diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2024-04-15 10:53:58 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-15 10:53:58 -0600 |
| commit | d9c1ebb6263cc3a2d494c9ece53edb3c8a2a4b39 (patch) | |
| tree | cffb2a939f6df969461949340fbedc6260241831 /tools | |
| parent | 3dd4c071e1ecdf15a30aa37187283f0b974dc825 (diff) | |
Initial gcc Support (#568)
* Added GCC
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/mkgccgen.py | 65 | ||||
| m--------- | tools/torch | 0 |
2 files changed, 65 insertions, 0 deletions
diff --git a/tools/mkgccgen.py b/tools/mkgccgen.py new file mode 100644 index 000000000..b93f25918 --- /dev/null +++ b/tools/mkgccgen.py @@ -0,0 +1,65 @@ +#!/usr/bin/python3 + +# Complete file list producer v0.7 +# Written by ProjectRevoTPP + +import os +from glob import glob +import sys + +def holecount(file): + with open(file, 'r', encoding = 'utf-8') as infile: + contents = infile.readlines() + asm_count = 0 + for i, line in enumerate(contents): + if(line.count("GLOBAL_ASM") > 0 and (i + 1 == len(contents) or contents[i+1].count("#endif") == 0)): + asm_count += 1 + return asm_count + +def noncount(file): + with open(file, 'r', encoding = 'utf-8') as infile: + contents = infile.readlines() + noncount = 0 + for i, line in enumerate(contents): + if(line.count("NON_") > 0): + noncount += 1 + return noncount + +def holecount_all(src): + for subdir, dirs, files in os.walk(src): + for filename in files: + filepath = subdir + os.sep + filename + if(not filename.endswith('.c')): + continue + holes = holecount(filepath) + nonmatches = noncount(filepath) + if(holes > 0 and nonmatches > 0): + print(filename, holes, nonmatches) + return 1 + +# get file encoding type +def get_encoding_type(file): + with open(file, 'rb') as f: + rawdata = f.read() + return detect(rawdata)['encoding'] + +outfile = open(sys.argv[1], "w") +outfile.write("# This file is auto-generated. DO NOT MODIFY!\n\n") +outfile.write("SAFE_C_FILES := \\\n") +for directory in os.walk("src"): + for filename in glob(os.path.join(directory[0], "*.c")): + infile = open(filename, "r", encoding="ascii", errors="surrogateescape") + # Open content. + contents = infile.read() + # Set the counts. + nonm_count = contents.count("NON_MATCHING") + noneq_count = contents.count("NON_EQUIVALENT") + global_asm_count = contents.count("GLOBAL_ASM") + # NOTE: As of now there is no distinction between unattempted files and unfinished ones. + if nonm_count + noneq_count == global_asm_count : + outfile.write(" build/us/") + outfile.write(os.path.splitext(filename)[0]) + outfile.write(".o \\\n") + infile.close() +outfile.close() + diff --git a/tools/torch b/tools/torch -Subproject 74b0c120290083a5e3571a43deada72781af072 +Subproject c82b4a8423eb41202dc61378aa50f0052140c13 |
