Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
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
Esempio n. 4
0
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)
Esempio n. 5
0
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)