def parse_big_file(): path = os.path.join(autoconfig.data_directory, 'big.xml') reader = parser.project_reader_t( parser.xml_generator_configuration_t( xml_generator_path=autoconfig.xml_generator_path)) reader.read_files([parser.create_gccxml_fc(path)]) reader.read_files([parser.create_gccxml_fc(path)]) reader.read_files([parser.create_gccxml_fc(path)])
def test(self): module_builder.set_logger_level( logging.CRITICAL ) messages.disable( *messages.all_warning_msgs ) xml_file = parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'particleuniverse.xml' ) ) mb = module_builder.module_builder_t( [ xml_file ] , gccxml_path=autoconfig.gccxml.executable , indexing_suite_version=2 , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler()) mb.global_ns.exclude() mb.namespace('ParticleUniverse').include() mb.namespace('Ogre').include() mb.namespace('Ogre').classes().already_exposed = True target_dir = os.path.join( autoconfig.build_directory, 'particle_universe' ) #~ if os.path.exists( target_dir ): #~ shutil.rmtree( target_dir ) #~ os.mkdir( target_dir ) psp = mb.class_( '::ParticleUniverse::ParticleScriptParser' ) declarations.print_declarations( psp ) mb.build_code_creator( 'PU' ) mb.split_module( target_dir )
def test(self): module_builder.set_logger_level( logging.CRITICAL ) messages.disable( *messages.all_warning_msgs ) ogre_file = autoconfig.data_directory.replace( 'pyplusplus_dev', 'pygccxml_dev' ) ogre_file = parser.create_gccxml_fc( os.path.join( ogre_file, 'ogre.1.7.xml' ) ) mb = module_builder.module_builder_t( [ ogre_file ] , gccxml_path=autoconfig.gccxml.executable , indexing_suite_version=2 , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler()) mb.global_ns.exclude() mb.namespace('Ogre').include() x = mb.global_ns.decls( lambda d: 'Animation*' in d.name and 'MapIterator' in d.name ) for y in x: print y.name print y.partial_name print declarations.full_name( y, with_defaults=False ) target_dir = os.path.join( autoconfig.build_directory, 'ogre' ) #~ if os.path.exists( target_dir ): #~ shutil.rmtree( target_dir ) #~ os.mkdir( target_dir ) mb.build_code_creator( 'Ogre3d' ) mb.split_module( target_dir )
def test(self): module_builder.set_logger_level( logging.CRITICAL ) messages.disable( *messages.all_warning_msgs ) ogre_file = autoconfig.data_directory.replace( 'pyplusplus_dev', 'pygccxml_dev' ) ogre_file = parser.create_gccxml_fc( os.path.join( ogre_file, 'ogre.1.7.xml' ) ) mb = module_builder.module_builder_t( [ ogre_file ] , xml_generator_config=autoconfig.xml_generator_config , indexing_suite_version=2) mb.global_ns.exclude() mb.namespace('Ogre').include() x = mb.global_ns.decls( lambda d: 'Animation*' in d.name and 'MapIterator' in d.name ) for y in x: print(y.name) print(y.partial_name) print(declarations.full_name( y, with_defaults=False )) target_dir = os.path.join( autoconfig.build_directory, 'ogre' ) #~ if os.path.exists( target_dir ): #~ shutil.rmtree( target_dir ) #~ os.mkdir( target_dir ) mb.build_code_creator( 'Ogre3d' ) mb.split_module( target_dir )
def test_on_big_file(file_name, count): file_name = os.path.join(autoconfig.data_directory, file_name) for i in range(count): reader = parser.project_reader_t( parser.xml_generator_configuration_t( xml_generator_path=autoconfig.generator_path)) decls = reader.read_files([parser.create_gccxml_fc(file_name)]) global_ns = declarations.get_global_namespace(decls) global_ns.init_optimizer()
def create_module_builder(self): date_time_xml_file = self._create_xml_file() mb = module_builder.module_builder_t( [parser.create_gccxml_fc(date_time_xml_file)], gccxml_path=date_time_settings.gccxml.executable, include_paths=[date_time_settings.boost.include], define_symbols=date_time_settings.defined_symbols, undefine_symbols=date_time_settings.undefined_symbols, optimize_queries=False, indexing_suite_version=2) if sys.platform == 'win32': linux_name = "time_duration<boost::posix_time::time_duration, boost::date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, (boost::date_time::time_resolutions)5, (long long)1000000, 6, int> >" win_name = "time_duration<boost::posix_time::time_duration, boost::date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, (boost::date_time::time_resolutions)5, (long long)1000000, 6, long> >" time_duration_impl = mb.class_(linux_name) #small price for generating code from xml and not from sources time_duration_impl.name = win_name time_duration_impl.demangled = None for f_decl in mb.free_functions(): f_decl.alias = f_decl.name f_decl.name = f_decl.demangled_name #f_decl.create_with_signature = True local_date_time = mb.class_( lambda decl: decl.name.startswith('local_date_time_base<')) for c in local_date_time.constructors(): if not c.is_copy_constructor: local_date_time.remove_declaration(c) mb.run_query_optimizer() for name, alias in customization_data.name2alias.items(): decl = mb.class_(name) decl.alias = alias if isinstance(decl, declarations.class_t): decl.wrapper_alias = alias + '_wrapper' return mb
def create_module_builder(self): date_time_xml_file = self._create_xml_file() mb = module_builder.module_builder_t( [parser.create_gccxml_fc(date_time_xml_file)], gccxml_path=date_time_settings.gccxml.executable, include_paths=[date_time_settings.boost.include], define_symbols=date_time_settings.defined_symbols, undefine_symbols=date_time_settings.undefined_symbols, optimize_queries=False, indexing_suite_version=2, ) if sys.platform == "win32": linux_name = "time_duration<boost::posix_time::time_duration, boost::date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, (boost::date_time::time_resolutions)5, (long long)1000000, 6, int> >" win_name = "time_duration<boost::posix_time::time_duration, boost::date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, (boost::date_time::time_resolutions)5, (long long)1000000, 6, long> >" time_duration_impl = mb.class_(linux_name) # small price for generating code from xml and not from sources time_duration_impl.name = win_name time_duration_impl.demangled = None for f_decl in mb.free_functions(): f_decl.alias = f_decl.name f_decl.name = f_decl.demangled_name # f_decl.create_with_signature = True local_date_time = mb.class_(lambda decl: decl.name.startswith("local_date_time_base<")) for c in local_date_time.constructors(): if not c.is_copy_constructor: local_date_time.remove_declaration(c) mb.run_query_optimizer() for name, alias in customization_data.name2alias.items(): decl = mb.class_(name) decl.alias = alias if isinstance(decl, declarations.class_t): decl.wrapper_alias = alias + "_wrapper" return mb
a,b,c,d,e,f,g,h,i,j = split_list(heads,10) lists = [a,b,c,d,e,f,g,h,i,j] for list in lists: parser.parse(list,xml_generator_config) # Configure the xml generator xml_generator_config = parser.xml_generator_configuration_t( xml_generator_path=generator_path, xml_generator=generator_name, compiler='cl.exe', compiler_path='C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\cl.exe', include_paths=godot_headers,keep_xml=True,cflags= ''.join(env['CCFLAGS'])) print(sys.platform) if sys.platform == "win32": path = 'C:\\godot-haxe\\godot-cpp\\include\\' arr = os.listdir(path) parser.parse() for p in arr: temp = os.listdir(path+p+"\\") for name in temp: names.append(path+p+"\\"+name) print(names) # Parse the c++ file decls = parser.parse(names, xml_generator_config) # Now tell py++ that we already made the xml file for f in names: files.append(parser.create_gccxml_fc(f.abspath)) mb = pyplusplus.module_builder.module_builder_t(files) # # Get access to the global namespace # global_namespace = declarations.get_global_namespace(decls) # # Get access to the 'ns' namespace # ns = global_namespace.namespace("ns")