def main(): t1 = time.time() failed = 0 passed = 0 with html_reporter(report_filename) as reporter: for filename in glob.iglob(os.path.join(nos_src_folder, '*.c')): print('==> Compiling', filename) try: do_compile(filename, reporter) except CompilerError as ex: print('Error:', ex.msg, ex.loc) ex.print() print_exc() failed += 1 except Exception as ex: print('General exception:', ex) print_exc() failed += 1 else: print('Great success!') passed += 1 t2 = time.time() elapsed = t2 - t1 print(passed, 'passed,', failed, 'failed in', elapsed, 'seconds')
def main(): environment_variable = "LCC_FOLDER" if environment_variable in os.environ: lcc_folder = os.environ[environment_variable] else: logging.error( "Please define %s to point to the lcc source folder", environment_variable, ) return this_dir = os.path.abspath(os.path.dirname(__file__)) report_filename = os.path.join(this_dir, "report_lcc.html") libc_includes = os.path.join(this_dir, "..", "librt", "libc") include_paths = [libc_includes] arch = "x86_64" t1 = time.time() failed = 0 passed = 0 sources = glob.glob(os.path.join(lcc_folder, "src", "*.c")) objs = [] with open(report_filename, "w") as f, HtmlReportGenerator(f) as reporter: for filename in sources: print(" ======================") print(" ========================") print(" ==> Compiling", filename) try: obj = do_compile(filename, include_paths, arch, reporter) objs.append(obj) except CompilerError as ex: print("Error:", ex.msg, ex.loc) ex.print() # print_exc() failed += 1 except Exception as ex: print("General exception:", ex) # ex.print() print_exc() failed += 1 else: print("Great success!") passed += 1 t2 = time.time() elapsed = t2 - t1 print("Passed:", passed, "failed:", failed, "in", elapsed, "seconds") obj = link(objs) print(obj)
def main(): t1 = time.time() failed = 0 passed = 0 sources = [ 'cpp.c', 'debug.c', 'dict.c', 'gen.c', 'lex.c', 'vector.c', 'parse.c', 'buffer.c', 'map.c', 'error.c', 'path.c', 'file.c', 'set.c', 'encoding.c', ] objs = [] with html_reporter(report_filename) as reporter: for filename in sources: filename = os.path.join(_8cc_folder, filename) print('==> Compiling', filename) try: obj = do_compile(filename, reporter) except CompilerError as ex: print('Error:', ex.msg, ex.loc) ex.print() print_exc() failed += 1 except Exception as ex: print('General exception:', ex) print_exc() failed += 1 else: objs.append(obj) print('Great success!') passed += 1 t2 = time.time() elapsed = t2 - t1 print(passed, 'passed,', failed, 'failed in', elapsed, 'seconds') obj = api.link(objs) with open('8cc.exe', 'wb') as f: write_elf(obj, f, type='executable')
def main(): t1 = time.time() failed = 0 passed = 0 sources = [ 'cpp.c', 'debug.c', 'dict.c', 'gen.c', 'lex.c', 'vector.c', 'parse.c', 'buffer.c', 'map.c', 'error.c', 'path.c', 'file.c', 'set.c', 'encoding.c', ] with open(report_filename, 'w') as f, HtmlReportGenerator(f) as reporter: for filename in sources: filename = os.path.join(_8cc_folder, filename) print('==> Compiling', filename) try: do_compile(filename, reporter) except CompilerError as ex: print('Error:', ex.msg, ex.loc) ex.print() print_exc() failed += 1 except Exception as ex: print('General exception:', ex) print_exc() failed += 1 else: print('Great success!') passed += 1 t2 = time.time() elapsed = t2 - t1 print(passed, 'passed,', failed, 'failed in', elapsed, 'seconds')
def main(): t1 = time.time() failed = 0 passed = 0 include_paths = [ # os.path.join(newlib_folder, 'libc', 'include'), # TODO: not sure about the include path below for stddef.h: # '/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/include' libc_includes, micropython_folder, port_folder, ] coptions = COptions() coptions.add_include_paths(include_paths) coptions.enable('freestanding') coptions.add_define('NO_QSTR', '1') file_pattern = os.path.join(micropython_folder, 'py', '*.c') objs = [] for filename in glob.iglob(file_pattern): print('==> Compiling', filename) try: obj = do_compile(filename, coptions) except CompilerError as ex: print('Error:', ex.msg, ex.loc) ex.print() print_exc() failed += 1 # break except Exception as ex: print('General exception:', ex) print_exc() failed += 1 # break else: print('Great success!', obj) passed += 1 objs.append(obj) t2 = time.time() elapsed = t2 - t1 print('Passed:', passed, 'failed:', failed, 'in', elapsed, 'seconds')
def main(): t1 = time.time() failed = 0 passed = 0 sources = glob.iglob(os.path.join(links_folder, '*.c')) objs = [] coptions = COptions() include_paths = [ libc_includes, links_folder, '/usr/include', ] coptions.add_include_paths(include_paths) with open(report_filename, 'w') as f, HtmlReportGenerator(f) as reporter: for filename in sources: filename = os.path.join(links_folder, filename) print(' ======================') print(' ========================') print(' ==> Compiling', filename) try: obj = do_compile(filename, coptions, reporter) objs.append(obj) except CompilerError as ex: print('Error:', ex.msg, ex.loc) ex.print() print_exc() failed += 1 except Exception as ex: print('General exception:', ex) print_exc() failed += 1 else: print('Great success!') passed += 1 t2 = time.time() elapsed = t2 - t1 print('Passed:', passed, 'failed:', failed, 'in', elapsed, 'seconds') obj = link(objs) print(obj)
def main(): environment_variable = "LIBMAD_FOLDER" if environment_variable in os.environ: libmad_folder = os.environ[environment_variable] else: logging.error( "Please define %s to point to the libmad source folder", environment_variable, ) return this_dir = os.path.abspath(os.path.dirname(__file__)) report_filename = os.path.join(this_dir, "report_libmad.html") libc_includes = os.path.join(this_dir, "..", "librt", "libc") include_paths = [libc_includes, libmad_folder] arch = "x86_64" t1 = time.time() failed = 0 passed = 0 sources = [ "layer3.c", "version.c", "fixed.c", "bit.c", "timer.c", "stream.c", "frame.c", "synth.c", "decoder.c", "layer12.c", "huffman.c", ] objs = [] with open(report_filename, "w") as f, HtmlReportGenerator(f) as reporter: for filename in sources: filename = os.path.join(libmad_folder, filename) print(" ======================") print(" ========================") print(" ==> Compiling", filename) try: obj = do_compile(filename, include_paths, arch, reporter) objs.append(obj) except CompilerError as ex: print("Error:", ex.msg, ex.loc) ex.print() print_exc() failed += 1 # except Exception as ex: # print("General exception:", ex) # print_exc() # failed += 1 else: print("Great success!") passed += 1 t2 = time.time() elapsed = t2 - t1 print("Passed:", passed, "failed:", failed, "in", elapsed, "seconds") obj = link(objs) print(obj)