aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-10-02 21:37:11 +0000
committerbloodstalker <thabogre@gmail.com>2018-10-02 21:37:11 +0000
commit44674b300e866cfdaa734c0dc2f5a00a7022cf26 (patch)
tree2a61ce6ec390649af50a54e2a78760b437050927 /bruiser
parentfixed some more bugs on tablegen and faultreiber's side. you can run the demo... (diff)
downloadmutator-44674b300e866cfdaa734c0dc2f5a00a7022cf26.tar.gz
mutator-44674b300e866cfdaa734c0dc2f5a00a7022cf26.zip
added tests for wasm setters, faultreiber and tablegen now use the same xml file. makes things more consistent
Diffstat (limited to '')
-rwxr-xr-xbruiser/autogen/wasm/ft.sh2
-rw-r--r--bruiser/autogen/wasm/ft/wasm.xml174
-rwxr-xr-xbruiser/autogen/wasm/ltg.sh2
-rw-r--r--bruiser/autogen/wasm/ltg/wasm.xml174
-rw-r--r--bruiser/autogen/wasm/wasm.xml (renamed from bruiser/autogen/wasm/ltg/luwasm.xml)0
-rw-r--r--bruiser/lua-scripts/wasmtest.lua648
-rw-r--r--bruiser/makefile28
7 files changed, 643 insertions, 385 deletions
diff --git a/bruiser/autogen/wasm/ft.sh b/bruiser/autogen/wasm/ft.sh
index 4910ff7..a7f5ac6 100755
--- a/bruiser/autogen/wasm/ft.sh
+++ b/bruiser/autogen/wasm/ft.sh
@@ -1,5 +1,5 @@
#!/bin/sh
cd $(dirname $0)
-"../../faultreiber/faultreiber.py" --name wasm --outdir ./ft/ --datetime --xml ./ft/wasm.xml --calloc --voidtraininitsize 60 --voidtrainfactor 1.9
+"../../faultreiber/faultreiber.py" --name wasm --outdir ./ft/ --datetime --xml ./wasm.xml --calloc --voidtraininitsize 60 --voidtrainfactor 1.9
#"clang-format" -i ./test/read.c ./test/structs.c ./test/structs.h ./test/aggregate.c ./test/aggregate.h ./test/read.h
#"less" ./test/structs.h
diff --git a/bruiser/autogen/wasm/ft/wasm.xml b/bruiser/autogen/wasm/ft/wasm.xml
deleted file mode 100644
index dfae936..0000000
--- a/bruiser/autogen/wasm/ft/wasm.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<FT>
- <Read>
- <Magic_Number name="magic_number" type="uint32" count="1"></Magic_Number>
- <Version name="version" type="uint32" count="1"></Version>
- <Type_Section name="W_Type_Section" count="1" type="" isaggregate="true" unordered="true" unorderedbegin="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">1</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Type_Section_Entry count="self::Count" type="self::Type_Section_Entry" name="entries"/>
- </Type_Section>
- <Import_Section name="W_Import_Section" count="1" type="" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">2</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Entries name="entries" type="self::Import_Section_Entry" count="self::Count"/>
- </Import_Section>
- <Function_Section name="W_Function_Section" count="1" type="" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="">3</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Types name="types" encoding="leb128u" type="uint32" count="self::Count"/>
- </Function_Section>
- <Table_Section name="W_Table_Section" count="1" type="" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">4</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Entries name="entries" type="self::Table_Type" count="self::Count"/>
- </Table_Section>
- <Memory_Section name="W_Memory_Section" count="1" type="" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">5</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <!--<Count name="count" encoding="leb128u" type="uint32" count="1"/>-->
- <Entries name="entries" type="self::Memory_Type" count="1"/>
- </Memory_Section>
- <Global_Section name="W_Global_Section" count="1" type="" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">6</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Globals name="globals" type="self::Global_Entry" count="self::Count"/>
- </Global_Section>
- <Export_Section name="W_Export_Section" count="1" type="" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">7</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Entries name="entries" type="self::Export_Entry" count="self::Count"/>
- </Export_Section>
- <Start_Section name="W_Start_Section" count="1" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">8</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Index name="index" encoding="leb128u" type="uint32" count="1"/>
- </Start_Section>
- <Element_Section name="W_Element_Section" count="1" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">9</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Entries name="entries" type="self::Element_Segment" count="self::Count"/>
- </Element_Section>
- <Code_Section name="W_Code_Section" count="1" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">10</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Bodies name="bodies" type="self::Function_Body" count="self::Count"/>
- </Code_Section>
- <Data_Section name="W_Data_Section" count="1" isaggregate="true" unordered="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">11</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Entries name="entries" type="self::Data_Segment" count="self::Count"/>
- </Data_Section>
- <Custom_Section name="W_Custom_Section" count="*" isaggregate="true" unordered="true" unorderedend="true">
- <ID name="id" type="uint8" encoding="leb128u" issign="true">0</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u"/>
- <Name name="name" type="string" size="self::NameLength"/>
- <Payload name="payload" type="uint8" count="self::PayloadLength"/>
- </Custom_Section>
- </Read>
- <Definition>
- <Init_Expr name="init_expr_t" isaggregate="true">
- <Code name="code" type="string" count="1" size="-1" delimiter="11"></Code>
- </Init_Expr>
- <Resizable_Limit name="resizable_limit_t" isaggregate="true">
- <Flags name="flags" encoding="leb128u" type="uint8" count="1"></Flags>
- <Initial name="initial" encoding="leb128u" type="uint32" count="1"></Initial>
- <Maximum name="maximum" encoding="leb128u" type="uint32" count="1"></Maximum>
- </Resizable_Limit>
- <Global_Type name="global_type_t" isaggregate="true">
- <Value_Type name="value_type" type="uint32" count="1"></Value_Type>
- <Mutability name="mutability" encoding="leb128u" type="uint8" count="1"></Mutability>
- </Global_Type>
- <Table_Type name="table_type_t" isaggregate="true">
- <Element_Type name="element_type" encoding="leb128u" type="uint8" count="1"></Element_Type>
- <Resizable_Limit name="resizable_limit" count="1" type="self::Resizable_Limit"></Resizable_Limit>
- </Table_Type>
- <Memory_Type name="memory_type_t" isaggregate="true">
- <Resizable_Limit count="1" type="self::Resizable_Limit" name="resizable_limit"></Resizable_Limit>
- </Memory_Type>
- <Type_Section_Entry name="W_Type_Section_Entry" isaggregate="true">
- <Form name="form" encoding="leb128u" type="uint8" count="1"/>
- <Param_Count name="param_count" encoding="leb128u" type="uint32" count="1"/>
- <Param_Types name="param_types" encoding="leb128u" type="uint8" count="self::Param_Count"/>
- <Return_Count name="return_count" encoding="leb128u" type="uint8"/>
- <Return_Types name="return_types" encoding="leb128u" type="uint8" count="self::Return_Count"/>
- </Type_Section_Entry>
- <Import_Section_Entry name="W_Import_Section_Entry" isaggregate="true">
- <Module_Length name="module_length" encoding="leb128u" type="uint32" count="1"/>
- <Module_Str name="module_str" type="string" count="1" size="self::Module_Length"/>
- <Field_Len name="field_len" encoding="leb128u" type="uint32" couny="1"/>
- <Field_Str name="field_str" type="string" count="1" size="self::Field_Len"/>
- <Kind name="kind" encoding="leb128u" type="uint8" count="1"/>
- <Type name="type" conditional="true" condition="self::Kind" type="FT::conditional">
- <condition0 name="type" encoding="leb128u" type="uint32">0</condition0>
- <condition1 name="type" type="self::Table_Type">1</condition1>
- <condition2 name="type" type="self::Memory_Type">2</condition2>
- <condition3 name="type" type="self::Global_Type">3</condition3>
- </Type>
- </Import_Section_Entry>
- <Global_Entry name="W_Global_Entry" isaggregate="true">
- <Global_Type name="type" type="self::Global_Type" count="1"/>
- <Init name="init" type="self::Init_Expr" count="1"/>
- </Global_Entry>
- <Export_Entry name="W_Export_Entry" isaggregate="true">
- <Field_Len name="field_len" encoding="leb128u" type="uint32" count="1"/>
- <Field_Str name="field_str" type="string" count="1" size="self::Field_Len"/>
- <Kind name="kind" encoding="leb128u" type="uint8" count="1"/>
- <Index name="index" encoding="leb128u" type="uint32" count="1"/>
- </Export_Entry>
- <Element_Segment name="W_Element_Segment" isaggregate="true">
- <Index name="index" encoding="leb128u" type="uint32" count="1"/>
- <Init name="init" type="self::Init_Expr" count="1"/>
- <Num_Length name="num_length" encoding="leb128u" type="uint32" count="1"/>
- <Elems name="elems" encoding="leb128u" type="uint32" count="self::Num_Length"/>
- </Element_Segment>
- <Local_Entry name="W_Local_Entry" isaggregate="true">
- <Count name="count" encoding="leb128u" type="uint32" count="1"/>
- <Type name="type" encoding="leb128u" type="uint16" count="self::Count"/>
- </Local_Entry>
- <Function_Body name="W_Function_Body" isaggregate="true">
- <Body_size name="body_size" encoding="leb128u" type="uint32" count="1"/>
- <Local_Count name="local_count" encoding="leb128u" type="uint32" count="1"/>
- <Local_Entries name="locals" type="self::Local_Entry" count="self::Local_Count"/>
- <Code name="code" type="uchar" count="self::Body_size"/>
- </Function_Body>
- <Data_Segment name="W_Data_Segment" isaggregate="true">
- <Index name="index" encoding="leb128u" type="uint32" count="1"/>
- <Offset name="offset" type="self::Init_Expr" count="1"/>
- <Size name="size" encoding="leb128u" type="uint32" count="1"/>
- <Data name="data" type="uchar" count="self::Size"/>
- </Data_Segment>
- </Definition>
-</FT>
diff --git a/bruiser/autogen/wasm/ltg.sh b/bruiser/autogen/wasm/ltg.sh
index 48643b9..9adecef 100755
--- a/bruiser/autogen/wasm/ltg.sh
+++ b/bruiser/autogen/wasm/ltg.sh
@@ -1,6 +1,6 @@
#!/bin/sh
cd $(dirname $0)
-"../../tablegen/luatablegen.py" --out ./ltg/ --luaheader ../../../lua-5.3.4/src --headeraggr ./ltg/wasm_tables.h --lualibpath ./ltg/wasm.lua --docpath ./ltg/wasm.md --xml ./ltg/luwasm.xml --tbldefs ./ltg/ --name wasm --anon
+"../../tablegen/luatablegen.py" --out ./ltg/ --luaheader ../../../lua-5.3.4/src --headeraggr ./ltg/wasm_tables.h --lualibpath ./ltg/wasm.lua --docpath ./ltg/wasm.md --xml ./wasm.xml --tbldefs ./ltg/ --name wasm --anon
clang-format ./ltg/*.c ./ltg/*.h -i
for filename in ./ltg/*.c; do
gcc -c $filename > /dev/null 2>&1
diff --git a/bruiser/autogen/wasm/ltg/wasm.xml b/bruiser/autogen/wasm/ltg/wasm.xml
deleted file mode 100644
index 6d8d0d2..0000000
--- a/bruiser/autogen/wasm/ltg/wasm.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<FT>
- <Read>
- <Magic_Number name="magic_number" type="uint32" count="1" luatype="integer"></Magic_Number>
- <Version name="version" type="uint32" count="1" luatype="integer"></Version>
- <Type_Section name="W_Type_Section" count="1" type="" isaggregate="true" unordered="true" unorderedbegin="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">1</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- <Type_Section_Entry count="self::Count" type="self::Type_Section_Entry" name="entries" luatype="table"/>
- </Type_Section>
- <Import_Section name="W_Import_Section" count="1" type="" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">2</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- <Entries name="entries" type="self::Import_Section_Entry" count="self::Count" luatype="table"/>
- </Import_Section>
- <Function_Section name="W_Function_Section" count="1" type="" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="" luatype="integer">3</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- </Function_Section>
- <Table_Section name="W_Table_Section" count="1" type="" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">4</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- <Entries name="entries" type="self::Table_Type" count="self::Count" luatype="table"/>
- </Table_Section>
- <Memory_Section name="W_Memory_Section" count="1" type="" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">5</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>-->
- <Entries name="entries" type="self::Memory_Type" count="1" luatype="table"/>
- </Memory_Section>
- <Global_Section name="W_Global_Section" count="1" type="" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">6</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- <Globals name="globals" type="self::Global_Entry" count="self::Count" luatype="table"/>
- </Global_Section>
- <Export_Section name="W_Export_Section" count="1" type="" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">7</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- <Entries name="entries" type="self::Export_Entry" count="self::Count" luatype="table"/>
- </Export_Section>
- <Start_Section name="W_Start_Section" count="1" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">8</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/>
- <Name name="name" type="string" size="self::NameLength" luatype="string"/>
- <Index name="index" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- </Start_Section>
- <Element_Section name="W_Element_Section" count="1" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">9</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- <Entries name="entries" type="self::Element_Segment" count="self::Count" luatype="table"/>
- </Element_Section>
- <Code_Section name="W_Code_Section" count="1" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">10</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- <Bodies name="bodies" type="self::Function_Body" count="self::Count" luatype="table"/>
- </Code_Section>
- <Data_Section name="W_Data_Section" count="1" isaggregate="true" unordered="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">11</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <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"/>
- <Entries name="entries" type="self::Data_Segment" count="self::Count" luatype="table"/>
- </Data_Section>
- <Custom_Section name="W_Custom_Section" count="*" isaggregate="true" unordered="true" unorderedend="true" luatype="table">
- <ID name="id" type="uint8" encoding="leb128u" issign="true" luatype="integer">0</ID>
- <PayloadLength name="payloadlength" type="uint32" encoding="leb128u" luatype="integer"/>
- <NameLength name="namelength" type="uint32" encoding="leb128u" luatype="integer"/>
- <Name name="name" type="string" size="self::NameLength" luatype="string"/>
- <Payload name="payload" type="uint8" count="self::PayloadLength" luatype="integer"/>
- </Custom_Section>
- </Read>
- <Definition>
- <Init_Expr name="init_expr_t" isaggregate="true" luatype="table">
- <Code name="code" type="string" count="1" size="-1" delimiter="11" luatype="integer"></Code>
- </Init_Expr>
- <Resizable_Limit name="resizable_limit_t" isaggregate="true" luatype="table">
- <Flags name="flags" encoding="leb128u" type="uint8" count="1" luatype="integer"></Flags>
- <Initial name="initial" encoding="leb128u" type="uint32" count="1" luatype="integer"></Initial>
- <Maximum name="maximum" encoding="leb128u" type="uint32" count="1" luatype="integer"></Maximum>
- </Resizable_Limit>
- <Global_Type name="global_type_t" isaggregate="true" luatype="table">
- <Value_Type name="value_type" type="uint32" count="1" luatype="integer"></Value_Type>
- <Mutability name="mutability" encoding="leb128u" type="uint8" count="1" luatype="integer"></Mutability>
- </Global_Type>
- <Table_Type name="table_type_t" isaggregate="true" luatype="table">
- <Element_Type name="element_type" encoding="leb128u" type="uint8" count="1" luatype="integer"></Element_Type>
- <Resizable_Limit name="resizable_limit" count="1" type="self::Resizable_Limit" luatype="table"></Resizable_Limit>
- </Table_Type>
- <Memory_Type name="memory_type_t" isaggregate="true" luatype="table">
- <Resizable_Limit count="1" type="self::Resizable_Limit" name="resizable_limit" luatype="table"></Resizable_Limit>
- </Memory_Type>
- <Type_Section_Entry name="W_Type_Section_Entry" isaggregate="true" luatype="table">
- <Form name="form" encoding="leb128u" type="uint8" count="1" luatype="integer"/>
- <Param_Count name="param_count" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Param_Types name="param_types" encoding="leb128u" type="uint8" count="self::Param_Count" luatype="integer"/>
- <Return_Count name="return_count" encoding="leb128u" type="uint8" luatype="integer"/>
- <Return_Types name="return_types" encoding="leb128u" type="uint8" count="self::Return_Count" luatype="integer"/>
- </Type_Section_Entry>
- <Import_Section_Entry name="W_Import_Section_Entry" isaggregate="true" luatype="table">
- <Module_Length name="module_length" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Module_Str name="module_str" type="string" count="1" size="self::Module_Length" luatype="string"/>
- <Field_Len name="field_len" encoding="leb128u" type="uint32" couny="1" luatype="integer"/>
- <Field_Str name="field_str" type="string" count="1" size="self::Field_Len" luatype="string"/>
- <Kind name="kind" encoding="leb128u" type="uint8" count="1" luatype="integer"/>
- <Type name="type" conditional="true" condition="self::Kind" type="FT::conditional" luatype="conditional">
- <condition0 name="type" encoding="leb128u" type="uint32" luatype="integer">0</condition0>
- <condition1 name="type" type="self::Table_Type" luatype="table">1</condition1>
- <condition2 name="type" type="self::Memory_Type" luatype="table">2</condition2>
- <condition3 name="type" type="self::Global_Type" luatype="table">3</condition3>
- </Type>
- </Import_Section_Entry>
- <Global_Entry name="W_Global_Entry" isaggregate="true" luatype="table">
- <Global_Type name="type" type="self::Global_Type" count="1" luatype="table"/>
- <Init name="init" type="self::Init_Expr" count="1" luatype="table"/>
- </Global_Entry>
- <Export_Entry name="W_Export_Entry" isaggregate="true" luatype="table">
- <Field_Len name="field_len" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Field_Str name="field_str" type="string" count="1" size="self::Field_Len" luatype="string"/>
- <Kind name="kind" encoding="leb128u" type="uint8" count="1" luatype="integer"/>
- <Index name="index" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- </Export_Entry>
- <Element_Segment name="W_Element_Segment" isaggregate="true" luatype="table">
- <Index name="index" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Init name="init" type="self::Init_Expr" count="1" luatype="table"/>
- <Num_Length name="num_length" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Elems name="elems" encoding="leb128u" type="uint32" count="self::Num_Length" luatype="integer"/>
- </Element_Segment>
- <Local_Entry name="W_Local_Entry" isaggregate="true" luatype="table">
- <Count name="count" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Type name="type" encoding="leb128u" type="uint16" count="self::Count" luatype="integer"/>
- </Local_Entry>
- <Function_Body name="W_Function_Body" isaggregate="true" luatype="table">
- <Body_size name="body_size" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Local_Count name="local_count" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Local_Entries name="locals" type="self::Local_Entry" count="self::Local_Count" luatype="table"/>
- <Code name="code" type="uchar" count="self::Body_size" luatype="integer"/>
- </Function_Body>
- <Data_Segment name="W_Data_Segment" isaggregate="true" luatype="table">
- <Index name="index" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Offset name="offset" type="self::Init_Expr" count="1" luatype="table"/>
- <Size name="size" encoding="leb128u" type="uint32" count="1" luatype="integer"/>
- <Data name="data" type="uchar" count="self::Size" luatype="table"/>
- </Data_Segment>
- </Definition>
-</FT>
diff --git a/bruiser/autogen/wasm/ltg/luwasm.xml b/bruiser/autogen/wasm/wasm.xml
index 5ccd054..5ccd054 100644
--- a/bruiser/autogen/wasm/ltg/luwasm.xml
+++ b/bruiser/autogen/wasm/wasm.xml
diff --git a/bruiser/lua-scripts/wasmtest.lua b/bruiser/lua-scripts/wasmtest.lua
index dec8d66..50dfa4f 100644
--- a/bruiser/lua-scripts/wasmtest.lua
+++ b/bruiser/lua-scripts/wasmtest.lua
@@ -3,26 +3,6 @@ colors = require("ansicolors")
local libwasm = {}
-function libwasm.demo(wasm_path)
- local a = getwasmobj(wasm_path)
- print(a)
- print(type(a))
- for k, v in pairs(a) do
- print(k, v, type(k), type(v))
- end
- libwasm.dump_import_section(a)
- libwasm.dump_type_section(a)
- libwasm.dump_function_section(a)
- libwasm.dump_table_section(a)
- libwasm.dump_memory_section(a)
- libwasm.dump_global_section(a)
- libwasm.dump_export_section(a)
- libwasm.dump_start_section(a)
- libwasm.dump_element_section(a)
- libwasm.dump_code_section(a)
- libwasm.dump_data_section(a)
-end
-
function libwasm.dump_type_section(a)
print(colors("%{green}".."\ntype section:"))
if a["type_section"] ~= nil then
@@ -282,7 +262,633 @@ function libwasm.dev(wasm_path)
libwasm.dump_import_section(a)
end
+function libwasm.demo_getters(wasm_path)
+ local a = getwasmobj(wasm_path)
+ print(a)
+ print(type(a))
+ for k, v in pairs(a) do
+ print(k, v, type(k), type(v))
+ end
+ libwasm.dump_import_section(a)
+ libwasm.dump_type_section(a)
+ libwasm.dump_function_section(a)
+ libwasm.dump_table_section(a)
+ libwasm.dump_memory_section(a)
+ libwasm.dump_global_section(a)
+ libwasm.dump_export_section(a)
+ libwasm.dump_start_section(a)
+ libwasm.dump_element_section(a)
+ libwasm.dump_code_section(a)
+ libwasm.dump_data_section(a)
+end
+
+function libwasm.demo_setters(wasm_path)
+ local a = getwasmobj(wasm_path)
+
+ --type section setters
+ do
+ print("type section setters:")
+
+ if a["type_section"] ~= nil then
+ local pre = a["type_section"]:id()
+ a["type_section"]:set_id(10)
+ local post = a["type_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."type_section:id:failure\n"))
+ success = false
+ else
+ io.write(colors("%{green}".."type_section:id:pass\n"))
+ end
+
+ pre = a["type_section"]:payloadlength()
+ a["type_section"]:set_payloadlength(10)
+ post = a["type_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."type_section:payloadlength:failure\n"))
+ success = false
+ else
+ io.write(colors("%{green}".."type_section:payloadlength:pass\n"))
+ end
+
+ pre = a["type_section"]:namelength()
+ a["type_section"]:set_namelength(10)
+ post = a["type_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."type_section:namelength:failure\n"))
+ success = false
+ else
+ io.write(colors("%{green}".."type_section:namelength:pass\n"))
+ end
+
+ pre = a["type_section"]:name()
+ a["type_section"]:set_name("type_section")
+ post = a["type_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."type_section:name:failure\n"))
+ success = false
+ else
+ io.write(colors("%{green}".."type_section:name:pass\n"))
+ end
+
+ pre = a["type_section"]:count()
+ a["type_section"]:set_count(13)
+ post = a["type_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."type_section:count:failure\n"))
+ success = false
+ else
+ io.write(colors("%{green}".."type_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+ --import section setters
+ do
+ print("import section setters:")
+
+ if a["import_section"] ~= nil then
+ local pre = a["import_section"]:id()
+ a["import_section"]:set_id(10)
+ local post = a["import_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."import_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."import_section:id:pass\n"))
+ end
+
+ pre = a["import_section"]:payloadlength()
+ a["import_section"]:set_payloadlength(222)
+ post = a["import_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."import_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."import_section:payloadlength:pass\n"))
+ end
+
+ pre = a["import_section"]:namelength()
+ a["import_section"]:set_namelength(17)
+ post = a["import_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."import_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."import_section:namelength:pass\n"))
+ end
+
+ pre = a["import_section"]:name()
+ a["import_section"]:set_name("import_section")
+ post = a["import_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."import_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."import_section:name:pass\n"))
+ end
+
+ pre = a["import_section"]:count()
+ a["import_section"]:set_count(13)
+ post = a["import_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."import_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."import_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+ --function section setters
+ do
+ print("function section setters:")
+
+ if a["function_section"] ~= nil then
+ local pre = a["function_section"]:id()
+ a["function_section"]:set_id(10)
+ local post = a["function_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."function_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."function_section:id:pass\n"))
+ end
+
+ pre = a["function_section"]:payloadlength()
+ a["function_section"]:set_payloadlength(222)
+ post = a["function_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."function_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."function_section:payloadlength:pass\n"))
+ end
+
+ pre = a["function_section"]:namelength()
+ a["function_section"]:set_namelength(17)
+ post = a["function_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."function_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."function_section:namelength:pass\n"))
+ end
+
+ pre = a["function_section"]:name()
+ a["function_section"]:set_name("function_section")
+ post = a["function_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."function_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."function_section:name:pass\n"))
+ end
+
+ pre = a["function_section"]:count()
+ a["function_section"]:set_count(13)
+ post = a["function_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."function_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."function_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+ --table section setters
+ do
+ print("table section setters:")
+
+ if a["table_section"] ~= nil then
+ local pre = a["table_section"]:id()
+ a["table_section"]:set_id(10)
+ local post = a["table_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."table_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."table_section:id:pass\n"))
+ end
+
+ pre = a["table_section"]:payloadlength()
+ a["table_section"]:set_payloadlength(222)
+ post = a["table_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."table_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."table_section:payloadlength:pass\n"))
+ end
+
+ pre = a["table_section"]:namelength()
+ a["table_section"]:set_namelength(17)
+ post = a["table_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."table_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."table_section:namelength:pass\n"))
+ end
+
+ pre = a["table_section"]:name()
+ a["table_section"]:set_name("table_section")
+ post = a["table_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."table_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."table_section:name:pass\n"))
+ end
+
+ pre = a["table_section"]:count()
+ a["table_section"]:set_count(13)
+ post = a["table_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."table_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."table_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+ --memory section setters
+ do
+ print("memory section setters:")
+
+ if a["memory_section"] ~= nil then
+ local pre = a["memory_section"]:id()
+ a["memory_section"]:set_id(10)
+ local post = a["memory_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."memory_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."memory_section:id:pass\n"))
+ end
+
+ pre = a["memory_section"]:payloadlength()
+ a["memory_section"]:set_payloadlength(222)
+ post = a["memory_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."memory_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."memory_section:payloadlength:pass\n"))
+ end
+
+ pre = a["memory_section"]:namelength()
+ a["memory_section"]:set_namelength(17)
+ post = a["memory_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."memory_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."memory_section:namelength:pass\n"))
+ end
+
+ pre = a["memory_section"]:name()
+ a["memory_section"]:set_name("memory_section")
+ post = a["memory_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."memory_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."memory_section:name:pass\n"))
+ end
+
+ --[[
+ pre = a["memory_section"]:count()
+ a["memory_section"]:set_count(13)
+ post = a["memory_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."memory_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."memory_section:count:pass\n"))
+ end
+ --]]
+
+ --FIXME-entries
+ end
+ end
+
+ --global section setters
+ do
+ print("global section setters:")
+
+ if a["global_section"] ~= nil then
+ local pre = a["global_section"]:id()
+ a["global_section"]:set_id(10)
+ local post = a["global_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."global_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."global_section:id:pass\n"))
+ end
+
+ pre = a["global_section"]:payloadlength()
+ a["global_section"]:set_payloadlength(222)
+ post = a["global_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."global_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."global_section:payloadlength:pass\n"))
+ end
+
+ pre = a["global_section"]:namelength()
+ a["global_section"]:set_namelength(17)
+ post = a["global_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."global_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."global_section:namelength:pass\n"))
+ end
+
+ pre = a["global_section"]:name()
+ a["global_section"]:set_name("global_section")
+ post = a["global_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."global_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."global_section:name:pass\n"))
+ end
+
+ pre = a["global_section"]:count()
+ a["global_section"]:set_count(13)
+ post = a["global_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."global_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."global_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+ --export section setters
+ do
+ print("export section setters:")
+
+ if a["export_section"] ~= nil then
+ local pre = a["export_section"]:id()
+ a["export_section"]:set_id(10)
+ local post = a["export_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."export_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."export_section:id:pass\n"))
+ end
+
+ pre = a["export_section"]:payloadlength()
+ a["export_section"]:set_payloadlength(222)
+ post = a["export_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."export_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."export_section:payloadlength:pass\n"))
+ end
+
+ pre = a["export_section"]:namelength()
+ a["export_section"]:set_namelength(17)
+ post = a["export_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."export_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."export_section:namelength:pass\n"))
+ end
+
+ pre = a["export_section"]:name()
+ a["export_section"]:set_name("export_section")
+ post = a["export_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."export_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."export_section:name:pass\n"))
+ end
+
+ pre = a["export_section"]:count()
+ a["export_section"]:set_count(13)
+ post = a["export_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."export_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."export_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+ --start section setters
+ do
+ print("start section setters:")
+
+ if a["start_section"] ~= nil then
+ local pre = a["start_section"]:id()
+ a["start_section"]:set_id(10)
+ local post = a["start_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."start_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."start_section:id:pass\n"))
+ end
+
+ pre = a["start_section"]:payloadlength()
+ a["start_section"]:set_payloadlength(222)
+ post = a["start_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."start_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."start_section:payloadlength:pass\n"))
+ end
+
+ pre = a["start_section"]:namelength()
+ a["start_section"]:set_namelength(17)
+ post = a["start_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."start_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."start_section:namelength:pass\n"))
+ end
+
+ pre = a["start_section"]:name()
+ a["start_section"]:set_name("start_section")
+ post = a["start_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."start_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."start_section:name:pass\n"))
+ end
+
+ pre = a["start_section"]:index()
+ a["start_section"]:set_index(13)
+ post = a["start_section"]:index()
+ if pre == post then
+ io.write(colors("%{red}".."start_section:index:failure\n"))
+ else
+ io.write(colors("%{green}".."start_section:index:pass\n"))
+ end
+ end
+ end
+
+ --element section setters
+ do
+ print("element section setters:")
+
+ if a["element_section"] ~= nil then
+ local pre = a["element_section"]:id()
+ a["element_section"]:set_id(10)
+ local post = a["element_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."element_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."element_section:id:pass\n"))
+ end
+
+ pre = a["element_section"]:payloadlength()
+ a["element_section"]:set_payloadlength(222)
+ post = a["element_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."element_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."element_section:payloadlength:pass\n"))
+ end
+
+ pre = a["element_section"]:namelength()
+ a["element_section"]:set_namelength(17)
+ post = a["element_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."element_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."element_section:namelength:pass\n"))
+ end
+
+ pre = a["element_section"]:name()
+ a["element_section"]:set_name("element_section")
+ post = a["element_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."element_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."element_section:name:pass\n"))
+ end
+
+ pre = a["element_section"]:count()
+ a["element_section"]:set_count(13)
+ post = a["element_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."element_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."element_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+ --code section setters
+ do
+ print("code section setters:")
+
+ if a["code_section"] ~= nil then
+ local pre = a["code_section"]:id()
+ a["code_section"]:set_id(100)
+ local post = a["code_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."code_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."code_section:id:pass\n"))
+ end
+
+ pre = a["code_section"]:payloadlength()
+ a["code_section"]:set_payloadlength(222)
+ post = a["code_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."code_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."code_section:payloadlength:pass\n"))
+ end
+
+ pre = a["code_section"]:namelength()
+ a["code_section"]:set_namelength(17)
+ post = a["code_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."code_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."code_section:namelength:pass\n"))
+ end
+
+ pre = a["code_section"]:name()
+ a["code_section"]:set_name("code_section")
+ post = a["code_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."code_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."code_section:name:pass\n"))
+ end
+
+ pre = a["code_section"]:count()
+ a["code_section"]:set_count(13)
+ post = a["code_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."code_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."code_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+ --data section setters
+ do
+ print("data section setters:")
+
+ if a["data_section"] ~= nil then
+ local pre = a["data_section"]:id()
+ a["data_section"]:set_id(100)
+ local post = a["data_section"]:id()
+ if pre == post then
+ io.write(colors("%{red}".."data_section:id:failure\n"))
+ else
+ io.write(colors("%{green}".."data_section:id:pass\n"))
+ end
+
+ pre = a["data_section"]:payloadlength()
+ a["data_section"]:set_payloadlength(222)
+ post = a["data_section"]:payloadlength()
+ if pre == post then
+ io.write(colors("%{red}".."data_section:payloadlength:failure\n"))
+ else
+ io.write(colors("%{green}".."data_section:payloadlength:pass\n"))
+ end
+
+ pre = a["data_section"]:namelength()
+ a["data_section"]:set_namelength(17)
+ post = a["data_section"]:namelength()
+ if pre == post then
+ io.write(colors("%{red}".."data_section:namelength:failure\n"))
+ else
+ io.write(colors("%{green}".."data_section:namelength:pass\n"))
+ end
+
+ pre = a["data_section"]:name()
+ a["data_section"]:set_name("data_section")
+ post = a["data_section"]:name()
+ if pre == post then
+ io.write(colors("%{red}".."data_section:name:failure\n"))
+ else
+ io.write(colors("%{green}".."data_section:name:pass\n"))
+ end
+
+ pre = a["data_section"]:count()
+ a["data_section"]:set_count(13)
+ post = a["data_section"]:count()
+ if pre == post then
+ io.write(colors("%{red}".."data_section:count:failure\n"))
+ else
+ io.write(colors("%{green}".."data_section:count:pass\n"))
+ end
+
+ --FIXME-entries
+ end
+ end
+
+end
+
--libwasm.dev("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
-libwasm.demo("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
+--libwasm.demo_getters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
+libwasm.demo_setters("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
--libwasm.dump_all("/home/bloodstalker/devi/hell2/bruiser/autogen/wasm/ft/test.wasm")
+
return libwasm
diff --git a/bruiser/makefile b/bruiser/makefile
index 0c59542..5665ec8 100644
--- a/bruiser/makefile
+++ b/bruiser/makefile
@@ -135,12 +135,12 @@ linenoise.odbg: ./linenoise/linenoise.c
linenoise.ocov: ./linenoise/linenoise.c
$(CC) $(CC_FLAGS) $(COV_CXX) linenoise/linenoise.c -c -o linenoise.ocov
-./autogen/wasm/ft/wasm.xml:
- if [[ ls -l ./autogen/wasm/ft/ | wc -l == 2 ]];then ./autogen/wasm/ft.sh;else :;fi
+#./autogen/wasm/ft/wasm.xml:
+ #if [[ ls -l ./autogen/wasm/ft/ | wc -l == 3 ]];then ./autogen/wasm/ft.sh;else :;fi
#./autogen/wasm/ft.sh
-./autogen/wasm/ltg/wasm.xml:
- if [[ ls -l ./autogen/wasm/ltg/ | wc -l == 2 ]];then ./autogen/wasm/ltg.sh;else :;fi
+#./autogen/wasm/ltg/wasm.xml:
+ #if [[ ls -l ./autogen/wasm/ltg/ | wc -l == 2 ]];then ./autogen/wasm/ltg.sh;else :;fi
#./autogen/wasm/ltg.sh
./luatablegen/%.o:./luatablegen/%.c
@@ -156,41 +156,41 @@ CODE_GEN_DBG: $(FT_WASM_A_DBG) $(LTG_WASM_A_DBG)
CODE_GEN_COV: $(FT_WASM_A_COV) $(LTG_WASM_A_COV)
define check_ft_codegen
- - $(shell if [[ $$(ls -l ./autogen/wasm/ft/ | wc -l) == 4 ]];then ./autogen/wasm/ft.sh;else :;fi)
+ - $(shell if [[ $$(ls -l ./autogen/wasm/ft/ | wc -l) == 3 ]];then ./autogen/wasm/ft.sh;else :;fi)
endef
define check_ltg_codegen
- - $(shell if [[ $$(ls -l ./autogen/wasm/ltg/ | wc -l) == 4 ]];then ./autogen/wasm/ltg.sh;else :;fi)
+ - $(shell if [[ $$(ls -l ./autogen/wasm/ltg/ | wc -l) == 2 ]];then ./autogen/wasm/ltg.sh;else :;fi)
endef
-$(FT_WASM_SO): ./autogen/wasm/ft/wasm.xml
+$(FT_WASM_SO): ./autogen/wasm/wasm.xml
$(check_ft_codegen)
$(MAKE) -C ./autogen/wasm/ft SO
-$(FT_WASM_A): ./autogen/wasm/ft/wasm.xml
+$(FT_WASM_A): ./autogen/wasm/wasm.xml
$(check_ft_codegen)
$(MAKE) -C ./autogen/wasm/ft A
-$(FT_WASM_A_DBG): ./autogen/wasm/ft/wasm.xml
+$(FT_WASM_A_DBG): ./autogen/wasm/wasm.xml
$(check_ft_codegen)
$(MAKE) -C ./autogen/wasm/ft ADBG
-$(FT_WASM_A_COV): ./autogen/wasm/ft/wasm.xml
+$(FT_WASM_A_COV): ./autogen/wasm/wasm.xml
$(check_ft_codegen)
$(MAKE) -C ./autogen/wasm/ft ACOV
-$(LTG_WASM_SO): ./autogen/wasm/ltg/wasm.xml
+$(LTG_WASM_SO): ./autogen/wasm/wasm.xml
$(check_ltg_codegen)
$(MAKE) -C ./autogen/wasm/ltg SO
-$(LTG_WASM_A): ./autogen/wasm/ltg/wasm.xml
+$(LTG_WASM_A): ./autogen/wasm/wasm.xml
$(check_ltg_codegen)
$(MAKE) -C ./autogen/wasm/ltg A
-$(LTG_WASM_A_DBG): ./autogen/wasm/ltg/wasm.xml
+$(LTG_WASM_A_DBG): ./autogen/wasm/wasm.xml
$(check_ltg_codegen)
$(MAKE) -C ./autogen/wasm/ltg ADBG
-$(LTG_WASM_A_COV): ./autogen/wasm/ltg/wasm.xml
+$(LTG_WASM_A_COV): ./autogen/wasm/wasm.xml
$(check_ltg_codegen)
$(MAKE) -C ./autogen/wasm/ltg ACOV