diff options
author | bloodstalker <thabogre@gmail.com> | 2018-08-29 18:25:26 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-08-29 18:25:26 +0000 |
commit | b1efe40eed74681d14c4c7a1777518593be58431 (patch) | |
tree | bea2cdd833f13823fcf515e91f499ac2eef5adfd | |
parent | update (diff) | |
download | luatablegen-b1efe40eed74681d14c4c7a1777518593be58431.tar.gz luatablegen-b1efe40eed74681d14c4c7a1777518593be58431.zip |
update
Diffstat (limited to '')
m--------- | lua5 | 0 | ||||
-rwxr-xr-x | luatablegen.py | 11 | ||||
-rw-r--r-- | out/makefile | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/lua5 b/lua5 -Subproject f59e6a93c0ad38a27a420e51abf8f13d962446b +Subproject e354c6355e7f48e087678ec49e340ca0696725b diff --git a/luatablegen.py b/luatablegen.py index a02cdf4..01fcfe5 100755 --- a/luatablegen.py +++ b/luatablegen.py @@ -50,9 +50,13 @@ REGISTER_TABLE_METHODS = ['static const luaL_Reg XXX_methods[] = {\n', REGISTER_META = ['static const luaL_Reg XXX_meta[] = {\n', '\t{0, 0}\n};\n'] TABLE_REGISTER = ['int XXX_register(lua_State* __ls) {\n', - '\tluaL_openlib(__ls, "XXX", XXX_methods, 0);\n', + 'lua_newtable(__ls);\n', + 'luaL_setfuncs(__ls, XXX_methods, 0);\n', + 'lua_setglobal(__ls, "XXX");\n', '\tluaL_newmetatable(__ls, "XXX");\n', - '\tluaL_openlib(__ls, 0, XXX_meta, 0);\n', + 'lua_newtable(__ls);\n', + 'luaL_setfuncs(__ls, XXX_meta, 0);\n', + 'lua_setglobal(__ls, 0);\n', '\tlua_pushliteral(__ls, "__index");\n', '\tlua_pushvalue(__ls, -3);\n', '\tlua_rawset(__ls, -3);\n', @@ -612,7 +616,6 @@ class TbgParser(object): field_names = v['field_name'] field_types = v['field_type'] lua_types = v['lua_type'] - #methods = v['methods'] l_source.write(LUA_SETMETA_NEW[0].replace("XXX", struct_name)) arg_list_str = str() for i in range(0, len(field_names)): @@ -678,10 +681,8 @@ class TbgParser(object): simple_type = simple_type_resovler(node.attrib["type"]) if count != 1 and simple_type not in simple_table_list: simple_table_list.append(simple_type) - print(simple_type) yyy = node.attrib["name"] xxx = simple_type_resovler(node.attrib["type"]) - #simple_type = lua_type_resolver(node.attrib["type"]) # lightuserdata types are being handled elsewhere if simple_type == "lightuserdata": continue lua_type = lua_type_resolver(node.attrib["type"]) diff --git a/out/makefile b/out/makefile index 86b90b3..f33376e 100644 --- a/out/makefile +++ b/out/makefile @@ -3,12 +3,12 @@ SHELL=bash SHELL?=bash CC=clang CC?=clang -CC_FLAGS=-fpic +CC_FLAGS= CC_EXTRA?= CTAGS_I_PATH?=./ LD_FLAGS= LIB_LUA=../lua5/liblua.a -EXTRA_LD_FLAGS?=-lm -ldl -llua +EXTRA_LD_FLAGS?=-lm -ldl ADD_SANITIZERS_CC= -g -fsanitize=address -fno-omit-frame-pointer ADD_SANITIZERS_LD= -g -fsanitize=address MEM_SANITIZERS_CC= -g -fsanitize=memory -fno-omit-frame-pointer @@ -81,7 +81,7 @@ $(LIB_LUA): $(MAKE) -C ../lua5 a $(TARGET): $(TARGET).o $(LIB_LUA) $(OBJ_LIST) - $(CC) $^ $(LD_FLAGS) -o $@ + $(CC) $(LD_FLAGS) $^ -o $@ $(TARGET)-static: $(TARGET).o $(LIB_LUA) $(OBJ_LIST) $(CC) $^ $(LD_FLAGS) -static -o $@ |