Ejemplo n.º 1
0
def main():

    # auto_script parameters.
    if len(sys.argv) > 1:
        inputs = [
            '../../angle_format.py', 'texture_format_data.json',
            'texture_format_map.json'
        ]
        outputs = ['texture_format_table_autogen.cpp']

        if sys.argv[1] == 'inputs':
            print ','.join(inputs)
        elif sys.argv[1] == 'outputs':
            print ','.join(outputs)
        else:
            print('Invalid script parameters')
            return 1
        return 0

    json_map = angle_format.load_with_override(
        os.path.abspath('texture_format_map.json'))
    data_source_name = 'texture_format_data.json'
    json_data = angle_format.load_json(data_source_name)

    angle_format_cases = parse_json_into_switch_angle_format_string(
        json_map, json_data)
    output_cpp = template_texture_format_table_autogen_cpp.format(
        script_name=sys.argv[0],
        angle_format_info_cases=angle_format_cases,
        data_source_name=data_source_name)
    with open('texture_format_table_autogen.cpp', 'wt') as out_file:
        out_file.write(output_cpp)
        out_file.close()
    return 0
Ejemplo n.º 2
0
def main():

    # auto_script parameters.
    if len(sys.argv) > 1:
        inputs = ['../../angle_format.py', 'texture_format_data.json', 'texture_format_map.json']
        outputs = ['texture_format_table_autogen.cpp']

        if sys.argv[1] == 'inputs':
            print ','.join(inputs)
        elif sys.argv[1] == 'outputs':
            print ','.join(outputs)
        else:
            print('Invalid script parameters')
            return 1
        return 0

    json_map = angle_format.load_with_override(os.path.abspath('texture_format_map.json'))
    data_source_name = 'texture_format_data.json'
    json_data = angle_format.load_json(data_source_name)

    angle_format_cases = parse_json_into_switch_angle_format_string(json_map, json_data)
    output_cpp = template_texture_format_table_autogen_cpp.format(
        script_name=sys.argv[0],
        copyright_year=date.today().year,
        angle_format_info_cases=angle_format_cases,
        data_source_name=data_source_name)
    with open('texture_format_table_autogen.cpp', 'wt') as out_file:
        out_file.write(output_cpp)
        out_file.close()
    return 0
Ejemplo n.º 3
0
        if support_test != None:
            table_data += "        {\n"
            table_data += json_to_table_data(internal_format, format_name,
                                             "if (" + support_test + ")",
                                             supported_case)
            table_data += json_to_table_data(internal_format, format_name,
                                             "else", unsupported_case)
            table_data += "        }\n"
        else:
            table_data += json_to_table_data(internal_format, format_name, "",
                                             supported_case)

    return table_data


json_map = angle_format.load_with_override(
    os.path.abspath('texture_format_map.json'))
data_source_name = 'texture_format_data.json'
json_data = angle_format.load_json(data_source_name)

angle_format_cases = parse_json_into_switch_angle_format_string(
    json_map, json_data)
output_cpp = template_texture_format_table_autogen_cpp.format(
    script_name=sys.argv[0],
    copyright_year=date.today().year,
    angle_format_info_cases=angle_format_cases,
    data_source_name=data_source_name)
with open('texture_format_table_autogen.cpp', 'wt') as out_file:
    out_file.write(output_cpp)
    out_file.close()
Ejemplo n.º 4
0
        angle_format = json_data[format_name]

        supported_case, unsupported_case, support_test = parse_json_angle_format_case(
            format_name, angle_format, json_data)

        table_data += '        case ' + internal_format + ':\n'

        if support_test != None:
            table_data += "        {\n"
            table_data += json_to_table_data(internal_format, format_name, "if (" + support_test + ")", supported_case)
            table_data += json_to_table_data(internal_format, format_name, "else", unsupported_case)
            table_data += "        }\n"
        else:
            table_data += json_to_table_data(internal_format, format_name, "", supported_case)

    return table_data

json_map = angle_format.load_with_override(os.path.abspath('texture_format_map.json'))
data_source_name = 'texture_format_data.json'
json_data = angle_format.load_json(data_source_name)

angle_format_cases = parse_json_into_switch_angle_format_string(json_map, json_data)
output_cpp = template_texture_format_table_autogen_cpp.format(
    script_name = sys.argv[0],
    copyright_year = date.today().year,
    angle_format_info_cases = angle_format_cases,
    data_source_name = data_source_name)
with open('texture_format_table_autogen.cpp', 'wt') as out_file:
    out_file.write(output_cpp)
    out_file.close()