예제 #1
0
int main(int argc, char * argv[])
{
   OFP::OFP_Traverse Module;
   
   if (argc < 2) {
      fprintf(stderr, "usage: traverse_sig filename\n");
      exit(-1);
   }

   FILE * file = fopen(argv[1], "r");
   if (file == NULL) {
      fprintf(stderr, "Failed to open file\n");
      exit(-1);
   }

   ATinitialize(argc, argv); 

   Module.term = ATreadFromTextFile(file);

   OFP::traverse_init();
   if (OFP::traverse_Module(Module.term, &Module)) {
      printf("\nWoot!\n");
   } else return 1;
   OFP::traverse_finalize();

   return 0;
}
예제 #2
0
파일: mcrl_open.c 프로젝트: jkeiren/muCRL
void CAESAR_INIT_GRAPH(void) {
    int argc;
    char **argv;
    char *FILENAME;
    char *OPTIONS;
    char *token;

    ATinitialize(0,NULL);
    ATsetWarningHandler(WarningHandler);
    ATsetErrorHandler(ErrorHandler);

    /* ATwarning ("Executing CAESAR_INIT_GRAPH"); */

    FILENAME = getenv ("OPEN_CAESAR_FILE");
    if (FILENAME == NULL)
        CAESAR_ERROR ("undefined environment variable $OPEN_CAESAR_FILE");

    OPTIONS = getenv ("MCRL_OPTIONS");
    if (OPTIONS == NULL)
        CAESAR_ERROR ("undefined environment variable $MCRL_OPTIONS");

#define MAX_OPTIONS 100

    argv = (char**)calloc(MAX_OPTIONS,sizeof(char*));
    argc = 0;
    argv[argc] = "mcrl_open";
    // ATwarning ("%d -> \"%s\"\n", argc, argv [argc]);
    argc ++;

    /* skip leading white spaces */
    while (*OPTIONS == ' ') OPTIONS++;
    token = strtok (OPTIONS, " ");
    while (1) {
        if (token == NULL) break;
        argv [argc] = token;
        // ATwarning ("%d -> \"%s\"\n", argc, argv [argc]);
        argc ++;
        token = strtok ((char *) NULL, " ");
    }

    argv [argc] = FILENAME;
    // ATwarning ("%d -> \"%s\"\n", argc, argv [argc]);
    argc ++;

    MCRLsetArguments(&argc, &argv);
    RWsetArguments(&argc,&argv);

    if (!MCRLinitialize())
        ATerror("%s cannot be opened\n",FILENAME);
    ATwarning("Opened %s",FILENAME);
    RWinitialize(MCRLgetAdt());
    LTSsetArguments(&argc,&argv);
    LTSinitialize(wrap_call_back);

    Label_set = ATindexedSetCreate(1024,75);
    /* ATwarning ("Leaving CAESAR_INIT_GRAPH"); */
}