From 956efe1e86f1f934e446d0289d27329c58726bab Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 5 Feb 2022 13:33:22 -0800 Subject: [PATCH] Print totals when autogenerating lua documentation --- autogen/convert_constants.py | 6 ++++++ autogen/convert_functions.py | 7 +++++++ autogen/convert_structs.py | 14 ++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index db47fcab..6048b8d6 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -31,6 +31,7 @@ pretend_find = [ ############################################################################ seen_constants = [] +totalConstants = 0 ############################################################################ @@ -51,6 +52,8 @@ def saw_constant(identifier): print("SAW DUPLICATE CONSTANT: " + identifier) return True else: + global totalConstants + totalConstants += 1 seen_constants.append(identifier) return False @@ -277,4 +280,7 @@ def main(): with open(get_path(out_filename_docs), 'w') as out: out.write(doc) + global totalConstants + print("Total constants: " + str(totalConstants)) + main() \ No newline at end of file diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index dc60dcbb..14f5464d 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -137,6 +137,7 @@ param_override_build['Vec3s'] = { ############################################################################ +total_functions = 0 header_h = "" def reject_line(line): @@ -258,6 +259,9 @@ def build_function(function, do_extern): function['implemented'] = 'UNIMPLEMENTED' not in s if 'UNIMPLEMENTED' in s: s = "/*\n" + s + "*/\n" + else: + global total_functions + total_functions += 1 return s + "\n" @@ -475,5 +479,8 @@ def main(): print(rejects) doc_files(processed_files) + global total_functions + print('Total functions: ' + str(total_functions)) + if __name__ == '__main__': main() \ No newline at end of file diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index 535d147c..1e46e217 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -64,6 +64,9 @@ sLuaManuallyDefinedStructs = [ 'struct Vec3s { s16 x; s16 y; s16 z; }' ] +total_structs = 0 +total_fields = 0 + ############################################################################ def strip_internal_blocks(body): @@ -286,6 +289,8 @@ def doc_struct_index(structs): for struct in structs: sid = struct['identifier'] s += '- [%s](#%s)\n' % (sid, sid) + global total_structs + total_structs += 1 s += '\n
\n\n' return s @@ -312,6 +317,9 @@ def doc_struct(struct): s += '| %s | %s | %s |\n' % (fid, ftype, restrictions) + global total_fields + total_fields += 1 + s += '\n[:arrow_up_small:](#)\n\n
\n' return s @@ -355,6 +363,12 @@ def build_files(): doc_structs(parsed) + global total_structs + global total_fields + + print("Total structs: " + str(total_structs)) + print("Total fields: " + str(total_fields)) + ############################################################################ if __name__ == '__main__':