Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8841 → Rev 8840

/kernel/trunk/asmxygen.py
43,7 → 43,7
def get_declarations(asm_file_contents, asm_file_name):
kernel_structure[asm_file_name] = [ [], [], [], [], [] ]
 
variable_pattern = re.compile(r'^\s*([\w\.]+)\s+d([bwdq])\s+([^;]*)\s*([;].*)?')
variable_pattern = re.compile(r'^\s*([\w\.]+)\s+d[bwdq] .*')
macro_pattern = re.compile(r'^\s*macro\s+([\w]+).*')
proc_pattern = re.compile(r'^\s*proc\s+([\w\.]+).*')
label_pattern = re.compile(r'^(?!;)\s*([\w\.]+):.*')
56,19 → 56,9
 
match = variable_pattern.findall(line)
if len(match) > 0:
(var_name, var_type, var_init, var_comm) = match[0]
if var_comm == "":
var_comm = "Undocumented"
else:
var_comm = var_comm[1:].lstrip()
if (len(var_comm) == 0):
var_comm = "!!! EMPTY_COMMENT"
if var_comm[0].islower(): var_comm = "!!! LOWERCASE COMMENT " + var_comm
if var_type == "b": var_type = "byte"
if var_type == "w": var_type = "word"
if var_type == "d": var_type = "dword"
if var_type == "q": var_type = "qword"
kernel_structure[asm_file_name][VARIABLES].append([ line_idx + 1, var_name, var_type, var_init, var_comm ])
var_name = match[0]
#print(f"Variable '{var_name}' at {line_idx + 1}")
kernel_structure[asm_file_name][VARIABLES].append([ line_idx + 1, var_name ])
line_idx += 1
continue
 
118,7 → 108,6
line_idx += 1
 
def handle_file(handled_files, asm_file_name, subdir = "."):
if dump_symbols:
print(f"Handling {asm_file_name}")
handled_files.append(asm_file_name)
try:
181,7 → 170,6
macro_count += len(kernel_structure[source][MACROS])
struct_count += len(kernel_structure[source][STRUCTURES])
 
print(f"File count: {len(kernel_structure)}")
print(f"Variable count: {var_count}")
print(f"Procedures count: {proc_count}")
print(f"Global labels count: {label_count}")
192,7 → 180,8
 
created_files = []
 
def write_variable(source, line, name, type, init, brief):
def write_variable(source, line, name, type = "int", brief = "Undocumented",
init = None):
source = source.replace("./", "")
full_path = doxygen_src_path + '/' + source
# Remove the file on first access if it was created by previous generation
213,7 → 202,11
f.write(f" * @par Source\n")
f.write(f" * <a href='{link_root}/{source}#line-{line}'>{source}:{line}</a>\n")
f.write(f" */\n")
f.write(f"{type} {name};\n\n")
if init == None:
set_init = ""
else:
set_init = f" = {init}"
f.write(f"{type} {name}{set_init};\n\n")
f.close()
 
i = 1
223,5 → 216,5
# Write variables doxygen of the source file
if len(kernel_structure[source][VARIABLES]) > 0:
for variable in kernel_structure[source][VARIABLES]:
write_variable(source, variable[0], variable[1], variable[2], variable[3], variable[4])
write_variable(source, variable[0], variable[1])
i += 1