void Cwhu_FaxSettingDlg::Lin_ImportAutoForArr(CString m_FilePath,CStringArray &m_AutoForward) { int Number = 0; //m_DutyArr数组必须足够大// //导入 CApplication app; CWorkbook book; CWorkbooks books; CWorksheet sheet; CWorksheets sheets; CRange range; LPDISPATCH lpDisp; //定义变量// COleVariant covOptional((long) DISP_E_PARAMNOTFOUND,VT_ERROR); if (!app.CreateDispatch(_T("Excel.Application"))) { this->MessageBox(_T("无法创建Excel应用")); } books = app.get_Workbooks(); //打开Excel,其中m_FilePath为Excel表的路径名// lpDisp = books.Open(m_FilePath,covOptional ,covOptional,covOptional,covOptional ,covOptional,covOptional,covOptional ,covOptional,covOptional,covOptional ,covOptional,covOptional,covOptional ,covOptional); book.AttachDispatch(lpDisp); sheets = book.get_Worksheets(); sheet = sheets.get_Item(COleVariant((short)1)); CStringArray m_ContentArr; for (int ItemNum = 2;ItemNum<40;ItemNum++) { for (int ColumNum=1;ColumNum<11;ColumNum++) { CString m_pos = Lin_GetEnglishCharacter(ColumNum); CString m_Itempos; m_Itempos.Format(_T("%d"),ItemNum); CString m_str = m_pos+m_Itempos; range = sheet.get_Range(COleVariant(m_str),COleVariant(m_str)); //获得单元格的内容 COleVariant rValue; rValue = COleVariant(range.get_Value2()); //转换成宽字符// rValue.ChangeType(VT_BSTR); //转换格式,并输出// CString m_content = CString(rValue.bstrVal); if (m_content!=_T("")) { m_AutoForward.Add(m_content); } } } book.put_Saved(TRUE); app.Quit(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); CApplication LaBotBox; LaBotBox.run(); return a.exec(); // }
Uint32 JoystickTimerCallback(Uint32 interval, void *) { CApplication *app = CApplication::GetInstancePointer(); if ((app == nullptr) || (! app->GetJoystickEnabled())) return 0; // don't run the timer again app->UpdateJoystick(); return interval; // run for the same interval again }
void Selene::Entry(CApplication& rApp) { Selene::CAppConfig* pConfig = rApp.GetAppConfig(); pConfig->SetAppName("SeleneDev"); SeleneDev::CGame* pGame = new SeleneDev::CGame(); int gameID = rApp.AddModule("Game", pGame); (void) gameID; rApp.AddToLoop(gameID); }
void CApplication::_programFailCallback(int signum) { if (!_failHandlerCalled) { _failHandlerCalled = true; CApplication * app = getInstance(); CEvent event(app); app->raiseEvent("onFatalError", event); } signal(signum, SIG_DFL); exit(3); }
int APIENTRY WinMain(HINSTANCE p_instance,HINSTANCE p_prev_instance,LPSTR p_cmd_line,int p_show) { //In win32 the p_prev_instance is ignored NOP(p_prev_instance,p_cmd_line,p_show); if( SUCCEEDED(App.Create( p_instance) )) { return App.Run(); } return 0; }
HRESULT CApplication::GetUI(IUserInterface** ppIUserInterface) throw() { if ( ! ppIUserInterface ) return E_POINTER; // return CoCreateInstance( CLSID_PeerProjectApplication, NULL, CLSCTX_ALL, IID_IUserInterface, (void**)ppIUserInterface ); CApplication* pApp = new CApplication; if ( ! pApp ) return E_OUTOFMEMORY; *ppIUserInterface = static_cast< IUserInterface* >( pApp->GetInterface( IID_IUserInterface ) ); return *ppIUserInterface ? S_OK : E_NOINTERFACE; }
HRESULT CApplication::GetSettings(ISettings** ppISettings) throw() { if ( ! ppISettings ) return E_POINTER; // return CoCreateInstance( CLSID_PeerProjectApplication, NULL, CLSCTX_ALL, IID_ISettings, (void**)ppISettings ); CApplication* pApp = new CApplication; if ( ! pApp ) return E_OUTOFMEMORY; *ppISettings = static_cast< ISettings* >( pApp->GetInterface( IID_ISettings ) ); return *ppISettings ? S_OK : E_NOINTERFACE; }
//============================================================================= int PLATFORM_MAIN () { DebugBreakOnAllocation(71); Initialize(); CApplication app; app.Go(); Uninitialize(); return 0; }
void ole_close_excel(const std::wstring &xlsx, CApplication &excel_application, CWorkbooks &books, CWorkbook &book, CWorksheets &sheets) { COleVariant covTrue((short)TRUE), covFalse((short)FALSE); COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); book.Close(COleVariant(short(FALSE)),COleVariant(xlsx.c_str()), covOptional); books.Close(); // 释放资源 sheets.ReleaseDispatch(); book.ReleaseDispatch(); books.ReleaseDispatch(); excel_application.Quit(); excel_application.ReleaseDispatch(); }
void appicationInitApp() { if ( g_appInit ) { // add zip data const char *dataPak = NULL; #ifdef USE_ZIPPACKAGE dataPak = getIView()->getPhysicPath("_common.zip"); #endif // create irrlicht device #if defined(_IRR_COMPILE_WITH_OGLES1_) g_irrDevice = createDevice( irr::video::EDT_OGLES1, core::dimension2d<u32>(480, 800), 16, false, false, false, dataPak, &g_myApp ); #else g_irrDevice = createDevice( irr::video::EDT_OGLES2, core::dimension2d<u32>(480, 800), 16, false, false, false, dataPak, &g_myApp ); #endif // init application g_myApp.initApplication( g_irrDevice ); } else if ( g_appResume ) { // resume application g_appResume = false; } g_appInit = false; }
int32 main(int32 argc, const char ** argv) { CApplication app; if (app.initialize(argc, argv)) { CCityDemo * demo = new CCityDemo; app.run(demo); app.shutdown(); delete demo; } }
bool CPalletID::PrintBarCode(int BoadNumber,CString &csTotal, bool isPrint) { CString temp; GetMyCurrentTime(temp,false); CString CS_SERIAL; CS_SERIAL.Format(L"%05d",BoadNumber); csTotal = temp + CS_SERIAL; if (isPrint) { //AfxMessageBox(L"创建组件"); const IID clsid = {0x3624b9c0, 0x9e5d,0x11d3, {0xa8,0x96, 0x00,0xc0,0x4f, 0x32, 0x4e, 0x22}}; CApplication app; if (FALSE == app.CreateDispatch(clsid)) { AfxMessageBox(_T("创建组件对象失败")); return false; } //CString szDir; //szDir.Format(L"\\\\172.20.0.8\\1.公司会议资料\\博杰生产管理软件\\条码模板\\卡板条形码.lab"); //szDir.Format(L"卡板条形码.lab"); TCHAR szDir[MAX_PATH] = {0}; GetModuleFileName(NULL, szDir, MAX_PATH); TCHAR* pEnd = _tcsrchr(szDir, _T('\\')); if(pEnd) *pEnd = 0; _tcscat_s(szDir, _T("\\卡板条形码.lab")); //Sleep(1000); _bstr_t bszDir = (szDir); if (app.GetDocuments()->Open(bszDir, true) == FALSE) { AfxMessageBox(_T("打开模板失败")); return false; } IDocumentStr *pdoc = (IDocumentStr *)app.GetActiveDocument(); //AfxMessageBox(csTotal); //Sleep(1000); _bstr_t bSerial =(csTotal); pdoc->GetVariables()->GetFormVariables()->Item(_T("Serial"))->Value = bSerial; pdoc->PrintDocument(1); app.Quit(); //AfxMessageBox(L"Fnish"); } return true; }
void GetStats(double &time1, double &time2, double &time3, uint64 &_n_unique, uint64 &_n_cutoff_min, uint64 &_n_cutoff_max, uint64 &_n_total, uint64 &_n_reads, uint64 &_tmp_size, uint64 &_tmp_size_strict_mem, uint64 &_max_disk_usage, uint64& _n_total_super_kmers) { if (is_selected) { kmc->GetStats(time1, time2, time3, _n_unique, _n_cutoff_min, _n_cutoff_max, _n_total, _n_reads, _tmp_size, _tmp_size_strict_mem, _max_disk_usage, _n_total_super_kmers); } else app_1->GetStats(time1, time2, time3, _n_unique, _n_cutoff_min, _n_cutoff_max, _n_total, _n_reads, _tmp_size, _tmp_size_strict_mem, _max_disk_usage, _n_total_super_kmers); }
bool Process() { if (is_selected) { return kmc->Process(); } else return app_1->Process(); }
/** * This is a recursive function which will create CApplication tree. * It will walk through the entire uninstallation tree and create * tree of CApplication for all the planned nodes. * * @param aRootNode Root node of uninstallation tree. * @return CApplication pointer corresponding to the aRootNode. */ CApplication* CPlanner::CreatePlannedApplicationL(CUninstallationNode& aRootNode) { CApplication* rootApplication = CApplication::NewLC(); RPointerArray<CUninstallationNode>& nodes = aRootNode.ChildNodes(); for(TInt i = 0; i < nodes.Count(); ++i) { if(!nodes[i]->IsPlanned()) { continue; } CApplication* child = CreatePlannedApplicationL(*nodes[i]); CleanupStack::PushL(child); rootApplication->AddEmbeddedApplicationL(child); CleanupStack::Pop(child); } UpdateAppForUninstallL(*rootApplication, aRootNode); if(!(Swi::SecUtils::IsPackageUidPresent(aRootNode.PackageL().Uid(), iUidList))) { TInt err = SecUtils::PublishPackageUid(aRootNode.PackageL().Uid(), iUidList); if(err==KErrNone) { DEBUG_PRINTF2(_L("CPlanner::CreatePlannedApplicationL published Uid is %x."),aRootNode.PackageL().Uid()); } else if(err == KErrOverflow) { DEBUG_PRINTF2(_L("CPlanner::CreatePlannedApplicationL failed to publish Uid %x as the array, holding the uids, exceeded its upper limit."),aRootNode.PackageL().Uid()); } else if(err == KErrNotFound) { DEBUG_PRINTF2(_L("CPlanner::CreatePlannedApplicationL failed to publish Uid %x as the property is not defined."),aRootNode.PackageL().Uid()); } else { DEBUG_PRINTF3(_L("CPlanner::CreatePlannedApplicationL failed to publish Uid %x with error."),aRootNode.PackageL().Uid(), err); User::Leave(err); } } CleanupStack::Pop(rootApplication); return rootApplication; }
int main() { CApplication app; // create application if( !app.Create(1024, 664, false) ) //if( !app.Create(1366, 768, true) ) return false; // main loop while( app.IsRunning() ) { app.AdvanceFrame(); } app.Destroy(); // exit the app return 0; }
/* Our custom handler (content generator) */ int foo_handler( request_rec* inpRequest ) { // int nReturnVal = DECLINED; // // if ( inpRequest->handler != NULL && strcmp( inpRequest->handler, "foo" ) == 0 ) // { // ap_rputs( "Hello World from FOO", inpRequest ); // nReturnVal = OK; // } // // return nReturnVal; /* Create an instance of our application. */ CApplication* pApp = new CApplication( inpRequest ); if ( pApp == NULL ) return HTTP_SERVICE_UNAVAILABLE; /* Register a C function to delete pApp at the end of the request cycle. */ apr_pool_cleanup_register( inpRequest->pool, ( void* )pApp, foo_delete_capplication_object, apr_pool_cleanup_null ); /* Reserve a temporary memory block from the request pool to store data between hooks. */ FOOCONFIG_t* pFooConfig = ( FOOCONFIG_t* ) apr_palloc( inpRequest->pool, sizeof( FOOCONFIG_t ) ); /* Remember our application pointer for future calls. */ pFooConfig->vpCApplication = ( void* )pApp; /* Register our config data structure for our module. */ foo_register_config_ptr( inpRequest, pFooConfig ); /* Run our application handler. */ return pApp->RunHandler(); }
int main(int argc, char *argv[]) { int result = -1; try { CApplication application; result = application.Start(argc, argv); } catch(std::exception const& e) { std::ofstream error("ERROR.TXT", std::ios::out, std::ios::app); if( error.is_open() ) error << "An exception has been thrown:" << "\n" << e.what() << "\n"; } catch(...) { std::ofstream error("ERROR.TXT", std::ios::out, std::ios::app); if( error.is_open() ) error << "An exception has been thrown." << "\n"; } return result; }
bool ole_open_excel(const string &xlsx, CApplication &excel_application, CWorkbooks &books, CWorkbook &book, CWorksheets &sheets) { if(!init_ole()){ return false; } if(false == filetool::exist(xlsx)){ std::string err = xlsx + "文件不存在!"; AfxMessageBox(strtool::string2wstring(err).c_str()); return false; } //创建Excel 服务器(启动Excel) if(!excel_application.CreateDispatch(_T("Excel.Application"),NULL)){ AfxMessageBox(_T("启动Excel服务器失败!")); return false; } excel_application.put_Visible(FALSE); excel_application.put_DisplayAlerts(FALSE); excel_application.put_UserControl(FALSE); //得到工作簿容器 books.AttachDispatch(excel_application.get_Workbooks(), TRUE); // const std::wstring wstr = const std::wstring w_xlsx = strtool::string2wstring(xlsx); //L"E:\\proj\\github_tokit\\trunk\\example\\excel\\测试用例.xlsx"; //打开一个工作簿,如不存在,则新增一个工作簿 LPDISPATCH lpDisp = books.Add(COleVariant(w_xlsx.c_str())); if (lpDisp){ book.AttachDispatch(lpDisp); // 得到工作簿中的Sheet的容器 sheets.AttachDispatch(book.get_Sheets()); } return true; }
int main() { CApplication* app = new CApplication(); app->GetDevice()->SetWidth(800); app->GetDevice()->SetHeight(600); if (app->Init()) { while (app->IsRunning()) { app->Update(); Sleep(100); } app->Deinit(); } return 0; }
HRESULT CXBMC_PC::Create( HINSTANCE hInstance, LPSTR commandLine ) { m_hInstance = hInstance; HRESULT hr = S_OK; CStdStringW strcl(commandLine); LPWSTR *szArglist; int nArgs; szArglist = CommandLineToArgvW(strcl.c_str(), &nArgs); if(szArglist != NULL) { for(int i=0;i<nArgs;i++) { CStdStringW strArgW(szArglist[i]); if(strArgW.Equals(L"-fs")) g_advancedSettings.m_startFullScreen = true; else if(strArgW.Equals(L"-p") || strArgW.Equals(L"--portable")) g_application.EnablePlatformDirectories(false); else if(strArgW.Equals(L"-d")) { if(++i < nArgs) { int iSleep = _wtoi(szArglist[i]); if(iSleep > 0 && iSleep < 360) Sleep(iSleep*1000); else --i; } } } LocalFree(szArglist); } return S_OK; }
void appicationExitApp() { g_myApp.destroyApplication(); g_irrDevice->drop(); __android_log_print(ANDROID_LOG_INFO, "libgsgameplay.so", "Native Application has exited"); }
void appicationLoop() { if ( g_irrDevice->run() ) g_myApp.mainLoop(); }
void COpenExcelDlg::Lin_InportExcelToList(CString m_FilePath,CListCtrl &m_List) { //先删除列表内容// m_List.DeleteAllItems(); while(m_List.GetHeaderCtrl()->GetItemCount()>0) { m_List.DeleteColumn(0); } //导入 CApplication app; CWorkbook book; CWorkbooks books; CWorksheet sheet; CWorksheets sheets; CRange range; LPDISPATCH lpDisp; //定义变量// COleVariant covOptional((long) DISP_E_PARAMNOTFOUND,VT_ERROR); if (!app.CreateDispatch(_T("Excel.Application"))) { this->MessageBox(_T("无法创建Excel应用")); return; } books = app.get_Workbooks(); //打开Excel,其中m_FilePath为Excel表的路径名// lpDisp = books.Open(m_FilePath,covOptional ,covOptional,covOptional,covOptional ,covOptional,covOptional,covOptional ,covOptional,covOptional,covOptional ,covOptional,covOptional,covOptional ,covOptional); book.AttachDispatch(lpDisp); sheets = book.get_Worksheets(); sheet = sheets.get_Item(COleVariant((short)1)); CStringArray m_HeadName; for (int i=1;i<26;i++) { CString m_pos = Lin_GetEnglishCharacter(i); m_pos = m_pos + _T("1"); range = sheet.get_Range(COleVariant(m_pos),COleVariant(m_pos)); //获得单元格的内容 COleVariant rValue; rValue = COleVariant(range.get_Value2()); //转换成宽字符// rValue.ChangeType(VT_BSTR); //转换格式,并输出// CString m_content = CString(rValue.bstrVal); if (m_content!=_T("")) { m_HeadName.Add(m_content); } } Lin_InitList(m_List,m_HeadName); CStringArray m_ContentArr; for (int ItemNum = 0;ItemNum<10000;ItemNum++) { for (int j=1;j<m_List.GetHeaderCtrl()->GetItemCount();j++) { CString m_pos = Lin_GetEnglishCharacter(j); CString m_Itempos; m_Itempos.Format(_T("%d"),ItemNum+2); CString m_str = m_pos+m_Itempos; range = sheet.get_Range(COleVariant(m_str),COleVariant(m_str)); //获得单元格的内容 COleVariant rValue; rValue = COleVariant(range.get_Value2()); //转换成宽字符// rValue.ChangeType(VT_BSTR); //转换格式,并输出// CString m_content = CString(rValue.bstrVal); m_ContentArr.Add(m_content); } if (m_ContentArr.GetAt(0)!=_T("")) { Lin_InsertList(m_List,m_ContentArr); m_ContentArr.RemoveAll(); } else{ break; } } book.put_Saved(TRUE); app.Quit(); }
void appicationResizeWindow(int w, int h) { g_myApp.notifyResizeWin(w, h); }
INT CXBMC_PC::Run() { g_application.Create(NULL); g_application.Run(); return 0; }
//---------------------------------------------------------------------------------- // Main function int _tmain(int argc, _TCHAR* argv[]) { CStopWatch w0, w1; double time1, time2, time3; uint64 n_unique, n_cutoff_min, n_cutoff_max, n_total, n_reads, tmp_size, tmp_size_strict_mem, max_disk_usage, n_total_super_kmers; omp_set_num_threads(1); #ifdef WIN32 _setmaxstdio(2040); #endif if(!parse_parameters(argc, argv)) { usage(); return 0; } if(Params.p_quake) { CApplication<CKmerQuake, KMER_WORDS, true> *app = new CApplication<CKmerQuake, KMER_WORDS, true>(Params); if(!app->Process()) { cout << "Not enough memory or some other error\n"; delete app; return 0; } app->GetStats(time1, time2, time3, n_unique, n_cutoff_min, n_cutoff_max, n_total, n_reads, tmp_size, tmp_size_strict_mem, max_disk_usage, n_total_super_kmers); delete app; } else { CApplication<CKmer, KMER_WORDS, false> *app = new CApplication<CKmer, KMER_WORDS, false>(Params); if(!app->Process()) { cout << "Not enough memory or some other error\n"; delete app; return 0; } app->GetStats(time1, time2, time3, n_unique, n_cutoff_min, n_cutoff_max, n_total, n_reads, tmp_size, tmp_size_strict_mem, max_disk_usage, n_total_super_kmers); delete app; } cout << "1st stage: " << time1 << "s\n"; cout << "2nd stage: " << time2 << "s\n"; if (Params.p_strict_mem) cout << "3rd stage: " << time3 << "s\n"; if (Params.p_strict_mem) cout << "Total : " << (time1 + time2 + time3) << "s\n"; else cout << "Total : " << (time1+time2) << "s\n"; if (Params.p_strict_mem) { cout << "Tmp size : " << tmp_size / 1000000 << "MB\n"; cout << "Tmp size strict memory : " << tmp_size_strict_mem / 1000000 << "MB\n"; //cout << "Tmp total: " << (tmp_size + tmp_size_strict_mem) / 1000000 << "MB\n"; cout << "Tmp total: " << max_disk_usage / 1000000 << "MB\n"; } else cout << "Tmp size : " << tmp_size / 1000000 << "MB\n"; cout << "\nStats:\n"; cout << " No. of k-mers below min. threshold : " << setw(12) << n_cutoff_min << "\n"; cout << " No. of k-mers above max. threshold : " << setw(12) << n_cutoff_max << "\n"; cout << " No. of unique k-mers : " << setw(12) << n_unique << "\n"; cout << " No. of unique counted k-mers : " << setw(12) << n_unique-n_cutoff_min-n_cutoff_max << "\n"; cout << " Total no. of k-mers : " << setw(12) << n_total << "\n"; if(Params.p_file_type != multiline_fasta) cout << " Total no. of reads : " << setw(12) << n_reads << "\n"; else cout << " Total no. of sequences : " << setw(12) << n_reads << "\n"; cout << " Total no. of super-k-mers : " << setw(12) << n_total_super_kmers << "\n"; return 0; }
void appicationTouchUp(int touchID, int x, int y) { g_myApp.notifyTouchEvent(CTouchManager::TouchUp, x, y, touchID); }
CString CEditorParam::CreateFormattedParamString(EventSheetEditor* pEd, CEditorAction* pAction, CEditorCondition* pCondition) { CApplication* pApp = pEd->application; CObjTypeMap& typemap = pApp->object_types; valid = true; CString ret; for( int a = 0; a < ttokens.size(); a++) { Token& tokenitem = ttokens[a]; if(tokenitem.t == T_IDENTIFIER && tokenitem.tsub == TT_OBJECTNAME) // object param { long number = tokenitem.oidOwner; CObjType* pType = pEd->application->FindObjTypeFromNumber(number); if(pType) { int specialvalue = 0; if(pAction) { pAction->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pAction->m_imgs.back(); image->tok = &tokenitem; specialvalue = pAction->m_imgs.size()-1; } if(pCondition) { pCondition->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pCondition->m_imgs.back(); image->tok = &tokenitem; specialvalue = pCondition->m_imgs.size()-1; } ret += pType->GetName(); ret += " <special_image>"; ret.AppendFormat("%d", specialvalue); ret += "</special_image> "; } else valid = false; //else - we need some sort of tempory name if we cant find one or the user could lose information! } else { CString string = tokenitem.str; string.Replace("&", "&"); string.Replace("<", "<"); string.Replace(">", ">"); if (tokenitem.t == T_STRINGLITERAL) string = CString("\"") + string + "\""; if (tokenitem.t == T_VARIABLENAME) { string = CString("'"); if(tokenitem.oidOwner == -1) { CApplication::GlobalVariable* global = pApp->GetGlobalVariable(tokenitem.id); if(global) string += global->name; else valid = false; } else if(CObjType* pType = pApp->FindObjTypeFromNumber(tokenitem.oidOwner)) { PrivateValue* Private = pType->GetPrivateVariable(tokenitem.id); if(Private) string += Private->name; else { // Not found; look up by name instead (valid expressions sometimes get here for families - AG) vector<PrivateValue>::iterator i = pType->m_PrivateValues.begin(); bool found = false; CString l = tokenitem.str; l.MakeLower(); for ( ; i != pType->m_PrivateValues.end(); i++) { CString r = i->name; r.MakeLower(); if (l == r) { found = true; string += i->name; break; } } if (!found) valid = false; } } else valid = false; //added to prevent family bug where deleting a family wont remove params refering to it string += "'"; } ret += string; } /* if(tokenitem.type == PTOK_COLOR) // for later when we have color tokens { int specialvalue = 0; if(pAction) { pAction->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pAction->m_imgs.back(); image->tok = &tokenitem; specialvalue = pAction->m_imgs.size()-1; } if(pCondition) { pCondition->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pCondition->m_imgs.back(); image->tok = &tokenitem; specialvalue = pCondition->m_imgs.size()-1; } ret += "<special_image>"; ret.AppendFormat("%d", specialvalue); ret += "</special_image> "; } */ } // Okay we have now recreated our token and everything...lets check what type of parameter it is! // Final step: if(m_type == 9 || m_type == 15) { CString formatted; formatted.Format("<b>%s</b>", m_reserved); return formatted; } // Private variable if(m_type == 14) { int varid = atoi(ret); CObjType* pType = pApp->FindObjTypeFromNumber(this->oid); if(pType) { for(vector<PrivateValue>::iterator v = pType->m_PrivateValues.begin(); v!= pType->m_PrivateValues.end(); v++) { if(v->identifier == varid) { CString formatted; formatted.Format("'%s'", v->name); return formatted; } } } } // Global variable if (m_type == 13) { int varid = atoi(ret); for(list<CApplication::GlobalVariable>::iterator v = pApp->global_variables.begin(); v != pApp->global_variables.end(); v++) { if(v->identifier == varid) { CString formatted; formatted.Format("'%s'", v->name); return formatted; } } } if(m_type == 6) // object..translate the parameter to a new number { int id = atoi(ret); CString newstring; newstring.Format("%d", id); if(ret == newstring) // will fail if its an attribute { /* int iconid; if(!pEd->m_familyhbitmaps.Lookup(id, iconid)) pEd->m_objecthbitmaps.Lookup(id, iconid); ret.Format("<img>%d</img>", iconid); */ long number = atol(ret); CObjType* pType; if(pType = pApp->FindObjTypeFromNumber(number)) { int specialvalue = 0; if(ttokens[0].t == T_INTEGER) { // ttokens[0].tsub = TT_OBJECTNAME; // ttokens[0].t = T_IDENTIFIER; ttokens[0].oidOwner = number; ttokens[0].id = number; //ttokens[0].trans = false; } if(pAction) { pAction->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pAction->m_imgs.back(); image->tok = &ttokens[0]; specialvalue = pAction->m_imgs.size()-1; } if(pCondition) { pCondition->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pCondition->m_imgs.back(); image->tok = &ttokens[0]; specialvalue = pCondition->m_imgs.size()-1; } ret = "<b>"; ret += pType->GetName(); ret += "</b>"; ret += " <special_image>"; ret.AppendFormat("%d", specialvalue); ret += "</special_image> "; return ret; } else valid = false; } else { // attribute.. } return ret; } if(m_type == 3) // colors { int id = atoi(ret); CString newstring; newstring.Format("%d", id); ttokens[0].t = T_COLOR; if(ret == newstring) // will fail if its an attribute { int specialvalue = 0; if(pAction) { pAction->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pAction->m_imgs.back(); image->tok = &ttokens[0]; image->tok->id = atoi(image->tok->str); specialvalue = pAction->m_imgs.size()-1; } if(pCondition) { pCondition->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pCondition->m_imgs.back(); image->tok = &ttokens[0]; image->tok->id = atoi(image->tok->str); specialvalue = pCondition->m_imgs.size()-1; } ret = "<special_image>"; ret.AppendFormat("%d", specialvalue); ret += "</special_image> "; return ret; } } // otherwise just return ret ;p CString format; format.Format("<i>%s</i>", ret); return format; }