/* * Here the fun begins */ int main(int argc, char **argv) { getOpts(argc, argv); init(); getOpts(argc, argv); if (!Batch) { printf("ArrowLISP "); printf(ALISP_RELEASE); printf(" (C) 2006 Nils M Holm\n"); } if (Image[0]) { if (alisp_load_image(Image)) { printf("* "); alisp_print_error(); if (Batch) exit(1); alisp_fini(); init(); getOpts(argc, argv); } } else if (!Batch) { printf("Warning: no image loaded\n"); } signal(SIGINT, catchIntr); repl(); alisp_fini(); return 0; }
int main(int argc, char ** argv){ char ops; unsigned int address; int size; Set *headSet = NULL; FILE *fp; getOpts(argc, argv); headSet = construction(); fp = fopen(fileTrace, "r"); if(fp == NULL){ exit(1); } /*read each line from log*/ while (fscanf(fp, " %c %x, %d\n", &ops, &address, &size) != EOF){ if(ops == 'M'){ search(headSet, address); numHits++; }else if(ops == 'L' || ops == 'S'){ search(headSet, address); } } freeAll(headSet); printSummary(numHits, numMiss, numEvic); fclose(fp); return 0; }
int MirandaSkinnedDialog::compile() { int ret = SkinnedDialog::compile(); if (ret == 2) { SkinOptions * opts = getOpts(); _ASSERT(opts != NULL); for(unsigned int i = 0; i < opts->getNumOptions(); ++i) { SkinOption *opt = opts->getOption(i); loadFromDB(opt); opt->setOnChangeCallback(&staticOnOptionChange, this); } for(unsigned int i = 0; i < getFieldCount(); ++i) { MirandaField *field = dynamic_cast<MirandaField *>(getField(i)); field->configure(); } fireOnSkinChanged(); } return ret; }
bool MirandaSkinnedDialog::finishedConfiguring() { updateFilename(); if (getDefaultState() == NULL || getOpts() == NULL) return false; return true; }
int main(int argc, char** argv) { getOpts(argc, argv); logMsg("Hello World!"); // 1 gz or 2 gz if (gz2_path == "NONE") { logMsg("single gz"); GZ gz(gz1_path, output_path); gz.testFunc(row_num, is_compress); } else { logMsg("double gz"); GZPair gzp(gz1_path, gz2_path, output_path); gzp.testFunc(row_num, is_compress); } return 0; }
int main(int argc, char **argv) { char *opt; int idx = 0; char buf[4096]; int debug = 0; int loop = 0; int result; int loops = 0; argc--; argv++; func_t func; if ((func=checkforTest(argv[0])) == NULL) { syntax(); } argc--; argv++; signal(SIGTERM, clean); signal(SIGQUIT, clean); signal(SIGINT, clean); while(idx < argc) { switch(getOpts("d:f:m:M:s:t:cr:n:b:DNPS:lL:R", argc, argv, &opt, &idx)) { case 'd': if ( opt) testDir = opt; else syntax(); break; case 'f': if ( opt) maxFile = atoi(opt); else syntax(); break; case 'n': if ( opt) numberOp = atoi(opt); else syntax(); break; case 't': if ( opt) totalSize = stoi(opt); else syntax(); break; case 'm': if ( opt) minSize = stoi(opt); else syntax();break; case 'M': if ( opt) maxSize = stoi(opt); else syntax();break; case 's': if ( opt) stepSize = sstoi(opt, &stepType); else syntax(); break; case 'b': if ( opt) rwBufSize = stoi(opt); else syntax(); break; case 'c': csv = 1; break; case 'r': remount = opt; break; case 'D': debug = 1; break; case 'N': createFileBefore=0;break; case 'P': printCreateTime=1;break; case 'S': if ( opt) doSleep=atoi(opt); else syntax();break; case 'l': loop = 1;break; case 'L': if ( opt) loops = atoi(opt); else syntax();break; case 'R': toNull = 1;break; default: printf("Wrong option\n");syntax(); } } if (maxFile <= 0 || testDir == NULL || maxSize <= 0 || rwBufSize < 1) { if ( debug ) { fprintf(stderr,"Error checking parameters:\n"); if ( maxFile <= 0 ) fprintf(stderr," maxFile = %d\n",maxFile); if ( testDir == NULL ) fprintf(stderr," testDir == NULL\n"); if ( maxSize <= 0 ) fprintf(stderr," maxSize = %d\n",maxSize); if ( rwBufSize < 1 ) fprintf(stderr," rwBufSize = %d\n",rwBufSize); } syntax(); } /* if test directory exist exit */ if ( access(testDir,W_OK) == 0 ) { fprintf(stderr,"Sorry <%s> exist\n", testDir); return 1; } if ( totalSize <= 0 ) { totalSize = maxSize * maxFile; } if ( stepSize <= 0 && minSize <= 0 ) { minSize = stepSize = maxSize; } if ( loop ) { result = 1; while((result=func())) if ( killed ) break; /* at this stage we may have to make some cleanup */ deleteTestDir(1); /* delete also sourcefile and sourcefile_* within the actual directory */ deleteSourceFiles(); } else if ( loops ) { result = 1; while((result=func()) && --loops > 0) if ( killed ) { /* at this stage we may have to make some cleanup */ deleteTestDir(1); /* delete also sourcefile and sourcefile_* within the actual directory */ deleteSourceFiles(); break; } } else { result = func(); } return result == 1 ? 0 : 1; }
int main(int argc, const char *argv[]) { AppOptions *args = getOpts(argc, argv); generate(args->inputPath, args->outputPath); free(args); exit(0); }
/*********************************************************************** * Main program for the Compiler **********************************************************************/ int main (int argc, char *argv[]) { getOpts (argc, argv); /* Set up and apply command line options */ /*********************************************************************** * Compiler Initialization. * * If explicit initialization of any phase of the compilation is needed, * calls to initialization routines in the applicable modules are placed * here. **********************************************************************/ errorOccurred = FALSE; /*********************************************************************** * Start the Compilation **********************************************************************/ if (dumpSource) sourceDump(); /* Phase 1: Scanner. In phase 2 and after, the following code should be * removed */ while (yylex()) if (errorOccurred) break; /* Phase 2: Parser -- should allocate an AST, storing the reference in the * global variable "ast", and build the AST there. */ yyparse(); /* Phase 3: Call the AST dumping routine if requested */ // if (dumpAST) // printAST(ast); /* Phase 4: Add code to call the code generation routine */ /* TODO: call your code generation routine here */ // if (errorOccurred) // fprintf(outputFile,"Failed to compile\n"); // else // genCode(ast); /*********************************************************************** * Post Compilation Cleanup **********************************************************************/ /* Make calls to any cleanup or finalization routines here. */ // freeAST(ast); /* Clean up files if necessary */ if (inputFile != DEFAULT_INPUT_FILE) fclose (inputFile); if (errorFile != DEFAULT_ERROR_FILE) fclose (errorFile); if (dumpFile != DEFAULT_DUMP_FILE) fclose (dumpFile); if (traceFile != DEFAULT_TRACE_FILE) fclose (traceFile); if (outputFile != DEFAULT_OUTPUT_FILE) fclose (outputFile); if (runInputFile != DEFAULT_RUN_INPUT_FILE) fclose (runInputFile); return 0; }