aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xmain.py3
-rwxr-xr-xrun.sh2
2 files changed, 4 insertions, 1 deletions
diff --git a/main.py b/main.py
index 90e239c..da982b9 100755
--- a/main.py
+++ b/main.py
@@ -184,6 +184,7 @@ class Argparser(object):
parser.add_argument("--singlefile", action="store_true", help="the generated code will be put in a single file", default=False)
parser.add_argument("--calloc", action="store_true", help="use calloc instead of malloc, defaults to false", default=False)
parser.add_argument("--luaalloc", action="store_true", help="use calloc instead of malloc, defaults to false", default=False)
+ parser.add_argument("--luaheaders", type=str, help="the location of lua header files that need to get added to the lib files if luaalloc has been selected", default="")
parser.add_argument("--singlefilename", type=str, help="name of the single file")
self.args = parser.parse_args()
if self.args.calloc and self.args.luaalloc: print("you have selected both calloc and lua_newuserdata. that can't possibly work.\n")
@@ -282,6 +283,8 @@ class CodeGen(object):
read_source.write("\n// automatically generated by faultrieber\n")
read_source.write("// " + self.dnt + "\n\n")
read_source.write(text.header_list)
+ if self.argparser.args.luaalloc:
+ read_source.write('#include "'+self.argparser.args.luaheaders+'"\n')
read_source.write('#include "./read.h"\n')
read_source.write('#include "./structs.h"\n\n')
if self.argparser.args.calloc: read_source.write(text.ft_calloc_def)
diff --git a/run.sh b/run.sh
index 5fd142c..d542844 100755
--- a/run.sh
+++ b/run.sh
@@ -1,5 +1,5 @@
#!/bin/sh
cd $(dirname $0)
-"./faultreiber.py" --targetname autowasm --outdir ./test/ --structs ./test/struct.json --xml ./resources/wasm2.xml --name wasm --luaalloc
+"./faultreiber.py" --targetname autowasm --outdir ./test/ --structs ./test/struct.json --xml ./resources/wasm2.xml --name wasm --luaalloc --luaheaders ../../../lua/src/lua.h
#"./faultreiber.py" --targetname autowasm --outdir ./test/ --structs ./test/struct.json --xml ./resources/wasm2.xml --name wasm --calloc
"clang-format" -i ./test/read.c ./test/structs.c ./test/structs.h ./test/aggregate.c ./test/aggregate.h ./test/read.h