Update of /cvsroot/pygccxml/source/pygccxml/parser
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23403/pygccxml/parser
Modified Files:
__init__.py declarations_cache.py project_reader.py scanner.py
source_reader.py
Log Message:
Index: __init__.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/__init__.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** __init__.py 22 Jan 2006 10:17:17 -0000 1.16
--- __init__.py 2 Mar 2006 05:53:14 -0000 1.17
***************
*** 9,12 ****
--- 9,17 ----
from project_reader import project_reader_t
from project_reader import file_configuration_t
+ from project_reader import create_text_fc
+ from project_reader import create_source_fc
+ from project_reader import create_gccxml_fc
+ from project_reader import create_cached_source_fc
+
from source_reader import source_reader_t
from source_reader import gccxml_runtime_error_t
***************
*** 17,20 ****
--- 22,26 ----
CONTENT_TYPE = file_configuration_t.CONTENT_TYPE
+
def parse( files
, config=None
Index: scanner.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/scanner.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** scanner.py 28 Feb 2006 07:11:09 -0000 1.20
--- scanner.py 2 Mar 2006 05:53:14 -0000 1.21
***************
*** 10,13 ****
--- 10,14 ----
import xml.sax.handler
from pygccxml.declarations import *
+ from pygccxml.utils import logger
##convention
***************
*** 192,196 ****
self.__files[ attrs[XML_AN_ID] ] = obj
else:
! print 'unknown object types.'
def endElement(self, name):
--- 193,198 ----
self.__files[ attrs[XML_AN_ID] ] = obj
else:
! logger.debug( 'Unknown object type has been found.'
! + ' Please report this bug to pygccxml development team.' )
def endElement(self, name):
Index: declarations_cache.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/declarations_cache.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** declarations_cache.py 28 Feb 2006 07:11:09 -0000 1.10
--- declarations_cache.py 2 Mar 2006 05:53:14 -0000 1.11
***************
*** 10,14 ****
import time
import cPickle
! from pygccxml.utils import TODO
--- 10,14 ----
import time
import cPickle
! from pygccxml.utils import logger
***************
*** 152,164 ****
cache_file_obj = file( file_name, 'rb' )
try:
! print "Loading cache... ",
! sys.stdout.flush()
start_time = time.clock()
cache = cPickle.load( cache_file_obj )
! print " %.1f secs"%(time.clock()-start_time)
! print "Found cache in file: [%s] entries: %s"%(file_name, len(cache.keys()))
except Exception, error:
cache_file_obj.close()
! print "Invalid cache file: [%s] Regenerating."%file_name
file(file_name, 'w+b').close() # Create empty file
cache = {} # Empty cache
--- 152,164 ----
cache_file_obj = file( file_name, 'rb' )
try:
! logger.debug( "Loading cache file ..." )
start_time = time.clock()
cache = cPickle.load( cache_file_obj )
! logger.debug( "Cache file has been loaded in %.1f secs"%( time.clock() - start_time ) )
! logger.debug( "Found cache in file: [%s] entries: %s"
! % ( file_name, len( cache.keys() ) ) )
except Exception, error:
cache_file_obj.close()
! logger.debug( "Invalid cache file: [%s] Regenerating." % file_name )
file(file_name, 'w+b').close() # Create empty file
cache = {} # Empty cache
***************
*** 177,181 ****
del self.__cache[key]
if num_removed > 0:
! print " removed %s entries from cache."%num_removed
# Save out the cache to disk
cache_file = file( self.__name, 'w+b' )
--- 177,181 ----
del self.__cache[key]
if num_removed > 0:
! logger.debug( "There are %s removed entries from cache." % num_removed )
# Save out the cache to disk
cache_file = file( self.__name, 'w+b' )
Index: source_reader.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/source_reader.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** source_reader.py 28 Feb 2006 07:11:09 -0000 1.24
--- source_reader.py 2 Mar 2006 05:53:14 -0000 1.25
***************
*** 13,16 ****
--- 13,17 ----
import patcher
from pygccxml.declarations import *
+ from pygccxml.utils import logger
class gccxml_runtime_error_t( RuntimeError ):
***************
*** 106,110 ****
command_line = self.__create_command_line( ffname, gccxml_file )
if self.__config.verbose:
! print " gccxml: ", command_line
input, output = os.popen4( command_line )
input.close()
--- 107,111 ----
command_line = self.__create_command_line( ffname, gccxml_file )
if self.__config.verbose:
! logger.debug( " Command line for GCC-XML: %s" % command_line )
input, output = os.popen4( command_line )
input.close()
***************
*** 146,154 ****
ffname = self.__file_full_name(source_file)
if self.__config.verbose:
! print " reading source file: [%s]:"%ffname,
declarations = self.__dcache.cached_value( ffname, self.__config )
if not declarations:
if self.__config.verbose:
! print " parsing..."
gccxml_file = self.create_xml_file( ffname )
declarations, files = self.__parse_gccxml_created_file( gccxml_file )
--- 147,155 ----
ffname = self.__file_full_name(source_file)
if self.__config.verbose:
! logger.debug( "Reading source file: [%s]." % ffname )
declarations = self.__dcache.cached_value( ffname, self.__config )
if not declarations:
if self.__config.verbose:
! logger.debug( "File has not been found in cache, parsing..." )
gccxml_file = self.create_xml_file( ffname )
declarations, files = self.__parse_gccxml_created_file( gccxml_file )
***************
*** 156,160 ****
else:
if self.__config.verbose:
! print " cached."
except Exception, error:
--- 157,161 ----
else:
if self.__config.verbose:
! logger.debug( "File has not been changed, reading declarations from cache." )
except Exception, error:
***************
*** 168,172 ****
def read_xml_file(self, gccxml_created_file):
if self.__config.verbose:
! print " reading xml file: [%s]"%gccxml_created_file
declarations, files = self.__parse_gccxml_created_file( gccxml_created_file )
--- 169,173 ----
def read_xml_file(self, gccxml_created_file):
if self.__config.verbose:
! logger.debug( "Reading xml file: [%s]" % gccxml_created_file )
declarations, files = self.__parse_gccxml_created_file( gccxml_created_file )
Index: project_reader.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/project_reader.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** project_reader.py 28 Feb 2006 07:11:09 -0000 1.22
--- project_reader.py 2 Mar 2006 05:53:14 -0000 1.23
***************
*** 11,14 ****
--- 11,15 ----
import declarations_cache
import pygccxml.declarations
+ from pygccxml.utils import logger
class COMPILATION_MODE:
***************
*** 55,58 ****
--- 56,76 ----
cached_source_file = property( __get_cached_source_file )
+ def create_text_fc( text ):
+ return file_configuration_t( data=text
+ , content_type=file_configuration_t.CONTENT_TYPE.TEXT )
+
+ def create_source_fc( header ):
+ return file_configuration_t( data=header
+ , content_type=file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE )
+
+ def create_gccxml_fc( xml_file ):
+ return file_configuration_t( data=xml_file
+ , content_type=file_configuration_t.CONTENT_TYPE.GCCXML_GENERATED_FILE )
+
+ def create_cached_source_fc( header, cached_source_file ):
+ return file_configuration_t( data=header
+ , cached_source_file=cached_source_file
+ , content_type=file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE )
+
class project_reader_t:
def __init__( self, config, cache=None, decl_factory=None):
***************
*** 79,83 ****
config = self.__config.clone()
if config.verbose:
! print "Reading project files: file by file"
for prj_file in files:
reader = None
--- 97,101 ----
config = self.__config.clone()
if config.verbose:
! logger.debug( "Reading project files: file by file" )
for prj_file in files:
reader = None
***************
*** 110,126 ****
namespaces.append( decls )
if config.verbose:
! print "Flushing cache... ",
! sys.stdout.flush()
start_time = time.clock()
self.__dcache.flush()
if config.verbose:
! print " %.1f secs"%(time.clock()-start_time)
answer = []
if config.verbose:
! print "joining namespaces"
for file_nss in namespaces:
answer = self._join_top_namespaces( answer, file_nss )
if config.verbose:
! print "joining declarations"
for ns in answer:
if isinstance( ns, pygccxml.declarations.namespace_t ):
--- 128,144 ----
namespaces.append( decls )
if config.verbose:
! logger.debug( "Flushing cache... " )
start_time = time.clock()
self.__dcache.flush()
if config.verbose:
! logger.debug( "Cache has been fkushed in %.1f secs"
! % ( time.clock() - start_time ) )
answer = []
if config.verbose:
! logger.debug( "Joining namespaces ..." )
for file_nss in namespaces:
answer = self._join_top_namespaces( answer, file_nss )
if config.verbose:
! logger.debug( "Joining declarations ..." )
for ns in answer:
if isinstance( ns, pygccxml.declarations.namespace_t ):
***************
*** 129,133 ****
types = self.__declarated_types(answer)
if config.verbose:
! print "relinking declared types"
self._relink_declarated_types( leaved_classes, types )
return answer
--- 147,151 ----
types = self.__declarated_types(answer)
if config.verbose:
! logger.debug( "Relinking declared types ..." )
self._relink_declarated_types( leaved_classes, types )
return answer
***************
*** 136,140 ****
config = self.__config.clone()
if config.verbose:
! print "Reading project files: all at once"
header_content = []
for header in files:
--- 154,158 ----
config = self.__config.clone()
if config.verbose:
! logger.debug( "Reading project files: all at once" )
header_content = []
for header in files:
|