diff options
Diffstat (limited to '')
-rwxr-xr-x | luatablegen.py | 19 | ||||
-rw-r--r-- | test/luwasm.xml | 4 |
2 files changed, 19 insertions, 4 deletions
diff --git a/luatablegen.py b/luatablegen.py index d4095a1..1d99897 100755 --- a/luatablegen.py +++ b/luatablegen.py @@ -812,7 +812,22 @@ class TbgParser(object): c_source.write("\n") def gc(self): - pass + dummy = str() + for field_name, lua_type in zip(field_names, lua_types): + parent = get_def_node(struct_name, self.elems) + node = get_def_node(field_name, parent) + type_node = get_def_node_tag(node.attrib["type"][6:], self.elems) + count = get_elem_count(node) + if lua_type == "integer": pass + elif lua_type == "lightuserdata": pass + elif lua_type == "number": pass + elif lua_type == "string": pass + elif lua_type == "boolean": pass + elif lua_type == "table": pass + elif lua_type == "conditional": pass + c_source.write(dummy) + dummy = str() + c_source.write("\n") def tostring(self): pass @@ -1057,7 +1072,7 @@ class TbgParser(object): d_source.write("_" + self.time + "_") if self.argparser.args.lualibpath: #l_source = open(self.argparser.args.lualibpath, "w") - l_source.write(LUA_LIB[0].replace("XXX", self.argparser.args.lualibname)) + l_source.write(LUA_LIB[1].replace("XXX", self.argparser.args.lualibname)) # write code here def premain(argparser): diff --git a/test/luwasm.xml b/test/luwasm.xml index 1a71c71..009e452 100644 --- a/test/luwasm.xml +++ b/test/luwasm.xml @@ -25,7 +25,7 @@ <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/> <Name name="name" type="string" size="self::NameLength" luatype="string"/> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> - <Types name="types" encoding="leb128u" type="uint32" count="self::Count" luatype="integer"/> + <Types name="types" encoding="leb128u" type="uint32" count="self::Count" luatype="lightuserdata"/> </Function_Section> <Table_Section name="W_Table_Section" count="1" type="" isaggregate="true" unordered="true" luatype="lightuserdata"> <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">4</ID> @@ -156,7 +156,7 @@ </Element_Segment> <Local_Entry name="W_Local_Entry" isaggregate="true" luatype="lightuserdata"> <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/> - <Type name="type" encoding="leb128u" type="uint16" count="self::Count" luatype="integer"/> + <Type name="type" encoding="leb128u" type="uint16" count="self::Count" luatype="lightuserdata"/> </Local_Entry> <Function_Body name="W_Function_Body" isaggregate="true" luatype="lightuserdata"> <Body_size name="body_size" encoding="leb128u" type="uint32" count="1" luatype="integer"/> |