How to use the pygccxml.parser.parse function in pygccxml

To help you get started, we’ve selected a few pygccxml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gccxml / pygccxml / unittests / file_cache_tester.py View on Github external
def test_from_file(self):
        declarations = parser.parse([self.header], self.config)
        cache = parser.file_cache_t(self.cache_file)
        cache.update(
            source_file=self.header,
            configuration=self.config,
            declarations=declarations,
            included_files=[])
        self.assertTrue(
            declarations == cache.cached_value(
                self.header,
                self.config),
            "cached declarations and source declarations are different")
        cache.flush()
        cache = parser.file_cache_t(self.cache_file)
        self.assertTrue(
            declarations == cache.cached_value(
                self.header,
github gccxml / pygccxml / unittests / calldef_matcher_tester.py View on Github external
def setUp(self):
        if not self.declarations:
            self.declarations = parser.parse([self.header], self.config)
github gccxml / pygccxml / unittests / start_with_declarations_tester.py View on Github external
def test_simple(self):
        decls = parser.parse([self.header], self.config)
        self.__check_result(decls)
github gccxml / pygccxml / unittests / unnamed_enums_bug_tester.py View on Github external
def setUp(self):
        if not self.global_ns:
            decls = parser.parse([self.header], self.config)
            self.global_ns = declarations.get_global_namespace(decls)
            self.global_ns.init_optimizer()
github gccxml / pygccxml / unittests / test_non_copyable_recursive.py View on Github external
def test_infinite_recursion_sstream(self):
        """
        Test find_noncopyable_vars

        See #71

        find_noncopyable_vars was throwing:
        RuntimeError: maximum recursion depth exceeded while
        calling a Python object
        """
        decls = parser.parse([self.header], self.config)
        global_ns = declarations.get_global_namespace(decls)

        # Real life example of the bug. This leads to a similar error,
        # but the situation is more complex as there are multiple
        # classes that are related the one to the others
        # (basic_istream, basic_ios, ios_base, ...)
        test_ns = global_ns.namespace('Test2')
        cls = test_ns.class_('FileStreamDataStream')
        declarations.type_traits_classes.find_noncopyable_vars(cls)
        self.assertFalse(declarations.type_traits_classes.is_noncopyable(cls))
github gccxml / pygccxml / unittests / undname_creator_tester.py View on Github external
def setUp(self):
        if not tester_t.global_ns:
            decls = parser.parse([self.header], self.config)
            tester_t.global_ns = declarations.get_global_namespace(decls)
            tester_t.global_ns.init_optimizer()

            process = subprocess.Popen(
                args='scons msvc_compiler=%s' %
                autoconfig.cxx_parsers_cfg.gccxml.compiler,
                shell=True,
                stdin=subprocess.PIPE,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                cwd=self.binary_parsers_dir)
            process.stdin.close()

            while process.poll() is None:
                line = process.stdout.readline()
                print(line.rstrip())
github gccxml / pygccxml / unittests / complex_types_tester.py View on Github external
def setUp(self):
        if not self.declarations:
            self.declarations = parser.parse([self.header], self.config)
github gccxml / pygccxml / unittests / unnamed_classes_tester.py View on Github external
def setUp(self):
        if not self.global_ns:
            decls = parser.parse([self.header], self.config)
            self.global_ns = declarations.get_global_namespace(decls)
            self.global_ns.init_optimizer()
github philikon / osxtypes / generate.py View on Github external
def main():
    config = pygccxml.parser.config_t(gccxml_path=gccxml_path,
                                      cflags=cflags,
                                      compiler="/usr/bin/gcc-4.0")
    decls = pygccxml.parser.parse(filenames, config)
    global_ns = pygccxml.declarations.get_global_namespace(decls)

    gen = OSXTypesGen()
    by_framework = groupByFramework(global_ns.declarations)
    [gen.addToLookup(decl) for decl in global_ns.declarations]
    for framework, declarations in by_framework.iteritems():
        if framework == "stdlib":
            continue
        gen.writeFramework(framework, declarations)
github mesa3d / mesa / src / gallium / drivers / svga / svgadump / svga_dump.py View on Github external
print
    print '#include "util/u_debug.h"'
    print '#include "svga_dump.h"'
    print

    config = parser.config_t(
        include_paths = ['../../../include', '../include'],
        compiler = 'gcc',
    )

    headers = [
        'svga_types.h', 
        'svga3d_reg.h', 
    ]

    decls = parser.parse(headers, config, parser.COMPILATION_MODE.ALL_AT_ONCE)
    global_ns = declarations.get_global_namespace(decls)

    names = set()
    for id, header, body, footer in cmds:
        names.add(header)
        for struct, count in body:
            names.add(struct)
        if footer is not None:
            names.add(footer)

    for class_ in global_ns.classes(lambda decl: decl.name in names):
        dump_struct(decls, class_)

    dump_cmds()