ProxyData& ProxyData::operator = (Buffer *cfg) { if (bInit){ free_data(_proxyData, this); bInit = false; } load_data(_proxyData, this, cfg); bInit = true; return *this; }
void CWeaponStatMgun::net_Import(NET_Packet& P) // import from server { inheritedPH::net_Import (P); u8 state = P.r_u8(); load_data (m_destEnemyDir, P); if(TRUE==IsWorking()&&!state) FireEnd (); if(FALSE==IsWorking()&&state) FireStart (); }
Plant::Plant(DFInstance *df, VIRTADDR address, int index, QObject *parent) : QObject(parent) , m_index(index) , m_address(address) , m_df(df) , m_mem(df->memory_layout()) , m_flags() { load_data(); }
void SearchRequest::element_start(const char *el, const char **attr) { if (!strcmp(el, "item")){ free_data(jabberSearchData, &data); load_data(jabberSearchData, &data, NULL); m_data = JabberClient::get_attr("jid", attr); set_str(&data.JID, m_data.c_str()); } m_data = ""; }
void CInventoryOwner::load(IReader &input_packet) { CActor* pOurActor = smart_cast<CActor*>(this); u8 active_slot = input_packet.r_u8(); if (pOurActor && pOurActor->GetHolderID() == u16(-1)) { if(active_slot == u8(-1)) { inventory().SetActiveSlot(NO_ACTIVE_SLOT); } else { inventory().Activate_deffered(active_slot, Device.dwFrame); } } m_tmp_active_slot_num = active_slot; CharacterInfo().load(input_packet); load_data(m_game_name, input_packet); load_data(m_money, input_packet); }
int main(int argc, char **argv){ int res = 0, code; char *file_name; char *operation; char *entidad; printf("\n\033[1;37m Tp0 - Cargador Masivo\n"); printf(" ---------------------\n\033[0m"); res = check_params(argc, 0); if(res == RES_OK){ operation = argv[1]; res = UNKNOWN_PARAM; if (strncmp(operation, "-i", 2) == 0 ){ res = check_params(argc, 4); if(res == RES_OK){ entidad = argv[2]; file_name = argv[3]; res = load_data(file_name, entidad); } } if (strncmp(operation, "-l", 2) == 0 ){ res = check_params(argc, 3); if(res == RES_OK){ entidad = argv[2]; res = list_data(entidad); } } if (strncmp(operation, "-k", 2) == 0 ){ res = check_params(argc, 4); if(res == RES_OK){ code = atoi(argv[2]); entidad = argv[3]; res = search_by_code(entidad, code); } } if (strncmp(operation, "-ok", 3) == 0 ){ res = check_params(argc, 3); if(res == RES_OK){ entidad = argv[2]; res = order_by_code(entidad); } } if (strncmp(operation, "-on", 3) == 0 ){ res = check_params(argc, 3); if(res == RES_OK){ entidad = argv[2]; res = order_by_name(entidad); } } } error_handler(res); return res; }
void CALifeSpawnRegistry::load (IReader &file_stream, xrGUID *save_guid) { IReader *chunk; chunk = file_stream.open_chunk(0); m_header.load (*chunk); chunk->close (); R_ASSERT2 (!save_guid || (*save_guid == header().guid()) || ignore_save_incompatibility(),"Saved game doesn't correspond to the spawn : DELETE SAVED GAME!"); chunk = file_stream.open_chunk(1); m_spawns.load (*chunk); chunk->close (); #if 0 SPAWN_GRAPH::vertex_iterator I = m_spawns.vertices().begin(); SPAWN_GRAPH::vertex_iterator E = m_spawns.vertices().end(); for ( ; I != E; ++I) { luabind::wrap_base *base = smart_cast<luabind::wrap_base*>(&(*I).second->data()->object()); if (!base) continue; if (xr_strcmp((*I).second->data()->object().name_replace(),"rostok_stalker_outfit")) continue; dummy *_dummy = (dummy*)((void*)base->m_self.m_impl); lua_State **_state = &_dummy->state; Msg ("0x%08x",*(int*)&_state); break; } #endif chunk = file_stream.open_chunk(2); load_data (m_artefact_spawn_positions,*chunk); chunk->close (); chunk = file_stream.open_chunk(3); R_ASSERT2 (chunk,"Spawn version mismatch - REBUILD SPAWN!"); ai().patrol_path_storage (*chunk); chunk->close (); VERIFY (!m_chunk); m_chunk = file_stream.open_chunk(4); R_ASSERT2 (m_chunk,"Spawn version mismatch - REBUILD SPAWN!"); VERIFY (!m_game_graph); m_game_graph = new CGameGraph(*m_chunk); ai().game_graph (m_game_graph); R_ASSERT2 ((header().graph_guid() == ai().game_graph().header().guid()) || ignore_save_incompatibility(),"Spawn doesn't correspond to the graph : REBUILD SPAWN!"); build_story_spawns (); build_root_spawns (); Msg ("* %d spawn points are successfully loaded",m_spawns.vertex_count()); }
/***********************************************************************//** * @brief 2D image pixel access operator (const variant) * * @param[in] ix Pixel index in first dimension (starting from 0). * @param[in] iy Pixel index in second dimension (starting from 0). * * Provides access to a pixel of a 2D image. No range checking or image * dimension verification is performed. Use the at(ix,iy) method if range * checking and image dimension verification is required. ***************************************************************************/ const double& GFitsImageDouble::operator()(const int& ix, const int& iy) const { // If image pixels are not available then allocate them now load_data(); // Calculate pixel offset int offset = ix + iy * m_naxes[0]; // Return image pixel return m_pixels[offset]; }
/***********************************************************************//** * @brief 2D image pixel access operator (const variant) * * @param[in] ix Pixel index in first dimension (starting from 0). * @param[in] iy Pixel index in second dimension (starting from 0). * * Provides access to a pixel of a 2D image. No range checking or image * dimension verification is performed. Use the at(ix,iy) method if range * checking and image dimension verification is required. ***************************************************************************/ const long& GFitsImageLong::operator() (const int& ix, const int& iy) const { // Load data load_data(); // Calculate pixel offset int offset = ix + iy * m_naxes[0]; // Return image pixel return m_pixels[offset]; }
/***********************************************************************//** * @brief 3D image pixel access operator * * @param[in] ix Pixel index in first dimension (starting from 0). * @param[in] iy Pixel index in second dimension (starting from 0). * @param[in] iz Pixel index in third dimension (starting from 0). * * Provides access to a pixel of a 3D image. No range checking or image * dimension verification is performed. Use the at(ix,iy) method if range * checking and image dimension verification is required. ***************************************************************************/ long& GFitsImageLong::operator() (const int& ix, const int& iy, const int& iz) { // Load data load_data(); // Calculate pixel offset int offset = ix + m_naxes[0] * (iy + iz * m_naxes[1]); // Return image pixel return m_pixels[offset]; }
Material::Material(DFInstance *df, VIRTADDR address, int index, bool inorganic, QObject *parent) : QObject(parent) , m_index(index) , m_address(address) , m_df(df) , m_mem(df->memory_layout()) , m_flags() , m_inorganic(inorganic) { load_data(); }
int main(int argc, char *argv[]) { int ch; int f_flag = 0; char *filename = "data"; ToxWindow* a; int i = 0; for (i = 0; i < argc; ++i) { if (argv[i] == NULL) break; else if (argv[i][0] == '-') { if (argv[i][1] == 'f') { if (argv[i + 1] != NULL) filename = argv[i + 1]; else f_flag = -1; } } } init_term(); init_tox(); load_data(filename); init_windows(); init_window_status(); if (f_flag == -1) { attron(COLOR_PAIR(3) | A_BOLD); wprintw(prompt->window, "You passed '-f' without giving an argument!\n" "defaulting to 'data' for a keyfile...\n"); attroff(COLOR_PAIR(3) | A_BOLD); } while(true) { /* Update tox */ do_tox(); /* Draw */ a = &windows[active_window]; prepare_window(a->window); a->blink = false; draw_bar(); a->onDraw(a); /* Handle input */ ch = getch(); if (ch == '\t' || ch == KEY_BTAB) set_active_window(ch); else if (ch != ERR) a->onKey(a, ch); } return 0; }
Dither::Dither(Configuration *cfg) { config = cfg; dither = NULL; mode = DITHER_NONE; set_mode(); if(mode != DITHER_NONE) load_data(); }
SoundPlugin::SoundPlugin(unsigned base, bool bFirst, Buffer *config) : Plugin(base) { load_data(soundData, &data, config); soundPlugin = this; user_data_id = getContacts()->registerUserData(info.title, soundUserData); m_bChanged = false; CmdSoundDisable = registerType(); EventSoundChanged = registerType(); Command cmd; cmd->id = user_data_id + 1; cmd->text = I18N_NOOP("&Sound"); cmd->icon = "sound"; cmd->icon_on = NULL; cmd->param = (void*)getSoundSetup; Event e(EventAddPreferences, cmd); e.process(); cmd->id = CmdSoundDisable; cmd->text = I18N_NOOP("&Sound"); cmd->icon = "nosound"; cmd->icon_on = "sound"; cmd->bar_id = ToolBarMain; cmd->bar_grp = 0; cmd->menu_id = 0; cmd->menu_grp = 0; cmd->flags = COMMAND_CHECK_STATE; Event eCmd(EventCommandCreate, cmd); eCmd.process(); cmd->icon = NULL; cmd->icon_on = NULL; cmd->bar_id = 0; cmd->menu_id = MenuMain; cmd->flags = COMMAND_CHECK_STATE; eCmd.process(); Event ePlugin(EventGetPluginInfo, (void*)"_core"); pluginInfo *info = (pluginInfo*)(ePlugin.process()); core = static_cast<CorePlugin*>(info->plugin); m_sound = NULL; #ifndef WIN32 m_player = 0; connect(ExecManager::manager, SIGNAL(childExited(int,int)), this, SLOT(childExited(int,int))); #endif m_checkTimer = new QTimer(this); connect(m_checkTimer, SIGNAL(timeout()), this, SLOT(checkSound())); if (bFirst) playSound(getStartUp()); }
FilterPlugin::FilterPlugin(unsigned base, Buffer *cfg) : Plugin(base), EventReceiver(HighPriority - 1) { filterPlugin = this; load_data(filterData, &data, cfg); user_data_id = getContacts()->registerUserData(info.title, filterUserData); CmdIgnoreList = registerType(); CmdIgnore = registerType(); CmdIgnoreText = registerType(); Command cmd; cmd->id = CmdIgnoreList; cmd->text = I18N_NOOP("Ignore list"); cmd->menu_id = MenuContactGroup; cmd->menu_grp = 0x8080; cmd->flags = COMMAND_CHECK_STATE; Event eCmd(EventCommandCreate, cmd); eCmd.process(); cmd->id = CmdIgnore; cmd->text = I18N_NOOP("Ignore user"); cmd->icon = "ignorelist"; cmd->menu_id = 0; cmd->menu_grp = 0; cmd->bar_id = ToolBarContainer; cmd->bar_grp = 0x7001; cmd->flags = COMMAND_CHECK_STATE; eCmd.process(); cmd->id = CmdIgnoreText; cmd->text = I18N_NOOP("Ignore this phrase"); cmd->icon = NULL; cmd->menu_id = MenuTextEdit; cmd->menu_grp = 0x7000; cmd->bar_id = 0; cmd->bar_grp = 0; cmd->flags = COMMAND_CHECK_STATE; eCmd.process(); cmd->menu_id = MenuMsgView; eCmd.process(); cmd->id = user_data_id + 1; cmd->text = I18N_NOOP("&Filter"); cmd->icon = "filter"; cmd->menu_id = 0; cmd->menu_grp = 0; cmd->param = (void*)getFilterConfig; Event ePref(EventAddPreferences, cmd); ePref.process(); }
ShortcutsPlugin::ShortcutsPlugin(unsigned base, Buffer *config) : Plugin(base) { load_data(shortcutsData, &data, config); #ifdef WIN32 m_bInit = false; init(); #else applyKeys(); #endif }
NLM_EXTERN GlobalBandStructPtr CreatBandStruct(SeqLocPtr slp1, SeqLocPtr slp2, Int4Ptr PNTR W, Boolean is_prot, Int2 method) { GlobalBandStructPtr gbsp; Uint1Ptr seq1,seq2; Int4 len1, len2; Int2 gopen, gext; /* default values */ Int4 ma=1, ms = -2; /* default values */ if (is_prot) { gopen = 5; gext=1; } else { gopen = 10; gext=2; } len1 = SeqLocLen(slp1); len2 = SeqLocLen(slp2); seq1 = load_data(slp1, is_prot); seq2 = load_data(slp2, is_prot); gbsp = GlobalBandStructCreate((Uint1)method); gbsp->seq1 = seq1; gbsp->seq2 = seq2; gbsp->seq1_length = len1; gbsp->seq2_length = len2; gbsp->seqloc1 = slp1; gbsp->seqloc2 = slp2; if (W != NULL) { gbsp->matrix = W; } else if (is_prot) { ChangeGlobalBandMatrix(gbsp, TRUE, "BLOSUM62", 0, 0); } else { ChangeGlobalBandMatrix(gbsp, FALSE, NULL, ma, ms); } /* all end gap penalties are set to zero */ SetGlobaltOptions(gbsp, 0, 0, 0, 0, 0, 0, 0, 0, gopen, gext); return gbsp; }
/***********************************************************************//** * @brief 4D image pixel access operator * * @param[in] ix Pixel index in first dimension (starting from 0). * @param[in] iy Pixel index in second dimension (starting from 0). * @param[in] iz Pixel index in third dimension (starting from 0). * @param[in] it Pixel index in forth dimension (starting from 0). * * Provides access to a pixel of a 4D image. No range checking or image * dimension verification is performed. Use the at(ix,iy) method if range * checking and image dimension verification is required. ***************************************************************************/ double& GFitsImageDouble::operator()(const int& ix, const int& iy, const int& iz, const int& it) { // If image pixels are not available then allocate them now load_data(); // Calculate pixel offset int offset = ix + m_naxes[0] * (iy + m_naxes[1] * (iz + it * m_naxes[2])); // Return image pixel return m_pixels[offset]; }
static int load_data_or_init(Tox *m, char *path) { data_file_name = path; if (load_data(m)) return 1; if (save_data(m)) return 1; return 0; }
int main(int argc, char *argv[]) { // $0 ../imnet_data/imnet_0.bin ../imnet_data/0_label.txt 63336 21504 const char usage[] = "USAGE: $0 data_filename, label_filename, num_samples, feature_vec_len"; if (argc != 5) { std::cout << usage << std::endl; exit(1); } std::cout << "Reading " << argv[1] << ", " << argv[2] << std::endl; load_data(argv[1], argv[2], atoi(argv[3]), atoi(argv[4])); return 0; }
JNIEXPORT void JNICALL Java_org_alexis_jpicotts_PicoTTS_setup (JNIEnv *env, jobject parent, jstring ta_filename, jstring sg_filename) { // INIT void *memory = malloc(PICO_MEM_SIZE); pico_Status status = pico_initialize(memory, PICO_MEM_SIZE, &picoSystem); if (PICO_OK != status) { raise_exception(env, "Failed to initialize Pico system"); return; } pico_Char* voicename = (pico_Char*) PICO_VOICE_NAME; status = pico_createVoiceDefinition(picoSystem, voicename); if (PICO_OK != status) { raise_exception(env, "Failed creating voice definition"); return; } // Load resource data const char* ta_filename_native = (*env)->GetStringUTFChars(env, ta_filename, NULL); const char* sg_filename_native = (*env)->GetStringUTFChars(env, sg_filename, NULL); if (load_data(env, ta_filename_native, sg_filename_native) != 0) return; (*env)->ReleaseStringUTFChars(env, ta_filename, ta_filename_native); (*env)->ReleaseStringUTFChars(env, sg_filename, sg_filename_native); // Add the text analysis resource status = pico_addResourceToVoiceDefinition(picoSystem, PICO_VOICE_NAME, picoTaResourceName); if (PICO_OK != status) { raise_exception(env, "Failed to add the text analysis resource"); return; } // Add the signal generation resource status = pico_addResourceToVoiceDefinition(picoSystem, PICO_VOICE_NAME, picoSgResourceName); if (PICO_OK != status) { raise_exception(env, "Failed to add the signal generation resource"); return; } // Initialize the engine status = pico_newEngine(picoSystem, voicename, &picoEngine); if (PICO_OK != status) { raise_exception(env, "Failed to load the engine"); return; } }
void AgentRequest::element_start(const char *el, const char **attr) { if (!strcmp(el, "agent")){ free_data(jabberAgentInfo, &data); load_data(jabberAgentInfo, &data, NULL); m_data = JabberClient::get_attr("jid", attr); set_str(&data.ID, m_data.c_str()); }else if (!strcmp(el, "search")){ data.Search = (unsigned)(-1); } m_data = ""; }
/***********************************************************************//** * @brief 4D image pixel access operator (const variant) * * @param[in] ix Pixel index in first dimension (starting from 0). * @param[in] iy Pixel index in second dimension (starting from 0). * @param[in] iz Pixel index in third dimension (starting from 0). * @param[in] it Pixel index in forth dimension (starting from 0). * * Provides access to a pixel of a 4D image. No range checking or image * dimension verification is performed. Use the at(ix,iy) method if range * checking and image dimension verification is required. ***************************************************************************/ const float& GFitsImageFloat::operator()(const int& ix, const int& iy, const int& iz, const int& it) const { // Load data load_data(); // Calculate pixel offset int offset = ix + m_naxes[0] * (iy + m_naxes[1] * (iz + it * m_naxes[2])); // Return image pixel return m_pixels[offset]; }
void CPatrolPathStorage::load (IReader &stream) { IReader *chunk; chunk = stream.open_chunk(0); u32 size = chunk->r_u32(); chunk->close (); m_registry.clear (); PATROL_REGISTRY::value_type pair; chunk = stream.open_chunk(1); for (u32 i=0; i<size; ++i) { IReader *chunk1; chunk1 = chunk->open_chunk(i); IReader *chunk2; chunk2 = chunk1->open_chunk(0); load_data (pair.first,*chunk2); chunk2->close (); chunk2 = chunk1->open_chunk(1); load_data (pair.second,*chunk2); chunk2->close (); chunk1->close (); const_iterator I = m_registry.find(pair.first); VERIFY3 (I == m_registry.end(),"Duplicated patrol path found ",*pair.first); #ifdef DEBUG pair.second->name (pair.first); #endif m_registry.insert (pair); } chunk->close (); }
/** * manages the running of the program, initialises data structures, loads * data and handles the processing of options. The bulk of this function * should simply be calling other functions to get the job done. **/ int main(int argc, char **argv) { /* validate command line arguments */ if(argc != 3) { printf("%s\n", "Oops! Your command line arguments are incorrect."); return EXIT_FAILURE; } if(strcmp(argv[1], "stock.dat") != 0 && strcmp(argv[2], "coins.dat") != 0) { printf("Oops! Please check your command line arguments: eg ./ppd *items*.dat *funds*.dat \n"); return EXIT_FAILURE; } /* represents the data structures to manage the system */ struct ppd_system system; int selection = 0; BOOLEAN running = TRUE; /* init the system */ system.stock_file_name = argv[1]; system.coin_file_name = argv[2]; system_init(&system); printf("System initialised. Please wait."); /* load data from .dat files */ load_data(&system, system.coin_file_name, system.stock_file_name); /* initialise the menu system */ menu_item menu[MENU_SIZE]; init_menu(menu); while (running) { /* loop, asking for options from the menu */ selection = display_menu(menu); printf("%s%d%s", "Option ", selection, " has been selected."); /* run each option selected */ if(menu[(selection - 1)].function( &system ) == FALSE) { printf("\n\n%s\n", "Sorry! Something went wrong. Now exiting."); running = FALSE; } } /* User has opted to quit */ /* make sure you always free all memory and close all files * before you exit the program */ return EXIT_SUCCESS; }
Container::Container(unsigned id, const char *cfg) { m_bInit = false; m_bInSize = false; m_bStatusSize = false; m_bBarChanged = false; m_bReceived = false; m_bNoSwitch = false; SET_WNDPROC("container") setWFlags(WDestructiveClose); QFrame *frm = new QFrame(this); setCentralWidget(frm); connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged())); QVBoxLayout *lay = new QVBoxLayout(frm); m_wnds = new QWidgetStack(frm); m_wnds->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); lay->addWidget(m_wnds); m_tabSplitter = new Splitter(frm); m_tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); m_tabBar = new UserTabBar(m_tabSplitter); m_tabBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding)); m_tabBar->hide(); m_status = new ContainerStatus(m_tabSplitter); lay->addWidget(m_tabSplitter); load_data(containerData, &data, cfg); if (cfg == NULL){ setId(id); memcpy(data.barState, CorePlugin::m_plugin->data.containerBar, sizeof(data.barState)); data.geometry[2] = CorePlugin::m_plugin->data.containerSize[0]; data.geometry[3] = CorePlugin::m_plugin->data.containerSize[1]; setStatusSize(CorePlugin::m_plugin->getContainerStatusSize()); showBar(); m_bInit = true; } m_bInSize = true; restoreGeometry(this, data.geometry, cfg != NULL, (cfg != NULL) || m_bInit); m_bInSize = false; connect(m_tabBar, SIGNAL(selected(int)), this, SLOT(contactSelected(int))); connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*))); connect(m_status, SIGNAL(sizeChanged(int)), this, SLOT(statusChanged(int))); m_accel = new QAccel(this); connect(m_accel, SIGNAL(activated(int)), this, SLOT(accelActivated(int))); setupAccel(); }
int main (int argc, char **argv) { CallbackData data; parse_args (&data, &argc, &argv); load_data (&data); count_cgs (&data); cleanup_data (&data); return 0; }
void CSE_ALifeInventoryItem::STATE_Read (NET_Packet &tNetPacket, u16 size) { u16 m_wVersion = base()->m_wVersion; if (m_wVersion > 52) tNetPacket.r_float (m_fCondition); if (m_wVersion > 123) { load_data (m_upgrades, tNetPacket); } State.position = base()->o_Position; }
RemotePlugin::RemotePlugin(unsigned base, const char *config) : Plugin(base) { load_data(remoteData, &data, config); Event ePlugin(EventGetPluginInfo, (void*)"_core"); pluginInfo *info = (pluginInfo*)(ePlugin.process()); core = static_cast<CorePlugin*>(info->plugin); bind(); #ifdef WIN32 remote = this; ipc = new IPC; #endif }
bool bin_index_t::file_node::first(data_t& key,data_t& val) const { open_index_file(); index_t ind; if(!first_item(root_page,ind))return false; key=ind.key; key.resize(key_len); val.resize(ind.data_len); load_data(ind.data_offset,val); return true; }