Пример #1
0
 def render_template(self, *args, **kwargs):
     # Kludge: to avoid circular dependency issues, do not import parsers
     # until needed.
     # TODO: If the render method was dynamically bound, like the compile
     # context, rather than being explicitly redefined in every module, we
     # could avoid this, maybe.
     from langkit.parsers import render
     return render(*args, **kwargs)
Пример #2
0
 def render_template(self, *args, **kwargs):
     # Kludge: to avoid circular dependency issues, do not import parsers
     # until needed.
     # TODO: If the render method was dynamically bound, like the compile
     # context, rather than being explicitly redefined in every module, we
     # could avoid this, maybe.
     from langkit.parsers import render
     return render(*args, **kwargs)
Пример #3
0
    def emit_c_api(self, src_path, include_path):
        """
        Generate header and binding body for the external C API.

        :param str include_path: The include path.
        :param str src_path: The source path.
        """
        def render(template_name):
            return self.render_template(template_name, _self=self)

        with names.lower:
            write_cpp_file(
                path.join(include_path,
                          "{}.h".format(self.c_api_settings.lib_name)),
                render("c_api/header_c"))

        self.write_ada_module(src_path, "c_api/pkg_analysis",
                              ["Analysis", "C"])
Пример #4
0
    def emit_c_api(self, src_path, include_path):
        """
        Generate header and binding body for the external C API.

        :param str include_path: The include path.
        :param str src_path: The source path.
        """
        def render(template_name):
            return self.render_template(template_name, _self=self)

        with names.lower:
            write_cpp_file(
                path.join(include_path,
                          "{}.h".format(self.c_api_settings.lib_name)),
                render("c_api/header_c")
            )

        self.write_ada_module(src_path, "c_api/pkg_analysis",
                              ["Analysis", "C"])
        self.write_ada_module(src_path, "c_api/pkg_ast", ["AST", "C"])
        self.write_ada_module(src_path, "c_api/pkg_ast_types",
                              ["AST", "Types", "C"])