Print totals when autogenerating lua documentation

This commit is contained in:
MysterD 2022-02-05 13:33:22 -08:00
parent 0a114094b9
commit 956efe1e86
3 changed files with 27 additions and 0 deletions

View File

@ -31,6 +31,7 @@ pretend_find = [
############################################################################ ############################################################################
seen_constants = [] seen_constants = []
totalConstants = 0
############################################################################ ############################################################################
@ -51,6 +52,8 @@ def saw_constant(identifier):
print("SAW DUPLICATE CONSTANT: " + identifier) print("SAW DUPLICATE CONSTANT: " + identifier)
return True return True
else: else:
global totalConstants
totalConstants += 1
seen_constants.append(identifier) seen_constants.append(identifier)
return False return False
@ -277,4 +280,7 @@ def main():
with open(get_path(out_filename_docs), 'w') as out: with open(get_path(out_filename_docs), 'w') as out:
out.write(doc) out.write(doc)
global totalConstants
print("Total constants: " + str(totalConstants))
main() main()

View File

@ -137,6 +137,7 @@ param_override_build['Vec3s'] = {
############################################################################ ############################################################################
total_functions = 0
header_h = "" header_h = ""
def reject_line(line): def reject_line(line):
@ -258,6 +259,9 @@ def build_function(function, do_extern):
function['implemented'] = 'UNIMPLEMENTED' not in s function['implemented'] = 'UNIMPLEMENTED' not in s
if 'UNIMPLEMENTED' in s: if 'UNIMPLEMENTED' in s:
s = "/*\n" + s + "*/\n" s = "/*\n" + s + "*/\n"
else:
global total_functions
total_functions += 1
return s + "\n" return s + "\n"
@ -475,5 +479,8 @@ def main():
print(rejects) print(rejects)
doc_files(processed_files) doc_files(processed_files)
global total_functions
print('Total functions: ' + str(total_functions))
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -64,6 +64,9 @@ sLuaManuallyDefinedStructs = [
'struct Vec3s { s16 x; s16 y; s16 z; }' 'struct Vec3s { s16 x; s16 y; s16 z; }'
] ]
total_structs = 0
total_fields = 0
############################################################################ ############################################################################
def strip_internal_blocks(body): def strip_internal_blocks(body):
@ -286,6 +289,8 @@ def doc_struct_index(structs):
for struct in structs: for struct in structs:
sid = struct['identifier'] sid = struct['identifier']
s += '- [%s](#%s)\n' % (sid, sid) s += '- [%s](#%s)\n' % (sid, sid)
global total_structs
total_structs += 1
s += '\n<br />\n\n' s += '\n<br />\n\n'
return s return s
@ -312,6 +317,9 @@ def doc_struct(struct):
s += '| %s | %s | %s |\n' % (fid, ftype, restrictions) s += '| %s | %s | %s |\n' % (fid, ftype, restrictions)
global total_fields
total_fields += 1
s += '\n[:arrow_up_small:](#)\n\n<br />\n' s += '\n[:arrow_up_small:](#)\n\n<br />\n'
return s return s
@ -355,6 +363,12 @@ def build_files():
doc_structs(parsed) doc_structs(parsed)
global total_structs
global total_fields
print("Total structs: " + str(total_structs))
print("Total fields: " + str(total_fields))
############################################################################ ############################################################################
if __name__ == '__main__': if __name__ == '__main__':