From b1efe40eed74681d14c4c7a1777518593be58431 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Wed, 29 Aug 2018 22:55:26 +0430 Subject: update --- lua5 | 2 +- luatablegen.py | 11 ++++++----- out/makefile | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lua5 b/lua5 index f59e6a9..e354c63 160000 --- a/lua5 +++ b/lua5 @@ -1 +1 @@ -Subproject commit f59e6a93c0ad38a27a420e51abf8f13d962446b5 +Subproject commit e354c6355e7f48e087678ec49e340ca0696725b1 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 $@ -- cgit v1.2.3