mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-18 19:22:41 +00:00
Add Lua wrappers for object_helpers.c
This commit is contained in:
parent
44fca9aede
commit
e499f51767
4 changed files with 2246 additions and 1 deletions
|
@ -36,6 +36,7 @@ in_files = [
|
||||||
"src/pc/network/network_player.h",
|
"src/pc/network/network_player.h",
|
||||||
"include/behavior_table.h",
|
"include/behavior_table.h",
|
||||||
"src/pc/lua/smlua_obj_utils.h",
|
"src/pc/lua/smlua_obj_utils.h",
|
||||||
|
"src/game/object_helpers.c",
|
||||||
]
|
]
|
||||||
|
|
||||||
override_allowed_functions = {
|
override_allowed_functions = {
|
||||||
|
@ -63,6 +64,7 @@ override_disallowed_functions = {
|
||||||
"src/game/sound_init.h": [ "_loop_", "thread4_", "set_sound_mode" ],
|
"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_utils.h": [ "network_get_player_text_color[^_]" ],
|
||||||
"src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update" ],
|
"src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update" ],
|
||||||
|
"src/game/object_helpers.c": [ "spawn_obj" ],
|
||||||
}
|
}
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
|
@ -6,10 +6,24 @@ def extract_functions(filename):
|
||||||
with open(filename) as file:
|
with open(filename) as file:
|
||||||
lines = file.readlines()
|
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
|
# strip directives and comments
|
||||||
in_directive = False
|
in_directive = False
|
||||||
|
tmp = txt
|
||||||
txt = ''
|
txt = ''
|
||||||
for line in lines:
|
for line in tmp.splitlines():
|
||||||
if line.strip().startswith('#') or in_directive:
|
if line.strip().startswith('#') or in_directive:
|
||||||
in_directive = line.strip().endswith('\\')
|
in_directive = line.strip().endswith('\\')
|
||||||
continue
|
continue
|
||||||
|
@ -69,3 +83,6 @@ def extract_functions(filename):
|
||||||
# normalize function ending
|
# normalize function ending
|
||||||
txt = txt.replace(' {', ';')
|
txt = txt.replace(' {', ';')
|
||||||
return txt
|
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
Loading…
Reference in a new issue