[pygccxml-commit] source/pygccxml/parser project_reader.py,1.27,1.28
Brought to you by:
mbaas,
roman_yakovenko
From: Roman <rom...@us...> - 2006-03-21 08:08:05
|
Update of /cvsroot/pygccxml/source/pygccxml/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32522/pygccxml/parser Modified Files: project_reader.py Log Message: module_builder_t class interface has been changed: as we agrees with Matthias: every step should be done explicitly: declaration parsing in __init__( I decided about this ) build_code_creator() <- creates code creators tree, user has full control on module_creator.creator_t class initialization write_module <- writes module to file split_module <- splits module code to mutliple files I will post about those changes on mailing list later. Index: project_reader.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/project_reader.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** project_reader.py 20 Mar 2006 14:18:48 -0000 1.27 --- project_reader.py 21 Mar 2006 08:07:25 -0000 1.28 *************** *** 108,123 **** self.__decl_factory = pygccxml.declarations.decl_factory_t() def read_files( self, files, compilation_mode=COMPILATION_MODE.FILE_BY_FILE): """Parse header files. ! @param files: The header files that should be parsed ! @type files: list of str @param compilation_mode: Determines whether the files are parsed individually or as one single chunk @type compilation_mode: L{COMPILATION_MODE} @returns: Declarations """ ! if compilation_mode == COMPILATION_MODE.ALL_AT_ONCE: return self.__parse_all_at_once(files) else: return self.__parse_file_by_file(files) --- 108,150 ---- self.__decl_factory = pygccxml.declarations.decl_factory_t() + def get_os_file_names( self, files ): + """Returns a list of OS file names + + @param files: list of strings or L{file_configuration_t} instances. + files could contain a mix of them + @type files: list + """ + fnames = [] + for f in files: + if isinstance( f, types.StringTypes ): + fnames.append( f ) + elif isinstance( f, file_configuration_t ): + if f.content_type in ( file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE + , file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE ): + fnames.append( f.data ) + else: + pass + return fnames + def read_files( self, files, compilation_mode=COMPILATION_MODE.FILE_BY_FILE): """Parse header files. ! @param files: list of strings or L{file_configuration_t} instances. ! files could contain a mix of them ! @type files: list @param compilation_mode: Determines whether the files are parsed individually or as one single chunk @type compilation_mode: L{COMPILATION_MODE} @returns: Declarations """ ! if compilation_mode == COMPILATION_MODE.ALL_AT_ONCE \ ! and len( files ) == len( self.get_os_file_names(files) ): return self.__parse_all_at_once(files) else: + if compilation_mode == COMPILATION_MODE.ALL_AT_ONCE: + msg = ''.join([ + "Unable to parse files using ALL_AT_ONCE mode. " + , "There is some file configuration that is not file. " + , "pygccxml.parser.project_reader_t switches to FILE_BY_FILE mode." ]) + logger.info( msg ) return self.__parse_file_by_file(files) *************** *** 147,150 **** --- 174,178 ---- decls = reader.read_xml_file( header ) elif content_type == file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE: + #TODO: raise error when header file does not exist if not os.path.exists( prj_file.cached_source_file ): dir_ = os.path.split( prj_file.cached_source_file )[0] |