From 426ebdfc06696cfece51938cd773fc752a932f32 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Fri, 10 Aug 2018 21:10:27 +0430 Subject: update --- main.py | 4 ++-- resources/wasm.xml | 6 ++++-- test/autowasm.c | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 335935f..09cb73a 100755 --- a/main.py +++ b/main.py @@ -358,10 +358,10 @@ class CodeGen(object): ref_node_name = pointer_remover(ref_node.attrib["name"]) if child_count == 1: for_read = text.c_read_elem_sig_2.replace("XXX", ref_node_name).replace("YYY", "dummy->" + child.attrib["name"]) + ";\n" - read_source.write(for_read) + read_source.write("dummy->" + child.attrib["name"] + "=" + for_read) elif child_count > 1: for_read = text.c_read_elem_sig_2.replace("XXX", ref_node_name).replace("YYY", "dummy->" + child.attrib["name"] + "[i]") + ";\n" - read_source.write(for_read) + read_source.write("dummy->" + child.attrib["name"] + "=" + for_read) else: # child_count == -1 count_name_str = child.attrib["count"][6:] read_source.write("if (" + "dummy->" + get_node_name(count_name_str, elem) + ")\n") diff --git a/resources/wasm.xml b/resources/wasm.xml index 6a9dfe9..6925cdb 100644 --- a/resources/wasm.xml +++ b/resources/wasm.xml @@ -40,8 +40,10 @@ + + @@ -106,7 +108,7 @@ - + diff --git a/test/autowasm.c b/test/autowasm.c index fe3fece..2e978ce 100644 --- a/test/autowasm.c +++ b/test/autowasm.c @@ -16,6 +16,7 @@ int main (int argc, char** argv) { printf("magic_number:%x\n", magic_number_container->magic_number); printf("version:%x\n", version_container->version); + printf("type section id:%d\n", W_Type_Section_container->id); printf("type section payloadlength:%d\n", W_Type_Section_container->payloadlength); printf("type_section entry count:%d\n", W_Type_Section_container->count); @@ -46,6 +47,22 @@ int main (int argc, char** argv) { for (int i = 0; i < W_Function_Section_container->count; ++i) printf("type:%d\n", W_Function_Section_container->types[i]); + printf("table_section_id:%d\n", W_Table_Section_container->id); + printf("table_section_payloadlength:%d\n", W_Table_Section_container->payloadlength); + printf("table_section_count:%d\n", W_Table_Section_container->count); + for (int i = 0; i < W_Table_Section_container->count; ++i) { + printf("element_type:%d\n", W_Table_Section_container->entries[i]->element_type); + printf("rl_flags:%d\n", W_Table_Section_container->entries[i]->resizable_limit->flags); + printf("rl_initial:%d\n", W_Table_Section_container->entries[i]->resizable_limit->initial); + printf("rl_maximum:%d\n", W_Table_Section_container->entries[i]->resizable_limit->maximum); + } + + printf("memory_section_id:%d\n", W_Memory_Section_container->id); + printf("memory_section_payload_length:%d\n", W_Memory_Section_container->payloadlength); + printf("rl_flags:%d\n", W_Memory_Section_container->entries->resizable_limit->flags); + printf("rl_initial:%d\n", W_Memory_Section_container->entries->resizable_limit->initial); + printf("rl_maximum:%d\n", W_Memory_Section_container->entries->resizable_limit->maximum); + release_all(); return 0; } -- cgit v1.2.3