def main(output, *filenames): # Load the scalars first. if len(filenames) > 1: raise Exception('We don\'t support loading from more than one file.') try: scalars = parse_scalars.load_scalars(filenames[0]) except ParserError as ex: print("\nError processing scalars:\n" + str(ex) + "\n") sys.exit(1) # Write the enum file. print(banner, file=output) print(file_header, file=output) for s in scalars: cpp_guard = s.cpp_guard if cpp_guard: print("#if defined(%s)" % cpp_guard, file=output) print(" %s," % s.enum_label, file=output) if cpp_guard: print("#endif", file=output) print(" ScalarCount,", file=output) print(file_footer, file=output)
def parse_scalar_definitions(filenames): if len(filenames) > 1: raise Exception('We don\'t support loading from more than one file.') try: return parse_scalars.load_scalars(filenames[0]) except ParserError as ex: print("\nError processing scalars:\n" + str(ex) + "\n") sys.exit(1)
def parse_scalar_definitions(filenames): scalars = [] for filename in filenames: try: batch = parse_scalars.load_scalars(filename) scalars.extend(batch) except ParserError as ex: print("\nError processing %s:\n%s\n" % (filename, str(ex)), file=sys.stderr) sys.exit(1) return scalars
def main(output, *filenames): # Load the scalars first. scalars = [] for filename in filenames: try: batch = parse_scalars.load_scalars(filename) scalars.extend(batch) except ParserError as ex: print("\nError processing %s:\n%s\n" % (filename, str(ex)), file=sys.stderr) sys.exit(1) # Write the enum file. print(banner, file=output) print(file_header, file=output) for s in scalars: if s.record_on_os(buildconfig.substs["OS_TARGET"]): print(" %s," % s.enum_label, file=output) print(" ScalarCount,", file=output) print(file_footer, file=output)
def main(output, *filenames): # Load the scalars first. if len(filenames) > 1: raise Exception('We don\'t support loading from more than one file.') try: scalars = parse_scalars.load_scalars(filenames[0]) except ParserError as ex: print("\nError processing scalars:\n" + str(ex) + "\n") sys.exit(1) # Write the enum file. print(banner, file=output) print(file_header, file=output) for s in scalars: if s.record_on_os(buildconfig.substs["OS_TARGET"]): print(" %s," % s.enum_label, file=output) print(" ScalarCount,", file=output) print(file_footer, file=output)