int main(){ Exec("../test/manager", sizeof("../test/manager")); }
void ButtonEventHandlers::Call(Type type, Button *target) { scoped_ptr<ButtonEventHandlerList> p(new ButtonEventHandlerList(m_handlers[type])); for_each(p->begin(), p->end(), Exec(target)); }
//----------------------------------------------------------------------------- // return values: 0 - OK, 1 - wrong arguments, 2 - wrong command, 3 - string too long, 4 -- unclosed string int mglParser::Parse(mglGraph *gr, std::wstring str, long pos) { if(Stop || gr->NeedStop()) return 0; curGr = gr->Self(); std::wstring arg[1024]; str=mgl_trim_ws(str); long n,k=0,m=0,mm=0,res; // try parse ':' -- several commands in line for(n=0;n<long(str.length());n++) { if(str[n]=='\'' && (n==0 || str[n-1]!='\\')) k++; if(k%2) continue; if(str[n]=='(') m++; if(str[n]==')') m--; if(str[n]=='{') mm++; if(str[n]=='}') mm--; if(str[n]=='#') break; if((str[n]==':' || str[n]=='\n') && k%2==0 && m==0 && mm==0) { res=Parse(gr,str.substr(0,n),pos); if(!res) res=Parse(gr,str.substr(n+1),pos); return res; } } if(k%2 || m || mm) return 4; // strings is not closed // define parameters or start cycle res = ParseDef(str); if(res) return res-1; // parse arguments (parameters $1, ..., $9) PutArg(str,false); str=mgl_trim_ws(str); std::wstring opt; for(k=0;k<1024;k++) // parse string to substrings (by spaces) { n = mglFindArg(str); if(n<1) // this is option { if(str[-n]==';') opt = str.substr(-n+1); if(n<0) str = str.substr(0,-n); break; } arg[k] = str.substr(0,n); str = mgl_trim_ws(str.substr(n+1)); } // try to find last argument if(str[0]!=0 && str[0]!='#' && str[0]!=';') { arg[k] = str; k++; } if(k<1) n =0; else { // fill arguments by its values mglArg *a = new mglArg[k]; FillArg(gr, k, arg, a); // execute first special (program-flow-control) commands if(!skip() && !arg[0].compare(L"stop")) { Stop = true; delete []a; return 0; } if(!arg[0].compare(L"func")) { Stop = true; delete []a; return 0; } n = FlowExec(gr, arg[0].c_str(),k-1,a); if(n) { delete []a; return n-1; } if(skip()) { delete []a; return 0; } if(!arg[0].compare(L"load")) { int n = a[0].type==1?0:1; a[0].s.assign(a[0].w.begin(),a[0].w.end()); if(!n) mgl_parser_load(this,a[0].s.c_str()); delete []a; return n; } if(!arg[0].compare(L"define")) { if(k==3) { DeleteVar(arg[1].c_str()); // force to delete variable with the same name mglNum *v=AddNum(arg[1].c_str()); if(arg[2][0]=='!') // complex number is added { HADT dd = mglFormulaCalcC(arg[2].substr(1),this, DataList); v->d=NAN; v->c = dd->a[0]; delete dd; } else { HMDT dd = mglFormulaCalc(arg[2],this, DataList); v->c = v->d = dd->a[0]; delete dd; } } delete []a; return k==3?0:1; } if(!arg[0].compare(L"rkstep")) { int res=1; if(k>2 && a[0].type==1 && a[1].type==1) { std::wstring a1 = arg[1], a2=arg[2]; res = 0; if(a1[0]=='\'') a1 = a1.substr(1,a1.length()-2); if(a2[0]=='\'') a2 = a2.substr(1,a2.length()-2); mgl_rk_step_w(this, a1.c_str(), a2.c_str(), (k>=3 && a[2].type==2)?a[2].v:1); } delete []a; return res; } if(!arg[0].compare(L"call")) { n = 1; if(a[0].type==1) { int na=0; a[0].s.assign(a[0].w.begin(),a[0].w.end()); n=-IsFunc(a[0].w.c_str(),&na); if(n && k!=na+2) { char buf[64]; snprintf(buf,64,"Bad arguments for %ls: %ld instead of %d\n", a[0].w.c_str(),k-2,na); buf[63]=0; gr->SetWarn(-1,buf); n = 1; } else if(n) { mglFnStack fn; fn.pos = pos; for(int i=0;i<10;i++) { fn.par[i] = par[i]; par[i]=L""; } for(int i=1;i<k-1;i++) AddParam(i,arg[i+1].c_str()); fn_stack.push_back(fn); n--; } else if(AllowFileIO) // disable external scripts if AllowFileIO=false { FILE *fp = fopen(a[0].s.c_str(),"rt"); if(fp) { register int i; mglParser *prs = new mglParser(AllowSetSize); prs->DataList.swap(DataList); prs->NumList.swap(NumList); prs->Cmd=Cmd; for(i=10;i<30;i++) prs->AddParam(i,par[i].c_str()); prs->Execute(gr,fp); for(i=10;i<30;i++) AddParam(i,prs->par[i].c_str()); DataList.swap(prs->DataList); NumList.swap(prs->NumList); prs->Cmd=0; delete prs; fclose(fp); } else n=1; } } delete []a; return n; } if(!arg[0].compare(L"for")) { n = 1; char ch = arg[1][0]; int r = ch-'0'; if(ch>='a' && ch<='z') r = 10+ch-'a'; // int r = int(a[0].v); if(arg[1][1]==0 && (r>=0 && r<40)) { if(a[1].type==0) { n=0; fval[r] = *(a[1].d); fval[r].nx *= fval[r].ny*fval[r].nz; } else if(a[1].type==2 && a[2].type==2 && a[2].v>a[1].v) { mreal step = a[3].type==2?a[3].v:1; mm = int(step>0 ? (a[2].v-a[1].v)/step : 0); if(mm>0) { n=0; fval[r].Create(mm+1); for(int ii=0;ii<mm+1;ii++) fval[r].a[ii] = a[1].v + step*ii; } } if(n==0) { for(int i=39;i>0;i--) { for_stack[i]=for_stack[i-1]; if_for[i]=if_for[i-1]; } for_stack[0] = r+1; fval[r].nz = pos; if_for[0]=if_pos; wchar_t buf[32]; mglprintf(buf,32,L"%g",fval[r].a[0]); AddParam(r, buf); fval[r].ny = 1; } } delete []a; return n; } // alocate new arrays and execute the command itself n = PreExec(gr, k, arg, a); if(n>0) n--; else if(!arg[0].compare(L"setsize") && !AllowSetSize) n = 2; else n = Exec(gr, arg[0].c_str(),k-1,a, arg[1].c_str(), opt.c_str()); delete []a; } // delete temporary data arrays for(size_t i=0;i<DataList.size();i++) if(DataList[i] && DataList[i]->temp) { mglDataA *u=DataList[i]; DataList[i]=0; delete u; } return n; }
/** * 构造函数 * 创建实例时就会在当前工作目录创建并打开数据库,初始化各种表 * 失败并不会抛出异常 * */ ZYSDbc::ZYSDbc() : m_pDb(NULL), m_cLastQuery(NULL) { if (SQLITE_OK == sqlite3_open_v2("TLog.db", &m_pDb,SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, NULL)) { Exec("CREATE TABLE IF NOT EXISTS LOG(ID CHAR[8] PRIMARY KEY, SIGNAL INT,TAG INT, CDATE CHAR[20])"); } }
int main() { Exec("test",0); }
bool FPerfCounters::ProcessRequest(uint8* Buffer, int32 BufferLen, FResponse& Response) { bool bSuccess = false; // scan the buffer for a line FUTF8ToTCHAR WideBuffer(reinterpret_cast<const ANSICHAR*>(Buffer)); const TCHAR* BufferEnd = FCString::Strstr(WideBuffer.Get(), TEXT("\r\n")); if (BufferEnd != nullptr) { // crack into pieces FString MainLine(BufferEnd - WideBuffer.Get(), WideBuffer.Get()); TArray<FString> Tokens; MainLine.ParseIntoArrayWS(Tokens); if (Tokens.Num() >= 2) { FString ContentType(TEXT("application/json")); Response.Code = 200; // handle the request if (Tokens[0] != TEXT("GET")) { Response.Body = FString::Printf(TEXT("{ \"error\": \"Method %s not allowed\" }"), *Tokens[0]); Response.Code = 405; } else if (Tokens[1].StartsWith(TEXT("/stats"))) { Response.Body = ToJson(); // retrieving stats resets them by default, unless ?peek parameter is passed const int kStatsTokenLength = 6; // strlen("/stats"); FString TokenRemainder = Tokens[1].Mid(kStatsTokenLength); if (TokenRemainder != TEXT("?peek")) { if (ExecCmdCallback.IsBound()) { ExecCmdCallback.Execute(TEXT("perfcounters clear"), *GLog); } else { Exec(nullptr, TEXT("perfcounters clear"), *GLog); } } } else if (Tokens[1].StartsWith(TEXT("/exec?c="))) { FString ExecCmd = Tokens[1].Mid(8); FString ExecCmdDecoded = FPlatformHttp::UrlDecode(ExecCmd); FStringOutputDevice StringOutDevice; StringOutDevice.SetAutoEmitLineTerminator(true); bool bResult = false; if (ExecCmdCallback.IsBound()) { bResult = ExecCmdCallback.Execute(ExecCmdDecoded, StringOutDevice); Response.Body = StringOutDevice; ContentType = TEXT("text/text"); } else { Response.Body = FString::Printf(TEXT("{ \"error\": \"exec handler not found\" }")); } Response.Code = bResult ? 200 : 404; } else { Response.Body = FString::Printf(TEXT("{ \"error\": \"%s not found\" }"), *Tokens[1]); Response.Code = 404; } // send the response headers Response.Header = FString::Printf(TEXT("HTTP/1.0 %d\r\nContent-Length: %d\r\nContent-Type: %s\r\n\r\n"), Response.Code, Response.Body.Len(), *ContentType); bSuccess = true; } else { UE_LOG(LogPerfCounters, Warning, TEXT("Unable to parse HTTP request header: %s"), *MainLine); } } else { UE_LOG(LogPerfCounters, Warning, TEXT("Unable to immediately receive full request header")); } return bSuccess; }
int main(int argc, char **argv) { int pid, i, j, ret; int exit_status; char *exec_argv[] = { "haha", NULL }; int *a = (int *)calloc(3, sizeof(int)); int num_a = 100; char *str; unsigned int delay_ticks = 2; char buf[2 * TERMINAL_MAX_LINE + 2]; char pipe_buf[1025]; int pipe_fd; int lock_fd; int cvar_fd; #ifdef SWAP_TEST free(a); a = (void *)calloc(num_a, PAGESIZE); if (a == NULL) goto loop; if (Fork() == 0) { while (1) { Delay(2); a[0] = 1000; TtyPrintf(CONSOLE, "pid = %u, a[0] = %u\n", GetPid(), a[0]); } } for (i = 0; i < num_a * PAGESIZE / sizeof(int); i += (PAGESIZE / sizeof(int))) a[i] = 100; if (Fork() == 0) { while (1) { Delay(2); a[0] = 2000; TtyPrintf(CONSOLE, "pid = %u, a[0] = %u\n", GetPid(), a[0]); } } for (i = 0; i < num_a * PAGESIZE / sizeof(int); i += (PAGESIZE / sizeof(int))) a[i] = 100; if (Fork() == 0) { while (1) { Delay(2); a[0] = 3000; TtyPrintf(CONSOLE, "pid = %u, a[0] = %u\n", GetPid(), a[0]); } } for (i = 0; i < num_a * PAGESIZE / sizeof(int); i += (PAGESIZE / sizeof(int))) a[i] = 100; if (Fork() == 0) { while (1) { Delay(2); a[0] = 4000; TtyPrintf(CONSOLE, "pid = %u, a[0] = %u\n", GetPid(), a[0]); } } for (i = 0; i < num_a * PAGESIZE / sizeof(int); i += (PAGESIZE / sizeof(int))) a[i] = 100; if (Fork() == 0) { while (1) { Delay(2); a[0] = 5000; TtyPrintf(CONSOLE, "pid = %u, a[0] = %u\n", GetPid(), a[0]); } } for (i = 0; i < num_a * PAGESIZE / sizeof(int); i += (PAGESIZE / sizeof(int))) a[i] = 100; #endif #ifdef PIPE_TEST ret = PipeInit(&pipe_fd); pid = Fork(); bzero(pipe_buf, sizeof(pipe_buf)); if (pid != ERROR && !pid) { TtyPrintf(CONSOLE, "pipe_fd = %u\n", pipe_fd); j = 0; Delay(1); while (1) { for (i = 0; i < sizeof(pipe_buf); i++) pipe_buf[i] = (j % 26) + 'a'; TtyPrintf(CONSOLE, ">>>>>>>>>>> write pipe\n"); ret = PipeWrite(pipe_fd, pipe_buf, sizeof(pipe_buf)); TtyPrintf(CONSOLE, "write pipe ret = %d, pid = %u\n", ret, GetPid()); j++; } Exit(0); } while (1) { bzero(pipe_buf, sizeof(pipe_buf)); TtyPrintf(CONSOLE, ">>>>>>>>>>> read pipe\n"); ret = PipeRead(pipe_fd, pipe_buf, sizeof(pipe_buf) - 7); TtyPrintf(CONSOLE, "<<<<<<<<<<< read pipe ret = %d, pid = %u, %s\n", ret, GetPid(), pipe_buf); } Reclaim(pipe_fd); #endif #ifdef CVAR_TEST ret = LockInit(&lock_fd); ret = CvarInit(&cvar_fd); pid = Custom0(0, 0, 0, 0); if (pid != ERROR && !pid) { Acquire(lock_fd); while (!condition) CvarWait(cvar_fd, lock_fd); Delay(2); Release(lock_fd); Exit(7); } Acquire(lock_fd); condition = 1; CvarSignal(cvar_fd); Release(lock_fd); ret = Reclaim(lock_fd); if (ret) Exit(-1); #endif #ifdef TTY_TEST for (i = 0; i < sizeof(buf) - 1; i++) buf[i] = '9'; buf[i] = '\0'; TtyPrintf(CONSOLE, buf); TtyPrintf(CONSOLE, "\n"); a[0] = 10; a[2] = 100; TtyPrintf(CONSOLE, "Enter somthing:\n"); bzero(buf, sizeof(buf)); ret = TtyRead(CONSOLE, buf, sizeof(buf)); TtyPrintf(CONSOLE, "You just entered: %s (len = %d)\n", buf, ret); #endif #ifdef COW_TEST if (argc == 2) delay_ticks = atoi(argv[1]); pid = Fork(); if (pid == ERROR) { Delay(2); return ERROR; } else if (!pid) { GetPid(); delay_ticks = 5; TtyPrintf(CONSOLE, " delay_ticks = %u, pid = %u\n", delay_ticks, GetPid()); pid = Fork(); if (pid != ERROR && !pid) { GetPid(); delay_ticks = 8; TtyPrintf(CONSOLE, " delay_ticks = %u, pid = %u\n", delay_ticks, GetPid()); Delay(delay_ticks); Exec("exec_test", exec_argv); } pid = Wait(&exit_status); TtyPrintf(CONSOLE, " delay_ticks = %u, pid = %u\n", delay_ticks, GetPid()); TtyPrintf(CONSOLE, " wait child = %u, status = %d\n", pid, exit_status); Delay(delay_ticks); Exit(10); } pid = Fork(); if (pid != ERROR && !pid) { incursive_func(0); GetPid(); delay_ticks = 9; TtyPrintf(CONSOLE, " delay_ticks = %u, pid = %u\n", delay_ticks, GetPid()); Delay(delay_ticks); Exit(100); } TtyPrintf(CONSOLE, " delay_ticks = %u, pid = %u\n", delay_ticks, GetPid()); Delay(delay_ticks); GetPid(); Wait(&exit_status); Wait(&exit_status); GetPid(); #endif loop: while (1) Delay(delay_ticks); return 0; }
int main(){ for(i = 0;i<10; i++){ Exec("../test/customer", 16); } Exit(0);
Command::Command() { Exec(); }
static int AMXAPI amx_DGramIdle(AMX *amx, int AMXAPI Exec(AMX *, cell *, int)) { char message[BUFLEN], source[SRC_BUFSIZE]; cell amx_addr_msg, amx_addr_src; int len, chars; int err=0; assert(idxReceiveString >= 0 || idxReceivePacket >= 0); if (PrevIdle != NULL) PrevIdle(amx, Exec); /* set up listener (first call only) */ if (!dgramBound) { if (dgramPort==0) dgramPort=AMX_DGRAMPORT; /* use default port if none was set */ if (udp_Listen(dgramPort)==-1) return AMX_ERR_GENERAL; dgramBound=1; } /* if */ if (udp_IsPacket()) { len=udp_Receive(message, sizeof message / sizeof message[0], source); amx_PushString(amx,&amx_addr_src,NULL,source,1,0); /* check the presence of a byte order mark: if it is absent, the received * packet is no string; also check the packet size against string length */ if ((message[0]!='\xef' || message[1]!='\xbb' || message[2]!='\xbf' || len!=(int)strlen(message)+1 || idxReceiveString<0) && idxReceivePacket>=0) { /* receive as "packet" */ amx_Push(amx,len); amx_PushArray(amx,&amx_addr_msg,NULL,(cell*)message,len); err=Exec(amx,NULL,idxReceivePacket); } else { const char *msg=message; if (msg[0]=='\xef' && msg[1]=='\xbb' && msg[2]=='\xbf') msg+=3; /* skip BOM */ /* optionally convert from UTF-8 to a wide string */ if (amx_UTF8Check(msg,&chars)==AMX_ERR_NONE) { cell *array=alloca((chars+1)*sizeof(cell)); cell *ptr=array; if (array!=NULL) { while (err==AMX_ERR_NONE && *msg!='\0') amx_UTF8Get(msg,&msg,ptr++); *ptr=0; /* zero-terminate */ amx_PushArray(amx,&amx_addr_msg,NULL,array,chars+1); } /* if */ } else { amx_PushString(amx,&amx_addr_msg,NULL,msg,1,0); } /* if */ err=Exec(amx,NULL,idxReceiveString); } /* if */ while (err==AMX_ERR_SLEEP) err=Exec(amx,NULL,AMX_EXEC_CONT); amx_Release(amx,amx_addr_msg); amx_Release(amx,amx_addr_src); } /* if */ return err; }
void CBRunCommandDialog::Receive ( JBroadcaster* sender, const Message& message ) { if (sender == this && message.Is(JXDialogDirector::kDeactivated)) { const JXDialogDirector::Deactivated* info = dynamic_cast<const JXDialogDirector::Deactivated*>(&message); assert( info != NULL ); if (info->Successful()) { Exec(); JPrefObject::WritePrefs(); } } else if (sender == itsHelpButton && message.Is(JXButton::kPushed)) { (JXGetHelpManager())->ShowSection(kCBTasksHelpName); } else if (sender == itsSaveCmdMenu && message.Is(JXMenu::kNeedsUpdate)) { UpdateSaveCmdMenu(); } else if (sender == itsSaveCmdMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandleSaveCmdMenu(selection->GetIndex()); } else if (sender == itsPathHistoryMenu && message.Is(JXMenu::kItemSelected)) { itsPathHistoryMenu->UpdateInputField(message, itsPathInput); } else if (sender == itsChoosePathButton && message.Is(JXButton::kPushed)) { itsPathInput->ChoosePath("", NULL); } else if (sender == itsChooseCmdButton && message.Is(JXButton::kPushed)) { JXFSRunFileDialog::HandleChooseCmdButton(itsCmdInput); } else if ((sender == itsCmdInput || sender == itsPathInput) && (message.Is(JTextEditor::kTextSet) || message.Is(JTextEditor::kTextChanged))) { UpdateDisplay(); } else if ((sender == itsIsMakeCB || sender == itsIsCVSCB || sender == itsUseWindowCB) && message.Is(JXCheckbox::kPushed)) { UpdateDisplay(); } else { JXDialogDirector::Receive(sender, message); } }
// // CmdHandler // // Handles all global level console commands // static void CmdHandler(U32 pathCrc) { switch (pathCrc) { // // Root level commands // case 0xB4729720: // "quit" runCodes.Set("QUIT"); break; #ifdef DEVELOPMENT case 0xBC36982D: // "ls" { U32 flags = Console::SHOWSCOPES | Console::SHOWVARS | Console::SHOWCMDS; // Recurse if there are any args ;) if (Console::ArgCount() == 1) { flags |= Console::NORECURSE; } Console::DisplayVarScope(VarSys::gScope, 0, flags); break; } #endif case 0xC39EE127: // "op" { const char *var, *op; VarSys::VarItem *param; if (Console::GetArgString(1, var) && Console::GetArgString(2, op) && Console::GetArg(3, param)) { Operation::Console(var, op, param); } else { CON_ERR((Console::ARGS)) } break; } case 0x5D8A9066: // "?" case 0xFF52E6E7: // "help" CON_DIAG(("Commands at the global scope :")) Console::DisplayVarScope(VarSys::gScope, 0, Console::SHOWCMDS); break; case 0x4CE2B3B3: // "bind" { const char *s1 = NULL, *s2; // If one argument is provided then print the binding for that item if (Console::GetArgString(1, s1)) { if (Console::GetArgString(2, s2)) { // Bind the key KeyBind::Create(s1, s2); break; } } // Print the binding KeyBind::Dump(KeyBind::DUMP_PRESS | KeyBind::DUMP_HOLD, s1); break; } case 0x3E3AF310: // "unbind" { const char *s; if (!Console::GetArgString(1, s)) { CON_ERR((Console::ARGS)) } else { // Unbind the key KeyBind::Remove(s); } break; } case 0xAAD665AB: // "exec" { const char *name; if (Console::GetArgString(1, name)) { if (!Exec(name, ScopeHandler, FALSE)) { CON_ERR(("Unable to exec file '%s' (not found)", name)) } } else { CON_ERR((Console::ARGS)) } break; } case 0x93890429: // "echo" { const char *str; if (Console::GetArgString(1, str)) { CON_MSG((str)) } break; } // // System commands // case 0x2AF1E6BC: // "sys.info" CON_DIAG(("CPU: %s", Hardware::CPU::GetDetailedDesc())) CON_DIAG(("MEM: %s", Hardware::Memory::GetDesc())) CON_DIAG(("OS : %s", Hardware::OS::GetDesc())) break; case 0x65CDFB1A: // "sys.uptime" CON_ERR(("I fell off my bike and hurt my knee :(")) break; case 0x9FE06237: // "sys.profile" break; case 0x1C3D54FD: // "sys.ver" CON_DIAG((Version::GetBuildString())) CON_DIAG(("Compiler flags: %s", Version::GetBuildDefs())) CON_DIAG(("Compiled by %s\\%s on %s", Version::GetBuildMachine(), Version::GetBuildUser(), Version::GetBuildOS())) CON_DIAG(("Executed by %s\\%s on %s", Hardware::OS::GetComputer(), Hardware::OS::GetUser(), Hardware::OS::GetDesc())) break; case 0x27988902: // "sys.runcode" { const char *s; if (Console::ArgCount() == 2 && Console::GetArgString(1, s)) { runCodes.Set(s); } else { CON_ERR((Console::ARGS)) } break; } case 0x94908FF0: // "sys.runonce" { const char *s; if (Console::GetArgString(1, s)) { AddRunOnceCmd(s); } else { CON_ERR((Console::ARGS)) } break; } case 0xEBB16C2F: // "sys.buildfileindexes" FileSys::BuildIndexes(); break; // // Profile commands // case 0xC20C046F: // "profile.init" { S32 max; S32 interval; if (!Console::GetArgInteger(1, max) || !Console::GetArgInteger(2, interval)) { CON_ERR(("profile.init max interval")) } else { Profile::Init(max, interval); profileOn = TRUE; } break; } case 0x484CCBF7: // "profile.reset" if (!profileOn) { CON_ERR(("Profiling is not initialized, use profile.init")) } else { Profile::Reset(); } break; case 0x139D6F79: // "profile.start" if (!profileOn) { CON_ERR(("Profiling is not initialized, use profile.init")) } else { Profile::Start(); } break; case 0x96C4A523: // "profile.stop" if (!profileOn) { CON_ERR(("Profiling is not initialized, use profile.init")) } else { Profile::Stop(); } break; // // Debug commands // case 0x7C6C010C: // "debug.break" DebugBreak(); break; case 0xE7123308: // "debug.assert" { CON_DIAG(("Calling ASSERT(0)")) Bool fatal = 0; fatal; ASSERT(fatal); break; } case 0x406C755D: // "debug.stackoverflow" CmdHandler(0x406C755D); break; case 0x019C9670: // "debug.filesys" CON_DIAG(("Logging all file sources")) FileSys::LogAllSources(); break; case 0x72E8EE93: // "debug.infiniteloop" { for (;;) { } } case 0xB67F90C3: // "debug.loop" { S32 time; if (Console::GetArgInteger(1, time) && (time > 0)) { U32 start = Clock::Time::Ms(); for (;;) { if (Clock::Time::Ms() > (start + U32(time))) { break; } } } break; } case 0x329B7354: // "debug.zerodiv" { Utils::FP::UnmaskException(Utils::FP::EX_ZERODIVIDE); F32 a = 0.0F; F32 b = 5.0F / a; b; break; } case 0x9C3DECF8: // "debug.intzerodiv" { S32 a = 0; S32 b = 5 / a; b; break; } case 0x0C887FB2: // "debug.overflow" { Utils::FP::UnmaskException(Utils::FP::EX_OVERFLOW); F32 a = F32_MAX; a *= 2.0F; break; } case 0x3B8C9F71: // "debug.underflow" { Utils::FP::UnmaskException(Utils::FP::EX_UNDERFLOW); F32 a = F32_EPSILON; a *= F32_EPSILON; break; } case 0x4A533750: // "debug.dircrc" { // Dump Directory Crc U32 crc = Dir::Crc(".\\packs"); CON_DIAG(("Data Crc: [%08X]", crc)) break; } case 0xD30DA7AC: // "debug.dumpsymbols" Debug::Symbol::Dump(); break; case 0x21237FCF: // "debug.memory.accessviolation" { U8 *p = NULL; *(p+0xFFFFFFFF) = 0; break; } case 0xF0BA78F5: // "debug.memory.overwritehead" { U8 *p = new U8[24]; *(p - 2) = 0x00; delete p; break; } case 0x29939DAF: // "debug.memory.overwritetail" { U8 *p = new U8[24]; *(p + 26) = 0x00; delete p; break; } case 0x1C7E4D06: // "debug.memory.useall" { U32 meg = 0; for (;;) { char *mem = new char[1048576 * 5]; memset(mem, 0, 1048576 * 5); meg+=5; LOG_DIAG(("Allocated %d megs", meg)); } break; } case 0x137FF882: // "debug.memory.snapshot" { Debug::Memory::SnapShot(); break; } case 0x24D608EF: // "debug.memory.report" { CON_DIAG(("Memory Report")) CON_DIAG(("-------------")) CON_DIAG(("Current Memory Usage:")) CON_DIAG(("Allocated Blocks : %d", Debug::Memory::GetAllocatedBlocks())) CON_DIAG(("Allocated Bytes : %d", Debug::Memory::GetAllocatedBytes())) CON_DIAG(("Overhead Bytes : %d", Debug::Memory::GetOverheadBytes())) CON_DIAG(("Cache Blocks : %d", Debug::Memory::GetCacheBlocks())) CON_DIAG(("Cache Bytes : %d", Debug::Memory::GetCacheBytes())) CON_DIAG(("Maximum Memory Usage:")) CON_DIAG(("Allocated Blocks : %d", Debug::Memory::GetMaxAllocatedBlocks())) CON_DIAG(("Allocated Bytes : %d", Debug::Memory::GetMaxAllocatedBytes())) CON_DIAG(("Overhead Bytes : %d", Debug::Memory::GetMaxOverheadBytes())) CON_DIAG(("Cache Blocks : %d", Debug::Memory::GetMaxCacheBlocks())) CON_DIAG(("Cache Bytes : %d", Debug::Memory::GetMaxCacheBytes())) break; } case 0x46B0E840: // "debug.memory.flushcache" Debug::Memory::FlushCache(); break; case 0x238DA5B4: // "debug.memory.validateall" CON_DIAG(("Validating Memory ...")) Debug::Memory::ValidateAll(); break; case 0x1C2EF73F: // "debug.memory.examine" Debug::Memory::Examine(); break; }
bool FileExplorerUpdater::ParseBZRstate(const wxString &path, VCSstatearray &sa) { wxString parent=path; while(true) { if(wxFileName::DirExists(wxFileName(parent,_T(".bzr")).GetFullPath())) break; wxString oldparent=parent; parent=wxFileName(parent).GetPath(); if(oldparent==parent||parent.IsEmpty()) return false; } if(parent.IsEmpty()) return false; wxArrayString output; wxString rpath=parent; #ifdef __WXMSW__ int hresult=Exec(_T("cmd /c bzr stat --short ")+path,output); #else int hresult=Exec(_T("bzr stat --short ")+path,output); #endif if(hresult!=0) { return false; } for(size_t i=0;i<output.GetCount();i++) { if(output[i].Len()<=4) break; VCSstate s; wxChar a=output[i][0]; switch(a) { case '+': s.state=fvsVcUpToDate; break; case '-': s.state=fvsVcNonControlled; break; // case 'C': // s.state=fvsVcConflict; // break; case '?': s.state=fvsVcNonControlled; break; case 'R': s.state=fvsVcModified; break; case 'P': //pending merge s.state=fvsVcOutOfDate; break; default: break; } a=output[i][1]; switch(a) { case 'N': // created s.state=fvsVcAdded; break; case 'D': //deleted s.state=fvsVcMissing; break; case 'K': //kind changed case 'M': //modified s.state=fvsVcModified; break; default: break; } if(output[i][0]=='C') s.state=fvsVcConflict; wxFileName f(output[i].Mid(4)); f.MakeAbsolute(rpath); s.path=f.GetFullPath(); sa.Add(s); } return true; }
void usememory(){ Exec("../test/memory"); }