/*** MAIN LOOP ***/ int main(int argc, char *argv[]) { #if DEBUG bmem = AvailMem( MEMF_PUBLIC ); #endif ParseArgs(&args, argc, argv); /* Look first if Jano isn't already running */ if( find_janoed( &args ) ) cleanup(0, RETURN_OK); /* Some global initialization */ init_searchtable(); /* Optionnal libraries */ AslBase = (struct Library *) OpenLibrary("asl.library", 36); LocaleBase = (struct LocaleBase *) OpenLibrary("locale.library", 38); DiskfontBase = (struct Library *) OpenLibrary("diskfont.library", 0); IFFParseBase = (struct Library *) OpenLibrary("iffparse.library",36); if(LocaleBase) InitLocale(); /* Localize the prog */ /* Open the required ROM libraries */ if( (IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 36)) && (GfxBase = (struct GfxBase *) OpenLibrary("graphics.library", 36)) && (GadToolsBase = (struct Library *) OpenLibrary("gadtools.library", 36)) && (KeymapBase = (struct Library *) OpenLibrary("keymap.library", 36)) && (UtilityBase = (struct UtilityBase *) OpenLibrary("utility.library", 36)) ) { init_macros(); set_default_prefs(&prefs, IntuitionBase->ActiveScreen); load_prefs(&prefs, NULL); /* See if it exists a config file */ sigport = create_port(); /* Create whether an empty project or an existing one */ if( ( edit = create_projects(NULL, args.sa_ArgLst, args.sa_NbArgs) ) ) { /* Open the main interface */ if(setup() == 0) { /* Makes edit project visible */ reshape_panel(edit); active_project(edit,TRUE); clear_brcorner(); dispatch_events(); } else cleanup(ErrMsg(ERR_NOGUI), RETURN_FAIL); } } else cleanup(ErrMsg(ERR_BADOS), RETURN_FAIL); /* Hope that all were well... */ cleanup(0, RETURN_OK); return 0; }
int main(int argc, char *argv[]) { int rc; afs_status_t st = 0; struct rx_connection *conn; char *srvrName; long srvrPort; void *cellHandle; afs_CMCellName_t cellName; ParseArgs(argc, argv, &srvrName, &srvrPort); rc = afsclient_Init(&st); if (!rc) { fprintf(stderr, "afsclient_Init, status %d\n", st); exit(1); } rc = afsclient_NullCellOpen(&cellHandle, &st); if (!rc) { fprintf(stderr, "afsclient_NullCellsOpen, status %d\n", st); exit(1); } rc = afsclient_CMStatOpenPort(cellHandle, srvrName, srvrPort, &conn, &st); if (!rc) { fprintf(stderr, "afsclient_CMStatOpenPort, status %d\n", st); exit(1); } rc = util_CMLocalCell(conn, cellName, &st); if (!rc) { fprintf(stderr, "util_CMLocalCell, status %d\n", st); exit(1); } rc = afsclient_CMStatClose(conn, &st); if (!rc) { fprintf(stderr, "afsclient_CMStatClose, status %d\n", st); exit(1); } rc = afsclient_CellClose(cellHandle, &st); if (!rc) { fprintf(stderr, "afsclient_CellClose, status %d\n", st); exit(1); } printf("\n"); printf("Client %s (port %ld) is in cell %s\n", srvrName, srvrPort, cellName); printf("\n"); exit(0); }
MStatus CheckMeshCmd::doIt(const MArgList& args) { MStatus status = ParseArgs(args); if (status != MS::kSuccess) { std::cerr << "Invalid argument.\n"; return status; } auto mode_function = mode_function_map_[mode_.asChar()]; return (this->*mode_function)(); }
static char *xi18n_getIMValues(XIMS ims, XIMArg *args) { Xi18n i18n_core = ims->protocol; char *ret; if ((ret = ParseArgs(i18n_core, I18N_GET, args)) != NULL) return ret; /*endif*/ return NULL; }
int main( int argc, char* argv[] ) { DWORD dwError = 0; handle_t bindingHandle = 0; HANDLE hEventLog = 0; PSTR pszBindingString = NULL; DWORD eventTableCategoryId = (DWORD) -1; PSTR pszFilename = NULL; evt_init_logging_to_file(LOG_LEVEL_VERBOSE, ""); dwError = ParseArgs(argc, argv, &pszFilename, &eventTableCategoryId); BAIL_ON_EVT_ERROR(dwError); if (IsNullOrEmptyString(pszFilename)) { EVT_LOG_ERROR("No path to the file containing events was specified."); ShowUsage(); BAIL_ON_EVT_ERROR((dwError = EINVAL)); } TRY { dwError = LWIOpenEventLog(&bindingHandle, &hEventLog, &pszBindingString, "127.0.0.1", "127.0.0.1"); BAIL_ON_EVT_ERROR(dwError); dwError = ParseAndAddEvents(bindingHandle, hEventLog, pszFilename, eventTableCategoryId, AddEventRecord); BAIL_ON_EVT_ERROR(dwError); } CATCH_ALL { exc_get_status (THIS_CATCH, &dwError); EVT_LOG_ERROR("Unexpected error . Error code [%d]\n", dwError); BAIL_ON_EVT_ERROR(dwError); } ENDTRY; error: if (bindingHandle && hEventLog && pszBindingString) LWICloseEventLog(bindingHandle, hEventLog, pszBindingString); if(dwError != 0) { EVT_LOG_ERROR("Failed to import events. Error code [%d]\n", dwError); } return dwError; }
EventRecord::EventRecord(long idEvent, long msec, long idCmd, ArgMMap mmArgs, Template * pTemplate, vector<InputDevPtr> vpDev) : Event(idEvent, msec, idCmd, mmArgs, pTemplate) { g_pErr->DFI("EventRecord::EventRecord", idEvent, 3); //m_pDev = pDev; m_vpDev = vpDev; ParseArgs(mmArgs); g_pErr->DFO("EventRecord::EventRecord", idEvent, 3); }
void qCtx::ParseArgsQmap(qStr *in, qArgAry *out, const char *qmap) { bool quot = false; bool more = true; // bool trim = true; // char quoted = '\x0'; // int qcnt = 0; char c; // int acnt = 0; if (!qmap) { ParseArgs(in, out); return; } char qmode = *qmap == 'A' ? '1' : *qmap == '1' ? '1' : '0'; if (*qmap != 'A' ) ++qmap; do { qStrBuf cur; while ( isspace((c = in->GetC())) ); if (c == T_SQ) { quot = true; c = in->GetC(); } else { quot = false; } if (qmode == '1' || quot) { more = ParseArgQuoted(in, cur, c); } else { more = ParseArg(in, cur, c); } out->Add(cur); out->SetQuot(out->Count()-1,quot); if (*qmap) { if (*qmap == '1') { qmode = '1'; ++qmap; } else if (*qmap == '0') { qmode = '0'; ++qmap; } } else { qmode = '0'; } } while (more && c != EOF); }
int main(int argc, const char *argv[]) { ParseArgs(argc, argv); if (cmdsOnly) { /* We make this a special case to avoid messing up other code. */ CreateBootCmds(); FinishBootCmds(); SendToDevice(&boot_cmds_packet->data[SIZE_OF_HEADER],SIZE_OF_BOOT_CMDS); exit(EXIT_SUCCESS); } if (netBoot && !toFiles) { /* Do not bother with this if we just want to write the packets to files. Means you do not have to be root to run --tofiles. */ net_init(); } else if (serBoot) { if (!SetupSerial()) { exit(0); } } CreateBootLoader(); CreateBootCmds(); FinishBootCmds(); printf("Starting boot...\n"); if (doing_flash) { printf("We're doing a flash write, this may take up to a few minutes...\n"); } if (toFiles) { udword seq = 0; struct packet_buf *p; while((p = create_packet(seq++))) { SendToDevice(p->data, p->size); } exit(EXIT_SUCCESS); } if (netBoot) { NetBoot(); } else if (serBoot) { SerBoot(); } printf("Done.\n"); return EXIT_SUCCESS; } /* main */
EventRecord::EventRecord(long idEvent, long msec, long idCmd, ArgMMap mmArgs, Template * pTemplate, InputDevPtr pDev) : Event(idEvent, msec, idCmd, mmArgs, pTemplate) { g_pErr->DFI("EventRecord::EventRecord", idEvent, 3); m_vpDev.push_back(pDev); ParseArgs(mmArgs); g_pErr->DFO("EventRecord::EventRecord", idEvent, 3); }
int main(int argc, char *argv[]) { int rc; afs_status_t st = 0; rxdebugHandle_p handle; char *srvrName; long srvrPort; afs_uint32 supported; ParseArgs(argc, argv, &srvrName, &srvrPort); rc = afsclient_Init(&st); if (!rc) { fprintf(stderr, "afsclient_Init, status %d\n", st); exit(1); } rc = afsclient_RXDebugOpenPort(srvrName, srvrPort, &handle, &st); if (!rc) { fprintf(stderr, "afsclient_RXDebugOpenPort, status %d\n", st); exit(1); } rc = util_RXDebugSupportedStats(handle, &supported, &st); if (!rc) { fprintf(stderr, "util_RXDebugSupportedStats, status %d\n", st); exit(1); } rc = afsclient_RXDebugClose(handle, &st); if (!rc) { fprintf(stderr, "afsclient_RXDebugClose, status %d\n", st); exit(1); } printf("\n"); printf("security stats: %s supported\n", (supported & RX_SERVER_DEBUG_SEC_STATS) ? "" : " not"); printf("all connections:%s supported\n", (supported & RX_SERVER_DEBUG_ALL_CONN) ? "" : " not"); printf("rx stats: %s supported\n", (supported & RX_SERVER_DEBUG_RX_STATS) ? "" : " not"); printf("waiter count: %s supported\n", (supported & RX_SERVER_DEBUG_WAITER_CNT) ? "" : " not"); printf("idle threads: %s supported\n", (supported & RX_SERVER_DEBUG_IDLE_THREADS) ? "" : " not"); printf("all peers: %s supported\n", (supported & RX_SERVER_DEBUG_ALL_PEER) ? "" : " not"); printf("\n"); exit(0); }
int main (int ac, char **av, char **envp) { list s; char **filename; int i_num_isl_files_processed = 0; int i_renaming_files = 0; if ((ProgramName = iluparser_GetProgramName(av[0])) == NULL) #if (defined(WIN32) && defined(_WINIO)) ProgramName = "wcppstub"; #else ProgramName = "c++-stubber"; #endif /* (defined(WIN32) && defined(_WINIO)) */ if (ac < 2) { PrintUsage(); return(1); } if (!ParseArgs (&ac, &av)) return(1); if (NamesFile != NULL) { if (!ReadSynonyms (NamesFile)) { fprintf (stderr, "Couldn't read names file %s.\n", NamesFile); return (1); }; }; if (StubsFile || HeaderFile || ClientCommonFile) i_renaming_files = 1; for (filename = av; *filename != NULL; filename += 1) { if (i_renaming_files && (i_num_isl_files_processed > 0)) { fprintf (stderr, "Can't use -sname -hname or -cname with more than 1 isl file.\n"); return(1); } if ((s = ParseFile (*filename)) == NULL) { fprintf (stderr, "Couldn't find or parse %s.\n", *filename); return (1); } list_enumerate (s, (iluparser_EnumProc) GenerateStubs, NULL); i_num_isl_files_processed++; } return(0); }
void StochasticGD<ParameterType, SampleType, LabelType, SparseGradientType, DenseGradientType>::InitFromCmd(int argc, const char *argv[]) { boost::program_options::options_description alloptions( "Available options for SGD optimizer"); alloptions.add(this->basedesc_); alloptions.add(this->sgdesc_); auto vm = ParseArgs(argc, argv, alloptions, true); this->learn_.learningrate_ = vm[kLearningRateOption].as<double>(); this->learn_.learningratedecay_ = vm[kLearningRateDecayOption].as<double>(); this->learn_.averge_ = vm[kAverageGradientOption].as<bool>(); }
int main(int argc, char *argv[]) { tArgsError err; if((err=ParseArgs(argc,argv))!=kArgsErrorNone) { Usage(err); return 1; } if(gPaddedText==kTrue) T2E2Padded(gSrcFile,gDstFileRoot); else T2E2Ragged(gSrcFile,gDstFileRoot); return 0; }
int main(int argc, char** argv) { Params p = ParseArgs(argc, argv); if (argc > 1) { std::ifstream fin; fin.open(argv[1]); parse(fin); } else { parse(std::cin); } return 0; }
int main(int argc, char **argv) { // Verify that the version of the library that we linked against is // compatible with the version of the headers we compiled against. GOOGLE_PROTOBUF_VERIFY_VERSION; ParseArgs(argc, argv); // read configuration file && apply it ft::Config::applyConfigFile(); // // make sure this process is singleton on the entire system // if (!singleton(ft::Config::singleton_lock_file().c_str())) { // fprintf(stderr, "%s is already state right now!\n", argv[0]); // ::abort(); // } // make this process to be a daemon process if (ft::Config::isDaemon()) { if (0 != daemon(0, 0)) { fprintf(stderr, "failed to call daemon(): %s\n", strerror(errno)); ::abort(); } } // init the action of logging ft::Config::initlog(); MainWork::instance()->init(); // { // ft::mysql::ConnectionGuard guard(ft::mysql::ConnectionPool::instance()); // std::shared_ptr<ft::mysql::Connection>& conn = guard.connection(); // const char* sql = "SELECT name, age, score FROM student ORDER BY score"; // std::string error; // sql::ResultSet* rs = conn->executeQuery(sql, error); // if (nullptr == rs) { // LogError << "Failed to execute sql: \"" << sql << "\", error: " << error; // } // LogInfo << "name\tage\tscore"; // while (rs->next()) { // LogInfo << rs->getString("name") << "\t" << rs->getInt("age") << "\t" << rs->getInt("score"); // } // } MainWork::instance()->start(); // Optional: Delete all global objects allocated by libprotobuf. google::protobuf::ShutdownProtobufLibrary(); return 0; }
ShadingImpl::ShadingImpl(DocWriterImpl& doc, Char const* pattern, ColorSpaceHandle cs, FunctionHandle const* fns, UInt num_functions) : IndirectObjectImpl(doc) , m_cs(cs) { // Indexed is not allowed for dictionaries with Function field. Shading // types supported now require Function field so indexed color space is // forbidden. if (is_pattern_color_space(cs) || (CS_INDEXED == color_space_type(cs))) throw exception_invalid_value(msg_shading_invalid_space()) << JAGLOC; m_function_handles.resize(num_functions); std::copy(fns, fns + num_functions, m_function_handles.begin()); try { ParsedResult const& p = parse_options(pattern, ParseArgs(&g_shading_keywords, &g_shading_values)); // common options matrix parse_array(p, SH_BBOX, m_bbox, true, 4); parse_array(p, SH_BACKGROUND, m_background); // shading type specific m_shading_type = p.explicit_value(); switch(m_shading_type) { case SHV_AXIAL: case SHV_RADIAL: parse_array(p, SH_COORDS, m_coords, false, m_shading_type==SHV_AXIAL ? 4 : 6); parse_array(p, SH_DOMAIN, m_domain, true, 2); if (parse_array(p, SH_EXTEND, m_extend, true, 2)) m_keys.set(BIT_EXTEND); break; case SHV_FUNCTION: parse_array(p, SH_MATRIX_FUN, m_matrix_fun, true, 6); parse_array(p, SH_DOMAIN, m_domain, true, 4); break; default: throw exception_invalid_value(msg_unknown_shading_type()) << JAGLOC; } } catch(exception const& exc) { throw exception_invalid_value(msg_invalid_shading_spec(), &exc) << JAGLOC; } }
int main (int argc, char * argv[]) { Measure height = Measure (&METER); Measure time = Measure (&SECOND); ParseArgs (argc, argv, &time); height = G * 0.5 * time.power (2); // d = 1/2 a t^2 cout << "At " << G.GetQuantity(); cout << " meters per second per second," << endl << "an object will fall "; cout << height.GetQuantity() << " meters in "; cout << time.GetQuantity() << " seconds." << endl; exit (0); }
void main( int argc, char **argv ) { long savings; foff buffsize; algorithm alg; if( !MsgInit() ) exit( EXIT_FAILURE ); alg = ParseArgs( argc, argv ); EndOld = FileSize( argv[1], &OldCorrection ); EndNew = FileSize( argv[2], &NewCorrection ); buffsize = ( EndOld > EndNew ) ? ( EndOld ) : ( EndNew ); buffsize += sizeof( PATCH_LEVEL ); OldFile = ReadIn( argv[1], buffsize, EndOld ); NewFile = ReadIn( argv[2], buffsize, EndNew ); ScanSyncString( SyncString ); switch( alg ) { case ALG_NOTHING: FindRegions(); break; #ifdef USE_DBGINFO case ALG_ONLY_NEW: case ALG_BOTH: SymbolicDiff( alg, argv[1], argv[2] ); break; #endif } if( NumHoles == 0 && DiffSize == 0 && EndOld == EndNew ) { printf( "Patch file not created - files are identical\n" ); MsgFini(); exit( EXIT_SUCCESS ); } MakeHoleArray(); SortHoleArray(); ProcessHoleArray( 0 ); savings = HolesToDiffs(); WritePatchFile( argv[3], newName ); FreeHoleArray(); VerifyCorrect( argv[2] ); print_stats( savings ); MsgFini(); exit( EXIT_SUCCESS ); }
int main(int argc, char* argv[]) { ClassFileAnalyzer analyzer; ParseArgs(argc, argv, analyzer); for (int i = 0; i < argc; ++i) { analyzer.analyzeClassFile(argv[i]); analyzer.WriteOutput(); } exit(0); }
int main(int argc, char** argv) { // default arguments autopilot_parms.SetIdeal(); if (!ParseArgs(argc, argv)) return 0; unsigned i = rand() % (NUM_WIND - 1) + 1; plan_tests(1); test_bestcruisetrack(1, i); return exit_status(); }
/** Executes a command * * @param args * * @return bool true on success; false on failure */ bool Execute() { if (!ParseArgs()) { return false; } if (verbose_) { printf("%s: Starting: numRxBytes=%u, numTxBytes=%u\n", args_[0], clientInfo_.numRxBytes, clientInfo_.numTxBytes); } cmdMgr_.Run(this); return true; } // Execute()
rc_t CC KMain(int argc, char *argv[]) { if ( ! ParseArgs ( argc, argv ) ) { RightUsage(); return 1; } if ( signal ( SIGINT, XTaskerSigIntHandler ) == SIG_ERR ) { printf ( "Can not instal signal handlers\n" ); return RC ( rcExe, rcFile, rcReading, rcParam, rcInvalid ); } return run ( NumThr, RunTime, FilePath, PathIsList ); }
int main(int argc, char** argv) { signal(SIGINT, &SigHandler); gArgc = argc; gArgv = argv; ParseArgs(gArgc, gArgv); //HackTest(); SetupScenario(); RunScene(); CleanUp(); }
bool CConsole::LineIsValid(const char *pStr) { if(!pStr || *pStr == 0) return false; do { CResult Result; const char *pEnd = pStr; const char *pNextPart = 0; int InString = 0; while(*pEnd) { if(*pEnd == '"') InString ^= 1; else if(*pEnd == '\\') // escape sequences { if(pEnd[1] == '"') pEnd++; } else if(!InString) { if(*pEnd == ';') // command separator { pNextPart = pEnd+1; break; } else if(*pEnd == '#') // comment, no need to do anything more break; } pEnd++; } if(ParseStart(&Result, pStr, (pEnd-pStr) + 1) != 0) return false; CCommand *pCommand = FindCommand(Result.m_pCommand, m_FlagMask); if(!pCommand || ParseArgs(&Result, pCommand->m_pParams)) return false; pStr = pNextPart; } while(pStr && *pStr); return true; }
int main(int argc, char** argv) { if (!ParseArgs(argc,argv)) { return 0; } plan_tests(5); ok(test_replay(OLC_League, official_score_sprint),"replay league",0); ok(test_replay(OLC_FAI, official_score_fai),"replay fai",0); ok(test_replay(OLC_Classic, official_score_classic),"replay classic",0); ok(test_replay(OLC_Sprint, official_score_sprint),"replay sprint",0); ok(test_replay(OLC_Plus, official_score_plus),"replay plus",0); return exit_status(); }
int main(int argc, char* argv[]) { TStr InFile,OutFile; int Dimensions, WalkLen, NumWalks, WinSize, Iter; double ParamP, ParamQ; bool Directed, Weighted, Verbose, OutputWalks; ParseArgs(argc, argv, InFile, OutFile, Dimensions, WalkLen, NumWalks, WinSize, Iter, Verbose, ParamP, ParamQ, Directed, Weighted, OutputWalks); PWNet InNet = PWNet::New(); TIntFltVH EmbeddingsHV; TVVec <TInt, int64> WalksVV; ReadGraph(InFile, Directed, Weighted, Verbose, InNet); node2vec(InNet, ParamP, ParamQ, Dimensions, WalkLen, NumWalks, WinSize, Iter, Verbose, OutputWalks, WalksVV, EmbeddingsHV); WriteOutput(OutFile, EmbeddingsHV, WalksVV, OutputWalks); return 0; }
int main(int argc, char** argv) { // default arguments autopilot_parms.SetIdeal(); if (!ParseArgs(argc, argv)) return 0; unsigned i = rand() % NUM_WIND; plan_tests(2); // tests whether flying at VOpt for OR task is optimal test_speed_factor(3, i); return exit_status(); }
int main( int argc, char **argv ) { BookSimConfig config; if ( !ParseArgs( &config, argc, argv ) ) { cout << "Usage: " << argv[0] << " configfile" << endl; return 0; } /*print the configuration file at the begining of the reprot */ ifstream in(argv[1]); char c; cout << "BEGIN Configuration File" << endl; cout << "Name: " << argv[1] << endl; while (!in.eof()) { in.get(c); cout << c ; } cout << "END Configuration File" << endl; _threads = config.GetInt("threads"); /*initialize routing, traffic, injection functions */ InitializeRoutingMap( ); InitializeTrafficMap( ); InitializeInjectionMap( ); _print_activity = (config.GetInt("print_activity")==1); _trace = (config.GetInt("viewer trace")==1); _use_read_write = (config.GetInt("use_read_write")==1); config.GetStr( "watch_file", watch_file ); _use_noc_latency = (config.GetInt("use_noc_latency")==1); /*configure and run the simulator */ bool result; // for(int i = 0; i<2; i++){ result = AllocatorSim( config ); //} return result ? -1 : 0; }
extern "C" int main(int argc, char *argv[]) { #if !defined(WIN32) && !defined(__SYMBIAN32__) signal(SIGPIPE, SIG_IGN); #endif #ifdef GEKKO // External library libfat, but let's not bother including its header extern void fatInitDefault(void); fatInitDefault(); freopen("sd:/stdout.txt", "wt", stdout); freopen("sd:/stderr.txt", "wt", stderr); fprintf(stdout, "Trying to force opening\n"); #endif #ifdef __SYMBIAN32__ freopen("warmux_stdout.txt", "w", stdout); freopen("warmux_stderr.txt", "w", stderr); #endif std::ios_base::sync_with_stdio(true); /* FIXME calling Config::GetInstance here means that there is no need of * singleton for Config but simply a global variable. This may look stange * but the whole system (directories, translation etc...) is needed, even for * the ParseArgs and DisplayWelcomeMessage functions. */ Config::GetInstance(); // init config first, because it initializes i18n ParseArgs(argc, argv); DisplayWelcomeMessage(); if (SDL_Init(SDL_INIT_TIMER) < 0) { fprintf(stderr, "Sorry, couldn't initialize SDL'!\n"); exit(EXIT_FAILURE); } #ifdef MAEMO Osso::Init(); #endif AppWarmux::GetInstance()->Main(); delete AppWarmux::GetInstance(); SDL_QuitSubSystem(SDL_INIT_TIMER); SDL_Quit(); exit(EXIT_SUCCESS); }
int main(int argc, char** argv) { output_skip = 60; replay_file = Path(_T("test/data/apf-bug554.igc")); task_file = Path(_T("test/data/apf-bug554.tsk")); if (!ParseArgs(argc,argv)) { return 0; } plan_tests(1); ok(test_replay(),"replay task",0); return exit_status(); }