inline Value Function::operator() (const Value& arg0, const Value& arg1, const Value& arg2) const { const SFun_Value_Impl* args[] = { arg0.getImpl(), arg1.getImpl(), arg2.getImpl() }; return doCall( args, sizeof(args)/sizeof(args[0]) ); }
bool LuaInterface::callMethod(void *o, const char *func, float a, float b) { lookupMethod(o, func); lua_pushnumber(_lua, a); lua_pushnumber(_lua, b); return doCall(2+1); // first parameter is self (aka o) }
/** * \brief Main loop. receives data and deal with it if it isn't empty * Uses protected method doCall to provide implementation specific * behavior when recieving data. */ void operator()() { Socket socket(*ctx_, ZMQ_REP); socket.connect(uriInproc_.c_str()); std::string data; while (true) { //vishnu::exitProcessIfAnyZombieChild(-1); data.clear(); try { data = socket.get(); } catch (zmq::error_t &error) { LOG(boost::str(boost::format("[ERROR] %1%\n") % error.what()), LogErr); continue; } // Deserialize and call Method if (! data.empty()) { try { std::string resultSerialized = doCall(data); socket.send(resultSerialized); } catch (const VishnuException& ex) { diet_profile_t* profile = diet_profile_alloc("docall", 2); diet_string_set(profile, 0, "error"); diet_string_set(profile, 1, ex.what()); socket.send(JsonObject::serialize(profile)); diet_profile_free(profile); LOG(boost::str(boost::format("[ERROR] %1%\n")%ex.what()), LogErr); } } } }
int QLuaApplication::Private::doScript(struct lua_State *L, int argc, char **argv, int argn) { int i; int status; if (! lua_checkstack(L, argc+4)) return printMessage(-1, "stack overflow (too many arguments)"); Q_ASSERT(argn<=argc); for (i=argn+1; i<argc; i++) lua_pushstring(L, argv[i]); lua_createtable(L, argc-argn, argn+1); for (i=0; i<=argn; i++) { lua_pushstring(L, (i<argc) ? argv[i] : "-"); lua_rawseti(L, -2, i-argn); } for (i=argn+1; i<argc; i++) { lua_pushvalue(L, i-argc-1); lua_rawseti(L, -2, i-argn); } lua_setglobal(L, "arg"); const char *s = 0; if (argn<argc && strcmp(argv[argn],"-") && strcmp(argv[argn],"--")) s = argv[argn]; if ((status = luaL_loadfile(L, s))) return printMessage(status, "%s", lua_tostring(L, -1)); int narg = (argn<argc) ? argc-argn-1 : 0; lua_insert(L, -narg-1); if ((status = doCall(L, narg))) return printMessage(status, "%s", lua_tostring(L, -1)); return status; }
bool LuaInterface::call(const char *func, int a, int b) { lookupFunc(func); lua_pushinteger(_lua, a); lua_pushinteger(_lua, b); return doCall(2); }
void GridLayoutPlanRepModule::callGrid(PlanRep &PG, GridLayout &gridLayout) { gridLayout.init(PG); if (!handleTrivial(PG, gridLayout, m_gridBoundingBox)) { doCall(PG, nullptr, gridLayout, m_gridBoundingBox, false); } }
bool LuaInterface::call(const char *func, const char *a, const char *b) { lookupFunc(func); lua_pushstring(_lua, a); lua_pushstring(_lua, b); return doCall(2); }
bool LuaInterface::Init() { if(!_lua) { _lua = luaL_newstate(); if(!_lua) return false; lua_atpanic(_lua, the_panic); // Lua internal functions luaL_openlibs(_lua); // Own functions. lua_register_all(_lua); } if(luaL_loadfile(_lua, script) != LUA_OK) { const char *err = lua_tostring(_lua, -1); if(err) puts(err); return false; } // push args for(int i = 0; i < argc; ++i) lua_pushstring(_lua, argv[i]); return doCall(argc); }
void DotBuilder::doElement(ASTElement* element) { switch (element->getElementType()) { case MELEMENT_BLOCK: doBlock(reinterpret_cast<ASTBlock*>(element)); break; case MELEMENT_CONSTANT: doConstant(reinterpret_cast<ASTConstant*>(element)); break; case MELEMENT_VARIABLE: doVariable(reinterpret_cast<ASTVariable*>(element)); break; case MELEMENT_OPERATOR: doOperator(reinterpret_cast<ASTOperator*>(element)); break; case MELEMENT_CALL: doCall(reinterpret_cast<ASTCall*>(element)); break; case MELEMENT_TRANSFORM: doTransform(reinterpret_cast<ASTTransform*>(element)); break; default: MP_ASSERT_NOT_REACHED(); } }
Message *ServerComponent::call(Message *msg_in, Message *msg_out) { try { msg_out = doCall(msg_in, msg_out, false, 0); } catch (const runtime_error & e) { msg_out->command = MSG_ERROR_COMMAND; msg_out->append(string(e.what())); } catch (const exception & e) { msg_out->command = MSG_ERROR_COMMAND; msg_out->append(string(e.what())); } catch (const string & e) { msg_out->command = MSG_ERROR_COMMAND; msg_out->append(e); } catch (...) { msg_out->command = MSG_ERROR_COMMAND; msg_out->append("Unkown exception"); } return msg_out; }
u32int Ressource::call(u8int id, u32int a, u32int b, u32int c, u32int d, u32int e) { if (!ISROOT && !accessible()) return (u32int) - 1; if (id == 0) return m_type; m_lock.waitLock(); u32int r = doCall(id, a, b, c, d, e); m_lock.unlock(); return r; }
void ShellingOrderModule::callLeftmost(const Graph &G, ShellingOrder &order, adjEntry adj) { List<ShellingOrderSet> partition; doCall(G,adj,partition); order.initLeftmost(G,partition); }
bool LuaInterface::callMethod(void *o, const char *func, void* other) { lookupMethod(o, func); int lty = lua_rawgetp(_lua, LUA_REGISTRYINDEX, other); #ifdef _DEBUG assert(lty == LUA_TUSERDATA); #endif return doCall(1+1); // first parameter is self (aka o) }
int Mission::checkIntExpr(missionNode *node,int mode){ int res=0; if(node->tag==DTAG_VAR_EXPR){ res=doIntVar(node,mode); } else if(node->tag==DTAG_FMATH){ res=doIMath(node,mode); } else if(node->tag==DTAG_CONST){ varInst *vi=doConst(node,mode); if(vi && vi->type==VAR_INT){ res=vi->int_val; } else{ fatalError(node,mode,"expected a float const, got a different one"); assert(0); } deleteVarInst(vi); } else if(node->tag==DTAG_CALL){ varInst *vi=doCall(node,mode); if(vi->type==VAR_INT){ res=vi->int_val; } else if(vi->type==VAR_ANY && mode==SCRIPT_PARSE){ res=vi->int_val; } else{ fatalError(node,mode,"expected a int call, got a different one"); assert(0); } deleteVarInst(vi); } else if(node->tag==DTAG_EXEC){ varInst *vi=doExec(node,mode); if(vi==NULL){ fatalError(node,mode,"doExec returned NULL"); assert(0); } else if(node->script.vartype==VAR_INT){ res=vi->int_val; } else{ fatalError(node,mode,"expected a int exec, got a different one"); assert(0); } deleteVarInst(vi); } else{ fatalError(node,mode,"no such int expression tag"); assert(0); } return res; }
varInst *Mission::checkExpression(missionNode *node,int mode){ varInst *ret=NULL; debug(3,node,mode,"checking expression"); // printRuntime(); switch(node->tag){ case DTAG_AND_EXPR: case DTAG_OR_EXPR: case DTAG_NOT_EXPR: case DTAG_TEST_EXPR: { bool res=checkBoolExpr(node,mode); ret=newVarInst(VI_TEMP); ret->type=VAR_BOOL; ret->bool_val=res; return ret; } break; case DTAG_CONST: { ret=doConst(node,mode); return ret; } break; case DTAG_VAR_EXPR: { ret=doVariable(node,mode); return ret; } break; case DTAG_FMATH: { ret=doMath(node,mode); return ret; } break; case DTAG_CALL: { ret=doCall(node,mode); return ret; } break; case DTAG_EXEC: { ret=doExec(node,mode); return ret; } break; default: fatalError(node,mode,"no such expression"); assert(0); break; } return ret; }
void PlanarGridLayoutModule::callGridFixEmbed( const Graph &G, GridLayout &gridLayout, adjEntry adjExternal) { gridLayout.init(G); if (!handleTrivial(G, gridLayout, m_gridBoundingBox)) { doCall(G, adjExternal, gridLayout, m_gridBoundingBox, true); } }
void GridLayoutPlanRepModule::callGridFixEmbed( PlanRep &PG, GridLayout &gridLayout, adjEntry adjExternal) { gridLayout.init(PG); if (!handleTrivial(PG, gridLayout, m_gridBoundingBox)) { doCall(PG, adjExternal, gridLayout, m_gridBoundingBox, true); } }
bool LuaInterface::call(const char *func, const char *a, const char *b, const char *c, const char *d, const char *e) { lookupFunc(func); lua_pushstring(_lua, a); lua_pushstring(_lua, b); lua_pushstring(_lua, c); lua_pushstring(_lua, d); lua_pushstring(_lua, e); return doCall(5); }
bool LuaInterface::call(const char *func, int a, int b, int c, int d, int e) { lookupFunc(func); lua_pushinteger(_lua, a); lua_pushinteger(_lua, b); lua_pushinteger(_lua, c); lua_pushinteger(_lua, d); lua_pushinteger(_lua, e); return doCall(5); }
inline Value Function::operator() (const Value args[], std::size_t numArgs) const { std::vector<const SFun_Value_Impl*> argImpls(numArgs); for ( std::size_t i = 0 ; i != numArgs ; ++i ) argImpls[i] = args[i].getImpl() ; return doCall( numArgs == 0 ? NULL : &argImpls[0], numArgs ); }
void GridLayoutModule::call(GraphAttributes &AG) { const Graph &G = AG.constGraph(); // compute grid layout GridLayout gridLayout(G); doCall(G,gridLayout,m_gridBoundingBox); // transform grid layout to real layout mapGridLayout(G,gridLayout,AG); }
int QLuaApplication::Private::doString(struct lua_State *L, const char *s) { int status = luaL_loadstring(L, s); if (status) return printMessage(status, "%s", lua_tostring(L, -1)); if ((status = doCall(L, 0))) return printMessage(status, "%s", lua_tostring(L, -1)); return status; }
int QLuaApplication::Private::doLibrary(struct lua_State *L, const char *s) { lua_getglobal(L, "require"); if (! lua_isfunction(L, -1)) return printMessage(-1, "global 'require' is not a function"); lua_pushstring(L, s); int status = doCall(L, 1); if (status) return printMessage(status, lua_tostring(L, -1)); return status; }
//call with list of node lists, on return these lists contain //the nodes in each clique that is found void CliqueFinder::call(List< List<node> > &cliqueLists) { m_callByList = true; m_pList = &cliqueLists; m_pList->clear(); //First find the cliques: doCall doCall(m_minDegree); //setresult is called in doCall for every treated component m_pList = nullptr; }//call
varInst *Mission::checkObjectExpr(missionNode *node,int mode){ varInst *res=NULL; if(node->tag==DTAG_VAR_EXPR){ res=doObjectVar(node,mode); } else if(node->tag==DTAG_CALL){ varInst *vi=doCall(node,mode); if(vi->type==VAR_OBJECT){ res=vi; } else if(vi->type==VAR_ANY && mode==SCRIPT_PARSE){ res=vi; } else{ fatalError(node,mode,"expected a object call, got a different one"); assert(0); } } else if(node->tag==DTAG_EXEC){ varInst *vi=doExec(node,mode); if(vi==NULL){ fatalError(node,mode,"doExec returned NULL"); assert(0); } else if(node->script.vartype==VAR_OBJECT){ res=vi; } else{ fatalError(node,mode,"expected a object exec, got a different one"); assert(0); } } else if(node->tag==DTAG_CONST){ varInst *vi=doConst(node,mode); if(vi->type==VAR_OBJECT && vi->objectname=="string"){ res=vi; } else{ fatalError(node,mode,"expected a string const, got a different one: "+vi->objectname); assert(0); } } else{ fatalError(node,mode,"no such object expression tag"); assert(0); } return res; }
void LongestPathRanking::call(const Graph &G, const EdgeArray<int> &length, NodeArray<int> &rank) { List<edge> R; m_subgraph.get().call(G,R); EdgeArray<bool> reversed(G,false); for (ListConstIterator<edge> it = R.begin(); it.valid(); ++it) reversed[*it] = true; R.clear(); doCall(G, rank, reversed, length); }
void PlanarGridLayoutModule::callFixEmbed(GraphAttributes &AG, adjEntry adjExternal) { const Graph &G = AG.constGraph(); // compute grid layout GridLayout gridLayout(G); if (!handleTrivial(G, gridLayout, m_gridBoundingBox)) { doCall(G, adjExternal, gridLayout, m_gridBoundingBox, true); } // transform grid layout to real layout mapGridLayout(G,gridLayout,AG); }
void caller() { struct LOIConfig n_local0 = {}; struct LOIConfig* n_ref1 = &n_local0; *&n_ref1->vehicleType = (uint16_t) 1U; *&n_ref1->vehicleSubType = (uint16_t) 2U; *&n_ref1->vehicleId = (int32_t) 3; printf("Calling doCall", (int32_t) 3); int32_t n_r2 = doCall(n_ref1); printf("Returned %d", n_r2); }
bool JsonRpcServer::call(QObject* object, const QMetaMethod& meta_method, const QVariantMap& args, QVariant& return_value) { return_value = QVariant(); QVariantList converted_args; if (!convertArgs(meta_method, args, converted_args)) { return false; } return doCall(object, meta_method, converted_args, return_value); }
inline Value Function::operator() (const std::list<Value>& args) const { std::vector<const SFun_Value_Impl*> argImpls; for ( std::list<Value>::const_iterator pArg = args.begin() ; pArg != args.end() ; ++pArg ) { argImpls.push_back(pArg->getImpl()); } return doCall( argImpls.empty() ? NULL : &argImpls[0], argImpls.size() ); }