Add Lua wrappers for object_helpers.c

This commit is contained in:
MysterD 2022-02-22 18:34:51 -08:00
parent 44fca9aede
commit e499f51767
4 changed files with 2246 additions and 1 deletions

View file

@ -36,6 +36,7 @@ in_files = [
"src/pc/network/network_player.h",
"include/behavior_table.h",
"src/pc/lua/smlua_obj_utils.h",
"src/game/object_helpers.c",
]
override_allowed_functions = {
@ -63,6 +64,7 @@ override_disallowed_functions = {
"src/game/sound_init.h": [ "_loop_", "thread4_", "set_sound_mode" ],
"src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ],
"src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update" ],
"src/game/object_helpers.c": [ "spawn_obj" ],
}
###########################################################

View file

@ -6,10 +6,24 @@ def extract_functions(filename):
with open(filename) as file:
lines = file.readlines()
# deal with certain ifdefs
txt = ''
gobbling = False
for line in lines:
if line.strip() == '#ifdef AVOID_UB':
gobbling = True
if line.strip() == '#else':
gobbling = False
if line.strip() == '#endif':
gobbling = False
if not gobbling:
txt += line + '\n'
# strip directives and comments
in_directive = False
tmp = txt
txt = ''
for line in lines:
for line in tmp.splitlines():
if line.strip().startswith('#') or in_directive:
in_directive = line.strip().endswith('\\')
continue
@ -69,3 +83,6 @@ def extract_functions(filename):
# normalize function ending
txt = txt.replace(' {', ';')
return txt
if __name__ == "__main__":
print(extract_functions(sys.argv[1]))

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff