From c52fb20b8480dad6d51ceaf215e8428062aa4541 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sun, 20 Jan 2019 13:00:15 +0330 Subject: update --- main.py | 3 +++ run.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3