void start_program(int argc, char **argv){ QApplication app(argc, argv); { // nsm { const char *nsm_url = getenv( "NSM_URL" ); if ( nsm_url ) { g_nsm = nsm_new(); printf("NSM: %p\n",g_nsm); nsm_set_open_callback( g_nsm, rc_nsm_open, 0 ); nsm_set_save_callback( g_nsm, rc_nsm_save, 0 ); if ( 0 == nsm_init( g_nsm, nsm_url ) ) { signal(SIGTERM, rc_nsm_signalHanlder); nsm_send_announce( g_nsm, "Radium Compressor", "", argv[0] ); g_nsm_timer.setInterval(50); g_nsm_timer.start(); } else { nsm_free( g_nsm ); g_nsm = 0; } } } if(g_nsm == NULL){ if (g_compressor == NULL) g_compressor = COMPRESSOR_create(0); g_compressor_editor = create_compressor_editor(NULL, g_compressor); g_compressor_editor->show(); } app.exec(); if(g_compressor_editor != NULL) delete_compressor_editor(g_compressor_editor); } }
void NsmClient::createInitialClient() { /* * Make first contact with NSM server. */ nsm_client_t* nsm = 0; H2Core::Preferences *pPref = H2Core::Preferences::get_instance(); QString H2ProcessName = pPref->getH2ProcessName(); QByteArray byteArray = H2ProcessName.toLatin1(); const char *nsm_url = getenv( "NSM_URL" ); if ( nsm_url ) { nsm = nsm_new(); if ( nsm ) { nsm_set_open_callback( nsm, nsm_open_cb, (void*) 0 ); nsm_set_save_callback( nsm, nsm_save_cb, (void*) 0 ); if ( nsm_init( nsm, nsm_url ) == 0 ) { nsm_send_announce( nsm, "Hydrogen", "", byteArray.data() ); nsm_check_wait( nsm, 10000 ); if(pthread_create(&m_NsmThread, NULL, nsm_processEvent, nsm)) { ___ERRORLOG("Error creating NSM thread\n "); return; } } else { ___ERRORLOG("failed, freeing NSM client"); nsm_free( nsm ); nsm = 0; } } } else { ___WARNINGLOG("No NSM URL available: no NSM management\n"); } }
void do_init(bool service_mode, bool use_fs_repo, const sc_string &fs_repo_location, bool with_debugger) { sc_session *system; if (!fs_repo_location.empty()) { fs_repo_loc = fs_repo_location; } system = libsc_init(use_fs_repo); init_dirhier(system); pm_keynodes_init(system); pm_sched_init(system, true); scp_vars_init(system); scp_core_init(system); scp_operators_init(system); scp_package_init(system); if (with_debugger) scp_debugger::init(system); if (!service_mode) { #ifdef USE_NSM nsm_pre_init(); #endif #ifdef USE_NSM nsm_init(); #endif } init_sc_operations(system); scl::init_productions_engine(system); init_ext_program(system); }