aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmain.py5
-rw-r--r--resources/wasm.xml6
2 files changed, 4 insertions, 7 deletions
diff --git a/main.py b/main.py
index f5b99c1..a3ebb2b 100755
--- a/main.py
+++ b/main.py
@@ -82,12 +82,10 @@ def get_full_path(path, name):
def get_elem_count(elem, elems):
if "count" in elem.attrib:
- #print(elem.attrib["count"])
try:
if str(int(elem.attrib["count"])) == elem.attrib["count"]:
return int(elem.attrib["count"])
except ValueError:
- #print(elem.attrib["count"][6:])
return -1
else:
return 1
@@ -152,6 +150,7 @@ class CodeGen(object):
read_source.write("\n// automatically generated by faultrieber\n")
read_source.write("// " + self.dnt + "\n")
read_source.write(text.header_list)
+ read_source.write('#include "./structs.h"\n')
inline = "inline " if self.argparser.args.inline else ""
static = "static " if self.argparser.args.static else ""
for elem in self.def_elems+ self.read_elems:
@@ -180,7 +179,6 @@ class CodeGen(object):
count_name_str = child.attrib["count"][6:]
for child2 in elem:
if child2.tag == count_name_str: replacement = "dummy." + child2.attrib["name"]
- print(count_name_str)
for_dummy_assign = "dummy." + child.attrib["name"] + "[i]" + "=" +ref_node_name+"_ins" + ";\n"
read_source.write(text.simple_loop.replace("YYY", for_dummy_declare+for_read+for_dummy_assign).replace("XXX", replacement))
else:
@@ -198,7 +196,6 @@ class CodeGen(object):
count_name_str = child.attrib["count"][6:]
for child2 in elem:
if child2.tag == count_name_str: replacement = "dummy." + child2.attrib["name"]
- print(count_name_str)
for_dummy_assign = "dummy." + child.attrib["name"] + "[i]" + "=" +pointer_remover(ref_node_name)+"_ins" + ";\n"
read_source.write(text.simple_loop.replace("YYY", for_dummy_declare+for_read+for_dummy_assign).replace("XXX", replacement))
else:
diff --git a/resources/wasm.xml b/resources/wasm.xml
index 6748ecb..58ff35c 100644
--- a/resources/wasm.xml
+++ b/resources/wasm.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<wasm:Structure xmlns:wasm="http://www.w3.org/2001/XMLSchema">
<Read>
- <Magic_Number name="magic_number" encoding="leb128u" type="uint32" size="4"></Magic_Number>
- <Version name="version" type="uint32" encoding="leb128u" size="4"></Version>
+ <Magic_Number name="magic_number" type="uint32" count="1"></Magic_Number>
+ <Version name="version" type="uint32" encoding="leb128u" count="1"></Version>
<Type_Section name="W_Type_Section" count="1" type="" isaggregate="true">
<Count name="count" encoding="leb128u" type="uint32" count="1"/>
<Type_Section_Entry count="self::Count" type="self::Type_Section_Entry" name="entries"/>
@@ -51,7 +51,7 @@
<Definition>
<Init_Expr name="init_expr_t" isaggregate="true">
<Size name="size" encoding="leb128u" type="varuint32" count="1"></Size>
- <Code name="code" type="string" coutn="1" size="self::Size"></Code>
+ <Code name="code" type="string" count="self::Size"></Code>
</Init_Expr>
<Resizable_Limit name="resizable_limit_t" isaggregate="true">
<Flags name="flags" encoding="leb128u" type="uint8" count="1"></Flags>