def main(c_filename):
    registry = ApiRegistry()
    for xmlfile in sorted(glob.glob('*.xml')):
        api = Api(registry, xmlfile)

    with open(c_filename, 'w') as c_out:
        write_header(c_out)

        c_out.write('#include "gcc-common.h"\n')
        c_out.write('#include "gcc-tree.h"\n')
        c_out.write('#include "ggc.h"\n')
        c_out.write('#include "gcc-internal.h"\n')
        c_out.write('#include <assert.h>\n')
        c_out.write('#include "tree.h"\n')

        # Ensure that we use the headers, so that the generated
        # casts pick up on the 'extern "C"' and don't get name-mangled:
        for api in registry.apis:
            c_out.write('#include "%s"\n' % api.get_header_filename())

        for type_ in registry.iter_types():
            for subclass in type_.get_subclasses(recursive=True):
                c_out.write('IMPLEMENT_CAST(%s, %s)\n'
                            % (type_.get_c_name(),
                               subclass.get_c_name()))
                c_out.write('IMPLEMENT_CAST(%s, %s)\n'
                            % (subclass.get_c_name(),
                               type_.get_c_name()))

        write_footer(c_out)
def main(c_filename, xmldir):
    registry = ApiRegistry()
    for xmlfile in sorted(glob.glob(xmldir + '*.xml')):
        api = Api(registry, xmlfile)

    with open(c_filename, 'w') as c_out:
        write_header(c_out)

        c_out.write('#include "gcc-common.h"\n')
        c_out.write('#include "gcc-tree.h"\n')
        c_out.write('#include "ggc.h"\n')
        c_out.write('#include "gcc-internal.h"\n')
        c_out.write('#include <assert.h>\n')
        c_out.write('#include "tree.h"\n')

        # Ensure that we use the headers, so that the generated
        # casts pick up on the 'extern "C"' and don't get name-mangled:
        for api in registry.apis:
            c_out.write('#include "%s"\n' % api.get_header_filename())

        for type_ in registry.iter_types():
            for subclass in type_.get_subclasses(recursive=True):
                c_out.write('IMPLEMENT_CAST(%s, %s)\n' %
                            (type_.get_c_name(), subclass.get_c_name()))
                c_out.write('IMPLEMENT_CAST(%s, %s)\n' %
                            (subclass.get_c_name(), type_.get_c_name()))

        write_footer(c_out)
Example #3
0
def main(c_filename, h_filename, xmldir):
    registry = ApiRegistry()
    for xmlfile in sorted(glob.glob(xmldir + '*.xml')):
        api = Api(registry, xmlfile)

    with open(c_filename, 'w') as c_out:
        write_c(registry, c_out)

    with open(h_filename, 'w') as h_out:
        write_h(registry, h_out)
Example #4
0
    out.write('*/\n')

    for api in registry.apis:
        out.write('/* Semiprivate types: %s */\n' % api.get_doc().as_text())
        for type_ in api.iter_types():
            out.write('struct %s {\n' % type_.get_c_name())
            out.write('  %s inner;\n' % type_.get_inner_type())
            out.write('};\n')
            out.write('\n')
            out.write('GCC_PRIVATE_API(struct %s)\n' % type_.get_c_name())
            out.write('gcc_private_make_%s(%s inner);\n' %
                      (type_.get_xml_name(), type_.get_inner_type()))
            out.write('\n')

    writer.write_end_extern_c()
    out.write('#endif /* INCLUDED__GCC_SEMIPRIVATE_TYPES_H */\n')
    write_footer(out)


registry = ApiRegistry()
for xmlfile in sorted(glob.glob('*.xml')):
    api = Api(registry, xmlfile)
for api in registry.apis:
    with open(api.get_header_filename(), 'w') as f:
        # write(api, sys.stdout)
        write_api(api, f)
    with open('gcc-public-types.h', 'w') as f:
        write_public_types(registry, f)
    with open('gcc-semiprivate-types.h', 'w') as f:
        write_semiprivate_types(registry, f)
Example #5
0
    out.write('*/\n')

    for api in registry.apis:
        out.write('/* Semiprivate types: %s */\n' % api.get_doc().as_text())
        for type_ in api.iter_types():
            out.write('struct %s {\n' % type_.get_c_name())
            out.write('  %s inner;\n' % type_.get_inner_type())
            out.write('};\n')
            out.write('\n')
            out.write('GCC_PRIVATE_API(struct %s)\n' % type_.get_c_name())
            out.write('gcc_private_make_%s(%s inner);\n'
                      % (type_.get_xml_name(),
                         type_.get_inner_type()))
            out.write('\n')

    writer.write_end_extern_c()
    out.write('#endif /* INCLUDED__GCC_SEMIPRIVATE_TYPES_H */\n')
    write_footer(out)

registry = ApiRegistry()
for xmlfile in sorted(glob.glob('*.xml')):
    api = Api(registry, xmlfile)
for api in registry.apis:
    with open(api.get_header_filename(), 'w') as f:
        # write(api, sys.stdout)
        write_api(api, f)
    with open('gcc-public-types.h', 'w') as f:
        write_public_types(registry, f)
    with open('gcc-semiprivate-types.h', 'w') as f:
        write_semiprivate_types(registry, f)