Adjusted function autogen to automatically pull includes

This commit is contained in:
MysterD 2022-02-15 22:08:24 -08:00
parent 3fcc31e233
commit f862b3ac21
2 changed files with 29 additions and 32 deletions

View File

@ -28,7 +28,6 @@ in_files = [
"src/pc/djui/djui_popup.h",
"src/pc/network/network_utils.h",
"src/pc/djui/djui_chat_message.h",
#"src/game/print.h",
"src/game/interaction.h",
"src/game/level_info.h",
"src/game/save_file.h",
@ -69,23 +68,7 @@ template = """/* THIS FILE IS AUTOGENERATED */
#include "smlua.h"
#include "game/level_update.h"
#include "game/area.h"
#include "game/mario.h"
#include "game/mario_step.h"
#include "game/mario_actions_stationary.h"
#include "audio/external.h"
#include "object_fields.h"
#include "engine/math_util.h"
#include "engine/surface_collision.h"
#include "pc/network/network_utils.h"
#include "src/pc/djui/djui_popup.h"
#include "src/game/print.h"
#include "src/game/interaction.h"
#include "src/game/level_info.h"
#include "src/game/save_file.h"
#include "src/game/sound_init.h"
#include "src/pc/djui/djui_gfx_utils.h"
$[INCLUDES]
$[FUNCTIONS]
@ -293,6 +276,14 @@ def build_binds(processed_files):
s += build_bind(function)
return s
def build_includes():
s = ''
for f in in_files:
if not f.endswith('.h'):
continue
s += '#include "%s"\n' % f
return s
############################################################################
def process_function(fname, line):
@ -473,12 +464,20 @@ def main():
built_functions = build_functions(processed_files)
built_binds = build_binds(processed_files)
built_includes = build_includes()
filename = get_path(out_filename)
gen = template \
.replace("$[FUNCTIONS]", built_functions) \
.replace("$[BINDS]", built_binds) \
.replace("$[INCLUDES]", built_includes)
with open(filename, 'w') as out:
out.write(template.replace("$[FUNCTIONS]", built_functions).replace("$[BINDS]", built_binds))
print('REJECTS:')
print(rejects)
out.write(gen)
print('REJECTS:\n%s' % rejects)
doc_files(processed_files)
global total_functions

View File

@ -3,24 +3,22 @@
#include "smlua.h"
#include "game/level_update.h"
#include "game/area.h"
#include "game/mario.h"
#include "game/mario_step.h"
#include "game/mario_actions_stationary.h"
#include "audio/external.h"
#include "object_fields.h"
#include "engine/math_util.h"
#include "engine/surface_collision.h"
#include "pc/network/network_utils.h"
#include "src/audio/external.h"
#include "src/engine/surface_collision.h"
#include "src/game/camera.h"
#include "src/game/characters.h"
#include "src/game/mario_step.h"
#include "src/game/mario.h"
#include "src/pc/djui/djui_popup.h"
#include "src/game/print.h"
#include "src/pc/network/network_utils.h"
#include "src/pc/djui/djui_chat_message.h"
#include "src/game/interaction.h"
#include "src/game/level_info.h"
#include "src/game/save_file.h"
#include "src/game/sound_init.h"
#include "src/pc/djui/djui_gfx_utils.h"
//////////////
// camera.h //
//////////////