Rev 8966 | Rev 8973 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8966 | Rev 8967 | ||
---|---|---|---|
Line 1371... | Line 1371... | ||
1371 | # Remove the file on first access if it was created by previous generation |
1371 | # Remove the file on first access if it was created by previous generation |
1372 | if full_path not in created_files: |
1372 | if full_path not in created_files: |
1373 | if os.path.isfile(full_path): |
1373 | if os.path.isfile(full_path): |
1374 | os.remove(full_path) |
1374 | os.remove(full_path) |
1375 | created_files.append(full_path) |
1375 | created_files.append(full_path) |
1376 | # Only remove the file on 'clean_generated_stuff' flag (removed above, just return) |
- | |
1377 | if clean_generated_stuff: |
- | |
1378 | return |
- | |
1379 | # Create directories need for the file |
1376 | # Create directories need for the file |
1380 | os.makedirs(os.path.dirname(full_path), exist_ok=True) |
1377 | os.makedirs(os.path.dirname(full_path), exist_ok=True) |
1381 | f = open(full_path, "a") |
1378 | f = open(full_path, "a") |
1382 | contents = ''.join([i if ord(i) < 128 else '?' for i in contents]) |
1379 | contents = ''.join([i if ord(i) < 128 else '?' for i in contents]) |
1383 | f.write(contents) |
1380 | f.write(contents) |
Line 1894... | Line 1891... | ||
1894 | cwd = os.path.abspath(os.path.dirname(sys.argv[0])) |
1891 | cwd = os.path.abspath(os.path.dirname(sys.argv[0])) |
1895 | asm_file_name = os.path.realpath(asm_file_name) |
1892 | asm_file_name = os.path.realpath(asm_file_name) |
1896 | asm_file_name = asm_file_name[len(cwd) + 1:] |
1893 | asm_file_name = asm_file_name[len(cwd) + 1:] |
1897 | # If it's lang.inc - skip it |
1894 | # If it's lang.inc - skip it |
1898 | if asm_file_name == 'lang.inc': |
1895 | if asm_file_name == 'lang.inc': |
- | 1896 | return |
|
- | 1897 | # If the file was handled in this execution before - skip it |
|
1899 | return handled_files |
1898 | if asm_file_name in handled_files: |
- | 1899 | return |
|
- | 1900 | # Say that the file was handled in this execution |
|
- | 1901 | handled_files.append(asm_file_name) |
|
1900 | # Check if the file should be parsed (if it was modified or wasn't parsed yet) |
1902 | # Check if the file should be parsed (if it was modified or wasn't parsed yet) |
1901 | should_get_declarations = True |
1903 | should_get_declarations = True |
1902 | if not it_neds_to_be_parsed(asm_file_name): |
1904 | if not it_neds_to_be_parsed(asm_file_name): |
1903 | print(f"Skipping {asm_file_name} (already newest)") |
1905 | print(f"Skipping {asm_file_name} (already newest)") |
1904 | should_get_declarations = False |
1906 | should_get_declarations = False |
1905 | else: |
1907 | else: |
1906 | print(f"Parsing {asm_file_name}") |
1908 | print(f"Parsing {asm_file_name}") |
1907 | # Say that the file was handled (maybe not parsed, but we know about the file) |
- | |
1908 | handled_files.append(asm_file_name) |
- | |
1909 | # Read the source |
1909 | # Read the source |
1910 | asm_file_contents = open(asm_file_name, "r", encoding="utf-8").read() |
1910 | asm_file_contents = open(asm_file_name, "r", encoding="utf-8").read() |
1911 | # Find includes, fix their paths and handle em recoursively |
1911 | # Find includes, fix their paths and handle em recoursively |
1912 | includes = re.findall(r'^include (["\'])(.*)\1', asm_file_contents, flags=re.MULTILINE) |
1912 | includes = re.findall(r'^include (["\'])(.*)\1', asm_file_contents, flags=re.MULTILINE) |
1913 | for include in includes: |
1913 | for include in includes: |
1914 | include = include[1].replace('\\', '/'); |
1914 | include = include[1].replace('\\', '/'); |
1915 | full_path = subdir + '/' + include; |
1915 | full_path = subdir + '/' + include; |
1916 | # If the path isn't valid, maybe that's not relative path |
1916 | # If the path isn't valid, maybe that's not relative path |
1917 | if not os.path.isfile(full_path): |
1917 | if not os.path.isfile(full_path): |
1918 | full_path = include |
1918 | full_path = include |
1919 | if full_path not in handled_files: |
- | |
1920 | new_subdir = full_path.rsplit('/', 1)[0] |
1919 | new_subdir = full_path.rsplit('/', 1)[0] |
1921 | handle_file(handled_files, full_path, new_subdir) |
1920 | handle_file(handled_files, full_path, new_subdir) |
1922 | # Only collect declarations from the file if it wasn't parsed before |
1921 | # Only collect declarations from the file if it wasn't parsed before |
1923 | if should_get_declarations: |
1922 | if should_get_declarations: |
1924 | get_declarations(asm_file_contents, asm_file_name) |
1923 | get_declarations(asm_file_contents, asm_file_name) |
1925 | # Finish him |
- | |
1926 | return handled_files |
- | |
Line 1927... | Line 1924... | ||
1927 | 1924 | ||
Line 1928... | Line 1925... | ||
1928 | kernel_files = [] |
1925 | kernel_files = [] |
Line 1934... | Line 1931... | ||
1934 | asm_element.dump() |
1931 | asm_element.dump() |
Line 1935... | Line 1932... | ||
1935 | 1932 | ||
1936 | if print_stats: |
1933 | if print_stats: |
Line -... | Line 1934... | ||
- | 1934 | print("--stats is not nimplmented") |
|
- | 1935 | ||
- | 1936 | if clean_generated_stuff: |
|
- | 1937 | kernel_files_set = set(kernel_files) |
|
- | 1938 | for file in kernel_files: |
|
- | 1939 | doxygen_file = f"{doxygen_src_path}/{file}" |
|
- | 1940 | if (os.path.isfile(doxygen_file)): |
|
- | 1941 | print(f"Removing {file}... ", end = '') |
|
- | 1942 | os.remove(doxygen_file) |
|
1937 | print("--stats is not nimplmented") |
1943 | print("Done.") |
Line 1938... | Line 1944... | ||
1938 | 1944 | else: |
|
1939 | print(f"Writing doumented sources to {doxygen_src_path}") |
1945 | print(f"Writing doumented sources to {doxygen_src_path}") |
1940 | 1946 |