本文整理汇总了Python中pygccxml.parser.project_reader_t函数的典型用法代码示例。如果您正苦于以下问题:Python project_reader_t函数的具体用法?Python project_reader_t怎么用?Python project_reader_t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了project_reader_t函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test
def test(self):
src_reader = parser.source_reader_t(self.config)
src_decls = src_reader.read_file(self.__fname)
xmlfile = src_reader.create_xml_file(self.__fname)
print(xmlfile)
try:
conf_t = parser.file_configuration_t
fconfig = conf_t(
data=xmlfile,
start_with_declarations=None,
content_type=conf_t.CONTENT_TYPE.GCCXML_GENERATED_FILE)
prj_reader = parser.project_reader_t(self.config)
prj_decls = prj_reader.read_files(
[fconfig],
compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE)
declarations.dump_declarations(
src_decls,
os.path.join(
autoconfig.build_directory,
'xmlfile_reader.src.txt'))
declarations.dump_declarations(
prj_decls,
os.path.join(
autoconfig.build_directory,
'xmlfile_reader.prj.txt'))
if src_decls != prj_decls:
self.fail(
"There is a difference between declarations in file %s." %
self.__fname)
finally:
pass # utils.remove_file_no_raise( xmlfile )
开发者ID:programmdesign,项目名称:pygccxml,代码行数:35,代码来源:xmlfile_reader_tester.py
示例2: __init__
def __init__(self, *args):
parser_test_case.parser_test_case_t.__init__(self, *args)
self.__files = [
'core_ns_join_1.hpp',
'core_ns_join_2.hpp',
'core_ns_join_3.hpp',
'core_membership.hpp',
'core_class_hierarchy.hpp',
'core_types.hpp',
'core_diamand_hierarchy_base.hpp',
'core_diamand_hierarchy_derived1.hpp',
'core_diamand_hierarchy_derived2.hpp',
'core_diamand_hierarchy_final_derived.hpp',
'core_overloads_1.hpp',
'core_overloads_2.hpp',
'typedefs_base.hpp']
# for i, f in enumerate(self.__files):
# f = parser.create_cached_source_fc(
# os.path.join( autoconfig.data_directory, f)
# , os.path.join( autoconfig.data_directory, f + '.xml') )
# self.__files[i] = f
prj_reader = parser.project_reader_t(self.config)
self.decls = prj_reader.read_files(
self.__files,
compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE)
开发者ID:Artoria2e5,项目名称:pygccxml,代码行数:26,代码来源:decl_printer_tester.py
示例3: __parse_declarations
def __parse_declarations( self, files, gccxml_config, compilation_mode, cache, indexing_suite_version ):
if None is gccxml_config:
gccxml_config = parser.config_t()
if None is compilation_mode:
compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE
start_time = time.clock()
self.logger.debug( 'parsing files - started' )
reader = parser.project_reader_t( gccxml_config, cache, decl_wrappers.dwfactory_t() )
decls = reader.read_files( files, compilation_mode )
self.logger.debug( 'parsing files - done( %f seconds )' % ( time.clock() - start_time ) )
self.logger.debug( 'settings declarations defaults - started' )
global_ns = decls_package.matcher.get_single(
decls_package.namespace_matcher_t( name='::' )
, decls )
if indexing_suite_version != 1:
for cls in global_ns.classes():
cls.indexing_suite_version = indexing_suite_version
try:
for cls in global_ns.decls(decl_type=decls_package.class_declaration_t):
cls.indexing_suite_version = indexing_suite_version
except RuntimeError:
pass
start_time = time.clock()
self.__apply_decls_defaults(decls)
self.logger.debug( 'settings declarations defaults - done( %f seconds )'
% ( time.clock() - start_time ) )
return global_ns
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:30,代码来源:builder.py
示例4: __test_correctness_impl
def __test_correctness_impl(self, file_name):
prj_reader = parser.project_reader_t(self.config)
prj_decls = prj_reader.read_files(
[file_name] * 2,
compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE)
src_reader = parser.source_reader_t(self.config)
src_decls = src_reader.read_file(file_name)
if src_decls != prj_decls:
s = src_decls[0]
p = prj_decls[0]
sr = open(
os.path.join(
autoconfig.build_directory, file_name + '.sr.txt'), 'w+')
pr = open(
os.path.join(
autoconfig.build_directory, file_name + '.pr.txt'), 'w+')
declarations.print_declarations(
s, writer=lambda l: sr.write(l + os.linesep))
declarations.print_declarations(
p, writer=lambda l: pr.write(l + os.linesep))
sr.close()
pr.close()
self.fail(
"There is a difference between declarations in file %s." %
file_name)
开发者ID:programmdesign,项目名称:pygccxml,代码行数:25,代码来源:project_reader_correctness_tester.py
示例5: profile_project2
def profile_project2():
he = r"2003\Vc7\PlatformSDK\Include\windows.h"
include_std_header = r"D:\Program Files\Microsoft Visual Studio .NET " + he
reader = parser.project_reader_t(
parser.xml_generator_configuration_t(
xml_generator_path=autoconfig.generator_path))
reader.read_files([include_std_header])
开发者ID:gccxml,项目名称:pygccxml,代码行数:7,代码来源:test_performance.py
示例6: parse_files
def parse_files(path, files):
# Find the location of the xml generator (castxml or gccxml)
#generator_path, generator_name = utils.find_xml_generator()
#print("GENER " + generator_path)
# Configure the xml generator
args = {
'include_paths':[path],
'keep_xml': True
}
if(xml_generator != None):
args['xml_generator'] =xml_generator
if(xml_generator_path != None):
args['xml_generator_path'] =xml_generator_path
xml_generator_config = parser.xml_generator_configuration_t(**args)
# not sure this actually does anything when compilation_mode is set to "ALL_AT_ONCE"
def cache_file(filename):
return parser.file_configuration_t(
data=filename,
content_type=parser.CONTENT_TYPE.CACHED_SOURCE_FILE,
cached_source_file=filename.replace(path, "tmp/xml")+".xml")
cached_files = [cache_file(f) for f in files]
project_reader = parser.project_reader_t(xml_generator_config)
decls = project_reader.read_files(
cached_files,
compilation_mode=parser.COMPILATION_MODE.ALL_AT_ONCE)
return declarations.get_global_namespace(decls)
开发者ID:henrikrudstrom,项目名称:oce-wrap,代码行数:31,代码来源:parse_headers.py
示例7: test
def test(self):
db = pypp_utils.exposed_decls_db_t()
config = parser.config_t( gccxml_path=autoconfig.gccxml.executable )
reader = parser.project_reader_t( config, None, decl_wrappers.dwfactory_t() )
decls = reader.read_files( [parser.create_text_fc(self.CODE)] )
global_ns = declarations.get_global_namespace( decls )
ns = global_ns.namespace( 'ns' )
ns_skip = global_ns.namespace( 'ns_skip' )
global_ns.exclude()
ns.include()
db.register_decls( global_ns, [] )
for x in ns.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == True )
for x in ns_skip.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == False )
db.save( os.path.join( autoconfig.build_dir, 'exposed.db.pypp' ) )
db2 = pypp_utils.exposed_decls_db_t()
db2.load( os.path.join( autoconfig.build_dir, 'exposed.db.pypp' ) )
for x in ns.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == True )
ns_skip = global_ns.namespace( 'ns_skip' )
for x in ns_skip.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == False )
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:32,代码来源:exposed_decls_db_tester.py
示例8: test_project_reader_all_at_once
def test_project_reader_all_at_once(self):
reader = parser.project_reader_t(self.config)
decls = reader.read_files(
[parser.file_configuration_t(
self.header, self.config.start_with_declarations)],
parser.COMPILATION_MODE.ALL_AT_ONCE)
self.__check_result(decls)
开发者ID:Artoria2e5,项目名称:pygccxml,代码行数:7,代码来源:start_with_declarations_tester.py
示例9: test_project_reader_file_by_file
def test_project_reader_file_by_file(self):
reader = parser.project_reader_t(self.config)
decls = reader.read_files(
[parser.file_configuration_t(
self.header, self.config.start_with_declarations)],
parser.COMPILATION_MODE.FILE_BY_FILE)
self.__check_result(decls)
开发者ID:Artoria2e5,项目名称:pygccxml,代码行数:7,代码来源:start_with_declarations_tester.py
示例10: profile_project
def profile_project():
include_std_header = os.path.join(
autoconfig.data_directory,
'include_std.hpp')
reader = parser.project_reader_t(
parser.xml_generator_configuration_t(
xml_generator_path=autoconfig.generator_path))
reader.read_files([include_std_header])
开发者ID:gccxml,项目名称:pygccxml,代码行数:8,代码来源:test_performance.py
示例11: parse_big_file
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)])
开发者ID:iMichka,项目名称:pygccxml,代码行数:8,代码来源:test_performance.py
示例12: test_on_big_file
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()
开发者ID:gccxml,项目名称:pygccxml,代码行数:9,代码来源:test_performance.py
示例13: test
def test(self):
fconfig = parser.file_configuration_t(
data="int i;", start_with_declarations=None, content_type=parser.file_configuration_t.CONTENT_TYPE.TEXT
)
prj_reader = parser.project_reader_t(self.config)
decls = prj_reader.read_files([fconfig], compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE)
var_i = declarations.find_declaration(decls, type=declarations.variable_t, name="i")
self.failUnless(var_i, "Variable i has not been found.")
开发者ID:iMichka,项目名称:pygccxml,代码行数:10,代码来源:text_reader_tester.py
示例14: test
def test(self):
prj_reader = parser.project_reader_t(self.config)
decls = prj_reader.read_files(
self.__files,
compilation_mode=parser.COMPILATION_MODE.ALL_AT_ONCE)
files = declarations.declaration_files(decls)
result = set()
for fn in files:
result.add(os.path.split(fn)[1])
self.failUnless(set(self.__files).issubset(result))
开发者ID:programmdesign,项目名称:pygccxml,代码行数:10,代码来源:declaration_files_tester.py
示例15: show_xml
def show_xml( self, file_configuration, compiler_config ):
try:
reader = parser.project_reader_t( config=compiler_config )
content = reader.read_xml( file_configuration )
return content, ''
#return xml.sax.saxutils.escape( content ), ''
except Exception, error:
user_msg = [ 'Error occured during code generation process!' ]
user_msg.append( 'Error:' )
user_msg.append( str( error ) )
return '', '\n'.join( user_msg )
开发者ID:atemysemicolon,项目名称:pyplusplusclone,代码行数:11,代码来源:code_generator.py
示例16: show_declarations
def show_declarations( self, file_configuration, compiler_config ):
try:
reader = parser.project_reader_t( config=compiler_config )
decls = reader.read_files( [file_configuration] )
global_ns = declarations.get_global_namespace( decls )
tmp = []
declarations.print_declarations( decls, verbose=False, writer=lambda x: tmp.append( x.rstrip() ) )
return os.linesep.join( tmp ), ''
except Exception, error:
user_msg = [ 'Error occured during code generation process!' ]
user_msg.append( 'Error:' )
user_msg.append( str( error ) )
return '', '\n'.join( user_msg )
开发者ID:atemysemicolon,项目名称:pyplusplusclone,代码行数:13,代码来源:code_generator.py
示例17: test
def test(self):
prj_reader = parser.project_reader_t( self.config )
prj_decls = prj_reader.read_files( self.__files
, compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE )
src_reader = parser.source_reader_t( self.config )
src_decls = src_reader.read_file( 'separate_compilation/all.h' )
declarations.dump_declarations( src_decls
, os.path.join( autoconfig.build_directory, 'separate_compilation.sr.txt' ) )
declarations.dump_declarations( prj_decls
, os.path.join( autoconfig.build_directory, 'separate_compilation.pr.txt' ) )
self.failUnless( src_decls == prj_decls, "There is a difference between declarations" )
开发者ID:atemysemicolon,项目名称:pyplusplusclone,代码行数:14,代码来源:project_reader_correctness_tester.py
示例18: __parse_declarations
def __parse_declarations( self, files, gccxml_config, compilation_mode=None, cache=None ):
if None is gccxml_config:
gccxml_config = parser.config_t()
if None is compilation_mode:
compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE
start_time = time.clock()
self.logger.debug( 'parsing files - started' )
reader = parser.project_reader_t( gccxml_config, cache, decl_wrappers.dwfactory_t() )
decls = reader.read_files( files, compilation_mode )
self.logger.debug( 'parsing files - done( %f seconds )' % ( time.clock() - start_time ) )
return decls_package.matcher.get_single( decls_package.namespace_matcher_t( name='::' )
, decls )
开发者ID:asford,项目名称:pyplusplus,代码行数:14,代码来源:ctypes_builder.py
示例19: test
def test(self):
fconfig = parser.file_configuration_t( data=self.__fname
, content_type=parser.CONTENT_TYPE.CACHED_SOURCE_FILE )
try:
prj_reader = parser.project_reader_t( self.config )
prj_decls = prj_reader.read_files( [fconfig]
, compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE )
self.failUnless( os.path.exists( fconfig.cached_source_file ) )
mtime1 = os.stat(fconfig.cached_source_file)[stat.ST_MTIME]
prj_decls = prj_reader.read_files( [fconfig]
, compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE )
mtime2 = os.stat(fconfig.cached_source_file)[stat.ST_MTIME]
self.failUnless( mtime1 == mtime2 )
finally:
utils.remove_file_no_raise( fconfig.cached_source_file )
开发者ID:glehmann,项目名称:WrapITK-unstable,代码行数:15,代码来源:cached_source_file_tester.py
示例20: test_project_on_include_std_dot_hpp
def test_project_on_include_std_dot_hpp():
include_std_header = os.path.join(
autoconfig.data_directory,
'include_std.hpp')
clock_prev = time.clock()
dcache = parser.file_cache_t(dcache_file_name)
reader = parser.project_reader_t(
parser.xml_generator_configuration_t(
xml_generator_path=autoconfig.generator_path),
dcache)
reader.read_files([include_std_header])
dcache.flush()
clock_now = time.clock()
print('without cache: %f seconds' % (clock_now - clock_prev))
clock_prev = time.clock()
dcache = parser.file_cache_t(dcache_file_name)
reader = parser.project_reader_t(
parser.xml_generator_configuration_t(
xml_generator_path=autoconfig.generator_path),
dcache)
reader.read_files([include_std_header])
clock_now = time.clock()
print('with cache : %f seconds' % (clock_now - clock_prev))
开发者ID:gccxml,项目名称:pygccxml,代码行数:24,代码来源:test_performance.py
注:本文中的pygccxml.parser.project_reader_t函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论