Update of /cvsroot/pygccxml/source/pygccxml/parser
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28954/pygccxml/parser
Modified Files:
declarations_cache.py directory_cache.py patcher.py
project_reader.py scanner.py source_reader.py
Log Message:
There are a lot of changes, sorry CVS did not worked for week or something like this
Changes
1. Lots of code clean up
2. Adding and updating documentation
3. Adding new method on decl_wrapper - readme. This method will return list of msgs to the developer.
For example if function takes by reference fundamental type it will say that this function could not be called from Python
4. Logging functionlity has been added to file writers too
5. Few bug fixes
6. For operator [] call policies is always set.
Index: scanner.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/scanner.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** scanner.py 9 Mar 2006 01:46:15 -0000 1.22
--- scanner.py 6 Apr 2006 06:15:58 -0000 1.23
***************
*** 252,256 ****
def __read_array_type( self, attrs ):
! type = attrs[ XML_AN_TYPE ]
size = array_t.SIZE_UNKNOWN
if attrs.has_key(XML_AN_MAX):
--- 252,256 ----
def __read_array_type( self, attrs ):
! type_ = attrs[ XML_AN_TYPE ]
size = array_t.SIZE_UNKNOWN
if attrs.has_key(XML_AN_MAX):
***************
*** 263,267 ****
except ValueError:
warnings.warn( 'unable to find out array size from expression "%s"' % attrs[ XML_AN_MAX ] )
! return array_t( type, size + 1 )
def __read_cv_qualified_type( self, attrs ):
--- 263,267 ----
except ValueError:
warnings.warn( 'unable to find out array size from expression "%s"' % attrs[ XML_AN_MAX ] )
! return array_t( type_, size + 1 )
def __read_cv_qualified_type( self, attrs ):
***************
*** 286,290 ****
try:
return FUNDAMENTAL_TYPES[ attrs[XML_AN_NAME] ]
! except KeyError, error:
raise RuntimeError( "pygccxml error: unable to find fundamental type with name '%s'."
% attrs[XML_AN_NAME] )
--- 286,290 ----
try:
return FUNDAMENTAL_TYPES[ attrs[XML_AN_NAME] ]
! except KeyError:
raise RuntimeError( "pygccxml error: unable to find fundamental type with name '%s'."
% attrs[XML_AN_NAME] )
***************
*** 292,297 ****
def __read_offset_type( self,attrs ):
base = attrs[ XML_AN_BASE_TYPE ]
! type = attrs[ XML_AN_TYPE ]
! return member_variable_type_t( class_inst=base, variable_type=type )
def __read_argument( self, attrs ):
--- 292,297 ----
def __read_offset_type( self,attrs ):
base = attrs[ XML_AN_BASE_TYPE ]
! type_ = attrs[ XML_AN_TYPE ]
! return member_variable_type_t( class_inst=base, variable_type=type_ )
def __read_argument( self, attrs ):
Index: declarations_cache.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/declarations_cache.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** declarations_cache.py 9 Mar 2006 01:46:15 -0000 1.12
--- declarations_cache.py 6 Apr 2006 06:15:58 -0000 1.13
***************
*** 6,10 ****
import os
- import sys
import md5
import time
--- 6,9 ----
***************
*** 158,162 ****
logger.info( "Found cache in file: [%s] entries: %s"
% ( file_name, len( cache.keys() ) ) )
! except Exception, error:
cache_file_obj.close()
logger.info( "Invalid cache file: [%s] Regenerating." % file_name )
--- 157,161 ----
logger.info( "Found cache in file: [%s] entries: %s"
% ( file_name, len( cache.keys() ) ) )
! except Exception:
cache_file_obj.close()
logger.info( "Invalid cache file: [%s] Regenerating." % file_name )
Index: directory_cache.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/directory_cache.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** directory_cache.py 8 Mar 2006 08:37:20 -0000 1.2
--- directory_cache.py 6 Apr 2006 06:15:58 -0000 1.3
***************
*** 141,146 ****
filesigs = []
for filename in dependent_files:
! id,sig = self.__filename_rep.acquire_filename(filename)
! filesigs.append((id,sig))
configsig = self._create_config_signature(configuration)
--- 141,146 ----
filesigs = []
for filename in dependent_files:
! id_,sig = self.__filename_rep.acquire_filename(filename)
! filesigs.append((id_,sig))
configsig = self._create_config_signature(configuration)
***************
*** 188,193 ****
# Check if any of the dependent files has been modified...
! for id, sig in entry.filesigs:
! if self.__filename_rep.is_file_modified(id, sig):
# print "CACHE: %s: Entry not up to date"%source_file
return None
--- 188,193 ----
# Check if any of the dependent files has been modified...
! for id_, sig in entry.filesigs:
! if self.__filename_rep.is_file_modified(id_, sig):
# print "CACHE: %s: Entry not up to date"%source_file
return None
***************
*** 292,297 ****
# Release the referenced files...
! for id, sig in entry.filesigs:
! self.__filename_rep.release_filename(id)
# Remove the cache entry...
--- 292,297 ----
# Release the referenced files...
! for id_, sig in entry.filesigs:
! self.__filename_rep.release_filename(id_)
# Remove the cache entry...
***************
*** 416,423 ****
self._md5_sigs = md5_sigs
! # ID lookup table (key: filename / value: id)
self.__id_lut = {}
! # Entry dictionary (key: id / value: filename_entry_t)
# This dictionary contains the actual data.
# It must always hold that each entry in __entries has a corresponding
--- 416,423 ----
self._md5_sigs = md5_sigs
! # ID lookup table (key: filename / value: id_)
self.__id_lut = {}
! # Entry dictionary (key: id_ / value: filename_entry_t)
# This dictionary contains the actual data.
# It must always hold that each entry in __entries has a corresponding
***************
*** 432,469 ****
"""Acquire a file name and return its id and its signature.
"""
! id = self.__id_lut.get(name)
# Is this a new entry?
! if id==None:
# then create one...
! id = self.__next_id
self.__next_id += 1
! self.__id_lut[name] = id
entry = filename_entry_t(name)
! self.__entries[id] = entry
else:
# otherwise obtain the entry...
! entry = self.__entries[id]
entry.inc_ref_count()
! return id, self._get_signature(entry)
! def release_filename(self, id):
"""Release a file name.
"""
! entry = self.__entries.get(id)
if entry==None:
! raise ValueError, "Invalid filename id (%d)"%id
# Decrease reference count and check if the entry has to be removed...
if entry.dec_ref_count()==0:
! del self.__entries[id]
del self.__id_lut[entry.filename]
! def is_file_modified(self, id, signature):
! """Check if the file referred to by id has been modified.
"""
! entry = self.__entries.get(id)
if entry==None:
! raise ValueError, "Invalid filename id (%d)"%id
# Is the signature already known?
--- 432,469 ----
"""Acquire a file name and return its id and its signature.
"""
! id_ = self.__id_lut.get(name)
# Is this a new entry?
! if id_==None:
# then create one...
! id_ = self.__next_id
self.__next_id += 1
! self.__id_lut[name] = id_
entry = filename_entry_t(name)
! self.__entries[id_] = entry
else:
# otherwise obtain the entry...
! entry = self.__entries[id_]
entry.inc_ref_count()
! return id_, self._get_signature(entry)
! def release_filename(self, id_):
"""Release a file name.
"""
! entry = self.__entries.get(id_)
if entry==None:
! raise ValueError, "Invalid filename id (%d)"%id_
# Decrease reference count and check if the entry has to be removed...
if entry.dec_ref_count()==0:
! del self.__entries[id_]
del self.__id_lut[entry.filename]
! def is_file_modified(self, id_, signature):
! """Check if the file referred to by id_ has been modified.
"""
! entry = self.__entries.get(id_)
if entry==None:
! raise ValueError, "Invalid filename id_ (%d)"%id_
# Is the signature already known?
***************
*** 480,484 ****
def update_id_counter(self):
! """Update the id counter so that it doesn't grow forever.
"""
if len(self.__entries)==0:
--- 480,484 ----
def update_id_counter(self):
! """Update the id_ counter so that it doesn't grow forever.
"""
if len(self.__entries)==0:
***************
*** 516,528 ****
print "ID lookup table:"
for name in self.__id_lut:
! id = self.__id_lut[name]
! print " %s -> %d"%(name, id)
print 70*"-"
print "%-4s %-60s %s"%("ID", "Filename", "Refcount")
print 70*"-"
! for id in self.__entries:
! entry = self.__entries[id]
! print "%04d %-60s %d"%(id, entry.filename, entry.refcount)
--- 516,528 ----
print "ID lookup table:"
for name in self.__id_lut:
! id_ = self.__id_lut[name]
! print " %s -> %d"%(name, id_)
print 70*"-"
print "%-4s %-60s %s"%("ID", "Filename", "Refcount")
print 70*"-"
! for id_ in self.__entries:
! entry = self.__entries[id_]
! print "%04d %-60s %d"%(id_, entry.filename, entry.refcount)
Index: patcher.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/patcher.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** patcher.py 9 Feb 2006 11:33:55 -0000 1.10
--- patcher.py 6 Apr 2006 06:15:58 -0000 1.11
***************
*** 4,8 ****
# http://www.boost.org/LICENSE_1_0.txt)
- import re
from pygccxml import declarations
--- 4,7 ----
***************
*** 133,137 ****
found1 = call_invocation.find_args( dv )
found2 = call_invocation.find_args( dv, found1[1] + 1 )
! args1 = call_invocation.args( dv[ found1[0] : found1[1] + 1 ] )
args2 = call_invocation.args( dv[ found2[0] : found2[1] + 1 ] )
return call_invocation.join( dv[:found1[0]], args2 )
--- 132,136 ----
found1 = call_invocation.find_args( dv )
found2 = call_invocation.find_args( dv, found1[1] + 1 )
! #args1 = call_invocation.args( dv[ found1[0] : found1[1] + 1 ] )
args2 = call_invocation.args( dv[ found2[0] : found2[1] + 1 ] )
return call_invocation.join( dv[:found1[0]], args2 )
Index: source_reader.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/source_reader.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** source_reader.py 9 Mar 2006 01:46:15 -0000 1.27
--- source_reader.py 6 Apr 2006 06:15:58 -0000 1.28
***************
*** 108,113 ****
if self.__config.verbose:
logger.info( " Command line for GCC-XML: %s" % command_line )
! input, output = os.popen4( command_line )
! input.close()
#output = os.popen(command_line)
gccxml_reports = []
--- 108,113 ----
if self.__config.verbose:
logger.info( " Command line for GCC-XML: %s" % command_line )
! input_, output = os.popen4( command_line )
! input_.close()
#output = os.popen(command_line)
gccxml_reports = []
***************
*** 205,209 ****
return os.path.normpath( abs_file_path )
return file_path
! except Exception, error:
return file_path
--- 205,209 ----
return os.path.normpath( abs_file_path )
return file_path
! except Exception:
return file_path
***************
*** 221,228 ****
, membership=scanner_.members()
, files=files )
! for type in list( types.itervalues() ):
#I need this copy because internaly linker change types collection
! linker_.instance = type
! apply_visitor( linker_, type )
for decl in decls.itervalues():
linker_.instance = decl
--- 221,228 ----
, membership=scanner_.members()
, files=files )
! for type_ in list( types.itervalues() ):
#I need this copy because internaly linker change types collection
! linker_.instance = type_
! apply_visitor( linker_, type_ )
for decl in decls.itervalues():
linker_.instance = decl
Index: project_reader.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/parser/project_reader.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** project_reader.py 21 Mar 2006 08:07:25 -0000 1.28
--- project_reader.py 6 Apr 2006 06:15:58 -0000 1.29
***************
*** 5,9 ****
import os
- import sys
import time
import types
--- 5,8 ----
***************
*** 108,112 ****
self.__decl_factory = pygccxml.declarations.decl_factory_t()
! def get_os_file_names( self, files ):
"""Returns a list of OS file names
--- 107,111 ----
self.__decl_factory = pygccxml.declarations.decl_factory_t()
! def get_os_file_names( files ):
"""Returns a list of OS file names
***************
*** 126,129 ****
--- 125,129 ----
pass
return fnames
+ get_os_file_names = staticmethod( get_os_file_names )
def read_files( self, files, compilation_mode=COMPILATION_MODE.FILE_BY_FILE):
|