[pygccxml-commit] SF.net SVN: pygccxml: [1066] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-06-20 05:23:38
|
Revision: 1066 http://svn.sourceforge.net/pygccxml/?rev=1066&view=rev Author: roman_yakovenko Date: 2007-06-19 22:23:38 -0700 (Tue, 19 Jun 2007) Log Message: ----------- adding support to GCC-XML attributes Modified Paths: -------------- pygccxml_dev/docs/history/history.rest pygccxml_dev/pygccxml/declarations/calldef.py pygccxml_dev/pygccxml/declarations/declaration.py pygccxml_dev/pygccxml/parser/scanner.py pygccxml_dev/unittests/test_all.py Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2007-06-19 09:51:56 UTC (rev 1065) +++ pygccxml_dev/docs/history/history.rest 2007-06-20 05:23:38 UTC (rev 1066) @@ -19,6 +19,7 @@ * Gottfried Ganssauge * Gaetan Lehmann * Martin Preisler +* Miguel Lobo ----------- SVN Version @@ -27,6 +28,11 @@ 1. Class ``free_operator_t`` is now able to provide references to the class declarations instances it works on. +2. Support for `GCC-XML attributes`_ was added. Many thanks to Miguel Lobo for + the implementation. + +.. _`GCC-XML attributes`: http://www.gccxml.org/HTML/Running.html + ------------- Version 0.9.0 ------------- Modified: pygccxml_dev/pygccxml/declarations/calldef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/calldef.py 2007-06-19 09:51:56 UTC (rev 1065) +++ pygccxml_dev/pygccxml/declarations/calldef.py 2007-06-20 05:23:38 UTC (rev 1066) @@ -39,11 +39,12 @@ class, that describes argument of "callable" declaration """ - def __init__( self, name='', type=None, default_value=None ): + def __init__( self, name='', type=None, default_value=None, attributes=None ): object.__init__(self) self._name = name self._default_value = default_value self._type = type + self._attributes = attributes def clone( self, **keywd ): """constructs new argument_t instance @@ -54,7 +55,8 @@ """ return argument_t( name=keywd.get( 'name', self.name ) , type=keywd.get( 'type', self.type ) - , default_value=keywd.get( 'default_value', self.default_value ) ) + , default_value=keywd.get( 'default_value', self.default_value ) + , attributes=keywd.get( 'attributes', self.attributes ) ) def __str__(self): if self.default_value==None: @@ -102,7 +104,17 @@ type = property( _get_type, _set_type , doc="""The type of the argument. @type: L{type_t}""") + + def _get_attributes( self ): + return self._attributes + def _set_attributes( self, attributes ): + self._attributes = attributes + attributes = property( _get_attributes, _set_attributes + , doc="""GCCXML attributes, set using __attribute__((gccxml("..."))) + @type: str + """ ) + class calldef_t( declaration.declaration_t ): """base class for all "callable" declarations""" def __init__( self, name='', arguments=None, exceptions=None, return_type=None, has_extern=False, does_throw=True ): Modified: pygccxml_dev/pygccxml/declarations/declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/declaration.py 2007-06-19 09:51:56 UTC (rev 1065) +++ pygccxml_dev/pygccxml/declarations/declaration.py 2007-06-20 05:23:38 UTC (rev 1066) @@ -57,12 +57,13 @@ class declaration_t( object ): """base class for all classes that represent a C++ declaration""" - def __init__( self, name='', location=None, is_artificial=False, mangled=None, demangled=None ): + def __init__( self, name='', location=None, is_artificial=False, mangled=None, demangled=None, attributes=None ): self._name = name self._location = location self._is_artificial = is_artificial self._mangled = mangled self._demangled = demangled + self._attributes = attributes self._parent = None self._cache = algorithms_cache.declaration_algs_cache_t() @@ -218,6 +219,17 @@ @type: str """ ) + def _get_attributes( self ): + return self._attributes + def _set_attributes( self, attributes ): + self._attributes = attributes + attributes = property( _get_attributes, _set_attributes + , doc="""GCCXML attributes, set using __attribute__((gccxml("..."))) + @type: str + """ ) + + + def _create_decl_string(self): return algorithm.full_name( self ) Modified: pygccxml_dev/pygccxml/parser/scanner.py =================================================================== --- pygccxml_dev/pygccxml/parser/scanner.py 2007-06-19 09:51:56 UTC (rev 1065) +++ pygccxml_dev/pygccxml/parser/scanner.py 2007-06-20 05:23:38 UTC (rev 1066) @@ -19,6 +19,7 @@ XML_AN_ABSTRACT = "abstract" XML_AN_ACCESS = "access" XML_AN_ARTIFICIAL = "artificial" +XML_AN_ATTRIBUTES = "attributes" XML_AN_BASE_TYPE = "basetype" XML_AN_BASES = "bases" XML_AN_BITS = "bits" @@ -203,6 +204,7 @@ self.__read_artificial(obj, attrs) self.__read_mangled( obj, attrs) self.__read_demangled( obj, attrs) + self.__read_attributes(obj, attrs) elif isinstance( obj, type_t ): self.__types[ element_id ] = obj elif isinstance( obj, types.StringTypes ): @@ -246,6 +248,9 @@ def __read_demangled( self, decl, attrs ): decl.demangled = attrs.get( XML_AN_DEMANGLED, None ) + def __read_attributes( self, decl, attrs ): + decl.attributes = attrs.get( XML_AN_ATTRIBUTES, None ) + def __read_access( self, attrs ): self.__access[ attrs[XML_AN_ID] ] = attrs.get( XML_AN_ACCESS, ACCESS_TYPES.PUBLIC ) @@ -330,6 +335,7 @@ argument.name = attrs.get( XML_AN_NAME, 'arg%d' % len(self.__inst.arguments) ) argument.type = attrs[XML_AN_TYPE] argument.default_value = attrs.get( XML_AN_DEFAULT, None ) + self.__read_attributes( argument, attrs ) if argument.default_value == '<gccxml-cast-expr>': argument.default_value = None self.__inst.arguments.append( argument ) Modified: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2007-06-19 09:51:56 UTC (rev 1065) +++ pygccxml_dev/unittests/test_all.py 2007-06-20 05:23:38 UTC (rev 1066) @@ -43,6 +43,7 @@ import free_operators_tester import remove_template_defaults_tester import find_container_traits_tester +import attributes_tester def create_suite(): testers = [ @@ -85,6 +86,7 @@ , free_operators_tester , remove_template_defaults_tester , find_container_traits_tester + , attributes_tester ] main_suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |