void PnpPlanTemplate<PnpPlaceClass, PnpTransitionClass>::executeAllActiveActions() { std::set<PnpPlace*> nep = this->getNonEmptyPlaces(); PNP_OUT("EXECUTING NONEMPTY PLACES ..."); for (std::set<PnpPlace*>::iterator p_iter=nep.begin(); p_iter!=nep.end();p_iter++) { PnpPlace* p = *p_iter; if (p->functionToCall == "") continue; std::vector<std::string> v = tokenize(p->functionToCall, "."); if (v.size() != 2) { PNP_ERR("Malformed function call (1): '"<<p->functionToCall<<"'"); } else { PnpExecutable* a = getExecutable(v[0]); if (!a) { PNP_ERR("Unknown executable '"<<v[0]<<"' in function call '"<<p->functionToCall<<"'"); } else { if (v[1] != "exec") { PNP_ERR("Unknown function '"<<v[1]<<"' in function call '"<<p->functionToCall<<"'"); } else { PNP_OUT("Executing '"<<p->functionToCall<<"'"); a->executeStep(); } } } } PNP_OUT("EXECUTING NONEMPTY PLACES === DONE"); }
JSValueRef setNeverInline(JSContextRef context, JSValueRef theFunctionValueRef) { if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef)) executable->setNeverInline(true); return JSValueMakeUndefined(context); }
bool Raw::Initialize() { QString filePath = getExecutable(); if(!filePath.isEmpty()) { _handle = _open(filePath.toStdString().c_str(), _O_BINARY | _O_RDONLY); _mapHandle = CreateFileMapping(getHandle(), NULL, PAGE_READONLY, 0, 0, NULL); void *buffer = MapViewOfFile(_mapHandle, FILE_MAP_READ, 0, 0, 0); //We got the file if(filePath.endsWith("xex")) { _type = GDFX; _xex = new Xex(NULL, buffer, 0); } else if(filePath.endsWith("xbe")) { _type = XSF; _xbe = new Xbe(NULL, buffer, 0); } else return false; } else return false; return true; }
JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef) { if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef)) { CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall); if (!baselineCodeBlock) return JSValueMakeNumber(context, 0); return JSValueMakeNumber(context, baselineCodeBlock->numberOfDFGCompiles()); } return JSValueMakeUndefined(context); }
bool PnpPlanTemplate<PnpPlaceClass, PnpTransitionClass> ::evaluateAtomicCondition(const std::string& atom) { std::vector<std::string> toks = tokenize(atom, "."); if (toks.size() == 1) { return conditionChecker->evaluateAtomicExternalCondition(atom); } else if (toks.size() == 2) { PnpExecutable* e = getExecutable(toks[0]); return e->getInternalConditionValue(toks[1]); } else { PNP_ERR("Malformed atomic condition '"<<atom<<"'"); return false; } }
void DGLRunAppProject::startDebugging() { // randomize connection port int port = rand() % (0xffff - 1024) + 1024; m_process = new DGLDebugeeQTProcess(port, m_EglMode); m_process->setParent(this); CONNASSERT(m_process, SIGNAL(processReady()), this, SLOT(processReadyHandler())); CONNASSERT(m_process, SIGNAL(processError(std::string)), this, SLOT(processErrorHandler(std::string))); CONNASSERT(m_process, SIGNAL(processFinished(int)), this, SLOT(processExitHandler(int))); CONNASSERT(m_process, SIGNAL(processCrashed()), this, SLOT(processCrashHandler())); m_process->run(getExecutable(), getPath(), getCommandLineArgVector(), getSkipProcessesCount()); }
JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef) { bool pretendToHaveManyCompiles = false; #if ENABLE(DFG_JIT) if (!Options::useJIT() || !Options::useDFGJIT()) pretendToHaveManyCompiles = true; #else pretendToHaveManyCompiles = true; #endif if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef)) { CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall); if (!baselineCodeBlock) return JSValueMakeNumber(context, 0); if (pretendToHaveManyCompiles) return JSValueMakeNumber(context, 1000000.0); return JSValueMakeNumber(context, baselineCodeBlock->numberOfDFGCompiles()); } return JSValueMakeUndefined(context); }
bool gmshLocalNetworkClient::run() { new_connection: setPid(0); // dummy pid, should be non-negative onelabGmshServer *server = new onelabGmshServer(this); int sock = server->LaunchClient(); if(sock < 0){ // could not establish the connection: aborting server->Shutdown(); delete server; return false; } Msg::StatusBar(true, "Running '%s'...", _name.c_str()); setGmshServer(server); while(1) { if(getExecutable().empty() && !CTX::instance()->solver.listen){ // we stopped listening to the special "Listen" client break; } // loop over all the clients (usually only one, but can be more if we // spawned subclients) and check if data is available for one of them bool stop = false, haveData = false; gmshLocalNetworkClient *c = 0; std::vector<gmshLocalNetworkClient*> toDelete; for(int i = 0; i < getNumClients(); i++){ c = getClient(i); if(c->getPid() < 0){ if(c == this){ // the "master" client stopped stop = true; break; } else{ // this subclient is not active anymore: shut down and delete its // server and mark the client for deletion GmshServer *s = c->getGmshServer(); c->setGmshServer(0); c->setFather(0); if(s){ s->Shutdown(); delete s; } toDelete.push_back(c); continue; } } GmshServer *s = c->getGmshServer(); if(!s){ Msg::Error("Abnormal server termination (no valid server)"); stop = true; break; } else{ int ret = s->NonBlockingWait(0.001, -1.); if(ret == 0){ // we have data from this particular client haveData = true; break; } else if(ret == 3){ // pass to the next client continue; } else{ // an error occurred stop = true; break; } } } for(unsigned int i = 0; i < toDelete.size(); i++){ removeClient(toDelete[i]); delete toDelete[i]; } // break the while(1) if the master client has stopped or if we encountered // a problem if(stop) break; // if data is available try to get the message from the corresponding // client; break the while(1) if we could not receive the message if(haveData && !c->receiveMessage(this)) break; // break the while(1) if the master client has stopped if(c == this && c->getPid() < 0) break; } // we are done running the (master) client: delete the servers and the // subclients, if any remain (they should have been deleted already). std::vector<gmshLocalNetworkClient*> toDelete; for(int i = 0; i < getNumClients(); i++){ gmshLocalNetworkClient *c = getClient(i); GmshServer *s = c->getGmshServer(); c->setGmshServer(0); c->setFather(0); if(s){ s->Shutdown(); delete s; } if(c != this){ if(c->getPid() > 0) Msg::Error("Subclient %s was not stopped correctly", c->getName().c_str()); toDelete.push_back(c); } } for(unsigned int i = 0; i < toDelete.size(); i++){ removeClient(toDelete[i]); delete toDelete[i]; } Msg::StatusBar(true, "Done running '%s'", _name.c_str()); if(getExecutable().empty()){ Msg::Info("Client disconnected: starting new connection"); goto new_connection; } return true; }
void PnpPlanTemplate<PnpPlaceClass, PnpTransitionClass>::fireAllEnabledTransitions() { PNP_OUT("Getting enabled transitions ..."); std::set<PnpTransition*> enabledTr = getAllEnabledTransitions(); #if PNP_OUTPUT_ENABLED PNP_OUT("Enabled transitions:"); for (std::set<PnpTransition*>::iterator it = enabledTr.begin(); it != enabledTr.end(); it++) { PNP_OUT(" " << (*it)->nodeId << " \"" << (*it)->pnmlString << "\""); } #endif if (enabledTr.empty()) { PNP_OUT("No enabled transition"); return; } PNP_OUT("FIRING TRANSITIONS"); // Transitions firing for (std::set<PnpTransition*>::iterator t_iter=enabledTr.begin(); t_iter!=enabledTr.end(); t_iter++) { PnpTransition* t = *t_iter; if (this->isEnabled(t)) { //can this be possible? legged say: IT IS!!!! //fireing some transitions may disable others if (!this->fire(t)) { PNP_ERR("Cannot fire the Transition!"); } else { for (size_t i = 0; i < t->functionsToCall.size(); i++) { size_t q = t->functionsToCall[i].find_last_of("."); if (q == std::string::npos) { // std::vector<std::string> v = tokenize(t->functionsToCall[i], "."); // if (v.size() != 2) { PNP_ERR("Malformed function call (2): '"<<t->functionsToCall[i]<<"'"); } else { std::vector<std::string> v; v.push_back(t->functionsToCall[i].substr(0, q)); v.push_back(t->functionsToCall[i].substr(q+1)); PnpExecutable* a = getExecutable(v[0]); if (!a) { PNP_ERR("Unknown executable name '"<<v[0]<<"' in function call '" <<t->functionsToCall[i]<<"'"); } else { if (v[1] == "start" || v[1] == "resume" || v[1] == "end" || v[1] == "fail" || v[1] == "interrupt") { PNP_OUT("Executing '"<<t->functionsToCall[i]<<"'"); } if (v[1] == "start") a->start(); else if (v[1] == "resume") a->resume(); else if (v[1] == "end") a->end(); else if (v[1] == "interrupt") a->interrupt(); else if (v[1] == "fail") a->fail(); else { PNP_ERR("Unknown function name '"<<v[1]<<"' in function call '" <<t->functionsToCall[i]<<"'"); } if (v[1] == "end" || v[1] == "fail") { #if DELETE_CONCLUDED_EXECUTABLES PNP_OUT("******* I can destroy '"<<v[0]<<"'"); activeExecutables.erase(v[0]); delete a; #else PNP_OUT("******* I won't destroy '"<<v[0]<<"'"); inactiveExecutables.insert(make_pair(v[0], a)); activeExecutables.erase(v[0]); #endif } } } } } } } }