diff options
Diffstat (limited to 'bruiser')
55 files changed, 59 insertions, 255 deletions
diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp index b38327e..7e6a22e 100644 --- a/bruiser/bruiser.cpp +++ b/bruiser/bruiser.cpp @@ -372,8 +372,10 @@ class PyExec { PySys_SetArgv(argc, argv); pName = PyUnicode_DecodeFSDefault(py_script_name.c_str()); - std::string command = "import sys\nsys.path.append(\"" + bruiser_path + "/../bfd\")\n"; - PyRun_SimpleString(command.c_str()); + std::string command_1 = "import sys\nsys.path.append(\"" + bruiser_path + "/../bfd\")\n"; + std::string command_2 = "sys.path.append(\"" + bruiser_path + "/wasm\")\n"; + PyRun_SimpleString(command_1.c_str()); + PyRun_SimpleString(command_2.c_str()); pModule = PyImport_Import(pName); Py_DECREF(pName); @@ -1351,6 +1353,25 @@ class LuaWrapper return 0; } + int BruiserLuaDWASMPy(lua_State* __ls) { + int numargs = lua_gettop(__ls); + std::string filename = "dwasm"; + std::string funcname; + std::string objjpath; + std::string action; + if (numargs != 3) { + PRINT_WITH_COLOR_LB(RED, "wrong number of args. expected 3."); + return 0; + } + funcname = lua_tostring(__ls, 1); + objjpath = lua_tostring(__ls, 2); + action = lua_tostring(__ls, 3); + if (funcname == "" || objjpath == "" || action == "") { + PRINT_WITH_COLOR_LB(RED,"bad arg. nil passed. expected a value."); + } + PyExec py(filename.c_str(), funcname.c_str(), objjpath.c_str()); + } + int BruiserPyLoader(lua_State* __ls ) { int numargs = lua_gettop(__ls); //std::string filename = "../bfd/load.py"; @@ -2385,6 +2406,7 @@ int main(int argc, const char **argv) { lua_register(LE.GetLuaState(), "xsize", &LuaDispatch<&LuaWrapper::BruiserLuaGetXSize>); lua_register(LE.GetLuaState(), "xclear", &LuaDispatch<&LuaWrapper::BruiserLuaXObjDeallocate>); lua_register(LE.GetLuaState(), "xmemusage", &LuaDispatch<&LuaWrapper::BruiserLuaGetXMemSize>); + lua_register(LE.GetLuaState(), "dwasm", &LuaDispatch<&LuaWrapper::BruiserLuaDWASMPy>); runloop.setLW(std::move(LW)); runloop.run(); diff --git a/bruiser/lua-scripts/wasm.lua b/bruiser/lua-scripts/wasm.lua index 88588a6..3c94960 100644 --- a/bruiser/lua-scripts/wasm.lua +++ b/bruiser/lua-scripts/wasm.lua @@ -20,6 +20,7 @@ setmetatable(resizable_limit_t, {__call = setmetatable(global_type_t, {__call = function(self, arg0, arg1) local t = self.new(arg0, arg1) + print("created",t) return t end } diff --git a/bruiser/luatablegen/W_Code_Section_tablegen.c b/bruiser/luatablegen/W_Code_Section_tablegen.c index 717af94..1c516ce 100644 --- a/bruiser/luatablegen/W_Code_Section_tablegen.c +++ b/bruiser/luatablegen/W_Code_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Code_Section_H -#define _W_Code_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Code_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Code_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Code_Section_tablegen.h b/bruiser/luatablegen/W_Code_Section_tablegen.h index 76026d3..5c39e0c 100644 --- a/bruiser/luatablegen/W_Code_Section_tablegen.h +++ b/bruiser/luatablegen/W_Code_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Code_Section_H #define _W_Code_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Data_Section_tablegen.c b/bruiser/luatablegen/W_Data_Section_tablegen.c index a1f78f5..3dbc98b 100644 --- a/bruiser/luatablegen/W_Data_Section_tablegen.c +++ b/bruiser/luatablegen/W_Data_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Data_Section_H -#define _W_Data_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Data_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Data_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Data_Section_tablegen.h b/bruiser/luatablegen/W_Data_Section_tablegen.h index 53276c0..6275d39 100644 --- a/bruiser/luatablegen/W_Data_Section_tablegen.h +++ b/bruiser/luatablegen/W_Data_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Data_Section_H #define _W_Data_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Data_Segment_tablegen.c b/bruiser/luatablegen/W_Data_Segment_tablegen.c index 43d6df1..20b2762 100644 --- a/bruiser/luatablegen/W_Data_Segment_tablegen.c +++ b/bruiser/luatablegen/W_Data_Segment_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Data_Segment_H -#define _W_Data_Segment_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Data_Segment_tablegen.h" #include "../wasm.h" @@ -140,9 +135,4 @@ int W_Data_Segment_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Data_Segment_tablegen.h b/bruiser/luatablegen/W_Data_Segment_tablegen.h index 008cc15..c80428b 100644 --- a/bruiser/luatablegen/W_Data_Segment_tablegen.h +++ b/bruiser/luatablegen/W_Data_Segment_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Data_Segment_H #define _W_Data_Segment_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Elem_Segment_tablegen.c b/bruiser/luatablegen/W_Elem_Segment_tablegen.c index 0500f0d..82f8a30 100644 --- a/bruiser/luatablegen/W_Elem_Segment_tablegen.c +++ b/bruiser/luatablegen/W_Elem_Segment_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Elem_Segment_H -#define _W_Elem_Segment_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Elem_Segment_tablegen.h" #include "../wasm.h" @@ -140,9 +135,4 @@ int W_Elem_Segment_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Elem_Segment_tablegen.h b/bruiser/luatablegen/W_Elem_Segment_tablegen.h index bde6475..46fded5 100644 --- a/bruiser/luatablegen/W_Elem_Segment_tablegen.h +++ b/bruiser/luatablegen/W_Elem_Segment_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Elem_Segment_H #define _W_Elem_Segment_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Element_Section_tablegen.c b/bruiser/luatablegen/W_Element_Section_tablegen.c index 9e98ed7..93e545b 100644 --- a/bruiser/luatablegen/W_Element_Section_tablegen.c +++ b/bruiser/luatablegen/W_Element_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Element_Section_H -#define _W_Element_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Element_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Element_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Element_Section_tablegen.h b/bruiser/luatablegen/W_Element_Section_tablegen.h index 9696217..9123bb8 100644 --- a/bruiser/luatablegen/W_Element_Section_tablegen.h +++ b/bruiser/luatablegen/W_Element_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Element_Section_H #define _W_Element_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Export_Entry_tablegen.c b/bruiser/luatablegen/W_Export_Entry_tablegen.c index a9b5a73..68f40c2 100644 --- a/bruiser/luatablegen/W_Export_Entry_tablegen.c +++ b/bruiser/luatablegen/W_Export_Entry_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Export_Entry_H -#define _W_Export_Entry_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Export_Entry_tablegen.h" #include "../wasm.h" @@ -140,9 +135,4 @@ int W_Export_Entry_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Export_Entry_tablegen.h b/bruiser/luatablegen/W_Export_Entry_tablegen.h index 00d0e00..c4fcdbd 100644 --- a/bruiser/luatablegen/W_Export_Entry_tablegen.h +++ b/bruiser/luatablegen/W_Export_Entry_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Export_Entry_H #define _W_Export_Entry_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Export_Section_tablegen.c b/bruiser/luatablegen/W_Export_Section_tablegen.c index fc4ffdf..fbd2538 100644 --- a/bruiser/luatablegen/W_Export_Section_tablegen.c +++ b/bruiser/luatablegen/W_Export_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Export_Section_H -#define _W_Export_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Export_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Export_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Export_Section_tablegen.h b/bruiser/luatablegen/W_Export_Section_tablegen.h index 4ab9968..ded408e 100644 --- a/bruiser/luatablegen/W_Export_Section_tablegen.h +++ b/bruiser/luatablegen/W_Export_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Export_Section_H #define _W_Export_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Function_Body_tablegen.c b/bruiser/luatablegen/W_Function_Body_tablegen.c index eb93f21..173c381 100644 --- a/bruiser/luatablegen/W_Function_Body_tablegen.c +++ b/bruiser/luatablegen/W_Function_Body_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Function_Body_H -#define _W_Function_Body_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Function_Body_tablegen.h" #include "../wasm.h" @@ -140,9 +135,4 @@ int W_Function_Body_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Function_Body_tablegen.h b/bruiser/luatablegen/W_Function_Body_tablegen.h index 2dcfc65..bb9bf13 100644 --- a/bruiser/luatablegen/W_Function_Body_tablegen.h +++ b/bruiser/luatablegen/W_Function_Body_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Function_Body_H #define _W_Function_Body_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Function_Section_tablegen.c b/bruiser/luatablegen/W_Function_Section_tablegen.c index 9b83937..ebc249d 100644 --- a/bruiser/luatablegen/W_Function_Section_tablegen.c +++ b/bruiser/luatablegen/W_Function_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Function_Section_H -#define _W_Function_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Function_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Function_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Function_Section_tablegen.h b/bruiser/luatablegen/W_Function_Section_tablegen.h index bd53df6..328e2c3 100644 --- a/bruiser/luatablegen/W_Function_Section_tablegen.h +++ b/bruiser/luatablegen/W_Function_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Function_Section_H #define _W_Function_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Global_Entry_tablegen.c b/bruiser/luatablegen/W_Global_Entry_tablegen.c index 9021820..9b87c0f 100644 --- a/bruiser/luatablegen/W_Global_Entry_tablegen.c +++ b/bruiser/luatablegen/W_Global_Entry_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Global_Entry_H -#define _W_Global_Entry_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Global_Entry_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Global_Entry_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Global_Entry_tablegen.h b/bruiser/luatablegen/W_Global_Entry_tablegen.h index 80a9afa..7432095 100644 --- a/bruiser/luatablegen/W_Global_Entry_tablegen.h +++ b/bruiser/luatablegen/W_Global_Entry_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Global_Entry_H #define _W_Global_Entry_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Global_Section_tablegen.c b/bruiser/luatablegen/W_Global_Section_tablegen.c index cb3195c..1254816 100644 --- a/bruiser/luatablegen/W_Global_Section_tablegen.c +++ b/bruiser/luatablegen/W_Global_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Global_Section_H -#define _W_Global_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Global_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Global_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Global_Section_tablegen.h b/bruiser/luatablegen/W_Global_Section_tablegen.h index c58ae62..52ab0c5 100644 --- a/bruiser/luatablegen/W_Global_Section_tablegen.h +++ b/bruiser/luatablegen/W_Global_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Global_Section_H #define _W_Global_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Import_Section_Entry_tablegen.c b/bruiser/luatablegen/W_Import_Section_Entry_tablegen.c index 2f40fc0..0a568e8 100644 --- a/bruiser/luatablegen/W_Import_Section_Entry_tablegen.c +++ b/bruiser/luatablegen/W_Import_Section_Entry_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Import_Section_Entry_H -#define _W_Import_Section_Entry_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Import_Section_Entry_tablegen.h" #include "../wasm.h" @@ -174,9 +169,4 @@ int W_Import_Section_Entry_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Import_Section_Entry_tablegen.h b/bruiser/luatablegen/W_Import_Section_Entry_tablegen.h index db2bddc..6086ae1 100644 --- a/bruiser/luatablegen/W_Import_Section_Entry_tablegen.h +++ b/bruiser/luatablegen/W_Import_Section_Entry_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Import_Section_Entry_H #define _W_Import_Section_Entry_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Import_Section_tablegen.c b/bruiser/luatablegen/W_Import_Section_tablegen.c index 88354f0..de966f9 100644 --- a/bruiser/luatablegen/W_Import_Section_tablegen.c +++ b/bruiser/luatablegen/W_Import_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Import_Section_H -#define _W_Import_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Import_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Import_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Import_Section_tablegen.h b/bruiser/luatablegen/W_Import_Section_tablegen.h index 2dd6799..5d51bf2 100644 --- a/bruiser/luatablegen/W_Import_Section_tablegen.h +++ b/bruiser/luatablegen/W_Import_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Import_Section_H #define _W_Import_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Local_Entry_tablegen.c b/bruiser/luatablegen/W_Local_Entry_tablegen.c index a6fe99e..db10c46 100644 --- a/bruiser/luatablegen/W_Local_Entry_tablegen.c +++ b/bruiser/luatablegen/W_Local_Entry_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Local_Entry_H -#define _W_Local_Entry_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Local_Entry_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Local_Entry_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Local_Entry_tablegen.h b/bruiser/luatablegen/W_Local_Entry_tablegen.h index 05a36dc..d29b5b9 100644 --- a/bruiser/luatablegen/W_Local_Entry_tablegen.h +++ b/bruiser/luatablegen/W_Local_Entry_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Local_Entry_H #define _W_Local_Entry_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Memory_Section_tablegen.c b/bruiser/luatablegen/W_Memory_Section_tablegen.c index 075d5ad..8972528 100644 --- a/bruiser/luatablegen/W_Memory_Section_tablegen.c +++ b/bruiser/luatablegen/W_Memory_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Memory_Section_H -#define _W_Memory_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Memory_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Memory_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Memory_Section_tablegen.h b/bruiser/luatablegen/W_Memory_Section_tablegen.h index 54b9d84..37bffcf 100644 --- a/bruiser/luatablegen/W_Memory_Section_tablegen.h +++ b/bruiser/luatablegen/W_Memory_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Memory_Section_H #define _W_Memory_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Start_Section_tablegen.c b/bruiser/luatablegen/W_Start_Section_tablegen.c index 1f46d8a..b598e1b 100644 --- a/bruiser/luatablegen/W_Start_Section_tablegen.c +++ b/bruiser/luatablegen/W_Start_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Start_Section_H -#define _W_Start_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Start_Section_tablegen.h" #include "../wasm.h" @@ -89,9 +84,4 @@ int W_Start_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Start_Section_tablegen.h b/bruiser/luatablegen/W_Start_Section_tablegen.h index 8e740d3..cf0c1e1 100644 --- a/bruiser/luatablegen/W_Start_Section_tablegen.h +++ b/bruiser/luatablegen/W_Start_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Start_Section_H #define _W_Start_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Table_Section_tablegen.c b/bruiser/luatablegen/W_Table_Section_tablegen.c index a27fb36..43bcdf0 100644 --- a/bruiser/luatablegen/W_Table_Section_tablegen.c +++ b/bruiser/luatablegen/W_Table_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Table_Section_H -#define _W_Table_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Table_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Table_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Table_Section_tablegen.h b/bruiser/luatablegen/W_Table_Section_tablegen.h index 5d10097..9793e6b 100644 --- a/bruiser/luatablegen/W_Table_Section_tablegen.h +++ b/bruiser/luatablegen/W_Table_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Table_Section_H #define _W_Table_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Type_Section_Entry_tablegen.c b/bruiser/luatablegen/W_Type_Section_Entry_tablegen.c index 4faeeb7..c6a38ea 100644 --- a/bruiser/luatablegen/W_Type_Section_Entry_tablegen.c +++ b/bruiser/luatablegen/W_Type_Section_Entry_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Type_Section_Entry_H -#define _W_Type_Section_Entry_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Type_Section_Entry_tablegen.h" #include "../wasm.h" @@ -157,9 +152,4 @@ int W_Type_Section_Entry_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Type_Section_Entry_tablegen.h b/bruiser/luatablegen/W_Type_Section_Entry_tablegen.h index 25d445d..dec22ae 100644 --- a/bruiser/luatablegen/W_Type_Section_Entry_tablegen.h +++ b/bruiser/luatablegen/W_Type_Section_Entry_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Type_Section_Entry_H #define _W_Type_Section_Entry_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/W_Type_Section_tablegen.c b/bruiser/luatablegen/W_Type_Section_tablegen.c index 3c784d1..237c87b 100644 --- a/bruiser/luatablegen/W_Type_Section_tablegen.c +++ b/bruiser/luatablegen/W_Type_Section_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _W_Type_Section_H -#define _W_Type_Section_H -#ifdef __cplusplus -extern "C" { -#endif #include "./W_Type_Section_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int W_Type_Section_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/W_Type_Section_tablegen.h b/bruiser/luatablegen/W_Type_Section_tablegen.h index 68cc567..fd2fd12 100644 --- a/bruiser/luatablegen/W_Type_Section_tablegen.h +++ b/bruiser/luatablegen/W_Type_Section_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _W_Type_Section_H #define _W_Type_Section_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/Wasm_Module_tablegen.c b/bruiser/luatablegen/Wasm_Module_tablegen.c index 724a7b3..318309e 100644 --- a/bruiser/luatablegen/Wasm_Module_tablegen.c +++ b/bruiser/luatablegen/Wasm_Module_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _Wasm_Module_H -#define _Wasm_Module_H -#ifdef __cplusplus -extern "C" { -#endif #include "./Wasm_Module_tablegen.h" #include "../wasm.h" @@ -293,9 +288,4 @@ int Wasm_Module_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/Wasm_Module_tablegen.h b/bruiser/luatablegen/Wasm_Module_tablegen.h index 795b219..7c9aaae 100644 --- a/bruiser/luatablegen/Wasm_Module_tablegen.h +++ b/bruiser/luatablegen/Wasm_Module_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _Wasm_Module_H #define _Wasm_Module_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/global_type_t_tablegen.c b/bruiser/luatablegen/global_type_t_tablegen.c index d583294..a2a8675 100644 --- a/bruiser/luatablegen/global_type_t_tablegen.c +++ b/bruiser/luatablegen/global_type_t_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _global_type_t_H -#define _global_type_t_H -#ifdef __cplusplus -extern "C" { -#endif #include "./global_type_t_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int global_type_t_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/global_type_t_tablegen.h b/bruiser/luatablegen/global_type_t_tablegen.h index 15a2c9e..9fbbc60 100644 --- a/bruiser/luatablegen/global_type_t_tablegen.h +++ b/bruiser/luatablegen/global_type_t_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _global_type_t_H #define _global_type_t_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/init_expr_t_tablegen.c b/bruiser/luatablegen/init_expr_t_tablegen.c index 08a6a3f..ff05e0c 100644 --- a/bruiser/luatablegen/init_expr_t_tablegen.c +++ b/bruiser/luatablegen/init_expr_t_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _init_expr_t_H -#define _init_expr_t_H -#ifdef __cplusplus -extern "C" { -#endif #include "./init_expr_t_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int init_expr_t_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/init_expr_t_tablegen.h b/bruiser/luatablegen/init_expr_t_tablegen.h index 3f7b518..aabcc64 100644 --- a/bruiser/luatablegen/init_expr_t_tablegen.h +++ b/bruiser/luatablegen/init_expr_t_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _init_expr_t_H #define _init_expr_t_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/memory_type_t_tablegen.c b/bruiser/luatablegen/memory_type_t_tablegen.c index fe921bc..5f75d51 100644 --- a/bruiser/luatablegen/memory_type_t_tablegen.c +++ b/bruiser/luatablegen/memory_type_t_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _memory_type_t_H -#define _memory_type_t_H -#ifdef __cplusplus -extern "C" { -#endif #include "./memory_type_t_tablegen.h" #include "../wasm.h" @@ -89,9 +84,4 @@ int memory_type_t_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/memory_type_t_tablegen.h b/bruiser/luatablegen/memory_type_t_tablegen.h index ffd02a9..2a63963 100644 --- a/bruiser/luatablegen/memory_type_t_tablegen.h +++ b/bruiser/luatablegen/memory_type_t_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _memory_type_t_H #define _memory_type_t_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/resizable_limit_t_tablegen.c b/bruiser/luatablegen/resizable_limit_t_tablegen.c index 16f0432..f777510 100644 --- a/bruiser/luatablegen/resizable_limit_t_tablegen.c +++ b/bruiser/luatablegen/resizable_limit_t_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _resizable_limit_t_H -#define _resizable_limit_t_H -#ifdef __cplusplus -extern "C" { -#endif #include "./resizable_limit_t_tablegen.h" #include "../wasm.h" @@ -123,9 +118,4 @@ int resizable_limit_t_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/resizable_limit_t_tablegen.h b/bruiser/luatablegen/resizable_limit_t_tablegen.h index bd9ab6f..b987261 100644 --- a/bruiser/luatablegen/resizable_limit_t_tablegen.h +++ b/bruiser/luatablegen/resizable_limit_t_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _resizable_limit_t_H #define _resizable_limit_t_H #ifdef __cplusplus diff --git a/bruiser/luatablegen/table_type_t_tablegen.c b/bruiser/luatablegen/table_type_t_tablegen.c index 21dd9da..a8e5af0 100644 --- a/bruiser/luatablegen/table_type_t_tablegen.c +++ b/bruiser/luatablegen/table_type_t_tablegen.c @@ -5,11 +5,6 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> -#ifndef _table_type_t_H -#define _table_type_t_H -#ifdef __cplusplus -extern "C" { -#endif #include "./table_type_t_tablegen.h" #include "../wasm.h" @@ -106,9 +101,4 @@ int table_type_t_register(lua_State* __ls) { return 1; } -#ifdef __cplusplus -} -#endif //end of extern c -#endif //end of inclusion guard - diff --git a/bruiser/luatablegen/table_type_t_tablegen.h b/bruiser/luatablegen/table_type_t_tablegen.h index c2aed8b..9999c40 100644 --- a/bruiser/luatablegen/table_type_t_tablegen.h +++ b/bruiser/luatablegen/table_type_t_tablegen.h @@ -5,6 +5,7 @@ #include "../lua-5.3.4/src/lualib.h" #include <inttypes.h> #include <stdbool.h> + #ifndef _table_type_t_H #define _table_type_t_H #ifdef __cplusplus diff --git a/bruiser/makefile b/bruiser/makefile index 393a7ae..ed592d8 100644 --- a/bruiser/makefile +++ b/bruiser/makefile @@ -17,7 +17,8 @@ C_SRCS=$(wildcard *.c) #for some reason without ld the build fails on ubuntu trusty on travis #EXTRA_LD_FLAGS+=-lpthread -ldl -lutil -lm -Xlinker -lpython3 EXTRA_LD_FLAGS+=$(shell $(PY_CONF) --ldflags) -lffi -lcapstone -lkeystone -L./lua-5.3.4/src -llua -TBG_OBJLIST_INC=$(patsubst ./luatablegen/%.c, ./luatablegen/%.o, $(wildcard ./luatablegen/*.c)) +TBG_OBJLIST_INC:=$(patsubst ./luatablegen/%.c, ./luatablegen/%.o, $(wildcard ./luatablegen/*.c)) +SAN?= ######################################RULES#################################### .DEFAULT: all diff --git a/bruiser/run.sh b/bruiser/run.sh index 0a1dca3..92d249d 100755 --- a/bruiser/run.sh +++ b/bruiser/run.sh @@ -2,6 +2,6 @@ cd $(dirname $0) #"./bruiser" --verbose --lua ./lua-scripts/demo1.lua -"./bruiser" --lua ./lua-scripts/demo1.lua +"./bruiser" --lua ./lua-scripts/regtest.lua #"./bruiser" ../test/bruisertest/test.cpp --src --verbose --lua ./lua-scripts/demo1.lua #gdb "./bruiser ../test/bruisertest/test.cpp --src" diff --git a/bruiser/wasm/dwasm.py b/bruiser/wasm/dwasm.py index 28f3c4d..e404dca 100755 --- a/bruiser/wasm/dwasm.py +++ b/bruiser/wasm/dwasm.py @@ -5,9 +5,14 @@ import code import readline import signal import sys -from parse import Argparser, premain, SigHandler_SIGINT +from parse import Argparser, premain, SigHandler_SIGINT,PythonInterpreter from utils import ParseFlags +def getWASMModule(): + module_path = sys.argv[1] + interpreter = PythonInterpreter() + module = interpreter.parse(module_path) + def main(): signal.signal(signal.SIGINT, SigHandler_SIGINT) argparser = Argparser() |