pygccxml-commit Mailing List for C++ Python language bindings (Page 56)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(190) |
Apr
(166) |
May
(170) |
Jun
(75) |
Jul
(105) |
Aug
(131) |
Sep
(99) |
Oct
(84) |
Nov
(67) |
Dec
(54) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(66) |
Feb
(49) |
Mar
(25) |
Apr
(62) |
May
(21) |
Jun
(34) |
Jul
(9) |
Aug
(21) |
Sep
(5) |
Oct
|
Nov
(63) |
Dec
(34) |
2008 |
Jan
(10) |
Feb
(42) |
Mar
(26) |
Apr
(25) |
May
(6) |
Jun
(40) |
Jul
(18) |
Aug
(29) |
Sep
(6) |
Oct
(32) |
Nov
(14) |
Dec
(56) |
2009 |
Jan
(127) |
Feb
(52) |
Mar
(2) |
Apr
(10) |
May
(29) |
Jun
(3) |
Jul
|
Aug
(16) |
Sep
(4) |
Oct
(11) |
Nov
(8) |
Dec
(14) |
2010 |
Jan
(31) |
Feb
(1) |
Mar
(7) |
Apr
(9) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(8) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <al...@us...> - 2006-08-25 03:13:08
|
Revision: 466 Author: allenb Date: 2006-08-24 20:13:02 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=466&view=rev Log Message: ----------- - Attempt to fix some performance issues. I didn't get much if anything out of this attempt, but I wanted to show everyone else what I tried. Once it has been examined, my method (and commented out failed method) should be removed and replaced with a better way to do this. Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/class_declaration.py pygccxml_dev/pygccxml/declarations/declaration.py Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-25 03:01:16 UTC (rev 465) +++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-25 03:13:02 UTC (rev 466) @@ -101,21 +101,26 @@ self._private_members = [] self._protected_members = [] self._aliases = [] + self.__cached_demangled_name = None # Cached value of name from get_name_impl def _get_name_impl( self ): if not self._name: #class with empty name return self._name - if class_t.USE_DEMANGLED_AS_NAME and self.demangled: - fname = algorithm.full_name( self.parent ) - if fname.startswith( '::' ) and not self.demangled.startswith( '::' ): - fname = fname[2:] - if self.demangled.startswith( fname ): - tmp = self.demangled[ len( fname ): ] #demangled::name - if tmp.startswith( '::' ): - tmp = tmp[2:] - return tmp + elif class_t.USE_DEMANGLED_AS_NAME and self.demangled: + if self.__cached_demangled_name: + return self.__cached_demangled_name else: - return self._name + fname = algorithm.full_name( self.parent ) + if fname.startswith( '::' ) and not self.demangled.startswith( '::' ): + fname = fname[2:] + if self.demangled.startswith( fname ): + tmp = self.demangled[ len( fname ): ] #demangled::name + if tmp.startswith( '::' ): + tmp = tmp[2:] + self.__cached_demangled_name = tmp + else: + self.__cached_demangled_name = self._name + return self.__cached_demangled_name else: return self._name Modified: pygccxml_dev/pygccxml/declarations/declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-25 03:01:16 UTC (rev 465) +++ pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-25 03:13:02 UTC (rev 466) @@ -75,6 +75,8 @@ self._mangled = mangled self._demangled = demangled self._parent = None + + #self._cached_name = None def __str__(self): """Default __str__ method. @@ -149,6 +151,12 @@ return self._name def _get_name( self ): + #if self._cached_name: + # assert self._get_name_impl() == self._cached_name + # return self._cached_name + #else: + # self._cached_name = self._get_name_impl() + # return self._cached_name return self._get_name_impl() def _set_name( self, new_name ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-25 03:01:21
|
Revision: 465 Author: allenb Date: 2006-08-24 20:01:16 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=465&view=rev Log Message: ----------- - Track down performance killer in declaration_path method. This method is called so often that it eats up more time then anything else in my generation runs. This single change doubles the performance of pyplusplus for me. (713 seconds down to 356 seconds) Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/algorithm.py Modified: pygccxml_dev/pygccxml/declarations/algorithm.py =================================================================== --- pygccxml_dev/pygccxml/declarations/algorithm.py 2006-08-24 12:07:58 UTC (rev 464) +++ pygccxml_dev/pygccxml/declarations/algorithm.py 2006-08-25 03:01:16 UTC (rev 465) @@ -19,13 +19,18 @@ """ if not decl: return [] - result = [ decl.name ] - parent = decl.parent - while parent: - result.append( parent.name ) - parent = parent.parent - result.reverse() - return result + cached_decl_path = getattr(decl, "cached_decl_path", None) + if cached_decl_path: + return cached_decl_path + else: + result = [ decl.name ] + parent = decl.parent + while parent: + result.append( parent.name ) + parent = parent.parent + result.reverse() + setattr(decl, "cached_decl_path", result) + return result def full_name( decl ): """ @@ -74,7 +79,7 @@ decls.append( decl_or_decls ) answer = [] for decl in decls: - answer.extend( proceed_single( decl ) ) + answer.extend( proceed_single( decl ) ) return answer def __make_flatten_generator( decl_or_decls ): @@ -260,4 +265,4 @@ fname = 'visit_' + decl_inst.__class__.__name__[:-2] #removing '_t' from class name if not hasattr(visitor, fname ): raise visit_function_has_not_been_found_t( visitor, decl_inst ) - getattr( visitor, fname )() \ No newline at end of file + getattr( visitor, fname )() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 12:08:08
|
Revision: 464 Author: roman_yakovenko Date: 2006-08-24 05:07:58 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=464&view=rev Log Message: ----------- fixing documentation Modified Paths: -------------- pydsc_dev/pydsc.py Modified: pydsc_dev/pydsc.py =================================================================== --- pydsc_dev/pydsc.py 2006-08-24 10:55:11 UTC (rev 463) +++ pydsc_dev/pydsc.py 2006-08-24 12:07:58 UTC (rev 464) @@ -34,32 +34,43 @@ more complex example ( taken from pygccxml project ): import pydsc -#test only pygccxml -#package_directory defined earlier -pydsc.doc_checker.filter.append( package_directory ) -pydsc.doc_checker.filter_type = pydsc.FILTER_TYPE.INCLUDE -# -map( pydsc.doc_checker.speller.ignore_always - , [ 'org' - , 'http' - , 'bool' - , 'str' - , 'www' - , 'param' - , 'txt' - , 'decl' - , 'decls' - , 'namespace' - , 'enum' - , 'const' - , 'GCC' - , 'xcc' - , 'TODO' - , 'typedef' - , 'os' - , 'normcase' - , 'normpath' ] ) - +#check only pygccxml package +pydsc.include( r'D:\pygccxml_sources\sources\pygccxml_dev' ) +pydsc.ignore( [ 'Yakovenko' + , 'Bierbaum' + , 'org' + , 'http' + , 'bool' + , 'str' + , 'www' + , 'param' + , 'txt' + , 'decl' + , 'decls' + , 'namespace' + , 'namespaces' + , 'enum' + , 'const' + , 'GCC' + , 'xcc' + , 'TODO' + , 'typedef' + , 'os' + , 'normcase' + , 'normpath' + , 'scopedef' + , 'ira'#part of Matthias mail address + , 'uka'#part of Matthias mail address + , 'de'#part of Matthias mail address + , 'dat'#file extension of directory cache + , 'config'#parameter description + , 'gccxml'#parameter description + , 'Py++' + , 'pygccxml' + , 'calldef' + , 'XXX' + , 'wstring' + , 'py' ] ) """ __version__ = '0.2' #current version This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 10:55:22
|
Revision: 463 Author: roman_yakovenko Date: 2006-08-24 03:55:11 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=463&view=rev Log Message: ----------- small fix Modified Paths: -------------- pygccxml_dev/docs/history/history.rest pyplusplus_dev/docs/history/history.rest Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2006-08-24 07:40:55 UTC (rev 462) +++ pygccxml_dev/docs/history/history.rest 2006-08-24 10:55:11 UTC (rev 463) @@ -17,9 +17,9 @@ * Georgiy Dernovoy * Darren Garnier ------ -0.8.1 ------ +------------- +Version 0.8.1 +------------- 1. `pygccxml`_ has been ported to MacOS X. Many thanks to Darren Garnier! Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2006-08-24 07:40:55 UTC (rev 462) +++ pyplusplus_dev/docs/history/history.rest 2006-08-24 10:55:11 UTC (rev 463) @@ -32,9 +32,9 @@ 3. Users always changed the name of the projects. I saw at least 6 different names. ------ -0.8.1 ------ +------------- +Version 0.8.1 +------------- 1. Georgiy Dernovoy contributed a patch, which allows `Py++`_ GUI to save\\load last used header file. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 07:41:02
|
Revision: 462 Author: roman_yakovenko Date: 2006-08-24 00:40:55 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=462&view=rev Log Message: ----------- change pyplusplus to Py++ Modified Paths: -------------- pyplusplus_dev/README.txt Modified: pyplusplus_dev/README.txt =================================================================== --- pyplusplus_dev/README.txt 2006-08-24 07:37:39 UTC (rev 461) +++ pyplusplus_dev/README.txt 2006-08-24 07:40:55 UTC (rev 462) @@ -1,52 +1,52 @@ -pyplusplus - Boost.Python code generator -======================================== - -pyplusplus is a code generator for Boost.Python that simplifies writing -Python bindings of a C/C++ library. The tool is implemented as a Python -module which is controlled by a user script. - -Homepage: http://www.language-binding.net/pyplusplus/pyplusplus.html - - -Requirements ------------- - -In order to use pyplusplus you need the following additional components: - -- Python v2.4 (or higher) -- pygccxml (http://www.language-binding.net/pygccxml/pygccxml.html) -- GCC-XML (http://www.gccxml.org) - - -Install -------- - -The package uses the Python distutils so you can do the usual procedure: - - python setup.py install - -For more information about using the distutils see the Python manual -"Installing Python Modules". - - -Documentation -------------- - -For examples and tutorials see the pyplusplus web site. An API reference -is available in the directory docs/apidocs in the source archive. - -If you obtained the source code from the subversion repository you -have to build the API reference yourself. This can be done using the -setup script: - - python setup.py doc - -In order for this to work you need epydoc (http://epydoc.sourceforge.net) -and pygccxml. - - --------------------------------------------------------------------------- -Copyright 2004 Roman Yakovenko. -Distributed under the Boost Software License, Version 1.0. (See -accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) +Py++ - Boost.Python code generator +======================================== + +Py++ is a code generator for Boost.Python that simplifies writing +Python bindings of a C/C++ library. The tool is implemented as a Python +module which is controlled by a user script. + +Homepage: http://www.language-binding.net/pyplusplus/pyplusplus.html + + +Requirements +------------ + +In order to use Py++ you need the following additional components: + +- Python v2.4 (or higher) +- pygccxml (http://www.language-binding.net/pygccxml/pygccxml.html) +- GCC-XML (http://www.gccxml.org) + + +Install +------- + +The package uses the Python distutils so you can do the usual procedure: + + python setup.py install + +For more information about using the distutils see the Python manual +"Installing Python Modules". + + +Documentation +------------- + +For examples and tutorials see the Py++ web site. An API reference +is available in the directory docs/apidocs in the source archive. + +If you obtained the source code from the subversion repository you +have to build the API reference yourself. This can be done using the +setup script: + + python setup.py doc + +In order for this to work you need epydoc (http://epydoc.sourceforge.net) +and pygccxml. + + +-------------------------------------------------------------------------- +Copyright 2004 Roman Yakovenko. +Distributed under the Boost Software License, Version 1.0. (See +accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 07:37:45
|
Revision: 461 Author: roman_yakovenko Date: 2006-08-24 00:37:39 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=461&view=rev Log Message: ----------- updating MANIFEST.in Modified Paths: -------------- pyplusplus_dev/MANIFEST.in Modified: pyplusplus_dev/MANIFEST.in =================================================================== --- pyplusplus_dev/MANIFEST.in 2006-08-24 07:09:38 UTC (rev 460) +++ pyplusplus_dev/MANIFEST.in 2006-08-24 07:37:39 UTC (rev 461) @@ -1,19 +1,54 @@ -include LICENSE_1_0.txt -include MANIFEST.in -include unittests/*.py -include unittests/data/*.hpp -include unittests/data/*.cpp -recursive-include docs/apidocs *.css -recursive-include docs/apidocs *.html -include docs/*.rest -include docs/*.png -include docs/*.html -include docs/comparisons/* -recursive-include docs/examples * -include docs/history/* -include docs/logos/* -include docs/tutorials/* -prune docs/*/.svn -prune docs/*/*/.svn -recursive-include examples * -recursive-include contrib *.py *.txt +include LICENSE_1_0.txt +include MANIFEST.in +include unittests/*.py +include unittests/data/*.hpp +include unittests/data/*.cpp +recursive-include docs/apidocs *.css +recursive-include docs/apidocs *.html +include docs/*.rest +include docs/*.png +include docs/*.html +include docs/comparisons/* +recursive-include docs/examples * +include docs/history/* +include docs/logos/* +include docs/tutorials/* +prune docs/*/.svn +prune docs/*/*/.svn + +prune examples/custom_code_creator/*/.svn +prune examples/custom_code_creator/generated/*/.svn +prune examples/custom_code_creator/unittests/*/.svn +prune examples/pyboost_dev/*/.svn +prune examples/pyboost_dev/dev/*/.svn +prune examples/pyboost_dev/dev/boost_random/*/.svn +prune examples/pyboost_dev/dev/crc/*/.svn +prune examples/pyboost_dev/dev/date_time/*/.svn +prune examples/pyboost_dev/dev/date_time/include/*/.svn +prune examples/pyboost_dev/dev/rational/*/.svn +prune examples/pyboost_dev/pyboost/*/.svn +prune examples/pyboost_dev/pyboost/boost_random/*/.svn +prune examples/pyboost_dev/pyboost/crc/*/.svn +prune examples/pyboost_dev/pyboost/date_time/*/.svn +prune examples/pyboost_dev/pyboost/rational/*/.svn +prune examples/pyboost_dev/unittestst/boost_random/*/.svn +prune examples/pyboost_dev/unittestst/crc/*/.svn +prune examples/pyboost_dev/unittestst/date_time/*/.svn +prune examples/pyboost_dev/unittestst/date_time/include/*/.svn +prune examples/pyboost_dev/unittestst/rational/*/.svn +prune examples/pyeasybmp_dev/*/.svn +prune examples/pyeasybmp_dev/pyeasybmp/*/.svn +prune examples/pyeasybmp_dev/pyeasybmp/generated/*/.svn +prune examples/pyeasybmp_dev/unittests/*/.svn + +prune examples/indexing_suite_v2/*/.svn +prune examples/indexing_suite_v2/docs/*/.svn +prune examples/indexing_suite_v2/docs/indexing_suite_v2_files/*/.svn +prune examples/indexing_suite_v2/indexing/*/.svn +prune examples/indexing_suite_v2/src/*/.svn +prune examples/indexing_suite_v2/src/indexing/*/.svn +prune examples/indexing_suite_v2/unittests/*/.svn + + +recursive-include examples * +recursive-include contrib *.py *.txt This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 07:09:49
|
Revision: 460 Author: roman_yakovenko Date: 2006-08-24 00:09:38 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=460&view=rev Log Message: ----------- adding mainfest for pyboost adding script that checks links of generated web pages Added Paths: ----------- developer_scripts/check_links.bat pyplusplus_dev/examples/pyboost_dev/MANIFEST.in Added: developer_scripts/check_links.bat =================================================================== --- developer_scripts/check_links.bat (rev 0) +++ developer_scripts/check_links.bat 2006-08-24 07:09:38 UTC (rev 460) @@ -0,0 +1 @@ +e:\python24\python.exe e:\python24\Scripts\linkchecker ..\..\language-binding\production\www\index.html Added: pyplusplus_dev/examples/pyboost_dev/MANIFEST.in =================================================================== --- pyplusplus_dev/examples/pyboost_dev/MANIFEST.in (rev 0) +++ pyplusplus_dev/examples/pyboost_dev/MANIFEST.in 2006-08-24 07:09:38 UTC (rev 460) @@ -0,0 +1,6 @@ +include LICENSE_1_0.txt +recursive-include dev/*.py +recursive-include dev/*.hpp +recursive-include dev/sconscript* +prune dev/*/.svn + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 07:08:48
|
Revision: 459 Author: roman_yakovenko Date: 2006-08-24 00:08:38 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=459&view=rev Log Message: ----------- adding license and permissions.txt to doc_extractors Added Paths: ----------- pyplusplus_dev/contrib/doc_extractors/LICENSE_1_0.txt pyplusplus_dev/contrib/doc_extractors/permissions.txt Added: pyplusplus_dev/contrib/doc_extractors/LICENSE_1_0.txt =================================================================== --- pyplusplus_dev/contrib/doc_extractors/LICENSE_1_0.txt (rev 0) +++ pyplusplus_dev/contrib/doc_extractors/LICENSE_1_0.txt 2006-08-24 07:08:38 UTC (rev 459) @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. Added: pyplusplus_dev/contrib/doc_extractors/permissions.txt =================================================================== (Binary files differ) Property changes on: pyplusplus_dev/contrib/doc_extractors/permissions.txt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 07:04:50
|
Revision: 458 Author: roman_yakovenko Date: 2006-08-24 00:04:43 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=458&view=rev Log Message: ----------- adding MANIFEST.in file for pydsc Added Paths: ----------- pydsc_dev/MANIFEST.in Added: pydsc_dev/MANIFEST.in =================================================================== --- pydsc_dev/MANIFEST.in (rev 0) +++ pydsc_dev/MANIFEST.in 2006-08-24 07:04:43 UTC (rev 458) @@ -0,0 +1,8 @@ +include LICENSE_1_0.txt +include MANIFEST.in +include unittests/*.py +include unittests/do_not_check/*.py +recursive-include docs/apidocs *.css +recursive-include docs/apidocs *.html +include docs/*.rest +prune docs/*/.svn This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 07:01:57
|
Revision: 457 Author: roman_yakovenko Date: 2006-08-24 00:01:49 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=457&view=rev Log Message: ----------- adding pydsc apidocs configuration to repository Added Paths: ----------- pydsc_dev/docs/apidocs/ pydsc_dev/docs/apidocs/www_configuration.py Added: pydsc_dev/docs/apidocs/www_configuration.py =================================================================== --- pydsc_dev/docs/apidocs/www_configuration.py (rev 0) +++ pydsc_dev/docs/apidocs/www_configuration.py 2006-08-24 07:01:49 UTC (rev 457) @@ -0,0 +1,2 @@ +name = 'API docs' +main_html_file = 'index.html' \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 06:53:30
|
Revision: 456 Author: roman_yakovenko Date: 2006-08-23 23:53:24 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=456&view=rev Log Message: ----------- updating history.rest Modified Paths: -------------- pygccxml_dev/docs/history/history.rest Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2006-08-24 06:40:11 UTC (rev 455) +++ pygccxml_dev/docs/history/history.rest 2006-08-24 06:53:24 UTC (rev 456) @@ -108,6 +108,18 @@ 11. Documentation was improved. +12. ``mdecl_wrapper_t.decls`` property was renamed to ``declarations``. + The reason is that the current name ( ``decls`` ) conflicts with the method + of the same name in the decl interface from ``declarations.scopedef_t`` class. + + So for example: + :: + + classes = ns.decls("class") + classes.decls("method") + + This will fail because it finds the attribute decls which is not a callable. + ----------- Version 0.8 ----------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-24 06:40:17
|
Revision: 455 Author: roman_yakovenko Date: 2006-08-23 23:40:11 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=455&view=rev Log Message: ----------- fixing __ensure_attribute bug Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py Modified: pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py =================================================================== --- pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py 2006-08-23 23:32:51 UTC (rev 454) +++ pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py 2006-08-24 06:40:11 UTC (rev 455) @@ -47,25 +47,25 @@ @type decls: list of L{declaration wrappers<decl_wrapper_t>} """ object.__init__( self ) - self.__dict__['decls'] = decls + self.__dict__['declarations'] = decls def __nonzero__( self ): - return bool( self.decls ) + return bool( self.declarations ) def __len__( self ): """returns the number of declarations""" - return len( self.decls ) + return len( self.declarations ) def __getitem__( self, index ): """provides access to declaration""" - return self.decls[index] + return self.declarations[index] def __iter__( self ): - return iter(self.decls) + return iter(self.declarations) def __ensure_attribute( self, name ): - invalid_decls = filter( lambda d: not hasattr( d, name ), self.decls ) - if False in invalid_decls: + invalid_decls = filter( lambda d: not hasattr( d, name ), self.declarations ) + if invalid_decls: raise RuntimeError( "Not all declarations have '%s' attribute." % name ) def __setattr__( self, name, value ): @@ -74,13 +74,13 @@ @param value: new value of attribute """ self.__ensure_attribute( name ) - for d in self.decls: + for d in self.declarations: setattr( d, name, value ) def __getattr__( self, name ): """@param name: name of method """ - return call_redirector_t( name, self.decls ) + return call_redirector_t( name, self.declarations ) def __contains__( self, item ): - return item in self.decls + return item in self.declarations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 23:32:54
|
Revision: 454 Author: allenb Date: 2006-08-23 16:32:51 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=454&view=rev Log Message: ----------- Import everything new. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/__init__.py Modified: pyplusplus_dev/contrib/goodies/__init__.py =================================================================== --- pyplusplus_dev/contrib/goodies/__init__.py 2006-08-23 23:32:40 UTC (rev 453) +++ pyplusplus_dev/contrib/goodies/__init__.py 2006-08-23 23:32:51 UTC (rev 454) @@ -6,7 +6,11 @@ # Authors: # Allen Bierbaum # + +#import goodie_overrides + +from goodie_utils import (set_recursive_default, set_allow_empty_mdecl_default, + finalize, add_member_function, wrap_method, add_method, + is_const_ref, exclude_protected, wrap_const_ref_params) + from dsl_interface import * -from goodie_utils import (set_recursive_default, finalize, add_member_function, - wrap_method, add_method, is_const_ref, exclude_protected, - wrap_const_ref_params) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 23:32:43
|
Revision: 453 Author: allenb Date: 2006-08-23 16:32:40 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=453&view=rev Log Message: ----------- Add new file that will be used to override the default behavior of pyplusplus methods and classes. (Python is so nice. :) Added Paths: ----------- pyplusplus_dev/contrib/goodies/goodie_overrides.py Added: pyplusplus_dev/contrib/goodies/goodie_overrides.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_overrides.py (rev 0) +++ pyplusplus_dev/contrib/goodies/goodie_overrides.py 2006-08-23 23:32:40 UTC (rev 453) @@ -0,0 +1,62 @@ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# Authors: +# Allen Bierbaum +# +# This file defines overrides to the standard pyplusplus behavior +# + +# --- Over ride the behavior of mdecl_wrapper ---- # +import pygccxml.declarations.mdecl_wrapper as mdecl_wrapper +pd = pygccxml.declarations + +# Define the call redirector so it can return arguments +# This method will now return multiple arguments by +# concatenating the arguments returned from the individual calls. +# If the returns arguments are delcarations, then it will wrap them +# to create an mdecl holder. +def new_call_redirector_t__call__(self, *arguments, **keywords): + results = [] + for d in self.decls: + callable_ = getattr(d, self.name) + answer = callable_( *arguments, **keywords ) + results.append( answer ) + + #I assume that all functions will return same type: + if not results: + return + + # If all elements are a decl type + # - Extract all decls and make a new decl wrapper + if not False in [isinstance(x,(pd.declaration_t,pd.mdecl_wrapper_t)) for x in results]: + all_decls = [] + for x in results: + if isinstance( x, declaration.declaration_t ): + all_decls.append(x) + elif isinstance( x, mdecl_wrapper_t ): + all_decls.extend(x.decls) + else: + assert False, "Should not get here" + return mdecl_wrapper_t( all_decls ) + # Otherwise, just return the list + else: + return results + +mdecl_wrapper.call_redirector_t.__call__ = new_call_redirector_t__call__ + +# Override the mdecl_wrapper_t.__getitem__ method + +def new_mdecl_wrapper_t__getitem__(self,index): + """Provide access to declaration. + If passed a standard index, then return contained decl. + Else call the getitem method of the contained decls. + """ + if isinstance(index, (int, slice)): + return self.decls[index] + else: + return self.__getattr__("__getitem__")(index) +mdecl_wrapper.mdecl_wrapper_t.__getitem__ = new_mdecl_wrapper_t__getitem__ + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 23:32:00
|
Revision: 452 Author: allenb Date: 2006-08-23 16:31:55 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=452&view=rev Log Message: ----------- Add method to override allow empty setting. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/goodie_utils.py Modified: pyplusplus_dev/contrib/goodies/goodie_utils.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-23 23:30:51 UTC (rev 451) +++ pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-23 23:31:55 UTC (rev 452) @@ -18,6 +18,8 @@ def set_recursive_default(val): pd.scopedef_t.RECURSIVE_DEFAULT = val +def set_allow_empty_mdecl_default(val): + pd.scopedef_t.ALLOW_EMPTY_MDECL_WRAPPER = val def finalize(cls): """ Attempt to finalize a class by not exposing virtual methods. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 23:30:55
|
Revision: 451 Author: allenb Date: 2006-08-23 16:30:51 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=451&view=rev Log Message: ----------- I *think* this fixes a bug. As far as I can tell with Python 2.4 atleast bool([False,True]) is still true so the logic of this test was not working. Please review this commit to verify that I have fixed something though. Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py Modified: pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py =================================================================== --- pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py 2006-08-23 23:29:13 UTC (rev 450) +++ pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py 2006-08-23 23:30:51 UTC (rev 451) @@ -65,7 +65,7 @@ def __ensure_attribute( self, name ): invalid_decls = filter( lambda d: not hasattr( d, name ), self.decls ) - if invalid_decls: + if False in invalid_decls: raise RuntimeError( "Not all declarations have '%s' attribute." % name ) def __setattr__( self, name, value ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 23:29:17
|
Revision: 450 Author: allenb Date: 2006-08-23 16:29:13 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=450&view=rev Log Message: ----------- Add enum work around flag. Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/calldef.py Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-08-23 22:18:27 UTC (rev 449) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-08-23 23:29:13 UTC (rev 450) @@ -16,6 +16,7 @@ #will be reference to no where - access violetion. #For example see temporal variable tester +use_enum_workaround = False #TODO: #Add to docs: @@ -59,6 +60,10 @@ and declarations.is_integral( arg_type_no_alias ) \ and not arg.default_value.startswith( arg_type_no_alias.decl_string ): result.append( '=(%s)(%s)' % ( arg_type_no_alias.decl_string, arg.default_value ) ) + elif use_enum_workaround and declarations.is_enum( arg.type ): + #Work around for bug/missing functionality in boost.python. + #registration order + result.append( '=(long)(%s)' % arg.default_value ) else: result.append( '=%s' % arg.default_value ) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 22:18:33
|
Revision: 449 Author: allenb Date: 2006-08-23 15:18:27 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=449&view=rev Log Message: ----------- Fix method and change the tab spacing back to 3 spaces. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/goodie_utils.py Modified: pyplusplus_dev/contrib/goodies/goodie_utils.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-23 19:42:04 UTC (rev 448) +++ pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-23 22:18:27 UTC (rev 449) @@ -12,113 +12,118 @@ import pygccxml.declarations.cpptypes as cpptypes import pyplusplus.code_creators as code_creators import pyplusplus.decl_wrappers as decl_wrappers +import copy def set_recursive_default(val): - pd.scopedef_t.RECURSIVE_DEFAULT = val + pd.scopedef_t.RECURSIVE_DEFAULT = val -#[Roman]The better way is to turn virtuality from virtual to non virtual + def finalize(cls): - """ Attempt to finalize a class by not exposing virtual methods. - Still exposes in the case of pure virtuals otherwise the class - could not be instantiated. - """ - members = cls.decls( pd.virtuality_type_matcher( pd.VIRTUALITY_TYPES.VIRTUAL ) - , decl_type=pd.member_calldef_t - , allow_empty=True) - members.set_virtuality( pd.VIRTUALITY_TYPES.NOT_VIRTUAL ) + """ Attempt to finalize a class by not exposing virtual methods. + Still exposes in the case of pure virtuals otherwise the class + could not be instantiated. + """ + if isinstance(cls, pd.mdecl_wrapper_t): + for x in cls: + finalize(x) + else: + members = cls.decls( pd.virtuality_type_matcher( pd.VIRTUALITY_TYPES.VIRTUAL ) + , decl_type=pd.member_calldef_t + , allow_empty=True) + members.set_virtuality( pd.VIRTUALITY_TYPES.NOT_VIRTUAL ) def add_member_function(cls, methodName, newMethod): - """ Add a member function to the class. """ - cls.add_registration_code('def("%s",%s)'%(methodName, newMethod), True) + """ Add a member function to the class. """ + cls.add_registration_code('def("%s",%s)'%(methodName, newMethod), True) def wrap_method(cls, methodName, newMethod): - """ Wrap a class method with a new method. - ex: c.wrapmethod(c,"doSomething","doSomethingWrapper") - """ - cls[methodName].exclude() - add_member_function(cls, methodName, newMethod) + """ Wrap a class method with a new method. + ex: c.wrapmethod(c,"doSomething","doSomethingWrapper") + """ + cls[methodName].exclude() + add_member_function(cls, methodName, newMethod) def add_method(moduleBuilder, methodName, method): - """ Add a method to the module builder. """ - code_text = 'boost::python::def("%s",%s);'%(methodName, method) - moduleBuilder.code_creator.body.adopt_creator( code_creators.custom_text_t( code_text ), 0 ) - #[Roman]moduleBuilder.add_registration_code( ... ), see relevant documentation - #This will add have exactly same effect as a previous line, also you don't - #have to build code creator first + """ Add a method to the module builder. """ + code_text = 'boost::python::def("%s",%s);'%(methodName, method) + moduleBuilder.code_creator.body.adopt_creator( code_creators.custom_text_t( code_text ), 0 ) + #[Roman]moduleBuilder.add_registration_code( ... ), see relevant documentation + #This will add have exactly same effect as a previous line, also you don't + #have to build code creator first def is_const_ref(type): - """ Extra trait tester method to check if something is a const reference. """ - is_const = tt.is_const(type) or (hasattr(type,'base') and tt.is_const(type.base)) - is_ref = tt.is_reference(type) or (hasattr(type,'base') and tt.is_reference(type.base)) - return (is_ref and is_const) - #[Roman]If you create unit tests for this code, I will add it to type traits module + """ Extra trait tester method to check if something is a const reference. """ + is_const = tt.is_const(type) or (hasattr(type,'base') and tt.is_const(type.base)) + is_ref = tt.is_reference(type) or (hasattr(type,'base') and tt.is_reference(type.base)) + return (is_ref and is_const) + #[Roman]If you create unit tests for this code, I will add it to type traits module def exclude_protected(cls): - """ Exclude all protected declarations. """ - cls.decls(pd.access_type_matcher_t('protected'),allow_empty=True).exclude() + """ Exclude all protected declarations. """ + cls.decls(pd.access_type_matcher_t('protected'),allow_empty=True).exclude() def wrap_const_ref_params(cls): - """ Find all member functions of cls and if they take a const& to a class - that does not have a destructor, then create a thin wrapper for them. - This works around an issue with boost.python where it needs a destructor. - """ - #[Roman] Obviously, this will only work, if the function does not need other - #wrapper, I think, this is a new use case for Matthias "arguments policies" - #functionality. - calldefs = cls.calldefs() + """ Find all member functions of cls and if they take a const& to a class + that does not have a destructor, then create a thin wrapper for them. + This works around an issue with boost.python where it needs a destructor. + """ + #[Roman] Obviously, this will only work, if the function does not need other + #wrapper, I think, this is a new use case for Matthias "arguments policies" + #functionality. + calldefs = cls.calldefs() - if None == calldefs: - return + if None == calldefs: + return - for c in calldefs: - # Skip constructors - if isinstance(c, pd.constructor_t): - continue + for c in calldefs: + # Skip constructors + if isinstance(c, pd.constructor_t): + continue - # Find arguments that need replacing - args_to_replace = [] # List of indices to args to replace with wrapping - args = c.arguments - for i in range(len(args)): - arg = args[i] - if is_const_ref(arg.type): - naked_arg = tt.remove_cv(tt.remove_reference(arg.type)) - if tt.is_class(naked_arg): - class_type = naked_arg.declaration - if not tt.has_public_destructor(class_type): - print "Found indestructible const& arg: [%s]:[%s] "%(str(c), str(arg)) - args_to_replace.append(i) + # Find arguments that need replacing + args_to_replace = [] # List of indices to args to replace with wrapping + args = c.arguments + for i in range(len(args)): + arg = args[i] + if is_const_ref(arg.type): + naked_arg = tt.remove_cv(tt.remove_reference(arg.type)) + if tt.is_class(naked_arg): + class_type = naked_arg.declaration + if not tt.has_public_destructor(class_type): + print "Found indestructible const& arg: [%s]:[%s] "%(str(c), str(arg)) + args_to_replace.append(i) - # Now replace arguments - if len(args_to_replace): - if isinstance(c, pd.operator_t) and c.symbol in ["<","==","!=","="]: - c.exclude() - continue + # Now replace arguments + if len(args_to_replace): + if isinstance(c, pd.operator_t) and c.symbol in ["<","==","!=","="]: + c.exclude() + continue - new_args = copy.copy(args) # Make new copy of args so we don't modify the existing method - for i in args_to_replace: - old_arg_type = args[i].type - if tt.is_reference(old_arg_type) and tt.is_const(old_arg_type.base): - new_args[i].type = cpptypes.reference_t(tt.remove_const(old_arg_type.base)) - elif tt.is_const(old_arg): - new_args[i].type = tt.remove_const(old_arg_type) + new_args = copy.copy(args) # Make new copy of args so we don't modify the existing method + for i in args_to_replace: + old_arg_type = args[i].type + if tt.is_reference(old_arg_type) and tt.is_const(old_arg_type.base): + new_args[i].type = cpptypes.reference_t(tt.remove_const(old_arg_type.base)) + elif tt.is_const(old_arg): + new_args[i].type = tt.remove_const(old_arg_type) - new_name = "%s_const_ref_wrapper"%c.name - args_str = [str(a) for a in new_args] - arg_names_str = [str(a.name) for a in new_args] - new_sig = "static %s %s(%s& self_arg, %s)"%(c.return_type,new_name,cls.name,",".join(args_str)) - new_method = """%s - { return self_arg.%s(%s); } - """%(new_sig,c.name,",".join(arg_names_str)) + new_name = "%s_const_ref_wrapper"%c.name + args_str = [str(a) for a in new_args] + arg_names_str = [str(a.name) for a in new_args] + new_sig = "static %s %s(%s& self_arg, %s)"%(c.return_type,new_name,cls.name,",".join(args_str)) + new_method = """%s + { return self_arg.%s(%s); } + """%(new_sig,c.name,",".join(arg_names_str)) - # Add it all - c.exclude() - - #[Roman] you can use cls.add_declaration_code, this could simplify the - #wrapper ou created, because it will generate the code within the source - #file, the class is generated - cls.add_wrapper_code(new_method) - - cls.add_code('def("%s", &%s::%s);'%(c.name, cls.wrapper_alias,new_name)) + # Add it all + c.exclude() + + #[Roman] you can use cls.add_declaration_code, this could simplify the + #wrapper you created, because it will generate the code within the source + #file, the class is generated + cls.add_wrapper_code(new_method) + + cls.add_code('def("%s", &%s::%s);'%(c.name, cls.wrapper_alias,new_name)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 19:42:08
|
Revision: 448 Author: allenb Date: 2006-08-23 12:42:04 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=448&view=rev Log Message: ----------- Now move the code over to just importing from the declarations package. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/dsl_interface.py Modified: pyplusplus_dev/contrib/goodies/dsl_interface.py =================================================================== --- pyplusplus_dev/contrib/goodies/dsl_interface.py 2006-08-23 19:39:22 UTC (rev 447) +++ pyplusplus_dev/contrib/goodies/dsl_interface.py 2006-08-23 19:42:04 UTC (rev 448) @@ -26,8 +26,13 @@ # Matchers # - Bring in all matchers but rename then without the '_t' at the end import pygccxml.declarations.matchers -for n in ["matcher_base_t","or_matcher_t","and_matcher_t","not_matcher_t", - "declaration_matcher_t","calldef_matcher_t","namespace_matcher_t", - "variable_matcher_t","regex_matcher_t","access_type_matcher_t", - "operator_matcher_t","custom_matcher_t","virtuality_type_matcher_t"]: - mod_dict[n[:-2]] = pygccxml.declarations.matchers.__dict__[n] +#for n in ["matcher_base_t","or_matcher_t","and_matcher_t","not_matcher_t", +# "declaration_matcher_t","calldef_matcher_t","namespace_matcher_t", +# "variable_matcher_t","regex_matcher_t","access_type_matcher_t", +# "operator_matcher_t","custom_matcher_t","virtuality_type_matcher_t"]: +# mod_dict[n[:-2]] = pygccxml.declarations.matchers.__dict__[n] + +from pygccxml.declarations import (or_matcher, and_matcher, not_matcher, declaration_matcher, + calldef_matcher, namespace_matcher, variable_matcher, + regex_matcher, access_type_matcher, operator_matcher, + custom_matcher, virtuality_type_matcher) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 19:39:24
|
Revision: 447 Author: allenb Date: 2006-08-23 12:39:22 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=447&view=rev Log Message: ----------- Bring back code to bring matchers into our namespace. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/dsl_interface.py Modified: pyplusplus_dev/contrib/goodies/dsl_interface.py =================================================================== --- pyplusplus_dev/contrib/goodies/dsl_interface.py 2006-08-23 19:36:58 UTC (rev 446) +++ pyplusplus_dev/contrib/goodies/dsl_interface.py 2006-08-23 19:39:22 UTC (rev 447) @@ -22,3 +22,12 @@ # Type traits + +# Matchers +# - Bring in all matchers but rename then without the '_t' at the end +import pygccxml.declarations.matchers +for n in ["matcher_base_t","or_matcher_t","and_matcher_t","not_matcher_t", + "declaration_matcher_t","calldef_matcher_t","namespace_matcher_t", + "variable_matcher_t","regex_matcher_t","access_type_matcher_t", + "operator_matcher_t","custom_matcher_t","virtuality_type_matcher_t"]: + mod_dict[n[:-2]] = pygccxml.declarations.matchers.__dict__[n] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-23 19:37:06
|
Revision: 446 Author: allenb Date: 2006-08-23 12:36:58 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=446&view=rev Log Message: ----------- Set to native EOL. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/__init__.py pyplusplus_dev/contrib/goodies/dsl_interface.py pyplusplus_dev/contrib/goodies/goodie_utils.py Property Changed: ---------------- pyplusplus_dev/contrib/goodies/__init__.py pyplusplus_dev/contrib/goodies/dsl_interface.py pyplusplus_dev/contrib/goodies/goodie_utils.py Modified: pyplusplus_dev/contrib/goodies/__init__.py =================================================================== --- pyplusplus_dev/contrib/goodies/__init__.py 2006-08-23 19:32:37 UTC (rev 445) +++ pyplusplus_dev/contrib/goodies/__init__.py 2006-08-23 19:36:58 UTC (rev 446) @@ -1,12 +1,12 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) -# -# Authors: -# Allen Bierbaum -# -from dsl_interface import * -from goodie_utils import (set_recursive_default, finalize, add_member_function, - wrap_method, add_method, is_const_ref, exclude_protected, - wrap_const_ref_params) +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# Authors: +# Allen Bierbaum +# +from dsl_interface import * +from goodie_utils import (set_recursive_default, finalize, add_member_function, + wrap_method, add_method, is_const_ref, exclude_protected, + wrap_const_ref_params) Property changes on: pyplusplus_dev/contrib/goodies/__init__.py ___________________________________________________________________ Name: svn:eol-style + native Modified: pyplusplus_dev/contrib/goodies/dsl_interface.py =================================================================== --- pyplusplus_dev/contrib/goodies/dsl_interface.py 2006-08-23 19:32:37 UTC (rev 445) +++ pyplusplus_dev/contrib/goodies/dsl_interface.py 2006-08-23 19:36:58 UTC (rev 446) @@ -1,24 +1,24 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) -# -# Authors: -# Allen Bierbaum -# - -# Dictionary of this module. Useful for adding symbols -mod_dict = globals() - -# Bring in the module builder and alias it -import pyplusplus.module_builder -ModuleBuilder = pyplusplus.module_builder.module_builder_t -set_logger_level = pyplusplus.module_builder.set_logger_level - -# Bring in all call policy symbols -from pyplusplus.module_builder.call_policies import * - -from pyplusplus.decl_wrappers import print_declarations - - -# Type traits +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# Authors: +# Allen Bierbaum +# + +# Dictionary of this module. Useful for adding symbols +mod_dict = globals() + +# Bring in the module builder and alias it +import pyplusplus.module_builder +ModuleBuilder = pyplusplus.module_builder.module_builder_t +set_logger_level = pyplusplus.module_builder.set_logger_level + +# Bring in all call policy symbols +from pyplusplus.module_builder.call_policies import * + +from pyplusplus.decl_wrappers import print_declarations + + +# Type traits Property changes on: pyplusplus_dev/contrib/goodies/dsl_interface.py ___________________________________________________________________ Name: svn:eol-style + native Modified: pyplusplus_dev/contrib/goodies/goodie_utils.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-23 19:32:37 UTC (rev 445) +++ pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-23 19:36:58 UTC (rev 446) @@ -1,124 +1,124 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) -# -# Authors: -# Allen Bierbaum -# -import pygccxml.declarations as pd -from pyplusplus.module_builder.call_policies import * -import pygccxml.declarations.type_traits as tt -import pygccxml.declarations.cpptypes as cpptypes -import pyplusplus.code_creators as code_creators -import pyplusplus.decl_wrappers as decl_wrappers - - -def set_recursive_default(val): - pd.scopedef_t.RECURSIVE_DEFAULT = val - -#[Roman]The better way is to turn virtuality from virtual to non virtual -def finalize(cls): - """ Attempt to finalize a class by not exposing virtual methods. - Still exposes in the case of pure virtuals otherwise the class - could not be instantiated. - """ - members = cls.decls( pd.virtuality_type_matcher( pd.VIRTUALITY_TYPES.VIRTUAL ) - , decl_type=pd.member_calldef_t - , allow_empty=True) - members.set_virtuality( pd.VIRTUALITY_TYPES.NOT_VIRTUAL ) - - -def add_member_function(cls, methodName, newMethod): - """ Add a member function to the class. """ - cls.add_registration_code('def("%s",%s)'%(methodName, newMethod), True) - -def wrap_method(cls, methodName, newMethod): - """ Wrap a class method with a new method. - ex: c.wrapmethod(c,"doSomething","doSomethingWrapper") - """ - cls[methodName].exclude() - add_member_function(cls, methodName, newMethod) - -def add_method(moduleBuilder, methodName, method): - """ Add a method to the module builder. """ - code_text = 'boost::python::def("%s",%s);'%(methodName, method) - moduleBuilder.code_creator.body.adopt_creator( code_creators.custom_text_t( code_text ), 0 ) - #[Roman]moduleBuilder.add_registration_code( ... ), see relevant documentation - #This will add have exactly same effect as a previous line, also you don't - #have to build code creator first - - -def is_const_ref(type): - """ Extra trait tester method to check if something is a const reference. """ - is_const = tt.is_const(type) or (hasattr(type,'base') and tt.is_const(type.base)) - is_ref = tt.is_reference(type) or (hasattr(type,'base') and tt.is_reference(type.base)) - return (is_ref and is_const) - #[Roman]If you create unit tests for this code, I will add it to type traits module - -def exclude_protected(cls): - """ Exclude all protected declarations. """ - cls.decls(pd.access_type_matcher_t('protected'),allow_empty=True).exclude() - -def wrap_const_ref_params(cls): - """ Find all member functions of cls and if they take a const& to a class - that does not have a destructor, then create a thin wrapper for them. - This works around an issue with boost.python where it needs a destructor. - """ - #[Roman] Obviously, this will only work, if the function does not need other - #wrapper, I think, this is a new use case for Matthias "arguments policies" - #functionality. - calldefs = cls.calldefs() - - if None == calldefs: - return - - for c in calldefs: - # Skip constructors - if isinstance(c, pd.constructor_t): - continue - - # Find arguments that need replacing - args_to_replace = [] # List of indices to args to replace with wrapping - args = c.arguments - for i in range(len(args)): - arg = args[i] - if is_const_ref(arg.type): - naked_arg = tt.remove_cv(tt.remove_reference(arg.type)) - if tt.is_class(naked_arg): - class_type = naked_arg.declaration - if not tt.has_public_destructor(class_type): - print "Found indestructible const& arg: [%s]:[%s] "%(str(c), str(arg)) - args_to_replace.append(i) - - # Now replace arguments - if len(args_to_replace): - if isinstance(c, pd.operator_t) and c.symbol in ["<","==","!=","="]: - c.exclude() - continue - - new_args = copy.copy(args) # Make new copy of args so we don't modify the existing method - for i in args_to_replace: - old_arg_type = args[i].type - if tt.is_reference(old_arg_type) and tt.is_const(old_arg_type.base): - new_args[i].type = cpptypes.reference_t(tt.remove_const(old_arg_type.base)) - elif tt.is_const(old_arg): - new_args[i].type = tt.remove_const(old_arg_type) - - new_name = "%s_const_ref_wrapper"%c.name - args_str = [str(a) for a in new_args] - arg_names_str = [str(a.name) for a in new_args] - new_sig = "static %s %s(%s& self_arg, %s)"%(c.return_type,new_name,cls.name,",".join(args_str)) - new_method = """%s - { return self_arg.%s(%s); } - """%(new_sig,c.name,",".join(arg_names_str)) - - # Add it all - c.exclude() - - #[Roman] you can use cls.add_declaration_code, this could simplify the - #wrapper ou created, because it will generate the code within the source - #file, the class is generated - cls.add_wrapper_code(new_method) - - cls.add_code('def("%s", &%s::%s);'%(c.name, cls.wrapper_alias,new_name)) +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# Authors: +# Allen Bierbaum +# +import pygccxml.declarations as pd +from pyplusplus.module_builder.call_policies import * +import pygccxml.declarations.type_traits as tt +import pygccxml.declarations.cpptypes as cpptypes +import pyplusplus.code_creators as code_creators +import pyplusplus.decl_wrappers as decl_wrappers + + +def set_recursive_default(val): + pd.scopedef_t.RECURSIVE_DEFAULT = val + +#[Roman]The better way is to turn virtuality from virtual to non virtual +def finalize(cls): + """ Attempt to finalize a class by not exposing virtual methods. + Still exposes in the case of pure virtuals otherwise the class + could not be instantiated. + """ + members = cls.decls( pd.virtuality_type_matcher( pd.VIRTUALITY_TYPES.VIRTUAL ) + , decl_type=pd.member_calldef_t + , allow_empty=True) + members.set_virtuality( pd.VIRTUALITY_TYPES.NOT_VIRTUAL ) + + +def add_member_function(cls, methodName, newMethod): + """ Add a member function to the class. """ + cls.add_registration_code('def("%s",%s)'%(methodName, newMethod), True) + +def wrap_method(cls, methodName, newMethod): + """ Wrap a class method with a new method. + ex: c.wrapmethod(c,"doSomething","doSomethingWrapper") + """ + cls[methodName].exclude() + add_member_function(cls, methodName, newMethod) + +def add_method(moduleBuilder, methodName, method): + """ Add a method to the module builder. """ + code_text = 'boost::python::def("%s",%s);'%(methodName, method) + moduleBuilder.code_creator.body.adopt_creator( code_creators.custom_text_t( code_text ), 0 ) + #[Roman]moduleBuilder.add_registration_code( ... ), see relevant documentation + #This will add have exactly same effect as a previous line, also you don't + #have to build code creator first + + +def is_const_ref(type): + """ Extra trait tester method to check if something is a const reference. """ + is_const = tt.is_const(type) or (hasattr(type,'base') and tt.is_const(type.base)) + is_ref = tt.is_reference(type) or (hasattr(type,'base') and tt.is_reference(type.base)) + return (is_ref and is_const) + #[Roman]If you create unit tests for this code, I will add it to type traits module + +def exclude_protected(cls): + """ Exclude all protected declarations. """ + cls.decls(pd.access_type_matcher_t('protected'),allow_empty=True).exclude() + +def wrap_const_ref_params(cls): + """ Find all member functions of cls and if they take a const& to a class + that does not have a destructor, then create a thin wrapper for them. + This works around an issue with boost.python where it needs a destructor. + """ + #[Roman] Obviously, this will only work, if the function does not need other + #wrapper, I think, this is a new use case for Matthias "arguments policies" + #functionality. + calldefs = cls.calldefs() + + if None == calldefs: + return + + for c in calldefs: + # Skip constructors + if isinstance(c, pd.constructor_t): + continue + + # Find arguments that need replacing + args_to_replace = [] # List of indices to args to replace with wrapping + args = c.arguments + for i in range(len(args)): + arg = args[i] + if is_const_ref(arg.type): + naked_arg = tt.remove_cv(tt.remove_reference(arg.type)) + if tt.is_class(naked_arg): + class_type = naked_arg.declaration + if not tt.has_public_destructor(class_type): + print "Found indestructible const& arg: [%s]:[%s] "%(str(c), str(arg)) + args_to_replace.append(i) + + # Now replace arguments + if len(args_to_replace): + if isinstance(c, pd.operator_t) and c.symbol in ["<","==","!=","="]: + c.exclude() + continue + + new_args = copy.copy(args) # Make new copy of args so we don't modify the existing method + for i in args_to_replace: + old_arg_type = args[i].type + if tt.is_reference(old_arg_type) and tt.is_const(old_arg_type.base): + new_args[i].type = cpptypes.reference_t(tt.remove_const(old_arg_type.base)) + elif tt.is_const(old_arg): + new_args[i].type = tt.remove_const(old_arg_type) + + new_name = "%s_const_ref_wrapper"%c.name + args_str = [str(a) for a in new_args] + arg_names_str = [str(a.name) for a in new_args] + new_sig = "static %s %s(%s& self_arg, %s)"%(c.return_type,new_name,cls.name,",".join(args_str)) + new_method = """%s + { return self_arg.%s(%s); } + """%(new_sig,c.name,",".join(arg_names_str)) + + # Add it all + c.exclude() + + #[Roman] you can use cls.add_declaration_code, this could simplify the + #wrapper ou created, because it will generate the code within the source + #file, the class is generated + cls.add_wrapper_code(new_method) + + cls.add_code('def("%s", &%s::%s);'%(c.name, cls.wrapper_alias,new_name)) Property changes on: pyplusplus_dev/contrib/goodies/goodie_utils.py ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-23 19:32:49
|
Revision: 445 Author: roman_yakovenko Date: 2006-08-23 12:32:37 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=445&view=rev Log Message: ----------- moving "create aliases for matchers" code from the module to the declarations package Modified Paths: -------------- pyplusplus_dev/contrib/goodies/dsl_interface.py Modified: pyplusplus_dev/contrib/goodies/dsl_interface.py =================================================================== --- pyplusplus_dev/contrib/goodies/dsl_interface.py 2006-08-23 19:31:39 UTC (rev 444) +++ pyplusplus_dev/contrib/goodies/dsl_interface.py 2006-08-23 19:32:37 UTC (rev 445) @@ -1,33 +1,24 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) -# -# Authors: -# Allen Bierbaum -# - -# Dictionary of this module. Useful for adding symbols -mod_dict = globals() - -# Bring in the module builder and alias it -import pyplusplus.module_builder -ModuleBuilder = pyplusplus.module_builder.module_builder_t -set_logger_level = pyplusplus.module_builder.set_logger_level - -# Bring in all call policy symbols -from pyplusplus.module_builder.call_policies import * - -from pyplusplus.decl_wrappers import print_declarations - - -# Type traits - -# Matchers -# - Bring in all matchers but rename then without the '_t' at the end -import pygccxml.declarations.matchers -for n in ["matcher_base_t","or_matcher_t","and_matcher_t","not_matcher_t", - "declaration_matcher_t","calldef_matcher_t","namespace_matcher_t", - "variable_matcher_t","regex_matcher_t","access_type_matcher_t", - "operator_matcher_t","custom_matcher_t","virtuality_type_matcher_t"]: - mod_dict[n[:-2]] = pygccxml.declarations.matchers.__dict__[n] \ No newline at end of file +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# Authors: +# Allen Bierbaum +# + +# Dictionary of this module. Useful for adding symbols +mod_dict = globals() + +# Bring in the module builder and alias it +import pyplusplus.module_builder +ModuleBuilder = pyplusplus.module_builder.module_builder_t +set_logger_level = pyplusplus.module_builder.set_logger_level + +# Bring in all call policy symbols +from pyplusplus.module_builder.call_policies import * + +from pyplusplus.decl_wrappers import print_declarations + + +# Type traits This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-23 19:31:58
|
Revision: 444 Author: roman_yakovenko Date: 2006-08-23 12:31:39 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=444&view=rev Log Message: ----------- improving implementation of finalize method adding few comments here and there Modified Paths: -------------- pyplusplus_dev/contrib/goodies/goodie_utils.py Modified: pyplusplus_dev/contrib/goodies/goodie_utils.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-23 19:29:16 UTC (rev 443) +++ pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-23 19:31:39 UTC (rev 444) @@ -15,104 +15,110 @@ def set_recursive_default(val): - pd.scopedef_t.RECURSIVE_DEFAULT = val + pd.scopedef_t.RECURSIVE_DEFAULT = val #[Roman]The better way is to turn virtuality from virtual to non virtual def finalize(cls): - """ Attempt to finalize a class by not exposing virtual methods. - Still exposes in the case of pure virtuals otherwise the class - could not be instantiated. - """ - members = cls.member_functions(allow_empty=True) - if members: - for m in members: - if m.virtuality == pd.VIRTUALITY_TYPES.VIRTUAL: - m.virtuality = pd.VIRTUALITY_TYPES.NOT_VIRTUAL + """ Attempt to finalize a class by not exposing virtual methods. + Still exposes in the case of pure virtuals otherwise the class + could not be instantiated. + """ + members = cls.decls( pd.virtuality_type_matcher( pd.VIRTUALITY_TYPES.VIRTUAL ) + , decl_type=pd.member_calldef_t + , allow_empty=True) + members.set_virtuality( pd.VIRTUALITY_TYPES.NOT_VIRTUAL ) def add_member_function(cls, methodName, newMethod): - """ Add a member function to the class. """ - cls.add_registration_code('def("%s",%s)'%(methodName, newMethod), True) + """ Add a member function to the class. """ + cls.add_registration_code('def("%s",%s)'%(methodName, newMethod), True) def wrap_method(cls, methodName, newMethod): - """ Wrap a class method with a new method. - ex: c.wrapmethod(c,"doSomething","doSomethingWrapper") - """ - cls[methodName].exclude() - add_member_function(cls, methodName, newMethod) + """ Wrap a class method with a new method. + ex: c.wrapmethod(c,"doSomething","doSomethingWrapper") + """ + cls[methodName].exclude() + add_member_function(cls, methodName, newMethod) def add_method(moduleBuilder, methodName, method): - """ Add a method to the module builder. """ - code_text = 'boost::python::def("%s",%s);'%(methodName, method) - moduleBuilder.code_creator.body.adopt_creator( code_creators.custom_text_t( code_text ), 0 ) - #[Roman]moduleBuilder.add_registration_code( ... ), see relevant documentation + """ Add a method to the module builder. """ + code_text = 'boost::python::def("%s",%s);'%(methodName, method) + moduleBuilder.code_creator.body.adopt_creator( code_creators.custom_text_t( code_text ), 0 ) + #[Roman]moduleBuilder.add_registration_code( ... ), see relevant documentation + #This will add have exactly same effect as a previous line, also you don't + #have to build code creator first def is_const_ref(type): - """ Extra trait tester method to check if something is a const reference. """ - is_const = tt.is_const(type) or (hasattr(type,'base') and tt.is_const(type.base)) - is_ref = tt.is_reference(type) or (hasattr(type,'base') and tt.is_reference(type.base)) - return (is_ref and is_const) - #[Roman]If you create unit tests for this code, I will add it to type traits module + """ Extra trait tester method to check if something is a const reference. """ + is_const = tt.is_const(type) or (hasattr(type,'base') and tt.is_const(type.base)) + is_ref = tt.is_reference(type) or (hasattr(type,'base') and tt.is_reference(type.base)) + return (is_ref and is_const) + #[Roman]If you create unit tests for this code, I will add it to type traits module def exclude_protected(cls): - """ Exclude all protected declarations. """ - cls.decls(pd.access_type_matcher_t('protected'),allow_empty=True).exclude() + """ Exclude all protected declarations. """ + cls.decls(pd.access_type_matcher_t('protected'),allow_empty=True).exclude() def wrap_const_ref_params(cls): - """ Find all member functions of cls and if they take a const& to a class - that does not have a destructor, then create a thin wrapper for them. - This works around an issue with boost.python where it needs a destructor. - """ - #[Roman] Obviously, this will only work, if the function does not need other - #wrapper, I think, this is a new use case for Matthias "arguments policies" - #functionality. - calldefs = cls.calldefs() + """ Find all member functions of cls and if they take a const& to a class + that does not have a destructor, then create a thin wrapper for them. + This works around an issue with boost.python where it needs a destructor. + """ + #[Roman] Obviously, this will only work, if the function does not need other + #wrapper, I think, this is a new use case for Matthias "arguments policies" + #functionality. + calldefs = cls.calldefs() - if None == calldefs: - return + if None == calldefs: + return - for c in calldefs: - # Skip constructors - if isinstance(c, pd.constructor_t): - continue + for c in calldefs: + # Skip constructors + if isinstance(c, pd.constructor_t): + continue - # Find arguments that need replacing - args_to_replace = [] # List of indices to args to replace with wrapping - args = c.arguments - for i in range(len(args)): - arg = args[i] - if is_const_ref(arg.type): - naked_arg = tt.remove_cv(tt.remove_reference(arg.type)) - if tt.is_class(naked_arg): - class_type = naked_arg.declaration - if not tt.has_public_destructor(class_type): - print "Found indestructible const& arg: [%s]:[%s] "%(str(c), str(arg)) - args_to_replace.append(i) + # Find arguments that need replacing + args_to_replace = [] # List of indices to args to replace with wrapping + args = c.arguments + for i in range(len(args)): + arg = args[i] + if is_const_ref(arg.type): + naked_arg = tt.remove_cv(tt.remove_reference(arg.type)) + if tt.is_class(naked_arg): + class_type = naked_arg.declaration + if not tt.has_public_destructor(class_type): + print "Found indestructible const& arg: [%s]:[%s] "%(str(c), str(arg)) + args_to_replace.append(i) - # Now replace arguments - if len(args_to_replace): - if isinstance(c, pd.operator_t) and c.symbol in ["<","==","!=","="]: - c.exclude() - continue + # Now replace arguments + if len(args_to_replace): + if isinstance(c, pd.operator_t) and c.symbol in ["<","==","!=","="]: + c.exclude() + continue - new_args = copy.copy(args) # Make new copy of args so we don't modify the existing method - for i in args_to_replace: - old_arg_type = args[i].type - if tt.is_reference(old_arg_type) and tt.is_const(old_arg_type.base): - new_args[i].type = cpptypes.reference_t(tt.remove_const(old_arg_type.base)) - elif tt.is_const(old_arg): - new_args[i].type = tt.remove_const(old_arg_type) + new_args = copy.copy(args) # Make new copy of args so we don't modify the existing method + for i in args_to_replace: + old_arg_type = args[i].type + if tt.is_reference(old_arg_type) and tt.is_const(old_arg_type.base): + new_args[i].type = cpptypes.reference_t(tt.remove_const(old_arg_type.base)) + elif tt.is_const(old_arg): + new_args[i].type = tt.remove_const(old_arg_type) - new_name = "%s_const_ref_wrapper"%c.name - args_str = [str(a) for a in new_args] - arg_names_str = [str(a.name) for a in new_args] - new_sig = "static %s %s(%s& self_arg, %s)"%(c.return_type,new_name,cls.name,",".join(args_str)) - new_method = """%s - { return self_arg.%s(%s); } - """%(new_sig,c.name,",".join(arg_names_str)) + new_name = "%s_const_ref_wrapper"%c.name + args_str = [str(a) for a in new_args] + arg_names_str = [str(a.name) for a in new_args] + new_sig = "static %s %s(%s& self_arg, %s)"%(c.return_type,new_name,cls.name,",".join(args_str)) + new_method = """%s + { return self_arg.%s(%s); } + """%(new_sig,c.name,",".join(arg_names_str)) - # Add it all - c.exclude() - cls.add_wrapper_code(new_method) - cls.add_code('def("%s", &%s::%s);'%(c.name, cls.wrapper_alias,new_name)) + # Add it all + c.exclude() + + #[Roman] you can use cls.add_declaration_code, this could simplify the + #wrapper ou created, because it will generate the code within the source + #file, the class is generated + cls.add_wrapper_code(new_method) + + cls.add_code('def("%s", &%s::%s);'%(c.name, cls.wrapper_alias,new_name)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-23 19:29:38
|
Revision: 443 Author: roman_yakovenko Date: 2006-08-23 12:29:16 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=443&view=rev Log Message: ----------- updating documentation Modified Paths: -------------- pyplusplus_dev/pyplusplus/_logging_/__init__.py pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py pyplusplus_dev/pyplusplus/file_writers/__init__.py pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py pyplusplus_dev/pyplusplus/file_writers/multiple_files.py pyplusplus_dev/pyplusplus/file_writers/single_file.py pyplusplus_dev/pyplusplus/file_writers/writer.py pyplusplus_dev/pyplusplus/gui/freeze.py pyplusplus_dev/pyplusplus/gui/ui.py pyplusplus_dev/pyplusplus/gui/ui_runner.py pyplusplus_dev/pyplusplus/gui/wizard.py Modified: pyplusplus_dev/pyplusplus/_logging_/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/_logging_/__init__.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/_logging_/__init__.py 2006-08-23 19:29:16 UTC (rev 443) @@ -4,10 +4,7 @@ # http://www.boost.org/LICENSE_1_0.txt) #TODO: find better place for it -""" -This package contains logging configuration for Py++. Default log level -is DEBUG. Default log messages destination is sys.stdout. -""" +"""defines logger classes""" import os import sys @@ -15,17 +12,37 @@ from multi_line_formatter import multi_line_formatter_t def _create_logger_( name ): + """implementation details""" logger = logging.getLogger(name) handler = logging.StreamHandler(sys.stdout) handler.setFormatter( multi_line_formatter_t( os.linesep + '%(levelname)s: %(message)s' ) ) - logger.addHandler(handler) + logger.addHandler(handler) logger.setLevel(logging.INFO) return logger class loggers: + """class-namespace, defines few loggers classes, used in the project""" + file_writer = _create_logger_( 'pyplusplus.file_writer' ) + """logger for classes that write code to files""" + declarations = _create_logger_( 'pyplusplus.declarations' ) + """logger for declaration classes + + This is very import logger. All important messages: problems with declarations, + warnings or hints are written to this logger. + """ + module_builder = _create_logger_( 'pyplusplus.module_builder' ) + """logger that in use by L{module_builder_t} class. + + Just another logger. It exists mostly for Py++ developers. + """ + #root logger exists for configuration purpose only root = logging.getLogger( 'pyplusplus' ) - all = [ root, file_writer, module_builder, declarations ] \ No newline at end of file + """root logger exists for your convinience only""" + + all = [ root, file_writer, module_builder, declarations ] + """contains all logger classes, defined by the class""" + \ No newline at end of file Modified: pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py =================================================================== --- pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py 2006-08-23 19:29:16 UTC (rev 443) @@ -5,6 +5,8 @@ # Initial version by Matthias Baas (ba...@ir...). +"""defines a class that helps to format user messages""" + import os, logging, textwrap class multi_line_formatter_t(logging.Formatter): Modified: pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py 2006-08-23 19:29:16 UTC (rev 443) @@ -3,6 +3,7 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) + import os import algorithm import code_creator Modified: pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2006-08-23 19:29:16 UTC (rev 443) @@ -77,11 +77,12 @@ def create_identifier(creator, full_name ): - from pyplusplus import code_creators """ This function will find all relevant namespace aliases and will return new full name that takes into account namespace aliases. """ + + from pyplusplus import code_creators dset = creators_affect_on_me( creator ) dset = filter( lambda x: isinstance( x, code_creators.namespace_alias_t ), dset ) full_name = full_name.lstrip( '::' ) Modified: pyplusplus_dev/pyplusplus/file_writers/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/__init__.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/file_writers/__init__.py 2006-08-23 19:29:16 UTC (rev 443) @@ -6,12 +6,14 @@ """ This package contains few classes, that writes L{code_creators.module_t} to files. -Right now 2 strategies were implemented: +Right now 3 strategies were implemented: - 1. classic strategy of deviding classes to files one class in one header + source + 1. All code is written in one file + + 2. Classic strategy of deviding classes to files: one class in one header + source files. - 2. all code is written in one file. + 2.1 Huge classes are splitten to few source files. """ @@ -22,6 +24,7 @@ from class_multiple_files import class_multiple_files_t def write_file( data, file_path ): + """writes data to file""" if isinstance( data, types.StringTypes ): writer_t.write_file( data, file_path ) else: @@ -29,9 +32,11 @@ sf.write() def write_multiple_files( extmodule, dir_path ): + """writes extmodule to multiple files""" mfs = multiple_files_t( extmodule, dir_path ) mfs.write() def write_class_multiple_files( extmodule, dir_path, huge_classes ): + """writes extmodue to multiple files and splits huge classes to few source files""" mfs = class_multiple_files_t( extmodule, dir_path, huge_classes ) mfs.write() \ No newline at end of file Modified: pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2006-08-23 19:29:16 UTC (rev 443) @@ -3,6 +3,10 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +"""defines a class that writes L{code_creators.module_t} to multiple files, the class +also splits huge C++ classes to few source files +""" + import os import writer import multiple_files Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2006-08-23 19:29:16 UTC (rev 443) @@ -3,6 +3,8 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +"""defines a class that writes L{code_creators.module_t} to multiple files""" + import os import writer from pygccxml import declarations Modified: pyplusplus_dev/pyplusplus/file_writers/single_file.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/single_file.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/file_writers/single_file.py 2006-08-23 19:29:16 UTC (rev 443) @@ -3,6 +3,8 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +"""defines a class that writes L{code_creators.module_t} to single file""" + import os import writer Modified: pyplusplus_dev/pyplusplus/file_writers/writer.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/writer.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/file_writers/writer.py 2006-08-23 19:29:16 UTC (rev 443) @@ -3,6 +3,8 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +"""defines interface for all classes that writes L{code_creators.module_t} to file(s)""" + import os import time from pyplusplus import _logging_ @@ -16,7 +18,6 @@ w = writer_class(module, file, ...) w.write() """ - logger = _logging_.loggers.file_writer def __init__(self, extmodule): @@ -36,6 +37,7 @@ @staticmethod def create_backup(fpath): + """creates backup of the file, by renaming it to C{fpath + ~}""" if not os.path.exists( fpath ): return backup_fpath = fpath + '~' @@ -44,6 +46,7 @@ os.rename( fpath, backup_fpath ) def write_code_repository(self, dir): + """creates files defined in L{code_repository} package""" for cr in code_repository.all: if self.__extmodule.is_system_header( cr.file_name ): self.write_file( os.path.join( dir, cr.file_name ), cr.code ) @@ -87,4 +90,5 @@ f = file( fpath, 'w+b' ) f.write( fcontent_new ) f.close() - writer_t.logger.info( 'file "%s" - updated( %f seconds )' % ( fname, time.clock() - start_time ) ) \ No newline at end of file + writer_t.logger.info( 'file "%s" - updated( %f seconds )' % ( fname, time.clock() - start_time ) ) + \ No newline at end of file Modified: pyplusplus_dev/pyplusplus/gui/freeze.py =================================================================== --- pyplusplus_dev/pyplusplus/gui/freeze.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/gui/freeze.py 2006-08-23 19:29:16 UTC (rev 443) @@ -4,6 +4,13 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) + +"""this module contains "freeze" functionality. + +It allows to create and distribute Py++ GUI as executable, that could be +run without installing Python, pygccxml and Py++. +""" + import os import sys import shutil Modified: pyplusplus_dev/pyplusplus/gui/ui.py =================================================================== --- pyplusplus_dev/pyplusplus/gui/ui.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/gui/ui.py 2006-08-23 19:29:16 UTC (rev 443) @@ -4,6 +4,11 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +"""this module implements GUI. + +TODO: It could be nice, if GUI will save the user settings beetwen runs. +""" + import os import time import Tkinter Modified: pyplusplus_dev/pyplusplus/gui/ui_runner.py =================================================================== --- pyplusplus_dev/pyplusplus/gui/ui_runner.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/gui/ui_runner.py 2006-08-23 19:29:16 UTC (rev 443) @@ -4,6 +4,12 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +"""Py++ user interface runner + +The main purpose of this module is to run ui.py from development tree, so the +only work it does is adding new paths to sys.path variable. +""" + import os import sys Modified: pyplusplus_dev/pyplusplus/gui/wizard.py =================================================================== --- pyplusplus_dev/pyplusplus/gui/wizard.py 2006-08-23 19:28:36 UTC (rev 442) +++ pyplusplus_dev/pyplusplus/gui/wizard.py 2006-08-23 19:29:16 UTC (rev 443) @@ -1,3 +1,5 @@ +"""generates Py++ code from the user data""" + CODE_TEMPLATE = \ """ import os @@ -22,6 +24,7 @@ """ class wizard_t( object ): + """code generator that creates Py++ code""" def __init__( self , parser_configuration , source_file ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-23 19:28:49
|
Revision: 442 Author: roman_yakovenko Date: 2006-08-23 12:28:36 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=442&view=rev Log Message: ----------- adding aliases for matcher classes Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/__init__.py Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2006-08-23 19:27:57 UTC (rev 441) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2006-08-23 19:28:36 UTC (rev 442) @@ -214,6 +214,33 @@ from matchers import operator_matcher_t from matchers import custom_matcher_t from matchers import virtuality_type_matcher_t + +#make matchers to look more like functors +or_matcher = or_matcher_t +"""see L{or_matcher} for documentation""" +and_matcher = and_matcher_t +"""see L{and_matcher} for documentation""" +not_matcher = not_matcher_t +"""see L{not_matcher} for documentation""" +declaration_matcher = declaration_matcher_t +"""see L{declaration_matcher} for documentation""" +calldef_matcher = calldef_matcher_t +"""see L{calldef_matcher} for documentation""" +namespace_matcher = namespace_matcher_t +"""see L{namespace_matcher} for documentation""" +variable_matcher = variable_matcher_t +"""see L{variable_matcher} for documentation""" +regex_matcher = regex_matcher_t +"""see L{regex_matcher} for documentation""" +access_type_matcher = access_type_matcher_t +"""see L{access_type_matcher} for documentation""" +operator_matcher = operator_matcher_t +"""see L{operator_matcher} for documentation""" +custom_matcher = custom_matcher_t +"""see L{custom_matcher} for documentation""" +virtuality_type_matcher = virtuality_type_matcher_t +"""see L{virtuality_type_matcher} for documentation""" + from matcher import matcher from mdecl_wrapper import mdecl_wrapper_t This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |