int main(int argc, char** argv){ if(argc <3){ cerr<<"Usage: ./main <path/to/target/config/file> <path/to/target/src/dir>"<<endl; cerr<<"or"<<endl; cerr<<"Usage: ./main -f <path/to/predefined/config-name/file> <path/to/target/src/dir>"<<endl; return 0; } std::vector<std::string> vec_options; vec_options.clear(); if( argc == 4 /*&& argv[1] == "-f"*/){ readOptions( vec_options, argv[2]); //从option-name.txt中读入配置名 } else{ //通过augeaus程序分析配置文件得到配置名 std::string conf_file_path = string(argv[1]); if( confilter(conf_file_path) == -1){ cerr<<"filter the option name in Config file failed"<<endl; return -1; } readOptions(vec_options, "./conf_list.dat"); } //先对每个配置项生成字典,计算熵,确定权重,具体每个词单独的字典匹配使用时再生成 std::map< std::string, double > entropy_dict; entropy_dict.clear(); calcEntropy(vec_options, entropy_dict); printf("options size : %d\n", vec_options.size()); // for(int i =0; i< vec_options.size(); i++){ // printf("%s\n", vec_options[i].c_str()); // } // for( std::map<string, double>::iterator ite=entropy_dict.begin(); ite!=entropy_dict.end(); ite++){ // printf("%s %lf\n", ite->first.c_str(), ite->second); // } vector<string> file_v; if(argc == 3) traverseDir(argv[2], file_v); else if( argc == 4) traverseDir(argv[3], file_v); printf("file_v size : %d\n", file_v.size()); string targetfile = findTargetFile(file_v, vec_options); //如果stack太小会出现cannot access to variable ...的错误 if( targetfile == ""){ cerr<<"Don't find any targetfile to analyze!"<<endl; return -1; } analyzeTargetFile(targetfile, vec_options, entropy_dict); }
MyView::MyView( TQWidget *parent, const char *name ) : TQLabel( parent, name ) { setBackgroundMode( X11ParentRelative ); openTasks=0; TDEAction *saveDecrypt=new TDEAction(i18n("&Decrypt && Save File"),"decrypted",0,TQT_TQOBJECT(this), TQT_SLOT(decryptDroppedFile()),TQT_TQOBJECT(this),"decrypt_file"); TDEAction *showDecrypt=new TDEAction(i18n("&Show Decrypted File"),"edit",0,TQT_TQOBJECT(this), TQT_SLOT(showDroppedFile()),TQT_TQOBJECT(this),"show_file"); TDEAction *encrypt=new TDEAction(i18n("&Encrypt File"),"encrypted",0,TQT_TQOBJECT(this), TQT_SLOT(encryptDroppedFile()),TQT_TQOBJECT(this),"encrypt_file"); TDEAction *sign=new TDEAction(i18n("&Sign File"), "signature",0,TQT_TQOBJECT(this), TQT_SLOT(signDroppedFile()),TQT_TQOBJECT(this),"sign_file"); //TQToolTip::add(this,i18n("KGpg drag & drop encryption applet")); readOptions(); resize(24,24); setPixmap( KSystemTray::loadIcon("kgpg_docked")); setAcceptDrops(true); droppopup=new TQPopupMenu(); showDecrypt->plug(droppopup); saveDecrypt->plug(droppopup); udroppopup=new TQPopupMenu(); encrypt->plug(udroppopup); sign->plug(udroppopup); TQToolTip::add(this, i18n("KGpg - encryption tool")); }
Plot3D::Plot3D(Kernel &k, const Tuple &cmd) : k(k) { spacetype = FLAT_SPACE; var expr = cmd[1]; var xrange = cmd[2]; var yrange = cmd[3]; var xparam = xrange.tuple()[1]; var yparam = yrange.tuple()[1]; xmin = toD(N(k, k.eval(xrange.tuple()[2])).object()); xmax = toD(N(k, k.eval(xrange.tuple()[3])).object()); ymin = toD(N(k, k.eval(yrange.tuple()[2])).object()); ymax = toD(N(k, k.eval(yrange.tuple()[3])).object()); if (cmd[cmd.size - 1].isTuple(SYS(Optional))) { var opts = cmd[cmd.size - 1]; readOptions(opts.tuple()); } sur = new Surface*[1]; surnum = 1; F2P *f3d = new F2P(k, expr, xparam, yparam); sur[0] = new Surface(f3d, xmin, xmax, ymin, ymax); delete f3d; zmin = sur[0]->zmin; zmax = sur[0]->zmax; for (int i = 1; i < surnum; i++) { if (sur[i]->zmin < zmin) zmin = sur[i]->zmin; if (sur[i]->zmax > zmax) zmax = sur[i]->zmax; } }
int main(int argc, char **argv) { int *intarray= NULL; int numInts; int checkEvery= MAXint; int curlong, totlong; int traceLevel= 4; /* 4 normally, no tracing since qset does not log. 5 for memory tracing */ readOptions(argc, argv, prompt, &numInts, &checkEvery, &traceLevel); setupMemory(traceLevel, numInts, &intarray); testSetappendSettruncate(numInts, intarray, checkEvery); testSetdelSetadd(numInts, intarray, checkEvery); testSetappendSet(numInts, intarray, checkEvery); testSetcompactCopy(numInts, intarray, checkEvery); testSetequalInEtc(numInts, intarray, checkEvery); testSettemp(numInts, intarray, checkEvery); testSetlastEtc(numInts, intarray, checkEvery); testSetdelsortedEtc(numInts, intarray, checkEvery); printf("\n\nNot testing qh_setduplicate and qh_setfree2.\n These routines use heap-allocated set contents. See qhull tests.\n"); qh_memstatistics(stdout); qh_memfreeshort(&curlong, &totlong); if (curlong || totlong){ qh_fprintf(stderr, 8043, "qh_memfreeshort: did not free %d bytes of long memory(%d pieces)\n", totlong, curlong); error_count++; } if(error_count){ qh_fprintf(stderr, 8012, "testqset: %d errors\n\n", error_count); exit(1); }else{ printf("testqset: OK\n\n"); } return 0; }/*main*/
int main(int argc,char **argv) { FILE *inFD,*outFD; fastqp seq = fq_alloc(1024); // number pulled out of thin air int seqlen,okay,ind; ind = readOptions(argc,argv); fprintf(stderr,"in: '%s'\n",argv[ind]); fprintf(stderr,"out: '%s'\n",argv[ind+1]); inFD = fopen(argv[ind],"r"); outFD = fopen(argv[ind+1],"w"); // first find out seq length okay = fq_next(seq,inFD); seqlen = strlen(seq->data); while (okay) { if (convert) { illumina2phred(seq->qual,seqlen); } else { fixOffset(seq->qual,seqlen); } fq_fastq(seq,outFD); okay = fq_next(seq,inFD); } fclose(inFD); fclose(outFD); return 0; }
void CommandOptions::OnShow(wxShowEvent& event) { if (event.IsShown()) { readOptions(); return; } storeOptions(); }
void initialize_keymappings(struct config *C) { //Load default keymappings first. default_keymappings( C ); //Override anything the user has set. readOptions( BINDING_CFG, controllerOptions, sizeof(controllerOptions)/sizeof(controllerOptions[0]), true ); }
KMouthApp::KMouthApp(QWidget* , const char* name): KXmlGuiWindow(0) { setObjectName(QLatin1String(name)); isConfigured = false; config = KGlobal::config(); /////////////////////////////////////////////////////////////////// // call inits to invoke all other construction parts initStatusBar(); initPhraseList(); initActions(); optionsDialog = new OptionsDialog(this); connect(optionsDialog, SIGNAL(configurationChanged()), this, SLOT(slotConfigurationChanged())); connect(optionsDialog, SIGNAL(configurationChanged()), phraseList, SLOT(configureCompletion())); phrases = new KActionCollection(static_cast<QWidget*>(this)); readOptions(); ConfigWizard *wizard = new ConfigWizard(this, config.data()); if (wizard->configurationNeeded()) { if (wizard->requestConfiguration()) { isConfigured = true; saveOptions(); wizard->saveConfig(); readOptions(); } else isConfigured = false; } else isConfigured = true; delete wizard; if (isConfigured) { phraseList->configureCompletion(); } /////////////////////////////////////////////////////////////////// // disable actions at startup fileSaveAs->setEnabled(false); filePrint->setEnabled(false); printer = 0; }
static void checkOptions(CSOUND *csound) { const char *csrcname; const char *home_dir; FILE *csrc = NULL; void *fd = NULL; char *s; /* IV - Feb 17 2005 */ csrcname = csoundGetEnv(csound, "CSOUND6RC"); if (csrcname != NULL && csrcname[0] != '\0') { fd = csound->FileOpen2(csound, &csrc, CSFILE_STD, csrcname, "r", NULL, CSFTYPE_OPTIONS, 0); if (fd == NULL) csoundMessage(csound, Str("WARNING: cannot open csound6rc file %s\n"), csrcname); else csound->Message(csound, Str("Reading options from $CSOUND6RC: %s \n"), csrcname); } if (fd == NULL && ((home_dir = csoundGetEnv(csound, "HOME")) != NULL && home_dir[0] != '\0')) { s = csoundConcatenatePaths(csound, home_dir, ".csound6rc"); fd = csound->FileOpen2(csound, &csrc, CSFILE_STD, s, "r", NULL, CSFTYPE_OPTIONS, 0); if (fd != NULL) csound->Message(csound, Str("Reading options from $HOME/.csound6rc\n")); csound->Free(csound, s); } /* read global .csound6rc file (if exists) */ if (fd != NULL) { readOptions(csound, csrc, 0); csound->FileClose(csound, fd); } /* check for .csound6rc in current directory */ fd = csound->FileOpen2(csound, &csrc, CSFILE_STD, ".csound6rc", "r", NULL, CSFTYPE_OPTIONS, 0); if (fd != NULL) { readOptions(csound, csrc, 0); csound->Message(csound, Str("Reading options from local directory .csound6rc \n")); csound->FileClose(csound, fd); } }
KVerbosApp::KVerbosApp(QWidget* , const char* name):KMainWindow (0, name) { // als erstes das Logo starten KStartupLogo* start_logo = new KStartupLogo(0); start_logo->show(); start_logo->raise(); // die Instanzen von kverbos zählen kverbosCounter++; config=kapp->config(); /////////////////////////////////////////////////////////////////// // call inits to invoke all other construction parts initStatusBar(); initActions(); initDocument(); initView(); readOptions(); /////////////////////////////////////////////////////////////////// // disable actions at startup // Mir ist nicht klar, warum die Autoren des Frameworks diese // Menuoptionen deaktivieren. // Ich werde hier jedenfalls gleich einmal einige auskommentieren. // fileSave->setEnabled(false); // fileSaveAs->setEnabled(false); filePrint->setEnabled(false); editCut->setEnabled(false); editCopy->setEnabled(false); editPaste->setEnabled(false); userResults->setEnabled(false); // El programa ha leído las opciones del programa. Entonces puedo iniciar el objeto // por la control de KFeeder. if (useKFeeder) { kfeederControl = new KFeederControl(kverbosCounter, showKFeederSplash, automaticKFeeder); useKFeeder = kfeederControl->isActive(); if (!useKFeeder) { // the KFeeder didn't start so it isn't installed. Delete the control object delete kfeederControl; kfeederControl = 0; }; } else kfeederControl = 0; // das Logo wieder löschen delete start_logo; }
ParametricRegionPlot::ParametricRegionPlot(var cmd) { var expr = At(cmd, 0); var urange = At(cmd, 1); var vrange = At(cmd, 2); int len = Size(cmd); if (ExQ(At(cmd, len - 1), TAG(Options))) { var opts = Body((At(cmd, len - 1))); readOptions(opts); } var uparam = At(urange, 0); umin = N::D(Evalf(At(urange, 1))); umax = N::D(Evalf(At(urange, 2))); var vparam = At(vrange, 0); vmin = N::D(Evalf(At(vrange, 1))); vmax = N::D(Evalf(At(vrange, 2))); if (VecQ(At(expr, 0))) { polynum = Size(expr); polys = new IndexedQuadArray*[polynum]; for (int i = 0; i < polynum; i++) { var funs = At(expr, i); F2P *fx = new F2P(At(funs, 0), uparam, vparam); F2P *fy = new F2P(At(funs, 1), uparam, vparam); polys[i] = (IndexedQuadArray*)(new ParametricRegion(fx, fy, umin, umax, vmin, vmax)); delete fx; delete fy; } } else { polynum = 1; polys = new IndexedQuadArray*[1]; var funs = expr; F2P *fx = new F2P(At(funs, 0), uparam, vparam); F2P *fy = new F2P(At(funs, 1), uparam, vparam); polys[0] = (IndexedQuadArray*)(new ParametricRegion(fx, fy, umin, umax, vmin, vmax)); delete fx; delete fy; } xmin = polys[0]->xmin; xmax = polys[0]->xmax; ymin = polys[0]->ymin; ymax = polys[0]->ymax; for (int i = 1; i < polynum; i++) { if (polys[i]->ymin < ymin) ymin = polys[i]->ymin; if (polys[i]->ymax > ymax) ymax = polys[i]->ymax; if (polys[i]->xmin < xmin) xmin = polys[i]->xmin; if (polys[i]->xmax > xmax) xmax = polys[i]->xmax; } }
void Initialize() { char path[BUFFER]; struct tm sys_date; time_t date; time(&date); sys_date = *localtime(&date); quiet = 0; X = 5; no_database = 'n'; path[0] = '\0'; #ifdef _WIN32 strncpy(path, getenv("PROGRAMFILES"), BUFFER); strncat(path, "\\giortes", BUFFER-strlen(path)); strncpy(database, path, BUFFER); #else strncpy(path, getenv("HOME"), BUFFER); strncat(path, "/.giortes", BUFFER-strlen(path)); #endif strncpy(personal, path, BUFFER); strncpy(internat, path, BUFFER); strncpy(settings, path, BUFFER); #ifdef _WIN32 strncat(database, "\\database.dat", BUFFER-strlen(database)); strncat(personal, "\\personal.txt", BUFFER-strlen(personal)); strncat(internat, "\\int_days.txt", BUFFER-strlen(internat)); strncat(settings, "\\settings.txt", BUFFER-strlen(settings)); #else strncpy(database, DATADIR"/database.dat", BUFFER); strncat(personal, "/personal.txt", BUFFER-strlen(personal)); strncat(internat, "/int_days.txt", BUFFER-strlen(internat)); strncat(settings, "/settings.txt", BUFFER-strlen(settings)); #endif current_year = sys_date.tm_year+1900; current_day = sys_date.tm_mday; current_month = sys_date.tm_mon + 1; setTomorrow(); easter(current_year); #ifndef NO_GUI auto_close_flag=0; auto_close=30; #endif readOptions(path); }
void KBattleshipWindow::init() { m_aiPlaying = false; m_placeable = false; m_shootable = false; m_serverHasClient = false; m_config = kapp->config(); initStatusBar(); initActions(); readOptions(); initView(); initChat(); initShipPlacing(); parseCommandLine(); }
KgpgApp::KgpgApp(TQWidget *parent, const char *name, WFlags f,TDEShortcut goHome,bool mainWindow):TDEMainWindow(parent, name,f) { isMainWindow=mainWindow; textEncoding=TQString(); readOptions(); goDefaultKey=goHome; // call inits to invoke all other construction parts initActions(); initView(); slotSetFont(KGpgSettings::font()); setupGUI(( ToolBar | Keys | StatusBar | Save | Create ), "kgpg.rc"); setAutoSaveSettings("Editor",true); }
int main(int argc, char *argv[]){ epoch = 0; readOptions(argc,argv); if (0 == epoch){ fprintf(stderr,"[ERROR] missing required argument epoch \n"); usage(); } if (quiet){ printf("%s\n",ctime(&epoch)); } else { printf("%s %d\n",ctime(&epoch),(unsigned int) epoch); } return(0); }
void RSWalkModule2014::initSpecificModule() { std::string config_path = memory_->data_path_; //config_path += "config/rswalk2014/"; //change this to rs config, in data/config/rswalk2014 -Ruohan // For RSWalk generator = new WalkEnginePreProcessor(); config_path = memory_->data_path_; config_path += "config/rswalk2014"; clipper = new ClippedGenerator((Generator*) new DistributedGenerator(config_path)); readOptions(config_path); standing = false; prev_command = WalkRequestBlock::NONE; target_walk_active = false; x_target = -1; y_target = -1; wasKicking = false; GyroConfig config; if(config.loadFromFile("gyro_calibration.txt")){ offsetX = config.offsetX; offsetY = config.offsetY; calibration_write_time = config.calibration_write_time; } }
KstApp::KstApp(QWidget *parent, const char* name) : KMainWindow(parent, name) { clearWFlags(WDestructiveClose); stopping = false; config = kapp->config(); initStatusBar(); initDocument(); initView(); /* create dialogs */ debugDialog = new KstDebugDialogI(this); plotDialog = new KstPlotDialogI(doc, this); dataManager = new KstDataManagerI(doc, this); filterListEditor = new FilterListEditor(this); viewScalarsDialog = new KstViewScalarsDialogI(this); viewVectorsDialog = new KstViewVectorsDialogI(this); changeFileDialog = new KstChangeFileDialogI(this); changeNptsDialog = new KstChangeNptsDialogI(this); quickCurvesDialog = new KstQuickCurvesDialogI(this); quickPSDDialog = new KstQuickPSDDialogI(this); graphFileDialog = new KstGraphFileDialogI(this); vectorSaveDialog = new VectorSaveDialog(this); connect(KstVectorDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstCurveDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstEqDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstHsDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstPsdDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstPluginDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstEventMonitorI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); initActions(); readOptions(); _updateThread = new UpdateThread(doc); _updateThread->setUpdateTime(KstSettings::globalSettings()->plotUpdateTimer); _updateThread->start(); connect(doc, SIGNAL(newFrameMsg(int)), this, SLOT(slotUpdateFrameMsg(int))); connect(view, SIGNAL(newStatusMsg(const QString &)), this, SLOT(slotUpdateStatusMsg(const QString &))); connect(view, SIGNAL(newDataMsg(const QString &)), this, SLOT(slotUpdateDataMsg(const QString &))); /*** Plot Dialog signals */ connect(changeFileDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(changeNptsDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(quickCurvesDialog,SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(quickPSDDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(filterListEditor, SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(graphFileDialog, SIGNAL(graphFileReq(const QString &,int,int)), view, SLOT(printToGraphicsFile(const QString &,int,int))); /*** label dialog ***/ connect(view->labelDialog, SIGNAL(applied()), this, SLOT(registerDocChange())); /*** plot dialog ***/ connect(plotDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange())); /*** ***/ connect(doc, SIGNAL(dataChanged()), this, SLOT(updateDialogs())); connect(dataManager, SIGNAL(editDataVector(const QString &)), KstVectorDialogI::globalInstance(), SLOT(show_I(const QString &))); connect(dataManager->OpenPlotDialog, SIGNAL(clicked()), this, SLOT(showPlotDialog())); setAutoSaveSettings("KST-KMainWindow", true); _dcopIface = new KstIfaceImpl(doc, this); view->forceUpdate(); connect(this, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged())); QTimer::singleShot(0, this, SLOT(updateActions())); // Load any extensions ExtensionMgr *mgr = ExtensionMgr::self(); mgr->setWindow(this); KService::List sl = KServiceType::offers("Kst Extension"); for (KService::List::ConstIterator it = sl.begin(); it != sl.end(); ++it) { KService::Ptr service = *it; QString name = service->property("Name").toString(); if (!mgr->enabled(name) && !service->property("X-Kst-Enabled").toBool()) { continue; } mgr->loadExtension(service); } }
int main(int argc, char **argv) { Timerx timer; if(argc != 5) { cerr << "Syntax error. You must provide all these parameters: " << argv[0] << " matcheds_folder calibration_file options_file use_prior (0|1)" << endl; return -1; } char* folder = argv[1]; bool cost = atoi(argv[4]); Calibration calib = readCalibration(argv[2]); Options localopts = readOptions(argv[3]); //Window creation int win_width = 800; int win_height = 800; RenderVO* renderer = new RenderVO("Visual Odometry", win_width, win_height); //matcheds files vector<string> files = getDirAsVector(folder); MatrixXd currentPose = MatrixXd::Identity(4, 4); bool quit = false; for(int i=0; i<files.size(); i++) { string current_file; current_file = string(folder) + "/" + files[i]; cout << current_file << endl; multiMatrix matches = readData(current_file.c_str(), cost); //estimate the current pose MatrixXd sol = backprojAVGSACOpt(matches.LC, matches.RC, matches.LP, matches.RP, calib, localopts); currentPose = currentPose * sol; cout << currentPose << endl; //adding new pose and landmarks renderer->addPose(currentPose, 1); //Showing images and rendering scene renderer->update(); //Detecting events int key = waitKey(5); switch(char(key)) { case 'p': int k2; do{ k2 = waitKey(-1); } while( (char(k2) != 'p') && (char(k2) != 'q') ); if(char(k2) == 'q') quit = true; break; case 'q': quit = true; } if(quit) break; } if(!quit) int key = waitKey(-1); delete renderer; return 0; }
void parseOptions(int argc, char *org_argv[], IObjContainer &ioc) { GetOpt opt; opt.opterr=0; int copt; std::string str0("null"); std::string str1; // std::vector<std::string> inputFilename; std::vector<std::string> outputFilename; // working with std::string is preferred std::vector<std::string> argv; for( int i=0 ; i < argc ; ++i) argv.push_back( org_argv[i] ); // read options from file? readOptions(argv); int sz=argv.size(); // printing is split, so remember bool isPrintTest=false; // getopt expects char*[]. char **pargv = new char* [sz+1] ; for( int i=0 ; i < sz ; ++i ) pargv[i] = const_cast<char*>(argv[i].c_str()); while( (copt = opt.getopt(sz, pargv, "f:p:t:v:<--cpu-time><--help><--post><--printTest>")) != -1 ) { if( opt.longOption > 0 ) str0=opt.longOption; if( opt.longOption && str0 == "--help" ) { Base::help(); // CellStatistics::help(); FD_interface::help(); InFile::help(); // Oper::help(); // OutFile::help(); QA::help(); // TimeControl::help(); exit(1); } if( opt.longOption && str0 == "--cpu-time" ) { isCPU_time=true; continue; } if( opt.longOption && str0 == "--post" ) { isPostProc=true; continue; } if( opt.longOption && str0 == "--printTest" ) { isPrintTest=true; continue; } switch ( copt ) { case 'f': ::NC_FILENAME = opt.optarg ; break; case 'p': ::NC_PATH = opt.optarg ; break; case 't': ::TABLE_PATH = opt.optarg ; break; default: // description(); break; } } // Note: pargv are pointers to argv items. std::vector<std::string> aargv; for( int i=opt.optind ; i < sz ; ++i) aargv.push_back( pargv[i] ); argv = aargv ; delete[] pargv ; // parse argv for instructions of making objects // and their linkage. Parse parse(argv); std::vector<std::vector<std::string> > linkList = parse.getLinkList(); if( isPrintTest ) parse.printList(); // exits // objects are created makeObject(linkList, ioc); // apply parameters to objects setObjProperties(linkList, ioc); linkObj(linkList, ioc); scanGdRelation(linkList, ioc); return ; }
int main(int argc, char ** argv) { // Initialise SDL if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) < 0) DIE("SDL_Init: %s", SDL_GetError()); GL_Init(); //Init SDL_TTF to print text to the screen... if ( TTF_Init() ) { fprintf( stderr, "Error initializing SDL_ttf!\n" ); exit ( 1 ); } S9xInitDisplay(argc, argv); // Configure snes9x #if CONF_GUI OssoInit(); // Hildon-games-wrapper initialization. #endif S9xLoadConfig(argc, argv); // Load config files and parse cmd line. readOptions(); #if CONF_GUI OssoConfig(); // Apply specific hildon-games config. #endif // S9x initialization S9xInitDisplay(argc, argv); S9xInitAudioOutput(); S9xInitInputDevices(); while(1) { S9xInit(); S9xReset(); char * rom = romSelector(); S9xSetRomFile(rom); free(rom); // Load rom and related files: state, unfreeze if needed loadRom(); resumeGame(); // Late initialization sprintf(String, "DrNokSnes - %s", Memory.ROMName); S9xSetTitle(String); S9xHacksLoadFile(Config.hacksFile); if (!S9xGraphicsInit()) DIE("S9xGraphicsInit failed"); S9xAudioOutputEnable(true); SDL_PauseAudio(0); S9xVideoReset(); Config.running = true; do { frameSync(); // May block, or set frameskip to true. S9xMainLoop(); // Does CPU things, renders if needed. pollEvents(); //Ouch that this is going here... updateBindingMessage(); } while (Config.running); S9xVideoReset(); S9xGraphicsDeinit(); // Save state Memory.SaveSRAM(S9xGetFilename(FILE_SRAM)); pauseGame(); Memory.Deinit(); S9xDeinitAPU(); } // Deinitialization S9xAudioOutputEnable(false); S9xDeinitInputDevices(); S9xDeinitAudioOutput(); S9xDeinitDisplay(); // Late deinitialization S9xUnloadConfig(); #if CONF_GUI OssoDeinit(); #endif SDL_Quit(); return 0; }
int main(int argc, char *argv[]) { bor_mesh3_t *mesh; size_t islen; FILE *outfile; bor_timer_t timer; readOptions(argc, argv); gsrm = svoGSRMNew(¶ms); printAttrs(); // open output file if (outfile_fn == NULL){ outfile = stdout; }else{ outfile = fopen(outfile_fn, "w"); if (outfile == NULL){ fprintf(stderr, "Can't open '%s' for writing!\n", outfile_fn); return -1; } } borTimerStart(&timer); borTimerStopAndPrintElapsed(&timer, stderr, " Reading input signals:\n"); borTimerStopAndPrintElapsed(&timer, stderr, " -- '%s'...\n", is_fn); islen = svoGSRMAddInputSignals(gsrm, is_fn); borTimerStopAndPrintElapsed(&timer, stderr, " -- Added %d input signals.\n", islen); fprintf(stderr, "\n"); if (svoGSRMRun(gsrm) == 0){ if (!no_postprocess) svoGSRMPostprocess(gsrm); borTimerStart(&timer); mesh = svoGSRMMesh(gsrm); borMesh3DumpSVT(mesh, outfile, "Result"); if (params.verbosity >= 2){ fprintf(stderr, "\n"); borTimerStopAndPrintElapsed(&timer, stderr, " Mesh dumped to '%s'.\n", (outfile == stdout ? "stdout" : outfile_fn)); } if (dump_triangles != NULL){ borMesh3DumpTriangles(mesh, dump_triangles); fclose(dump_triangles); if (params.verbosity >= 2){ borTimerStopAndPrintElapsed(&timer, stderr, " Mesh dumped as triangles into '%s'.\n", dump_triangles_fn); } } } svoGSRMDel(gsrm); // close output file if (outfile != stdout) fclose(outfile); return 0; }
KateMainWindow::KateMainWindow (KConfig *sconfig, const QString &sgroup) : KateMDI::MainWindow (0) { setObjectName((QString("__KateMainWindow#%1").arg(uniqueID)).toLatin1()); // first the very important id myID = uniqueID; uniqueID++; new KateMainWindowAdaptor( this ); m_dbusObjectPath = "/MainWindow/" + QString::number( myID ); QDBusConnection::sessionBus().registerObject( m_dbusObjectPath, this ); m_modignore = false; // here we go, set some usable default sizes if (!initialGeometrySet()) { int scnum = QApplication::desktop()->screenNumber(parentWidget()); QRect desk = QApplication::desktop()->screenGeometry(scnum); QSize size; // try to load size if (sconfig) { KConfigGroup cg( sconfig, sgroup ); size.setWidth (cg.readEntry( QString::fromLatin1("Width %1").arg(desk.width()), 0 )); size.setHeight (cg.readEntry( QString::fromLatin1("Height %1").arg(desk.height()), 0 )); } // if thats fails, try to reuse size if (size.isEmpty()) { // first try to reuse size known from current or last created main window ;=) if (KateApp::self()->mainWindows () > 0) { KateMainWindow *win = KateApp::self()->activeMainWindow (); if (!win) win = KateApp::self()->mainWindow (KateApp::self()->mainWindows () - 1); size = win->size(); } else // now fallback to hard defaults ;) { // first try global app config KConfigGroup cg( KGlobal::config(), "MainWindow" ); size.setWidth (cg.readEntry( QString::fromLatin1("Width %1").arg(desk.width()), 0 )); size.setHeight (cg.readEntry( QString::fromLatin1("Height %1").arg(desk.height()), 0 )); if (size.isEmpty()) size = QSize (qMin (700, desk.width()), qMin(480, desk.height())); } resize (size); } } // start session restore if needed startRestore (sconfig, sgroup); m_mainWindow = new Kate::MainWindow (this); // setup most important actions first, needed by setupMainWindow setupImportantActions (); // setup the most important widgets setupMainWindow(); // setup the actions setupActions(); setStandardToolBarMenuEnabled( true ); setXMLFile( "kateui.rc" ); createShellGUI ( true ); //kDebug() << "****************************************************************************" << sconfig; // register mainwindow in app KateApp::self()->addMainWindow (this); // enable plugin guis KatePluginManager::self()->enableAllPluginsGUI (this, sconfig); // caption update for (uint i = 0; i < KateDocManager::self()->documents(); i++) slotDocumentCreated (KateDocManager::self()->document(i)); connect(KateDocManager::self(), SIGNAL(documentCreated(KTextEditor::Document*)), this, SLOT(slotDocumentCreated(KTextEditor::Document*))); readOptions(); if (sconfig) m_viewManager->restoreViewConfiguration (KConfigGroup(sconfig, sgroup) ); finishRestore (); fileOpenRecent->loadEntries( KConfigGroup(sconfig, "Recent Files" ) ); setAcceptDrops(true); connect(KateSessionManager::self(), SIGNAL(sessionChanged()), this, SLOT(updateCaption())); connect(this,SIGNAL(sigShowPluginConfigPage(Kate::PluginConfigPageInterface *,uint)),this,SLOT(showPluginConfigPage(Kate::PluginConfigPageInterface *,uint))); }
int main(int argc,char **argv) { FILE *input,*good,*bad = NULL,*missing=NULL; Reader *input; Writer *good; fastap linker1,linker2; int ind,isFasta; int wantProgressMeter = 0; int cTrimmed=0,cUnTrimmed=0,cLinker=0,cQual=0; /* process the command-line options */ ind = readOptions(argc,argv); if (isatty(fileno(stderr))) { wantProgressMeter = 1; } /* check the linker file, read linkers */ if (!isFastaFile(argv[ind])) { fprintf(stderr,"linker file '%s' does not exist or does not appear to be a Fasta file.\n",argv[ind]); exit(-1); } linker1 = fa_alloc(LINELENGTH); linker2 = fa_alloc(LINELENGTH); getLinker(argv[ind],linker1,linker2); /* check that the input file looks good, get its type */ if (ind + 1 >= argc) { fprintf(stderr,USAGE); exit(-1); } if (!fileExists(argv[ind+1])) { fprintf(stderr,"input file '%s' does not exist (or some other error occurred).\n",argv[ind+1]); exit(-1); } input = bode::Reader::open(std::string(argv[ind+1])) /* if (isFastaFile(argv[ind+1])) { isFasta = 1; } else if (isFastqFile(argv[ind+1])) { isFasta = 0; } else { fprintf(stderr,"input file '%s' does not appear to be Fasta or Fastq.\n",argv[ind+1]); exit(-1); } input = fopen(argv[ind+1],"r"); */ /* check that output file doesn't exist, open it */ if (ind + 2 >= argc) { fprintf(stderr,USAGE); exit(-1); } if (fileExists(argv[ind+2]) && !overwrite) { fprintf(stderr,"output file '%s' exists, will not overwrite.\n",argv[ind+2]); exit(-1); } good = input->getWriter(); good = good->open(argv[ind+2],input->header()); /* missing linker output file */ /* if (missingLinkerOutputFile != NULL) { if (fileExists(missingLinkerOutputFile)) { fprintf(stderr,"missing linker output file '%s' exists, will not overwrite.\n",missingLinkerOutputFile); exit(-1); } missing = fopen(missingLinkerOutputFile,"w"); } */ /* set up the alignment stuff */ calignInit(LINELENGTH,2,-2,-6,-1); processFile(linker1,linker2,input,good,bad,missing,&cTrimmed,&cUnTrimmed,&cLinker,wantProgressMeter); fprintf(stdout,"trimmed=%d untrimmed=%d linker=%d lowqual=%d\n", cTrimmed,cUnTrimmed,cLinker,cQual); return 0; }
/** \brief Creates an object from a CFG file. Automatically calls readOptions. */ BenchmarkCFG (const char * filename) { readOptions(filename); }
void kpok::newRound() { bool onePlayerGame = false; m_game.newRound(); playerBox[0]->setHeldEnabled(false); if (m_numPlayers == 1) onePlayerGame = true; readOptions(); // maybe some options have changed so check em if (m_players[0].getCash() < m_game.getMinBet()) noMoney(); else { for (unsigned int i = 0; i < m_numPlayers; i++) { if (m_players[i].getCash() >= m_game.getMinBet()) m_game.activatePlayer(&m_players[i]); else removePlayerFromRound(&m_players[i]); } } if (m_game.getNumActivePlayers() == 1 && m_game.getType() != SinglePlayer) switchToOnePlayerRules(); m_blinkingBox = 0; wonLabel->hide(); stopBlinking(); stopWave(); for (int i = 0; i < m_game.getNumActivePlayers(); i++) m_game.getActivePlayer(i)->newRound(); // We are beginning a new round so every card is available. drawAllDecks(); playerBox[0]->showHelds(false); // Deal first cards of the round bool skip[PokerHandSize]; for (int i = 0; i < PokerHandSize; i++) skip[i] = false; for (int i = 0; i < m_game.getNumActivePlayers(); i++) drawCards(m_game.getActivePlayer(i), skip); if (m_game.getNumActivePlayers() > 1) { findHumanPlayer()->changeBet(m_game.getMinBet()); m_game.bet(m_game.getMinBet()); betBox->show(); } else { m_game.getActivePlayer(0)->changeBet(cashPerRound); betBox->hide(); } paintCash(); drawTimer->start(drawDelay, TRUE); }