pygccxml-commit Mailing List for C++ Python language bindings (Page 6)
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: <rom...@us...> - 2009-05-14 12:04:55
|
Revision: 1732 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1732&view=rev Author: roman_yakovenko Date: 2009-05-14 12:04:50 +0000 (Thu, 14 May 2009) Log Message: ----------- adding new user Modified Paths: -------------- pyplusplus_dev/docs/quotes.rest Modified: pyplusplus_dev/docs/quotes.rest =================================================================== --- pyplusplus_dev/docs/quotes.rest 2009-05-13 12:31:34 UTC (rev 1731) +++ pyplusplus_dev/docs/quotes.rest 2009-05-14 12:04:50 UTC (rev 1732) @@ -49,10 +49,10 @@ David Carpman -"... I started a few months ago to develop a set of Python bindings for -OpenCascade modeling/visualization library. After a quick tour to evaluate -different solutions, my choice lead me to Py++, which is a very convenient -tool : I was able to achieve the first release of my project only two weeks after +"... I started a few months ago to develop a set of Python bindings for +OpenCascade modeling/visualization library. After a quick tour to evaluate +different solutions, my choice lead me to Py++, which is a very convenient +tool : I was able to achieve the first release of my project only two weeks after the project start !" Paviot Thomas @@ -114,24 +114,29 @@ * `OIS`_ - an object oriented input system. .. _`OIS` : http://www.wreckedgames.com/forum/ - + * All in all, `Python-OGRE`_ project contains bindings for more than 30 libraries. You can find code generation scripts here: https://python-ogre.svn.sourceforge.net/svnroot/python-ogre/trunk/python-ogre/code_generators/ -* `Rising Sun Pictures`_ company is using :doc:`Py++ <pyplusplus>` to create Python bindings for +* `Rising Sun Pictures`_ company is using :doc:`Py++ <pyplusplus>` to create Python bindings for `Apple Shake API`_. `PyShake`_ enables running of Python code from within Shake and by exposing the Shake API to Python. - + .. _`Rising Sun Pictures` : http://open.rsp.com.au/ .. _`Apple Shake API` : http://www.apple.com/shake/ .. _`PyShake` : http://open.rsp.com.au/projects/pyshake -* Paviot Thomas, the author of `pythonOCC`_ project, is using :doc:`Py++ <pyplusplus>` to create +* Paviot Thomas, the author of `pythonOCC`_ project, is using :doc:`Py++ <pyplusplus>` to create Python bindings for `OpenCascade`_, a 3D modeling & numerical simulation library. .. _`pythonOCC` : http://www.minerva-plm.org/pythonOCC/ .. _`OpenCascade` : http://www.opencascade.org/ +* Adrien Saladin, the author of `PTools`_ project, is using :doc:`Py++ <pyplusplus>` + to create an opensource molecular docking library. + + .. _`PTools` : http://www.biomedcentral.com/1472-6807/9/27/abstract + * I am :-). I created Python bindings for the following libraries: * `Boost.Date_Time`_ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-13 16:07:15
|
Revision: 1731 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1731&view=rev Author: roman_yakovenko Date: 2009-05-13 12:31:34 +0000 (Wed, 13 May 2009) Log Message: ----------- updating encoding Modified Paths: -------------- developer_scripts/ensure_utf8.py pyplusplus_dev/docs/documentation/apidocs/api.rest pyplusplus_dev/docs/history/history.rest Modified: developer_scripts/ensure_utf8.py =================================================================== --- developer_scripts/ensure_utf8.py 2009-05-13 12:16:24 UTC (rev 1730) +++ developer_scripts/ensure_utf8.py 2009-05-13 12:31:34 UTC (rev 1731) @@ -27,6 +27,7 @@ def write_content( fpath, content ): fcontent_new = content #unicode( content, 'UTF8' ) + fcontent_new = fcontent_new.lstrip( unicode( codecs.BOM_UTF8, "utf8" ) ) f = codecs.open( fpath, 'w+b', 'UTF8' ) f.write( fcontent_new ) f.close() @@ -36,8 +37,12 @@ if __name__ == '__main__': sources_dir = os.path.join( os.path.abspath( os.curdir ), '..' ) + dirs_to_go = [ os.path.join( sources_dir, 'pydsc_dev' ) + , os.path.join( sources_dir, 'pygccxml_dev' ) + , os.path.join( sources_dir, 'pyplusplus_dev' ) ] - for fpath in files_iterator( sources_dir, to_be_validated_file_exts ): + for fpath in files_iterator( dirs_to_go, to_be_validated_file_exts ): + print 'converting %s' % fpath ensure_utf8( fpath ) print 'converting %s - done' % fpath Modified: pyplusplus_dev/docs/documentation/apidocs/api.rest =================================================================== --- pyplusplus_dev/docs/documentation/apidocs/api.rest 2009-05-13 12:16:24 UTC (rev 1730) +++ pyplusplus_dev/docs/documentation/apidocs/api.rest 2009-05-13 12:31:34 UTC (rev 1731) @@ -1,4 +1,4 @@ -=== +=== API === Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2009-05-13 12:16:24 UTC (rev 1730) +++ pyplusplus_dev/docs/history/history.rest 2009-05-13 12:31:34 UTC (rev 1731) @@ -1,4 +1,4 @@ -=================== +=================== Development history =================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-13 13:22:40
|
Revision: 1730 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1730&view=rev Author: roman_yakovenko Date: 2009-05-13 12:16:24 +0000 (Wed, 13 May 2009) Log Message: ----------- updating encoding Modified Paths: -------------- pydsc_dev/docs/pydsc.rest Modified: pydsc_dev/docs/pydsc.rest =================================================================== --- pydsc_dev/docs/pydsc.rest 2009-05-13 11:58:25 UTC (rev 1729) +++ pydsc_dev/docs/pydsc.rest 2009-05-13 12:16:24 UTC (rev 1730) @@ -2,11 +2,6 @@ pydsc introduction ================== -.. meta:: - :description: Python documentation string spell checker - :keywords: Python, docstring, documentation, spell, check - , документация, спеллер, орфографическая коррекция, - -------------- What is pydsc? -------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-13 11:58:30
|
Revision: 1729 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1729&view=rev Author: roman_yakovenko Date: 2009-05-13 11:58:25 +0000 (Wed, 13 May 2009) Log Message: ----------- updating encoding Modified Paths: -------------- pyplusplus_dev/docs/download.rest Added Paths: ----------- developer_scripts/ensure_utf8.py Added: developer_scripts/ensure_utf8.py =================================================================== --- developer_scripts/ensure_utf8.py (rev 0) +++ developer_scripts/ensure_utf8.py 2009-05-13 11:58:25 UTC (rev 1729) @@ -0,0 +1,43 @@ +# Copyright 2004-2008 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) + +import os +import codecs +from file_system_iter import files_iterator, folders_iterator + +to_be_validated_file_exts = [ + '*.rest' +] + +def ensure_utf8( fpath ): + def read_content( fpath ): + last_error = None + for encoding in [ 'ascii', 'UTF8', 'UTF16' ]: + try: + f = codecs.open( fpath, 'rb', encoding ) + fcontent = f.read() + f.close() + return fcontent + except UnicodeDecodeError, err: + last_error = err + else: + raise last_error + + def write_content( fpath, content ): + fcontent_new = content #unicode( content, 'UTF8' ) + f = codecs.open( fpath, 'w+b', 'UTF8' ) + f.write( fcontent_new ) + f.close() + + write_content( fpath, read_content( fpath ) ) + + +if __name__ == '__main__': + sources_dir = os.path.join( os.path.abspath( os.curdir ), '..' ) + + for fpath in files_iterator( sources_dir, to_be_validated_file_exts ): + print 'converting %s' % fpath + ensure_utf8( fpath ) + print 'converting %s - done' % fpath Modified: pyplusplus_dev/docs/download.rest =================================================================== --- pyplusplus_dev/docs/download.rest 2009-05-13 11:25:12 UTC (rev 1728) +++ pyplusplus_dev/docs/download.rest 2009-05-13 11:58:25 UTC (rev 1729) @@ -1,58 +1,58 @@ -================== -Download & Install -================== - -------------------- -Py++ on SourceForge -------------------- - -:doc:`Py++ <pyplusplus>` project is hosted on SourceForge. Using SourceForge services you -can: - -1) get access to source code -2) get access to latest release version of :doc:`Py++ <pyplusplus>` - - ------------------ -Subversion access ------------------ - -http://sourceforge.net/svn/?group_id=118209 - --------- -Download --------- - -https://sourceforge.net/project/showfiles.php?group_id=118209 - ------------- -Installation ------------- - -In command prompt or shell change current directory to be "pyplusplus-X.Y.Z". -"X.Y.Z" is version of :doc:`Py++ <pyplusplus>`. Type the following command: - -| ``python setup.py install`` - -After this command complete, you should have installed :doc:`Py++ <pyplusplus>` package. - -Boost.Python installation -------------------------- - -Users of Microsoft Windows can enjoy from simple `installer for Boost Libraries`_. -You can find it `here`_. Take a look on new `getting started guide`_ for Boost -libraries. - -Another very valuable link related to Boost is http://engineering.meta-comm.com/boost.aspx . -You will find hourly snapshots of the source code and the documentation for all -Boost libraries. - -.. _`getting started guide` : http://boost.cvs.sourceforge.net/*checkout*/boost/boost/more/getting_started.html -.. _`here` : http://www.boost-consulting.com/products/free -.. _`installer for Boost Libraries` : http://www.boost-consulting.com/products/free - ------------- -Dependencies ------------- - -* :doc:`pygccxml <../pygccxml/pygccxml>` +================== +Download & Install +================== + +------------------- +Py++ on SourceForge +------------------- + +:doc:`Py++ <pyplusplus>` project is hosted on SourceForge. Using SourceForge services you +can: + +1) get access to source code +2) get access to latest release version of :doc:`Py++ <pyplusplus>` + + +----------------- +Subversion access +----------------- + +http://sourceforge.net/svn/?group_id=118209 + +-------- +Download +-------- + +https://sourceforge.net/project/showfiles.php?group_id=118209 + +------------ +Installation +------------ + +In command prompt or shell change current directory to be "pyplusplus-X.Y.Z". +"X.Y.Z" is version of :doc:`Py++ <pyplusplus>`. Type the following command: + +| ``python setup.py install`` + +After this command complete, you should have installed :doc:`Py++ <pyplusplus>` package. + +Boost.Python installation +------------------------- + +Users of Microsoft Windows can enjoy from simple `installer for Boost Libraries`_. +You can find it `here`_. Take a look on new `getting started guide`_ for Boost +libraries. + +Another very valuable link related to Boost is http://engineering.meta-comm.com/boost.aspx . +You will find hourly snapshots of the source code and the documentation for all +Boost libraries. + +.. _`getting started guide` : http://boost.cvs.sourceforge.net/*checkout*/boost/boost/more/getting_started.html +.. _`here` : http://www.boost-consulting.com/products/free +.. _`installer for Boost Libraries` : http://www.boost-consulting.com/products/free + +------------ +Dependencies +------------ + +* :doc:`pygccxml <../pygccxml/pygccxml>` This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-13 11:25:21
|
Revision: 1728 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1728&view=rev Author: roman_yakovenko Date: 2009-05-13 11:25:12 +0000 (Wed, 13 May 2009) Log Message: ----------- update encoding Modified Paths: -------------- index.rest pygccxml_dev/docs/apidocs/api.rest Modified: index.rest =================================================================== --- index.rest 2009-05-13 10:58:56 UTC (rev 1727) +++ index.rest 2009-05-13 11:25:12 UTC (rev 1728) @@ -1,4 +1,4 @@ -============================== +============================== C\\C++ Python language binding ============================== Modified: pygccxml_dev/docs/apidocs/api.rest =================================================================== --- pygccxml_dev/docs/apidocs/api.rest 2009-05-13 10:58:56 UTC (rev 1727) +++ pygccxml_dev/docs/apidocs/api.rest 2009-05-13 11:25:12 UTC (rev 1728) @@ -2,10 +2,6 @@ API ==== ----- -API ----- - `pygccxml` consists from 4 sub packages .. toctree:: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-13 10:59:05
|
Revision: 1727 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1727&view=rev Author: roman_yakovenko Date: 2009-05-13 10:58:56 +0000 (Wed, 13 May 2009) Log Message: ----------- change encoding Modified Paths: -------------- pygccxml_dev/docs/apidocs/api.rest pygccxml_dev/docs/links.rest pygccxml_dev/docs/pygccxml.rest pygccxml_dev/docs/query_interface.rest Modified: pygccxml_dev/docs/apidocs/api.rest =================================================================== --- pygccxml_dev/docs/apidocs/api.rest 2009-05-13 10:23:46 UTC (rev 1726) +++ pygccxml_dev/docs/apidocs/api.rest 2009-05-13 10:58:56 UTC (rev 1727) @@ -1,4 +1,4 @@ -==== +==== API ==== Modified: pygccxml_dev/docs/links.rest =================================================================== --- pygccxml_dev/docs/links.rest 2009-05-13 10:23:46 UTC (rev 1726) +++ pygccxml_dev/docs/links.rest 2009-05-13 10:58:56 UTC (rev 1727) @@ -1,4 +1,4 @@ -============== +============== C++ Reflection ============== Modified: pygccxml_dev/docs/pygccxml.rest =================================================================== --- pygccxml_dev/docs/pygccxml.rest 2009-05-13 10:23:46 UTC (rev 1726) +++ pygccxml_dev/docs/pygccxml.rest 2009-05-13 10:58:56 UTC (rev 1727) @@ -1,4 +1,4 @@ -================ +================ pygccxml package ================ Modified: pygccxml_dev/docs/query_interface.rest =================================================================== --- pygccxml_dev/docs/query_interface.rest 2009-05-13 10:23:46 UTC (rev 1726) +++ pygccxml_dev/docs/query_interface.rest 2009-05-13 10:58:56 UTC (rev 1727) @@ -1,4 +1,4 @@ -====================== +====================== Declarations query API ====================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-13 10:24:06
|
Revision: 1726 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1726&view=rev Author: roman_yakovenko Date: 2009-05-13 10:23:46 +0000 (Wed, 13 May 2009) Log Message: ----------- updating docs Modified Paths: -------------- sphinx/conf.py Added Paths: ----------- sphinx/readme.txt Removed Paths: ------------- sphinx/check_links.bat Property Changed: ---------------- sphinx/ Property changes on: sphinx ___________________________________________________________________ Modified: svn:ignore - __build pydsc pygccxml pyplusplus index.rest html_documentation + __build pydsc pygccxml pyplusplus index.rest html_documentation www Deleted: sphinx/check_links.bat =================================================================== --- sphinx/check_links.bat 2009-05-13 10:22:27 UTC (rev 1725) +++ sphinx/check_links.bat 2009-05-13 10:23:46 UTC (rev 1726) @@ -1,2 +0,0 @@ -E:\Python25\Scripts\linkchecker.bat --no-warnings .\__build\index.html - Modified: sphinx/conf.py =================================================================== --- sphinx/conf.py 2009-05-13 10:22:27 UTC (rev 1725) +++ sphinx/conf.py 2009-05-13 10:23:46 UTC (rev 1726) @@ -54,11 +54,11 @@ shutil.copy( os.path.join( project_root, 'index.rest' ), doc_project_root ) try: - import pydsc + #~ import pydsc #report errors related to the project only - pydsc.include_paths( project_root ) - pydsc.ignore_dictionary( 'ignore_dictionary.txt' ) - pydsc.set_text_preprocessor( pydsc.sphinx_preprocessor ) + #~ pydsc.include_paths( project_root ) + #~ pydsc.ignore_dictionary( 'ignore_dictionary.txt' ) + #~ pydsc.set_text_preprocessor( pydsc.sphinx_preprocessor ) import pygccxml import pyplusplus except: @@ -118,8 +118,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx'] - +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage'] # Add any paths that contain templates here, relative to this directory. templates_path = ['__templates'] if 'www' in outdir: @@ -204,7 +203,7 @@ # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +html_favicon = 'favicon.ico' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, Added: sphinx/readme.txt =================================================================== --- sphinx/readme.txt (rev 0) +++ sphinx/readme.txt 2009-05-13 10:23:46 UTC (rev 1726) @@ -0,0 +1,7 @@ +language-binding web site: + + sphinx-build -b [changes|linkcheck|doctest] . www + +ads free doumentation: + + sphinx-build . docs This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-13 10:22:39
|
Revision: 1725 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1725&view=rev Author: roman_yakovenko Date: 2009-05-13 10:22:27 +0000 (Wed, 13 May 2009) Log Message: ----------- updating docs Modified Paths: -------------- index.rest pygccxml_dev/docs/design.rest pygccxml_dev/docs/download.rest pygccxml_dev/docs/history/history.rest pygccxml_dev/docs/links.rest pygccxml_dev/docs/pygccxml.rest pygccxml_dev/docs/query_interface.rest Modified: index.rest =================================================================== --- index.rest 2009-05-12 05:12:04 UTC (rev 1724) +++ index.rest 2009-05-13 10:22:27 UTC (rev 1725) @@ -1,50 +1,50 @@ -============================== -C\\C++ Python language binding -============================== - ----------------- -pygccxml package ----------------- - -* Do you need to parse C++ code? -* Do you need to build code generator? -* Do you need to create UML diagram? - -:doc:`pygccxml <pygccxml/pygccxml>` is the way to go! :doc:`Learn more <pygccxml/pygccxml>`. - ------------- -Py++ package ------------- - -"I love deadlines. I love the whooshing noise they make as they go by." - -- Douglas Adams - -Meet your deadlines with powerful code generator engine - :doc:`Py++ <pyplusplus/pyplusplus>`. - -:doc:`Py++ <pyplusplus/pyplusplus>`, `ctypes <http://docs.python.org/library/ctypes.html>`_ -and `Boost.Python <http://www.boost.org/doc/libs/1_38_0/libs/python/doc/index.html>`_ -provide a complete solution for interfacing Python and C\\C++. -:doc:`Learn more <pyplusplus/pyplusplus>`. - -*European Space Agency*, *Ogre*, *PyOpenSG* and many others :doc:`use <pyplusplus/quotes>` `Py++`. - -------------- -pydsc package -------------- - -Documentation strings contain spelling errors? :doc:`Fix them in a minute <pydsc/pydsc>`! - -.. toctree:: - :hidden: - - pydsc/pydsc.rest - pygccxml/pygccxml.rest - pyplusplus/pyplusplus.rest - ------------------- -Indices and tables ------------------- - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` +============================== +C\\C++ Python language binding +============================== + +---------------- +pygccxml package +---------------- + +* Do you need to parse C++ code? +* Do you need to build code generator? +* Do you need to create UML diagram? + +:doc:`pygccxml <pygccxml/pygccxml>` is the way to go! :doc:`Learn more <pygccxml/pygccxml>`. + +------------ +Py++ package +------------ + +"I love deadlines. I love the whooshing noise they make as they go by." + -- Douglas Adams + +Meet your deadlines with powerful code generator engine - :doc:`Py++ <pyplusplus/pyplusplus>`. + +:doc:`Py++ <pyplusplus/pyplusplus>`, `ctypes <http://docs.python.org/library/ctypes.html>`_ +and `Boost.Python <http://www.boost.org/doc/libs/1_38_0/libs/python/doc/index.html>`_ +provide a complete solution for interfacing Python and C\\C++. +:doc:`Learn more <pyplusplus/pyplusplus>`. + +*European Space Agency*, *Ogre*, *PyOpenSG* and many others :doc:`use <pyplusplus/quotes>` `Py++`. + +------------- +pydsc package +------------- + +Documentation strings contain spelling errors? :doc:`Fix them in a minute <pydsc/pydsc>`! + +.. toctree:: + :hidden: + + pydsc/pydsc.rest + pygccxml/pygccxml.rest + pyplusplus/pyplusplus.rest + +------------------ +Indices and tables +------------------ + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` Modified: pygccxml_dev/docs/design.rest =================================================================== --- pygccxml_dev/docs/design.rest 2009-05-12 05:12:04 UTC (rev 1724) +++ pygccxml_dev/docs/design.rest 2009-05-13 10:22:27 UTC (rev 1725) @@ -1,293 +1,293 @@ -=============== -Design overview -=============== - ------------------------- -The view from 10000 fits ------------------------- - -:doc:`pygccxml <pygccxml>` has 4 packages: - -* :mod:`declarations <pygccxml.declarations>` package defines classes that describe - C++ declarations and types - -* :mod:`parser <pygccxml.parser>` package defines classes that parse `GCC-XML`_ - generated files. Also it defines few classes that will help you to eliminate - unnecessary parsing of C++ source files. - -* :mod:`binary_parsers <pygccxml.binary_parsers>` package extracts some - information from binary files ( `.so`, `.dll`, `.map` ) and merges it with - the declarations tree. - -* ``utils`` package defines few functions, I found useful in the whole project. - -------------------------- -``declarations`` package -------------------------- - -Please take a look on the `UML diagram`_. This `UML diagram`_ describes almost all -classes defined in the package and their relationship. ``declarations`` package -defines two hierarchies of class: - -1. types hierarchy - used to represent a C++ type - -2. declarations hierarchy - used to represent a C++ declaration - - -Types hierarchy ---------------- - -Types hierarchy is used to represent an arbitrary type in C++. class ``type_t`` -is the base class. - -``type_traits`` -~~~~~~~~~~~~~~~ - -Are you aware of `boost::type_traits`_ library? The `boost::type_traits`_ -library contains a set of very specific traits classes, each of which -encapsulate a single trait from the C++ type system; for example, is a type -a pointer or a reference? Or does a type have a trivial constructor, or a -const-qualifier? - -:doc:`pygccxml <pygccxml>` implements a lot of functionality from the library: - -* a lot of algorithms were implemented - - + ``is_same`` - - + ``is_enum`` - - + ``is_void`` - - + ``is_const`` - - + ``is_array`` - - + ``is_pointer`` - - + ``is_volatile`` - - + ``is_integral`` - - + ``is_reference`` - - + ``is_arithmetic`` - - + ``is_convertible`` - - + ``is_fundamental`` - - + ``is_floating_point`` - - + ``is_base_and_derived`` - - + ``is_unary_operator`` - - + ``is_binary_operator`` - - + ``remove_cv`` - - + ``remove_const`` - - + ``remove_alias`` - - + ``remove_pointer`` - - + ``remove_volatile`` - - + ``remove_reference`` - - + ``has_trivial_copy`` - - + ``has_trivial_constructor`` - - + ``has_any_non_copyconstructor`` - - For a full list of implemented algorithms, please consult API documentation. - -* a lot of unit tests has been written base on unit tests from the - `boost::type_traits`_ library. - - -If you are going to build code generator, you will find ``type_traits`` very handy. - -Declarations hierarchy ----------------------- - -A declaration hierarchy is used to represent an arbitrary C++ declaration. -Basically, most of the classes defined in this package are just "set of properties". - -``declaration_t`` is the base class of the declaration hierarchy. Every declaration -has ``parent`` property. This property keeps a reference to the scope declaration -instance, in which this declaration is defined. - -The ``scopedef_t`` class derives from ``declaration_t``. This class is used to -say - "I may have other declarations inside". The "composite" design pattern is -used here. ``class_t`` and ``namespace_t`` declaration classes derive from the -``scopedef_t`` class. - ------------------- -``parser`` package ------------------- - -Please take a look on `parser package UML diagram`_ . Classes defined in this -package, implement parsing and linking functionality. There are few kind of -classes defined by the package: - -* classes, that implements parsing algorithms of `GCC-XML`_ generated XML file - -* parser configuration classes - -* cache - classes, those one will help you to eliminate unnecessary parsing - -* patchers - classes, which fix `GCC-XML`_ generated declarations. ( Yes, sometimes - GCC-XML generates wrong description of C++ declaration. ) - -Parser classes --------------- - -``source_reader_t`` - the only class that have a detailed knowledge about `GCC-XML`_. -It has only one responsibility: it calls `GCC-XML`_ with a source file specified -by user and creates declarations tree. The implementation of this class is split -to 2 classes: - -1. ``scanner_t`` - this class scans the "XML" file, generated by `GCC-XML`_ and - creates :doc:`pygccxml <pygccxml>` declarations and types classes. After the xml file has - been processed declarations and type class instances keeps references to - each other using `GCC-XML`_ generated ids. - -2. ``linker_t`` - this class contains logic for replacing `GCC-XML`_ generated - ids with references to declarations or type class instances. - -Both those classes are implementation details and should not be used by user. -Performance note: ``scanner_t`` class uses Python ``xml.sax`` package in order -to parse XML. As a result, ``scanner_t`` class is able to parse even big XML files -pretty quick. - -``project_reader_t`` - think about this class as a linker. In most cases you work -with few source files. GCC-XML does not supports this mode of work. So, :doc:`pygccxml <pygccxml>` -implements all functionality needed to parse few source files at once. -``project_reader_t`` implements 2 different algorithms, that solves the problem: - -1. ``project_reader_t`` creates temporal source file, which includes all the source - files. - -2. ``project_reader_t`` parse separately every source file, using ``source_reader_t`` - class and then joins the resulting declarations tree into single declarations - tree. - -Both approaches have different trades-off. The first approach does not allow you -to reuse information from already parsed source files. While the second one -allows you to setup cache. - -Parser configuration classes ----------------------------- - -``config_t`` - a class, that accumulates all the settings needed to invoke `GCC-XML`_: - - -``file_configuration_t`` - a class, that contains some data and description how -to treat the data. ``file_configuration_t`` can contain reference to the the following types -of data: - -(1) path to C++ source file - -(2) path to `GCC-XML`_ generated XML file - -(3) path to C++ source file and path to `GCC-XML`_ generated XML file - - In this case, if XML file does not exists, it will be created. Next time - you will ask to parse the source file, the XML file will be used instead. - - Small tip: you can setup your makefile to delete XML files every time, - the relevant source file has changed. - -(4) Python string, that contains valid C++ code - -There are few functions that will help you to construct ``file_configuration_t`` -object: - -* ``def create_source_fc( header )`` - - ``header`` contains path to C++ source file - -* ``def create_gccxml_fc( xml_file )`` - - ``xml_file`` contains path to `GCC-XML`_ generated XML file - -* ``def create_cached_source_fc( header, cached_source_file )`` - - - ``header`` contains path to C++ source file - - ``xml_file`` contains path to `GCC-XML`_ generated XML file - -* ``def create_text_fc( text )`` - - ``text`` - Python string, that contains valid C++ code - - -Cache classes -------------- - -There are few cache classes, which implements different cache strategies. - -1. ``file_configuration_t`` class, that keeps path to C++ source file and path to - `GCC-XML`_ generated XML file. - -2. ``file_cache_t`` class, will save all declarations from all files within single - binary file. - -3. ``directory_cache_t`` class will store one index file called "index.dat" which - is always read by the cache when the cache object is created. Each header file - will have its corresponding \*.cache file that stores the declarations found - in the header file. The index file is used to determine whether a \*.cache file - is still valid or not (by checking if one of the dependent files - (i.e. the header file itself and all included files) have been modified since - the last run). - -In some cases, ``directory_cache_t`` class gives much better performance, than -``file_cache_t``. Many thanks to Matthias Baas for its implementation. - -**Warning**: when :doc:`pygccxml <pygccxml>` writes information to files, using cache classes, -it does not write any version information. It means, that when you upgrade -:doc:`pygccxml <pygccxml>` you have to delete all your cache files. Otherwise you will get very -strange errors. For example: missing attribute. - - -Patchers --------- - -Well, `GCC-XML`_ has few bugs, which could not be fixed from it. For example - -.. code-block:: c++ - - namespace ns1{ namespace ns2{ - enum fruit{ apple, orange }; - } } - -.. code-block:: c++ - - void fix_enum( ns1::ns2::fruit arg=ns1::ns2::apple ); - -`GCC-XML`_ will report the default value of ``arg`` as ``apple``. Obviously -this in an error. :doc:`pygccxml <pygccxml>` knows how to fix this bug. - -This is not the only bug, which could be fixed, there are few of them. :doc:`pygccxml <pygccxml>` -introduces few classes, which knows how to deal with specific bug. More over, those -bugs are fixed, only if I am 101% sure, that this is the right thing to do. - -------- -Summary -------- - -That's all. I hope I was clear, at least I tried. Any way, :doc:`pygccxml <pygccxml>` is an open -source project. You always can take a look on the source code. If you need more -information please read API documentation. - - -.. _`SourceForge`: http://sourceforge.net/index.php -.. _`Python`: http://www.python.org -.. _`GCC-XML`: http://www.gccxml.org -.. _`UML diagram` : declarations_uml.png -.. _`parser package UML diagram` : parser_uml.png -.. _`ReleaseForge` : http://releaseforge.sourceforge.net -.. _`boost::type_traits` : http://www.boost.org/libs/type_traits/index.html +=============== +Design overview +=============== + +------------------------ +The view from 10000 fits +------------------------ + +:doc:`pygccxml <pygccxml>` has 4 packages: + +* :mod:`declarations <pygccxml.declarations>` package defines classes that describe + C++ declarations and types + +* :mod:`parser <pygccxml.parser>` package defines classes that parse `GCC-XML`_ + generated files. Also it defines few classes that will help you to eliminate + unnecessary parsing of C++ source files. + +* :mod:`binary_parsers <pygccxml.binary_parsers>` package extracts some + information from binary files ( `.so`, `.dll`, `.map` ) and merges it with + the declarations tree. + +* ``utils`` package defines few functions, I found useful in the whole project. + +------------------------- +``declarations`` package +------------------------- + +Please take a look on the `UML diagram`_. This `UML diagram`_ describes almost all +classes defined in the package and their relationship. ``declarations`` package +defines two hierarchies of class: + +1. types hierarchy - used to represent a C++ type + +2. declarations hierarchy - used to represent a C++ declaration + + +Types hierarchy +--------------- + +Types hierarchy is used to represent an arbitrary type in C++. class ``type_t`` +is the base class. + +``type_traits`` +~~~~~~~~~~~~~~~ + +Are you aware of `boost::type_traits`_ library? The `boost::type_traits`_ +library contains a set of very specific traits classes, each of which +encapsulate a single trait from the C++ type system; for example, is a type +a pointer or a reference? Or does a type have a trivial constructor, or a +const-qualifier? + +:doc:`pygccxml <pygccxml>` implements a lot of functionality from the library: + +* a lot of algorithms were implemented + + + ``is_same`` + + + ``is_enum`` + + + ``is_void`` + + + ``is_const`` + + + ``is_array`` + + + ``is_pointer`` + + + ``is_volatile`` + + + ``is_integral`` + + + ``is_reference`` + + + ``is_arithmetic`` + + + ``is_convertible`` + + + ``is_fundamental`` + + + ``is_floating_point`` + + + ``is_base_and_derived`` + + + ``is_unary_operator`` + + + ``is_binary_operator`` + + + ``remove_cv`` + + + ``remove_const`` + + + ``remove_alias`` + + + ``remove_pointer`` + + + ``remove_volatile`` + + + ``remove_reference`` + + + ``has_trivial_copy`` + + + ``has_trivial_constructor`` + + + ``has_any_non_copyconstructor`` + + For a full list of implemented algorithms, please consult API documentation. + +* a lot of unit tests has been written base on unit tests from the + `boost::type_traits`_ library. + + +If you are going to build code generator, you will find ``type_traits`` very handy. + +Declarations hierarchy +---------------------- + +A declaration hierarchy is used to represent an arbitrary C++ declaration. +Basically, most of the classes defined in this package are just "set of properties". + +``declaration_t`` is the base class of the declaration hierarchy. Every declaration +has ``parent`` property. This property keeps a reference to the scope declaration +instance, in which this declaration is defined. + +The ``scopedef_t`` class derives from ``declaration_t``. This class is used to +say - "I may have other declarations inside". The "composite" design pattern is +used here. ``class_t`` and ``namespace_t`` declaration classes derive from the +``scopedef_t`` class. + +------------------ +``parser`` package +------------------ + +Please take a look on `parser package UML diagram`_ . Classes defined in this +package, implement parsing and linking functionality. There are few kind of +classes defined by the package: + +* classes, that implements parsing algorithms of `GCC-XML`_ generated XML file + +* parser configuration classes + +* cache - classes, those one will help you to eliminate unnecessary parsing + +* patchers - classes, which fix `GCC-XML`_ generated declarations. ( Yes, sometimes + GCC-XML generates wrong description of C++ declaration. ) + +Parser classes +-------------- + +``source_reader_t`` - the only class that have a detailed knowledge about `GCC-XML`_. +It has only one responsibility: it calls `GCC-XML`_ with a source file specified +by user and creates declarations tree. The implementation of this class is split +to 2 classes: + +1. ``scanner_t`` - this class scans the "XML" file, generated by `GCC-XML`_ and + creates :doc:`pygccxml <pygccxml>` declarations and types classes. After the xml file has + been processed declarations and type class instances keeps references to + each other using `GCC-XML`_ generated ids. + +2. ``linker_t`` - this class contains logic for replacing `GCC-XML`_ generated + ids with references to declarations or type class instances. + +Both those classes are implementation details and should not be used by user. +Performance note: ``scanner_t`` class uses Python ``xml.sax`` package in order +to parse XML. As a result, ``scanner_t`` class is able to parse even big XML files +pretty quick. + +``project_reader_t`` - think about this class as a linker. In most cases you work +with few source files. GCC-XML does not supports this mode of work. So, :doc:`pygccxml <pygccxml>` +implements all functionality needed to parse few source files at once. +``project_reader_t`` implements 2 different algorithms, that solves the problem: + +1. ``project_reader_t`` creates temporal source file, which includes all the source + files. + +2. ``project_reader_t`` parse separately every source file, using ``source_reader_t`` + class and then joins the resulting declarations tree into single declarations + tree. + +Both approaches have different trades-off. The first approach does not allow you +to reuse information from already parsed source files. While the second one +allows you to setup cache. + +Parser configuration classes +---------------------------- + +``config_t`` - a class, that accumulates all the settings needed to invoke `GCC-XML`_: + + +``file_configuration_t`` - a class, that contains some data and description how +to treat the data. ``file_configuration_t`` can contain reference to the the following types +of data: + +(1) path to C++ source file + +(2) path to `GCC-XML`_ generated XML file + +(3) path to C++ source file and path to `GCC-XML`_ generated XML file + + In this case, if XML file does not exists, it will be created. Next time + you will ask to parse the source file, the XML file will be used instead. + + Small tip: you can setup your makefile to delete XML files every time, + the relevant source file has changed. + +(4) Python string, that contains valid C++ code + +There are few functions that will help you to construct ``file_configuration_t`` +object: + +* ``def create_source_fc( header )`` + + ``header`` contains path to C++ source file + +* ``def create_gccxml_fc( xml_file )`` + + ``xml_file`` contains path to `GCC-XML`_ generated XML file + +* ``def create_cached_source_fc( header, cached_source_file )`` + + - ``header`` contains path to C++ source file + - ``xml_file`` contains path to `GCC-XML`_ generated XML file + +* ``def create_text_fc( text )`` + + ``text`` - Python string, that contains valid C++ code + + +Cache classes +------------- + +There are few cache classes, which implements different cache strategies. + +1. ``file_configuration_t`` class, that keeps path to C++ source file and path to + `GCC-XML`_ generated XML file. + +2. ``file_cache_t`` class, will save all declarations from all files within single + binary file. + +3. ``directory_cache_t`` class will store one index file called "index.dat" which + is always read by the cache when the cache object is created. Each header file + will have its corresponding \*.cache file that stores the declarations found + in the header file. The index file is used to determine whether a \*.cache file + is still valid or not (by checking if one of the dependent files + (i.e. the header file itself and all included files) have been modified since + the last run). + +In some cases, ``directory_cache_t`` class gives much better performance, than +``file_cache_t``. Many thanks to Matthias Baas for its implementation. + +**Warning**: when :doc:`pygccxml <pygccxml>` writes information to files, using cache classes, +it does not write any version information. It means, that when you upgrade +:doc:`pygccxml <pygccxml>` you have to delete all your cache files. Otherwise you will get very +strange errors. For example: missing attribute. + + +Patchers +-------- + +Well, `GCC-XML`_ has few bugs, which could not be fixed from it. For example + +.. code-block:: c++ + + namespace ns1{ namespace ns2{ + enum fruit{ apple, orange }; + } } + +.. code-block:: c++ + + void fix_enum( ns1::ns2::fruit arg=ns1::ns2::apple ); + +`GCC-XML`_ will report the default value of ``arg`` as ``apple``. Obviously +this in an error. :doc:`pygccxml <pygccxml>` knows how to fix this bug. + +This is not the only bug, which could be fixed, there are few of them. :doc:`pygccxml <pygccxml>` +introduces few classes, which knows how to deal with specific bug. More over, those +bugs are fixed, only if I am 101% sure, that this is the right thing to do. + +------- +Summary +------- + +That's all. I hope I was clear, at least I tried. Any way, :doc:`pygccxml <pygccxml>` is an open +source project. You always can take a look on the source code. If you need more +information please read API documentation. + + +.. _`SourceForge`: http://sourceforge.net/index.php +.. _`Python`: http://www.python.org +.. _`GCC-XML`: http://www.gccxml.org +.. _`UML diagram` : declarations_uml.png +.. _`parser package UML diagram` : parser_uml.png +.. _`ReleaseForge` : http://releaseforge.sourceforge.net +.. _`boost::type_traits` : http://www.boost.org/libs/type_traits/index.html Modified: pygccxml_dev/docs/download.rest =================================================================== --- pygccxml_dev/docs/download.rest 2009-05-12 05:12:04 UTC (rev 1724) +++ pygccxml_dev/docs/download.rest 2009-05-13 10:22:27 UTC (rev 1725) @@ -1,67 +1,67 @@ -================== -Download & Install -================== - -------------------------- -pygccxml on SourceForge -------------------------- - -:doc:`pygccxml <pygccxml>` project is hosted on SourceForge. Using SourceForge services you -can: - -1) get access to source code -2) get access to latest release version of :doc:`pygccxml <pygccxml>` - - ------------------ -Subversion access ------------------ - -http://sourceforge.net/svn/?group_id=118209 - --------- -Download --------- - -https://sourceforge.net/project/showfiles.php?group_id=118209 - ------------- -Installation ------------- - -GCC-XML -------- -There are few different ways to install GCC-XML on your system: - -1. If you use Linux, than I am almost sure your system has "gccxml" package. - Consider to install it using "native"(rpm, deb, portage) packaging system. - -.. line separator - -2. Another option is to install it from the source code. See `instructions`_ - provided by Brad King, the author of `GCC-XML`_. Installation from sources - is supported for Windows, Linux and Mac platforms. - -.. _`instructions` : http://gccxml.org/HTML/Install.html - -3. You can use `GCC-XML`_ installer built by me, from the CVS. Go to `download page`_ - and download "gccxml-setup". - -.. _`download page` : http://sourceforge.net/project/showfiles.php?group_id=118209 - -pygccxml --------- -In command prompt or shell change current directory to be "pygccxml-X.Y.Z". -"X.Y.Z" is version of :doc:`pygccxml <pygccxml>`. Type the following command: - -| ``python setup.py install`` - -After this command complete, you should have installed :doc:`pygccxml <pygccxml>` package. - ------------- -Dependencies ------------- - -* `GCC-XML`_ - -.. _`GCC-XML`: http://www.gccxml.org +================== +Download & Install +================== + +------------------------- +pygccxml on SourceForge +------------------------- + +:doc:`pygccxml <pygccxml>` project is hosted on SourceForge. Using SourceForge services you +can: + +1) get access to source code +2) get access to latest release version of :doc:`pygccxml <pygccxml>` + + +----------------- +Subversion access +----------------- + +http://sourceforge.net/svn/?group_id=118209 + +-------- +Download +-------- + +https://sourceforge.net/project/showfiles.php?group_id=118209 + +------------ +Installation +------------ + +GCC-XML +------- +There are few different ways to install GCC-XML on your system: + +1. If you use Linux, than I am almost sure your system has "gccxml" package. + Consider to install it using "native"(rpm, deb, portage) packaging system. + +.. line separator + +2. Another option is to install it from the source code. See `instructions`_ + provided by Brad King, the author of `GCC-XML`_. Installation from sources + is supported for Windows, Linux and Mac platforms. + +.. _`instructions` : http://gccxml.org/HTML/Install.html + +3. You can use `GCC-XML`_ installer built by me, from the CVS. Go to `download page`_ + and download "gccxml-setup". + +.. _`download page` : http://sourceforge.net/project/showfiles.php?group_id=118209 + +pygccxml +-------- +In command prompt or shell change current directory to be "pygccxml-X.Y.Z". +"X.Y.Z" is version of :doc:`pygccxml <pygccxml>`. Type the following command: + +| ``python setup.py install`` + +After this command complete, you should have installed :doc:`pygccxml <pygccxml>` package. + +------------ +Dependencies +------------ + +* `GCC-XML`_ + +.. _`GCC-XML`: http://www.gccxml.org Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2009-05-12 05:12:04 UTC (rev 1724) +++ pygccxml_dev/docs/history/history.rest 2009-05-13 10:22:27 UTC (rev 1725) @@ -1,563 +1,563 @@ -=================== -Development history -=================== - ------------- -Contributors ------------- - -Thanks to all the people that have contributed patches, bug reports and suggestions: - -* My wife - Yulia -* John Pallister -* Matthias Baas -* Allen Bierbaum -* Georgiy Dernovoy -* Darren Garnier -* Gottfried Ganssauge -* Gaetan Lehmann -* Martin Preisler -* Miguel Lobo -* Jeremy Sanders -* Ben Schleimer -* Gustavo Carneiro - ------------ -Version 1.1 ------------ - -1. Experimental back-ends based on ``.pdb`` and ``.bsc`` files were removed. - -2. Ability to extract different information from binary files ( ``.pdb``, ``.so``, - ``.map`` ) and merge it with a declarations tree was added. - -3. Ability to load `GCC-XML`_ configuration from ``.ini`` like file was added. - See :func:`pygccxml.parser.config.load_gccxml_configuration` for details. - -4. From now on, :doc:`pygccxml <../pygccxml>` will use `Sphinx <http://sphinx.pocoo.org/>`_ - for all documentation. The documentation format and content were updated. - -5. From now on, `pygccxml` will provide convenient setup for latest `GCC-XML`_ - version (CVS). See :doc:`download <../download>` document. - -6. Bug `[ 2431993 ] pygccxml parses const volatile variable args as just const <http://sourceforge.net/tracker/index.php?func=detail&aid=2431993&group_id=118209&atid=684318>`_ - was fixed. - - ------------ -Version 1.0 ------------ - -1. Support for ellipsis was added. - - Warning: this feature introduce backward compatibility problem! - - Description: - - .. code-block:: c++ - - void do_smth( int, ... ) - - Before this change, pygccxml would report that the function ``do_smth`` has - only one argument. - - After this change, pygccxml will report that the function has two arguments. - The second argument type will be ``declarations.ellipsis_t``. All classes, - which describe callables, have new property ``has_ellipsis``. It the value of - the property is ``True``, than the function has ellipsis in its definition. - -2. New experimental back-end, based on ``.pdb`` (progam database file), was added. - -3. New high-level API wrapper for ``.bsc`` (browse source code file) was added. - -4. The recomended `GCC-XML`_ version to use with this release is CVS revision 123. - This revision introduces small, but very important feature. `GCC-XML`_ - started to dump artificial declarations (constructor, destructor, operator=). - ``pygccxml.declarations.type_traits`` functions were updated to use the new - information. - -5. ``declarations.decl_printer_t`` class dumps almost all available information - about a declaration. - -6. ``declarations.is_same_function`` was fixed and now it treats - "covariant returns" right. - -7. Search algorithm was improved for template instantiated classes. From - now, a spaces within the class name doesn't matter. - -8. pygccxml unit tests functionality was improved. Many thanks to Gustavo Carneiro. - -------------- -Version 0.9.5 -------------- - -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 - -3. A bug in parsing a function exception specification was fixed. Many thanks to - Jeremy Sanders. - -4. Support for a type/class "align", "offset" and "size" was added. Many thanks to - Ben Schleimer for the implementation. - -5. Support for GCC-XML 0.9 was added. - -6. Support for ``__restrict__`` was added. - -7. ``declarations.has_trivial_copy`` was renamed to ``declarations.has_copy_constructor``. - The old name is still available, but will be removed soon. - -8. ``declarations.priority_queue`` was renamed to ``declarations.priority_queue_traits``. - -9. ``declarations.find_container_traits`` function was added. - -10. Support for "partial name" was added. "Partial name" is the class name, without - template default arguments. The functionality was added to std containers - classes. - -11. ``declarations.class_t`` and ``declarations.class_declaration_t`` has new property - - ``container_traits``. This property describes std container element class. - -12. All logging is now done to ``stderr`` instead of ``stdout``. - -------------- -Version 0.9.0 -------------- - -1. Performance was improved. :doc:`pygccxml <../pygccxml>` is now 30-50% faster. The improvement - was achieved by using `cElementTree`_ package, ``iterparse`` functionality, - instead of standard XML SAX API. If `cElementTree`_ package is not available, - the built-in XML SAX package is used. - -.. _`cElementTree` : http://effbot.org/zone/celementtree.htm - -2. ``is_base_and_derived`` function was changed. The second argument could be - a tuple, which contains classes. The function returns ``True`` if at least one - class derives from the base one. - -.. line separator - -3. Class ``calldef_t`` has property - ``does_throw``. It describes - whether the function throws any exception or not. - -.. line separator - -4. Bug fixes: small bug was fixed in functionality that corrects GCC-XML reported - function default arguments. Reference to "enum" declaration extracted properly. - Many thanks to Martin Preisler for reporting the bug. - -.. line separator - -5. New type traits have been added: - - - * ``is_std_ostream`` - * ``is_std_wostream`` - -.. line separator - -6. C++ does not define implicit conversion between an integral type and ``void*``. - ``declarations.is_convertible`` type traits was fixed. - -.. line separator - -7. ``declarations.is_noncopyable`` type traits implementation was slightly changed. - Now it checks explicitly that class has: - - * default constructor - * copy constructor - * ``operator=`` - * destructor - - If all listed functions exist, than the algorithm returns ``False``, otherwise - it will continue to execute previous logic. - -.. line separator - -8. ``declarations.class_declaration_t`` has new property - ``aliases``. This is - a list of all aliases to the class declaration. - -.. line separator - -9. The message of the exception, which is raised from ``declarations.mdecl_wrapper_t`` - class was improved and now clearly explains what the problem is. - -.. line separator - -------------- -Version 0.8.5 -------------- - -1. Added new functionality: "I depend on them". Every declaration can report - types and declarations it depends on. - -2. ``signed char`` and ``char`` are two different types. This bug was fixed and - now :doc:`pygccxml <../pygccxml>` treats them right. Many thanks to Gaetan Lehmann for reporting - the bug. - -3. Declarations, read from GCC-XML generated file, could be saved in cache. - -4. New type traits have been added: - - * ``is_bool`` - -5. Small improvement to algorithm, which extracts ``value_type`` - ( ``mapped_type`` ) from "std" containers. - -6. Few aliases to long method name were introduced: - - ================================= ========================== - Name Alias - ================================= ========================== - ``scopedef_t.variable`` ``scopedef_t.var`` - ``scopedef_t.variables`` ``scopedef_t.vars`` - ``scopedef_t.member_function`` ``scopedef_t.mem_fun`` - ``scopedef_t.member_functions`` ``scopedef_t.mem_funs`` - ``scopedef_t.free_function`` ``scopedef_t.free_fun`` - ``scopedef_t.free_functions`` ``scopedef_t.free_funs`` - ================================= ========================== - -7. Fixing bug related to array size and cache. - -------------- -Version 0.8.2 -------------- - -1. Few small bug fix and unit tests have been introduced on 64 Bit platforms. - Many thanks to Gottfried Ganssauge! He also help me to discover and fix - some important bug in ``type_traits.__remove_alias`` function, by introducing - small example that reproduced the error. - -2. Huge speed improvement has been achieved (x10). Allen Bierbaum suggested to - save and reuse results of different :doc:`pygccxml <../pygccxml>` algorithms: - - * ``declarations.remove_alias`` - * ``declarations.full_name`` - * ``declarations.access_type`` - * ``declarations.demangled_name`` - * ``declarations.declaration_path`` - -3. Interface changes: - - * ``declarations.class_t``: - - + ``set_members`` method was removed - - + ``adopt_declaration`` method was introduced, instead of ``set_members`` - - * ``declarations.array_t`` class "set" accessor for size property was added. - - * ``declarations.namespace_t.adopt_declaration`` method was added. - - * ``declarations.variable_t.access_type`` property was added. - -4. New type traits have been added: - - * ``is_same_function`` - -5. Few bug were fixed. - -6. Documentation was improved. - -------------- -Version 0.8.1 -------------- - -1. :doc:`pygccxml <../pygccxml>` has been ported to MacOS X. Many thanks to Darren Garnier! - -2. New type traits have been added: - - * ``enum_traits`` - - * ``class_traits`` - - * ``class_declaration_traits`` - - * ``is_std_string`` - - * ``is_std_wstring`` - - * ``remove_declarated`` - - * ``has_public_less`` - - * ``has_public_equal`` - - * ``has_public_binary_operator`` - - * ``smart_pointer_traits`` - - * ``list_traits`` - - * ``deque_traits`` - - * ``queue_traits`` - - * ``priority_queue`` - - * ``vector_traits`` - - * ``stack_traits`` - - * ``map_traits`` - - * ``multimap_traits`` - - * ``hash_map_traits`` - - * ``hash_multimap_traits`` - - * ``set_traits`` - - * ``hash_set_traits`` - - * ``multiset_traits`` - - * ``hash_multiset_traits`` - -3. ``enumeration_t`` class interface was changed. Enumeration values are kept - in a list, instead of a dictionary. ``get_name2value_dict`` will build for - you dictionary, where key is an enumeration name, and value is an enumeration - value. - - This has been done in order to provide stable order of enumeration values. - -4. Now you can pass operator symbol, as a name to query functions: - - .. code-block:: python - - cls = global_namespace.class_( 'my_class' ) - op = cls.operator( '<' ) - #instead of - op = cls.operator( symbol='<' ) - -5. :doc:`pygccxml <../pygccxml>` improved a lot functionality related to providing feedback to user: - - * every package has its own logger - - * only important user messages are written to ``stdout`` - - * user messages are clear - -6. Support to Java native types has been added. - -7. It is possible to pass an arbitrary string as a parameter to `GCC-XML`_. - -8. Native java types has been added to fundamental types. - -9. Cache classes implementation was improved. - -10. Few bug were fixed. - -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: - - .. code-block:: python - - classes = ns.decls("class") - classes.decls("method") - - This will fail because it finds the attribute decls which is not a callable. - ------------ -Version 0.8 ------------ - -1. :doc:`pygccxml <../pygccxml>` now has power "select" interface. Read more about this cool feature - in tutorials. - -2. Improved support for template instantiations. :doc:`pygccxml <../pygccxml>` now take into - account demangled name of declarations. Please refer to documentation for - more explanantion. - -3. ``dummy_type_t`` - new type in types hierarchy. This is a very useful class - for code generation projects. - -4. New function - ``get_global_namespace``. As you can guess, it will find and - return reference to global namespace. - -5. New functionality in ``type_traits`` - ``has_public_assign``. This function - will return True, if class has public assign operator. - -6. ``declarations.class_t`` has new property - ``aliases``. This is a list of - all class aliases. - -7. Bug fixes. - -8. Documentation has been updated/written/improved. - -------------- -Version 0.7.1 -------------- - -**Attention - this going to be last version that is tested with Python 2.3** - -1. New fundamental types has been added - - * complex float - - * complex double - - * complex long double - -2. **Attention - non backward compatible change** - - ``declarations.filtering.user_defined`` and ``declarations.filtering.by_location`` - implementation has been changed. In previous version of those functions, - ``decls`` list has been changed in place. This was wrong behavior. Now, - those functions will return new list, which contains all desired declarations. - -3. Few new type traits has been added - - * *type_traits.has_destructor* - - * *type_traits.has_public_destructor* - - * *type_traits.has_public_constructor* - - * *type_traits.is_noncopyable* - -4. ``decl_printer_t`` class and ``print_declarations`` function have been added. - Now you can print in a nice way your declaration tree or part of it. - Thanks to Allen Bierbaum! - -5. New class ``declarations.decl_factory_t`` has been added. This is a default - factory for all declarations. From now all relevant parser classes takes as - input instance of this class or ``Null``. In case of ``Null`` instance of - ``declarations.decl_factory_t`` will be created. Using this class you can - easily extend functionality provided by built-in declarations. - -6. Sometimes, there is a need to find a declaration that match some criteria. - The was such functionality in :doc:`pygccxml <../pygccxml>`, but it was too limited. This - release fix the situation. :doc:`pygccxml <../pygccxml>` adds a set of classes that will help - you to deal with this problem. - -7. New cache - ``parser.directory_cache_t`` has been implemented. - ``parser.directory_cache_t`` uses individual files stored in a dedicated - cache directory to store the cached contents. - Thanks to Matthias Baas! - -8. ``parser.file_cache_t`` has been improved a lot. - Thanks to Allen Bierbaum! - -9. New file configuration is available: "cached source file". - ``parser.project_reader_t`` class will check for existence of `GCC-XML`_ - generated file. If it does not exist it will create one. If it do exist, - then the parser will use that file. - -10. Few helper functions has been added in order to make construction of - configuration file to be as easy as possible: - - * ``parser.create_text_fc`` - creates file configuration, that contains text - * ``parser.create_source_fc`` - creates file configuration, that contains - reference to regular source file - * ``parser.create_gccxml_fc`` - creates file configuration, that contains - reference to `GCC-XML`_ generated file - * ``parser.create_cached_source_fc`` - creates file configuration, that - contains reference to 2 files: `GCC-XML`_ generated file and regular source - file - -11. Small bug fixes. - -12. Documentation. Allen Bierbaum and Matthias Baas contributed so much in this - area. Almost every public function/class has now documentation string. - -13. Logging functionality has been added. :doc:`pygccxml <../pygccxml>` creates new logger - "pygccxml". Now it is possible to see what :doc:`pygccxml <../pygccxml>` is doing right now. - -14. I am sure I forgot something. - - -------------- -Version 0.6.9 -------------- - -1. New functions: - - * *type_traits.is_void_pointer* - - * *type_traits.array_size* - - * *type_traits.array_item_type* - -2. Class *declarations.variable_t* has new property - *bit_fields* - -3. Now it is possible to specify "undefined" directives using - *parser.config_t* class. - -4. *patch* functionality has been introduced. `GCC-XML`_ generates wrong - default values for function arguments. *patch* functionality tries to fix - this. - -5. Small bug fixes - -------------- -Version 0.6.8 -------------- - -1. Small bug has been fixed. - -------------- -Version 0.6.7 -------------- - -1. New functions: - - * *type_traits.remove_pointer* - - * *type_traits.base_type* - - * *type_traits.is_convertible* - -2. A lot of small bug fixes. - -3. Few English mistakes have been fixed. - - .. attention:: - - There are 2 none backward compatible changes: - - * class with name **compaund_t** has been renamed to **compound_t** - - * word **pathes** has been replaced with **paths** - -4. There are new properties on - - * *declarations.declaration_t.top_parent* - - * *declarations.class_t.recursive_bases* returns all base classes of the - class - - * *declarations.class_t.recursive_derived* returns all derived classes of - the class - - * *member_calldef_t.access_type* - -5. New type has been introduced: *unknown_t*. There are use cases when - `GCC-XML`_ does not returns function return type. - -6. New implementation of *make_flatten* algorithm using generators. - By default old implementation will be used. - -7. *parser.file_configuration_t* interface has been changed. Now it is able - to keep: source file, text or `GCC-XML`_ generated file. If you are doing - something with code that is not changing you'd better use `GCC-XML`_ - generated file as content of the *parser.file_configuration_t*. Save your - time. - -8. There are some cases when `GCC-XML`_ reports *"restricted"*. In this case - :doc:`pygccxml <../pygccxml>` replaces *"restricted"* with *"volatile"*. - - -.. _`SourceForge`: http://sourceforge.net/index.php -.. _`GCC-XML`: http://www.gccxml.org +=================== +Development history +=================== + +------------ +Contributors +------------ + +Thanks to all the people that have contributed patches, bug reports and suggestions: + +* My wife - Yulia +* John Pallister +* Matthias Baas +* Allen Bierbaum +* Georgiy Dernovoy +* Darren Garnier +* Gottfried Ganssauge +* Gaetan Lehmann +* Martin Preisler +* Miguel Lobo +* Jeremy Sanders +* Ben Schleimer +* Gustavo Carneiro + +----------- +Version 1.1 +----------- + +1. Experimental back-ends based on ``.pdb`` and ``.bsc`` files were removed. + +2. Ability to extract different information from binary files ( ``.pdb``, ``.so``, + ``.map`` ) and merge it with a declarations tree was added. + +3. Ability to load `GCC-XML`_ configuration from ``.ini`` like file was added. + See :func:`pygccxml.parser.config.load_gccxml_configuration` for details. + +4. From now on, :doc:`pygccxml <../pygccxml>` will use `Sphinx <http://sphinx.pocoo.org/>`_ + for all documentation. The documentation format and content were updated. + +5. From now on, `pygccxml` will provide convenient setup for latest `GCC-XML`_ + version (CVS). See :doc:`download <../download>` document. + +6. Bug `[ 2431993 ] pygccxml parses const volatile variable args as just const <http://sourceforge.net/tracker/index.php?func=detail&aid=2431993&group_id=118209&atid=684318>`_ + was fixed. + + +----------- +Version 1.0 +----------- + +1. Support for ellipsis was added. + + Warning: this feature introduce backward compatibility problem! + + Description: + + .. code-block:: c++ + + void do_smth( int, ... ) + + Before this change, pygccxml would report that the function ``do_smth`` has + only one argument. + + After this change, pygccxml will report that the function has two arguments. + The second argument type will be ``declarations.ellipsis_t``. All classes, + which describe callables, have new property ``has_ellipsis``. It the value of + the property is ``True``, than the function has ellipsis in its definition. + +2. New experimental back-end, based on ``.pdb`` (progam database file), was added. + +3. New high-level API wrapper for ``.bsc`` (browse source code file) was added. + +4. The recomended `GCC-XML`_ version to use with this release is CVS revision 123. + This revision introduces small, but very important feature. `GCC-XML`_ + started to dump artificial declarations (constructor, destructor, operator=). + ``pygccxml.declarations.type_traits`` functions were updated to use the new + information. + +5. ``declarations.decl_printer_t`` class dumps almost all available information + about a declaration. + +6. ``declarations.is_same_function`` was fixed and now it treats + "covariant returns" right. + +7. Search algorithm was improved for template instantiated classes. From + now, a spaces within the class name doesn't matter. + +8. pygccxml unit tests functionality was improved. Many thanks to Gustavo Carneiro. + +------------- +Version 0.9.5 +------------- + +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 + +3. A bug in parsing a function exception specification was fixed. Many thanks to + Jeremy Sanders. + +4. Support for a type/class "align", "offset" and "size" was added. Many thanks to + Ben Schleimer for the implementation. + +5. Support for GCC-XML 0.9 was added. + +6. Support for ``__restrict__`` was added. + +7. ``declarations.has_trivial_copy`` was renamed to ``declarations.has_copy_constructor``. + The old name is still available, but will be removed soon. + +8. ``declarations.priority_queue`` was renamed to ``declarations.priority_queue_traits``. + +9. ``declarations.find_container_traits`` function was added. + +10. Support for "partial name" was added. "Partial name" is the class name, without + template default arguments. The functionality was added to std containers + classes. + +11. ``declarations.class_t`` and ``declarations.class_declaration_t`` has new property - + ``container_traits``. This property describes std container element class. + +12. All logging is now done to ``stderr`` instead of ``stdout``. + +------------- +Version 0.9.0 +------------- + +1. Performance was improved. :doc:`pygccxml <../pygccxml>` is now 30-50% faster. The improvement + was achieved by using `cElementTree`_ package, ``iterparse`` functionality, + instead of standard XML SAX API. If `cElementTree`_ package is not available, + the built-in XML SAX package is used. + +.. _`cElementTree` : http://effbot.org/zone/celementtree.htm + +2. ``is_base_and_derived`` function was changed. The second argument could be + a tuple, which contains classes. The function returns ``True`` if at least one + class derives from the base one. + +.. line separator + +3. Class ``calldef_t`` has property - ``does_throw``. It describes + whether the function throws any exception or not. + +.. line separator + +4. Bug fixes: small bug was fixed in functionality that corrects GCC-XML reported + function default arguments. Reference to "enum" declaration extracted properly. + Many thanks to Martin Preisler for reporting the bug. + +.. line separator + +5. New type traits have been added: + + + * ``is_std_ostream`` + * ``is_std_wostream`` + +.. line separator + +6. C++ does not define implicit conversion between an integral type and ``void*``. + ``declarations.is_convertible`` type traits was fixed. + +.. line separator + +7. ``declarations.is_noncopyable`` type traits implementation was slightly changed. + Now it checks explicitly that class has: + + * default constructor + * copy constructor + * ``operator=`` + * destructor + + If all listed functions exist, than the algorithm returns ``False``, otherwise + it will continue to execute previous logic. + +.. line separator + +8. ``declarations.class_declaration_t`` has new property - ``aliases``. This is + a list of all aliases to the class declaration. + +.. line separator + +9. The message of the exception, which is raised from ``declarations.mdecl_wrapper_t`` + class was improved and now clearly explains what the problem is. + +.. line separator + +------------- +Version 0.8.5 +------------- + +1. Added new functionality: "I depend on them". Every declaration can report + types and declarations it depends on. + +2. ``signed char`` and ``char`` are two different types. This bug was fixed and + now :doc:`pygccxml <../pygccxml>` treats them right. Many thanks to Gaetan Lehmann for reporting + the bug. + +3. Declarations, read from GCC-XML generated file, could be saved in cache. + +4. New type traits have been added: + + * ``is_bool`` + +5. Small improvement to algorithm, which extracts ``value_type`` + ( ``mapped_type`` ) from "std" containers. + +6. Few aliases to long method name were introduced: + + ================================= ========================== + Name Alias + ================================= ========================== + ``scopedef_t.variable`` ``scopedef_t.var`` + ``scopedef_t.variables`` ``scopedef_t.vars`` + ``scopedef_t.member_function`` ``scopedef_t.mem_fun`` + ``scopedef_t.member_functions`` ``scopedef_t.mem_funs`` + ``scopedef_t.free_function`` ``scopedef_t.free_fun`` + ``scopedef_t.free_functions`` ``scopedef_t.free_funs`` + ================================= ========================== + +7. Fixing bug related to array size and cache. + +------------- +Version 0.8.2 +------------- + +1. Few small bug fix and unit tests have been introduced on 64 Bit platforms. + Many thanks to Gottfried Ganssauge! He also help me to discover and fix + some important bug in ``type_traits.__remove_alias`` function, by introducing + small example that reproduced the error. + +2. Huge speed improvement has been achieved (x10). Allen Bierbaum suggested to + save and reuse results of different :doc:`pygccxml <../pygccxml>` algorithms: + + * ``declarations.remove_alias`` + * ``declarations.full_name`` + * ``declarations.access_type`` + * ``declarations.demangled_name`` + * ``declarations.declaration_path`` + +3. Interface changes: + + * ``declarations.class_t``: + + + ``set_members`` method was removed + + + ``adopt_declaration`` method was introduced, instead of ``set_members`` + + * ``declarations.array_t`` class "set" accessor for size property was added. + + * ``declarations.namespace_t.adopt_declaration`` method was added. + + * ``declarations.variable_t.access_type`` property was added. + +4. New type traits have been added: + + * ``is_same_function`` + +5. Few bug were fixed. + +6. Documentation was improved. + +------------- +Version 0.8.1 +------------- + +1. :doc:`pygccxml <../pygccxml>` has been ported to MacOS X. Many thanks to Darren Garnier! + +2. New type traits have been added: + + * ``enum_traits`` + + * ``class_traits`` + + * ``class_declaration_traits`` + + * ``is_std_string`` + + * ``is_std_wstring`` + + * ``remove_declarated`` + + * ``has_public_less`` + + * ``has_public_equal`` + + * ``has_public_binary_operator`` + + * ``smart_pointer_traits`` + + * ``list_traits`` + + * ``deque_traits`` + + * ``queue_traits`` + + * ``priority_queue`` + + * ``vector_traits`` + + * ``stack_traits`` + + * ``map_traits`` + + * ``multimap_traits`` + + * ``hash_map_traits`` + + * ``hash_multimap_traits`` + + * ``set_traits`` + + * ``hash_set_traits`` + + * ``multiset_traits`` + + * ``hash_multiset_traits`` + +3. ``enumeration_t`` class interface was changed. Enumeration values are kept + in a list, instead of a dictionary. ``get_name2value_dict`` will build for + you dictionary, where key is an enumeration name, and value is an enumeration + value. + + This has been done in order to provide stable order of enumeration values. + +4. Now you can pass operator symbol, as a name to query functions: + + .. code-block:: python + + cls = global_namespace.class_( 'my_class' ) + op = cls.operator( '<' ) + #instead of + op = cls.operator( symbol='<' ) + +5. :doc:`pygccxml <../pygccxml>` improved a lot functionality related to providing feedback to user: + + * every package has its own logger + + * only important user messages are written to ``stdout`` + + * user messages are clear + +6. Support to Java native types has been added. + +7. It is possible to pass an arbitrary string as a parameter to `GCC-XML`_. + +8. Native java types has been added to fundamental types. + +9. Cache classes implementation was improved. + +10. Few bug were fixed. + +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: + + .. code-block:: python + + classes = ns.decls("class") + classes.decls("method") + + This will fail because it finds the attribute decls which is not a callable. + +----------- +Version 0.8 +----------- + +1. :doc:`pygccxml <../pygccxml>` now has power "select" interface. Read more about this cool feature + in tutorials. + +2. Improved support for template instantiations. :doc:`pygccxml <../pygccxml>` now take into + account demangled name of declarations. Please refer to documentation for + more explanantion. + +3. ``dummy_type_t`` - new type in types hierarchy. This is a very useful class + for code generation projects. + +4. New function - ``get_global_namespace``. As you can guess, it will find and + return reference to global namespace. + +5. New functionality in ``type_traits`` - ``has_public_assign``. This function + will return True, if class has public assign operator. + +6. ``declarations.class_t`` has new property - ``aliases``. This is a list of + all class aliases. + +7. Bug fixes. + +8. Documentation has been updated/written/improved. + +------------- +Version 0.7.1 +------------- + +**Attention - this going to be last version that is tested with Python 2.3** + +1. New fundamental types has been added + + * complex float + + * complex double + + * complex long double + +2. **Attention - non backward compatible change** + + ``declarations.filtering.user_defined`` and ``declarations.filtering.by_location`` + implementation has been changed. In previous version of those functions, + ``decls`` list has been changed in place. This was wrong behavior. Now, + those functions will return new list, which contains all desired declarations. + +3. Few new type traits has been added + + * *type_traits.has_destructor* + + * *type_traits.has_public_destructor* + + * *type_traits.has_public_constructor* + + * *type_traits.is_noncopyable* + +4. ``decl_printer_t`` class and ``print_declarations`` function have been added. + Now you can print in a nice way your declaration tree or part of it. + Thanks to Allen Bierbaum! + +5. New class ``declarations.decl_factory_t`` has been added. This is a default + factory for all declarations. From now all relevant parser classes takes as + input instance of this class or ``Null``. In case of ``Null`` instance of + ``declarations.decl_factory_t`` will be created. Using this class you can + easily extend functionality provided by built-in declarations. + +6. Sometimes, there is a need to find a declaration that match some criteria. + The was such functionality in :doc:`pygccxml <../pygccxml>`, but it was too limited. This + release fix the situation. :doc:`pygccxml <../pygccxml>` adds a set of classes that will help + you to deal with this problem. + +7. New cache - ``parser.directory_cache_t`` has been implemented. + ``parser.directory_cache_t`` uses individual files stored in a dedicated + cache directory to store the cached contents. + Thanks to Matthias Baas! + +8. ``parser.file_cache_t`` has been improved a lot. + Thanks to Allen Bierbaum! + +9. New file configuration is available: "cached source file". + ``parser.project_reader_t`` class will check for existence of `GCC-XML`_ + generated file. If it does not exist it will create one. If it do exist, + then the parser will use that file. + +10. Few helper functions has been added in order to make construction of + configuration file to be as easy as possible: + + * ``parser.create_text_fc`` - creates file configuration, that contains text + * ``parser.create_source_fc`` - creates file configuration, that contains + reference to regular source file + * ``parser.create_gccxml_fc`` - creates file configuration, that contains + reference to `GCC-XML`_ generated file + * ``parser.create_cached_source_fc`` - creates file configuration, that + contains reference to 2 files: `GCC-XML`_ generated file and regular source + file + +11. Small bug fixes. + +12. Documentation. Allen Bierbaum and Matthias Baas contributed so much in this + area. Almost every public function/class has now documentation string. + +13. Logging functionality has been added. :doc:`pygccxml <../pygccxml>` creates new logger + "pygccxml". Now it is possible to see what :doc:`pygccxml <../pygccxml>` is doing right n... [truncated message content] |
From: <rom...@us...> - 2009-05-12 05:12:04
|
Revision: 1724 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1724&view=rev Author: roman_yakovenko Date: 2009-05-12 05:12:04 +0000 (Tue, 12 May 2009) Log Message: ----------- adding favorite icon Added Paths: ----------- sphinx/__static/favicon.ico Added: sphinx/__static/favicon.ico =================================================================== (Binary files differ) Property changes on: sphinx/__static/favicon.ico ___________________________________________________________________ Added: 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...> - 2009-05-11 19:17:13
|
Revision: 1723 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1723&view=rev Author: roman_yakovenko Date: 2009-05-11 19:17:07 +0000 (Mon, 11 May 2009) Log Message: ----------- porting to linux Modified Paths: -------------- pygccxml_dev/unittests/gccxml.cfg Modified: pygccxml_dev/unittests/gccxml.cfg =================================================================== --- pygccxml_dev/unittests/gccxml.cfg 2009-05-11 19:15:45 UTC (rev 1722) +++ pygccxml_dev/unittests/gccxml.cfg 2009-05-11 19:17:07 UTC (rev 1723) @@ -9,5 +9,5 @@ #gccxml has a nice algorithms, which selects what C++ compiler to emulate. #You can explicitly set what compiler it should emulate. #Valid options are: g++, msvc6, msvc7, msvc71, msvc8, cl. -compiler=msvc71 +compiler= #GCC-XML site: http://gccxml.org/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-11 19:15:58
|
Revision: 1722 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1722&view=rev Author: roman_yakovenko Date: 2009-05-11 19:15:45 +0000 (Mon, 11 May 2009) Log Message: ----------- porting few tests to linux Modified Paths: -------------- pyplusplus_dev/environment.py pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py pyplusplus_dev/unittests/gccxml.cfg Modified: pyplusplus_dev/environment.py =================================================================== --- pyplusplus_dev/environment.py 2009-05-11 19:14:10 UTC (rev 1721) +++ pyplusplus_dev/environment.py 2009-05-11 19:15:45 UTC (rev 1722) @@ -44,7 +44,7 @@ scons.ccflags = ['-DBOOST_PYTHON_NO_PY_SIGNATURES' ] boost.libs = ['/home/roman/include/libs' ] boost.include = '/home/roman/boost_svn' - python.include = '/usr/include/python2.5' + python.include = '/usr/include/python2.6' elif 'root' == getpass.getuser(): if sys.platform == 'win32': scons.suffix = '.pyd' Modified: pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py =================================================================== --- pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py 2009-05-11 19:14:10 UTC (rev 1721) +++ pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py 2009-05-11 19:15:45 UTC (rev 1722) @@ -9,6 +9,7 @@ import fundamental_tester_base EXPECTED_ERROR_INFO = "I don't have time to find out what is going wrong" +EXPECTED_FAILURE_INFO = EXPECTED_ERROR_INFO MODULE_SPTR_DECL_CODE = \ Modified: pyplusplus_dev/unittests/gccxml.cfg =================================================================== --- pyplusplus_dev/unittests/gccxml.cfg 2009-05-11 19:14:10 UTC (rev 1721) +++ pyplusplus_dev/unittests/gccxml.cfg 2009-05-11 19:15:45 UTC (rev 1722) @@ -9,5 +9,5 @@ #gccxml has a nice algorithms, which selects what C++ compiler to emulate. #You can explicitly set what compiler it should emulate. #Valid options are: g++, msvc6, msvc7, msvc71, msvc8, cl. -compiler=msvc9 +compiler= #GCC-XML site: http://gccxml.org/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-11 19:14:23
|
Revision: 1721 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1721&view=rev Author: roman_yakovenko Date: 2009-05-11 19:14:10 +0000 (Mon, 11 May 2009) Log Message: ----------- remove SVN merge result Modified Paths: -------------- pygccxml_dev/unittests/data/core_cache.hpp Modified: pygccxml_dev/unittests/data/core_cache.hpp =================================================================== --- pygccxml_dev/unittests/data/core_cache.hpp 2009-05-11 13:05:17 UTC (rev 1720) +++ pygccxml_dev/unittests/data/core_cache.hpp 2009-05-11 19:14:10 UTC (rev 1721) @@ -21,5 +21,4 @@ } } #endif//__core_cache_hpp__ - -//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file +//touch \ 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...> - 2009-05-11 13:42:37
|
Revision: 1716 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1716&view=rev Author: roman_yakovenko Date: 2009-05-11 12:19:59 +0000 (Mon, 11 May 2009) Log Message: ----------- clean-up Property Changed: ---------------- pydsc_dev/ pyplusplus_dev/examples/pyboost_dev/pyboost/boost_random/ pyplusplus_dev/examples/pyboost_dev/pyboost/crc/ pyplusplus_dev/examples/pyboost_dev/pyboost/date_time/ pyplusplus_dev/examples/pyboost_dev/pyboost/rational/ Property changes on: pydsc_dev ___________________________________________________________________ Added: svn:ignore + MANIFEST Property changes on: pyplusplus_dev/examples/pyboost_dev/pyboost/boost_random ___________________________________________________________________ Added: svn:ignore + generated Property changes on: pyplusplus_dev/examples/pyboost_dev/pyboost/crc ___________________________________________________________________ Added: svn:ignore + generated Property changes on: pyplusplus_dev/examples/pyboost_dev/pyboost/date_time ___________________________________________________________________ Added: svn:ignore + generated Property changes on: pyplusplus_dev/examples/pyboost_dev/pyboost/rational ___________________________________________________________________ Added: svn:ignore + generated This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-11 13:05:26
|
Revision: 1720 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1720&view=rev Author: roman_yakovenko Date: 2009-05-11 13:05:17 +0000 (Mon, 11 May 2009) Log Message: ----------- update readme Modified Paths: -------------- pyplusplus_dev/README.txt Modified: pyplusplus_dev/README.txt =================================================================== --- pyplusplus_dev/README.txt 2009-05-11 13:01:54 UTC (rev 1719) +++ pyplusplus_dev/README.txt 2009-05-11 13:05:17 UTC (rev 1720) @@ -13,7 +13,7 @@ In order to use Py++ you need the following additional components: -- Python v2.4 (or higher) +- Python v2.6 (or higher) - pygccxml (http://www.language-binding.net/pygccxml/pygccxml.html) - GCC-XML (http://www.gccxml.org) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-11 13:02:03
|
Revision: 1719 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1719&view=rev Author: roman_yakovenko Date: 2009-05-11 13:01:54 +0000 (Mon, 11 May 2009) Log Message: ----------- cleanup Removed Paths: ------------- pygccxml_dev/unittests/data/big.xml.bz2 pygccxml_dev/unittests/data/big2.xml.bz2 Property Changed: ---------------- pygccxml_dev/unittests/data/binary_parsers/ Deleted: pygccxml_dev/unittests/data/big.xml.bz2 =================================================================== (Binary files differ) Deleted: pygccxml_dev/unittests/data/big2.xml.bz2 =================================================================== (Binary files differ) Property changes on: pygccxml_dev/unittests/data/binary_parsers ___________________________________________________________________ Modified: svn:ignore - Release Debug *.suo binaries + Release Debug *.suo binaries .sconsign.dblite This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-11 12:52:38
|
Revision: 1718 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1718&view=rev Author: roman_yakovenko Date: 2009-05-11 12:52:34 +0000 (Mon, 11 May 2009) Log Message: ----------- cleanup Removed Paths: ------------- pygccxml_dev/unittests/results.txt Deleted: pygccxml_dev/unittests/results.txt =================================================================== --- pygccxml_dev/unittests/results.txt 2009-05-11 12:39:14 UTC (rev 1717) +++ pygccxml_dev/unittests/results.txt 2009-05-11 12:52:34 UTC (rev 1718) @@ -1,242 +0,0 @@ ->python -u "test_performance.py" -unittests will run on DEVELOPMENT version -running - -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... - 15815730 function calls (15569178 primitive calls) in 102.347 CPU seconds - - Ordered by: internal time, call count - List reduced from 424 to 20 due to restriction <20> - - ncalls tottime percall cumtime percall filename:lineno(function) - 1324 8.493 0.006 16.359 0.012 ../pygccxml/parser/patcher.py:115(__find_enum) - 3188314 7.700 0.000 7.700 0.000 ../pygccxml/parser/patcher.py:119(<lambda>) - 735216 7.090 0.000 7.090 0.000 posixpath.py:56(join) - 582283 6.519 0.000 6.894 0.000 posixpath.py:156(islink) - 76466 5.295 0.000 21.655 0.000 posixpath.py:410(realpath) - 271521 3.945 0.000 3.945 0.000 <string>:55(__iter__) - 135760 2.234 0.000 19.078 0.000 ../pygccxml/parser/scanner.py:174(startElement) - 141610 2.018 0.000 2.441 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) - 38689 1.917 0.000 4.648 0.000 ../pygccxml/parser/scanner.py:344(__read_member_function) - 1 1.784 1.784 88.092 88.092 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) - 76466 1.624 0.000 25.001 0.000 ../pygccxml/parser/source_reader.py:304(__produce_full_file) - 76466 1.616 0.000 1.616 0.000 posixpath.py:373(normpath) - 1 1.594 1.594 24.988 24.988 ../pygccxml/parser/etree_scanner.py:45(read) -225592/69633 1.582 0.000 1.835 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) -141499/141100 1.510 0.000 2.789 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) - 27828/6 1.490 0.000 2.173 0.362 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) - 41683 1.463 0.000 2.122 0.000 ../pygccxml/parser/scanner.py:315(__read_argument) - 76194 1.449 0.000 1.795 0.000 ../pygccxml/parser/scanner.py:215(__read_location) - 90232 1.300 0.000 1.981 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:24(_set_inst) - 1 1.218 1.218 4.453 4.453 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) - - -running - done ->Exit code: 0 - - - - - -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... - 12627416 function calls (12380864 primitive calls) in 77.817 CPU seconds - - Ordered by: internal time, call count - List reduced from 423 to 20 due to restriction <20> - - ncalls tottime percall cumtime percall filename:lineno(function) - 735216 6.205 0.000 6.205 0.000 posixpath.py:56(join) - 582283 5.645 0.000 6.005 0.000 posixpath.py:156(islink) - 76466 4.705 0.000 19.188 0.000 posixpath.py:410(realpath) - 271521 3.354 0.000 3.354 0.000 <string>:55(__iter__) - 1324 2.394 0.002 2.534 0.002 ../pygccxml/parser/patcher.py:115(__find_enum) - 135760 1.929 0.000 15.088 0.000 ../pygccxml/parser/scanner.py:174(startElement) - 1 1.704 1.704 63.984 63.984 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) -225592/69633 1.590 0.000 1.846 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) -141499/141100 1.498 0.000 2.742 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) - 76466 1.486 0.000 1.486 0.000 posixpath.py:373(normpath) - 1 1.451 1.451 20.204 20.204 ../pygccxml/parser/etree_scanner.py:45(read) - 90232 1.219 0.000 1.869 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:24(_set_inst) - 76466 1.195 0.000 21.955 0.000 ../pygccxml/parser/source_reader.py:304(__produce_full_file) - 41683 1.062 0.000 1.892 0.000 ../pygccxml/parser/scanner.py:312(__read_argument) - 76205 1.053 0.000 1.855 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) - 65791 1.047 0.000 3.838 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) - 41652 0.981 0.000 1.682 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:61(__link_calldef) - 76466 0.957 0.000 0.957 0.000 posixpath.py:168(exists) - 27828/6 0.954 0.000 1.592 0.265 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) - 557669 0.936 0.000 0.936 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) - - -running - done ->Exit code: 0 - ->python -u "test_performance.py" -unittests will run on DEVELOPMENT version -running - -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... - 10073090 function calls (9835812 primitive calls) in 58.827 CPU seconds - - Ordered by: internal time, call count - List reduced from 419 to 20 due to restriction <20> - - ncalls tottime percall cumtime percall filename:lineno(function) - 271521 3.735 0.000 3.735 0.000 <string>:55(__iter__) - 1324 2.521 0.002 2.667 0.002 ../pygccxml/parser/patcher.py:101(__find_enum) -225592/69633 2.357 0.000 2.613 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) - 135760 2.218 0.000 16.325 0.000 ../pygccxml/parser/scanner.py:174(startElement) - 141610 1.943 0.000 2.325 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) - 76194 1.807 0.000 2.137 0.000 ../pygccxml/parser/scanner.py:213(__read_location) - 1 1.531 1.531 21.903 21.903 ../pygccxml/parser/etree_scanner.py:45(read) -141499/141100 1.527 0.000 2.830 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) - 1 1.457 1.457 4.782 4.782 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) - 90232 1.205 0.000 1.866 0.000 ../pygccxml/parser/linker.py:24(_set_inst) - 41683 1.123 0.000 1.737 0.000 ../pygccxml/parser/scanner.py:313(__read_argument) - 65791 1.075 0.000 4.162 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) - 41652 1.012 0.000 1.727 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) - 38526 0.941 0.000 2.268 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) - 76205 0.908 0.000 1.459 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) - 518982 0.861 0.000 0.861 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) - 76204 0.782 0.000 2.501 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) - 41652 0.728 0.000 2.552 0.000 ../pygccxml/parser/scanner.py:325(__read_calldef) - 516848 0.711 0.000 0.711 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) - 71642 0.678 0.000 2.597 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) - - -running - done ->Exit code: 0 - ->python -u "test_performance.py" -unittests will run on DEVELOPMENT version -running - -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... - 10583171 function calls (10350530 primitive calls) in 60.270 CPU seconds - - Ordered by: internal time, call count - List reduced from 421 to 20 due to restriction <20> - - ncalls tottime percall cumtime percall filename:lineno(function) - 271521 3.893 0.000 3.893 0.000 <string>:55(__iter__) - 135760 2.191 0.000 16.832 0.000 ../pygccxml/parser/scanner.py:179(startElement) - 141610 2.124 0.000 2.545 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) -225592/69633 1.774 0.000 2.064 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) - 1 1.607 1.607 22.649 22.649 ../pygccxml/parser/etree_scanner.py:45(read) -141499/141100 1.567 0.000 3.062 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) - 76194 1.555 0.000 1.908 0.000 ../pygccxml/parser/scanner.py:219(__read_location) - 1324 1.546 0.001 2.569 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) - 41683 1.308 0.000 1.938 0.000 ../pygccxml/parser/scanner.py:319(__read_argument) - 90232 1.197 0.000 1.899 0.000 ../pygccxml/parser/linker.py:24(_set_inst) - 1 1.178 1.178 4.614 4.614 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) - 65791 1.113 0.000 4.126 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) - 76205 1.084 0.000 1.084 0.000 ../pygccxml/parser/patcher.py:182(<lambda>) - 608538 1.006 0.000 1.006 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) - 41652 1.000 0.000 1.761 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) - 76205 0.975 0.000 1.488 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) - 518982 0.934 0.000 0.934 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) - 516848 0.910 0.000 0.910 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) - 76204 0.818 0.000 2.456 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) - 38526 0.812 0.000 2.163 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) - - -running - done ->Exit code: 0 - - ->python -u "test_performance.py" -unittests will run on DEVELOPMENT version -running - -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... - 31749399 function calls (31051476 primitive calls) in 188.225 CPU seconds - - Ordered by: internal time, call count - List reduced from 421 to 30 due to restriction <30> - - ncalls tottime percall cumtime percall filename:lineno(function) - 814563 12.143 0.000 12.143 0.000 <string>:55(__iter__) - 424830 7.973 0.000 9.177 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) - 407280 7.053 0.000 56.374 0.000 ../pygccxml/parser/scanner.py:179(startElement) -676776/208899 5.302 0.000 6.200 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) - 3 5.219 1.740 74.732 24.911 ../pygccxml/parser/etree_scanner.py:45(read) -424497/423300 5.084 0.000 9.270 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) - 125049 4.247 0.000 6.629 0.000 ../pygccxml/parser/scanner.py:319(__read_argument) - 3972 4.153 0.001 7.367 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) - 228615 4.025 0.000 5.306 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) - 124956 4.000 0.000 6.375 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) - 270696 3.940 0.000 6.193 0.000 ../pygccxml/parser/linker.py:24(_set_inst) - 197373 3.522 0.000 13.509 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) - 228582 3.355 0.000 4.619 0.000 ../pygccxml/parser/scanner.py:219(__read_location) - 1825614 3.128 0.000 3.128 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) - 3 3.087 1.029 14.448 4.816 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) - 228612 2.998 0.000 8.169 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) - 1550544 2.991 0.000 2.991 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) - 1556946 2.905 0.000 2.905 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) - 115578 2.626 0.000 6.350 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) - 124956 2.494 0.000 8.618 0.000 ../pygccxml/parser/scanner.py:331(__read_calldef) - 214926 2.125 0.000 8.512 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) - 6 1.954 0.326 9.310 1.552 ../pygccxml/parser/source_reader.py:27(bind_aliases) - 987228 1.940 0.000 1.940 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) - 3 1.873 0.624 138.282 46.094 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) - 3 1.761 0.587 15.909 5.303 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:452(__declarated_types) - 270696 1.729 0.000 29.906 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:265(apply_visitor) - 425985 1.719 0.000 2.409 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:43(_set_access_type) - 116067 1.701 0.000 10.146 0.000 ../pygccxml/parser/scanner.py:348(__read_member_function) - 13914 1.696 0.000 16.956 0.001 ../pygccxml/parser/linker.py:46(__link_members) - 41742/9 1.642 0.000 2.707 0.301 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) - - -running - done ->Exit code: 0 - ->python -u "test_performance.py" -unittests will run on DEVELOPMENT version -running - -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... - -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... - -INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... - 31520787 function calls (30822864 primitive calls) in 199.769 CPU seconds - - Ordered by: internal time, call count - List reduced from 421 to 30 due to restriction <30> - - ncalls tottime percall cumtime percall filename:lineno(function) - 814563 12.595 0.000 12.595 0.000 <string>:55(__iter__) - 424830 8.190 0.000 9.620 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) - 407280 6.869 0.000 57.260 0.000 ../pygccxml/parser/scanner.py:184(startElement) -424497/423300 5.643 0.000 10.489 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) -676776/208899 5.519 0.000 6.542 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) - 3 5.488 1.829 76.478 25.493 ../pygccxml/parser/etree_scanner.py:45(read) - 3972 4.797 0.001 8.675 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) - 125049 4.328 0.000 6.655 0.000 ../pygccxml/parser/scanner.py:326(__read_argument) - 228615 4.253 0.000 5.794 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) - 124956 4.168 0.000 6.604 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) - 270696 3.926 0.000 6.478 0.000 ../pygccxml/parser/linker.py:24(_set_inst) - 1825614 3.770 0.000 3.770 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) - 197373 3.757 0.000 13.898 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) - 228582 3.485 0.000 4.765 0.000 ../pygccxml/parser/scanner.py:224(__read_location) - 1556946 3.162 0.000 3.162 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) - 3 3.091 1.030 14.798 4.933 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) - 115578 3.047 0.000 7.004 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) - 228612 2.726 0.000 8.139 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) - 1550544 2.720 0.000 2.720 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) - 124956 2.413 0.000 8.018 0.000 ../pygccxml/parser/scanner.py:338(__read_calldef) - 6 2.260 0.377 10.256 1.709 ../pygccxml/parser/source_reader.py:27(bind_aliases) - 214926 2.179 0.000 8.457 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) - 987228 2.063 0.000 2.063 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) - 3 1.956 0.652 145.544 48.515 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) - 116067 1.946 0.000 10.222 0.000 ../pygccxml/parser/scanner.py:355(__read_member_function) - 3 1.928 0.643 17.163 5.721 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:452(__declarated_types) - 13914 1.902 0.000 17.540 0.001 ../pygccxml/parser/linker.py:46(__link_members) - 425985 1.879 0.000 2.584 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:43(_set_access_type) - 270696 1.799 0.000 30.748 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:265(apply_visitor) - 547467 1.679 0.000 1.679 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:581(_get_declaration) - - -running - done ->Exit code: 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-11 12:39:24
|
Revision: 1717 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1717&view=rev Author: roman_yakovenko Date: 2009-05-11 12:39:14 +0000 (Mon, 11 May 2009) Log Message: ----------- updating setup Modified Paths: -------------- pyplusplus_dev/setup.py Modified: pyplusplus_dev/setup.py =================================================================== --- pyplusplus_dev/setup.py 2009-05-11 12:19:59 UTC (rev 1716) +++ pyplusplus_dev/setup.py 2009-05-11 12:39:14 UTC (rev 1717) @@ -1,113 +1,30 @@ -# Copyright 2004-2008 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) - -import sys, os, os.path -from distutils import sysconfig -from distutils.core import setup -from distutils.cmd import Command - -try: - sys.path.append("../pygccxml_dev") - import pygccxml - pygccxml_available = True -except ImportError: - pygccxml_available = False - - -def add_pygccxml_to_PYTHONPATH(): - """Update PYTHONPATH so that is refers to pygccxml_dev. - - The updated path is required for generating the documentation when - pygccxml is not 'officially' installed. - """ - if not os.environ.has_key( 'PYTHONPATH' ): - os.environ['PYTHONPATH'] = '' - if sys.platform == 'win32': - environment_var_delimiter = ';' - else: - environment_var_delimiter = ':' - - pygccxml_path = os.path.normpath(os.path.join(os.getcwd(), "..", "pygccxml_dev")) - os.environ[ 'PYTHONPATH' ] = os.environ[ 'PYTHONPATH' ] \ - + environment_var_delimiter \ - + pygccxml_path - print "Setting PYTHONPATH to", os.environ["PYTHONPATH"] - - -def generate_doc(): - """Generate the epydoc reference manual. - """ - if not pygccxml_available: - print "Please install pygccxml before generating the docs." - sys.exit() - - add_pygccxml_to_PYTHONPATH() - - import epydoc - from epydoc.docbuilder import build_doc_index - from epydoc.docwriter.html import HTMLWriter - - print "Generating epydoc files..." - - # Register a logger object so that warnings/errors are shown - epydoc.log.register_logger(epydoc.log.SimpleLogger()) - - docindex = build_doc_index(['pyplusplus', 'pygccxml']) - html_writer = HTMLWriter( docindex - , prj_name='Py++' - , prj_url='http://www.language-binding.net' - , show_private=False - , show_frames=False ) - - html_writer.write( os.path.join('docs', 'documentation', 'apidocs') ) - - -class doc_cmd(Command): - """This is a new distutils command 'doc' to build the epydoc manual. - """ - - description = 'build the API reference using epydoc' - user_options = [('no-doc', None, "don't run epydoc")] - boolean_options = ['no-doc'] - - def initialize_options (self): - self.no_doc = 0 - - def finalize_options (self): - pass - - def run(self): - if self.no_doc: - return - generate_doc() - - -# Generate the doc when a source distribution is created -if sys.argv[-1]=="sdist": - generate_doc() - - -setup( name = "Py++", - version = "1.0.0", - description="Py++ is a framework of components for creating C++ code generator for Boost.Python library", - author="Roman Yakovenko", - author_email="rom...@gm...", - url='http://www.language-binding.net/pyplusplus/pyplusplus.html', - scripts = ["scripts/pyplusplus_gui", - "scripts/pyplusplus_gui.pyw"], - packages=[ 'pyplusplus', - 'pyplusplus.file_writers', - 'pyplusplus.code_creators', - 'pyplusplus.creators_factory', - 'pyplusplus.code_repository', - 'pyplusplus.code_repository.indexing_suite', - 'pyplusplus.decl_wrappers', - 'pyplusplus.module_builder', - 'pyplusplus.utils', - 'pyplusplus.function_transformers', - 'pyplusplus._logging_', - 'pyplusplus.messages'], - cmdclass = {"doc" : doc_cmd} -) +# Copyright 2004-2008 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) + +import sys, os, os.path +from distutils import sysconfig +from distutils.core import setup +from distutils.cmd import Command + +setup( name = "Py++", + version = "1.0.0", + description="Py++ is a framework of components for creating C++ code generator for Boost.Python library", + author="Roman Yakovenko", + author_email="rom...@gm...", + url='http://www.language-binding.net/pyplusplus/pyplusplus.html', + scripts = ["scripts/pyplusplus_gui", + "scripts/pyplusplus_gui.pyw"], + packages=[ 'pyplusplus', + 'pyplusplus.file_writers', + 'pyplusplus.code_creators', + 'pyplusplus.creators_factory', + 'pyplusplus.code_repository', + 'pyplusplus.code_repository.indexing_suite', + 'pyplusplus.decl_wrappers', + 'pyplusplus.module_builder', + 'pyplusplus.utils', + 'pyplusplus.function_transformers', + 'pyplusplus._logging_', + 'pyplusplus.messages'] ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-11 11:14:15
|
Revision: 1715 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1715&view=rev Author: roman_yakovenko Date: 2009-05-11 11:14:03 +0000 (Mon, 11 May 2009) Log Message: ----------- documentation update Modified Paths: -------------- pyplusplus_dev/docs/download.rest pyplusplus_dev/docs/history/history.rest pyplusplus_dev/docs/pyplusplus.rest pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest Modified: pyplusplus_dev/docs/download.rest =================================================================== --- pyplusplus_dev/docs/download.rest 2009-05-11 09:01:32 UTC (rev 1714) +++ pyplusplus_dev/docs/download.rest 2009-05-11 11:14:03 UTC (rev 1715) @@ -1,58 +1,58 @@ -================== -Download & install -================== - -------------------- -Py++ on SourceForge -------------------- - -:doc:`Py++ <pyplusplus>` project is hosted on SourceForge. Using SourceForge services you -can: - -1) get access to source code -2) get access to latest release version of :doc:`Py++ <pyplusplus>` - - ------------------ -Subversion access ------------------ - -http://sourceforge.net/svn/?group_id=118209 - --------- -Download --------- - -https://sourceforge.net/project/showfiles.php?group_id=118209 - ------------- -Installation ------------- - -In command prompt or shell change current directory to be "pyplusplus-X.Y.Z". -"X.Y.Z" is version of :doc:`Py++ <pyplusplus>`. Type the following command: - -| ``python setup.py install`` - -After this command complete, you should have installed :doc:`Py++ <pyplusplus>` package. - -Boost.Python installation -------------------------- - -Users of Microsoft Windows can enjoy from simple `installer for Boost Libraries`_. -You can find it `here`_. Take a look on new `getting started guide`_ for Boost -libraries. - -Another very valuable link related to Boost is http://engineering.meta-comm.com/boost.aspx . -You will find hourly snapshots of the source code and the documentation for all -Boost libraries. - -.. _`getting started guide` : http://boost.cvs.sourceforge.net/*checkout*/boost/boost/more/getting_started.html -.. _`here` : http://www.boost-consulting.com/products/free -.. _`installer for Boost Libraries` : http://www.boost-consulting.com/products/free - ------------- -Dependencies ------------- - -* :doc:`pygccxml <../pygccxml/pygccxml>` +================== +Download & Install +================== + +------------------- +Py++ on SourceForge +------------------- + +:doc:`Py++ <pyplusplus>` project is hosted on SourceForge. Using SourceForge services you +can: + +1) get access to source code +2) get access to latest release version of :doc:`Py++ <pyplusplus>` + + +----------------- +Subversion access +----------------- + +http://sourceforge.net/svn/?group_id=118209 + +-------- +Download +-------- + +https://sourceforge.net/project/showfiles.php?group_id=118209 + +------------ +Installation +------------ + +In command prompt or shell change current directory to be "pyplusplus-X.Y.Z". +"X.Y.Z" is version of :doc:`Py++ <pyplusplus>`. Type the following command: + +| ``python setup.py install`` + +After this command complete, you should have installed :doc:`Py++ <pyplusplus>` package. + +Boost.Python installation +------------------------- + +Users of Microsoft Windows can enjoy from simple `installer for Boost Libraries`_. +You can find it `here`_. Take a look on new `getting started guide`_ for Boost +libraries. + +Another very valuable link related to Boost is http://engineering.meta-comm.com/boost.aspx . +You will find hourly snapshots of the source code and the documentation for all +Boost libraries. + +.. _`getting started guide` : http://boost.cvs.sourceforge.net/*checkout*/boost/boost/more/getting_started.html +.. _`here` : http://www.boost-consulting.com/products/free +.. _`installer for Boost Libraries` : http://www.boost-consulting.com/products/free + +------------ +Dependencies +------------ + +* :doc:`pygccxml <../pygccxml/pygccxml>` Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2009-05-11 09:01:32 UTC (rev 1714) +++ pyplusplus_dev/docs/history/history.rest 2009-05-11 11:14:03 UTC (rev 1715) @@ -1,559 +1,560 @@ -=================== -Development history -=================== - ------------- -Contributors ------------- - -Thanks to all the people that have contributed patches, bug reports and suggestions: - -* My wife - Yulia -* John Pallister -* Matthias Baas -* Allen Bierbaum -* Lakin Wecker -* Georgiy Dernovoy -* Gottfried Ganssauge -* Andy Miller -* Martin Preisler -* Meghana Haridev -* Julian Scheid -* Oliver Schweitzer -* Hernán Ordiales -* Bernd Fritzke -* Andrei Vermel -* Carsten( spom.spom ) - ------------ -Version 1.1 ------------ - -1. The bug related to exposing free operators was fixed. Many thanks to Andrei Vermel. - -2. Few bugs were fixed for 64Bit platform. Many thanks to Carsten. - -3. :mod:`ctypes` backend was introduced - :doc:`Py++ <../pyplusplus>` is able to - generate Python code, which uses :mod:`ctypes` package to call functions in - DLLs or shared libraries. - - Massive refactoring, which preserve backward compatibility to previous releases, - was done. - -4. From now on, :doc:`Py++ <../pyplusplus>` will use `Sphinx <http://sphinx.pocoo.org/>`_ - for all documentation. - -5. :doc:`Indexing Suite V2 <../documentation/indexing_suite_v2.html>` introduces - few backward compatibility changes. The indexing suite became "headers only" - library and doesn't requier Boost.Python library patching. - See ":doc:`../documentation/containers`" document for more information. - - ------------ -Version 1.0 ------------ - -1. The algorithm, which calculates what member functions should be redefined in - derived class wrappers, was improved. Many thanks to Julian Scheid for the bug - fix. - - The change explanation. - - .. code-block:: c++ - - struct A{ - virtual void foo() {} - }; - - class B: public A{ - }; - - Previous version of :doc:`Py++ <../pyplusplus>` didn't generate wrapper for class ``B``, even - though ``B`` inherits ``A``'s virtual function. Now if you have the following - Python code: - - .. code-block:: python - - class C(B): - def __init__( self ): - B.__init__(self) - def foo(self): - print "C.foo" - - then when ``foo`` is invoked on this instance on the C++ side of things, the - Python code won't be executed as the wrapper was missing. - - **Warning!** **There is a possibility that your generated code will not work!** - **Keep reading.** - - If you use "function transformation" functionality, than it is possible the - generated code will **NOT** work. Consider the following example: - - .. code-block:: c++ - - struct A{ - virtual void foo(int& i) {/*do smth*/} - }; - - class B: public A{ - virtual void foo(int& i) {/*do smth else*/} - }; - - The :doc:`Py++ <../pyplusplus>` code: - - .. code-block:: python - - from pyplusplus import module_builder - from pyplusplus import function_transformers as FT - - mb = module_builder_t( ... ) - foo = mb.mem_funs( 'foo' ) - foo.add_transformation( FT.output(0) ) - - The generated code, for class ``B``, is: - - .. code-block:: c++ - - namespace bp = boost::python; - - struct B_wrapper : B, bp::wrapper< B > { - virtual void foo( int & i ) const { ... } - - static boost::python::tuple default_foo( ::B const & inst ) - { ... } - - virtual void foo( int & i ) const - { ... } - - static boost::python::object default_foo( ::A const & inst ) - { ... } - }; - ... - bp::class_< B_wrapper, bp::bases< A > >( "B" ) - .def( "foo", (boost::python::tuple (*)( ::B const & ))( &B_wrapper::default_foo ) ) - .def( "foo", (boost::python::object (*)( ::A const & ))( &B_wrapper::default_foo ) ); - - As you can see, after applying the transformation both functions have same - signature. Do you know what function will be called in some situation? I do - - the wrong one :-(. - - Unfortunately, there is no easy work around or some trick that you can use, - which will not break the existing code. I see few solutions to the problem: - - * change the alias of the functions - - .. code-block:: python - - from pyplusplus import module_builder - from pyplusplus import function_transformers as FT - - mb = module_builder_t( ... ) - foo = mb.mem_funs( '::A::foo' ).add_transformation( FT.output(0), alias="foo_a" ) - foo = mb.mem_funs( '::B::foo' ).add_transformation( FT.output(0), alias="foo_b" ) - - * use ``inout`` transformation - it preserves a function signature - - * :doc:`Py++ <../pyplusplus>` can introduce a configuration, that will preserve the previous behaviour. - I think this is a wrong way to go and doing the API changes is the 'right' - longer term solution. - - If you **absolutely need** to preserve API backward compatible, contact me - and I will introduce such configuration option. - - Sorry for inconvenience. - -2. Few bugs, related to Indexing Suite 2, were fixed. Many thanks to Oliver Schweitzer - for reporting them. - -3. New and highly experimental feature was introduced - - :doc:`Boost.Python and ctypes integration <../documentation/ctypes/ctypes_integration>`. - -4. Support for :doc:`boost::python::make_constructor <../documentation/functions/make_constructor>` functionality was added. - -5. Support for unions and unnamed classes was added. - -6. Doxygen documentation extractor was improved. Many thanks to Hernán Ordiales. - -7. Py++ documentation was improved. Many thanks to Bernd Fritzke. - -------------- -Version 0.9.5 -------------- - -1. Bug fixes: - - * Py++ will not expose free operators, if at least one of the classes, it works - on, is not exposed. - Many thanks to Meghana Haridev for reporting the bug. - -2. Added ability to completely disable warnings reporting. - -3. All logging is now done to ``stderr`` instead of ``stdout``. - -4. Generated code improvements: - - * ``default_call_policies`` is not generated - - * ``return_internal_reference`` call policies - default arguments are not - generated - - * STD containers are generated without default arguments. For example instead - of ``std::vector< int, std::allocator< int > >``, in many cases :doc:`Py++ <../pyplusplus>` will - generate ``std::vector< int >``. - -5. :doc:`create_with_signature <../documentation/functions/overloading>` algorithm was improved. - :doc:`Py++ <../pyplusplus>` will generate correct code in one more use case. - -6. Added ability to exclude declarations from being exposed, if they will cause - compilation to fail. - -7. Starting from this version, :doc:`Py++ <../pyplusplus>` provides a complete solution for - :doc:`multi-module development <../documentation/multi_module_development>`. - -8. Classes, which expose C arrays will be registered only once. - -9. Starting from this version, :doc:`Py++ <../pyplusplus>` supports a code generation with different - encodings. - -10. There is a new strategy to split code into files. It is IDE friendly. Be sure - to read :doc:`the updated documentation <../documentation/split_module>`. - -------------- -Version 0.9.0 -------------- - -1. Bug fixes: - - * Declaration of virtual functions that have an exception specification with - an empty throw was fixed. Now the exception specification is generated properly. - Many thanks to Martin Preisler for reporting the bug. - -2. Added exposing of copy constructor, ``operator=`` and ``operator<<``. - - * ``operator=`` is exposed under "assign" name - - * ``operator<<`` is exposed under "__str__" name - -3. Added new call policies: - - * :doc:`as_tuple <../documentation/functions/call_policies/as_tuple>` - - * :doc:`custom_call_policies <../documentation/functions/call_policies/return_range>` - - * :doc:`return_range <../documentation/functions/call_policies/return_range>` - -4. Added an initial support for multi-module development. Now you can mark your - declarations as ``already_exposed`` and :doc:`Py++ <../pyplusplus>` will do the rest. For more - information read :doc:`multi-module development guide <../documentation/multi_module_development>`. - -.. line-separator - -5. :doc:`input_c_buffer <../documentation/functions/transformation/input_c_buffer>` - new functions - transformation, which allows to pass a Python sequence to function, instead of pair of arguments: pointer to buffer and size. - -6. Added ability to control generated "include" directives. Now you can ask :doc:`Py++ <../pyplusplus>` - to include a header file, when it generates code for some declaration. For more - information refers to `inserting code guide`_. - -.. _`inserting code guide` : ../documentation/inserting_code.html#header-files - -7. Code generation improvements: system header files ( Boost.Python or Py++ defined ) - will be included from the generated files only in case the generated code - depends on them. - -8. Performance improvements: Py++ runs 1.5 - 2 times faster, than the previous one. - -9. Added ability to add code before overridden and default function calls. - For more information refer to `member function API documentation`_. - -.. _`member function API documentation` : ../documentation/apidocs/pyplusplus.decl_wrappers.calldef_wrapper.member_function_t-class.html - -10. :doc:`Py++ <../pyplusplus>` will generate documentation for automatically constructed properties. - For more information refer to :doc:`properties guide <../documentation/properties>`. - -11. Added iteration functionality to Boost.Python Indexing Suite V2 ``std::map`` - and ``std::multimap`` containers. - -------------- -Version 0.8.5 -------------- - -1. Added :doc:`Function Transformation <../documentation/functions/transformation/transformation>` feature. - -2. "Py++" introduces new functionality, which allows you to control messages and - warnings: :doc:`how to disable warnings? <../documentation/warnings>`. - -3. Added new algorithm, which controls the registration order of the functions. - See :doc:`registration order document <../documentation/functions/registration_order>` - -4. New "Py++" defined :doc:`return_pointee_value <../documentation/functions/call_policies/return_pointee_value>` - call policy was introduced. - -5. Support for opaque types was added. Read more about this feature `here`__. - -.. __ : ../documentation/functions/call_policies/call_policies.html#special-case - -6. It is possible to configure "Py++" to generate faster ( compilation time ) - code for indexing suite version 2. See API documentation. - -7. The algorithm, which finds all class properties was improved. It provides - user with a better way to control properties creation. A property that would - hide another exposed declaration will not be registered\\created. - -8. Work around for "custom smart pointer as member variable" Boost.Python bug - was introduced. - -9. Bugs fixes and documentation improvement. - - -------------- -Version 0.8.2 -------------- - -1. Interface changes: - - * ``module_builder.module_builder_t.build_code_creator`` method: - argument ``create_casting_constructor`` was removed and deprecation warning - was introduced. - -2. Performance improvements. In some cases you can get x10 performance boost. - Many thanks to Allen Bierbaum! Saving and reusing results of different - :doc:`pygccxml <../../pygccxml/pygccxml>` algorithms and type traits functions achieved this. - -3. Convenience API for registering exception translator was introduced. - -4. :doc:`Py++ <../pyplusplus>` can generate code that uses ``BOOST_PYTHON_FUNCTION_OVERLOADS`` and - ``BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS`` macros. - -5. Treatment to previously generated and no more in-use files was added. By - default :doc:`Py++ <../pyplusplus>` will delete these files, but of course you can redefine this - behaviour. - -6. Generated code changes: - - * ``default_call_policies`` should not be generated any more. - - * For functions that have ``return_value_policy< return_opaque_pointer >`` - call policy, :doc:`Py++ <../pyplusplus>` will automatically generate ``BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID`` - macro. Thank you very much for Gottfried Ganssauge for this idea. - -7. Support for Boost.Python properties was introduced. :doc:`Py++ <../pyplusplus>` implements small - algorithm, that will automatically discover properties, base on naming conventions. - -8. ``decl_wrappers.class_t`` has new function: ``is_wrapper_needed``. This - function explains why :doc:`Py++ <../pyplusplus>` creates class wrapper for exposed class. - -9. Python type traits module was introduce. Today it contains only single function: - - * ``is_immutable`` - returns ``True`` if exposed type is Python immutable type - - - -------------- -Version 0.8.1 -------------- - - -1. Georgiy Dernovoy contributed a patch, which allows :doc:`Py++ <../pyplusplus>` GUI to - save\\load last used header file. - - -2. :doc:`Py++ <../pyplusplus>` improved a lot functionality related to providing feedback to user: - - * every package has its own logger - * only important user messages are written to ``stdout`` - * user messages are clear - -3. Support for Boost.Python indexing suite version 2 was implemented. - -4. Every code creator class took ``parent`` argument in ``__init__`` method. - This argument was removed. ``adopt_creator`` and ``remove_creator`` will - set\unset reference to parent. - -5. Generated code for member and free functions was changed. This changed was - introduced to fix compilation errors on msvc 7.1 compiler. - -6. :doc:`Py++ <../pyplusplus>` generates "stable" code. If header files were not changed, - :doc:`Py++ <../pyplusplus>` will not change any file. - -7. Support for huge classes was added. :doc:`Py++ <../pyplusplus>` is able to split registration - code for the class to multiple cpp files. - -8. User code could be added almost anywhere, without use of low level API. - -9. Generated source files include only header files you passes as an argument - to module builder. - -10. Bug fixes. - -11. Documentation was improved. - - -Project name changed --------------------- - -In this version the project has been renamed from "pyplusplus" to "Py++". -There were few reasons to this: - -1. I like "Py++" more then "pyplusplus". - -2. "Py++" was the original name of the project: http://mail.python.org/pipermail/c++-sig/2005-July/009280.html - -3. Users always changed the name of the projects. I saw at least 6 different names. - - - -------------- -Version 0.8.0 -------------- - -1. :doc:`Py++ <../pyplusplus>` "user guide" functionality has been improved. Now :doc:`Py++ <../pyplusplus>` - can answer few questions: - - * why this declaration could not be exported - - * why this function could not be overridden from Python - -2. :doc:`Py++ <../pyplusplus>` can suggest an alias for exported classes. - -3. Small redesign has been done - now it is much easier to understand and - maintain code creators, which creates code for C++ functions. - -4. Exception specification is taken into account, when :doc:`Py++ <../pyplusplus>` exports - member functions. - -5. Member variables, that are pointers exported correctly. - -6. Added experimental support for ``vector_indexing_suite``. - -7. Bug fixes. - -------------- -Version 0.7.0 -------------- - -Many thanks to *Matthias Baas* and *Allen Bierbaum*! They contributed so much to -Py++, especially Matthias: - - * New high-level API: :doc:`Py++ <../pyplusplus>` has simple and powerful API - - * Documentation: Matthias and Allen added a lot of documentation strings - - * Bug fixes and performance improvements - -1. New GUI features: - - * It is possible now to see XML generated by GCC-XML. - - * It is possible to use GUI as wizard. It will help you to start with - :doc:`Py++ <../pyplusplus>`, by generating :doc:`Py++ <../pyplusplus>` code. - -2. **Attention - non backward compatible change**. - - ``module_creator.creator_t.__init__`` method has been changed. ``decls`` - argument could be interpreted as - - * list of all declaration to be exported - - * list of top-level declarations. ``creator_t`` should export all - declarations recursively. - - In order to clarify the use of ``decls`` argument new argument ``recursive`` - has been added. By default new value of ``recursive`` is ``False``. - - Guide for users/upgraders: if use are exporting all declaration without - filtering, you should set ``recursive`` argument to ``True``. If you use - ``pygccxml.declarations.filtering.*`` functions, you have nothing to do. - - Sorry for the inconvenience :-(. - -3. Better split of extension module to files. From now the following declarations will - have dedicated file: - - * named enumerations, defined within namespace - * unnamed enumerations and global variables - * free functions - - This functionality will keep the number of instantiated templates within - one file, ``main.cpp``, to be very low. Also it is possible to implement - solution, where ``main.cpp`` file does not contain templates instantiations - at all. - -4. Only constant casting operators could be used with ``implicitly_convertible``. - This bug has been fixed. - -5. Bug exporting non copyable class has been fixed. - -6. Small bug fix - from now file with identical content will not be overwritten. - -7. Boost.Python ``optional`` is now supported and used when a constructor has a - a default argument. - -8. :doc:`Py++ <../pyplusplus>` now generates correct code for hierarchy of abstract classes: - - .. code-block:: c++ - - struct abstract1{ - virtual void do_smth() = 0; - } - - struct abstract2 : public abstract1{ - virtual void do_smth_else() = 0; - } - - struct concrete : public abstract2{ - virtual void do_smth(){}; - virtual void do_smth_else(){}; - } - -9. Logging functionality has been added - -10. New packages ``module_builder``, ``decl_wrappers`` and ``_logging_`` has - been added. - -11. ... - -http://boost.org/libs/python/doc/v2/init.html#optional-spec - -------------- -Version 0.6.0 -------------- - -1. Code repository has been introduced. This repository contains classes - and functions that will help users to export different C++ classes and - declarations. Right now this repository contains two classes: - - * *array_1_t* - - * *const_array_1_t* - - Those classes helps to export static, single dimension arrays. - -2. Code generation has been improved. - -3. Code generation speed has been improved. - -4. If you have Niall Douglas *void\** patch, then you can enjoy from - automatically set call policies. - -5. Bit fields can be accessed from Python - -6. Creating custom code creator example has been added. - -7. Comparison to Pyste has been wrote. - -8. Using this version it is possible to export most of TnFOX Python bindings. - -------------- -Version 0.5.1 -------------- - -1. operator() is now supported. - -2. Special casting operators are renamed( *__int__*, *__str__*, ... ). - -3. Few bug fixes - - -.. _`SourceForge`: http://sourceforge.net/index.php - +=================== +Development history +=================== + +------------ +Contributors +------------ + +Thanks to all the people that have contributed patches, bug reports and suggestions: + +* My wife - Yulia +* John Pallister +* Matthias Baas +* Allen Bierbaum +* Lakin Wecker +* Georgiy Dernovoy +* Gottfried Ganssauge +* Andy Miller +* Martin Preisler +* Meghana Haridev +* Julian Scheid +* Oliver Schweitzer +* Hernán Ordiales +* Bernd Fritzke +* Andrei Vermel +* Carsten( spom.spom ) + +----------- +Version 1.1 +----------- + +1. The bug related to exposing free operators was fixed. Many thanks to Andrei Vermel. + +2. Few bugs were fixed for 64Bit platform. Many thanks to Carsten. + +3. :mod:`ctypes` backend was introduced - :doc:`Py++ <../pyplusplus>` is able to + generate Python code, which uses :mod:`ctypes` package to call functions in + DLLs or shared libraries. + + Massive refactoring, which preserve backward compatibility to previous releases, + was done. + +4. From now on, :doc:`Py++ <../pyplusplus>` will use `Sphinx <http://sphinx.pocoo.org/>`_ + for all documentation. + +5. :doc:`Indexing Suite V2 <../documentation/indexing_suite_v2.html>` introduces + few backward compatibility changes. The indexing suite became "headers only" + library and doesn't requier Boost.Python library patching. + See ":doc:`../documentation/containers`" document for more information. + +6. Support for `std::hash_map<...>` and `std::hash_set<...>` containers was added. + +----------- +Version 1.0 +----------- + +1. The algorithm, which calculates what member functions should be redefined in + derived class wrappers, was improved. Many thanks to Julian Scheid for the bug + fix. + + The change explanation. + + .. code-block:: c++ + + struct A{ + virtual void foo() {} + }; + + class B: public A{ + }; + + Previous version of :doc:`Py++ <../pyplusplus>` didn't generate wrapper for class ``B``, even + though ``B`` inherits ``A``'s virtual function. Now if you have the following + Python code: + + .. code-block:: python + + class C(B): + def __init__( self ): + B.__init__(self) + def foo(self): + print "C.foo" + + then when ``foo`` is invoked on this instance on the C++ side of things, the + Python code won't be executed as the wrapper was missing. + + **Warning!** **There is a possibility that your generated code will not work!** + **Keep reading.** + + If you use "function transformation" functionality, than it is possible the + generated code will **NOT** work. Consider the following example: + + .. code-block:: c++ + + struct A{ + virtual void foo(int& i) {/*do smth*/} + }; + + class B: public A{ + virtual void foo(int& i) {/*do smth else*/} + }; + + The :doc:`Py++ <../pyplusplus>` code: + + .. code-block:: python + + from pyplusplus import module_builder + from pyplusplus import function_transformers as FT + + mb = module_builder_t( ... ) + foo = mb.mem_funs( 'foo' ) + foo.add_transformation( FT.output(0) ) + + The generated code, for class ``B``, is: + + .. code-block:: c++ + + namespace bp = boost::python; + + struct B_wrapper : B, bp::wrapper< B > { + virtual void foo( int & i ) const { ... } + + static boost::python::tuple default_foo( ::B const & inst ) + { ... } + + virtual void foo( int & i ) const + { ... } + + static boost::python::object default_foo( ::A const & inst ) + { ... } + }; + ... + bp::class_< B_wrapper, bp::bases< A > >( "B" ) + .def( "foo", (boost::python::tuple (*)( ::B const & ))( &B_wrapper::default_foo ) ) + .def( "foo", (boost::python::object (*)( ::A const & ))( &B_wrapper::default_foo ) ); + + As you can see, after applying the transformation both functions have same + signature. Do you know what function will be called in some situation? I do - + the wrong one :-(. + + Unfortunately, there is no easy work around or some trick that you can use, + which will not break the existing code. I see few solutions to the problem: + + * change the alias of the functions + + .. code-block:: python + + from pyplusplus import module_builder + from pyplusplus import function_transformers as FT + + mb = module_builder_t( ... ) + foo = mb.mem_funs( '::A::foo' ).add_transformation( FT.output(0), alias="foo_a" ) + foo = mb.mem_funs( '::B::foo' ).add_transformation( FT.output(0), alias="foo_b" ) + + * use ``inout`` transformation - it preserves a function signature + + * :doc:`Py++ <../pyplusplus>` can introduce a configuration, that will preserve the previous behaviour. + I think this is a wrong way to go and doing the API changes is the 'right' + longer term solution. + + If you **absolutely need** to preserve API backward compatible, contact me + and I will introduce such configuration option. + + Sorry for inconvenience. + +2. Few bugs, related to Indexing Suite 2, were fixed. Many thanks to Oliver Schweitzer + for reporting them. + +3. New and highly experimental feature was introduced - + :doc:`Boost.Python and ctypes integration <../documentation/ctypes/ctypes_integration>`. + +4. Support for :doc:`boost::python::make_constructor <../documentation/functions/make_constructor>` functionality was added. + +5. Support for unions and unnamed classes was added. + +6. Doxygen documentation extractor was improved. Many thanks to Hernán Ordiales. + +7. Py++ documentation was improved. Many thanks to Bernd Fritzke. + +------------- +Version 0.9.5 +------------- + +1. Bug fixes: + + * Py++ will not expose free operators, if at least one of the classes, it works + on, is not exposed. + Many thanks to Meghana Haridev for reporting the bug. + +2. Added ability to completely disable warnings reporting. + +3. All logging is now done to ``stderr`` instead of ``stdout``. + +4. Generated code improvements: + + * ``default_call_policies`` is not generated + + * ``return_internal_reference`` call policies - default arguments are not + generated + + * STD containers are generated without default arguments. For example instead + of ``std::vector< int, std::allocator< int > >``, in many cases :doc:`Py++ <../pyplusplus>` will + generate ``std::vector< int >``. + +5. :doc:`create_with_signature <../documentation/functions/overloading>` algorithm was improved. + :doc:`Py++ <../pyplusplus>` will generate correct code in one more use case. + +6. Added ability to exclude declarations from being exposed, if they will cause + compilation to fail. + +7. Starting from this version, :doc:`Py++ <../pyplusplus>` provides a complete solution for + :doc:`multi-module development <../documentation/multi_module_development>`. + +8. Classes, which expose C arrays will be registered only once. + +9. Starting from this version, :doc:`Py++ <../pyplusplus>` supports a code generation with different + encodings. + +10. There is a new strategy to split code into files. It is IDE friendly. Be sure + to read :doc:`the updated documentation <../documentation/split_module>`. + +------------- +Version 0.9.0 +------------- + +1. Bug fixes: + + * Declaration of virtual functions that have an exception specification with + an empty throw was fixed. Now the exception specification is generated properly. + Many thanks to Martin Preisler for reporting the bug. + +2. Added exposing of copy constructor, ``operator=`` and ``operator<<``. + + * ``operator=`` is exposed under "assign" name + + * ``operator<<`` is exposed under "__str__" name + +3. Added new call policies: + + * :doc:`as_tuple <../documentation/functions/call_policies/as_tuple>` + + * :doc:`custom_call_policies <../documentation/functions/call_policies/return_range>` + + * :doc:`return_range <../documentation/functions/call_policies/return_range>` + +4. Added an initial support for multi-module development. Now you can mark your + declarations as ``already_exposed`` and :doc:`Py++ <../pyplusplus>` will do the rest. For more + information read :doc:`multi-module development guide <../documentation/multi_module_development>`. + +.. line-separator + +5. :doc:`input_c_buffer <../documentation/functions/transformation/input_c_buffer>` - new functions + transformation, which allows to pass a Python sequence to function, instead of pair of arguments: pointer to buffer and size. + +6. Added ability to control generated "include" directives. Now you can ask :doc:`Py++ <../pyplusplus>` + to include a header file, when it generates code for some declaration. For more + information refers to `inserting code guide`_. + +.. _`inserting code guide` : ../documentation/inserting_code.html#header-files + +7. Code generation improvements: system header files ( Boost.Python or Py++ defined ) + will be included from the generated files only in case the generated code + depends on them. + +8. Performance improvements: Py++ runs 1.5 - 2 times faster, than the previous one. + +9. Added ability to add code before overridden and default function calls. + For more information refer to `member function API documentation`_. + +.. _`member function API documentation` : ../documentation/apidocs/pyplusplus.decl_wrappers.calldef_wrapper.member_function_t-class.html + +10. :doc:`Py++ <../pyplusplus>` will generate documentation for automatically constructed properties. + For more information refer to :doc:`properties guide <../documentation/properties>`. + +11. Added iteration functionality to Boost.Python Indexing Suite V2 ``std::map`` + and ``std::multimap`` containers. + +------------- +Version 0.8.5 +------------- + +1. Added :doc:`Function Transformation <../documentation/functions/transformation/transformation>` feature. + +2. "Py++" introduces new functionality, which allows you to control messages and + warnings: :doc:`how to disable warnings? <../documentation/warnings>`. + +3. Added new algorithm, which controls the registration order of the functions. + See :doc:`registration order document <../documentation/functions/registration_order>` + +4. New "Py++" defined :doc:`return_pointee_value <../documentation/functions/call_policies/return_pointee_value>` + call policy was introduced. + +5. Support for opaque types was added. Read more about this feature `here`__. + +.. __ : ../documentation/functions/call_policies/call_policies.html#special-case + +6. It is possible to configure "Py++" to generate faster ( compilation time ) + code for indexing suite version 2. See API documentation. + +7. The algorithm, which finds all class properties was improved. It provides + user with a better way to control properties creation. A property that would + hide another exposed declaration will not be registered\\created. + +8. Work around for "custom smart pointer as member variable" Boost.Python bug + was introduced. + +9. Bugs fixes and documentation improvement. + + +------------- +Version 0.8.2 +------------- + +1. Interface changes: + + * ``module_builder.module_builder_t.build_code_creator`` method: + argument ``create_casting_constructor`` was removed and deprecation warning + was introduced. + +2. Performance improvements. In some cases you can get x10 performance boost. + Many thanks to Allen Bierbaum! Saving and reusing results of different + :doc:`pygccxml <../../pygccxml/pygccxml>` algorithms and type traits functions achieved this. + +3. Convenience API for registering exception translator was introduced. + +4. :doc:`Py++ <../pyplusplus>` can generate code that uses ``BOOST_PYTHON_FUNCTION_OVERLOADS`` and + ``BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS`` macros. + +5. Treatment to previously generated and no more in-use files was added. By + default :doc:`Py++ <../pyplusplus>` will delete these files, but of course you can redefine this + behaviour. + +6. Generated code changes: + + * ``default_call_policies`` should not be generated any more. + + * For functions that have ``return_value_policy< return_opaque_pointer >`` + call policy, :doc:`Py++ <../pyplusplus>` will automatically generate ``BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID`` + macro. Thank you very much for Gottfried Ganssauge for this idea. + +7. Support for Boost.Python properties was introduced. :doc:`Py++ <../pyplusplus>` implements small + algorithm, that will automatically discover properties, base on naming conventions. + +8. ``decl_wrappers.class_t`` has new function: ``is_wrapper_needed``. This + function explains why :doc:`Py++ <../pyplusplus>` creates class wrapper for exposed class. + +9. Python type traits module was introduce. Today it contains only single function: + + * ``is_immutable`` - returns ``True`` if exposed type is Python immutable type + + + +------------- +Version 0.8.1 +------------- + + +1. Georgiy Dernovoy contributed a patch, which allows :doc:`Py++ <../pyplusplus>` GUI to + save\\load last used header file. + + +2. :doc:`Py++ <../pyplusplus>` improved a lot functionality related to providing feedback to user: + + * every package has its own logger + * only important user messages are written to ``stdout`` + * user messages are clear + +3. Support for Boost.Python indexing suite version 2 was implemented. + +4. Every code creator class took ``parent`` argument in ``__init__`` method. + This argument was removed. ``adopt_creator`` and ``remove_creator`` will + set\unset reference to parent. + +5. Generated code for member and free functions was changed. This changed was + introduced to fix compilation errors on msvc 7.1 compiler. + +6. :doc:`Py++ <../pyplusplus>` generates "stable" code. If header files were not changed, + :doc:`Py++ <../pyplusplus>` will not change any file. + +7. Support for huge classes was added. :doc:`Py++ <../pyplusplus>` is able to split registration + code for the class to multiple cpp files. + +8. User code could be added almost anywhere, without use of low level API. + +9. Generated source files include only header files you passes as an argument + to module builder. + +10. Bug fixes. + +11. Documentation was improved. + + +Project name changed +-------------------- + +In this version the project has been renamed from "pyplusplus" to "Py++". +There were few reasons to this: + +1. I like "Py++" more then "pyplusplus". + +2. "Py++" was the original name of the project: http://mail.python.org/pipermail/c++-sig/2005-July/009280.html + +3. Users always changed the name of the projects. I saw at least 6 different names. + + + +------------- +Version 0.8.0 +------------- + +1. :doc:`Py++ <../pyplusplus>` "user guide" functionality has been improved. Now :doc:`Py++ <../pyplusplus>` + can answer few questions: + + * why this declaration could not be exported + + * why this function could not be overridden from Python + +2. :doc:`Py++ <../pyplusplus>` can suggest an alias for exported classes. + +3. Small redesign has been done - now it is much easier to understand and + maintain code creators, which creates code for C++ functions. + +4. Exception specification is taken into account, when :doc:`Py++ <../pyplusplus>` exports + member functions. + +5. Member variables, that are pointers exported correctly. + +6. Added experimental support for ``vector_indexing_suite``. + +7. Bug fixes. + +------------- +Version 0.7.0 +------------- + +Many thanks to *Matthias Baas* and *Allen Bierbaum*! They contributed so much to +Py++, especially Matthias: + + * New high-level API: :doc:`Py++ <../pyplusplus>` has simple and powerful API + + * Documentation: Matthias and Allen added a lot of documentation strings + + * Bug fixes and performance improvements + +1. New GUI features: + + * It is possible now to see XML generated by GCC-XML. + + * It is possible to use GUI as wizard. It will help you to start with + :doc:`Py++ <../pyplusplus>`, by generating :doc:`Py++ <../pyplusplus>` code. + +2. **Attention - non backward compatible change**. + + ``module_creator.creator_t.__init__`` method has been changed. ``decls`` + argument could be interpreted as + + * list of all declaration to be exported + + * list of top-level declarations. ``creator_t`` should export all + declarations recursively. + + In order to clarify the use of ``decls`` argument new argument ``recursive`` + has been added. By default new value of ``recursive`` is ``False``. + + Guide for users/upgraders: if use are exporting all declaration without + filtering, you should set ``recursive`` argument to ``True``. If you use + ``pygccxml.declarations.filtering.*`` functions, you have nothing to do. + + Sorry for the inconvenience :-(. + +3. Better split of extension module to files. From now the following declarations will + have dedicated file: + + * named enumerations, defined within namespace + * unnamed enumerations and global variables + * free functions + + This functionality will keep the number of instantiated templates within + one file, ``main.cpp``, to be very low. Also it is possible to implement + solution, where ``main.cpp`` file does not contain templates instantiations + at all. + +4. Only constant casting operators could be used with ``implicitly_convertible``. + This bug has been fixed. + +5. Bug exporting non copyable class has been fixed. + +6. Small bug fix - from now file with identical content will not be overwritten. + +7. Boost.Python ``optional`` is now supported and used when a constructor has a + a default argument. + +8. :doc:`Py++ <../pyplusplus>` now generates correct code for hierarchy of abstract classes: + + .. code-block:: c++ + + struct abstract1{ + virtual void do_smth() = 0; + } + + struct abstract2 : public abstract1{ + virtual void do_smth_else() = 0; + } + + struct concrete : public abstract2{ + virtual void do_smth(){}; + virtual void do_smth_else(){}; + } + +9. Logging functionality has been added + +10. New packages ``module_builder``, ``decl_wrappers`` and ``_logging_`` has + been added. + +11. ... + +http://boost.org/libs/python/doc/v2/init.html#optional-spec + +------------- +Version 0.6.0 +------------- + +1. Code repository has been introduced. This repository contains classes + and functions that will help users to export different C++ classes and + declarations. Right now this repository contains two classes: + + * *array_1_t* + + * *const_array_1_t* + + Those classes helps to export static, single dimension arrays. + +2. Code generation has been improved. + +3. Code generation speed has been improved. + +4. If you have Niall Douglas *void\** patch, then you can enjoy from + automatically set call policies. + +5. Bit fields can be accessed from Python + +6. Creating custom code creator example has been added. + +7. Comparison to Pyste has been wrote. + +8. Using this version it is possible to export most of TnFOX Python bindings. + +------------- +Version 0.5.1 +------------- + +1. operator() is now supported. + +2. Special casting operators are renamed( *__int__*, *__str__*, ... ). + +3. Few bug fixes + + +.. _`SourceForge`: http://sourceforge.net/index.php + Modified: pyplusplus_dev/docs/pyplusplus.rest =================================================================== --- pyplusplus_dev/docs/pyplusplus.rest 2009-05-11 09:01:32 UTC (rev 1714) +++ pyplusplus_dev/docs/pyplusplus.rest 2009-05-11 11:14:03 UTC (rev 1715) @@ -1,190 +1,189 @@ -============== -`Py++` package -============== - ----------------- -What is `Py++`? ----------------- -Definition: - .. include:: ./definition.irest - -`Py++` uses few different programming paradigms to help you to expose C++ -declarations to Python. This code generator will not stand on your way. It will -guide you through the whole process. It will raise warnings in the case you are -doing something wrong with a link to the explanation. And the most important it -will save your time - you will not have to update code generator script every -time source code is changed. - ------------------------ -Code generation process ------------------------ - -Code generation process, using `Py++` consists from few steps. The following -paragraphs will tell you more about every step. - - -*"read declarations"* ---------------------- - -`Py++` does not reinvent the wheel. It uses `GCC C++ compiler`_ to parse C++ -source files. To be more precise, the tool chain looks like this: - -1. source code is passed to `GCC-XML`_ - -2. `GCC-XML`_ passes it to `GCC C++ compiler`_ - -3. `GCC-XML`_ generates an XML description of a C++ program from GCC's internal - representation. - -4. `Py++` uses :doc:`pygccxml <../../pygccxml/pygccxml>` package to read `GCC-XML`_ generated file. - -The bottom line - you can be sure, that all your declarations are read correctly. - -.. _`GCC C++ compiler` : http://www.gnu.org/software/gcc - - -*"build module"* ------------------ - -Only very small and simple projects could be exported as is. Most of the projects -still require human invocation. Basically there are 2 questions that you should -answer: - - 1. which declarations should be exported - 2. how this specific declaration should be exported or, if I change a little - a question, what code should be written in order I get access from Python - to that functionality - -Of course, `Py++` cannot answer those question, but it provides maximum help to you. - -How can `Py++` help you with first question? `Py++` provides very powerful and -simple query interface. For example in one line of code you can select all free -functions that have two arguments, where the first argument has type ``int &`` -and the type of the second argument is any: - -.. code-block:: python - - mb = module_builder_t( ... ) #module_builder_t is the main class that - #will help you with code generation process - mb.free_functions( arg_types=[ 'int &', None ] ) - -Another example - the developer wants to exclude all protected functions from -being exported: - -.. code-block:: python - - mb = module_builder_t( ... ) - mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude() - -The developer can create custom criteria, for example exclude all declarations -with 'impl' ( implementation ) string within the name. - -.. code-block:: python - - mb = module_builder_t( ... ) - mb.decls( lambda decl: 'impl' in decl.name ).exclude() - -Note the way the queries were built. You can think about those queries as -the rules, which will continue to work even after exported C++ code was changed. -It means that you don't have to change code generator source code every time. - -So far, so good what about second question? Well, by default `Py++` generates a -code that will satisfy almost all developers. `Py++` could be configured in many -ways to satisfy your needs. But sometimes this is still not enough. There are -use cases when you need full control over generated code. One of the biggest -problems, with code generators in general, is modifying generated code and -preserving changes. How many code generators did you use or know, that -allow you to put your code anywhere or to reorder generated code as you wish? -`Py++` allows you to do that. - -`Py++` introduces new concept: code creator and code creators tree. You can think -about code creators tree as some kind of `AST`_. The only difference is that code -creators tree provides more specific functionality. For example ``include_t`` code -creator is responsible to create C++ ``include`` directive code. You have full -control over code creators tree, before it is written to disc. Here you -can find UML diagram of almost all code creators: `class diagram`_. - -.. _`AST`: http://en.wikipedia.org/wiki/Abstract_syntax_tree -.. _`class diagram`: code_creators_uml.png - -At the end of this step you have code creators tree, which is ready to be written -to disc. - -*"write code to files"* ------------------------ -During this step `Py++` reads the code creators tree and writes the code to a -disc. The code generation process result should not be different from the one, -which would be achieved by human. For small project writing all code into single -file is good approach, for big ones the code should be splitted into multiple files. -`Py++` implements both strategies. - -------------- -Features list -------------- - -* `Py++` supports almost all features found in `Boost.Python`_ library - -* Using `Py++` you can develop few extension modules simultaneously, especially - when they share the code. - -* `Py++` generates code, which will help you: - - * to understand compiler generated error messages - - * to minimize project built time - -* `Py++` has few modes of writing code into files: - - * single file - - * multiple files - - * fixed set of multiple files - - * multiple files, where single class code is split to few files - -* You have full control over generated code. Your code could be inserted almost - anywhere. - -* Your license is written at the top of every generated file - -* `Py++` will check the "completeness" of the bindings. It will check for you - that the exposed declarations don't have references to unexposed ones. - -* `Py++` provides enough functionality to extract source code documentation - and write it as Python documentation string - -* `Py++` provides simple and powerful framework to create a wrapper for - functions, which could not be exposed as is to `Python`_. - -* ... - -------- -License -------- - -`Boost Software License`_. - ---------------------------- -Documentation contents ---------------------------- - -.. toctree:: - :maxdepth: 1 - - documentation/tutorials/tutorials.rest - quotes.rest - download.rest - documentation/index.rest - examples/examples.rest - links.rest - comparisons/compare_to.rest - peps/peps_index.rest - troubleshooting_guide/lessons_learned.rest - history/history.rest - - -.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html -.. _`Python`: http://www.python.org -.. _`GCC-XML`: http://www.gccxml.org -.. _`Boost Software License`: http://boost.org/more/license_info.html +============== +`Py++` package +============== + +---------------- +What is `Py++`? +---------------- +Definition: + .. include:: ./definition.irest + +`Py++` uses few different programming paradigms to help you to expose C++ +declarations to Python. This code generator will not stand on your way. It will +guide you through the whole process. It will raise warnings in the case you are +doing something wrong with a link to the explanation. And the most important it +will save your time - you will not have to update code generator script every +time source code is changed. + +----------------------- +Code generation process +----------------------- + +Code generation process, using `Py++` consists from few steps. The following +paragraphs will tell you more about every step. + + +*"read declarations"* +--------------------- + +`Py++` does not reinvent the wheel. It uses `GCC C++ compiler`_ to parse C++ +source files. To be more precise, the tool chain looks like this: + +1. source code is passed to `GCC-XML`_ + +2. `GCC-XML`_ passes it to `GCC C++ compiler`_ + +3. `GCC-XML`_ generates an XML description of a C++ program from GCC's internal + representation. + +4. `Py++` uses :doc:`pygccxml <../../pygccxml/pygccxml>` package to read `GCC-XML`_ generated file. + +The bottom line - you can be sure, that all your declarations are read correctly. + +.. _`GCC C++ compiler` : http://www.gnu.org/software/gcc + + +*"build module"* +----------------- + +Only very small and simple projects could be exported as is. Most of the projects +still require human invocation. Basically there are 2 questions that you should +answer: + + 1. which declarations should be exported + 2. how this specific declaration should be exported or, if I change a little + a question, what code should be written in order I get access from Python + to that functionality + +Of course, `Py++` cannot answer those question, but it provides maximum help to you. + +How can `Py++` help you with first question? `Py++` provides very powerful and +simple query interface. For example in one line of code you can select all free +functions that have two arguments, where the first argument has type ``int &`` +and the type of the second argument is any: + +.. code-block:: python + + mb = module_builder_t( ... ) #module_builder_t is the main class that + #will help you with code generation process + mb.free_functions( arg_types=[ 'int &', None ] ) + +Another example - the developer wants to exclude all protected functions from +being exported: + +.. code-block:: python + + mb = module_builder_t( ... ) + mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude() + +The developer can create custom criteria, for example exclude all declarations +with 'impl' ( implementation ) string within the name. + +.. code-block:: python + + mb = module_builder_t( ... ) + mb.decls( lambda decl: 'impl' in decl.name ).exclude() + +Note the way the queries were built. You can think about those queries as +the rules, which will continue to work even after exported C++ code was changed. +It means that you don't have to change code generator source code every time. + +So far, so good what about second question? Well, by default `Py++` generates a +code that will satisfy almost all developers. `Py++` could be configured in many +ways to satisfy your needs. But sometimes this is still not enough. There are +use cases when you need full control over generated code. One of the biggest +problems, with code generators in general, is modifying generated code and +preserving changes. How many code generators did you use or know, that +allow you to put your code anywhere or to reorder generated code as you wish? +`Py++` allows you to do that. + +`Py++` introduces new concept: code creator and code creators tree. You can think +about code creators tree as some kind of `AST`_. The only difference is that code +creators tree provides more specific functionality. For example ``include_t`` code +creator is responsible to create C++ ``include`` directive code. You have full +control over code creators tree, before it is written to disc. Here you +can find UML diagram of almost all code creators: `class diagram`_. + +.. _`AST`: http://en.wikipedia.org/wiki/Abstract_syntax_tree +.. _`class diagram`: code_creators_uml.png + +At the end of this step you have code creators tree, which is ready to be written +to disc. + +*"write code to files"* +----------------------- +During this step `Py++` reads the code creators tree and writes the code to a +disc. The code generation process result should not be different from the one, +which would be achieved by human. For small project writing all code into single +file is good approach, for big ones the code should be splitted into multiple files. +`Py++` implements both strategies. + +------------- +Features list +------------- + +* `Py++` supports almost all features found in `Boost.Python`_ library + +* Using `Py++` you can develop few extension modules simultaneously, especially + when they share the code. + +* `Py++` generates code, which will help you: + + * to understand compiler generated error messages + + * to minimize project built time + +* `Py++` has few modes of writing code into files: + + * single file + + * multiple files + + * fixed set of multiple files + + * multiple files, where single class code is split to few files + +* You have full control over generated code. Your code could be inserted almost + anywhere. + +* Your license is written at the top of every generated file + +* `Py++` will check the "completeness" of the bindings. It will check for you + that the exposed declarations don't have references to unexposed ones. + +* `Py++` provides enough functionality to extract source code documentation + and write it as Python documentation string + +* `Py++` provides simple and powerful framework to create a wrapper for + functions, which could not be exposed as is to `Python`_. + +* ... + +------- +License +------- + +`Boost Software License`_. + +--------------------------- +Documentation contents +--------------------------- + +.. toctree:: + :maxdepth: 1 + + documentation/tutorials/tutorials.rest + quotes.rest + download.rest + documentation/index.rest + examples/examples.rest + links.rest + comparisons/compare_to.rest + peps/peps_index.rest + troubleshooting_guide/lessons_learned.rest + history/history.rest + +.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html +.. _`Python`: http://www.python.org +.. _`GCC-XML`: http://www.gccxml.org +.. _`Boost Software License`: http://boost.org/more/license_info.html Modified: pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest =================================================================== --- pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest 2009-05-11 09:01:32 UTC (rev 1714) +++ pyplusplus_dev/docs/troubleshooting_guide/lessons_learned.rest 2009-05-11 11:14:03 UTC (rev 1715) @@ -1,21 +1,22 @@ -============================== -Boost.Python - lessons learned -============================== - --------- -Preamble --------- - -Software development is an interactive process. During `Py++` development -I see many interesting problems and even more interesting solutions. - -On this page you will find my collection of the solutions to some of the problems. - -.. toctree:: - - easy_extending_guide/easy_extending_guide.rest - smart_ptrs/smart_ptrs.rest - shared_ptr/shared_ptr.rest - automatic_conversion/automatic_conversion.rest - exceptions/exceptions.rest - +============================== +Boost.Python - lessons learned +============================== + +-------- +Preamble +-------- + +Software development is an interactive process. During `Py++` development +I see many interesting problems and even more interesting solutions. + +On this page you will find my collection of the solutions to some of the problems. + +.. toctree:: + :maxdepth: 1 + + easy_extending_guide/easy_extending_guide.rest + smart_ptrs/smart_ptrs.rest + shared_ptr/shared_ptr.rest + automatic_conversion/automatic_conversion.rest + exceptions/exceptions.rest + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-11 09:01:40
|
Revision: 1714 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1714&view=rev Author: roman_yakovenko Date: 2009-05-11 09:01:32 +0000 (Mon, 11 May 2009) Log Message: ----------- documentation update Modified Paths: -------------- index.rest pygccxml_dev/docs/apidocs/api.rest pygccxml_dev/docs/design.rest pygccxml_dev/docs/download.rest pygccxml_dev/docs/history/history.rest pygccxml_dev/docs/pygccxml.rest pygccxml_dev/docs/query_interface.rest Modified: index.rest =================================================================== --- index.rest 2009-05-11 07:44:51 UTC (rev 1713) +++ index.rest 2009-05-11 09:01:32 UTC (rev 1714) @@ -1,54 +1,50 @@ -============================== -C\\C++ Python language binding -============================== - ----------------- -pygccxml package ----------------- - -* Do you need to parse C++ code? -* Do you need to build code generator? -* Do you need to create UML diagram? - -:doc:`pygccxml <pygccxml/pygccxml>` is the way to go! :doc:`Learn more <pygccxml/pygccxml>`. - ------------- -Py++ package ------------- - -"I love deadlines. I love the whooshing noise they make as they go by." - -- Douglas Adams - -Meet your deadlines with powerful code generator engine - :doc:`Py++ <pyplusplus/pyplusplus>`. - -:doc:`Py++ <pyplusplus/pyplusplus>`, `ctypes <http://docs.python.org/library/ctypes.html>`_ -and `Boost.Python <http://www.boost.org/doc/libs/1_38_0/libs/python/doc/index.html>`_ -provide a complete solution for interfacing Python and C\\C++. -:doc:`Learn more <pyplusplus/pyplusplus>`. - -*European Space Agency*, *Ogre*, *PyOpenSG* and many others :doc:`use <pyplusplus/quotes>` `Py++`. - -------------- -pydsc package -------------- - -Documentation strings contain spelling errors? :doc:`Fix them in a minute <pydsc/pydsc>`! - -------------- -Documentation -------------- - -.. toctree:: - :maxdepth: 1 - - pygccxml documentation <pygccxml/pygccxml.rest> - Py++ documentation <pyplusplus/pyplusplus.rest> - pydsc documentation <pydsc/pydsc.rest> - ------------------- -Indices and tables ------------------- - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` +============================== +C\\C++ Python language binding +============================== + +---------------- +pygccxml package +---------------- + +* Do you need to parse C++ code? +* Do you need to build code generator? +* Do you need to create UML diagram? + +:doc:`pygccxml <pygccxml/pygccxml>` is the way to go! :doc:`Learn more <pygccxml/pygccxml>`. + +------------ +Py++ package +------------ + +"I love deadlines. I love the whooshing noise they make as they go by." + -- Douglas Adams + +Meet your deadlines with powerful code generator engine - :doc:`Py++ <pyplusplus/pyplusplus>`. + +:doc:`Py++ <pyplusplus/pyplusplus>`, `ctypes <http://docs.python.org/library/ctypes.html>`_ +and `Boost.Python <http://www.boost.org/doc/libs/1_38_0/libs/python/doc/index.html>`_ +provide a complete solution for interfacing Python and C\\C++. +:doc:`Learn more <pyplusplus/pyplusplus>`. + +*European Space Agency*, *Ogre*, *PyOpenSG* and many others :doc:`use <pyplusplus/quotes>` `Py++`. + +------------- +pydsc package +------------- + +Documentation strings contain spelling errors? :doc:`Fix them in a minute <pydsc/pydsc>`! + +.. toctree:: + :hidden: + + pydsc/pydsc.rest + pygccxml/pygccxml.rest + pyplusplus/pyplusplus.rest + +------------------ +Indices and tables +------------------ + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` Modified: pygccxml_dev/docs/apidocs/api.rest =================================================================== --- pygccxml_dev/docs/apidocs/api.rest 2009-05-11 07:44:51 UTC (rev 1713) +++ pygccxml_dev/docs/apidocs/api.rest 2009-05-11 09:01:32 UTC (rev 1714) @@ -1,11 +1,15 @@ -=== +==== API -=== +==== +---- +API +---- + `pygccxml` consists from 4 sub packages .. toctree:: - :maxdepth: 4 + :maxdepth: 1 declarations.rest parser.rest Modified: pygccxml_dev/docs/design.rest =================================================================== --- pygccxml_dev/docs/design.rest 2009-05-11 07:44:51 UTC (rev 1713) +++ pygccxml_dev/docs/design.rest 2009-05-11 09:01:32 UTC (rev 1714) @@ -1,293 +1,293 @@ -=============== -pygccxml design -=============== - ------------------------- -The view from 10000 fits ------------------------- - -:doc:`pygccxml <pygccxml>` has 4 packages: - -* :mod:`declarations <pygccxml.declarations>` package defines classes that describe - C++ declarations and types - -* :mod:`parser <pygccxml.parser>` package defines classes that parse `GCC-XML`_ - generated files. Also it defines few classes that will help you to eliminate - unnecessary parsing of C++ source files. - -* :mod:`binary_parsers <pygccxml.binary_parsers>` package extracts some - information from binary files ( `.so`, `.dll`, `.map` ) and merges it with - the declarations tree. - -* ``utils`` package defines few functions, I found useful in the whole project. - -------------------------- -``declarations`` package -------------------------- - -Please take a look on the `UML diagram`_. This `UML diagram`_ describes almost all -classes defined in the package and their relationship. ``declarations`` package -defines two hierarchies of class: - -1. types hierarchy - used to represent a C++ type - -2. declarations hierarchy - used to represent a C++ declaration - - -Types hierarchy ---------------- - -Types hierarchy is used to represent an arbitrary type in C++. class ``type_t`` -is the base class. - -``type_traits`` -~~~~~~~~~~~~~~~ - -Are you aware of `boost::type_traits`_ library? The `boost::type_traits`_ -library contains a set of very specific traits classes, each of which -encapsulate a single trait from the C++ type system; for example, is a type -a pointer or a reference? Or does a type have a trivial constructor, or a -const-qualifier? - -:doc:`pygccxml <pygccxml>` implements a lot of functionality from the library: - -* a lot of algorithms were implemented - - + ``is_same`` - - + ``is_enum`` - - + ``is_void`` - - + ``is_const`` - - + ``is_array`` - - + ``is_pointer`` - - + ``is_volatile`` - - + ``is_integral`` - - + ``is_reference`` - - + ``is_arithmetic`` - - + ``is_convertible`` - - + ``is_fundamental`` - - + ``is_floating_point`` - - + ``is_base_and_derived`` - - + ``is_unary_operator`` - - + ``is_binary_operator`` - - + ``remove_cv`` - - + ``remove_const`` - - + ``remove_alias`` - - + ``remove_pointer`` - - + ``remove_volatile`` - - + ``remove_reference`` - - + ``has_trivial_copy`` - - + ``has_trivial_constructor`` - - + ``has_any_non_copyconstructor`` - - For a full list of implemented algorithms, please consult API documentation. - -* a lot of unit tests has been written base on unit tests from the - `boost::type_traits`_ library. - - -If you are going to build code generator, you will find ``type_traits`` very handy. - -Declarations hierarchy ----------------------- - -A declaration hierarchy is used to represent an arbitrary C++ declaration. -Basically, most of the classes defined in this package are just "set of properties". - -``declaration_t`` is the base class of the declaration hierarchy. Every declaration -has ``parent`` property. This property keeps a reference to the scope declaration -instance, in which this declaration is defined. - -The ``scopedef_t`` class derives from ``declaration_t``. This class is used to -say - "I may have other declarations inside". The "composite" design pattern is -used here. ``class_t`` and ``namespace_t`` declaration classes derive from the -``scopedef_t`` class. - ------------------- -``parser`` package ------------------- - -Please take a look on `parser package UML diagram`_ . Classes defined in this -package, implement parsing and linking functionality. There are few kind of -classes defined by the package: - -* classes, that implements parsing algorithms of `GCC-XML`_ generated XML file - -* parser configuration classes - -* cache - classes, those one will help you to eliminate unnecessary parsing - -* patchers - classes, which fix `GCC-XML`_ generated declarations. ( Yes, sometimes - GCC-XML generates wrong description of C++ declaration. ) - -Parser classes --------------- - -``source_reader_t`` - the only class that have a detailed knowledge about `GCC-XML`_. -It has only one responsibility: it calls `GCC-XML`_ with a source file specified -by user and creates declarations tree. The implementation of this class is split -to 2 classes: - -1. ``scanner_t`` - this class scans the "XML" file, generated by `GCC-XML`_ and - creates :doc:`pygccxml <pygccxml>` declarations and types classes. After the xml file has - been processed declarations and type class instances keeps references to - each other using `GCC-XML`_ generated ids. - -2. ``linker_t`` - this class contains logic for replacing `GCC-XML`_ generated - ids with references to declarations or type class instances. - -Both those classes are implementation details and should not be used by user. -Performance note: ``scanner_t`` class uses Python ``xml.sax`` package in order -to parse XML. As a result, ``scanner_t`` class is able to parse even big XML files -pretty quick. - -``project_reader_t`` - think about this class as a linker. In most cases you work -with few source files. GCC-XML does not supports this mode of work. So, :doc:`pygccxml <pygccxml>` -implements all functionality needed to parse few source files at once. -``project_reader_t`` implements 2 different algorithms, that solves the problem: - -1. ``project_reader_t`` creates temporal source file, which includes all the source - files. - -2. ``project_reader_t`` parse separately every source file, using ``source_reader_t`` - class and then joins the resulting declarations tree into single declarations - tree. - -Both approaches have different trades-off. The first approach does not allow you -to reuse information from already parsed source files. While the second one -allows you to setup cache. - -Parser configuration classes ----------------------------- - -``config_t`` - a class, that accumulates all the settings needed to invoke `GCC-XML`_: - - -``file_configuration_t`` - a class, that contains some data and description how -to treat the data. ``file_configuration_t`` can contain reference to the the following types -of data: - -(1) path to C++ source file - -(2) path to `GCC-XML`_ generated XML file - -(3) path to C++ source file and path to `GCC-XML`_ generated XML file - - In this case, if XML file does not exists, it will be created. Next time - you will ask to parse the source file, the XML file will be used instead. - - Small tip: you can setup your makefile to delete XML files every time, - the relevant source file has changed. - -(4) Python string, that contains valid C++ code - -There are few functions that will help you to construct ``file_configuration_t`` -object: - -* ``def create_source_fc( header )`` - - ``header`` contains path to C++ source file - -* ``def create_gccxml_fc( xml_file )`` - - ``xml_file`` contains path to `GCC-XML`_ generated XML file - -* ``def create_cached_source_fc( header, cached_source_file )`` - - - ``header`` contains path to C++ source file - - ``xml_file`` contains path to `GCC-XML`_ generated XML file - -* ``def create_text_fc( text )`` - - ``text`` - Python string, that contains valid C++ code - - -Cache classes -------------- - -There are few cache classes, which implements different cache strategies. - -1. ``file_configuration_t`` class, that keeps path to C++ source file and path to - `GCC-XML`_ generated XML file. - -2. ``file_cache_t`` class, will save all declarations from all files within single - binary file. - -3. ``directory_cache_t`` class will store one index file called "index.dat" which - is always read by the cache when the cache object is created. Each header file - will have its corresponding \*.cache file that stores the declarations found - in the header file. The index file is used to determine whether a \*.cache file - is still valid or not (by checking if one of the dependent files - (i.e. the header file itself and all included files) have been modified since - the last run). - -In some cases, ``directory_cache_t`` class gives much better performance, than -``file_cache_t``. Many thanks to Matthias Baas for its implementation. - -**Warning**: when :doc:`pygccxml <pygccxml>` writes information to files, using cache classes, -it does not write any version information. It means, that when you upgrade -:doc:`pygccxml <pygccxml>` you have to delete all your cache files. Otherwise you will get very -strange errors. For example: missing attribute. - - -Patchers --------- - -Well, `GCC-XML`_ has few bugs, which could not be fixed from it. For example - -.. code-block:: c++ - - namespace ns1{ namespace ns2{ - enum fruit{ apple, orange }; - } } - -.. code-block:: c++ - - void fix_enum( ns1::ns2::fruit arg=ns1::ns2::apple ); - -`GCC-XML`_ will report the default value of ``arg`` as ``apple``. Obviously -this in an error. :doc:`pygccxml <pygccxml>` knows how to fix this bug. - -This is not the only bug, which could be fixed, there are few of them. :doc:`pygccxml <pygccxml>` -introduces few classes, which knows how to deal with specific bug. More over, those -bugs are fixed, only if I am 101% sure, that this is the right thing to do. - -------- -Summary -------- - -That's all. I hope I was clear, at least I tried. Any way, :doc:`pygccxml <pygccxml>` is an open -source project. You always can take a look on the source code. If you need more -information please read API documentation. - - -.. _`SourceForge`: http://sourceforge.net/index.php -.. _`Python`: http://www.python.org -.. _`GCC-XML`: http://www.gccxml.org -.. _`UML diagram` : declarations_uml.png -.. _`parser package UML diagram` : parser_uml.png -.. _`ReleaseForge` : http://releaseforge.sourceforge.net -.. _`boost::type_traits` : http://www.boost.org/libs/type_traits/index.html +=============== +Design overview +=============== + +------------------------ +The view from 10000 fits +------------------------ + +:doc:`pygccxml <pygccxml>` has 4 packages: + +* :mod:`declarations <pygccxml.declarations>` package defines classes that describe + C++ declarations and types + +* :mod:`parser <pygccxml.parser>` package defines classes that parse `GCC-XML`_ + generated files. Also it defines few classes that will help you to eliminate + unnecessary parsing of C++ source files. + +* :mod:`binary_parsers <pygccxml.binary_parsers>` package extracts some + information from binary files ( `.so`, `.dll`, `.map` ) and merges it with + the declarations tree. + +* ``utils`` package defines few functions, I found useful in the whole project. + +------------------------- +``declarations`` package +------------------------- + +Please take a look on the `UML diagram`_. This `UML diagram`_ describes almost all +classes defined in the package and their relationship. ``declarations`` package +defines two hierarchies of class: + +1. types hierarchy - used to represent a C++ type + +2. declarations hierarchy - used to represent a C++ declaration + + +Types hierarchy +--------------- + +Types hierarchy is used to represent an arbitrary type in C++. class ``type_t`` +is the base class. + +``type_traits`` +~~~~~~~~~~~~~~~ + +Are you aware of `boost::type_traits`_ library? The `boost::type_traits`_ +library contains a set of very specific traits classes, each of which +encapsulate a single trait from the C++ type system; for example, is a type +a pointer or a reference? Or does a type have a trivial constructor, or a +const-qualifier? + +:doc:`pygccxml <pygccxml>` implements a lot of functionality from the library: + +* a lot of algorithms were implemented + + + ``is_same`` + + + ``is_enum`` + + + ``is_void`` + + + ``is_const`` + + + ``is_array`` + + + ``is_pointer`` + + + ``is_volatile`` + + + ``is_integral`` + + + ``is_reference`` + + + ``is_arithmetic`` + + + ``is_convertible`` + + + ``is_fundamental`` + + + ``is_floating_point`` + + + ``is_base_and_derived`` + + + ``is_unary_operator`` + + + ``is_binary_operator`` + + + ``remove_cv`` + + + ``remove_const`` + + + ``remove_alias`` + + + ``remove_pointer`` + + + ``remove_volatile`` + + + ``remove_reference`` + + + ``has_trivial_copy`` + + + ``has_trivial_constructor`` + + + ``has_any_non_copyconstructor`` + + For a full list of implemented algorithms, please consult API documentation. + +* a lot of unit tests has been written base on unit tests from the + `boost::type_traits`_ library. + + +If you are going to build code generator, you will find ``type_traits`` very handy. + +Declarations hierarchy +---------------------- + +A declaration hierarchy is used to represent an arbitrary C++ declaration. +Basically, most of the classes defined in this package are just "set of properties". + +``declaration_t`` is the base class of the declaration hierarchy. Every declaration +has ``parent`` property. This property keeps a reference to the scope declaration +instance, in which this declaration is defined. + +The ``scopedef_t`` class derives from ``declaration_t``. This class is used to +say - "I may have other declarations inside". The "composite" design pattern is +used here. ``class_t`` and ``namespace_t`` declaration classes derive from the +``scopedef_t`` class. + +------------------ +``parser`` package +------------------ + +Please take a look on `parser package UML diagram`_ . Classes defined in this +package, implement parsing and linking functionality. There are few kind of +classes defined by the package: + +* classes, that implements parsing algorithms of `GCC-XML`_ generated XML file + +* parser configuration classes + +* cache - classes, those one will help you to eliminate unnecessary parsing + +* patchers - classes, which fix `GCC-XML`_ generated declarations. ( Yes, sometimes + GCC-XML generates wrong description of C++ declaration. ) + +Parser classes +-------------- + +``source_reader_t`` - the only class that have a detailed knowledge about `GCC-XML`_. +It has only one responsibility: it calls `GCC-XML`_ with a source file specified +by user and creates declarations tree. The implementation of this class is split +to 2 classes: + +1. ``scanner_t`` - this class scans the "XML" file, generated by `GCC-XML`_ and + creates :doc:`pygccxml <pygccxml>` declarations and types classes. After the xml file has + been processed declarations and type class instances keeps references to + each other using `GCC-XML`_ generated ids. + +2. ``linker_t`` - this class contains logic for replacing `GCC-XML`_ generated + ids with references to declarations or type class instances. + +Both those classes are implementation details and should not be used by user. +Performance note: ``scanner_t`` class uses Python ``xml.sax`` package in order +to parse XML. As a result, ``scanner_t`` class is able to parse even big XML files +pretty quick. + +``project_reader_t`` - think about this class as a linker. In most cases you work +with few source files. GCC-XML does not supports this mode of work. So, :doc:`pygccxml <pygccxml>` +implements all functionality needed to parse few source files at once. +``project_reader_t`` implements 2 different algorithms, that solves the problem: + +1. ``project_reader_t`` creates temporal source file, which includes all the source + files. + +2. ``project_reader_t`` parse separately every source file, using ``source_reader_t`` + class and then joins the resulting declarations tree into single declarations + tree. + +Both approaches have different trades-off. The first approach does not allow you +to reuse information from already parsed source files. While the second one +allows you to setup cache. + +Parser configuration classes +---------------------------- + +``config_t`` - a class, that accumulates all the settings needed to invoke `GCC-XML`_: + + +``file_configuration_t`` - a class, that contains some data and description how +to treat the data. ``file_configuration_t`` can contain reference to the the following types +of data: + +(1) path to C++ source file + +(2) path to `GCC-XML`_ generated XML file + +(3) path to C++ source file and path to `GCC-XML`_ generated XML file + + In this case, if XML file does not exists, it will be created. Next time + you will ask to parse the source file, the XML file will be used instead. + + Small tip: you can setup your makefile to delete XML files every time, + the relevant source file has changed. + +(4) Python string, that contains valid C++ code + +There are few functions that will help you to construct ``file_configuration_t`` +object: + +* ``def create_source_fc( header )`` + + ``header`` contains path to C++ source file + +* ``def create_gccxml_fc( xml_file )`` + + ``xml_file`` contains path to `GCC-XML`_ generated XML file + +* ``def create_cached_source_fc( header, cached_source_file )`` + + - ``header`` contains path to C++ source file + - ``xml_file`` contains path to `GCC-XML`_ generated XML file + +* ``def create_text_fc( text )`` + + ``text`` - Python string, that contains valid C++ code + + +Cache classes +------------- + +There are few cache classes, which implements different cache strategies. + +1. ``file_configuration_t`` class, that keeps path to C++ source file and path to + `GCC-XML`_ generated XML file. + +2. ``file_cache_t`` class, will save all declarations from all files within single + binary file. + +3. ``directory_cache_t`` class will store one index file called "index.dat" which + is always read by the cache when the cache object is created. Each header file + will have its corresponding \*.cache file that stores the declarations found + in the header file. The index file is used to determine whether a \*.cache file + is still valid or not (by checking if one of the dependent files + (i.e. the header file itself and all included files) have been modified since + the last run). + +In some cases, ``directory_cache_t`` class gives much better performance, than +``file_cache_t``. Many thanks to Matthias Baas for its implementation. + +**Warning**: when :doc:`pygccxml <pygccxml>` writes information to files, using cache classes, +it does not write any version information. It means, that when you upgrade +:doc:`pygccxml <pygccxml>` you have to delete all your cache files. Otherwise you will get very +strange errors. For example: missing attribute. + + +Patchers +-------- + +Well, `GCC-XML`_ has few bugs, which could not be fixed from it. For example + +.. code-block:: c++ + + namespace ns1{ namespace ns2{ + enum fruit{ apple, orange }; + } } + +.. code-block:: c++ + + void fix_enum( ns1::ns2::fruit arg=ns1::ns2::apple ); + +`GCC-XML`_ will report the default value of ``arg`` as ``apple``. Obviously +this in an error. :doc:`pygccxml <pygccxml>` knows how to fix this bug. + +This is not the only bug, which could be fixed, there are few of them. :doc:`pygccxml <pygccxml>` +introduces few classes, which knows how to deal with specific bug. More over, those +bugs are fixed, only if I am 101% sure, that this is the right thing to do. + +------- +Summary +------- + +That's all. I hope I was clear, at least I tried. Any way, :doc:`pygccxml <pygccxml>` is an open +source project. You always can take a look on the source code. If you need more +information please read API documentation. + + +.. _`SourceForge`: http://sourceforge.net/index.php +.. _`Python`: http://www.python.org +.. _`GCC-XML`: http://www.gccxml.org +.. _`UML diagram` : declarations_uml.png +.. _`parser package UML diagram` : parser_uml.png +.. _`ReleaseForge` : http://releaseforge.sourceforge.net +.. _`boost::type_traits` : http://www.boost.org/libs/type_traits/index.html Modified: pygccxml_dev/docs/download.rest =================================================================== --- pygccxml_dev/docs/download.rest 2009-05-11 07:44:51 UTC (rev 1713) +++ pygccxml_dev/docs/download.rest 2009-05-11 09:01:32 UTC (rev 1714) @@ -1,67 +1,67 @@ -================= -pygccxml download -================= - -------------------------- -pygccxml on SourceForge -------------------------- - -:doc:`pygccxml <pygccxml>` project is hosted on SourceForge. Using SourceForge services you -can: - -1) get access to source code -2) get access to latest release version of :doc:`pygccxml <pygccxml>` - - ------------------ -Subversion access ------------------ - -http://sourceforge.net/svn/?group_id=118209 - --------- -Download --------- - -https://sourceforge.net/project/showfiles.php?group_id=118209 - ------------- -Installation ------------- - -GCC-XML -------- -There are few different ways to install GCC-XML on your system: - -1. If you use Linux, than I am almost sure your system has "gccxml" package. - Consider to install it using "native"(rpm, deb, portage) packaging system. - -.. line separator - -2. Another option is to install it from the source code. See `instructions`_ - provided by Brad King, the author of `GCC-XML`_. Installation from sources - is supported for Windows, Linux and Mac platforms. - -.. _`instructions` : http://gccxml.org/HTML/Install.html - -3. You can use `GCC-XML`_ installer built by me, from the CVS. Go to `download page`_ - and download "gccxml-setup". - -.. _`download page` : http://sourceforge.net/project/showfiles.php?group_id=118209 - -pygccxml --------- -In command prompt or shell change current directory to be "pygccxml-X.Y.Z". -"X.Y.Z" is version of :doc:`pygccxml <pygccxml>`. Type the following command: - -| ``python setup.py install`` - -After this command complete, you should have installed :doc:`pygccxml <pygccxml>` package. - ------------- -Dependencies ------------- - -* `GCC-XML`_ - -.. _`GCC-XML`: http://www.gccxml.org +================== +Download & Install +================== + +------------------------- +pygccxml on SourceForge +------------------------- + +:doc:`pygccxml <pygccxml>` project is hosted on SourceForge. Using SourceForge services you +can: + +1) get access to source code +2) get access to latest release version of :doc:`pygccxml <pygccxml>` + + +----------------- +Subversion access +----------------- + +http://sourceforge.net/svn/?group_id=118209 + +-------- +Download +-------- + +https://sourceforge.net/project/showfiles.php?group_id=118209 + +------------ +Installation +------------ + +GCC-XML +------- +There are few different ways to install GCC-XML on your system: + +1. If you use Linux, than I am almost sure your system has "gccxml" package. + Consider to install it using "native"(rpm, deb, portage) packaging system. + +.. line separator + +2. Another option is to install it from the source code. See `instructions`_ + provided by Brad King, the author of `GCC-XML`_. Installation from sources + is supported for Windows, Linux and Mac platforms. + +.. _`instructions` : http://gccxml.org/HTML/Install.html + +3. You can use `GCC-XML`_ installer built by me, from the CVS. Go to `download page`_ + and download "gccxml-setup". + +.. _`download page` : http://sourceforge.net/project/showfiles.php?group_id=118209 + +pygccxml +-------- +In command prompt or shell change current directory to be "pygccxml-X.Y.Z". +"X.Y.Z" is version of :doc:`pygccxml <pygccxml>`. Type the following command: + +| ``python setup.py install`` + +After this command complete, you should have installed :doc:`pygccxml <pygccxml>` package. + +------------ +Dependencies +------------ + +* `GCC-XML`_ + +.. _`GCC-XML`: http://www.gccxml.org Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2009-05-11 07:44:51 UTC (rev 1713) +++ pygccxml_dev/docs/history/history.rest 2009-05-11 09:01:32 UTC (rev 1714) @@ -1,563 +1,563 @@ -============================ -pygccxml development history -============================ - ------------- -Contributors ------------- - -Thanks to all the people that have contributed patches, bug reports and suggestions: - -* My wife - Yulia -* John Pallister -* Matthias Baas -* Allen Bierbaum -* Georgiy Dernovoy -* Darren Garnier -* Gottfried Ganssauge -* Gaetan Lehmann -* Martin Preisler -* Miguel Lobo -* Jeremy Sanders -* Ben Schleimer -* Gustavo Carneiro - ------------ -Version 1.1 ------------ - -1. Experimental back-ends based on ``.pdb`` and ``.bsc`` files were removed. - -2. Ability to extract different information from binary files ( ``.pdb``, ``.so``, - ``.map`` ) and merge it with a declarations tree was added. - -3. Ability to load `GCC-XML`_ configuration from ``.ini`` like file was added. - See :func:`pygccxml.parser.config.load_gccxml_configuration` for details. - -4. From now on, :doc:`pygccxml <../pygccxml>` will use `Sphinx <http://sphinx.pocoo.org/>`_ - for all documentation. The documentation format and content were updated. - -5. From now on, `pygccxml` will provide convenient setup for latest `GCC-XML`_ - version (CVS). See :doc:`download <../download>` document. - -6. Bug `[ 2431993 ] pygccxml parses const volatile variable args as just const <http://sourceforge.net/tracker/index.php?func=detail&aid=2431993&group_id=118209&atid=684318>`_ - was fixed. - - ------------ -Version 1.0 ------------ - -1. Support for ellipsis was added. - - Warning: this feature introduce backward compatibility problem! - - Description: - - .. code-block:: c++ - - void do_smth( int, ... ) - - Before this change, pygccxml would report that the function ``do_smth`` has - only one argument. - - After this change, pygccxml will report that the function has two arguments. - The second argument type will be ``declarations.ellipsis_t``. All classes, - which describe callables, have new property ``has_ellipsis``. It the value of - the property is ``True``, than the function has ellipsis in its definition. - -2. New experimental back-end, based on ``.pdb`` (progam database file), was added. - -3. New high-level API wrapper for ``.bsc`` (browse source code file) was added. - -4. The recomended `GCC-XML`_ version to use with this release is CVS revision 123. - This revision introduces small, but very important feature. `GCC-XML`_ - started to dump artificial declarations (constructor, destructor, operator=). - ``pygccxml.declarations.type_traits`` functions were updated to use the new - information. - -5. ``declarations.decl_printer_t`` class dumps almost all available information - about a declaration. - -6. ``declarations.is_same_function`` was fixed and now it treats - "covariant returns" right. - -7. Search algorithm was improved for template instantiated classes. From - now, a spaces within the class name doesn't matter. - -8. pygccxml unit tests functionality was improved. Many thanks to Gustavo Carneiro. - -------------- -Version 0.9.5 -------------- - -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 - -3. A bug in parsing a function exception specification was fixed. Many thanks to - Jeremy Sanders. - -4. Support for a type/class "align", "offset" and "size" was added. Many thanks to - Ben Schleimer for the implementation. - -5. Support for GCC-XML 0.9 was added. - -6. Support for ``__restrict__`` was added. - -7. ``declarations.has_trivial_copy`` was renamed to ``declarations.has_copy_constructor``. - The old name is still available, but will be removed soon. - -8. ``declarations.priority_queue`` was renamed to ``declarations.priority_queue_traits``. - -9. ``declarations.find_container_traits`` function was added. - -10. Support for "partial name" was added. "Partial name" is the class name, without - template default arguments. The functionality was added to std containers - classes. - -11. ``declarations.class_t`` and ``declarations.class_declaration_t`` has new property - - ``container_traits``. This property describes std container element class. - -12. All logging is now done to ``stderr`` instead of ``stdout``. - -------------- -Version 0.9.0 -------------- - -1. Performance was improved. :doc:`pygccxml <../pygccxml>` is now 30-50% faster. The improvement - was achieved by using `cElementTree`_ package, ``iterparse`` functionality, - instead of standard XML SAX API. If `cElementTree`_ package is not available, - the built-in XML SAX package is used. - -.. _`cElementTree` : http://effbot.org/zone/celementtree.htm - -2. ``is_base_and_derived`` function was changed. The second argument could be - a tuple, which contains classes. The function returns ``True`` if at least one - class derives from the base one. - -.. line separator - -3. Class ``calldef_t`` has property - ``does_throw``. It describes - whether the function throws any exception or not. - -.. line separator - -4. Bug fixes: small bug was fixed in functionality that corrects GCC-XML reported - function default arguments. Reference to "enum" declaration extracted properly. - Many thanks to Martin Preisler for reporting the bug. - -.. line separator - -5. New type traits have been added: - - - * ``is_std_ostream`` - * ``is_std_wostream`` - -.. line separator - -6. C++ does not define implicit conversion between an integral type and ``void*``. - ``declarations.is_convertible`` type traits was fixed. - -.. line separator - -7. ``declarations.is_noncopyable`` type traits implementation was slightly changed. - Now it checks explicitly that class has: - - * default constructor - * copy constructor - * ``operator=`` - * destructor - - If all listed functions exist, than the algorithm returns ``False``, otherwise - it will continue to execute previous logic. - -.. line separator - -8. ``declarations.class_declaration_t`` has new property - ``aliases``. This is - a list of all aliases to the class declaration. - -.. line separator - -9. The message of the exception, which is raised from ``declarations.mdecl_wrapper_t`` - class was improved and now clearly explains what the problem is. - -.. line separator - -------------- -Version 0.8.5 -------------- - -1. Added new functionality: "I depend on them". Every declaration can report - types and declarations it depends on. - -2. ``signed char`` and ``char`` are two different types. This bug was fixed and - now :doc:`pygccxml <../pygccxml>` treats them right. Many thanks to Gaetan Lehmann for reporting - the bug. - -3. Declarations, read from GCC-XML generated file, could be saved in cache. - -4. New type traits have been added: - - * ``is_bool`` - -5. Small improvement to algorithm, which extracts ``value_type`` - ( ``mapped_type`` ) from "std" containers. - -6. Few aliases to long method name were introduced: - - ================================= ========================== - Name Alias - ================================= ========================== - ``scopedef_t.variable`` ``scopedef_t.var`` - ``scopedef_t.variables`` ``scopedef_t.vars`` - ``scopedef_t.member_function`` ``scopedef_t.mem_fun`` - ``scopedef_t.member_functions`` ``scopedef_t.mem_funs`` - ``scopedef_t.free_function`` ``scopedef_t.free_fun`` - ``scopedef_t.free_functions`` ``scopedef_t.free_funs`` - ================================= ========================== - -7. Fixing bug related to array size and cache. - -------------- -Version 0.8.2 -------------- - -1. Few small bug fix and unit tests have been introduced on 64 Bit platforms. - Many thanks to Gottfried Ganssauge! He also help me to discover and fix - some important bug in ``type_traits.__remove_alias`` function, by introducing - small example that reproduced the error. - -2. Huge speed improvement has been achieved (x10). Allen Bierbaum suggested to - save and reuse results of different :doc:`pygccxml <../pygccxml>` algorithms: - - * ``declarations.remove_alias`` - * ``declarations.full_name`` - * ``declarations.access_type`` - * ``declarations.demangled_name`` - * ``declarations.declaration_path`` - -3. Interface changes: - - * ``declarations.class_t``: - - + ``set_members`` method was removed - - + ``adopt_declaration`` method was introduced, instead of ``set_members`` - - * ``declarations.array_t`` class "set" accessor for size property was added. - - * ``declarations.namespace_t.adopt_declaration`` method was added. - - * ``declarations.variable_t.access_type`` property was added. - -4. New type traits have been added: - - * ``is_same_function`` - -5. Few bug were fixed. - -6. Documentation was improved. - -------------- -Version 0.8.1 -------------- - -1. :doc:`pygccxml <../pygccxml>` has been ported to MacOS X. Many thanks to Darren Garnier! - -2. New type traits have been added: - - * ``enum_traits`` - - * ``class_traits`` - - * ``class_declaration_traits`` - - * ``is_std_string`` - - * ``is_std_wstring`` - - * ``remove_declarated`` - - * ``has_public_less`` - - * ``has_public_equal`` - - * ``has_public_binary_operator`` - - * ``smart_pointer_traits`` - - * ``list_traits`` - - * ``deque_traits`` - - * ``queue_traits`` - - * ``priority_queue`` - - * ``vector_traits`` - - * ``stack_traits`` - - * ``map_traits`` - - * ``multimap_traits`` - - * ``hash_map_traits`` - - * ``hash_multimap_traits`` - - * ``set_traits`` - - * ``hash_set_traits`` - - * ``multiset_traits`` - - * ``hash_multiset_traits`` - -3. ``enumeration_t`` class interface was changed. Enumeration values are kept - in a list, instead of a dictionary. ``get_name2value_dict`` will build for - you dictionary, where key is an enumeration name, and value is an enumeration - value. - - This has been done in order to provide stable order of enumeration values. - -4. Now you can pass operator symbol, as a name to query functions: - - .. code-block:: python - - cls = global_namespace.class_( 'my_class' ) - op = cls.operator( '<' ) - #instead of - op = cls.operator( symbol='<' ) - -5. :doc:`pygccxml <../pygccxml>` improved a lot functionality related to providing feedback to user: - - * every package has its own logger - - * only important user messages are written to ``stdout`` - - * user messages are clear - -6. Support to Java native types has been added. - -7. It is possible to pass an arbitrary string as a parameter to `GCC-XML`_. - -8. Native java types has been added to fundamental types. - -9. Cache classes implementation was improved. - -10. Few bug were fixed. - -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: - - .. code-block:: python - - classes = ns.decls("class") - classes.decls("method") - - This will fail because it finds the attribute decls which is not a callable. - ------------ -Version 0.8 ------------ - -1. :doc:`pygccxml <../pygccxml>` now has power "select" interface. Read more about this cool feature - in tutorials. - -2. Improved support for template instantiations. :doc:`pygccxml <../pygccxml>` now take into - account demangled name of declarations. Please refer to documentation for - more explanantion. - -3. ``dummy_type_t`` - new type in types hierarchy. This is a very useful class - for code generation projects. - -4. New function - ``get_global_namespace``. As you can guess, it will find and - return reference to global namespace. - -5. New functionality in ``type_traits`` - ``has_public_assign``. This function - will return True, if class has public assign operator. - -6. ``declarations.class_t`` has new property - ``aliases``. This is a list of - all class aliases. - -7. Bug fixes. - -8. Documentation has been updated/written/improved. - -------------- -Version 0.7.1 -------------- - -**Attention - this going to be last version that is tested with Python 2.3** - -1. New fundamental types has been added - - * complex float - - * complex double - - * complex long double - -2. **Attention - non backward compatible change** - - ``declarations.filtering.user_defined`` and ``declarations.filtering.by_location`` - implementation has been changed. In previous version of those functions, - ``decls`` list has been changed in place. This was wrong behavior. Now, - those functions will return new list, which contains all desired declarations. - -3. Few new type traits has been added - - * *type_traits.has_destructor* - - * *type_traits.has_public_destructor* - - * *type_traits.has_public_constructor* - - * *type_traits.is_noncopyable* - -4. ``decl_printer_t`` class and ``print_declarations`` function have been added. - Now you can print in a nice way your declaration tree or part of it. - Thanks to Allen Bierbaum! - -5. New class ``declarations.decl_factory_t`` has been added. This is a default - factory for all declarations. From now all relevant parser classes takes as - input instance of this class or ``Null``. In case of ``Null`` instance of - ``declarations.decl_factory_t`` will be created. Using this class you can - easily extend functionality provided by built-in declarations. - -6. Sometimes, there is a need to find a declaration that match some criteria. - The was such functionality in :doc:`pygccxml <../pygccxml>`, but it was too limited. This - release fix the situation. :doc:`pygccxml <../pygccxml>` adds a set of classes that will help - you to deal with this problem. - -7. New cache - ``parser.directory_cache_t`` has been implemented. - ``parser.directory_cache_t`` uses individual files stored in a dedicated - cache directory to store the cached contents. - Thanks to Matthias Baas! - -8. ``parser.file_cache_t`` has been improved a lot. - Thanks to Allen Bierbaum! - -9. New file configuration is available: "cached source file". - ``parser.project_reader_t`` class will check for existence of `GCC-XML`_ - generated file. If it does not exist it will create one. If it do exist, - then the parser will use that file. - -10. Few helper functions has been added in order to make construction of - configuration file to be as easy as possible: - - * ``parser.create_text_fc`` - creates file configuration, that contains text - * ``parser.create_source_fc`` - creates file configuration, that contains - reference to regular source file - * ``parser.create_gccxml_fc`` - creates file configuration, that contains - reference to `GCC-XML`_ generated file - * ``parser.create_cached_source_fc`` - creates file configuration, that - contains reference to 2 files: `GCC-XML`_ generated file and regular source - file - -11. Small bug fixes. - -12. Documentation. Allen Bierbaum and Matthias Baas contributed so much in this - area. Almost every public function/class has now documentation string. - -13. Logging functionality has been added. :doc:`pygccxml <../pygccxml>` creates new logger - "pygccxml". Now it is possible to see what :doc:`pygccxml <../pygccxml>` is doing right now. - -14. I am sure I forgot something. - - -------------- -Version 0.6.9 -------------- - -1. New functions: - - * *type_traits.is_void_pointer* - - * *type_traits.array_size* - - * *type_traits.array_item_type* - -2. Class *declarations.variable_t* has new property - *bit_fields* - -3. Now it is possible to specify "undefined" directives using - *parser.config_t* class. - -4. *patch* functionality has been introduced. `GCC-XML`_ generates wrong - default values for function arguments. *patch* functionality tries to fix - this. - -5. Small bug fixes - -------------- -Version 0.6.8 -------------- - -1. Small bug has been fixed. - -------------- -Version 0.6.7 -------------- - -1. New functions: - - * *type_traits.remove_pointer* - - * *type_traits.base_type* - - * *type_traits.is_convertible* - -2. A lot of small bug fixes. - -3. Few English mistakes have been fixed. - - .. attention:: - - There are 2 none backward compatible changes: - - * class with name **compaund_t** has been renamed to **compound_t** - - * word **pathes** has been replaced with **paths** - -4. There are new properties on - - * *declarations.declaration_t.top_parent* - - * *declarations.class_t.recursive_bases* returns all base classes of the - class - - * *declarations.class_t.recursive_derived* returns all derived classes of - the class - - * *member_calldef_t.access_type* - -5. New type has been introduced: *unknown_t*. There are use cases when - `GCC-XML`_ does not returns function return type. - -6. New implementation of *make_flatten* algorithm using generators. - By default old implementation will be used. - -7. *parser.file_configuration_t* interface has been changed. Now it is able - to keep: source file, text or `GCC-XML`_ generated file. If you are doing - something with code that is not changing you'd better use `GCC-XML`_ - generated file as content of the *parser.file_configuration_t*. Save your - time. - -8. There are some cases when `GCC-XML`_ reports *"restricted"*. In this case - :doc:`pygccxml <../pygccxml>` replaces *"restricted"* with *"volatile"*. - - -.. _`SourceForge`: http://sourceforge.net/index.php -.. _`GCC-XML`: http://www.gccxml.org +=================== +Development history +=================== + +------------ +Contributors +------------ + +Thanks to all the people that have contributed patches, bug reports and suggestions: + +* My wife - Yulia +* John Pallister +* Matthias Baas +* Allen Bierbaum +* Georgiy Dernovoy +* Darren Garnier +* Gottfried Ganssauge +* Gaetan Lehmann +* Martin Preisler +* Miguel Lobo +* Jeremy Sanders +* Ben Schleimer +* Gustavo Carneiro + +----------- +Version 1.1 +----------- + +1. Experimental back-ends based on ``.pdb`` and ``.bsc`` files were removed. + +2. Ability to extract different information from binary files ( ``.pdb``, ``.so``, + ``.map`` ) and merge it with a declarations tree was added. + +3. Ability to load `GCC-XML`_ configuration from ``.ini`` like file was added. + See :func:`pygccxml.parser.config.load_gccxml_configuration` for details. + +4. From now on, :doc:`pygccxml <../pygccxml>` will use `Sphinx <http://sphinx.pocoo.org/>`_ + for all documentation. The documentation format and content were updated. + +5. From now on, `pygccxml` will provide convenient setup for latest `GCC-XML`_ + version (CVS). See :doc:`download <../download>` document. + +6. Bug `[ 2431993 ] pygccxml parses const volatile variable args as just const <http://sourceforge.net/tracker/index.php?func=detail&aid=2431993&group_id=118209&atid=684318>`_ + was fixed. + + +----------- +Version 1.0 +----------- + +1. Support for ellipsis was added. + + Warning: this feature introduce backward compatibility problem! + + Description: + + .. code-block:: c++ + + void do_smth( int, ... ) + + Before this change, pygccxml would report that the function ``do_smth`` has + only one argument. + + After this change, pygccxml will report that the function has two arguments. + The second argument type will be ``declarations.ellipsis_t``. All classes, + which describe callables, have new property ``has_ellipsis``. It the value of + the property is ``True``, than the function has ellipsis in its definition. + +2. New experimental back-end, based on ``.pdb`` (progam database file), was added. + +3. New high-level API wrapper for ``.bsc`` (browse source code file) was added. + +4. The recomended `GCC-XML`_ version to use with this release is CVS revision 123. + This revision introduces small, but very important feature. `GCC-XML`_ + started to dump artificial declarations (constructor, destructor, operator=). + ``pygccxml.declarations.type_traits`` functions were updated to use the new + information. + +5. ``declarations.decl_printer_t`` class dumps almost all available information + about a declaration. + +6. ``declarations.is_same_function`` was fixed and now it treats + "covariant returns" right. + +7. Search algorithm was improved for template instantiated classes. From + now, a spaces within the class name doesn't matter. + +8. pygccxml unit tests functionality was improved. Many thanks to Gustavo Carneiro. + +------------- +Version 0.9.5 +------------- + +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 + +3. A bug in parsing a function exception specification was fixed. Many thanks to + Jeremy Sanders. + +4. Support for a type/class "align", "offset" and "size" was added. Many thanks to + Ben Schleimer for the implementation. + +5. Support for GCC-XML 0.9 was added. + +6. Support for ``__restrict__`` was added. + +7. ``declarations.has_trivial_copy`` was renamed to ``declarations.has_copy_constructor``. + The old name is still available, but will be removed soon. + +8. ``declarations.priority_queue`` was renamed to ``declarations.priority_queue_traits``. + +9. ``declarations.find_container_traits`` function was added. + +10. Support for "partial name" was added. "Partial name" is the class name, without + template default arguments. The functionality was added to std containers + classes. + +11. ``declarations.class_t`` and ``declarations.class_declaration_t`` has new property - + ``container_traits``. This property describes std container element class. + +12. All logging is now done to ``stderr`` instead of ``stdout``. + +------------- +Version 0.9.0 +------------- + +1. Performance was improved. :doc:`pygccxml <../pygccxml>` is now 30-50% faster. The improvement + was achieved by using `cElementTree`_ package, ``iterparse`` functionality, + instead of standard XML SAX API. If `cElementTree`_ package is not available, + the built-in XML SAX package is used. + +.. _`cElementTree` : http://effbot.org/zone/celementtree.htm + +2. ``is_base_and_derived`` function was changed. The second argument could be + a tuple, which contains classes. The function returns ``True`` if at least one + class derives from the base one. + +.. line separator + +3. Class ``calldef_t`` has property - ``does_throw``. It describes + whether the function throws any exception or not. + +.. line separator + +4. Bug fixes: small bug was fixed in functionality that corrects GCC-XML reported + function default arguments. Reference to "enum" declaration extracted properly. + Many thanks to Martin Preisler for reporting the bug. + +.. line separator + +5. New type traits have been added: + + + * ``is_std_ostream`` + * ``is_std_wostream`` + +.. line separator + +6. C++ does not define implicit conversion between an integral type and ``void*``. + ``declarations.is_convertible`` type traits was fixed. + +.. line separator + +7. ``declarations.is_noncopyable`` type traits implementation was slightly changed. + Now it checks explicitly that class has: + + * default constructor + * copy constructor + * ``operator=`` + * destructor + + If all listed functions exist, than the algorithm returns ``False``, otherwise + it will continue to execute previous logic. + +.. line separator + +8. ``declarations.class_declaration_t`` has new property - ``aliases``. This is + a list of all aliases to the class declaration. + +.. line separator + +9. The message of the exception, which is raised from ``declarations.mdecl_wrapper_t`` + class was improved and now clearly explains what the problem is. + +.. line separator + +------------- +Version 0.8.5 +------------- + +1. Added new functionality: "I depend on them". Every declaration can report + types and declarations it depends on. + +2. ``signed char`` and ``char`` are two different types. This bug was fixed and + now :doc:`pygccxml <../pygccxml>` treats them right. Many thanks to Gaetan Lehmann for reporting + the bug. + +3. Declarations, read from GCC-XML generated file, could be saved in cache. + +4. New type traits have been added: + + * ``is_bool`` + +5. Small improvement to algorithm, which extracts ``value_type`` + ( ``mapped_type`` ) from "std" containers. + +6. Few aliases to long method name were introduced: + + ================================= ========================== + Name Alias + ================================= ========================== + ``scopedef_t.variable`` ``scopedef_t.var`` + ``scopedef_t.variables`` ``scopedef_t.vars`` + ``scopedef_t.member_function`` ``scopedef_t.mem_fun`` + ``scopedef_t.member_functions`` ``scopedef_t.mem_funs`` + ``scopedef_t.free_function`` ``scopedef_t.free_fun`` + ``scopedef_t.free_functions`` ``scopedef_t.free_funs`` + ================================= ========================== + +7. Fixing bug related to array size and cache. + +------------- +Version 0.8.2 +------------- + +1. Few small bug fix and unit tests have been introduced on 64 Bit platforms. + Many thanks to Gottfried Ganssauge! He also help me to discover and fix + some important bug in ``type_traits.__remove_alias`` function, by introducing + small example that reproduced the error. + +2. Huge speed improvement has been achieved (x10). Allen Bierbaum suggested to + save and reuse results of different :doc:`pygccxml <../pygccxml>` algorithms: + + * ``declarations.remove_alias`` + * ``declarations.full_name`` + * ``declarations.access_type`` + * ``declarations.demangled_name`` + * ``declarations.declaration_path`` + +3. Interface changes: + + * ``declarations.class_t``: + + + ``set_members`` method was removed + + + ``adopt_declaration`` method was introduced, instead of ``set_members`` + + * ``declarations.array_t`` class "set" accessor for size property was added. + + * ``declarations.namespace_t.adopt_declaration`` method was added. + + * ``declarations.variable_t.access_type`` property was added. + +4. New type traits have been added: + + * ``is_same_function`` + +5. Few bug were fixed. + +6. Documentation was improved. + +------------- +Version 0.8.1 +------------- + +1. :doc:`pygccxml <../pygccxml>` has been ported to MacOS X. Many thanks to Darren Garnier! + +2. New type traits have been added: + + * ``enum_traits`` + + * ``class_traits`` + + * ``class_declaration_traits`` + + * ``is_std_string`` + + * ``is_std_wstring`` + + * ``remove_declarated`` + + * ``has_public_less`` + + * ``has_public_equal`` + + * ``has_public_binary_operator`` + + * ``smart_pointer_traits`` + + * ``list_traits`` + + * ``deque_traits`` + + * ``queue_traits`` + + * ``priority_queue`` + + * ``vector_traits`` + + * ``stack_traits`` + + * ``map_traits`` + + * ``multimap_traits`` + + * ``hash_map_traits`` + + * ``hash_multimap_traits`` + + * ``set_traits`` + + * ``hash_set_traits`` + + * ``multiset_traits`` + + * ``hash_multiset_traits`` + +3. ``enumeration_t`` class interface was changed. Enumeration values are kept + in a list, instead of a dictionary. ``get_name2value_dict`` will build for + you dictionary, where key is an enumeration name, and value is an enumeration + value. + + This has been done in order to provide stable order of enumeration values. + +4. Now you can pass operator symbol, as a name to query functions: + + .. code-block:: python + + cls = global_namespace.class_( 'my_class' ) + op = cls.operator( '<' ) + #instead of + op = cls.operator( symbol='<' ) + +5. :doc:`pygccxml <../pygccxml>` improved a lot functionality related to providing feedback to user: + + * every package has its own logger + + * only important user messages are written to ``stdout`` + + * user messages are clear + +6. Support to Java native types has been added. + +7. It is possible to pass an arbitrary string as a parameter to `GCC-XML`_. + +8. Native java types has been added to fundamental types. + +9. Cache classes implementation was improved. + +10. Few bug were fixed. + +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: + + .. code-block:: python + + classes = ns.decls("class") + classes.decls("method") + + This will fail because it finds the attribute decls which is not a callable. + +----------- +Version 0.8 +----------- + +1. :doc:`pygccxml <../pygccxml>` now has power "select" interface. Read more about this cool feature + in tutorials. + +2. Improved support for template instantiations. :doc:`pygccxml <../pygccxml>` now take into + account demangled name of declarations. Please refer to documentation for + more explanantion. + +3. ``dummy_type_t`` - new type in types hierarchy. This is a very useful class + for code generation projects. + +4. New function - ``get_global_namespace``. As you can guess, it will find and + return reference to global namespace. + +5. New functionality in ``type_traits`` - ``has_public_assign``. This function + will return True, if class has public assign operator. + +6. ``declarations.class_t`` has new property - ``aliases``. This is a list of + all class aliases. + +7. Bug fixes. + +8. Documentation has been updated/written/improved. + +------------- +Version 0.7.1 +------------- + +**Attention - this going to be last version that is tested with Python 2.3** + +1. New fundamental types has been added + + * complex float + + * complex double + + * complex long double + +2. **Attention - non backward compatible change** + + ``declarations.filtering.user_defined`` and ``declarations.filtering.by_location`` + implementation has been changed. In previous version of those functions, + ``decls`` list has been changed in place. This was wrong behavior. Now, + those functions will return new list, which contains all desired declarations. + +3. Few new type traits has been added + + * *type_traits.has_destructor* + + * *type_traits.has_public_destructor* + + * *type_traits.has_public_constructor* + + * *type_traits.is_noncopyable* + +4. ``decl_printer_t`` class and ``print_declarations`` function have been added. + Now you can print in a nice way your declaration tree or part of it. + Thanks to Allen Bierbaum! + +5. New class ``declarations.decl_factory_t`` has been added. This is a default + factory for all declarations. From now all relevant parser classes takes as + input instance of this class or ``Null``. In case of ``Null`` instance of + ``declarations.decl_factory_t`` will be created. Using this class you can + easily extend functionality provided by built-in declarations. + +6. Sometimes, there is a need to find a declaration that match some criteria. + The was such functionality in :doc:`pygccxml <../pygccxml>`, but it was too limited. This + release fix the situation. :doc:`pygccxml <../pygccxml>` adds a set of classes that will help + you to deal with this problem. + +7. New cache - ``parser.directory_cache_t`` has been implemented. + ``parser.directory_cache_t`` uses individual files stored in a dedicated + cache directory to store the cached contents. + Thanks to Matthias Baas! + +8. ``parser.file_cache_t`` has been improved a lot. + Thanks to Allen Bierbaum! + +9. New file configuration is available: "cached source file". + ``parser.project_reader_t`` class will check for existence of `GCC-XML`_ + generated file. If it does not exist it will create one. If it do exist, + then the parser will use that file. + +10. Few helper functions has been added in order to make construction of + configuration file to be as easy as possible: + + * ``parser.create_text_fc`` - creates file configuration, that contains text + * ``parser.create_source_fc`` - creates file configuration, that contains + reference to regular source file + * ``parser.create_gccxml_fc`` ... [truncated message content] |
From: <rom...@us...> - 2009-05-11 07:44:56
|
Revision: 1713 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1713&view=rev Author: roman_yakovenko Date: 2009-05-11 07:44:51 +0000 (Mon, 11 May 2009) Log Message: ----------- update docs Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/matchers.py pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py pyplusplus_dev/pyplusplus/module_builder/ctypes_builder.py pyplusplus_dev/unittests/ctypes_tester.py pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py pyplusplus_dev/unittests/test_all.py pyplusplus_dev/unittests/virtual_inheritance_tester.py Modified: pygccxml_dev/pygccxml/declarations/matchers.py =================================================================== --- pygccxml_dev/pygccxml/declarations/matchers.py 2009-05-11 07:27:29 UTC (rev 1712) +++ pygccxml_dev/pygccxml/declarations/matchers.py 2009-05-11 07:44:51 UTC (rev 1713) @@ -1,542 +1,545 @@ -# Copyright 2004-2008 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) - -""" -defines all "built-in" classes that implement declarations compare functionality -according to some criteria -""" - -import os -import re -import types -import algorithm -import variable -import namespace -import calldef -import cpptypes -import templates -import class_declaration -from pygccxml import utils - -class matcher_base_t(object): - """matcher_base_t class defines interface for classes that will implement - compare functionality according to some criteria. - """ - def __init__( self ): - object.__init__( self ) - - def __call__(self, decl): - raise NotImplementedError( "matcher must always implement the __call__() method." ) - - def __invert__(self): - """not-operator (~)""" - return not_matcher_t(self) - - def __and__(self, other): - """and-operator (&)""" - return and_matcher_t([self, other]) - - def __or__(self, other): - """or-operator (|)""" - return or_matcher_t([self, other]) - - def __str__( self ): - return "base class for all matchers" - -class and_matcher_t(matcher_base_t): - """ - Combine several other matchers with "&" (and) operator. - - For example: find all private functions with name XXX - - .. code-block:: python - - matcher = access_type_matcher_t( 'private' ) & calldef_matcher_t( name='XXX' ) - """ - def __init__(self, matchers): - matcher_base_t.__init__(self) - self.matchers = matchers - - def __call__(self, decl): - for matcher in self.matchers: - if not matcher(decl): - return False - return True - - def __str__(self): - return " & ".join( map( lambda x: "(%s)" % str( x ), self.matchers ) ) - - -class or_matcher_t(matcher_base_t): - """Combine several other matchers with "|" (or) operator. - - For example: find all functions and variables with name 'XXX' - - .. code-block:: python - - matcher = variable_matcher_t( name='XXX' ) | calldef_matcher_t( name='XXX' ) - - """ - def __init__(self, matchers): - matcher_base_t.__init__(self) - self.matchers = matchers - - def __call__(self, decl): - for matcher in self.matchers: - if matcher(decl): - return True - return False - - def __str__(self): - return " | ".join( map( lambda x: "(%s)" % str( x ), self.matchers ) ) - - -class not_matcher_t(matcher_base_t): - """ - return the inverse result of a matcher - - For example: find all public and protected declarations - - .. code-block:: python - - matcher = ~access_type_matcher_t( 'private' ) - """ - def __init__(self, matcher): - matcher_base_t.__init__(self) - self.matcher = matcher - - def __call__(self, decl): - return not self.matcher(decl) - - def __str__(self): - return "~(%s)"%str(self.matcher) - -class declaration_matcher_t( matcher_base_t ): - """ - Instance of this class will match declarations by next criteria: - - declaration name, also could be fully qualified name - Example: `wstring` or `::std::wstring` - - declaration type - Example: :class:`class_t`, :class:`namespace_t`, :class:`enumeration_t` - - location within file system ( file or directory ) - """ - def __init__( self, name=None, decl_type=None, header_dir=None, header_file=None ): - """ - :param decl_type: declaration type to match by. For example :class:`enumeration_t`. - :type decl_type: any class that derives from :class:`declaration_t` class - - :param name: declaration name, could be full name. - :type name: str - - :param header_dir: absolute directory path - :type header_dir: str - - :param header_file: absolute file path - :type header_file: str - - """ - #An other option is that pygccxml will create absolute path using - #os.path.abspath function. But I think this is just wrong, because abspath - #builds path using current working directory. This behavior is fragile - #and very difficult to find a bug. - matcher_base_t.__init__( self ) - self.decl_type = decl_type - self.__name = None - self.__opt_is_tmpl_inst = None - self.__opt_tmpl_name = None - self.__opt_is_full_name = None - self.__decl_name_only = None - - self._set_name( name ) - - self.header_dir = header_dir - self.header_file = header_file - - if self.header_dir: - self.header_dir = utils.normalize_path( self.header_dir ) - if not os.path.isabs( self.header_dir ): - raise RuntimeError( "Path to header directory should be absolute!" ) - - if self.header_file: - self.header_file = utils.normalize_path( self.header_file ) - if not os.path.isabs( self.header_file ): - raise RuntimeError( "Path to header file should be absolute!" ) - - def _get_name(self): - return self.__name - - def _set_name( self, name ): - self.__name = name - if not self.__name: - self.__opt_is_tmpl_inst = None - self.__opt_tmpl_name = None - self.__opt_is_full_name = None - self.__decl_name_only = None - else: - self.__opt_is_tmpl_inst = templates.is_instantiation( self.__name ) - self.__opt_tmpl_name = templates.name( self.__name ) - if self.__opt_is_tmpl_inst: - if '::' in self.__opt_tmpl_name: - self.__opt_is_full_name = True - self.__decl_name_only = self.__opt_tmpl_name.split('::')[-1] - else: - self.__opt_is_full_name = False - self.__decl_name_only = self.__opt_tmpl_name - self.__name = templates.normalize( name ) - else: - if '::' in self.__name: - self.__opt_is_full_name = True - self.__decl_name_only = self.__name.split('::')[-1] - else: - self.__opt_is_full_name = False - self.__decl_name_only = self.__name - - - name = property( _get_name, _set_name ) - - def __str__( self ): - msg = [] - if not None is self.decl_type: - msg.append( '(decl type==%s)' % self.decl_type.__name__ ) - if not None is self.name: - msg.append( '(name==%s)' % self.name ) - if not None is self.header_dir: - msg.append( '(header dir==%s)' % self.header_dir ) - if not None is self.header_file: - msg.append( '(header file==%s)' % self.header_file ) - if not msg: - msg.append( 'any' ) - return ' and '.join( msg ) - - def __call__( self, decl ): - if not None is self.decl_type: - if not isinstance( decl, self.decl_type ): - return False - if not None is self.name: - if not self.check_name( decl ): - return False - if not None is self.header_dir: - if decl.location: - decl_dir = os.path.abspath( os.path.dirname( decl.location.file_name ) ) - decl_dir = utils.normalize_path( decl_dir ) - if decl_dir[:len(self.header_dir)] != self.header_dir: - return False - else: - return False - if not None is self.header_file: - if decl.location: - decl_file = os.path.abspath( decl.location.file_name ) - decl_file = utils.normalize_path( decl_file ) - if decl_file != self.header_file: - return False - else: - return False - return True - - def check_name( self, decl ): - assert not None is self.name - if self.__opt_is_tmpl_inst: - if not self.__opt_is_full_name: - if self.name != templates.normalize( decl.name ) \ - and self.name != templates.normalize( decl.partial_name ): - return False - else: - if self.name != templates.normalize( algorithm.full_name( decl, with_defaults=True ) ) \ - and self.name != templates.normalize( algorithm.full_name( decl, with_defaults=False ) ): - return False - else: - if not self.__opt_is_full_name: - if self.name != decl.name and self.name != decl.partial_name: - return False - else: - if self.name != algorithm.full_name( decl, with_defaults=True ) \ - and self.name != algorithm.full_name( decl, with_defaults=False ): - return False - return True - - def is_full_name(self): - return self.__opt_is_full_name - - def _get_decl_name_only(self): - return self.__decl_name_only - decl_name_only = property( _get_decl_name_only ) - -class variable_matcher_t( declaration_matcher_t ): - """ - Instance of this class will match variables by next criteria: - - :class:`declaration_matcher_t` criteria - - variable type. Example: :class:`int_t` or 'int' - """ - def __init__( self, name=None, type=None, header_dir=None, header_file=None ): - """ - :param type: variable type - :type type: string or instance of :class:`type_t` derived class - """ - declaration_matcher_t.__init__( self - , name=name - , decl_type=variable.variable_t - , header_dir=header_dir - , header_file=header_file ) - self.type = type - - def __call__( self, decl ): - if not super( variable_matcher_t, self ).__call__( decl ): - return False - if not None is self.type: - if isinstance( self.type, cpptypes.type_t ): - if self.type != decl.type: - return False - else: - if self.type != decl.type.decl_string: - return False - return True - - def __str__( self ): - msg = [ super( variable_matcher_t, self ).__str__() ] - if msg == [ 'any' ]: - msg = [] - if not None is self.type: - msg.append( '(value type==%s)' % str(self.type) ) - if not msg: - msg.append( 'any' ) - return ' and '.join( msg ) - - -class namespace_matcher_t( declaration_matcher_t ): - """Instance of this class will match namespaces by name.""" - - def __init__( self, name=None ): - declaration_matcher_t.__init__( self, name=name, decl_type=namespace.namespace_t) - - def __call__( self, decl ): - if self.name and decl.name == '': - #unnamed namespace have same name as thier parent, we should prevent - #this happens. The price is: user should search for unnamed namespace - #directly. - return False - return super( namespace_matcher_t, self ).__call__( decl ) - - -class calldef_matcher_t( declaration_matcher_t ): - """ - Instance of this class will match callable by the following criteria: - * :class:`declaration_matcher_t` criteria - * return type. For example: :class:`int_t` or 'int' - * argument types - """ - - def __init__( self, name=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): - """ - :param return_type: callable return type - :type return_type: string or instance of :class:`type_t` derived class - - :param arg_types: list of function argument types. `arg_types` can contain. - Any item within the list could be string or instance of :class:`type_t` derived - class. If you don't want some argument to participate in match you can - put None. For example: - - .. code-block:: python - - calldef_matcher_t( arg_types=[ 'int &', None ] ) - - will match all functions that takes 2 arguments, where the first one is - reference to integer and second any - - :type arg_types: list - """ - if None is decl_type: - decl_type = calldef.calldef_t - declaration_matcher_t.__init__( self - , name=name - , decl_type=decl_type - , header_dir=header_dir - , header_file=header_file ) - - self.return_type = return_type - self.arg_types = arg_types - - def __call__( self, decl ): - if not super( calldef_matcher_t, self ).__call__( decl ): - return False - if not None is self.return_type \ - and not self.__compare_types( self.return_type, decl.return_type ): - return False - if self.arg_types: - if isinstance( self.arg_types, (types.ListType, types.TupleType)): - if len(self.arg_types) != len( decl.arguments ): - return False - for type_or_str, arg in zip( self.arg_types, decl.arguments ): - if None == type_or_str: - continue - else: - if not self.__compare_types( type_or_str, arg.type ): - return False - return True - - def __compare_types( self, type_or_str, type ): - assert type_or_str - if type is None: - return False - if isinstance( type_or_str, cpptypes.type_t ): - if type_or_str != type: - return False - else: - if type_or_str != type.decl_string: - return False - return True - - def __str__( self ): - msg = [ super( calldef_matcher_t, self ).__str__() ] - if msg == [ 'any' ]: - msg = [] - if not None is self.return_type: - msg.append( '(return type==%s)' % str(self.return_type) ) - if self.arg_types: - for i in range( len( self.arg_types ) ): - if self.arg_types[i] is None: - msg.append( '(arg %d type==any)' % i ) - else: - msg.append( '(arg %d type==%s)' % ( i, str( self.arg_types[i] ) ) ) - if not msg: - msg.append( 'any' ) - return ' and '.join( msg ) - - -class operator_matcher_t( calldef_matcher_t ): - """ - Instance of this class will match operators by next criteria: - * :class:`calldef_matcher_t` criteria - * operator symbol: =, !=, (), [] and etc - """ - def __init__( self, name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): - """ - :param symbol: operator symbol - :type symbol: str - """ - if None is decl_type: - decl_type = calldef.operator_t - calldef_matcher_t.__init__( self - , name=name - , return_type=return_type - , arg_types=arg_types - , decl_type=decl_type - , header_dir=header_dir - , header_file=header_file) - self.symbol = symbol - - def __call__( self, decl ): - if not super( operator_matcher_t, self ).__call__( decl ): - return False - if not None is self.symbol: - if self.symbol != decl.symbol: - return False - return True - - def __str__( self ): - msg = [ super( operator_matcher_t, self ).__str__() ] - if msg == [ 'any' ]: - msg = [] - if not None is self.symbol: - msg.append( '(symbol==%s)' % str(self.symbol) ) - if not msg: - msg.append( 'any' ) - return ' and '.join( msg ) - -class regex_matcher_t( matcher_base_t ): - """ - Instance of this class will match declaration using regular expression. - User should supply a function that will extract from declaration desired - information as string. Later, this matcher will match that string using - user regular expression. - """ - def __init__( self, regex, function=None ): - """ - :param regex: regular expression - :type regex: string, an instance of this class will compile it for you - - :param function: function that will be called to get an information from - declaration as string. As input this function takes 1 argument: reference - to declaration. Return value should be string. If function is None, then - the matcher will use declaration name. - - """ - matcher_base_t.__init__(self) - self.regex = re.compile( regex ) - self.function = function - if None is self.function: - self.function = lambda decl: decl.name - - def __call__( self, decl ): - text = self.function( decl ) - return bool( self.regex.match( text ) ) - - def __str__( self ): - return '(regex=%s)' % self.regex - -class access_type_matcher_t( matcher_base_t ): - """ - Instance of this class will match declaration by its access type: public, - private or protected. If declarations does not have access type, for example - free function, then `False` will be returned. - """ - - def __init__( self, access_type ): - """ - :param access_type: declaration access type, could be "public", "private", "protected" - :type access_type: :class: `str` - """ - matcher_base_t.__init__( self ) - self.access_type = access_type - - def __call__( self, decl ): - if not isinstance( decl.parent, class_declaration.class_t ): - return False - return self.access_type == decl.parent.find_out_member_access_type( decl ) - - def __str__( self ): - return '(access type=%s)' % self.access_type - -class virtuality_type_matcher_t( matcher_base_t ): - """ - Instance of this class will match declaration by its virtual type: not virtual, - virtual or pure virtual. If declarations does not have "virtual" property, - for example free function, then `False` will be returned. - """ - - def __init__( self, virtuality_type ): - """ - :param access_type: declaration access type - :type access_type: :class:VIRTUALITY_TYPES defines few constants for your convenience. - """ - matcher_base_t.__init__( self ) - self.virtuality_type = virtuality_type - - def __call__( self, decl ): - if not isinstance( decl.parent, class_declaration.class_t ): - return False - return self.virtuality_type == decl.virtuality - - def __str__( self ): - return '(virtuality type=%s)' % self.virtuality_type - - -class custom_matcher_t( matcher_base_t ): - """ - Instance of this class will match declaration by user custom criteria. - """ - - def __init__( self, function ): - """ - :param function: callable, that takes single argument - declaration instance - should return True or False - """ - matcher_base_t.__init__( self ) - self.function = function - - def __call__( self, decl ): - return bool( self.function( decl ) ) - - def __str__( self ): - return '(user criteria)' +# Copyright 2004-2008 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) + +""" +defines all "built-in" classes that implement declarations compare functionality +according to some criteria +""" + +import os +import re +import types +import algorithm +import variable +import namespace +import calldef +import cpptypes +import templates +import class_declaration +from pygccxml import utils + +class matcher_base_t(object): + """matcher_base_t class defines interface for classes that will implement + compare functionality according to some criteria. + """ + def __init__( self ): + object.__init__( self ) + + def __call__(self, decl): + raise NotImplementedError( "matcher must always implement the __call__() method." ) + + def __invert__(self): + """not-operator (~)""" + return not_matcher_t(self) + + def __and__(self, other): + """and-operator (&)""" + return and_matcher_t([self, other]) + + def __or__(self, other): + """or-operator (|)""" + return or_matcher_t([self, other]) + + def __str__( self ): + return "base class for all matchers" + +class and_matcher_t(matcher_base_t): + """ + Combine several other matchers with "&" (and) operator. + + For example: find all private functions with name XXX + + .. code-block:: python + + matcher = access_type_matcher_t( 'private' ) & calldef_matcher_t( name='XXX' ) + """ + def __init__(self, matchers): + matcher_base_t.__init__(self) + self.matchers = matchers + + def __call__(self, decl): + for matcher in self.matchers: + if not matcher(decl): + return False + return True + + def __str__(self): + return " & ".join( map( lambda x: "(%s)" % str( x ), self.matchers ) ) + + +class or_matcher_t(matcher_base_t): + """Combine several other matchers with "|" (or) operator. + + For example: find all functions and variables with name 'XXX' + + .. code-block:: python + + matcher = variable_matcher_t( name='XXX' ) | calldef_matcher_t( name='XXX' ) + + """ + def __init__(self, matchers): + matcher_base_t.__init__(self) + self.matchers = matchers + + def __call__(self, decl): + for matcher in self.matchers: + if matcher(decl): + return True + return False + + def __str__(self): + return " | ".join( map( lambda x: "(%s)" % str( x ), self.matchers ) ) + + +class not_matcher_t(matcher_base_t): + """ + return the inverse result of a matcher + + For example: find all public and protected declarations + + .. code-block:: python + + matcher = ~access_type_matcher_t( 'private' ) + """ + def __init__(self, matcher): + matcher_base_t.__init__(self) + self.matcher = matcher + + def __call__(self, decl): + return not self.matcher(decl) + + def __str__(self): + return "~(%s)"%str(self.matcher) + +class declaration_matcher_t( matcher_base_t ): + """ + Instance of this class will match declarations by next criteria: + - declaration name, also could be fully qualified name + Example: `wstring` or `::std::wstring` + - declaration type + Example: :class:`class_t`, :class:`namespace_t`, :class:`enumeration_t` + - location within file system ( file or directory ) + """ + def __init__( self, name=None, decl_type=None, header_dir=None, header_file=None ): + """ + :param decl_type: declaration type to match by. For example :class:`enumeration_t`. + :type decl_type: any class that derives from :class:`declaration_t` class + + :param name: declaration name, could be full name. + :type name: str + + :param header_dir: absolute directory path + :type header_dir: str + + :param header_file: absolute file path + :type header_file: str + + """ + #An other option is that pygccxml will create absolute path using + #os.path.abspath function. But I think this is just wrong, because abspath + #builds path using current working directory. This behavior is fragile + #and very difficult to find a bug. + matcher_base_t.__init__( self ) + self.decl_type = decl_type + self.__name = None + self.__opt_is_tmpl_inst = None + self.__opt_tmpl_name = None + self.__opt_is_full_name = None + self.__decl_name_only = None + + self._set_name( name ) + + self.header_dir = header_dir + self.header_file = header_file + + if self.header_dir: + self.header_dir = utils.normalize_path( self.header_dir ) + if not os.path.isabs( self.header_dir ): + raise RuntimeError( "Path to header directory should be absolute!" ) + + if self.header_file: + self.header_file = utils.normalize_path( self.header_file ) + if not os.path.isabs( self.header_file ): + raise RuntimeError( "Path to header file should be absolute!" ) + + def _get_name(self): + return self.__name + + def _set_name( self, name ): + self.__name = name + if not self.__name: + self.__opt_is_tmpl_inst = None + self.__opt_tmpl_name = None + self.__opt_is_full_name = None + self.__decl_name_only = None + else: + self.__opt_is_tmpl_inst = templates.is_instantiation( self.__name ) + self.__opt_tmpl_name = templates.name( self.__name ) + if self.__opt_is_tmpl_inst: + if '::' in self.__opt_tmpl_name: + self.__opt_is_full_name = True + self.__decl_name_only = self.__opt_tmpl_name.split('::')[-1] + else: + self.__opt_is_full_name = False + self.__decl_name_only = self.__opt_tmpl_name + self.__name = templates.normalize( name ) + else: + if '::' in self.__name: + self.__opt_is_full_name = True + self.__decl_name_only = self.__name.split('::')[-1] + else: + self.__opt_is_full_name = False + self.__decl_name_only = self.__name + + + name = property( _get_name, _set_name ) + + def __str__( self ): + msg = [] + if not None is self.decl_type: + msg.append( '(decl type==%s)' % self.decl_type.__name__ ) + if not None is self.name: + msg.append( '(name==%s)' % self.name ) + if not None is self.header_dir: + msg.append( '(header dir==%s)' % self.header_dir ) + if not None is self.header_file: + msg.append( '(header file==%s)' % self.header_file ) + if not msg: + msg.append( 'any' ) + return ' and '.join( msg ) + + def __call__( self, decl ): + if not None is self.decl_type: + if not isinstance( decl, self.decl_type ): + return False + if not None is self.name: + if not self.check_name( decl ): + return False + if not None is self.header_dir: + if decl.location: + decl_dir = os.path.abspath( os.path.dirname( decl.location.file_name ) ) + decl_dir = utils.normalize_path( decl_dir ) + if decl_dir[:len(self.header_dir)] != self.header_dir: + return False + else: + return False + if not None is self.header_file: + if decl.location: + decl_file = os.path.abspath( decl.location.file_name ) + decl_file = utils.normalize_path( decl_file ) + if decl_file != self.header_file: + return False + else: + return False + return True + + def check_name( self, decl ): + assert not None is self.name + if self.__opt_is_tmpl_inst: + if not self.__opt_is_full_name: + if self.name != templates.normalize( decl.name ) \ + and self.name != templates.normalize( decl.partial_name ): + return False + else: + if self.name != templates.normalize( algorithm.full_name( decl, with_defaults=True ) ) \ + and self.name != templates.normalize( algorithm.full_name( decl, with_defaults=False ) ): + return False + else: + if not self.__opt_is_full_name: + if self.name != decl.name and self.name != decl.partial_name: + return False + else: + if self.name != algorithm.full_name( decl, with_defaults=True ) \ + and self.name != algorithm.full_name( decl, with_defaults=False ): + return False + return True + + def is_full_name(self): + return self.__opt_is_full_name + + def _get_decl_name_only(self): + return self.__decl_name_only + decl_name_only = property( _get_decl_name_only ) + +class variable_matcher_t( declaration_matcher_t ): + """ + Instance of this class will match variables by next criteria: + - :class:`declaration_matcher_t` criteria + - variable type. Example: :class:`int_t` or 'int' + """ + def __init__( self, name=None, type=None, header_dir=None, header_file=None ): + """ + :param type: variable type + :type type: string or instance of :class:`type_t` derived class + """ + declaration_matcher_t.__init__( self + , name=name + , decl_type=variable.variable_t + , header_dir=header_dir + , header_file=header_file ) + self.type = type + + def __call__( self, decl ): + if not super( variable_matcher_t, self ).__call__( decl ): + return False + if not None is self.type: + if isinstance( self.type, cpptypes.type_t ): + if self.type != decl.type: + return False + else: + if self.type != decl.type.decl_string: + return False + return True + + def __str__( self ): + msg = [ super( variable_matcher_t, self ).__str__() ] + if msg == [ 'any' ]: + msg = [] + if not None is self.type: + msg.append( '(value type==%s)' % str(self.type) ) + if not msg: + msg.append( 'any' ) + return ' and '.join( msg ) + + +class namespace_matcher_t( declaration_matcher_t ): + """Instance of this class will match namespaces by name.""" + + def __init__( self, name=None ): + declaration_matcher_t.__init__( self, name=name, decl_type=namespace.namespace_t) + + def __call__( self, decl ): + if self.name and decl.name == '': + #unnamed namespace have same name as thier parent, we should prevent + #this happens. The price is: user should search for unnamed namespace + #directly. + return False + return super( namespace_matcher_t, self ).__call__( decl ) + + +class calldef_matcher_t( declaration_matcher_t ): + """ + Instance of this class will match callable by the following criteria: + * :class:`declaration_matcher_t` criteria + * return type. For example: :class:`int_t` or 'int' + * argument types + + """ + + def __init__( self, name=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): + """ + :param return_type: callable return type + :type return_type: string or instance of :class:`type_t` derived class + + :type arg_types: list + :param arg_types: list of function argument types. `arg_types` can contain. + Any item within the list could be string or instance + of :class:`type_t` derived class. If you don't want + some argument to participate in match you can put None. + + For example: + + .. code-block:: python + + calldef_matcher_t( arg_types=[ 'int &', None ] ) + + will match all functions that takes 2 arguments, where the first one is + reference to integer and second any + """ + if None is decl_type: + decl_type = calldef.calldef_t + declaration_matcher_t.__init__( self + , name=name + , decl_type=decl_type + , header_dir=header_dir + , header_file=header_file ) + + self.return_type = return_type + self.arg_types = arg_types + + def __call__( self, decl ): + if not super( calldef_matcher_t, self ).__call__( decl ): + return False + if not None is self.return_type \ + and not self.__compare_types( self.return_type, decl.return_type ): + return False + if self.arg_types: + if isinstance( self.arg_types, (types.ListType, types.TupleType)): + if len(self.arg_types) != len( decl.arguments ): + return False + for type_or_str, arg in zip( self.arg_types, decl.arguments ): + if None == type_or_str: + continue + else: + if not self.__compare_types( type_or_str, arg.type ): + return False + return True + + def __compare_types( self, type_or_str, type ): + assert type_or_str + if type is None: + return False + if isinstance( type_or_str, cpptypes.type_t ): + if type_or_str != type: + return False + else: + if type_or_str != type.decl_string: + return False + return True + + def __str__( self ): + msg = [ super( calldef_matcher_t, self ).__str__() ] + if msg == [ 'any' ]: + msg = [] + if not None is self.return_type: + msg.append( '(return type==%s)' % str(self.return_type) ) + if self.arg_types: + for i in range( len( self.arg_types ) ): + if self.arg_types[i] is None: + msg.append( '(arg %d type==any)' % i ) + else: + msg.append( '(arg %d type==%s)' % ( i, str( self.arg_types[i] ) ) ) + if not msg: + msg.append( 'any' ) + return ' and '.join( msg ) + + +class operator_matcher_t( calldef_matcher_t ): + """ + Instance of this class will match operators by next criteria: + * :class:`calldef_matcher_t` criteria + * operator symbol: =, !=, (), [] and etc + """ + def __init__( self, name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): + """ + :param symbol: operator symbol + :type symbol: str + """ + if None is decl_type: + decl_type = calldef.operator_t + calldef_matcher_t.__init__( self + , name=name + , return_type=return_type + , arg_types=arg_types + , decl_type=decl_type + , header_dir=header_dir + , header_file=header_file) + self.symbol = symbol + + def __call__( self, decl ): + if not super( operator_matcher_t, self ).__call__( decl ): + return False + if not None is self.symbol: + if self.symbol != decl.symbol: + return False + return True + + def __str__( self ): + msg = [ super( operator_matcher_t, self ).__str__() ] + if msg == [ 'any' ]: + msg = [] + if not None is self.symbol: + msg.append( '(symbol==%s)' % str(self.symbol) ) + if not msg: + msg.append( 'any' ) + return ' and '.join( msg ) + +class regex_matcher_t( matcher_base_t ): + """ + Instance of this class will match declaration using regular expression. + User should supply a function that will extract from declaration desired + information as string. Later, this matcher will match that string using + user regular expression. + """ + def __init__( self, regex, function=None ): + """ + :param regex: regular expression + :type regex: string, an instance of this class will compile it for you + + :param function: function that will be called to get an information from + declaration as string. As input this function takes single + argument - reference to a declaration. Return value + should be string. If function is None, then the matcher + will use declaration name. + + """ + matcher_base_t.__init__(self) + self.regex = re.compile( regex ) + self.function = function + if None is self.function: + self.function = lambda decl: decl.name + + def __call__( self, decl ): + text = self.function( decl ) + return bool( self.regex.match( text ) ) + + def __str__( self ): + return '(regex=%s)' % self.regex + +class access_type_matcher_t( matcher_base_t ): + """ + Instance of this class will match declaration by its access type: public, + private or protected. If declarations does not have access type, for example + free function, then `False` will be returned. + """ + + def __init__( self, access_type ): + """ + :param access_type: declaration access type, could be "public", "private", "protected" + :type access_type: :class: `str` + """ + matcher_base_t.__init__( self ) + self.access_type = access_type + + def __call__( self, decl ): + if not isinstance( decl.parent, class_declaration.class_t ): + return False + return self.access_type == decl.parent.find_out_member_access_type( decl ) + + def __str__( self ): + return '(access type=%s)' % self.access_type + +class virtuality_type_matcher_t( matcher_base_t ): + """ + Instance of this class will match declaration by its virtual type: not virtual, + virtual or pure virtual. If declarations does not have "virtual" property, + for example free function, then `False` will be returned. + """ + + def __init__( self, virtuality_type ): + """ + :param access_type: declaration access type + :type access_type: :class:VIRTUALITY_TYPES defines few constants for your convenience. + """ + matcher_base_t.__init__( self ) + self.virtuality_type = virtuality_type + + def __call__( self, decl ): + if not isinstance( decl.parent, class_declaration.class_t ): + return False + return self.virtuality_type == decl.virtuality + + def __str__( self ): + return '(virtuality type=%s)' % self.virtuality_type + + +class custom_matcher_t( matcher_base_t ): + """ + Instance of this class will match declaration by user custom criteria. + """ + + def __init__( self, function ): + """ + :param function: callable, that takes single argument - declaration instance + should return True or False + """ + matcher_base_t.__init__( self ) + self.function = function + + def __call__( self, decl ): + return bool( self.function( decl ) ) + + def __str__( self ): + return '(user criteria)' Modified: pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py =================================================================== --- pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py 2009-05-11 07:27:29 UTC (rev 1712) +++ pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py 2009-05-11 07:44:51 UTC (rev 1713) @@ -1,73 +1,73 @@ -# Copyright 2006 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) - -"""defines :class:function_transformation_t class""" - -import md5 -import controllers -from pygccxml import declarations -from pyplusplus import code_repository - -class function_transformation_t: - """the class holds function transformation definition - all transformations that should be applied""" - def __init__(self, function, transformer_creator, **keywd): - self.__function = function - self.__controller = None - if isinstance( function.parent, declarations.class_t ): - if declarations.VIRTUALITY_TYPES.NOT_VIRTUAL == function.virtuality: - self.__controller = controllers.mem_fun_controller_t( function ) - elif declarations.VIRTUALITY_TYPES.PURE_VIRTUAL == function.virtuality: - self.__controller = controllers.pure_virtual_mem_fun_controller_t( function ) - else: - self.__controller = controllers.virtual_mem_fun_controller_t( function ) - else: - self.__controller = controllers.free_fun_controller_t( function ) - self.__transformers = map( lambda tr_creator: tr_creator( function ), transformer_creator ) - self.__thread_safe = keywd.get( 'thread_safe', False ) - self.__controller.apply( self.__transformers ) - self.__unique_name = None - self.__alias = keywd.get( 'alias', None ) - - @property - def unique_name( self ): - if None is self.__unique_name: - obj = md5.new() - if self.__function.mangled: # free functions don't have a mangled value - obj.update( self.__function.mangled ) - else: - obj.update( self.__function.decl_string ) - obj.update( self.__function.location.file_name ) - obj.update( str( self.__function.location.line ) ) - self.__unique_name = self.__function.name + '_' + obj.hexdigest () - return self.__unique_name - - @property - def alias( self ): - if None is self.__alias: - if self.__function.overloads: - self.__alias = self.unique_name - else: - self.__alias = self.__function.alias - return self.__alias - - @property - def transformers( self ): - return self.__transformers - - @property - def controller( self ): - return self.__controller - - def required_headers( self ): - headers = [] - map( lambda transformer: headers.extend( transformer.required_headers() ) - , self.transformers ) - if self.__function.call_policies: - headers.append( code_repository.call_policies.file_name ) - return headers - - @property - def thread_safe( self ): - return self.__thread_safe +# Copyright 2006 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) + +"""defines :class:function_transformation_t class""" + +import hashlib +import controllers +from pygccxml import declarations +from pyplusplus import code_repository + +class function_transformation_t: + """the class holds function transformation definition - all transformations that should be applied""" + def __init__(self, function, transformer_creator, **keywd): + self.__function = function + self.__controller = None + if isinstance( function.parent, declarations.class_t ): + if declarations.VIRTUALITY_TYPES.NOT_VIRTUAL == function.virtuality: + self.__controller = controllers.mem_fun_controller_t( function ) + elif declarations.VIRTUALITY_TYPES.PURE_VIRTUAL == function.virtuality: + self.__controller = controllers.pure_virtual_mem_fun_controller_t( function ) + else: + self.__controller = controllers.virtual_mem_fun_controller_t( function ) + else: + self.__controller = controllers.free_fun_controller_t( function ) + self.__transformers = map( lambda tr_creator: tr_creator( function ), transformer_creator ) + self.__thread_safe = keywd.get( 'thread_safe', False ) + self.__controller.apply( self.__transformers ) + self.__unique_name = None + self.__alias = keywd.get( 'alias', None ) + + @property + def unique_name( self ): + if None is self.__unique_name: + obj = hashlib.md5() + if self.__function.mangled: # free functions don't have a mangled value + obj.update( self.__function.mangled ) + else: + obj.update( self.__function.decl_string ) + obj.update( self.__function.location.file_name ) + obj.update( str( self.__function.location.line ) ) + self.__unique_name = self.__function.name + '_' + obj.hexdigest () + return self.__unique_name + + @property + def alias( self ): + if None is self.__alias: + if self.__function.overloads: + self.__alias = self.unique_name + else: + self.__alias = self.__function.alias + return self.__alias + + @property + def transformers( self ): + return self.__transformers + + @property + def controller( self ): + return self.__controller + + def required_headers( self ): + headers = [] + map( lambda transformer: headers.extend( transformer.required_headers() ) + , self.transformers ) + if self.__function.call_policies: + headers.append( code_repository.call_policies.file_name ) + return headers + + @property + def thread_safe( self ): + return self.__thread_safe Modified: pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py =================================================================== --- pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py 2009-05-11 07:27:29 UTC (rev 1712) +++ pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py 2009-05-11 07:44:51 UTC (rev 1713) @@ -1,424 +1,427 @@ -# Copyright 2004-2008 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) - -import os -import sys -import time -import types -import warnings -import module_builder - -from pygccxml import parser -from pygccxml import utils as pygccxml_utils -from pygccxml import declarations as decls_package - -from pyplusplus import utils -from pyplusplus import _logging_ -from pyplusplus import decl_wrappers -from pyplusplus import file_writers -from pyplusplus import code_creators -from pyplusplus import creators_factory - -class builder_t(module_builder.module_builder_t): - """ - This class provides users with simple and intuitive interface to `Py++` - and/or pygccxml functionality. If this is your first attempt to use `Py++` - consider to read tutorials. You can find them on `web site <http://www.language-binding.net>`_. - """ - - def __init__( self - , files - , gccxml_path='' - , working_directory='.' - , include_paths=None - , define_symbols=None - , undefine_symbols=None - , start_with_declarations=None - , compilation_mode=None - , cache=None - , optimize_queries=True - , ignore_gccxml_output=False - , indexing_suite_version=1 - , cflags="" - , encoding='ascii' - , compiler=None - , gccxml_config=None): - """ - :param files: list of files, declarations from them you want to export - :type files: list of strings or :class:`parser.file_configuration_t` instances - - :param gccxml_path: path to gccxml binary. If you don't pass this argument, - pygccxml parser will try to locate it using you environment PATH variable - :type gccxml_path: str - - :param include_paths: additional header files location. You don't have to - specify system and standard directories. - :type include_paths: list of strings - - :param define_symbols: list of symbols to be defined for preprocessor. - :param define_symbols: list of strings - - :param undefine_symbols: list of symbols to be undefined for preprocessor. - :param undefine_symbols: list of strings - - :param cflags: Raw string to be added to gccxml command line. - - :param gccxml_config: instance of pygccxml.parser.config_t class, holds - gccxml( compiler ) configuration. You can use this argument instead of - passing the compiler configuration separately. - """ - module_builder.module_builder_t.__init__( self, global_ns=None, encoding=encoding ) - - if not gccxml_config: - gccxml_config = parser.config_t( gccxml_path=gccxml_path - , working_directory=working_directory - , include_paths=include_paths - , define_symbols=define_symbols - , undefine_symbols=undefine_symbols - , start_with_declarations=start_with_declarations - , ignore_gccxml_output=ignore_gccxml_output - , cflags=cflags - , compiler=compiler) - - #may be in future I will add those directories to user_defined_directories to self.__code_creator. - self.__parsed_files = map( pygccxml_utils.normalize_path - , parser.project_reader_t.get_os_file_names( files ) ) - tmp = map( lambda file_: os.path.split( file_ )[0], self.__parsed_files ) - self.__parsed_dirs = filter( None, tmp ) - - self.global_ns = self.__parse_declarations( files - , gccxml_config - , compilation_mode - , cache - , indexing_suite_version) - self.global_ns.decls(recursive=True, allow_empty=True)._code_generator = decl_wrappers.CODE_GENERATOR_TYPES.CTYPES - - self.__code_creator = None - if optimize_queries: - self.run_query_optimizer() - - self.__declarations_code_head = [] - self.__declarations_code_tail = [] - - self.__registrations_code_head = [] - self.__registrations_code_tail = [] - - - - def register_module_dependency( self, other_module_generated_code_dir ): - """ - `already_exposed` solution is pretty good when you mix hand-written - modules with `Py++` generated. It doesn't work/scale for "true" - multi-module development. This is exactly the reason why `Py++` - offers "semi automatic" solution. - - For every exposed module, `Py++` generates `exposed_decl.pypp.txt` file. - This file contains the list of all parsed declarations and whether they - were included or excluded. Later, when you work on another module, you - can tell `Py++` that the current module depends on the previously - generated one. `Py++` will load `exposed_decl.pypp.txt` file and update - the declarations. - """ - - db = utils.exposed_decls_db_t() - db.load( other_module_generated_code_dir ) - db.update_decls( self.global_ns ) - - - def __parse_declarations( self, files, gccxml_config, compilation_mode, cache, indexing_suite_version ): - if None is gccxml_config: - gccxml_config = parser.config_t() - if None is compilation_mode: - compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE - start_time = time.clock() - self.logger.debug( 'parsing files - started' ) - reader = parser.project_reader_t( gccxml_config, cache, decl_wrappers.dwfactory_t() ) - decls = reader.read_files( files, compilation_mode ) - - self.logger.debug( 'parsing files - done( %f seconds )' % ( time.clock() - start_time ) ) - self.logger.debug( 'settings declarations defaults - started' ) - - global_ns = decls_package.matcher.get_single( - decls_package.namespace_matcher_t( name='::' ) - , decls ) - if indexing_suite_version != 1: - for cls in global_ns.classes(): - cls.indexing_suite_version = indexing_suite_version - for cls in global_ns.decls(decl_type=decls_package.class_declaration_t): - cls.indexing_suite_version = indexing_suite_version - - start_time = time.clock() - self.__apply_decls_defaults(decls) - self.logger.debug( 'settings declarations defaults - done( %f seconds )' - % ( time.clock() - start_time ) ) - return global_ns - - def __filter_by_location( self, flatten_decls ): - for decl in flatten_decls: - if not decl.location: - continue - fpath = pygccxml_utils.normalize_path( decl.location.file_name ) - if pygccxml_utils.contains_parent_dir( fpath, self.__parsed_dirs ): - continue - if fpath in self.__parsed_files: - continue - found = False - for pfile in self.__parsed_files: - if fpath.endswith( pfile ): - found = True - break - if not found: - decl.exclude() - - def __apply_decls_defaults(self, decls): - flatten_decls = decls_package.make_flatten( decls ) - self.__filter_by_location( flatten_decls ) - call_policies_resolver = creators_factory.built_in_resolver_t() - calldefs = filter( lambda decl: isinstance( decl, decls_package.calldef_t ) - , flatten_decls ) - map( lambda calldef: calldef.set_call_policies( call_policies_resolver( calldef ) ) - , calldefs ) - mem_vars = filter( lambda decl: isinstance( decl, decls_package.variable_t ) - and isinstance( decl.parent, decls_package.class_t ) - , flatten_decls ) - map( lambda mem_var: mem_var.set_getter_call_policies( call_policies_resolver( mem_var, 'get' ) ) - , mem_vars ) - map( lambda mem_var: mem_var.set_setter_call_policies( call_policies_resolver( mem_var, 'set' ) ) - , mem_vars ) - - @property - def declarations_code_head( self ): - "List of user code, that will be added to the head of the declarations section." - return self.__declarations_code_head - - @property - def declarations_code_tail( self ): - "List of user code, that will be added to the tail of the declarations section." - return self.__declarations_code_tail - - @property - def registrations_code_head( self ): - "List of user code, that will be added to the head of the registrations section." - return self.__registrations_code_head - - @property - def registrations_code_tail( self ): - "List of user code, that will be added to the tail of the registrations section." - return self.__registrations_code_tail - - def build_code_creator( self - , module_name - , boost_python_ns_name='bp' - , call_policies_resolver_=None - , types_db=None - , target_configuration=None - , enable_indexing_suite=True - , doc_extractor=None): - """ - Creates :class:`code_creators.bpmodule_t` code creator. - - :param module_name: module name - :type module_name: str - - :param boost_python_ns_name: boost::python namespace alias, by default it is `bp` - :type boost_python_ns_name: str - - :param call_policies_resolver_: callable, that will be invoked on every calldef object. It should return call policies. - :type call_policies_resolver_: callable - :param doc_extractor: callable, that takes as argument reference to declaration and returns documentation string - :type doc_extractor: callable or None - """ - - creator = creators_factory.bpcreator_t( self.global_ns - , module_name - , boost_python_ns_name - , call_policies_resolver_ - , types_db - , target_configuration - , enable_indexing_suite ) - self.__code_creator = creator.create() - self.__code_creator.replace_included_headers(self.__parsed_files) - self.__code_creator.update_documentation( doc_extractor ) - return self.__code_creator - - @property - def code_creator( self ): - "reference to :class:`code_creators.bpmodule_t` instance" - if not self.__code_creator: - raise RuntimeError( "self.module is equal to None. Did you forget to call build_code_creator function?" ) - return self.__code_creator - - def has_code_creator( self ): - """ - Function, that will return True if build_code_creator function has been - called and False otherwise - """ - return not ( None is self.__code_creator ) - - def add_declaration_code( self, code, tail=True ): - if tail: - self.__declarations_code_tail.append( code ) - else: - self.__declarations_code_head.append( code ) - - def add_registration_code( self, code, tail=True ): - if tail: - self.__registrations_code_tail.append( code ) - else: - self.__registrations_code_head.append( code ) - - def add_constants( self, **keywds ): - """ - adds code that exposes some constants to Python. - - For example: - .. code-block:: python - - mb.add_constants( version='"1.2.3"' ) - # or - constants = dict( version:'"1.2.3"' ) - mb.add_constants( \\*\\*constants ) - - will generate the following code: - - .. code-block:: c++ - - boost::python::scope().attr("version") = "1.2.3"; - - """ - tmpl = 'boost::python::scope().attr("%(name)s") = %(value)s;' - for name, value in keywds.items(): - if not isinstance( value, types.StringTypes ): - value = str( value ) - self.add_regi... [truncated message content] |
From: <rom...@us...> - 2009-05-11 07:27:37
|
Revision: 1712 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1712&view=rev Author: roman_yakovenko Date: 2009-05-11 07:27:29 +0000 (Mon, 11 May 2009) Log Message: ----------- add few words Modified Paths: -------------- sphinx/ignore_dictionary.txt Modified: sphinx/ignore_dictionary.txt =================================================================== --- sphinx/ignore_dictionary.txt 2009-05-10 20:04:09 UTC (rev 1711) +++ sphinx/ignore_dictionary.txt 2009-05-11 07:27:29 UTC (rev 1712) @@ -1,41 +1,45 @@ -Yakovenko -org -www -txt -http -bool -const -JNI -jboolean -jbyte -jchar -jdouble -jfloat -jint -jlong -jshort -GCC -wchar -TODO -namespace -namespaces -str -pygccxml -GCCXML -gccxml -GCC -gcc -noncopyable -Bierbaum -ctypes -dll -cpp -pdb -bsc -undecorate -Beltrame -Kunstleve -Grosse -msvc -demangle -demangled +Yakovenko +org +www +txt +http +bool +const +JNI +jboolean +jbyte +jchar +jdouble +jfloat +jint +jlong +jshort +GCC +wchar +TODO +namespace +namespaces +str +pygccxml +GCCXML +gccxml +GCC +gcc +noncopyable +Bierbaum +ctypes +dll +cpp +pdb +bsc +undecorate +Beltrame +Kunstleve +Grosse +msvc +demangle +demangled +calldef +os +ini +undefine This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-10 20:04:19
|
Revision: 1711 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1711&view=rev Author: roman_yakovenko Date: 2009-05-10 20:04:09 +0000 (Sun, 10 May 2009) Log Message: ----------- fixing unittests Modified Paths: -------------- pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py pyplusplus_dev/unittests/fundamental_tester_base.py pyplusplus_dev/unittests/virtual_inheritance_tester.py Modified: pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py =================================================================== --- pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py 2009-05-10 18:25:05 UTC (rev 1710) +++ pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py 2009-05-10 20:04:09 UTC (rev 1711) @@ -1,203 +1,206 @@ -# Copyright 2004-2008 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) - -"""defines class, which informs user about used, but unexposed declarations""" - -import os -from pyplusplus import utils -from pyplusplus import messages -from pygccxml import declarations -from pyplusplus import decl_wrappers - -class duplicated_names_reporter_t(object): - def __init__( self, decls, value_getter, msg ): - self.decls = decls - self.get_value = value_getter - self.msg = msg - - def __select( self ): - duplicated = {} - for decl in self.decls: - value = self.get_value( decl ) - if not duplicated.has_key( value ): - duplicated[ value ] = set() - duplicated[ value ].add( decl ) - result = duplicated.copy() - for value, buggy_decls in duplicated.items(): - if 1 == len( buggy_decls ): - del result[ value ] - return result - - def __report_single( self, control_decl, duplicated, logger ): - value = self.get_value( control_decl ) - if value not in duplicated: - return - buggy_decls = duplicated[value].copy() - buggy_decls.remove( control_decl ) - warning = self.msg % ( value, os.linesep.join( map( str, buggy_decls ) ) ) - logger.warn( "%s;%s" % ( str( control_decl ), warning ) ) - - def report( self, logger ): - duplicated = self.__select() - for decl in self.decls: - self.__report_single( decl, duplicated, logger ) - -duplicated_aliases_reporter \ - = lambda decls: duplicated_names_reporter_t( decls, lambda d: d.alias, messages.W1047 ) - -duplicated_wrapper_aliases_reporter \ - = lambda decls: duplicated_names_reporter_t( decls, lambda d: d.wrapper_alias, messages.W1065 ) - - -class manager_t( object ): - def __init__( self, logger ): - object.__init__( self ) - self.__exported_decls = [] - self.__logger = logger - - def add_exported( self, decl ): - self.__exported_decls.append( decl ) - - def __is_std_decl( self, decl ): - #Every class under std should be exported by Boost.Python and\\or `Py++` - #Also this is not the case right now, I prefer to hide the warnings - dpath = declarations.declaration_path( decl ) - if len( dpath ) < 3: - return False - if dpath[1] != 'std': - return False - if decl.name.startswith( 'pair<' ): - #special case - return False - return True - - def __build_dependencies( self, decl ): - if self.__is_std_decl( decl ): - #TODO add element_type to the list of dependencies - return [] #std declarations should be exported by `Py++`! - if decl.already_exposed: - return [] - dependencies = decl.i_depend_on_them(recursive=False) - - if isinstance( decl, declarations.class_t ): - dependencies = filter( lambda d: d.access_type != declarations.ACCESS_TYPES.PRIVATE - , dependencies ) - - return dependencies - - def __has_unexposed_dependency( self, exported_ids, depend_on_decl, dependency ): - sptr_traits = declarations.smart_pointer_traits - - if None is depend_on_decl: - return - - if self.__is_std_decl( depend_on_decl ): - return - - if sptr_traits.is_smart_pointer( depend_on_decl ): - try: - value_type = sptr_traits.value_type( depend_on_decl ) - if isinstance( value_type, declarations.type_t ): - value_type = declarations.remove_cv( value_type ) - value_type = declarations.remove_declarated( value_type ) - if isinstance( value_type, declarations.declaration_t ): - return self.__has_unexposed_dependency( exported_ids, value_type, dependency ) - except RuntimeError: - pass - - if isinstance( depend_on_decl, decl_wrappers.decl_wrapper_t ): - if depend_on_decl.already_exposed: - return - if isinstance( depend_on_decl, declarations.class_types ): - if depend_on_decl.opaque: - return - if dependency.hint == "base class": - return #base class for some class don't have to be exported - if isinstance( depend_on_decl, declarations.variable_t ): - if not decl.expose_value: - return - - if isinstance( dependency.decl, declarations.variable_t ): - #the only dependency of the variable is its type - if not dependency.decl.expose_value: - return - - if dependency.hint == "return type": - #in this case we don't check, the return type but the function - if isinstance( dependency.decl, declarations.calldef_t ): - if dependency.decl.return_type and dependency.decl.call_policies \ - and decl_wrappers.is_return_opaque_pointer_policy( dependency.decl.call_policies ): - return - - return id( depend_on_decl ) not in exported_ids - - def __find_out_used_but_not_exported( self ): - used_not_exported = [] - exported_ids = set( map( lambda d: id( d ), self.__exported_decls ) ) - for decl in self.__exported_decls: - for dependency in self.__build_dependencies( decl ): - depend_on_decl = dependency.find_out_depend_on_declaration() - if self.__has_unexposed_dependency( exported_ids, depend_on_decl, dependency ): - if messages.filter_disabled_msgs([messages.W1040], depend_on_decl.disabled_messages ): - #need to report dependency errors - used_not_exported.append(dependency) - return used_not_exported - - def __group_by_unexposed( self, dependencies ): - groups = {} - for dependency in dependencies: - depend_on_decl = dependency.find_out_depend_on_declaration() - if not groups.has_key( id( depend_on_decl ) ): - groups[ id( depend_on_decl ) ] = [] - groups[ id( depend_on_decl ) ].append( dependency ) - return groups - - def __create_dependencies_msg( self, dependencies ): - depend_on_decl = dependencies[0].find_out_depend_on_declaration() - decls = [] - for dependency in dependencies: - decls.append( os.linesep + ' ' + str( dependency.declaration ) ) - return "%s;%s" % ( depend_on_decl, messages.W1040 % ''.join( decls ) ) - - def __report_duplicated_aliases( self ): - decls = filter( lambda decl: isinstance( decl, declarations.class_types ) \ - and isinstance( decl.parent, declarations.namespace_t ) - , self.__exported_decls ) - - dar = duplicated_aliases_reporter( decls ) - dar.report( self.__logger ) - - classes = filter( lambda c: isinstance( c, declarations.class_t ), decls ) - query = lambda decl: isinstance( decl, declarations.class_types ) \ - and decl.ignore == False \ - and decl._already_exposed == False - - for cls in classes: - internal_decls = cls.decls( query, recursive=False, allow_empty=True) - dar = duplicated_aliases_reporter( internal_decls ) - dar.report( self.__logger ) - - def __report_duplicated_wrapper_aliases( self ): - decls = filter( lambda decl: isinstance( decl, declarations.class_t ) \ - and isinstance( decl.parent, declarations.namespace_t ) - , self.__exported_decls ) - - dwar = duplicated_wrapper_aliases_reporter( decls ) - dwar.report( self.__logger ) - - query = lambda decl: decl.ignore == False and decl._already_exposed == False - - for cls in decls: - internal_decls = cls.classes( query, recursive=False, allow_empty=True) - dwar = duplicated_wrapper_aliases_reporter( internal_decls ) - dwar.report( self.__logger ) - - def inform_user( self ): - used_not_exported_decls = self.__find_out_used_but_not_exported() - groups = self.__group_by_unexposed( used_not_exported_decls ) - for group in groups.itervalues(): - self.__logger.warn( self.__create_dependencies_msg( group ) ) - self.__report_duplicated_aliases() - self.__report_duplicated_wrapper_aliases() +# Copyright 2004-2008 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) + +"""defines class, which informs user about used, but unexposed declarations""" + +import os +from pyplusplus import utils +from pyplusplus import messages +from pygccxml import declarations +from pyplusplus import decl_wrappers + +class duplicated_names_reporter_t(object): + def __init__( self, decls, value_getter, msg ): + self.decls = decls + self.get_value = value_getter + self.msg = msg + + def __select( self ): + duplicated = {} + for decl in self.decls: + value = self.get_value( decl ) + if not duplicated.has_key( value ): + duplicated[ value ] = set() + duplicated[ value ].add( decl ) + result = duplicated.copy() + for value, buggy_decls in duplicated.items(): + if 1 == len( buggy_decls ): + del result[ value ] + return result + + def __report_single( self, control_decl, duplicated, logger ): + value = self.get_value( control_decl ) + if value not in duplicated: + return + buggy_decls = duplicated[value].copy() + buggy_decls.remove( control_decl ) + warning = self.msg % ( value, os.linesep.join( map( str, buggy_decls ) ) ) + logger.warn( "%s;%s" % ( str( control_decl ), warning ) ) + + def report( self, logger ): + duplicated = self.__select() + for decl in self.decls: + self.__report_single( decl, duplicated, logger ) + +duplicated_aliases_reporter \ + = lambda decls: duplicated_names_reporter_t( decls, lambda d: d.alias, messages.W1047 ) + +duplicated_wrapper_aliases_reporter \ + = lambda decls: duplicated_names_reporter_t( decls, lambda d: d.wrapper_alias, messages.W1065 ) + + +class manager_t( object ): + def __init__( self, logger ): + object.__init__( self ) + self.__exported_decls = [] + self.__logger = logger + + def add_exported( self, decl ): + self.__exported_decls.append( decl ) + if isinstance( decl, declarations.class_t ) and decl.indexing_suite: + included_decls = decl.decls( lambda d: d.ignore==False, allow_empty=True, recursive=True ) + map( self.add_exported, included_decls ) + + def __is_std_decl( self, decl ): + #Every class under std should be exported by Boost.Python and\\or `Py++` + #Also this is not the case right now, I prefer to hide the warnings + dpath = declarations.declaration_path( decl ) + if len( dpath ) < 3: + return False + if dpath[1] != 'std': + return False + if decl.name.startswith( 'pair<' ): + #special case + return False + return True + + def __build_dependencies( self, decl ): + if self.__is_std_decl( decl ): + #TODO add element_type to the list of dependencies + return [] #std declarations should be exported by `Py++`! + if decl.already_exposed: + return [] + dependencies = decl.i_depend_on_them(recursive=False) + + if isinstance( decl, declarations.class_t ): + dependencies = filter( lambda d: d.access_type != declarations.ACCESS_TYPES.PRIVATE + , dependencies ) + + return dependencies + + def __has_unexposed_dependency( self, exported_ids, depend_on_decl, dependency ): + sptr_traits = declarations.smart_pointer_traits + + if None is depend_on_decl: + return + + if self.__is_std_decl( depend_on_decl ): + return + + if sptr_traits.is_smart_pointer( depend_on_decl ): + try: + value_type = sptr_traits.value_type( depend_on_decl ) + if isinstance( value_type, declarations.type_t ): + value_type = declarations.remove_cv( value_type ) + value_type = declarations.remove_declarated( value_type ) + if isinstance( value_type, declarations.declaration_t ): + return self.__has_unexposed_dependency( exported_ids, value_type, dependency ) + except RuntimeError: + pass + + if isinstance( depend_on_decl, decl_wrappers.decl_wrapper_t ): + if depend_on_decl.already_exposed: + return + if isinstance( depend_on_decl, declarations.class_types ): + if depend_on_decl.opaque: + return + if dependency.hint == "base class": + return #base class for some class don't have to be exported + if isinstance( depend_on_decl, declarations.variable_t ): + if not decl.expose_value: + return + + if isinstance( dependency.decl, declarations.variable_t ): + #the only dependency of the variable is its type + if not dependency.decl.expose_value: + return + + if dependency.hint == "return type": + #in this case we don't check, the return type but the function + if isinstance( dependency.decl, declarations.calldef_t ): + if dependency.decl.return_type and dependency.decl.call_policies \ + and decl_wrappers.is_return_opaque_pointer_policy( dependency.decl.call_policies ): + return + + return id( depend_on_decl ) not in exported_ids + + def __find_out_used_but_not_exported( self ): + used_not_exported = [] + exported_ids = set( map( lambda d: id( d ), self.__exported_decls ) ) + for decl in self.__exported_decls: + for dependency in self.__build_dependencies( decl ): + depend_on_decl = dependency.find_out_depend_on_declaration() + if self.__has_unexposed_dependency( exported_ids, depend_on_decl, dependency ): + if messages.filter_disabled_msgs([messages.W1040], depend_on_decl.disabled_messages ): + #need to report dependency errors + used_not_exported.append(dependency) + return used_not_exported + + def __group_by_unexposed( self, dependencies ): + groups = {} + for dependency in dependencies: + depend_on_decl = dependency.find_out_depend_on_declaration() + if not groups.has_key( id( depend_on_decl ) ): + groups[ id( depend_on_decl ) ] = [] + groups[ id( depend_on_decl ) ].append( dependency ) + return groups + + def __create_dependencies_msg( self, dependencies ): + depend_on_decl = dependencies[0].find_out_depend_on_declaration() + decls = [] + for dependency in dependencies: + decls.append( os.linesep + ' ' + str( dependency.declaration ) ) + return "%s;%s" % ( depend_on_decl, messages.W1040 % ''.join( decls ) ) + + def __report_duplicated_aliases( self ): + decls = filter( lambda decl: isinstance( decl, declarations.class_types ) \ + and isinstance( decl.parent, declarations.namespace_t ) + , self.__exported_decls ) + + dar = duplicated_aliases_reporter( decls ) + dar.report( self.__logger ) + + classes = filter( lambda c: isinstance( c, declarations.class_t ), decls ) + query = lambda decl: isinstance( decl, declarations.class_types ) \ + and decl.ignore == False \ + and decl._already_exposed == False + + for cls in classes: + internal_decls = cls.decls( query, recursive=False, allow_empty=True) + dar = duplicated_aliases_reporter( internal_decls ) + dar.report( self.__logger ) + + def __report_duplicated_wrapper_aliases( self ): + decls = filter( lambda decl: isinstance( decl, declarations.class_t ) \ + and isinstance( decl.parent, declarations.namespace_t ) + , self.__exported_decls ) + + dwar = duplicated_wrapper_aliases_reporter( decls ) + dwar.report( self.__logger ) + + query = lambda decl: decl.ignore == False and decl._already_exposed == False + + for cls in decls: + internal_decls = cls.classes( query, recursive=False, allow_empty=True) + dwar = duplicated_wrapper_aliases_reporter( internal_decls ) + dwar.report( self.__logger ) + + def inform_user( self ): + used_not_exported_decls = self.__find_out_used_but_not_exported() + groups = self.__group_by_unexposed( used_not_exported_decls ) + for group in groups.itervalues(): + self.__logger.warn( self.__create_dependencies_msg( group ) ) + self.__report_duplicated_aliases() + self.__report_duplicated_wrapper_aliases() Modified: pyplusplus_dev/unittests/fundamental_tester_base.py =================================================================== --- pyplusplus_dev/unittests/fundamental_tester_base.py 2009-05-10 18:25:05 UTC (rev 1710) +++ pyplusplus_dev/unittests/fundamental_tester_base.py 2009-05-10 20:04:09 UTC (rev 1711) @@ -1,158 +1,156 @@ -# Copyright 2004-2008 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) - -import os -import sys -import unittest -import autoconfig -import pygccxml -from pygccxml import parser -from pyplusplus import utils -from pygccxml import declarations -from pyplusplus import module_builder - -LICENSE = """// Copyright 2004-2008 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)""" - -class fundamental_tester_base_t( unittest.TestCase ): - SUFFIX_TO_BE_EXPORTED = '_to_be_exported.hpp' - - def __init__(self, module_name, *args, **keywd ): - unittest.TestCase.__init__(self, *args) - self.__module_name = module_name - self.__to_be_exported_header \ - = os.path.join( autoconfig.data_directory - , self.__module_name + self.SUFFIX_TO_BE_EXPORTED ) - - self.__generated_source_file_name = os.path.join( autoconfig.build_dir - , self.__module_name + '.cpp' ) - self.__generated_scons_file_name = os.path.join( autoconfig.build_dir - , self.__module_name + '.scons' ) - - self.__indexing_suite_version = keywd.get( 'indexing_suite_version', 1 ) - - def failIfRaisesAny(self, callableObj, *args, **kwargs): - try: - callableObj(*args, **kwargs) - except Exception, error: - self.fail( 'exception has been raised during execution. exception: ' + str(error) ) - - def failIfNotRaisesAny(self, callableObj, *args, **kwargs): - was_exception = False - try: - callableObj(*args, **kwargs) - except: - was_exception = True - self.failUnless(was_exception, 'exception has not been raised during execution.') - - def __test_already_exposed( self, mb ): - exposed_db = utils.exposed_decls_db_t() - exposed_db.load( autoconfig.build_dir ) - irrelevant_decl_types = ( declarations.typedef_t - , declarations.namespace_t - , declarations.free_operator_t ) - specially_exposed_decls = mb.code_creator.specially_exposed_decls - for d in mb.decls(): - if not d.exportable: - continue - elif isinstance( d, declarations.free_operator_t ): - continue - elif d.ignore: - if d in specially_exposed_decls: - continue - if exposed_db.is_exposed( d ): - i = 0 - self.failUnless( not exposed_db.is_exposed( d ) - , '''Declaration "%s" is NOT exposed, but for some reason it is marked as such.''' - % str( d ) ) - #if d.ignore or not d.exportable or isinstance( d, irrelevant_decl_types ): - #continue - #if d.parent and not d.parent.name: - #continue #unnamed classes - else: - self.failUnless( exposed_db.is_exposed( d ) - , '''Declaration "%s" is exposed, but for some reason it isn't marked as such.''' - % str( d ) ) - - def customize(self, generator): - pass - - def get_source_files( self ): - sources = [ self.__generated_source_file_name ] - to_be_exported_cpp = os.path.splitext( self.__to_be_exported_header )[0] + '.cpp' - if os.path.exists( to_be_exported_cpp ): - sources.append( to_be_exported_cpp ) - return sources - - def generate_source_files( self, mb ): - mb.write_module( self.__generated_source_file_name ) - - def run_tests(self, module): - raise NotImplementedError() - - def _create_extension_source_file(self): - global LICENSE - - mb = module_builder.module_builder_t( [self.__to_be_exported_header] - , gccxml_path=autoconfig.gccxml.executable - , include_paths=[autoconfig.boost.include] - , undefine_symbols=['__MINGW32__'] - , indexing_suite_version=self.__indexing_suite_version - , compiler=autoconfig.cxx_parsers_cfg.gccxml.compiler) - for decl in mb.decls(): - decl.documentation = '"documentation"' - self.customize( mb ) - doc_extractor = lambda decl: decl.documentation - if not mb.has_code_creator(): - mb.build_code_creator( self.__module_name, doc_extractor=doc_extractor ) - mb.code_creator.std_directories.extend( autoconfig.scons_config.cpppath ) - mb.code_creator.user_defined_directories.append( autoconfig.data_directory ) - mb.code_creator.precompiled_header = "boost/python.hpp" - mb.code_creator.license = LICENSE - self.generate_source_files( mb ) - self.__test_already_exposed( mb ) - - def _create_sconstruct(self, sources ): - sources_str = [] - for source in sources: - sources_str.append( "r'%s'" % source ) - sources_str = ','.join( sources_str ) - sconstruct_script = autoconfig.scons_config.create_sconstruct()\ - % { 'target' : self.__module_name - , 'sources' : sources_str } - sconstruct_file = file( self.__generated_scons_file_name, 'w+b' ) - sconstruct_file.write( sconstruct_script ) - sconstruct_file.close() - - def _clean_build( self, sconstruct_file ): - cmd = autoconfig.scons.cmd_clean % sconstruct_file - output = os.popen( cmd ) - scons_reports = [] - while True: - data = output.readline() - scons_reports.append( data ) - if not data: - break - exit_status = output.close() - scons_msg = ''.join(scons_reports) - if exit_status: - raise RuntimeError( "unable to clean extension. error: %s" % scons_msg ) - - def test(self): - pypp = None - try: - self._create_extension_source_file() - sources = self.get_source_files() - self._create_sconstruct(sources) - autoconfig.scons_config.compile( autoconfig.scons.cmd_build + ' --file=%s' % self.__generated_scons_file_name ) - pypp = __import__( self.__module_name ) - self.run_tests(pypp) - finally: - if sys.modules.has_key( self.__module_name ): - del sys.modules[self.__module_name] - del pypp - #self._clean_build(self.__generated_scons_file_name) +# Copyright 2004-2008 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) + +import os +import sys +import unittest +import autoconfig +import pygccxml +from pygccxml import parser +from pyplusplus import utils +from pygccxml import declarations +from pyplusplus import module_builder + +LICENSE = """// Copyright 2004-2008 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)""" + +class fundamental_tester_base_t( unittest.TestCase ): + SUFFIX_TO_BE_EXPORTED = '_to_be_exported.hpp' + + def __init__(self, module_name, *args, **keywd ): + unittest.TestCase.__init__(self, *args) + self.__module_name = module_name + self.__to_be_exported_header \ + = os.path.join( autoconfig.data_directory + , self.__module_name + self.SUFFIX_TO_BE_EXPORTED ) + + self.__generated_source_file_name = os.path.join( autoconfig.build_dir + , self.__module_name + '.cpp' ) + self.__generated_scons_file_name = os.path.join( autoconfig.build_dir + , self.__module_name + '.scons' ) + + self.__indexing_suite_version = keywd.get( 'indexing_suite_version', 1 ) + + def failIfRaisesAny(self, callableObj, *args, **kwargs): + try: + callableObj(*args, **kwargs) + except Exception, error: + self.fail( 'exception has been raised during execution. exception: ' + str(error) ) + + def failIfNotRaisesAny(self, callableObj, *args, **kwargs): + was_exception = False + try: + callableObj(*args, **kwargs) + except: + was_exception = True + self.failUnless(was_exception, 'exception has not been raised during execution.') + + def __test_already_exposed( self, mb ): + exposed_db = utils.exposed_decls_db_t() + exposed_db.load( autoconfig.build_dir ) + irrelevant_decl_types = ( declarations.typedef_t + , declarations.namespace_t + , declarations.free_operator_t ) + specially_exposed_decls = mb.code_creator.specially_exposed_decls + for d in mb.decls(): + if not d.exportable: + continue + elif isinstance( d, declarations.free_operator_t ): + continue + elif d.ignore: + if d in specially_exposed_decls: + continue + if exposed_db.is_exposed( d ): + i = 0 + self.failUnless( not exposed_db.is_exposed( d ) + , '''Declaration "%s" is NOT exposed, but for some reason it is marked as such.''' + % str( d ) ) + elif d.parent \ + and isinstance( d.parent, declarations.class_t ) \ + and d.parent.indexing_suite: + continue + else: + self.failUnless( exposed_db.is_exposed( d ) + , '''Declaration "%s" is exposed, but for some reason it isn't marked as such.''' + % str( d ) ) + + def customize(self, generator): + pass + + def get_source_files( self ): + sources = [ self.__generated_source_file_name ] + to_be_exported_cpp = os.path.splitext( self.__to_be_exported_header )[0] + '.cpp' + if os.path.exists( to_be_exported_cpp ): + sources.append( to_be_exported_cpp ) + return sources + + def generate_source_files( self, mb ): + mb.write_module( self.__generated_source_file_name ) + + def run_tests(self, module): + raise NotImplementedError() + + def _create_extension_source_file(self): + global LICENSE + + mb = module_builder.module_builder_t( [self.__to_be_exported_header] + #, undefine_symbols=['__MINGW32__'] + , indexing_suite_version=self.__indexing_suite_version + , gccxml_config=autoconfig.cxx_parsers_cfg.gccxml) + for decl in mb.decls(): + decl.documentation = '"documentation"' + self.customize( mb ) + doc_extractor = lambda decl: decl.documentation + if not mb.has_code_creator(): + mb.build_code_creator( self.__module_name, doc_extractor=doc_extractor ) + mb.code_creator.std_directories.extend( autoconfig.scons_config.cpppath ) + mb.code_creator.user_defined_directories.append( autoconfig.data_directory ) + mb.code_creator.precompiled_header = "boost/python.hpp" + mb.code_creator.license = LICENSE + self.generate_source_files( mb ) + self.__test_already_exposed( mb ) + + def _create_sconstruct(self, sources ): + sources_str = [] + for source in sources: + sources_str.append( "r'%s'" % source ) + sources_str = ','.join( sources_str ) + sconstruct_script = autoconfig.scons_config.create_sconstruct()\ + % { 'target' : self.__module_name + , 'sources' : sources_str } + sconstruct_file = file( self.__generated_scons_file_name, 'w+b' ) + sconstruct_file.write( sconstruct_script ) + sconstruct_file.close() + + def _clean_build( self, sconstruct_file ): + cmd = autoconfig.scons.cmd_clean % sconstruct_file + output = os.popen( cmd ) + scons_reports = [] + while True: + data = output.readline() + scons_reports.append( data ) + if not data: + break + exit_status = output.close() + scons_msg = ''.join(scons_reports) + if exit_status: + raise RuntimeError( "unable to clean extension. error: %s" % scons_msg ) + + def test(self): + pypp = None + try: + self._create_extension_source_file() + sources = self.get_source_files() + self._create_sconstruct(sources) + autoconfig.scons_config.compile( autoconfig.scons.cmd_build + ' --file=%s' % self.__generated_scons_file_name ) + pypp = __import__( self.__module_name ) + self.run_tests(pypp) + finally: + if sys.modules.has_key( self.__module_name ): + del sys.modules[self.__module_name] + del pypp + #self._clean_build(self.__generated_scons_file_name) Modified: pyplusplus_dev/unittests/virtual_inheritance_tester.py =================================================================== --- pyplusplus_dev/unittests/virtual_inheritance_tester.py 2009-05-10 18:25:05 UTC (rev 1710) +++ pyplusplus_dev/unittests/virtual_inheritance_tester.py 2009-05-10 20:04:09 UTC (rev 1711) @@ -1,35 +1,38 @@ -# Copyright 2004-2008 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) - -import os -import sys -import unittest -import fundamental_tester_base - -class tester_t(fundamental_tester_base.fundamental_tester_base_t): - EXTENSION_NAME = 'virtual_inheritance' - - def __init__( self, *args ): - fundamental_tester_base.fundamental_tester_base_t.__init__( - self - , tester_t.EXTENSION_NAME - , *args ) - - def customize( self, mb ): - mb.classes().always_expose_using_scope = True - - def run_tests( self, module): - pass - -def create_suite(): - suite = unittest.TestSuite() - suite.addTest( unittest.makeSuite(tester_t)) - return suite - -def run_suite(): - unittest.TextTestRunner(verbosity=2).run( create_suite() ) - -if __name__ == "__main__": - run_suite() +# Copyright 2004-2008 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) + +import os +import sys +import unittest +import fundamental_tester_base + +EXPECTED_TO_FAIL = True +EXPECTED_TO_FAIL_INFO = "Boost.Python doesn't support virtual inheritance" + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'virtual_inheritance' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize( self, mb ): + mb.classes().always_expose_using_scope = True + + def run_tests( self, module): + pass + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-10 18:25:09
|
Revision: 1710 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1710&view=rev Author: roman_yakovenko Date: 2009-05-10 18:25:05 +0000 (Sun, 10 May 2009) Log Message: ----------- update setup Modified Paths: -------------- pygccxml_dev/setup.py Modified: pygccxml_dev/setup.py =================================================================== --- pygccxml_dev/setup.py 2009-05-10 18:14:04 UTC (rev 1709) +++ pygccxml_dev/setup.py 2009-05-10 18:25:05 UTC (rev 1710) @@ -1,69 +1,20 @@ -#!/usr/bin/env python -# Copyright 2004-2008 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) - -import sys, os, os.path -from distutils import sysconfig -from distutils.core import setup -from distutils.cmd import Command - -def generate_doc(): - """Generate the epydoc reference manual. - """ - print "Generating epydoc files..." - - from epydoc.docbuilder import build_doc_index - from epydoc.docwriter.html import HTMLWriter - - docindex = build_doc_index(['pygccxml']) - html_writer = HTMLWriter( docindex - , prj_name='pygccxml' - , prj_url='http://www.language-binding.net' - , show_private=False - , show_frames=False) - - html_writer.write( os.path.join('docs', 'apidocs') ) - -class doc_cmd(Command): - """This is a new distutils command 'doc' to build the epydoc manual. - """ - - description = 'build the API reference using epydoc' - user_options = [('no-doc', None, "don't run epydoc")] - boolean_options = ['no-doc'] - - def initialize_options (self): - self.no_doc = 0 - - def finalize_options (self): - pass - - def run(self): - if self.no_doc: - return - generate_doc() - - -# Generate the doc when a source distribution is created -if sys.argv[-1]=="sdist": - generate_doc() - - -setup( name = "pygccxml", - version = "1.0.0", - description = "GCC-XML generated file reader", - author = "Roman Yakovenko", - author_email = "rom...@gm...", - url = 'http://www.language-binding.net/pygccxml/pygccxml.html', - packages = [ 'pygccxml', - 'pygccxml.declarations', - 'pygccxml.parser', - 'pygccxml.binary_parsers', - #~ deprecated - #~ 'pygccxml.binary_parsers.bsc', - #~ 'pygccxml.binary_parsers.mspdb', - 'pygccxml.utils' ], - cmdclass = {"doc" : doc_cmd} -) +#!/usr/bin/env python +# Copyright 2004-2008 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) + +from distutils.core import setup + +setup( name = "pygccxml", + version = "1.1.0", + description = "GCC-XML generated file reader", + author = "Roman Yakovenko", + author_email = "rom...@gm...", + url = 'http://www.language-binding.net/pygccxml/pygccxml.html', + packages = [ 'pygccxml', + 'pygccxml.declarations', + 'pygccxml.parser', + 'pygccxml.binary_parsers', + 'pygccxml.utils' ] +) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-05-10 18:14:11
|
Revision: 1709 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1709&view=rev Author: roman_yakovenko Date: 2009-05-10 18:14:04 +0000 (Sun, 10 May 2009) Log Message: ----------- update history and clean testers from PDB compiler Modified Paths: -------------- pygccxml_dev/docs/history/history.rest pygccxml_dev/pygccxml/declarations/class_declaration.py pygccxml_dev/pygccxml/declarations/compilers.py pygccxml_dev/pygccxml/declarations/cpptypes.py pygccxml_dev/pygccxml/declarations/enumeration.py pygccxml_dev/pygccxml/parser/config.py pygccxml_dev/unittests/core_tester.py pygccxml_dev/unittests/data/core_cache.hpp pygccxml_dev/unittests/templates_tester.py Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/docs/history/history.rest 2009-05-10 18:14:04 UTC (rev 1709) @@ -35,7 +35,7 @@ See :func:`pygccxml.parser.config.load_gccxml_configuration` for details. 4. From now on, :doc:`pygccxml <../pygccxml>` will use `Sphinx <http://sphinx.pocoo.org/>`_ - for all documentation. + for all documentation. The documentation format and content were updated. 5. From now on, `pygccxml` will provide convenient setup for latest `GCC-XML`_ version (CVS). See :doc:`download <../download>` document. @@ -43,6 +43,7 @@ 6. Bug `[ 2431993 ] pygccxml parses const volatile variable args as just const <http://sourceforge.net/tracker/index.php?func=detail&aid=2431993&group_id=118209&atid=684318>`_ was fixed. + ----------- Version 1.0 ----------- Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/class_declaration.py 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2009-05-10 18:14:04 UTC (rev 1709) @@ -276,33 +276,7 @@ return self._recursive_derived def _get_is_abstract(self): - if self.compiler == compilers.MSVC_PDB_9: - #prevent cyclic dependencies - import calldef - import function_traits - from matchers import virtuality_type_matcher_t as vtmatcher_t - filter_pv = vtmatcher_t( calldef.VIRTUALITY_TYPES.PURE_VIRTUAL ) - if self.calldefs( filter_pv, recursive=False, allow_empty=True ): - return True - filter_npv = vtmatcher_t( calldef.VIRTUALITY_TYPES.VIRTUAL ) \ - | vtmatcher_t( calldef.VIRTUALITY_TYPES.NOT_VIRTUAL ) - pv_calldefs = [] - npv_calldefs = [] - - npv_calldefs.extend( self.calldefs( filter_npv, recursive=False, allow_empty=True ) ) - for base in self.recursive_bases: - cls = base.related_class - pv_calldefs.extend( cls.calldefs( filter_pv, recursive=False, allow_empty=True ) ) - npv_calldefs.extend( cls.calldefs( filter_npv, recursive=False, allow_empty=True ) ) - - for pure_virtual in pv_calldefs: - impl_found = filter( lambda f: function_traits.is_same_function( pure_virtual, f ) - , npv_calldefs ) - if not impl_found: - return True - return False - else: - return self._is_abstract + return self._is_abstract def _set_is_abstract( self, is_abstract ): self._is_abstract = is_abstract is_abstract = property( _get_is_abstract, _set_is_abstract @@ -344,8 +318,6 @@ , doc="Size of this class in bytes @type: int") def _get_byte_align(self): - if self.compiler == compilers.MSVC_PDB_9: - compilers.on_missing_functionality( self.compiler, "byte align" ) return self._byte_align def _set_byte_align( self, new_byte_align ): self._byte_align = new_byte_align Modified: pygccxml_dev/pygccxml/declarations/compilers.py =================================================================== --- pygccxml_dev/pygccxml/declarations/compilers.py 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/pygccxml/declarations/compilers.py 2009-05-10 18:14:04 UTC (rev 1709) @@ -16,8 +16,6 @@ #are dumped whether the user declared them or not. Those that were #implicitly declared by the compiler are marked as "artificial". -MSVC_PDB_9 = "MSVC PDB 9.0" - def on_missing_functionality( compiler, functionality ): raise NotImplementedError( '"%s" compiler doesn\'t support functionality "%s"' % ( compiler, functionality )) Modified: pygccxml_dev/pygccxml/declarations/cpptypes.py =================================================================== --- pygccxml_dev/pygccxml/declarations/cpptypes.py 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/pygccxml/declarations/cpptypes.py 2009-05-10 18:14:04 UTC (rev 1709) @@ -65,8 +65,6 @@ , doc="Size of this type in bytes @type: int") def _get_byte_align(self): - if self.compiler == compilers.MSVC_PDB_9: - compilers.on_missing_functionality( self.compiler, "byte align" ) return self._byte_align def _set_byte_align( self, new_byte_align ): self._byte_align = new_byte_align Modified: pygccxml_dev/pygccxml/declarations/enumeration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/enumeration.py 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/pygccxml/declarations/enumeration.py 2009-05-10 18:14:04 UTC (rev 1709) @@ -128,8 +128,6 @@ , doc="Size of this class in bytes @type: int") def _get_byte_align(self): - if self.compiler == compilers.MSVC_PDB_9: - compilers.on_missing_functionality( self.compiler, "byte align" ) return self._byte_align def _set_byte_align( self, new_byte_align ): self._byte_align = new_byte_align Modified: pygccxml_dev/pygccxml/parser/config.py =================================================================== --- pygccxml_dev/pygccxml/parser/config.py 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/pygccxml/parser/config.py 2009-05-10 18:14:04 UTC (rev 1709) @@ -205,7 +205,7 @@ gccxml_path= #gccxml working directory - optional, could be set to your source code directory working_directory= -#additional include directories, separated by ';' or ':' +#additional include directories, separated by ';' include_paths= #gccxml has a nice algorithms, which selects what C++ compiler to emulate. #You can explicitly set what compiler it should emulate. Modified: pygccxml_dev/unittests/core_tester.py =================================================================== --- pygccxml_dev/unittests/core_tester.py 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/unittests/core_tester.py 2009-05-10 18:14:04 UTC (rev 1709) @@ -1,414 +1,397 @@ -# Copyright 2004-2008 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) - -import os -import sys -import pprint -import unittest -import tempfile -import autoconfig -import parser_test_case -from pprint import pformat - -import pygccxml -from pygccxml.utils import * -from pygccxml.parser import * -from pygccxml.declarations import * - -def is_sub_path( root, some_path ): - root = normalize_path( root ) - some_path = normalize_path( some_path ) - return some_path.startswith( root ) - - -class core_t( parser_test_case.parser_test_case_t ): - """Tests core algorithms of GCC-XML and GCC-XML file reader. - Those most white-box testing. - """ - global_ns = None - def __init__(self, *args ): - parser_test_case.parser_test_case_t.__init__( self, *args ) - self.global_ns = None - - def test_top_parent(self): - enum = self.global_ns.enum( '::ns::ns32::E33' ) - self.failUnless( self.global_ns is enum.top_parent ) - - #tests namespaces join functionality. described in gccxml.py - def test_nss_join(self): - #list of all namespaces - nss = [ '::ns', '::ns::ns12', '::ns::ns22', '::ns::ns32' ] - #list of all namespaces that have unnamed namespace - unnamed_nss = nss[1:] - #list of all enums [0:2] [3:5] [6:8] - has same parent - enums = [ '::E11', '::E21', '::E31' - , '::ns::E12', '::ns::E22', '::ns::E32' - , '::ns::ns12::E13', '::ns::ns22::E23', '::ns::ns32::E33' ] - - for ns in nss: - self.global_ns.namespace( ns ) - - for enum in enums: - self.global_ns.enum( enum ) - - ns = self.global_ns.namespace( nss[0] ) - ns12 = self.global_ns.namespace( nss[1] ) - ns22 = self.global_ns.namespace( nss[2] ) - ns32 = self.global_ns.namespace( nss[3] ) - self.failUnless( ns and ( ns is ns12.parent is ns22.parent is ns32.parent ) - , 'There are 2 or more instances of ns namespace.' ) - - E11 = self.global_ns.enum( enums[0] ) - E21 = self.global_ns.enum( enums[1] ) - E31 = self.global_ns.enum( enums[2] ) - self.failUnless( E11.parent is E21.parent is E31.parent - , 'There are 2 or more instances of global namespace.' ) - - nsE12 = self.global_ns.enum( enums[3] ) - nsE23 = self.global_ns.enum( enums[4] ) - nsE33 = self.global_ns.enum( enums[5] ) - self.failUnless( ns and ( ns is nsE12.parent is nsE23.parent is nsE33.parent ) - , 'There are 2 or more instances of ns namespace.' ) - - def _test_ns_membership(self, ns, enum_name ): - unnamed_enum = ns.enum( lambda d: d.name == '' \ - and is_sub_path( autoconfig.data_directory, d.location.file_name ) - , recursive=False ) - self.failUnless( unnamed_enum in ns.declarations - , "namespace '%s' does not contains unnamed enum." % ns.name ) - - enum = ns.enum( enum_name, recursive=False ) - - self.failUnless( enum in ns.declarations - , "namespace '%s' does not contains enum '%s'" % ( ns.name, enum.name ) ) - - self.failUnless( unnamed_enum.parent is ns - , "unnamed enum belong to namespace '%s' but this namespace is not it's parent." % ns.name ) - - self.failUnless( enum.parent is ns - , "enum '%s' belong to namespace '%s' but this namespace is not it's parent." % ( enum.name, ns.name ) ) - - def _test_class_membership( self, class_inst, enum_name, access ): - #getting enum through get_members function - if class_inst.compiler == compilers.MSVC_PDB_9: - nested_enum1 = class_inst.enum( name=enum_name ) - else: - nested_enum1 = class_inst.enum( name=enum_name, function=access_type_matcher_t( access ) ) - - #getting enum through declarations property - nested_enum2 = class_inst.enum( enum_name ) - - #it shoud be same object - self.failUnless( nested_enum1 is nested_enum2 - , "enum accessed through access definition('%s') and through declarations('%s') are different enums or instances." \ - %( nested_enum1.name, nested_enum2.name ) ) - - #check whether we meaning same class instance - self.failUnless( class_inst is nested_enum1.parent is nested_enum2.parent - , 'There are 2 or more instances of ns namespace.' ) - - #test gccxml_file_reader_t._update_membership algorithm - def test_membership(self): - core_membership = self.global_ns.namespace( 'membership' ) - self._test_ns_membership( self.global_ns, 'EGlobal' ) - self._test_ns_membership( core_membership.namespace('enums_ns'), 'EWithin' ) - self._test_ns_membership( core_membership.namespace( '' ), 'EWithinUnnamed' ) - class_nested_enums = core_membership.class_( 'class_for_nested_enums_t' ) - self._test_class_membership( class_nested_enums, 'ENestedPublic', ACCESS_TYPES.PUBLIC ) - self._test_class_membership( class_nested_enums, 'ENestedProtected', ACCESS_TYPES.PROTECTED ) - self._test_class_membership( class_nested_enums, 'ENestedPrivate', ACCESS_TYPES.PRIVATE ) - - def test_mangled(self): - std = self.global_ns.namespace( 'std' ) - self.failUnless( std, 'std namespace has not been found' ) - self.failUnless( std.mangled, 'mangled name of std namespace should be different from None' ) - - def _test_is_based_and_derived(self, base, derived, access): - dhi_v = hierarchy_info_t( derived, access, True ) - dhi_not_v = hierarchy_info_t( derived, access, False ) - self.failUnless( dhi_v in base.derived or dhi_not_v in base.derived - , "base class '%s' doesn't has derived class '%s'" %( base.name, derived.name ) ) - - bhi_v = hierarchy_info_t( base, access, True ) - bhi_not_v = hierarchy_info_t( base, access, False ) - - self.failUnless( bhi_v in derived.bases or bhi_not_v in derived.bases - , "derive class '%s' doesn't has base class '%s'" %( derived.name, base.name ) ) - - def test_class_hierarchy(self): - class_hierarchy = self.global_ns.namespace( 'class_hierarchy' ) - - base = class_hierarchy.class_( 'base_t' ) - other_base = class_hierarchy.class_( 'other_base_t' ) - derived_public = class_hierarchy.class_( 'derived_public_t' ) - derived_protected = class_hierarchy.class_( 'derived_protected_t' ) - derived_private = class_hierarchy.class_( 'derived_private_t' ) - multi_derived = class_hierarchy.class_( 'multi_derived_t' ) - - self._test_is_based_and_derived( base, derived_public, ACCESS_TYPES.PUBLIC ) - self._test_is_based_and_derived( base, derived_protected, ACCESS_TYPES.PROTECTED ) - self._test_is_based_and_derived( base, derived_private, ACCESS_TYPES.PRIVATE ) - self._test_is_based_and_derived( base, multi_derived, ACCESS_TYPES.PROTECTED ) - self._test_is_based_and_derived( other_base, multi_derived, ACCESS_TYPES.PRIVATE ) - self._test_is_based_and_derived( derived_private, multi_derived, ACCESS_TYPES.PRIVATE ) - - def _test_is_same_bases(self, derived1, derived2 ): - bases1 = set([ id(hierarchy_info.related_class) for hierarchy_info in derived1.bases ]) - bases2 = set([ id(hierarchy_info.related_class) for hierarchy_info in derived2.bases ]) - self.failUnless( bases1 == bases2 - , "derived class '%s' and derived class '%s' has references to different instance of base classes " \ - % ( derived1.name, derived2.name ) ) - - def test_class_join(self): - diamand_hierarchy = self.global_ns.namespace( 'diamand_hierarchy' ) - base = diamand_hierarchy.class_( 'base_t' ) - derived1 = diamand_hierarchy.class_( 'derived1_t' ) - derived2 = diamand_hierarchy.class_( 'derived2_t' ) - final_derived = diamand_hierarchy.class_( 'final_derived_t' ) - - self._test_is_based_and_derived( base, derived1, ACCESS_TYPES.PUBLIC ) - self._test_is_based_and_derived( base, derived2, ACCESS_TYPES.PUBLIC ) - self._test_is_based_and_derived( derived1, final_derived, ACCESS_TYPES.PUBLIC ) - self._test_is_based_and_derived( derived2, final_derived, ACCESS_TYPES.PUBLIC ) - self._test_is_same_bases(derived1, derived2) - - def test_fundamental_types(self): - #check whether all build in types could be constructed - errors = [] - for fundamental_type_name, fundamental_type in FUNDAMENTAL_TYPES.iteritems(): - if 'complex' in fundamental_type_name: - continue #I check this in an other tester - if isinstance( fundamental_type, java_fundamental_t ): - continue #I don't check this at all - typedef_name = 'typedef_' + fundamental_type_name.replace( ' ', '_' ) - typedef = self.global_ns.decl( decl_type=typedef_t, name=typedef_name ) - self.failUnless( typedef, "unable to find typedef to build-in type '%s'" % fundamental_type_name ) - if typedef.type.decl_string != fundamental_type.decl_string: - errors.append( "there is a difference between typedef base type name('%s') and expected one('%s')" - % (typedef.type.decl_string, fundamental_type.decl_string) ) - if self.global_ns.compiler != compilers.MSVC_PDB_9: - self.failIf( errors, pprint.pformat( errors ) ) - else: - self.failUnless( 5 == len( errors ), pprint.pformat( errors ) ) - - def test_compound_types(self): - typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_const_int' ) - self._test_type_composition( typedef_inst.type, const_t, int_t ) - - typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_pointer_int' ) - self._test_type_composition( typedef_inst.type, pointer_t, int_t ) - - typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_reference_int' ) - self._test_type_composition( typedef_inst.type, reference_t, int_t ) - - typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_const_unsigned_int_const_pointer' ) - self._test_type_composition( typedef_inst.type, const_t, pointer_t ) - self._test_type_composition( typedef_inst.type.base, pointer_t, const_t ) - self._test_type_composition( typedef_inst.type.base.base, const_t, unsigned_int_t ) - - typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_volatile_int' ) - self._test_type_composition( typedef_inst.type, volatile_t, int_t ) - - var_inst = self.global_ns.variable( 'array255' ) - self._test_type_composition( var_inst.type, array_t, int_t ) - - - typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_EFavoriteDrinks' ) - self.failUnless( isinstance( typedef_inst.type, declarated_t ) - , " typedef to enum should be 'declarated_t' instead of '%s'" % typedef_inst.type.__class__.__name__ ) - enum_declaration = self.global_ns.enum( 'EFavoriteDrinks' ) - self.failUnless( typedef_inst.type.declaration is enum_declaration - , "instance of declaration_t has reference to '%s' instead of '%s'" \ - % ( typedef_inst.type.declaration.name, enum_declaration.name ) ) - - def test_free_function_type(self): - function_ptr = self.global_ns.decl( decl_type=typedef_t, name='function_ptr' ) - self._test_type_composition( function_ptr.type, pointer_t, free_function_type_t ) - function_type = function_ptr.type.base - self.failUnless( isinstance( function_type.return_type, int_t ) - , "return function type of typedef 'function_ptr' should be '%s' instead of '%s' " \ - %( 'int_t', function_type.return_type.__class__.__name__ ) ) - self.failUnless( len( function_type.arguments_types ) == 2 - , "number of arguments of function of typedef 'function_ptr' should be 2 instead of '%d' " \ - % len( function_type.arguments_types ) ) - self.failUnless( isinstance( function_type.arguments_types[0], int_t ) - , "first argument of function of typedef 'function_ptr' should be '%s' instead of '%s' " \ - %( 'int_t', function_type.arguments_types[0].__class__.__name__ ) ) - self.failUnless( isinstance( function_type.arguments_types[1], double_t ) - , "first argument of function of typedef 'function_ptr' should be '%s' instead of '%s' " \ - %( 'double_t', function_type.arguments_types[0].__class__.__name__ ) ) - - def test_member_function_type(self): - function_ptr = self.global_ns.decl( decl_type=typedef_t, name='member_function_ptr_t') - self._test_type_composition( function_ptr.type, pointer_t, member_function_type_t ) - - function_type = function_ptr.type.base - - members_pointers = self.global_ns.class_( 'members_pointers_t' ) - self.failUnless( function_type.class_inst.declaration is members_pointers - , "member function type class should be '%s' instead of '%s'" \ - % ( members_pointers.decl_string, function_type.class_inst.decl_string ) ) - - self.failUnless( isinstance( function_type.return_type, int_t ) - , "return function type of typedef 'member_function_ptr_t' should be '%s' instead of '%s' " \ - %( 'int_t', function_type.return_type.__class__.__name__ ) ) - self.failUnless( len( function_type.arguments_types ) == 1 - , "number of arguments of function of typedef 'member_function_ptr_t' should be 1 instead of '%d' " \ - % len( function_type.arguments_types ) ) - self.failUnless( isinstance( function_type.arguments_types[0], double_t ) - , "first argument of function of typedef 'member_function_ptr_t' should be '%s' instead of '%s' " \ - %( 'double_t', function_type.arguments_types[0].__class__.__name__ ) ) - - if self.global_ns.compiler != compilers.MSVC_PDB_9: - self.failUnless( function_type.has_const, " 'member_function_ptr_t' should be const function." ) - - def test_member_variable_type(self): - if self.global_ns.compiler == compilers.MSVC_PDB_9: - return - - mv = self.global_ns.decl( decl_type=typedef_t, name='member_variable_ptr_t') - self._test_type_composition( mv.type, pointer_t, member_variable_type_t ) - - members_pointers = self.global_ns.class_( 'members_pointers_t' ) - self.failUnless( members_pointers, "unable to find class('%s')" % 'members_pointers_t' ) - self._test_type_composition( mv.type.base, member_variable_type_t, declarated_t ) - mv_type = mv.type.base - self.failUnless( mv_type.base.declaration is members_pointers - , "member function type class should be '%s' instead of '%s'" \ - % ( members_pointers.decl_string, mv_type.base.decl_string ) ) - - def test_overloading(self): - ns = self.global_ns.namespace( 'overloads' ) - - do_nothings = ns.calldefs( 'do_nothing', recursive=False ) - self.failUnless( 4 == len(do_nothings) - , "expected number of overloaded 'do_nothing' functions is %d and existing(%d) is different" \ - % ( 4, len(do_nothings) ) ) - for index, do_nothing in enumerate(do_nothings): - others = do_nothings[:index] + do_nothings[index+1:] - if set( do_nothing.overloads ) != set( others ): - print '\nexisting: ' - for x in do_nothing.overloads: - print str(x) - print '\nexpected: ' - for x in others: - print str(x) - - self.failUnless( set( do_nothing.overloads ) == set( others ) - , "there is a difference between expected function overloads and existing ones." ) - - def test_abstract_classes(self): - ns = self.global_ns.namespace( 'abstract_classes' ) - abstract_i = ns.class_( 'abstract_i' ) - self.failUnless( abstract_i.is_abstract, "class 'abstract_i' should be abstract" ) - derived_abstract_i = ns.class_( 'derived_abstract_i' ) - self.failUnless( derived_abstract_i.is_abstract, "class 'derived_abstract_i' should be abstract" ) - implementation = ns.class_( 'implementation' ) - self.failUnless( not implementation.is_abstract, "class 'implementation' should not be abstract" ) - - def test_versioning(self): - for d in self.global_ns.decls(): - self.failUnless( d.compiler ) - - def test_byte_size( self ): - mptrs = self.global_ns.class_( 'members_pointers_t' ) - self.failUnless( mptrs.byte_size != 0 ) - - def test_byte_align( self ): - mptrs = self.global_ns.class_( 'members_pointers_t' ) - if mptrs.compiler != compilers.MSVC_PDB_9: - self.failUnless( mptrs.byte_align != 0 ) - - def test_byte_offset( self ): - mptrs = self.global_ns.class_( 'members_pointers_t' ) - self.failUnless( mptrs.var( 'xxx' ).byte_offset != 0 ) - -class pdb_based_core_tester_t( core_t ): - def __init__(self, *args ): - core_t.__init__( self, *args ) - self.global_ns = autoconfig.get_pdb_global_ns() - -class core_gccxml_t( core_t ): - """Tests core algorithms of GCC-XML and GCC-XML file reader. - Those most white-box testing. - """ - global_ns = None - def __init__(self, *args ): - core_t.__init__( self, *args ) - self.test_files = [ 'core_ns_join_1.hpp' - , 'core_ns_join_2.hpp' - , 'core_ns_join_3.hpp' - , 'core_membership.hpp' - , 'core_class_hierarchy.hpp' - , 'core_types.hpp' - , 'core_diamand_hierarchy_base.hpp' - , 'core_diamand_hierarchy_derived1.hpp' - , 'core_diamand_hierarchy_derived2.hpp' - , 'core_diamand_hierarchy_final_derived.hpp' - , 'core_overloads_1.hpp' - , 'core_overloads_2.hpp' - , 'abstract_classes.hpp' - ] - self.global_ns = None - - def setUp(self): - if not core_t.global_ns: - decls = parse( self.test_files, self.config, self.COMPILATION_MODE ) - core_t.global_ns = pygccxml.declarations.get_global_namespace( decls ) - if self.INIT_OPTIMIZER: - core_t.global_ns.init_optimizer() - self.global_ns = core_t.global_ns - -class core_all_at_once_t( core_gccxml_t ): - COMPILATION_MODE = COMPILATION_MODE.ALL_AT_ONCE - INIT_OPTIMIZER = True - def __init__(self, *args): - core_gccxml_t.__init__(self, *args) - -class core_all_at_once_no_opt_t( core_gccxml_t ): - COMPILATION_MODE = COMPILATION_MODE.ALL_AT_ONCE - INIT_OPTIMIZER = False - def __init__(self, *args): - core_gccxml_t.__init__(self, *args) - -class core_file_by_file_t( core_gccxml_t ): - COMPILATION_MODE = COMPILATION_MODE.FILE_BY_FILE - INIT_OPTIMIZER = True - def __init__(self, *args): - core_gccxml_t.__init__(self, *args) - -class core_file_by_file_no_opt_t( core_gccxml_t ): - COMPILATION_MODE = COMPILATION_MODE.FILE_BY_FILE - INIT_OPTIMIZER = False - def __init__(self, *args): - core_gccxml_t.__init__(self, *args) - -def create_suite(): - suite = unittest.TestSuite() - if autoconfig.cxx_parsers_cfg.gccxml: - suite.addTest( unittest.makeSuite(core_all_at_once_t)) - suite.addTest( unittest.makeSuite(core_all_at_once_no_opt_t)) - suite.addTest( unittest.makeSuite(core_file_by_file_t)) - suite.addTest( unittest.makeSuite(core_file_by_file_no_opt_t)) - #~ if autoconfig.cxx_parsers_cfg.pdb_loader: - #~ suite.addTest( unittest.makeSuite(pdb_based_core_tester_t)) - return suite - -def run_suite(): - unittest.TextTestRunner(verbosity=2).run( create_suite() ) - -if __name__ == "__main__": - run_suite() -##~ import hotshot -##~ import hotshot.stats -##~ statistics_file = tempfile.mkstemp( suffix='.stat' )[1] -##~ profile = hotshot.Profile(statistics_file) -##~ -##~ profile.runcall( run_suite ) -##~ profile.close() -##~ statistics = hotshot.stats.load( statistics_file ) -##~ statistics.strip_dirs() -##~ statistics.sort_stats( 'time', 'calls' ) -##~ statistics.print_stats( 678 ) +# Copyright 2004-2008 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) + +import os +import sys +import pprint +import unittest +import tempfile +import autoconfig +import parser_test_case +from pprint import pformat + +import pygccxml +from pygccxml.utils import * +from pygccxml.parser import * +from pygccxml.declarations import * + +def is_sub_path( root, some_path ): + root = normalize_path( root ) + some_path = normalize_path( some_path ) + return some_path.startswith( root ) + + +class core_t( parser_test_case.parser_test_case_t ): + """Tests core algorithms of GCC-XML and GCC-XML file reader. + Those most white-box testing. + """ + global_ns = None + def __init__(self, *args ): + parser_test_case.parser_test_case_t.__init__( self, *args ) + self.global_ns = None + + def test_top_parent(self): + enum = self.global_ns.enum( '::ns::ns32::E33' ) + self.failUnless( self.global_ns is enum.top_parent ) + + #tests namespaces join functionality. described in gccxml.py + def test_nss_join(self): + #list of all namespaces + nss = [ '::ns', '::ns::ns12', '::ns::ns22', '::ns::ns32' ] + #list of all namespaces that have unnamed namespace + unnamed_nss = nss[1:] + #list of all enums [0:2] [3:5] [6:8] - has same parent + enums = [ '::E11', '::E21', '::E31' + , '::ns::E12', '::ns::E22', '::ns::E32' + , '::ns::ns12::E13', '::ns::ns22::E23', '::ns::ns32::E33' ] + + for ns in nss: + self.global_ns.namespace( ns ) + + for enum in enums: + self.global_ns.enum( enum ) + + ns = self.global_ns.namespace( nss[0] ) + ns12 = self.global_ns.namespace( nss[1] ) + ns22 = self.global_ns.namespace( nss[2] ) + ns32 = self.global_ns.namespace( nss[3] ) + self.failUnless( ns and ( ns is ns12.parent is ns22.parent is ns32.parent ) + , 'There are 2 or more instances of ns namespace.' ) + + E11 = self.global_ns.enum( enums[0] ) + E21 = self.global_ns.enum( enums[1] ) + E31 = self.global_ns.enum( enums[2] ) + self.failUnless( E11.parent is E21.parent is E31.parent + , 'There are 2 or more instances of global namespace.' ) + + nsE12 = self.global_ns.enum( enums[3] ) + nsE23 = self.global_ns.enum( enums[4] ) + nsE33 = self.global_ns.enum( enums[5] ) + self.failUnless( ns and ( ns is nsE12.parent is nsE23.parent is nsE33.parent ) + , 'There are 2 or more instances of ns namespace.' ) + + def _test_ns_membership(self, ns, enum_name ): + unnamed_enum = ns.enum( lambda d: d.name == '' \ + and is_sub_path( autoconfig.data_directory, d.location.file_name ) + , recursive=False ) + self.failUnless( unnamed_enum in ns.declarations + , "namespace '%s' does not contains unnamed enum." % ns.name ) + + enum = ns.enum( enum_name, recursive=False ) + + self.failUnless( enum in ns.declarations + , "namespace '%s' does not contains enum '%s'" % ( ns.name, enum.name ) ) + + self.failUnless( unnamed_enum.parent is ns + , "unnamed enum belong to namespace '%s' but this namespace is not it's parent." % ns.name ) + + self.failUnless( enum.parent is ns + , "enum '%s' belong to namespace '%s' but this namespace is not it's parent." % ( enum.name, ns.name ) ) + + def _test_class_membership( self, class_inst, enum_name, access ): + #getting enum through get_members function + nested_enum1 = class_inst.enum( name=enum_name, function=access_type_matcher_t( access ) ) + + #getting enum through declarations property + nested_enum2 = class_inst.enum( enum_name ) + + #it shoud be same object + self.failUnless( nested_enum1 is nested_enum2 + , "enum accessed through access definition('%s') and through declarations('%s') are different enums or instances." \ + %( nested_enum1.name, nested_enum2.name ) ) + + #check whether we meaning same class instance + self.failUnless( class_inst is nested_enum1.parent is nested_enum2.parent + , 'There are 2 or more instances of ns namespace.' ) + + #test gccxml_file_reader_t._update_membership algorithm + def test_membership(self): + core_membership = self.global_ns.namespace( 'membership' ) + self._test_ns_membership( self.global_ns, 'EGlobal' ) + self._test_ns_membership( core_membership.namespace('enums_ns'), 'EWithin' ) + self._test_ns_membership( core_membership.namespace( '' ), 'EWithinUnnamed' ) + class_nested_enums = core_membership.class_( 'class_for_nested_enums_t' ) + self._test_class_membership( class_nested_enums, 'ENestedPublic', ACCESS_TYPES.PUBLIC ) + self._test_class_membership( class_nested_enums, 'ENestedProtected', ACCESS_TYPES.PROTECTED ) + self._test_class_membership( class_nested_enums, 'ENestedPrivate', ACCESS_TYPES.PRIVATE ) + + def test_mangled(self): + std = self.global_ns.namespace( 'std' ) + self.failUnless( std, 'std namespace has not been found' ) + self.failUnless( std.mangled, 'mangled name of std namespace should be different from None' ) + + def _test_is_based_and_derived(self, base, derived, access): + dhi_v = hierarchy_info_t( derived, access, True ) + dhi_not_v = hierarchy_info_t( derived, access, False ) + self.failUnless( dhi_v in base.derived or dhi_not_v in base.derived + , "base class '%s' doesn't has derived class '%s'" %( base.name, derived.name ) ) + + bhi_v = hierarchy_info_t( base, access, True ) + bhi_not_v = hierarchy_info_t( base, access, False ) + + self.failUnless( bhi_v in derived.bases or bhi_not_v in derived.bases + , "derive class '%s' doesn't has base class '%s'" %( derived.name, base.name ) ) + + def test_class_hierarchy(self): + class_hierarchy = self.global_ns.namespace( 'class_hierarchy' ) + + base = class_hierarchy.class_( 'base_t' ) + other_base = class_hierarchy.class_( 'other_base_t' ) + derived_public = class_hierarchy.class_( 'derived_public_t' ) + derived_protected = class_hierarchy.class_( 'derived_protected_t' ) + derived_private = class_hierarchy.class_( 'derived_private_t' ) + multi_derived = class_hierarchy.class_( 'multi_derived_t' ) + + self._test_is_based_and_derived( base, derived_public, ACCESS_TYPES.PUBLIC ) + self._test_is_based_and_derived( base, derived_protected, ACCESS_TYPES.PROTECTED ) + self._test_is_based_and_derived( base, derived_private, ACCESS_TYPES.PRIVATE ) + self._test_is_based_and_derived( base, multi_derived, ACCESS_TYPES.PROTECTED ) + self._test_is_based_and_derived( other_base, multi_derived, ACCESS_TYPES.PRIVATE ) + self._test_is_based_and_derived( derived_private, multi_derived, ACCESS_TYPES.PRIVATE ) + + def _test_is_same_bases(self, derived1, derived2 ): + bases1 = set([ id(hierarchy_info.related_class) for hierarchy_info in derived1.bases ]) + bases2 = set([ id(hierarchy_info.related_class) for hierarchy_info in derived2.bases ]) + self.failUnless( bases1 == bases2 + , "derived class '%s' and derived class '%s' has references to different instance of base classes " \ + % ( derived1.name, derived2.name ) ) + + def test_class_join(self): + diamand_hierarchy = self.global_ns.namespace( 'diamand_hierarchy' ) + base = diamand_hierarchy.class_( 'base_t' ) + derived1 = diamand_hierarchy.class_( 'derived1_t' ) + derived2 = diamand_hierarchy.class_( 'derived2_t' ) + final_derived = diamand_hierarchy.class_( 'final_derived_t' ) + + self._test_is_based_and_derived( base, derived1, ACCESS_TYPES.PUBLIC ) + self._test_is_based_and_derived( base, derived2, ACCESS_TYPES.PUBLIC ) + self._test_is_based_and_derived( derived1, final_derived, ACCESS_TYPES.PUBLIC ) + self._test_is_based_and_derived( derived2, final_derived, ACCESS_TYPES.PUBLIC ) + self._test_is_same_bases(derived1, derived2) + + def test_fundamental_types(self): + #check whether all build in types could be constructed + errors = [] + for fundamental_type_name, fundamental_type in FUNDAMENTAL_TYPES.iteritems(): + if 'complex' in fundamental_type_name: + continue #I check this in an other tester + if isinstance( fundamental_type, java_fundamental_t ): + continue #I don't check this at all + typedef_name = 'typedef_' + fundamental_type_name.replace( ' ', '_' ) + typedef = self.global_ns.decl( decl_type=typedef_t, name=typedef_name ) + self.failUnless( typedef, "unable to find typedef to build-in type '%s'" % fundamental_type_name ) + if typedef.type.decl_string != fundamental_type.decl_string: + errors.append( "there is a difference between typedef base type name('%s') and expected one('%s')" + % (typedef.type.decl_string, fundamental_type.decl_string) ) + self.failIf( errors, pprint.pformat( errors ) ) + + def test_compound_types(self): + typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_const_int' ) + self._test_type_composition( typedef_inst.type, const_t, int_t ) + + typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_pointer_int' ) + self._test_type_composition( typedef_inst.type, pointer_t, int_t ) + + typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_reference_int' ) + self._test_type_composition( typedef_inst.type, reference_t, int_t ) + + typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_const_unsigned_int_const_pointer' ) + self._test_type_composition( typedef_inst.type, const_t, pointer_t ) + self._test_type_composition( typedef_inst.type.base, pointer_t, const_t ) + self._test_type_composition( typedef_inst.type.base.base, const_t, unsigned_int_t ) + + typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_volatile_int' ) + self._test_type_composition( typedef_inst.type, volatile_t, int_t ) + + var_inst = self.global_ns.variable( 'array255' ) + self._test_type_composition( var_inst.type, array_t, int_t ) + + + typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_EFavoriteDrinks' ) + self.failUnless( isinstance( typedef_inst.type, declarated_t ) + , " typedef to enum should be 'declarated_t' instead of '%s'" % typedef_inst.type.__class__.__name__ ) + enum_declaration = self.global_ns.enum( 'EFavoriteDrinks' ) + self.failUnless( typedef_inst.type.declaration is enum_declaration + , "instance of declaration_t has reference to '%s' instead of '%s'" \ + % ( typedef_inst.type.declaration.name, enum_declaration.name ) ) + + def test_free_function_type(self): + function_ptr = self.global_ns.decl( decl_type=typedef_t, name='function_ptr' ) + self._test_type_composition( function_ptr.type, pointer_t, free_function_type_t ) + function_type = function_ptr.type.base + self.failUnless( isinstance( function_type.return_type, int_t ) + , "return function type of typedef 'function_ptr' should be '%s' instead of '%s' " \ + %( 'int_t', function_type.return_type.__class__.__name__ ) ) + self.failUnless( len( function_type.arguments_types ) == 2 + , "number of arguments of function of typedef 'function_ptr' should be 2 instead of '%d' " \ + % len( function_type.arguments_types ) ) + self.failUnless( isinstance( function_type.arguments_types[0], int_t ) + , "first argument of function of typedef 'function_ptr' should be '%s' instead of '%s' " \ + %( 'int_t', function_type.arguments_types[0].__class__.__name__ ) ) + self.failUnless( isinstance( function_type.arguments_types[1], double_t ) + , "first argument of function of typedef 'function_ptr' should be '%s' instead of '%s' " \ + %( 'double_t', function_type.arguments_types[0].__class__.__name__ ) ) + + def test_member_function_type(self): + function_ptr = self.global_ns.decl( decl_type=typedef_t, name='member_function_ptr_t') + self._test_type_composition( function_ptr.type, pointer_t, member_function_type_t ) + + function_type = function_ptr.type.base + + members_pointers = self.global_ns.class_( 'members_pointers_t' ) + self.failUnless( function_type.class_inst.declaration is members_pointers + , "member function type class should be '%s' instead of '%s'" \ + % ( members_pointers.decl_string, function_type.class_inst.decl_string ) ) + + self.failUnless( isinstance( function_type.return_type, int_t ) + , "return function type of typedef 'member_function_ptr_t' should be '%s' instead of '%s' " \ + %( 'int_t', function_type.return_type.__class__.__name__ ) ) + self.failUnless( len( function_type.arguments_types ) == 1 + , "number of arguments of function of typedef 'member_function_ptr_t' should be 1 instead of '%d' " \ + % len( function_type.arguments_types ) ) + self.failUnless( isinstance( function_type.arguments_types[0], double_t ) + , "first argument of function of typedef 'member_function_ptr_t' should be '%s' instead of '%s' " \ + %( 'double_t', function_type.arguments_types[0].__class__.__name__ ) ) + + self.failUnless( function_type.has_const, " 'member_function_ptr_t' should be const function." ) + + def test_member_variable_type(self): + mv = self.global_ns.decl( decl_type=typedef_t, name='member_variable_ptr_t') + self._test_type_composition( mv.type, pointer_t, member_variable_type_t ) + + members_pointers = self.global_ns.class_( 'members_pointers_t' ) + self.failUnless( members_pointers, "unable to find class('%s')" % 'members_pointers_t' ) + self._test_type_composition( mv.type.base, member_variable_type_t, declarated_t ) + mv_type = mv.type.base + self.failUnless( mv_type.base.declaration is members_pointers + , "member function type class should be '%s' instead of '%s'" \ + % ( members_pointers.decl_string, mv_type.base.decl_string ) ) + + def test_overloading(self): + ns = self.global_ns.namespace( 'overloads' ) + + do_nothings = ns.calldefs( 'do_nothing', recursive=False ) + self.failUnless( 4 == len(do_nothings) + , "expected number of overloaded 'do_nothing' functions is %d and existing(%d) is different" \ + % ( 4, len(do_nothings) ) ) + for index, do_nothing in enumerate(do_nothings): + others = do_nothings[:index] + do_nothings[index+1:] + if set( do_nothing.overloads ) != set( others ): + print '\nexisting: ' + for x in do_nothing.overloads: + print str(x) + print '\nexpected: ' + for x in others: + print str(x) + + self.failUnless( set( do_nothing.overloads ) == set( others ) + , "there is a difference between expected function overloads and existing ones." ) + + def test_abstract_classes(self): + ns = self.global_ns.namespace( 'abstract_classes' ) + abstract_i = ns.class_( 'abstract_i' ) + self.failUnless( abstract_i.is_abstract, "class 'abstract_i' should be abstract" ) + derived_abstract_i = ns.class_( 'derived_abstract_i' ) + self.failUnless( derived_abstract_i.is_abstract, "class 'derived_abstract_i' should be abstract" ) + implementation = ns.class_( 'implementation' ) + self.failUnless( not implementation.is_abstract, "class 'implementation' should not be abstract" ) + + def test_versioning(self): + for d in self.global_ns.decls(): + self.failUnless( d.compiler ) + + def test_byte_size( self ): + mptrs = self.global_ns.class_( 'members_pointers_t' ) + self.failUnless( mptrs.byte_size != 0 ) + + def test_byte_align( self ): + mptrs = self.global_ns.class_( 'members_pointers_t' ) + self.failUnless( mptrs.byte_align != 0 ) + + def test_byte_offset( self ): + mptrs = self.global_ns.class_( 'members_pointers_t' ) + self.failUnless( mptrs.var( 'xxx' ).byte_offset != 0 ) + + +class core_gccxml_t( core_t ): + """Tests core algorithms of GCC-XML and GCC-XML file reader. + Those most white-box testing. + """ + global_ns = None + def __init__(self, *args ): + core_t.__init__( self, *args ) + self.test_files = [ 'core_ns_join_1.hpp' + , 'core_ns_join_2.hpp' + , 'core_ns_join_3.hpp' + , 'core_membership.hpp' + , 'core_class_hierarchy.hpp' + , 'core_types.hpp' + , 'core_diamand_hierarchy_base.hpp' + , 'core_diamand_hierarchy_derived1.hpp' + , 'core_diamand_hierarchy_derived2.hpp' + , 'core_diamand_hierarchy_final_derived.hpp' + , 'core_overloads_1.hpp' + , 'core_overloads_2.hpp' + , 'abstract_classes.hpp' + ] + self.global_ns = None + + def setUp(self): + if not core_t.global_ns: + decls = parse( self.test_files, self.config, self.COMPILATION_MODE ) + core_t.global_ns = pygccxml.declarations.get_global_namespace( decls ) + if self.INIT_OPTIMIZER: + core_t.global_ns.init_optimizer() + self.global_ns = core_t.global_ns + +class core_all_at_once_t( core_gccxml_t ): + COMPILATION_MODE = COMPILATION_MODE.ALL_AT_ONCE + INIT_OPTIMIZER = True + def __init__(self, *args): + core_gccxml_t.__init__(self, *args) + +class core_all_at_once_no_opt_t( core_gccxml_t ): + COMPILATION_MODE = COMPILATION_MODE.ALL_AT_ONCE + INIT_OPTIMIZER = False + def __init__(self, *args): + core_gccxml_t.__init__(self, *args) + +class core_file_by_file_t( core_gccxml_t ): + COMPILATION_MODE = COMPILATION_MODE.FILE_BY_FILE + INIT_OPTIMIZER = True + def __init__(self, *args): + core_gccxml_t.__init__(self, *args) + +class core_file_by_file_no_opt_t( core_gccxml_t ): + COMPILATION_MODE = COMPILATION_MODE.FILE_BY_FILE + INIT_OPTIMIZER = False + def __init__(self, *args): + core_gccxml_t.__init__(self, *args) + +def create_suite(): + suite = unittest.TestSuite() + if autoconfig.cxx_parsers_cfg.gccxml: + suite.addTest( unittest.makeSuite(core_all_at_once_t)) + suite.addTest( unittest.makeSuite(core_all_at_once_no_opt_t)) + suite.addTest( unittest.makeSuite(core_file_by_file_t)) + suite.addTest( unittest.makeSuite(core_file_by_file_no_opt_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() +##~ import hotshot +##~ import hotshot.stats +##~ statistics_file = tempfile.mkstemp( suffix='.stat' )[1] +##~ profile = hotshot.Profile(statistics_file) +##~ +##~ profile.runcall( run_suite ) +##~ profile.close() +##~ statistics = hotshot.stats.load( statistics_file ) +##~ statistics.strip_dirs() +##~ statistics.sort_stats( 'time', 'calls' ) +##~ statistics.print_stats( 678 ) Modified: pygccxml_dev/unittests/data/core_cache.hpp =================================================================== --- pygccxml_dev/unittests/data/core_cache.hpp 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/unittests/data/core_cache.hpp 2009-05-10 18:14:04 UTC (rev 1709) @@ -22,4 +22,4 @@ #endif//__core_cache_hpp__ -//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file +//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file Modified: pygccxml_dev/unittests/templates_tester.py =================================================================== --- pygccxml_dev/unittests/templates_tester.py 2009-04-28 05:49:45 UTC (rev 1708) +++ pygccxml_dev/unittests/templates_tester.py 2009-05-10 18:14:04 UTC (rev 1709) @@ -1,76 +1,76 @@ -#! /usr/bin/python -# Copyright 2004-2008 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) - -import unittest -import autoconfig -import pygccxml -from pygccxml.utils import * -from pygccxml.parser import * -from pygccxml import declarations - -class tester_t( unittest.TestCase ): - def __init__(self, *args ): - unittest.TestCase.__init__( self, *args ) - - def __test_split_impl(self, decl_string, name, args): - self.failUnless( ( name, args ) == declarations.templates.split( decl_string ) ) - - def __test_split_recursive_impl(self, decl_string, control_seq): - self.failUnless( control_seq == declarations.templates.split_recursive( decl_string ) ) - - def __test_is_template_impl( self, decl_string ): - self.failUnless( declarations.templates.is_instantiation( decl_string ) ) - - def test_split_on_vector(self): - self.__test_is_template_impl( "vector<int,std::allocator<int> >" ) - - self.__test_split_impl( "vector<int,std::allocator<int> >" - , "vector" - , [ "int", "std::allocator<int>" ] ) - - self.__test_split_recursive_impl( "vector<int,std::allocator<int> >" - , [ ( "vector", [ "int", "std::allocator<int>" ] ) - , ( "std::allocator", ["int"] ) ] ) - - def test_split_on_string(self): - self.__test_is_template_impl( "basic_string<char,std::char_traits<char>,std::allocator<char> >" ) - - self.__test_split_impl( "basic_string<char,std::char_traits<char>,std::allocator<char> >" - , "basic_string" - , [ "char", "std::char_traits<char>", "std::allocator<char>" ] ) - - def test_split_on_map(self): - self.__test_is_template_impl( "map<long int,std::vector<int, std::allocator<int> >,std::less<long int>,std::allocator<std::pair<const long int, std::vector<int, std::allocator<int> > > > >" ) - - self.__test_split_impl( "map<long int,std::vector<int, std::allocator<int> >,std::less<long int>,std::allocator<std::pair<const long int, std::vector<int, std::allocator<int> > > > >" - , "map" - , [ "long int" - , "std::vector<int, std::allocator<int> >" - , "std::less<long int>" - , "std::allocator<std::pair<const long int, std::vector<int, std::allocator<int> > > >" ] ) - - def test_join_on_vector(self): - self.failUnless( "vector< int, std::allocator<int> >" - == declarations.templates.join("vector", ( "int", "std::allocator<int>" ) ) ) - - def test_bug_is_tmpl_inst(self): - self.failUnless( False == declarations.templates.is_instantiation( "::FX::QMemArray<unsigned char>::setRawData" ) ) - - def test_split_bug_fptr(self): - x = 'map<std::string, bool (*)(std::string&, Ogre::MaterialScriptContext&), std::less<std::string>, std::allocator<std::pair<std::string const, bool (*)(std::string&, Ogre::MaterialScriptContext&)> > >' - name, args = declarations.templates.split( x ) - self.failUnless( len(x) == 4 ) - -def create_suite(): - suite = unittest.TestSuite() - suite.addTest( unittest.makeSuite(tester_t)) - return suite - -def run_suite(): - unittest.TextTestRunner(verbosity=2).run( create_suite() ) - -if __name__ == "__main__": - run_suite() \ No newline at end of file +#! /usr/bin/python +# Copyright 2004-2008 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) + +import unittest +import autoconfig +import pygccxml +from pygccxml.utils import * +from pygccxml.parser import * +from pygccxml import declarations + +class tester_t( unittest.TestCase ): + def __init__(self, *args ): + unittest.TestCase.__init__( self, *args ) + + def __test_split_impl(self, decl_string, name, args): + self.failUnless( ( name, args ) == declarations.templates.split( decl_string ) ) + + def __test_split_recursive_impl(self, decl_string, control_seq): + self.failUnless( control_seq == declarations.templates.split_recursive( decl_string ) ) + + def __test_is_template_impl( self, decl_string ): + self.failUnless( declarations.templates.is_instantiation( decl_string ) ) + + def test_split_on_vector(self): + self.__test_is_template_impl( "vector<int,std::allocator<int> >" ) + + self.__test_split_impl( "vector<int,std::allocator<int> >" + , "vector" + , [ "int", "std::allocator<int>" ] ) + + self.__test_split_recursive_impl( "vector<int,std::allocator<int> >" + , [ ( "vector", [ "int", "std::allocator<int>" ] ) + , ( "std::allocator", ["int"] ) ] ) + + def test_split_on_string(self): + self.__test_is_template_impl( "basic_string<char,std::char_traits<char>,std::allocator<char> >" ) + + self.__test_split_impl( "basic_string<char,std::char_traits<char>,std::allocator<char> >" + , "basic_string" + , [ "char", "std::char_traits<char>", "std::allocator<char>" ] ) + + def test_split_on_map(self): + self.__test_is_template_impl( "map<long int,std::vector<int, std::allocator<int> >,std::less<long int>,std::allocator<std::pair<const long int, std::vector<int, std::allocator<int> > > > >" ) + + self.__test_split_impl( "map<long int,std::vector<int, std::allocator<int> >,std::less<long int>,std::allocator<std::pair<const long int, std::vector<int, std::allocator<int> > > > >" + , "map" + , [ "long int" + , "std::vector<int, std::allocator<int> >" + , "std::less<long int>" + , "std::allocator<std::pair<const long int, std::vector<int, std::allocator<int> > > >" ] ) + + def test_join_on_vector(self): + self.failUnless( "vector< int, std::allocator<int> >" + == declarations.templates.join("vector", ( "int", "std::allocator<int>" ) ) ) + + def test_bug_is_tmpl_inst(self): + self.failUnless( False == declarations.templates.is_instantiation( "::FX::QMemArray<unsigned char>::setRawData" ) ) + + def test_split_bug_fptr(self): + x = 'map<std::string, bool (*)(std::string&, Ogre::MaterialScriptContext&), std::less<std::string>, std::allocator<std::pair<std::string const, bool (*)(std::string&, Ogre::MaterialScriptContext&)> > >' + name, args = declarations.templates.split( x ) + self.failUnless( len(x) == 4, "This test is expected to fail." ) + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-04-28 05:49:55
|
Revision: 1708 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1708&view=rev Author: roman_yakovenko Date: 2009-04-28 05:49:45 +0000 (Tue, 28 Apr 2009) Log Message: ----------- small patch from Patrick Hartling - use original argument type for function definition Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py Modified: pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py 2009-04-24 19:52:44 UTC (rev 1707) +++ pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py 2009-04-28 05:49:45 UTC (rev 1708) @@ -18,9 +18,9 @@ use_enum_workaround = False class argument_utils_t: - + PARAM_SEPARATOR = code_creator.code_creator_t.PARAM_SEPARATOR - + def __init__( self, declaration, identifier_creator, arguments=None ): self.__decl = declaration if None is arguments: @@ -57,7 +57,7 @@ if declarations.is_fundamental( arg_type_no_alias ) \ 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.partial_decl_string + result.append( '=(%s)(%s)' % ( arg.type.partial_decl_string , arg.default_value ) ) elif self.__should_use_enum_wa( arg ): #Work around for bug/missing functionality in boost.python. @@ -87,7 +87,7 @@ if len( args ) == 1: return args[ 0 ] return self.PARAM_SEPARATOR.join( args ) - + def call_args( self ): params = [] for index, arg in enumerate( self.__args ): @@ -106,7 +106,7 @@ self.__return_stmt = None self.__result_var = result_var self.__call_policy_alias = controller.register_variable_name( 'call_policies_t' ) - + @property def pre_return_code( self ): if None is self.__pre_return_code: @@ -124,11 +124,11 @@ return self.__pre_return_code @property - def statement( self ): + def statement( self ): if None is self.__return_stmt: stmt = '' - bpl_object = algorithm.create_identifier( self.__creator, 'boost::python::object' ) - make_tuple = algorithm.create_identifier( self.__creator, 'boost::python::make_tuple' ) + bpl_object = algorithm.create_identifier( self.__creator, 'boost::python::object' ) + make_tuple = algorithm.create_identifier( self.__creator, 'boost::python::make_tuple' ) make_object = algorithm.create_identifier( self.__creator, 'pyplusplus::call_policies::make_object' ) if not declarations.is_void( self.__function.return_type ): @@ -136,23 +136,23 @@ self.__return_vars.insert( 0, self.__result_var.name ) else: self.__return_vars.insert( 0 - , declarations.call_invocation.join( + , declarations.call_invocation.join( declarations.templates.join( make_object , [self.__call_policy_alias, self.__result_var.type.decl_string] ) , [self.__result_var.name] ) ) - + if 0 == len( self.__return_vars ): pass elif 1 == len( self.__return_vars ): stmt = bpl_object + '( %s )' % self.__return_vars[ 0 ] - else: # 1 < + else: # 1 < stmt = declarations.call_invocation.join( make_tuple, self.__return_vars ) if self.__creator.LINE_LENGTH < len( stmt ): - stmt = declarations.call_invocation.join( + stmt = declarations.call_invocation.join( make_tuple , self.__return_vars , os.linesep + self.__creator.indent( self.__creator.PARAM_SEPARATOR, 6 ) ) - + if stmt: stmt = 'return ' + stmt + ';' self.__return_stmt = stmt This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |