Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
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>
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()
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 = []
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 = []
def __init__(self, *arguments, **keywords):
declarations.casting_operator_t.__init__( self, *arguments, **keywords )
calldef_t.__init__( self )
decls = filter( lambda decl: isinstance( decl, declarations.class_types ) \
and isinstance( decl.parent, declarations.namespace_t )
, self.__exported_decls )
decls = filter( lambda decl: isinstance( decl, declarations.class_types ) \
and isinstance( decl.parent, declarations.namespace_t )
, self.__exported_decls )
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 ):
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