void LuaParser::AddString(int key, const string& value) { if ((L == NULL) || (initDepth < 0)) { return; } lua_pushnumber(L, key); lua_pushstring(L, value.c_str()); PushParam(); }
void LuaParser::AddBool(int key, bool value) { if ((L == NULL) || (initDepth < 0)) { return; } lua_pushnumber(L, key); lua_pushboolean(L, value); PushParam(); }
void LuaParser::AddFloat(int key, float value) { if ((L == NULL) || (initDepth < 0)) { return; } lua_pushnumber(L, key); lua_pushnumber(L, value); PushParam(); }
void LuaParser::AddFloat(const string& key, float value) { if ((L == NULL) || (initDepth < 0)) { return; } lua_pushstring(L, key.c_str()); lua_pushnumber(L, value); PushParam(); }
void LuaParser::AddBool(const string& key, bool value) { if ((L == NULL) || (initDepth < 0)) { return; } lua_pushstring(L, key.c_str()); lua_pushboolean(L, value); PushParam(); }
void LuaParser::EndTable() { if ((L == NULL) || (initDepth < 0)) { return; } assert(initDepth > 0); initDepth--; PushParam(); }
void LuaParser::AddFunc(int key, int (*func)(lua_State*)) { if ((L == NULL) || (initDepth < 0)) { return; } if (func == NULL) { return; } lua_pushnumber(L, key); lua_pushcfunction(L, func); PushParam(); }
void LuaParser::AddFunc(const string& key, int (*func)(lua_State*)) { if ((L == NULL) || (initDepth < 0)) { return; } if (func == NULL) { return; } lua_pushstring(L, key.c_str()); lua_pushcfunction(L, func); PushParam(); }
void PushParam(TreeNode* pnode){ if (pnode->sibling!=NULL){ PushParam(pnode->sibling); } HandleNodeExp(pnode); EMITCODE("pushl %eax\n"); }
void HandleProcExc(TreeNode* pnode){ ProcList varList=procListLookup(pnode->attr.name); PushParam(pnode->child[0]); EMITCODE("pushl %ecx\n"); EMITCODE("movl %esp, %ecx\n"); sprintf(tmp, "call %s\n", pnode->attr.name); EMITCODE(tmp); EMITCODE("popl %ecx\n"); PopParam(pnode->child[0],varList->paraList); }