int main(int argc, const char* argv[]) { int rc; SeparationFlags sf; SeparationPrefs preferences; const char** argvCopy = NULL; #ifdef NDEBUG mwDisableErrorBoxes(); #endif /* NDEBUG */ argvCopy = mwFixArgv(argc, argv); rc = parseParameters(argc, argvCopy ? argvCopy : argv, &sf); if (rc) { if (BOINC_APPLICATION) { freeSeparationFlags(&sf); mwBoincInit(MW_PLAIN); parseParameters(argc, argvCopy, &sf); printVersion(TRUE, FALSE); } mw_printf("Failed to parse parameters\n"); free(argvCopy); mw_finish(EXIT_FAILURE); } rc = separationInit(sf.debugBOINC); free(argvCopy); if (rc) return rc; separationReadPreferences(&preferences); setFlagsFromPreferences(&sf, &preferences, argv[0]); if (sf.processPriority != MW_PRIORITY_INVALID) { mwSetProcessPriority(sf.processPriority); } rc = worker(&sf); freeSeparationFlags(&sf); if (!sf.ignoreCheckpoint && sf.cleanupCheckpoint && rc == 0) { mw_report("Removing checkpoint file '%s'\n", CHECKPOINT_FILE); mw_remove(CHECKPOINT_FILE); } mw_finish(rc); return rc; }
/* Maybe set up some platform specific issues */ static void nbSpecialSetup() { mwDisableErrorBoxes(); #if ENABLE_CRLIBM /* Try to handle inconsistencies with x87. We shouldn't use * this. This helps, but there can still be some problems for some * values. Sticking with SSE2 is the way to go. */ crlibm_init(); #endif #ifdef _MSC_VER /* FIXME: Also for mingw, but seems to be missing */ /* Make windows printing be more consistent. For some reason it * defaults to printing 3 digits in the exponent. There are still * issues where the rounding of the last digit by printf on * windows in a small number of cases. */ _set_output_format(_TWO_DIGIT_EXPONENT); #endif /* _WIN32 */ }