Rev 8841 | Rev 8844 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8841 | Rev 8842 | ||
---|---|---|---|
Line 39... | Line 39... | ||
39 | LABELS = 3 |
39 | LABELS = 3 |
40 | STRUCTURES = 4 |
40 | STRUCTURES = 4 |
41 | kernel_structure = {} |
41 | kernel_structure = {} |
Line 42... | Line 42... | ||
42 | 42 | ||
- | 43 | def get_declarations(asm_file_contents, asm_file_name): |
|
43 | def get_declarations(asm_file_contents, asm_file_name): |
44 | asm_file_name = asm_file_name.replace("./", "") |
Line 44... | Line 45... | ||
44 | kernel_structure[asm_file_name] = [ [], [], [], [], [] ] |
45 | kernel_structure[asm_file_name] = [ [], [], [], [], [] ] |
45 | 46 | ||
46 | variable_pattern = re.compile(r'^\s*([\w\.]+)\s+d([bwdq])\s+([^;]*)\s*([;].*)?') |
47 | variable_pattern = re.compile(r'^\s*([\w\.]+)\s+d([bwdq])\s+([^;]*)\s*([;].*)?') |
Line 190... | Line 191... | ||
190 | 191 | ||
Line 191... | Line 192... | ||
191 | print(f"Writing doumented sources to {doxygen_src_path}") |
192 | print(f"Writing doumented sources to {doxygen_src_path}") |
Line 192... | Line 193... | ||
192 | 193 | ||
193 | created_files = [] |
- | |
194 | 194 | created_files = [] |
|
195 | def write_variable(source, line, name, type, init, brief): |
195 | |
196 | source = source.replace("./", "") |
196 | def write_something(source, somehing): |
197 | full_path = doxygen_src_path + '/' + source |
197 | full_path = doxygen_src_path + '/' + source |
198 | # Remove the file on first access if it was created by previous generation |
198 | # Remove the file on first access if it was created by previous generation |
199 | if full_path not in created_files: |
199 | if full_path not in created_files: |
200 | if os.path.isfile(full_path): |
200 | if os.path.isfile(full_path): |
201 | os.remove(full_path) |
201 | os.remove(full_path) |
202 | created_files.append(full_path) |
202 | created_files.append(full_path) |
203 | # Only remove the file on 'clean_generated_stuff' flag (removed above, just return) |
203 | # Only remove the file on 'clean_generated_stuff' flag (removed above, just return) |
204 | if clean_generated_stuff: return |
- | |
205 | # Create directories need for the file |
204 | if clean_generated_stuff: return |
206 | os.makedirs(os.path.dirname(full_path), exist_ok=True) |
205 | # Create directories need for the file |
207 | name = name.replace(".", "_") |
- | |
208 | f = open(full_path, "a") |
- | |
209 | f.write(f"/**\n") |
- | |
210 | f.write(f" * @brief {brief}\n") |
- | |
211 | f.write(f" * @par Initial value\n") |
- | |
212 | f.write(f" * {init}\n") |
- | |
213 | f.write(f" * @par Source\n") |
- | |
214 | f.write(f" * {source}:{line}\n") |
206 | os.makedirs(os.path.dirname(full_path), exist_ok=True) |
Line -... | Line 207... | ||
- | 207 | f = open(full_path, "a") |
|
- | 208 | f.write(somehing) |
|
- | 209 | f.close() |
|
- | 210 | ||
- | 211 | def write_variable(source, line, name, type, init, brief): |
|
- | 212 | name = name.replace(".", "_") |
|
- | 213 | something = (f"/**\n" + |
|
- | 214 | f" * @brief {brief}\n" + |
|
- | 215 | f" * @par Initial value\n" + |
|
- | 216 | f" * {init}\n" + |
|
- | 217 | f" * @par Source\n" + |
|
- | 218 | f" * {source}:{line}\n" + |
|
- | 219 | f" */\n" + |
|
- | 220 | f"{type} {name};\n\n") |
|
- | 221 | write_something(source, something) |
|
- | 222 | ||
- | 223 | def write_procedure(source, line, name, brief = "Undocumented"): |
|
- | 224 | name = name.replace(".", "_") |
|
- | 225 | something = (f"/**\n" + |
|
- | 226 | f" * @brief {brief}\n" + |
|
- | 227 | f" * @par Source\n" + |
|
- | 228 | f" * {source}:{line}\n" + |
|
215 | f.write(f" */\n") |
229 | f" */\n" + |
216 | f.write(f"{type} {name};\n\n") |
230 | f"void {name}();\n\n") |
217 | f.close() |
231 | write_something(source, something) |
218 | 232 | ||
219 | i = 1 |
233 | i = 1 |
220 | for source in kernel_structure: |
234 | for source in kernel_structure: |
221 | # Print progress: current/total |
235 | # Print progress: current/total |
222 | print(f"{i}/{len(kernel_structure)} Writing {source}") |
236 | print(f"{i}/{len(kernel_structure)} Writing {source}") |
- | 237 | # Write variables doxygen of the source file |
|
- | 238 | if len(kernel_structure[source][VARIABLES]) > 0: |
|
- | 239 | for variable in kernel_structure[source][VARIABLES]: |
|
223 | # Write variables doxygen of the source file |
240 | write_variable(source, variable[0], variable[1], variable[2], variable[3], variable[4]) |