aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-07-14 10:44:56 +0000
committerbloodstalker <thabogre@gmail.com>2018-07-14 10:44:56 +0000
commit2cae0e54f7bec588fbceb1e91c6023923abc1d1c (patch)
tree471f824bed5af2347c7b0a6378344c127bf11efc
parentfirst commit (diff)
downloadluatablegen-2cae0e54f7bec588fbceb1e91c6023923abc1d1c.tar.gz
luatablegen-2cae0e54f7bec588fbceb1e91c6023923abc1d1c.zip
update
-rwxr-xr-xluatablegen.py8
-rwxr-xr-xrun.sh3
2 files changed, 10 insertions, 1 deletions
diff --git a/luatablegen.py b/luatablegen.py
index aca41d3..3fc39b3 100755
--- a/luatablegen.py
+++ b/luatablegen.py
@@ -7,6 +7,7 @@ import os
import readline
import signal
import sys
+import datetime
C_STRUCT = ['typedef struct XXX {', '}XXX;']
HEADER_GUARD = ['\n#ifndef _XXX_H\n#define _XXX_H\n', '#endif //end of inclusion guard\n\n']
@@ -97,10 +98,13 @@ class TbgParser(object):
def __init__(self, argparser):
self.tbg_file = json.load(open(argparser.args.tbg))
self.argparser = argparser
+ self.time = datetime.datetime.now().isoformat()
+ print(self.time)
def begin(self, c_source, struct_name, h_filename, is_source):
c_source.write("\n")
c_source.write("// automatically generated by luatablegen\n")
+ c_source.write("// " + self.time + "\n")
for header in HEADER_LIST:
if self.argparser.args.luaheader:
c_source.write(header.replace("HHH", self.argparser.args.luaheader+"/"))
@@ -282,6 +286,7 @@ class TbgParser(object):
def luagen(self):
l_source = open(self.argparser.args.lualibpath, "w")
l_source.write("-- automatically generated by luatablegen\n")
+ l_source.write("-- " + self.time + "\n")
l_source.write(LUA_LIB[0])
for k, v in self.tbg_file.items():
struct_name = k
@@ -366,6 +371,8 @@ class TbgParser(object):
aggr_header_h = open(self.argparser.args.headeraggr, "w")
aggr_header.write("// automatically generated by luatablegen\n")
aggr_header_h.write("// automatically generated by luatablegen\n")
+ aggr_header.write("// " + self.time + "\n")
+ aggr_header_h.write("// " + self.time + "\n")
aggr_header_h.write(HEADER_GUARD[0].replace("XXX", "WASM_TABLES_AGGR"))
aggr_header_h.write(EXTERN_C[0])
aggr_header.write("\n")
@@ -392,6 +399,7 @@ class TbgParser(object):
self.luagen()
if self.argparser.args.docpath:
d_source.write("_automatically generated by luatablegen._<br/>\n")
+ d_source.write("_" + self.time + "_")
# write code here
def premain(argparser):
diff --git a/run.sh b/run.sh
index a4afb66..12b86db 100755
--- a/run.sh
+++ b/run.sh
@@ -1,6 +1,7 @@
#!/usr/bin/bash
cd $(dirname $0)
-../luatablegen.py --tbg ../wasmtablegen.json --out ./ --luaheader ../../bruiser/lua-5.3.4/src --pre ./wasmheader.txt --headeraggr ../../bruiser/luatablegen/wasm_tables.h --lualibpath ./wasm.lua --docpath ./wasm.md
+if [[ -d ./out ]]; then :;else mkdir ./out;fi
+./luatablegen.py --tbg ./test/wasmtablegen.json --out ./out --luaheader /home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src --pre ./test/wasmheader.txt --headeraggr ./out/wasm_tables.h --lualibpath ./out/wasm.lua --docpath ./out/wasm.md
for filename in ../../bruiser/luatablegen/*.c; do
gcc -c $filename > /dev/null 2>&1
if [[ $? != 0 ]]; then