这篇教程C++ ELOG函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ELOG函数的典型用法代码示例。如果您正苦于以下问题:C++ ELOG函数的具体用法?C++ ELOG怎么用?C++ ELOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ELOG函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Log void Log(LogTypes::LOG_LEVELS level, const char *msg) { switch (level) { case LogTypes::LVERBOSE: case LogTypes::LDEBUG: case LogTypes::LINFO: ILOG("%s", msg); break; case LogTypes::LERROR: ELOG("%s", msg); break; case LogTypes::LWARNING: WLOG("%s", msg); break; case LogTypes::LNOTICE: default: ILOG("%s", msg); break; } }
开发者ID:arg274,项目名称:ppsspp,代码行数:21,
示例2: CML_Gain_Offsets_Config/*------------完成CML的的发射链路设置Config_for_Gain and Offsets---------------------*/INT8U CML_Gain_Offsets_Config(void){ u16 Program_Block4[6] = {0x8000,0x0000,0x0530,0x130e,0x0000,0x0000}; u8 i;//Upper_8_Bit,Lower_8_Bit,; // CBUS_SendTwoByte(0xc1,0x00,0x00);// Chack_Prog_flag();// CBUS_SendTwoByte(0xc1,0x02,0x30); for(i = 0;i < 6;i++) { CBUS_Send16U(PROG_REG,Program_Block4[i]); if(CML_NO_ERR!=Chack_Prog_flag(CML_TIME_OUT)){ ELOG("timeout err/n"); return CML_ERR; }; DelayMS(10);// Delay #10 } return CML_NO_ERR;// CBUS_SendTwoByte(0xB1,0x12,0xc0);//12,00 //Input Gain: Output1->MOD1, Output2->MOD2,DISC->Input1}
开发者ID:liuxizhen2009,项目名称:zlggui,代码行数:22,
示例3: parse_mode_json/* * Start parsing the received JSON string * */void parse_mode_json(char *json) { /* FIXME: Fasciliate stream processing, i.e. allow starting to interpret * JSON in chunks */ struct mode_json_params params; mode binding; params.cur_key = NULL; params.json = json; params.mode = &binding; yajl_handle handle; yajl_status state; handle = yajl_alloc(&mode_callbacks, NULL, (void *)¶ms); state = yajl_parse(handle, (const unsigned char *)json, strlen(json)); /* FIXME: Propper error handling for JSON parsing */ switch (state) { case yajl_status_ok: break; case yajl_status_client_canceled: case yajl_status_error: ELOG("Could not parse mode event!/n"); exit(EXIT_FAILURE); break; } /* We don't want to indicate default binding mode */ if (strcmp("default", i3string_as_utf8(params.mode->name)) == 0) I3STRING_FREE(params.mode->name); /* Set the new binding mode */ set_current_mode(&binding); yajl_free(handle); FREE(params.cur_key);}
开发者ID:Acidburn0zzz,项目名称:i3,代码行数:44,
示例4: init_glslangbool AndroidVulkanContext::Init(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) { if (g_Vulkan) { return false; } init_glslang(); g_LogOptions.breakOnError = true; g_LogOptions.breakOnWarning = true; g_LogOptions.msgBoxOnError = false; ILOG("Creating vulkan context"); Version gitVer(PPSSPP_GIT_VERSION); g_Vulkan = new VulkanContext("PPSSPP", gitVer.ToInteger(), VULKAN_FLAG_PRESENT_MAILBOX | VULKAN_FLAG_PRESENT_FIFO_RELAXED); if (!g_Vulkan->GetInstance()) { ELOG("Failed to create vulkan context"); return false; } ILOG("Creating vulkan device"); if (g_Vulkan->CreateDevice(0) != VK_SUCCESS) { ILOG("Failed to create vulkan device: %s", g_Vulkan->InitError().c_str()); return false; } int width = desiredBackbufferSizeX; int height = desiredBackbufferSizeY; if (!width || !height) { width = pixel_xres; height = pixel_yres; } ILOG("InitSurfaceAndroid: width=%d height=%d", width, height); g_Vulkan->InitSurfaceAndroid(wnd, width, height); if (g_validate_) { int bits = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; g_Vulkan->InitDebugMsgCallback(&Vulkan_Dbg, bits, &g_LogOptions); } g_Vulkan->InitObjects(true); return true;}
开发者ID:njh08d,项目名称:ppsspp,代码行数:40,
示例5: NativeInitGraphicsvoid NativeInitGraphics(){ INFO_LOG(BOOT, "NativeInitGraphics - should only be called once!"); gl_lost_manager_init(); ui_draw2d.SetAtlas(&ui_atlas); screenManager = new ScreenManager(); if (boot_filename.empty()) { screenManager->switchScreen(new LogoScreen(boot_filename)); } else { // Go directly into the game. screenManager->switchScreen(new EmuScreen(boot_filename)); } // screenManager->switchScreen(new FileSelectScreen()); UIShader_Init(); UITheme theme = {0}; theme.uiFont = UBUNTU24; theme.uiFontSmall = UBUNTU24; theme.uiFontSmaller = UBUNTU24; theme.buttonImage = I_BUTTON; theme.buttonSelected = I_BUTTON_SELECTED; theme.checkOn = I_CHECKEDBOX; theme.checkOff = I_SQUARE; UIInit(&ui_atlas, theme); uiTexture = new Texture(); if (!uiTexture->Load("ui_atlas.zim")) { ELOG("Failed to load texture"); } uiTexture->Bind(0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);}
开发者ID:ChrisAldama,项目名称:ppsspp,代码行数:40,
示例6: socketbool Server::Listen4(int port) { listener_ = socket(AF_INET, SOCK_STREAM, 0); if (listener_ < 0) return false; struct sockaddr_in server_addr; memset(&server_addr, 0, sizeof(server_addr)); server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = htonl(INADDR_ANY); server_addr.sin_port = htons(port); int opt = 1; // Enable re-binding to avoid the pain when restarting the server quickly. setsockopt(listener_, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt)); if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { closesocket(listener_); ELOG("Failed to bind to port %i. Bailing.", port); return false; } fd_util::SetNonBlocking(listener_, true); // 1024 is the max number of queued requests. if (listen(listener_, 1024) < 0) { closesocket(listener_); return false; } socklen_t len = sizeof(server_addr); if (getsockname(listener_, (struct sockaddr *)&server_addr, &len) == 0) { port = ntohs(server_addr.sin_port); } ILOG("HTTP server started on port %i", port); port_ = port; return true;}
开发者ID:AmesianX,项目名称:ppsspp,代码行数:39,
示例7: fread_idle_cb// Called by the by the 'idle' handle to emulate a reading eventstatic void fread_idle_cb(uv_idle_t *handle){ uv_fs_t req; RStream *rstream = handle_get_rstream((uv_handle_t *)handle); rstream->uvbuf.len = rbuffer_available(rstream->buffer); rstream->uvbuf.base = rbuffer_write_ptr(rstream->buffer); // the offset argument to uv_fs_read is int64_t, could someone really try // to read more than 9 quintillion (9e18) bytes? // upcast is meant to avoid tautological condition warning on 32 bits uintmax_t fpos_intmax = rstream->fpos; if (fpos_intmax > INT64_MAX) { ELOG("stream offset overflow"); preserve_exit(); } // Synchronous read uv_fs_read( uv_default_loop(), &req, rstream->fd, &rstream->uvbuf, 1, (int64_t) rstream->fpos, NULL); uv_fs_req_cleanup(&req); if (req.result <= 0) { uv_idle_stop(rstream->fread_idle); return; } // no errors (req.result (ssize_t) is positive), it's safe to cast. size_t nread = (size_t) req.result; rbuffer_produced(rstream->buffer, nread); rstream->fpos += nread;}
开发者ID:axblount,项目名称:neovim,代码行数:40,
示例8: TiXmlDeclarationvoid PluginManager::Save() { TiXmlDocument doc; doc.LinkEndChild(new TiXmlDeclaration("1.0", "UTF-8", "")); TiXmlElement* xmlRoot = new TiXmlElement("Plugins"); xmlRoot->SetAttribute("version", "1.0"); doc.LinkEndChild(xmlRoot); for (int i = 0; i < plugins_.size(); i++) { Plugin* plugin = plugins_.at(i); TiXmlElement* xmlPlugin = new TiXmlElement("Plugin"); xmlRoot->LinkEndChild(xmlPlugin); XmlUtil::AppendTextElement(xmlPlugin, "UUID", plugin->GetUUID()); XmlUtil::AppendTextElement(xmlPlugin, "Enabled", plugin->IsEnabled()); } FilePaths::CreateSettingsDirectory(); bool saved = doc.SaveFile(FilePaths::GetPluginSettingsFile().mb_str()); if (!saved) ELOG(_T("Could not save plugin.xml file"));}
开发者ID:DocWhoChat,项目名称:appetizer,代码行数:22,
示例9: sendbool Buffer::FlushSocket(uintptr_t sock) { for (size_t pos = 0, end = data_.size(); pos < end; ) { int sent = send(sock, &data_[pos], end - pos, 0); if (sent < 0) { ELOG("FlushSocket failed"); return false; } pos += sent; // Buffer full, don't spin. if (sent == 0) {#ifdef _WIN32 Sleep(1);#else sleep(1);#endif } } data_.resize(0); return true;}
开发者ID:Ced2911,项目名称:native,代码行数:22,
示例10: getenvvoid *update_ipc(void *data){ char *socket_path = getenv("I3SOCK"); char *i3_default_sock_path = "/tmp/i3-ipc.sock"; main_loop = ev_default_loop(0); if (socket_path == NULL) { ELOG("No Socket Path Specified, default to %s/n", i3_default_sock_path); socket_path = i3_default_sock_path; } if (init_connection(socket_path)) { /* We subscribe to the i3-events we need */ subscribe_events(); /* Get current workspaces from i3. */ i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_WORKSPACES, NULL); } ev_loop(main_loop, 0);}
开发者ID:phnom,项目名称:i3applet,代码行数:22,
示例11: ELOG void OrganizationShowHandller::handleIqID( const IQ& iq, int context ) { json::jobject jobj = json::jobject(); if (iq.m_subtype != gloox::IQ::Result) { universal_resource error_desc; ELOG("app")->error(WCOOL(L"组织结构树查看权限获取错误") + boost::shared_ptr<gloox::Tag>(iq.tag())->xml()); error_desc = XL("biz.OrganizationShowHandller.fail"); callback_(true, error_desc,jobj); } else { boost::shared_ptr<gloox::Tag> ptag(iq.findExtension(kExtUser_iq_filter_organization_show)->tag()); if (ptag) { gloox::Tag* tag_basic_permission = ptag->findChild("basic_permissions"); if (tag_basic_permission) { ConstTagList ptag_list = tag_basic_permission->findTagList("//permission"); for (ConstTagList::iterator it = ptag_list.begin(); it != ptag_list.end(); ++it) { if ((*it)->findAttribute("name") == "show_organization") { if ((*it)->cdata() == "true") { jobj["is_show_organization"] = true; } else { jobj["is_show_organization"] = false; } callback_(false, XL(""),jobj); } } } } } }
开发者ID:iVideo,项目名称:weishao,代码行数:38,
示例12: ILOG/** * Check if the new version of the app is available * @param silent If this is set to false, no error messages will be displayed to the user */void MiniLaunchBar::CheckForNewVersion(bool silent) { ILOG(_T("Looking for an update...")); UpdaterVersionInfo versionInfo; bool success = Updater::CheckVersion(CHECK_VERSION_URL, versionInfo); if (!success) { ELOG(_T("Could not get update information")); if (!silent) MessageBoxes::ShowError(_("Could not get update information")); return; } wxString thisVersion = VersionInfo::GetVersionString(); ILOG(wxString::Format(_T("This version: %s"), thisVersion)); ILOG(wxString::Format(_T("Current version: %s"), versionInfo.Version)); ILOG(wxString::Format(_T("Page URL: %s"), versionInfo.PageURL)); ILOG(wxString::Format(_T("Download URL: %s"), versionInfo.DownloadURL)); ILOG(wxString::Format(_T("Release notes: %s"), versionInfo.ReleaseNotes)); if (Updater::CompareVersions(thisVersion, versionInfo.Version) >= 0) { ILOG(_T("=> No new version")); if (!silent) MessageBoxes::ShowInformation(_("You have the latest version.")); return; } else { ILOG(_T("=> A new version is available")); } wxString message; message = wxString::Format(_("A new version of Appetizer is available!/n/nYour version: %s/nNew version: %s/nRelease notes: %s/nDo you wish to download it now?"), thisVersion, versionInfo.Version, versionInfo.ReleaseNotes); int result = MessageBoxes::ShowConfirmation(message, 2|8, wxEmptyString, false, _("New version of Appetizer")); if (result == wxID_YES) { bool wasLaunched = ::wxLaunchDefaultBrowser(versionInfo.PageURL, wxBROWSER_NEW_WINDOW); if (!wasLaunched) MessageBoxes::ShowError(_("Error launching web browser")); }}
开发者ID:tanaga9,项目名称:appetizer,代码行数:42,
示例13: LOG// -----------------------------------------------------------------------------// CSTSApduEvent::Dispatch// from CJavaEvent. Copies response data to java side and calls java side method// with parameters set before.// (other items were commented in a header).// -----------------------------------------------------------------------------void CSTSApduEvent::Dispatch(JNIEnv* aJni, jobject aPeer){ LOG(ESATSA, EInfo, "+ CSTSApduEvent::Dispatch"); // create java byte array jbyteArray byteArray; if (iResponseData) { LOG(ESATSA, EInfo, "CSTSApduEvent::Dispatch: Responsedata is ready"); byteArray = aJni->NewByteArray(iResponseData->Size()); if (byteArray) { LOG(ESATSA, EInfo, "CSTSApduEvent::Dispatch: create byteArray now"); S60CommonUtils::CopyToJava((*aJni), *iResponseData, byteArray, 0, iResponseData->Size()); } } else { LOG(ESATSA, EInfo, "CSTSApduEvent::Dispatch: responseData is NOT ready!"); byteArray = aJni->NewByteArray(0); } if (!byteArray) { ELOG(ESATSA, "STS::CSTSApduEvent::Dispatch - Failed to create ByteArray"); iError = KErrNoMemory; } LOG(ESATSA, EInfo, "call java side method with parameters"); // call java side method with parameters jclass sessionClass = aJni->FindClass( "com/nokia/mj/impl/satsa/APDUConnectionImpl"); jmethodID mOperationCompleteCallBack = aJni->GetMethodID(sessionClass, "operationComplete", "(II[B)V"); aJni->CallVoidMethod(aPeer, mOperationCompleteCallBack, iId, iError, byteArray);}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:44,
示例14: ELOG bool SoundHandler::loadFromFile(const typeAssetID assetID, sf::SoundBuffer& asset) { // Start with a return result of false bool succ = false; // Retrieve the filename for this asset std::string anFilename = assetID; // Was a valid filename found? then attempt to load the asset from anFilename if(anFilename.length() > 0) { // Load the asset from a file succ = asset.loadFromFile(anFilename); } else { ELOG() << "SoundHandler::loadFromFile(" << assetID << ") No filename provided!" << std::endl; } // Return anResult of true if successful, false otherwise return succ; }
开发者ID:Ostkaka,项目名称:MGE,代码行数:23,
示例15: guardvoid ScreenManager::processFinishDialog() { if (dialogFinished_) { std::lock_guard<std::recursive_mutex> guard(inputLock_); // Another dialog may have been pushed before the render, so search for it. Screen *caller = dialogParent(dialogFinished_); for (size_t i = 0; i < stack_.size(); ++i) { if (stack_[i].screen == dialogFinished_) { stack_.erase(stack_.begin() + i); } } if (!caller) { ELOG("ERROR: no top screen when finishing dialog"); } else if (caller != topScreen()) { // The caller may get confused if we call dialogFinished() now. WLOG("Skipping non-top dialog when finishing dialog."); } else { caller->dialogFinished(dialogFinished_, dialogResult_); } delete dialogFinished_; dialogFinished_ = nullptr; }}
开发者ID:takashow,项目名称:ppsspp,代码行数:23,
示例16: Initstatic bool Init(){ if (!gSDLIsInit) { ELOG("Please init Stage before creating sound."); return false; } if (!sChannelsInit) { sChannelsInit = true; for(int i=0;i<sMaxChannels;i++) { sUsedChannel[i] = false; sDoneChannel[i] = false; } Mix_ChannelFinished(onChannelDone); Mix_HookMusicFinished(onMusicDone); Mix_SetPostMix(onPostMix,0); } return sChannelsInit;}
开发者ID:aaulia,项目名称:NME,代码行数:23,
示例17: OpenSLWrap_Shutdown// shut down the native audio systemextern "C" void OpenSLWrap_Shutdown() { SLresult result; ILOG("OpenSLWrap_Shutdown - stopping playback"); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_STOPPED); if (SL_RESULT_SUCCESS != result) { ELOG("SetPlayState failed"); } ILOG("OpenSLWrap_Shutdown - deleting player object"); if (bqPlayerObject != NULL) { (*bqPlayerObject)->Destroy(bqPlayerObject); bqPlayerObject = NULL; bqPlayerPlay = NULL; bqPlayerBufferQueue = NULL; bqPlayerMuteSolo = NULL; bqPlayerVolume = NULL; } ILOG("OpenSLWrap_Shutdown - deleting mix object"); if (outputMixObject != NULL) { (*outputMixObject)->Destroy(outputMixObject); outputMixObject = NULL; } ILOG("OpenSLWrap_Shutdown - deleting engine object"); if (engineObject != NULL) { (*engineObject)->Destroy(engineObject); engineObject = NULL; engineEngine = NULL; } delete [] buffer[0]; delete [] buffer[1]; ILOG("OpenSLWrap_Shutdown - finished");}
开发者ID:Bigpet,项目名称:native,代码行数:38,
示例18: LOG //For a given population entity apply the population growing algorithm mlong population_manager::calculate_population_delta( ) { LOG("population_manager::calculate_population_delta(): For ", player_name, ", population: ",collections->total_population,", max population: ",collections->max_population ); mlong delta = 0, new_population = 0; if( collections->total_population < 15 ) { new_population = collections->total_population + 1; } else { /* *Use a simple growing algorithm to increase or decrease the current population */ delta = ( BASE_GROW_RATION - 1 ) * collections->total_population; //The delta will be negative in case of starving citizen if( collections->total_population > population_grow_cycle_trigger_threshold ) { //Depending on the growing cycle the population can grow quicly or can even decrease long double cycle_factor = get_grow_cycle_factor(); delta *= cycle_factor; ELOG("population_manager::calculate_population_delta(): New delta:", delta, " grow_cycle_factor: ",cycle_factor); } delta = apply_economic_var_to_delta( delta ); new_population = collections->total_population + delta; } //Check the boundary if( new_population > collections->max_population ) { new_population = collections->max_population; } if( new_population < 0 ) { new_population = 0; } return new_population - collections->total_population; }
开发者ID:fjanisze,项目名称:Gioco,代码行数:38,
示例19: ELOGbool TmxHandler::LoadFromMemory(const GQE::typeAssetID theAssetID,Tmx::Map& theMap){ // Start with a return result of false bool anResult = false; // TODO: Retrieve the const char* pointer to load data from const char* anData = NULL; // TODO: Retrieve the size in bytes of the font to load from memory size_t anDataSize = 0; // Try to obtain the font from the memory location specified if(NULL != anData && anDataSize > 0) { } else { ELOG() << "TmxHandler::LoadFromMemory(" << theAssetID << ") Bad memory location or size!" << std::endl; } // Return anResult of true if successful, false otherwise return anResult;}
开发者ID:GatorQue,项目名称:gqp-tnt,代码行数:24,
示例20: PartitionID/** * delete the file associated with the Table table_name only * @param table_name * @return */RetCode DropTableExec::DeleteTableFiles(const string& table_name) { RetCode ret = rSuccess; Catalog* local_catalog = Environment::getInstance()->getCatalog(); TableDescriptor* table_desc = local_catalog->getTable(table_name); // start to delete the files vector<vector<string>> write_path; for (int i = 0; i < table_desc->getNumberOfProjection(); i++) { vector<string> prj_write_path; prj_write_path.clear(); for (int j = 0; j < table_desc->getProjectoin(i) ->getPartitioner() ->getNumberOfPartitions(); ++j) { string path = PartitionID(table_desc->getProjectoin(i)->getProjectionID(), j).getPathAndName(); prj_write_path.push_back(path); } write_path.push_back(prj_write_path); // unbound the file in memory if (table_desc->getProjectoin(i)->getPartitioner()->allPartitionBound()) { Catalog::getInstance()->getBindingModele()->UnbindingEntireProjection( table_desc->getProjectoin(i)->getPartitioner()); } } TableFileConnector* connector = new TableFileConnector( Config::local_disk_mode ? FilePlatform::kDisk : FilePlatform::kHdfs, write_path); ret = connector->DeleteFiles(); if (ret != rSuccess) { ELOG(ret, "failed to delete the projections, when delete the file on table" + table_name); return ret; } return ret;}
开发者ID:JolyZhang,项目名称:CLAIMS,代码行数:41,
示例21: FillBuffer void FillBuffer(const ByteArray &inBytes,bool inFirst) { int time_samples = inBytes.Size()/sizeof(float)/STEREO_SAMPLES; const float *buffer = (const float *)inBytes.Bytes(); enum { MASK = BUF_SIZE - 1 }; for(int i=0;i<time_samples;i++) { int mono_pos = (i+mDynamicFillPos) & MASK; mDynamicBuffer[ mono_pos<<1 ] = *buffer++ * ((1<<15)-1); mDynamicBuffer[ (mono_pos<<1) + 1 ] = *buffer++ * ((1<<15)-1); } int soundTime = getMixerTime(mSoundPos0); if (mDynamicFillPos<soundTime && !inFirst) ELOG("Too slow - FillBuffer %d / %d)", mDynamicFillPos, soundTime ); mDynamicFillPos += time_samples; if (time_samples<1024 && !mDynamicRequestPending) { mDynamicRequestPending = true; for(int i=0;i<2048;i++) { int mono_pos = (i+mDynamicFillPos) & MASK; mDynamicBuffer[ mono_pos<<1 ] = 0; mDynamicBuffer[ (mono_pos<<1) + 1 ] = 0; } int samples_left = (int)mDynamicFillPos - (int)(soundTime); int ticks_left = samples_left*1000/44100; //printf("Expire in %d (%d)/n", samples_left, ticks_left ); #ifndef EMSCRIPTEN Mix_ExpireChannel(mChannel, ticks_left>0 ? ticks_left : 1 ); #endif } }
开发者ID:clemos,项目名称:nme,代码行数:36,
示例22: if mlong population_manager::apply_economic_var_to_delta( mlong delta ) { const economics::economic_variables* eco = player_obj->economics->get_the_economic_variables(); if( delta > 10 ) { //The delta value depends on some economic factors mlong tmp = delta , tmp2; if( eco->salary_taxes_equity_perception > 0.7 ) //This very bad level impact negatively the population grow { delta *= - ( 0.5 + eco->salary_taxes_equity_perception ); } else if( eco->salary_taxes_equity_perception < 0.3 ) { delta *= ( 1.3 - eco->salary_taxes_equity_perception ); // Increase the speed } tmp2 = delta; //Also the amount of starving units impact the growing capacity long double starving_on_total_ratio; if( collections->total_population > 0 ) { starving_on_total_ratio = ( long double ) eco->amount_of_starving_unit / collections->total_population; if( starving_on_total_ratio > STARVING_RATIO_THRESHOLD && delta > 0) { //Is very high, the population dislike this situation. the delta will be negative delta *= -1; } delta *= ( ( delta > 0 ) ? 1 - starving_on_total_ratio : 1 + starving_on_total_ratio );//If the amount of starving unit is 0, there will be no negative or positive impact } ELOG("population_manager::apply_economic_var_to_delta(): Delta:",tmp,",TaxEqPerc:",eco->salary_taxes_equity_perception,",NewDelta:",tmp2,",StarvTotalRatio:",starving_on_total_ratio,",FinalDelta:",delta ); } else if( delta < 0 ) { delta *= ( 1 + eco->salary_taxes_equity_perception ); //Increase the depopulation speed } return delta; }
开发者ID:fjanisze,项目名称:Gioco,代码行数:36,
示例23: timechar *get_data_tests(){ tree *first = NULL; struct _tree_data data[MAX_ELEMENT]; struct _tree_data tmp_elmnt; struct _tree_data current_min; unsigned int result; unsigned int element_in_tree = 0; int i = 0; int j = 0; unsigned long rand_seed = (unsigned long) time(NULL); ILOG("Random seed: %lu", rand_seed); srand(rand_seed); for (i = 0; i < MAX_ELEMENT; i++) { data[i].key = rand(); data[i].value = rand(); } verif_tree(first); // Try to allocate a new tree. first = init_dictionnary(data_cmp, data_print, data_delete, NULL); if (first == NULL) { ELOG("Init dictionnary error"); return "Init dictionnary error"; } // Add data verif_tree(first); for (i = 0; i < MAX_ELEMENT; i++) { tmp_elmnt.key = data[i].key; if (!is_present(first, &(tmp_elmnt))) { element_in_tree++; } result = insert_elmt(first, &(data[i]), sizeof(struct _tree_data)); if (result != element_in_tree) { ELOG("Wrong result of inserted element"); return "Wrong result of inserted element"; } verif_tree(first); } current_min.key = (int) 0x80000000; current_min.value = (int) 0x80000000; for (i = 0; i < MAX_ELEMENT && element_in_tree != 0; i++) { tmp_elmnt.key = (int) 0x7fffffff; tmp_elmnt.value = (int) 0x7fffffff; // Get minimum data for (j = 0; j < MAX_ELEMENT; j++) { if ( data[j].key < tmp_elmnt.key && data[j].key > current_min.key) { tmp_elmnt.key = data[j].key; tmp_elmnt.value = data[j].value; } } current_min.key = tmp_elmnt.key; current_min.value = tmp_elmnt.value; if (!is_present(first, &tmp_elmnt)) { ELOG("Minimum data not in tree"); return "Minimum data not in tree"; } delete_node_min(first); if (is_present(first, &tmp_elmnt)) { ELOG("Minimum element deleted"); return "Minimum element deleted"; } element_in_tree--; verif_tree(first); } // Try to delete it delete_tree(first); return NULL;}
开发者ID:boomft,项目名称:libavl,代码行数:84,
示例24: LoadZIMPtrint LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int *flags, uint8 **image) { if (zim[0] != 'Z' || zim[1] != 'I' || zim[2] != 'M' || zim[3] != 'G') { ELOG("Not a ZIM file"); return 0; } memcpy(width, zim + 4, 4); memcpy(height, zim + 8, 4); memcpy(flags, zim + 12, 4); int num_levels = 1; int image_data_size[ZIM_MAX_MIP_LEVELS]; if (*flags & ZIM_HAS_MIPS) { num_levels = log2i(*width < *height ? *width : *height) + 1; } int total_data_size = 0; for (int i = 0; i < num_levels; i++) { if (i > 0) { width[i] = width[i-1] / 2; height[i] = height[i-1] / 2; } switch (*flags & ZIM_FORMAT_MASK) { case ZIM_RGBA8888: image_data_size[i] = width[i] * height[i] * 4; break; case ZIM_RGBA4444: case ZIM_RGB565: image_data_size[i] = width[i] * height[i] * 2; break; case ZIM_ETC1: { int data_width = width[i]; int data_height = height[i]; if (data_width < 4) data_width = 4; if (data_height < 4) data_height = 4; image_data_size[i] = data_width * data_height / 2; break; } default: ELOG("Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK); return 0; } total_data_size += image_data_size[i]; } if (total_data_size == 0) { ELOG("Invalid ZIM data size 0"); return 0; } image[0] = (uint8 *)malloc(total_data_size); for (int i = 1; i < num_levels; i++) { image[i] = image[i-1] + image_data_size[i-1]; } if (*flags & ZIM_ZLIB_COMPRESSED) { long outlen = (long)total_data_size; if (Z_OK != ezuncompress(*image, &outlen, (unsigned char *)(zim + 16), (long)datasize - 16)) { free(*image); *image = 0; return 0; } if (outlen != total_data_size) { ELOG("Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size); } } else { memcpy(*image, zim + 16, datasize - 16); if (datasize - 16 != (size_t)total_data_size) { ELOG("Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size); } } return num_levels;}
开发者ID:fuhuan416,项目名称:native,代码行数:73,
示例25: RunTestsvoid RunTests(){ std::string output;#ifdef IOS const std::string baseDirectory = g_Config.flash0Directory + "../";#else const std::string baseDirectory = g_Config.memStickDirectory;#endif CoreParameter coreParam; coreParam.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER; coreParam.gpuCore = g_Config.bSoftwareRendering ? GPU_SOFTWARE : GPU_GLES; coreParam.enableSound = g_Config.bEnableSound; coreParam.graphicsContext = PSP_CoreParameter().graphicsContext; coreParam.mountIso = ""; coreParam.mountRoot = baseDirectory + "pspautotests/"; coreParam.startPaused = false; coreParam.printfEmuLog = false; coreParam.headLess = true; coreParam.renderWidth = 480; coreParam.renderHeight = 272; coreParam.pixelWidth = 480; coreParam.pixelHeight = 272; coreParam.collectEmuLog = &output; coreParam.unthrottle = true; coreParam.updateRecent = false; // Never report from tests. std::string savedReportHost = g_Config.sReportHost; g_Config.sReportHost = ""; for (size_t i = 0; i < ARRAY_SIZE(testsToRun); i++) { const char *testName = testsToRun[i]; coreParam.fileToStart = baseDirectory + "pspautotests/tests/" + testName + ".prx"; std::string expectedFile = baseDirectory + "pspautotests/tests/" + testName + ".expected"; ILOG("Preparing to execute %s", testName); std::string error_string; output = ""; if (!PSP_Init(coreParam, &error_string)) { ELOG("Failed to init unittest %s : %s", testsToRun[i], error_string.c_str()); PSP_CoreParameter().pixelWidth = pixel_xres; PSP_CoreParameter().pixelHeight = pixel_yres; return; } // Run the emu until the test exits while (true) { int blockTicks = usToCycles(1000000 / 10); while (coreState == CORE_RUNNING) { PSP_RunLoopFor(blockTicks); } // Hopefully coreState is now CORE_NEXTFRAME if (coreState == CORE_NEXTFRAME) { // set back to running for the next frame coreState = CORE_RUNNING; } else if (coreState == CORE_POWERDOWN) { ILOG("Finished running test %s", testName); break; } } std::ifstream expected(expectedFile.c_str(), std::ios_base::in); if (!expected) { ELOG("Error opening expectedFile %s", expectedFile.c_str()); break; } std::istringstream logoutput(output); int line = 0; while (true) { ++line; std::string e, o; std::getline(expected, e); std::getline(logoutput, o); // Remove stray returns e = TrimNewlines(e); o = TrimNewlines(o); if (e != o) { ELOG("DIFF on line %i!", line); ELOG("O: %s", o.c_str()); ELOG("E: %s", e.c_str()); } if (expected.eof()) { break; } if (logoutput.eof()) { break; } } PSP_Shutdown(); } glViewport(0,0,pixel_xres,pixel_yres); PSP_CoreParameter().pixelWidth = pixel_xres; PSP_CoreParameter().pixelHeight = pixel_yres; PSP_CoreParameter().headLess = false; g_Config.sReportHost = savedReportHost;}
开发者ID:BlueSplash,项目名称:ppsspp,代码行数:100,
示例26: OpenSLWrap_Init// create the engine and output mix objectsextern "C" bool OpenSLWrap_Init(AndroidAudioCallback cb, int _FramesPerBuffer, int _SampleRate) { audioCallback = cb; framesPerBuffer = _FramesPerBuffer; if (framesPerBuffer == 0) framesPerBuffer = 256; if (framesPerBuffer < 32) framesPerBuffer = 32; sampleRate = _SampleRate; if (sampleRate != 44100 && sampleRate != 48000) { ELOG("Invalid sample rate %i - choosing 44100", sampleRate); sampleRate = 44100; } buffer[0] = new short[framesPerBuffer * 2]; buffer[1] = new short[framesPerBuffer * 2]; SLresult result; // create engine result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL); assert(SL_RESULT_SUCCESS == result); result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); assert(SL_RESULT_SUCCESS == result); result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, 0, 0); assert(SL_RESULT_SUCCESS == result); result = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); SLuint32 sr = SL_SAMPLINGRATE_44_1; if (sampleRate == 48000) { sr = SL_SAMPLINGRATE_48; } SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2}; SLDataFormat_PCM format_pcm = { SL_DATAFORMAT_PCM, 2, sr, SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16, SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT, SL_BYTEORDER_LITTLEENDIAN }; SLDataSource audioSrc = {&loc_bufq, &format_pcm}; // configure audio sink SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObject}; SLDataSink audioSnk = {&loc_outmix, NULL}; // create audio player const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME}; const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req); assert(SL_RESULT_SUCCESS == result); result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay); assert(SL_RESULT_SUCCESS == result); result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, &bqPlayerBufferQueue); assert(SL_RESULT_SUCCESS == result); result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, NULL); assert(SL_RESULT_SUCCESS == result); result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_VOLUME, &bqPlayerVolume); assert(SL_RESULT_SUCCESS == result); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); assert(SL_RESULT_SUCCESS == result); // Render and enqueue a first buffer. (or should we just play the buffer empty?) curBuffer = 0; audioCallback(buffer[curBuffer], framesPerBuffer); result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[curBuffer])); if (SL_RESULT_SUCCESS != result) { return false; } curBuffer ^= 1; return true;}
开发者ID:Bigpet,项目名称:native,代码行数:83,
示例27: ELOGtpool::TaskSPtr CxxIwyu::iwyuCommand(const doim::FsDirectorySPtr& directory, const doim::CxxFileSPtr& cxxFile) const{ auto arguments = CxxCompiler::includeArguments(directory, cxxFile->cxxIncludeDirectories()); arguments->insert(CxxCompiler::gStdCpp14Argument); arguments->insert(CxxCompiler::gOptimizationLevel0Argument); const string& file = cxxFile->file()->path(directory); auto argument_file = doim::SysArgument::unique(file); arguments->insert(argument_file); arguments = doim::SysArgumentSet::unique(arguments); auto command = doim::SysCommand::unique(nullptr, mTool, arguments); auto fn = [directory, cxxFile](int exit, const string& output) -> ECode { if (exit == 0) { ELOG("Unexpected exit code from iwyu tool: {}", exit); EHBan(kUnexpected); } bool success = true; static std::regex removeItemsRegex( "(?:^|/n)(.*?) should remove these lines:" "(?:[//s//r//n]+- #include.*?////// lines //d+-//d+)+"); static std::regex removeItemRegex("- (#include.*?)//s*////// lines (//d+)-//d+"); auto its = std::sregex_iterator(output.begin(), output.end(), removeItemsRegex); for (std::sregex_iterator items = its; items != std::sregex_iterator(); ++items) { std::smatch smatchs = *items; const auto& removes = smatchs.str(); auto it = std::sregex_iterator(removes.begin(), removes.end(), removeItemRegex); for (std::sregex_iterator item = it; item != std::sregex_iterator(); ++item) { success = false; std::smatch smatch = *item; ELOG("/n{}:{}:1: error: extra {} ", smatchs[1].str(), smatch[2].str(), smatch[1].str()); } } static std::regex addItemsRegex("(?:^|/n)(.*?) should add these lines:" "(?:[//s//r//n]+#include.*?//////[^//n]*)+"); static std::regex addItemRegex("(#include//s[/"<]([^/">]+)[^//n]+)"); struct Warning { std::string erroredFile; std::string missingHeader; }; std::vector<Warning> warnings; its = std::sregex_iterator(output.begin(), output.end(), addItemsRegex); for (std::sregex_iterator items = its; items != std::sregex_iterator(); ++items) { std::smatch smatchs = *items; const auto& adds = smatchs.str(); auto it = std::sregex_iterator(adds.begin(), adds.end(), addItemRegex); for (std::sregex_iterator item = it; item != std::sregex_iterator(); ++item) { std::smatch smatch = *item; warnings.push_back(Warning{smatchs[1].str(), smatch[2].str()}); } } for (const auto& warning : warnings) { auto file = doim::FsFile::find(directory, warning.erroredFile); if (file == nullptr) { success = false; ELOG("IWYU reports issues for unknown file {}", warning.erroredFile); continue; } doim::CxxIncludeDirectory::CxxHeaderInfo headerInfo; if (cxxFile->file() == file) { EHLog(doim::CxxIncludeDirectory::findHeaderDeep( string_view(warning.missingHeader), nullptr, cxxFile->cxxIncludeDirectories(), headerInfo)); } else { EHLog(doim::CxxIncludeDirectory::findHeaderDeep( file, nullptr, cxxFile->cxxIncludeDirectories(), headerInfo)); if (headerInfo.mHeader == nullptr) { success = false;//.........这里部分代码省略.........
开发者ID:ggeorgiev,项目名称:dbs,代码行数:101,
示例28: glsl_recompilebool glsl_recompile(GLSLProgram *program, std::string *error_message) { struct stat vs, fs; AutoCharArrayBuf vsh_src, fsh_src; if (strlen(program->vshader_filename) > 0 && 0 == stat(program->vshader_filename, &vs)) { program->vshader_mtime = vs.st_mtime; if (!program->vshader_source) { size_t sz; vsh_src.reset((char *)ReadLocalFile(program->vshader_filename, &sz)); } } else { program->vshader_mtime = 0; } if (strlen(program->fshader_filename) > 0 && 0 == stat(program->fshader_filename, &fs)) { program->fshader_mtime = fs.st_mtime; if (!program->fshader_source) { size_t sz; fsh_src.reset((char *)ReadLocalFile(program->fshader_filename, &sz)); } } else { program->fshader_mtime = 0; } if (!program->vshader_source && !vsh_src) { size_t sz; vsh_src.reset((char *)VFSReadFile(program->vshader_filename, &sz)); } if (!program->vshader_source && !vsh_src) { ELOG("File missing: %s", program->vshader_filename); if (error_message) { *error_message = std::string("File missing: ") + program->vshader_filename; } return false; } if (!program->fshader_source && !fsh_src) { size_t sz; fsh_src.reset((char *)VFSReadFile(program->fshader_filename, &sz)); } if (!program->fshader_source && !fsh_src) { ELOG("File missing: %s", program->fshader_filename); if (error_message) { *error_message = std::string("File missing: ") + program->fshader_filename; } return false; } GLuint vsh = glCreateShader(GL_VERTEX_SHADER); const GLchar *vsh_str = program->vshader_source ? program->vshader_source : (const GLchar *)(vsh_src); if (!CompileShader(vsh_str, vsh, program->vshader_filename, error_message)) { return false; } const GLchar *fsh_str = program->fshader_source ? program->fshader_source : (const GLchar *)(fsh_src); GLuint fsh = glCreateShader(GL_FRAGMENT_SHADER); if (!CompileShader(fsh_str, fsh, program->fshader_filename, error_message)) { glDeleteShader(vsh); return false; } GLuint prog = glCreateProgram(); glAttachShader(prog, vsh); glAttachShader(prog, fsh); glLinkProgram(prog); GLint linkStatus; glGetProgramiv(prog, GL_LINK_STATUS, &linkStatus); if (linkStatus == GL_FALSE) { GLint bufLength = 0; glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &bufLength); if (bufLength) { char* buf = new char[bufLength + 1]; // safety glGetProgramInfoLog(prog, bufLength, NULL, buf); ILOG("vsh: %i fsh: %i", vsh, fsh); ELOG("Could not link shader program (linkstatus=%i):/n %s /n", linkStatus, buf); if (error_message) { *error_message = buf; } delete [] buf; } else { ILOG("vsh: %i fsh: %i", vsh, fsh); ELOG("Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus); if (error_message) { *error_message = "(no error message available)"; } } glDeleteShader(vsh); glDeleteShader(fsh); return false; } // Destroy the old program, if any. if (program->program_) { glDeleteProgram(program->program_); } program->program_ = prog; program->vsh_ = vsh; program->fsh_ = fsh;//.........这里部分代码省略.........
开发者ID:Alceris,项目名称:ppsspp,代码行数:101,
示例29: main//.........这里部分代码省略......... if (path[strlen(path)-1] != '/') strcat(path, "/");#endif#ifdef _WIN32 NativeInit(argc, (const char **)argv, path, "D://", "BADCOFFEE");#else NativeInit(argc, (const char **)argv, path, "/tmp", "BADCOFFEE");#endif dp_xres = (float)pixel_xres * density / zoom; dp_yres = (float)pixel_yres * density / zoom; pixel_in_dps = (float)pixel_xres / dp_xres; NativeInitGraphics(); glstate.viewport.set(0, 0, pixel_xres, pixel_yres); float dp_xscale = (float)dp_xres / pixel_xres; float dp_yscale = (float)dp_yres / pixel_yres; printf("Pixels: %i x %i/n", pixel_xres, pixel_yres); printf("Virtual pixels: %i x %i/n", dp_xres, dp_yres); SDL_AudioSpec fmt; fmt.freq = 44100; fmt.format = AUDIO_S16; fmt.channels = 2; fmt.samples = 1024; fmt.callback = &mixaudio; fmt.userdata = (void *)0; if (SDL_OpenAudio(&fmt, NULL) < 0) { ELOG("Failed to open audio: %s", SDL_GetError()); return 1; } // Audio must be unpaused _after_ NativeInit() SDL_PauseAudio(0);#ifdef PANDORA // Joysticks init, we the nubs if setup as Joystick int numjoys = SDL_NumJoysticks(); if (numjoys>0) for (int i=0; i<numjoys; i++) { if (strncmp(SDL_JoystickName(i), "nub0", 4) == 0) ljoy=SDL_JoystickOpen(i); if (strncmp(SDL_JoystickName(i), "nub1", 4) == 0) rjoy=SDL_JoystickOpen(i); }#endif int framecount = 0; bool nextFrameMD = 0; float t = 0, lastT = 0; while (true) { input_state.accelerometer_valid = false; input_state.mouse_valid = true; int quitRequested = 0; SDL_Event event; while (SDL_PollEvent(&event)) { float mx = event.motion.x * dp_xscale; float my = event.motion.y * dp_yscale; if (event.type == SDL_QUIT) {
开发者ID:PeterTh,项目名称:native,代码行数:67,
注:本文中的ELOG函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ELOG_DEBUG函数代码示例 C++ ELL_3V_SET函数代码示例 |