bool tTVPApplication::StartApplication( int argc, char* argv[] ) { _set_se_translator(se_translator_function); ArgC = argc; ArgV = argv; for( int i = 0; i < argc; i++ ) { if(!strcmp(argv[i], "-@processohmlog")) { has_map_report_process_ = true; } } TVPTerminateCode = 0; CheckConsole(); // try starting the program! bool engine_init = false; try { if(TVPCheckProcessLog()) return true; // sub-process for processing object hash map log TVPInitScriptEngine(); engine_init = true; // banner TVPAddImportantLog( TVPFormatMessage(TVPProgramStartedOn, TVPGetOSName(), TVPGetPlatformName()) ); // TVPInitializeBaseSystems TVPInitializeBaseSystems(); Initialize(); if(TVPCheckPrintDataPath()) return true; if(TVPExecuteUserConfig()) return true; image_load_thread_ = new tTVPAsyncImageLoader(); TVPSystemInit(); if(TVPCheckAbout()) return true; // version information dialog box; SetTitle( std::wstring(TVPKirikiri) ); TVPSystemControl = new tTVPSystemControl(); #ifndef TVP_IGNORE_LOAD_TPM_PLUGIN TVPLoadPluigins(); // load plugin module *.tpm #endif // Check digitizer CheckDigitizer(); // start image load thread image_load_thread_->Resume(); if(TVPProjectDirSelected) TVPInitializeStartupScript(); Run(); try { // image_load_thread_->ExitRequest(); delete image_load_thread_; image_load_thread_ = NULL; } catch(...) { // ignore errors } try { TVPSystemUninit(); } catch(...) { // ignore errors } } catch( const EAbort & ) { // nothing to do } catch( const Exception &exception ) { TVPOnError(); if(!TVPSystemUninitCalled) ShowException(exception.what()); } catch( const TJS::eTJSScriptError &e ) { TVPOnError(); if(!TVPSystemUninitCalled) ShowException( e.GetMessage().c_str() ); } catch( const TJS::eTJS &e) { TVPOnError(); if(!TVPSystemUninitCalled) ShowException( e.GetMessage().c_str() ); } catch( const std::exception &e ) { ShowException( ttstr(e.what()).c_str() ); } catch( const char* e ) { ShowException( ttstr(e).c_str() ); } catch( const wchar_t* e ) { ShowException( e ); } catch( const SEHException& e ) { PEXCEPTION_RECORD rec = e.ExceptionPointers->ExceptionRecord; std::wstring text(SECodeToMessage(e.Code)); ttstr result = TJSGetStackTraceString( 10 ); PrintConsole( result.c_str(), result.length(), true ); TVPDumpHWException(); ShowException( text.c_str() ); } catch(...) { ShowException( (const tjs_char*)TVPUnknownError ); } if(engine_init) TVPUninitScriptEngine(); if(TVPSystemControl) delete TVPSystemControl; TVPSystemControl = NULL; CloseConsole(); return false; }
//--------------------------------------------------------------------------- void TVPBeforeSystemUninit() { TVPDumpHWException(); // dump cached hw exceptoin }