How to use the pygccxml.declarations 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 / type_traits_tester.py View on Github external
};

            typedef C<b> easy;
            typedef D Deasy;

            inline void instantiate(){
                int val = sizeof(easy);
            }

            }
        """

        global_ns = parser.parse_string(
            code,
            autoconfig.cxx_parsers_cfg.gccxml)
        global_ns = declarations.get_global_namespace(global_ns)
        easy = global_ns.typedef('easy')
        declarations.class_traits.get_declaration(easy)
        deasy = global_ns.typedef('Deasy')
        d_a = declarations.class_traits.get_declaration(deasy)
        self.assertTrue(isinstance(d_a, declarations.class_types))
</b>
github NetBSD / xsrc / external / mit / MesaLib / dist / src / gallium / drivers / svga / svgadump / svga_dump.py View on Github external
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()
github cpc / tce / tce / Python-bindings / tools / pygccxml / pygccxml / parser / project_reader.py View on Github external
if not cpptype:
                return []
            elif isinstance( cpptype, pygccxml.declarations.fundamental_t ):
                return []
            elif isinstance( cpptype, pygccxml.declarations.declarated_t ):
                return [ cpptype ]
            elif isinstance( cpptype, pygccxml.declarations.compound_t ):
                return get_from_type( cpptype.base )
            elif isinstance( cpptype, pygccxml.declarations.calldef_type_t ):
                types = get_from_type( cpptype.return_type )
                for arg in cpptype.arguments_types:
                    types.extend( get_from_type( arg ) )
                return types
            else:
                assert isinstance( cpptype, ( pygccxml.declarations.unknown_t
                                              , pygccxml.declarations.ellipsis_t ) )
                return []
        types = []
github cpc / tce / tce / Python-bindings / tools / pygccxml / pygccxml / parser / project_reader.py View on Github external
def get_from_type(cpptype):
            if not cpptype:
                return []
            elif isinstance( cpptype, pygccxml.declarations.fundamental_t ):
                return []
            elif isinstance( cpptype, pygccxml.declarations.declarated_t ):
                return [ cpptype ]
            elif isinstance( cpptype, pygccxml.declarations.compound_t ):
                return get_from_type( cpptype.base )
            elif isinstance( cpptype, pygccxml.declarations.calldef_type_t ):
                types = get_from_type( cpptype.return_type )
                for arg in cpptype.arguments_types:
                    types.extend( get_from_type( arg ) )
                return types
            else:
                assert isinstance( cpptype, ( pygccxml.declarations.unknown_t
                                              , pygccxml.declarations.ellipsis_t ) )
                return []
        types = []
github cpc / tce / tce / Python-bindings / tools / pygccxml / pyplusplus / decl_wrappers / calldef_wrapper.py View on Github external
def __init__(self, *arguments, **keywords):
        declarations.casting_operator_t.__init__( self, *arguments, **keywords )
        calldef_t.__init__( self )
github cpc / tce / tce / Python-bindings / tools / pygccxml / pyplusplus / module_creator / dependencies_manager.py View on Github external
decls = filter( lambda decl: isinstance( decl, declarations.class_types ) \
                                     and isinstance( decl.parent, declarations.namespace_t )
                        , self.__exported_decls )
github cpc / tce / tce / Python-bindings / tools / pygccxml / pyplusplus / module_creator / dependencies_manager.py View on Github external
        decls = filter( lambda decl: isinstance( decl, declarations.class_types ) \
                                     and isinstance( decl.parent, declarations.namespace_t )
                        , self.__exported_decls )
github s3ql / s3ql / build_pygccxml.py View on Github external
def visit_pointer( self ):
            no_ptr = declarations.remove_const( declarations.remove_pointer( self.user_type ) )
            #if declarations.is_same( declarations.char_t(), no_ptr ):
            #    return "ctypes.c_char_p"
            if declarations.is_same( declarations.wchar_t(), no_ptr ):
                return "ctypes.c_wchar_p"
            elif declarations.is_same( declarations.void_t(), no_ptr ):
                return "ctypes.c_void_p"
            else:
                base_visitor = my_type_converter_t( self.user_type.base, self.decl_formatter )
                internal_type_str = declarations.apply_visitor( base_visitor, base_visitor.user_type )
                return "ctypes.POINTER( %s )" % internal_type_str   
        def visit_reference( self ):
github cpc / tce / tce / Python-bindings / tools / pygccxml / pyplusplus / code_creators / member_variable.py View on Github external
def _get_exported_var_type( self ):
        type_ = declarations.remove_reference( self.declaration.type )
        type_ = declarations.remove_const( type_ )
        if python_traits.is_immutable( type_ ):
            return type_
        else:
            return self.declaration.type