From ff0745456b8b6aebe1a506e59d8bd01ffde29384 Mon Sep 17 00:00:00 2001 From: "Magomed Kostoev (mkostoevr)" Date: Sun, 13 Jun 2021 22:23:55 +0000 Subject: [PATCH] [kernel][asmxygen.py] Implement very basic macro and struct documentation generation git-svn-id: svn://kolibrios.org@8846 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/asmxygen.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/kernel/trunk/asmxygen.py b/kernel/trunk/asmxygen.py index dffc7467d6..8710b3a5b9 100644 --- a/kernel/trunk/asmxygen.py +++ b/kernel/trunk/asmxygen.py @@ -240,6 +240,26 @@ def write_label(source, line, name, brief = "Undocumented"): f"void {name}();\n\n") write_something(source, something) +def write_macro(source, line, name, brief = "Undocumented"): + name = name.replace(".", "_") + something = (f"/**\n" + + f" * @def {name}\n" + + f" * @brief {brief}\n" + + f" * @par Source\n" + + f" * {source}:{line}\n" + + f" */\n#define {name}\n\n") + write_something(source, something) + +def write_structure(source, line, name, brief = "Undocumented"): + name = name.replace(".", "_") + something = (f"/**\n" + + f" * @struct {name}\n" + + f" * @brief {brief}\n" + + f" * @par Source\n" + + f" * {source}:{line}\n" + + f" */\nstruct {name}" + " {};\n\n") + write_something(source, something) + i = 1 for source in kernel_structure: # Print progress: current/total @@ -254,4 +274,10 @@ for source in kernel_structure: if len(kernel_structure[source][LABELS]) > 0: for label in kernel_structure[source][LABELS]: write_label(source, label[0], label[1]) + if len(kernel_structure[source][MACROS]) > 0: + for macro in kernel_structure[source][MACROS]: + write_macro(source, macro[0], macro[1]) + if len(kernel_structure[source][STRUCTURES]) > 0: + for structure in kernel_structure[source][STRUCTURES]: + write_structure(source, structure[0], structure[1]) i += 1