pygccxml-commit Mailing List for C++ Python language bindings (Page 74)
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: <mb...@us...> - 2006-04-28 16:18:59
|
Revision: 16 Author: mbaas Date: 2006-04-28 09:18:49 -0700 (Fri, 28 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=16&view=rev Log Message: ----------- Updated the setup script so that it can be used to create source archives. Added a MANIFEST.in file. Modified Paths: -------------- pyplusplus_dev/setup.py Added Paths: ----------- pyplusplus_dev/MANIFEST.in Property Changed: ---------------- pyplusplus_dev/ Property changes on: pyplusplus_dev ___________________________________________________________________ Name: svn:ignore + build dist MANIFEST *.pyc Added: pyplusplus_dev/MANIFEST.in =================================================================== --- pyplusplus_dev/MANIFEST.in (rev 0) +++ pyplusplus_dev/MANIFEST.in 2006-04-28 16:18:49 UTC (rev 16) @@ -0,0 +1,15 @@ +include LICENSE_1_0.txt +include MANIFEST.in +include unittests/*.py +include unittests/data/* +recursive-include docs/apidocs *.css +recursive-include docs/apidocs *.html +include docs/*.rest +include docs/*.png +include docs/*.html +include docs/comparisons/* +recursive-include docs/examples * +include docs/history/* +include docs/logos/* +include docs/tutorials/* +recursive-include examples/* Modified: pyplusplus_dev/setup.py =================================================================== --- pyplusplus_dev/setup.py 2006-04-28 16:14:47 UTC (rev 15) +++ pyplusplus_dev/setup.py 2006-04-28 16:18:49 UTC (rev 16) @@ -3,25 +3,80 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -import os +import sys, os, os.path from distutils import sysconfig from distutils.core import setup - -setup( name="pyplusplus" - , description="pyplusplus is a framework of components for creating C++ code generator for boost.python library" - , author="Roman Yakovenko" - , author_email="rom...@gm..." - , url='http://pyplusplus.sourceforge.net' - , scripts= map( lambda script_name: os.path.join( 'pyplusplus', 'scripts', script_name ) - , os.listdir( os.path.join( 'pyplusplus', 'scripts' ) ) ) - , packages=[ 'pyplusplus' - , 'pyplusplus.gui' - , 'pyplusplus.file_writers' - , 'pyplusplus.code_creators' - , 'pyplusplus.module_creator' - , 'pyplusplus.code_repository' - , 'pyplusplus.decl_wrappers' - , 'pyplusplus.module_builder' - , 'pyplusplus.utils' - , 'pyplusplus._logging_'] +from distutils.cmd import Command + +try: + sys.path.append("../pygccxml_dev") + import pygccxml + pygccxml_available = True +except ImportError: + pygccxml_available = False + + +def generate_doc(): + """Generate the epydoc reference manual. + """ + if not pygccxml_available: + print "Please install pygccxml before generating the docs." + sys.exit() + + print "Generating epydoc files..." + options = [ '--output="%s"'%os.path.join('docs', 'apidocs'), + '--docformat=epytext', + '--url=http://www.language-binding.net', + '--name=pyplusplus', +# '--verbose', + 'pyplusplus'] + cmd_line = "epydoc " + ' '.join( options ) + print cmd_line + os.system(cmd_line) + + +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 = "pyplusplus", + version = "0.7.1", + description="pyplusplus 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.gui', + 'pyplusplus.file_writers', + 'pyplusplus.code_creators', + 'pyplusplus.module_creator', + 'pyplusplus.code_repository', + 'pyplusplus.decl_wrappers', + 'pyplusplus.module_builder', + 'pyplusplus.utils', + 'pyplusplus._logging_'], + cmdclass = {"doc" : doc_cmd} ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mb...@us...> - 2006-04-28 16:15:05
|
Revision: 15 Author: mbaas Date: 2006-04-28 09:14:47 -0700 (Fri, 28 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=15&view=rev Log Message: ----------- Added *.pyc to the ignore list Property Changed: ---------------- pyplusplus_dev/pyplusplus/ pyplusplus_dev/pyplusplus/_logging_/ pyplusplus_dev/pyplusplus/code_creators/ pyplusplus_dev/pyplusplus/code_repository/ pyplusplus_dev/pyplusplus/decl_wrappers/ pyplusplus_dev/pyplusplus/file_writers/ pyplusplus_dev/pyplusplus/gui/ pyplusplus_dev/pyplusplus/module_builder/ pyplusplus_dev/pyplusplus/module_creator/ pyplusplus_dev/pyplusplus/utils/ Property changes on: pyplusplus_dev/pyplusplus ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/_logging_ ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/code_creators ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/code_repository ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/decl_wrappers ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/file_writers ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/gui ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/module_builder ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/module_creator ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pyplusplus_dev/pyplusplus/utils ___________________________________________________________________ Name: svn:ignore + *.pyc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mb...@us...> - 2006-04-28 10:16:16
|
Revision: 14 Author: mbaas Date: 2006-04-28 03:15:53 -0700 (Fri, 28 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=14&view=rev Log Message: ----------- Updated the URL Modified Paths: -------------- pygccxml_dev/setup.py Modified: pygccxml_dev/setup.py =================================================================== --- pygccxml_dev/setup.py 2006-04-28 10:11:07 UTC (rev 13) +++ pygccxml_dev/setup.py 2006-04-28 10:15:53 UTC (rev 14) @@ -54,7 +54,7 @@ description = "GCC-XML generated file reader", author = "Roman Yakovenko", author_email = "rom...@gm...", - url = 'http://pygccxml.sourceforge.net', + url = 'http://www.language-binding.net/pygccxml/pygccxml.html', packages = [ 'pygccxml', 'pygccxml.declarations', 'pygccxml.parser', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mb...@us...> - 2006-04-28 10:11:12
|
Revision: 13 Author: mbaas Date: 2006-04-28 03:11:07 -0700 (Fri, 28 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=13&view=rev Log Message: ----------- Added some generated directories/files to the ignore list Property Changed: ---------------- pygccxml_dev/ Property changes on: pygccxml_dev ___________________________________________________________________ Name: svn:ignore + build dist MANIFEST This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mb...@us...> - 2006-04-28 10:09:55
|
Revision: 12 Author: mbaas Date: 2006-04-28 03:09:48 -0700 (Fri, 28 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=12&view=rev Log Message: ----------- Modified the setup script so that it can be used to create source distributions. Added MANIFEST.in. Modified Paths: -------------- pygccxml_dev/setup.py Added Paths: ----------- pygccxml_dev/MANIFEST.in Added: pygccxml_dev/MANIFEST.in =================================================================== --- pygccxml_dev/MANIFEST.in (rev 0) +++ pygccxml_dev/MANIFEST.in 2006-04-28 10:09:48 UTC (rev 12) @@ -0,0 +1,11 @@ +include LICENSE_1_0.txt +include unittests/*.py +include unittests/data/* +recursive-include docs/apidocs *.css +recursive-include docs/apidocs *.html +include docs/*.rest +include docs/*.png +include docs/example/* +include docs/history/* +include docs/logos/* + Modified: pygccxml_dev/setup.py =================================================================== --- pygccxml_dev/setup.py 2006-04-28 10:07:47 UTC (rev 11) +++ pygccxml_dev/setup.py 2006-04-28 10:09:48 UTC (rev 12) @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at @@ -3,14 +4,59 @@ # http://www.boost.org/LICENSE_1_0.txt) -import os +import sys, os, os.path from distutils import sysconfig from distutils.core import setup +from distutils.cmd import Command -setup( name="pygccxml" - , description="GCC-XML generated file reader" - , author="Roman Yakovenko" - , packages=[ 'pygccxml' - , 'pygccxml.declarations' - , 'pygccxml.parser' - , 'pygccxml.utils' ] +def generate_doc(): + """Generate the epydoc reference manual. + """ + print "Generating epydoc files..." + options = [ '--output="%s"'%os.path.join('docs', 'apidocs'), + '--docformat=epytext', + '--url=http://www.language-binding.net', + '--name=pygccxml', +# '--verbose', + 'pygccxml'] + cmd_line = "epydoc " + ' '.join( options ) + print cmd_line + os.system(cmd_line) + + +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 = "0.7.2", + description = "GCC-XML generated file reader", + author = "Roman Yakovenko", + author_email = "rom...@gm...", + url = 'http://pygccxml.sourceforge.net', + packages = [ 'pygccxml', + 'pygccxml.declarations', + 'pygccxml.parser', + 'pygccxml.utils' ], + cmdclass = {"doc" : doc_cmd} ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mb...@us...> - 2006-04-28 10:07:55
|
Revision: 11 Author: mbaas Date: 2006-04-28 03:07:47 -0700 (Fri, 28 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=11&view=rev Log Message: ----------- Added *.pyc files to the svn:ignore property Property Changed: ---------------- pygccxml_dev/pygccxml/ pygccxml_dev/pygccxml/declarations/ pygccxml_dev/pygccxml/parser/ pygccxml_dev/pygccxml/utils/ Property changes on: pygccxml_dev/pygccxml ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pygccxml_dev/pygccxml/declarations ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pygccxml_dev/pygccxml/parser ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: pygccxml_dev/pygccxml/utils ___________________________________________________________________ Name: svn:ignore + *.pyc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mb...@us...> - 2006-04-28 07:37:45
|
Revision: 10 Author: mbaas Date: 2006-04-28 00:37:38 -0700 (Fri, 28 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=10&view=rev Log Message: ----------- Deleted some files that are not required for the unittests Removed Paths: ------------- pygccxml_dev/unittests/data/gccxml.xsl pygccxml_dev/unittests/example.py pygccxml_dev/unittests/pygccxml.profile pygccxml_dev/unittests/windows.py Deleted: pygccxml_dev/unittests/data/gccxml.xsl =================================================================== --- pygccxml_dev/unittests/data/gccxml.xsl 2006-04-27 06:18:41 UTC (rev 9) +++ pygccxml_dev/unittests/data/gccxml.xsl 2006-04-28 07:37:38 UTC (rev 10) @@ -1,989 +0,0 @@ -<?xml version="1.0"?> -<xsl:stylesheet - xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" - version = "1.0"> - <xsl:output method="html"/> - - <xsl:template match = "GCC_XML"> - - <!-- =============================================== --> - <table border="0"> - <tr><td>A</td><td ><a href="#TA">Array Types</a></td></tr> - <tr><td>B</td><td ><a href="#TB">Builtins</a></td></tr> - <tr><td>Co</td><td ><a href="#TC">Constructors</a></td></tr> - <tr><td>Cvt</td><td ><a href="#TCT">Converter</a></td></tr> - <tr><td>Q</td><td ><a href="#TQ">Cvq Types</a></td></tr> - <tr><td>Z</td><td ><a href="#TZ">Classes</a></td></tr> - <tr><td>D</td><td ><a href="#TD">Destructors</a></td></tr> - <tr><td>E</td><td ><a href="#TE">Enumerations</a></td></tr> - <tr><td>Fd</td><td ><a href="#TFd">Fields</a></td></tr> - <tr><td>Fu</td><td ><a href="#TF">Functions</a></td></tr> - <tr><td>FT</td><td ><a href="#TFT">Function Types</a></td></tr> - <tr><td>M</td><td ><a href="#TM">Methods</a></td></tr> - <tr><td>MT</td><td ><a href="#TMT">Method Typess</a></td></tr> - <tr><td>N</td><td ><a href="#TN">Namespaces</a></td></tr> - <tr><td>OpM</td><td ><a href="#TOM">Operator Methods</a></td></tr> - <tr><td>OpF</td><td ><a href="#TOF">Operator Functions</a></td></tr> - <tr><td>O</td><td ><a href="#TO">Offset Types</a></td></tr> - <tr><td>P</td><td ><a href="#TP">Pointer Types</a></td></tr> - <tr><td>R</td><td ><a href="#TR">Reference Types</a></td></tr> - <tr><td>S</td><td ><a href="#TS">Structures</a></td></tr> - <tr><td>TT</td><td ><a href="#TT">Typedefs</a></td></tr> - <tr><td>U</td><td ><a href="#TU">Unions</a></td></tr> - <tr><td>V</td><td ><a href="#TV">Variables</a></td></tr> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TB"></a> - <thead> - <tr align="center" colspan="5">Builtin Types</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - </tr> - </thead> - <xsl:apply-templates select="FundamentalType"> - <xsl:sort select="@id"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TN"></a> - <thead> - <tr align="center" colspan="5">Namespaces</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">members</td> - </tr> - </thead> - <xsl:apply-templates select="Namespace"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TZ"></a> - <thead> - <tr align="center" colspan="5">Classes</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">bases</td> - <td align="center">members</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Class"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TS"></a> - <thead> - <tr align="center" colspan="5">Structures</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">bases</td> - <td align="center">members</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Struct"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TU"></a> - <thead> - <tr align="center" colspan="5">Unions</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">bases</td> - <td align="center">members</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Union"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TFd"></a> - <thead> - <tr align="center" colspan="5">Fields</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">type</td> - <td align="center">bits</td> - <td align="center">access</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Field"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TT"></a> - <thead> - <tr align="center" colspan="5">Typedefs</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">type</td> - </tr> - </thead> - <xsl:apply-templates select="Typedef"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TA"></a> - <thead> - <tr align="center" colspan="2">Arrays</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">type</td> - <td align="center">min</td> - <td align="center">max</td> - </tr> - </thead> - <xsl:apply-templates select="ArrayType"> - <xsl:sort select="@id"/> - </xsl:apply-templates> - </table><hr/> - - - <!-- =============================================== --> - <table border="1"> - <a name="TP"></a> - <thead> - <tr align="center" colspan="2">Pointers</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">type</td> - </tr> - </thead> - <xsl:apply-templates select="PointerType"> - <xsl:sort select="@id"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TO"></a> - <thead> - <tr align="center" colspan="2">Offset Types</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">basetype</td> - <td align="center">type</td> - </tr> - </thead> - <xsl:apply-templates select="OffsetType"> - <xsl:sort select="@id"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TR"></a> - <thead> - <tr align="center" colspan="2">References</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">type</td> - </tr> - </thead> - <xsl:apply-templates select="ReferenceType"> - <xsl:sort select="@id"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TQ"></a> - <thead> - <tr align="center" colspan="2">CVQ Types</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">type</td> - </tr> - </thead> - <xsl:apply-templates select="CvQualifiedType"> - <xsl:sort select="@id"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TV"></a> - <thead> - <tr align="center" colspan="5">Variables</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">type</td> - <td align="center">access</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Variable"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TM"></a> - <thead> - <tr align="center" colspan="5">Methods</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">returns</td> - <td align="center">throws</td> - <td align="center">arguments</td> - <td align="center">access</td> - <td align="center">static</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Method"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TOM"></a> - <thead> - <tr align="center" colspan="5">Operator Methods</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">returns</td> - <td align="center">throws</td> - <td align="center">arguments</td> - <td align="center">access</td> - <td align="center">static</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="OperatorMethod"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TMT"></a> - <thead> - <tr align="center" colspan="5">Method Types</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">basetype</td> - <td align="center">returns</td> - <td align="center">arguments</td> - <td align="center">const</td> - </tr> - </thead> - <xsl:apply-templates select="MethodType"> - <xsl:sort select="@id"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TCT"></a> - <thead> - <tr align="center" colspan="5">Converters</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">returns</td> - <td align="center">throws</td> - <td align="center">access</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Converter"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TF"></a> - <thead> - <tr align="center" colspan="5">Functions</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">returns</td> - <td align="center">throws</td> - <td align="center">arguments</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Function"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TOF"></a> - <thead> - <tr align="center" colspan="5">Operator Functions</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">returns</td> - <td align="center">throws</td> - <td align="center">arguments</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="OperatorFunction"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TFT"></a> - <thead> - <tr align="center" colspan="5">Function Types</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">returns</td> - <td align="center">arguments</td> - </tr> - </thead> - <xsl:apply-templates select="FunctionType"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TC"></a> - <thead> - <tr align="center" colspan="5">Constructors</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">throws</td> - <td align="center">arguments</td> - <td align="center">access</td> - <td align="center">artificial</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Constructor"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TD"></a> - <thead> - <tr align="center" colspan="5">Destructors</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">throws</td> - <td align="center">access</td> - <td align="center">virtual</td> - <td align="center">artificial</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Destructor"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <a name="TE"></a> - <thead> - <tr align="center" colspan="5">Enumerations</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - <td align="center">context</td> - <td align="center">artificial</td> - <td align="center">file</td> - <td align="center">line</td> - </tr> - </thead> - <xsl:apply-templates select="Enumeration"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - <!-- =============================================== --> - <table border="1"> - <thead> - <tr align="center" colspan="5">File</tr> - <tr> - <td align="center">T</td> - <td align="center">id</td> - <td align="center">name</td> - </tr> - </thead> - <xsl:apply-templates select="File"> - <xsl:sort select="@name"/> - </xsl:apply-templates> - </table><hr/> - - </xsl:template> - - <!-- ====================================================================== --> - <xsl:template match = "Class"> - <tr> - <td>Z</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@bases" /> - </xsl:call-template> - </td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@members" /> - </xsl:call-template> - </td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Struct"> - <tr> - <td>S</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@bases" /> - </xsl:call-template> - </td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@members" /> - </xsl:call-template> - </td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Union"> - <tr> - <td>U</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@bases" /> - </xsl:call-template> - </td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@members" /> - </xsl:call-template> - </td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Namespace"> - <tr> - <td>N</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@members" /> - </xsl:call-template> - </td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Field"> - <tr> - <td>Fd</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td><a href="#{@type}"><xsl:value-of select="@type"/></a></td> - <td><xsl:value-of select="@access"/></td> - <td><xsl:value-of select="@bits"/></td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Typedef"> - <tr> - <td>T</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td><a href="#{@type}"><xsl:value-of select="@type"/></a></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "ArrayType"> - <tr> - <td>A</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="#{@type}"><xsl:value-of select="@type"/></a></td> - <td><a name="{@min}"><xsl:value-of select="@min"/></a></td> - <td><a name="{@max}"><xsl:value-of select="@max"/></a></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "PointerType"> - <tr> - <td>P</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="#{@type}"><xsl:value-of select="@type"/></a></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "OffsetType"> - <tr> - <td>O</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="#{@basetype}"><xsl:value-of select="@basetype"/></a></td> - <td><a href="#{@type}"><xsl:value-of select="@type"/></a></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "ReferenceType"> - <tr> - <td>R</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="#{@type}"><xsl:value-of select="@type"/></a></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "CvQualifiedType"> - <tr> - <td>Q</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="#{@type}"><xsl:value-of select="@type"/></a></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "FundamentalType"> - <tr> - <td>B</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Variable"> - <tr> - <td>V</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td><a href="#{@type}"><xsl:value-of select="@type"/></a></td> - <td><xsl:value-of select="@access"/></td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Method"> - <tr> - <td>M</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td><a href="#{@returns}"><xsl:value-of select="@returns"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@throw" /> - </xsl:call-template> - </td> - <td><xsl:apply-templates select="Argument"/></td> - <td><xsl:value-of select="@access"/></td> - <td> - <xsl:choose> - <xsl:when test="@static='1'">true</xsl:when> - <xsl:otherwise>false</xsl:otherwise> - </xsl:choose> - </td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "MethodType"> - <tr> - <td>MT</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="#{@basetype}"><xsl:value-of select="@basetype"/></a></td> - <td><a href="#{@returns}"><xsl:value-of select="@returns"/></a></td> - <td><xsl:apply-templates select="Argument"/></td> - <td> - <xsl:choose> - <xsl:when test="@const='1'">true</xsl:when> - <xsl:otherwise>false</xsl:otherwise> - </xsl:choose> - </td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "OperatorMethod"> - <tr> - <td>OpM</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="#{@basetype}"><xsl:value-of select="@basetype"/></a></td> - <td><a href="#{@returns}"><xsl:value-of select="@returns"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@throw" /> - </xsl:call-template> - </td> - <td><xsl:apply-templates select="Argument"/></td> - <td><xsl:value-of select="@access"/></td> - <td> - <xsl:choose> - <xsl:when test="@static='1'">true</xsl:when> - <xsl:otherwise>false</xsl:otherwise> - </xsl:choose> - </td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Converter"> - <tr> - <td>Cnv</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td><a href="#{@returns}"><xsl:value-of select="@returns"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@throw" /> - </xsl:call-template> - </td> - <td><xsl:value-of select="@access"/></td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Function"> - <tr> - <td>F</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td><a href="#{@returns}"><xsl:value-of select="@returns"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@throw" /> - </xsl:call-template> - </td> - <td><xsl:apply-templates select="Argument"/></td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "OperatorFunction"> - <tr> - <td>OpF</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td><a href="#{@returns}"><xsl:value-of select="@returns"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@throw" /> - </xsl:call-template> - </td> - <td><xsl:apply-templates select="Argument"/></td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "FunctionType"> - <tr> - <td>FT</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="#{@returns}"><xsl:value-of select="@returns"/></a></td> - <td><xsl:apply-templates select="Argument"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Destructor"> - <tr> - <td>D</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@throw" /> - </xsl:call-template> - </td> - <td><xsl:value-of select="@access"/></td> - <td> - <xsl:choose> - <xsl:when test="@virtual='1'">true</xsl:when> - <xsl:otherwise>false</xsl:otherwise> - </xsl:choose> - </td> - <td> - <xsl:choose> - <xsl:when test="@artificial='1'">true</xsl:when> - <xsl:otherwise>false</xsl:otherwise> - </xsl:choose> - </td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Constructor"> - <tr> - <td>Co</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td> - <xsl:call-template name="tokenize"> - <xsl:with-param name="string" select="@throw" /> - </xsl:call-template> - </td> - <td><xsl:apply-templates select="Argument"/></td> - <td><xsl:value-of select="@access"/></td> - <td> - <xsl:choose> - <xsl:when test="@artificial='1'">true</xsl:when> - <xsl:otherwise>false</xsl:otherwise> - </xsl:choose> - </td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Enumeration"> - <tr> - <td>En</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><xsl:value-of select="@name"/></td> - <td><a href="#{@context}"><xsl:value-of select="@context"/></a></td> - <td> - <xsl:choose> - <xsl:when test="@artificial='1'">true</xsl:when> - <xsl:otherwise>false</xsl:otherwise> - </xsl:choose> - </td> - <td><a href="#{@file}"><xsl:value-of select="@file"/></a></td> - <td><xsl:value-of select="@line"/></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "File"> - <tr> - <td>Fd</td> - <td><a name="{@id}"><xsl:value-of select="@id"/></a></td> - <td><a href="{@name}"><xsl:value-of select="@name"/></a></td> - </tr> - </xsl:template> - - <!-- =============================================== --> - <xsl:template match = "Argument"> - <a href="#{@type}"><xsl:value-of select="@type"/></a> - </xsl:template> - - <!--- ========== Tokenizer ================== --> - <xsl:template name="tokenize"> - <xsl:param name="string" select="''" /> - <xsl:param name="delimiters" select="' 	 '" /> - <xsl:choose> - <xsl:when test="not($string)" /> - <xsl:when test="not($delimiters)"> - <xsl:call-template name="_tokenize-characters"> - <xsl:with-param name="string" select="$string" /> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="_tokenize-delimiters"> - <xsl:with-param name="string" select="$string" /> - <xsl:with-param name="delimiters" select="$delimiters" /> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <!-- =============================================== --> - <xsl:template name="_tokenize-characters"> - <xsl:param name="string" /> - <xsl:if test="$string"> - <a href="#{$string}"> - <xsl:value-of select="substring($string, 1, 1)" /> - </a> - <xsl:call-template name="_tokenize-characters"> - <xsl:with-param name="string" select="substring($string, 2)" /> - </xsl:call-template> - </xsl:if> - </xsl:template> - - <!-- =============================================== --> - <xsl:template name="_tokenize-delimiters"> - <xsl:param name="string" /> - <xsl:param name="delimiters" /> - <xsl:variable name="delimiter" select="substring($delimiters, 1, 1)" /> - <xsl:choose> - <xsl:when test="not($delimiter)"> - <a href="#{$string}"> - <xsl:value-of select="$string" /> - </a> - </xsl:when> - <xsl:when test="contains($string, $delimiter)"> - <xsl:if test="not(starts-with($string, $delimiter))"> - <xsl:call-template name="_tokenize-delimiters"> - <xsl:with-param name="string" select="substring-before($string, $delimiter)" /> - <xsl:with-param name="delimiters" select="substring($delimiters, 2)" /> - </xsl:call-template> - </xsl:if> - <xsl:call-template name="_tokenize-delimiters"> - <xsl:with-param name="string" select="substring-after($string, $delimiter)" /> - <xsl:with-param name="delimiters" select="$delimiters" /> - </xsl:call-template> - </xsl:when> - - <xsl:when test="starts-with($string, 'private:')"> - <xsl:call-template name="_tokenize-delimiters"> - <xsl:with-param name="string" select="substring($string, 9)" /> - </xsl:call-template> - </xsl:when> - - <xsl:when test="starts-with($string, 'protected:')"> - <xsl:call-template name="_tokenize-delimiters"> - <xsl:with-param name="string" select="substring($string, 11)" /> - </xsl:call-template> - </xsl:when> - - <xsl:otherwise> - <xsl:call-template name="_tokenize-delimiters"> - <xsl:with-param name="string" select="$string" /> - <xsl:with-param name="delimiters" select="substring($delimiters, 2)" /> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - -</xsl:stylesheet> Deleted: pygccxml_dev/unittests/example.py =================================================================== --- pygccxml_dev/unittests/example.py 2006-04-27 06:18:41 UTC (rev 9) +++ pygccxml_dev/unittests/example.py 2006-04-28 07:37:38 UTC (rev 10) @@ -1,143 +0,0 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -import sys -import autoconfig -from pygccxml import * - -class printer_t( declarations.decl_visitor_t ): - JUSTIFY = 20 - INTEND_SIZE = 4 - - def __init__( self, level=0 ): - declarations.decl_visitor_t.__init__(self) - self.__inst = None - self.__level = level - - def _get_level(self): - return self.__level - level = property( _get_level ) - - def _get_inst(self): - return self.__inst - def _set_inst(self, inst): - self.__inst = inst - instance = property( _get_inst, _set_inst ) - - def __nice_decl_name( self, inst ): - name = inst.__class__.__name__ - if name.endswith( '_t' ): - name = name[:-len('_t')] - return name.replace( '_', ' ' ) - - def __print_decl_header(self): - header = self.__nice_decl_name( self.__inst ) + ": '%s'" % self.__inst.name - print ' ' * self.level * self.INTEND_SIZE + header.ljust( self.JUSTIFY ) - curr_level = self.level + 1 - if self.__inst.location: - location = 'location: ' - print ' ' * curr_level * self.INTEND_SIZE + location.ljust( self.JUSTIFY ) - curr_level += 1 - file = 'file: ' + "'%s'" % self.__inst.location.file_name - print ' ' * curr_level * self.INTEND_SIZE + file.ljust( self.JUSTIFY ) - line = 'line: ' + "'%s'" % self.__inst.location.line - print ' ' * curr_level * self.INTEND_SIZE + line.ljust( self.JUSTIFY ) - curr_level = self.level + 1 - artificial = 'artificial: ' + "'%s'" % str(self.__inst.is_artificial) - print ' ' * curr_level * self.INTEND_SIZE + artificial.ljust( self.JUSTIFY ) - - def visit_member_function( self ): - self.__print_decl_header() - - def visit_constructor( self ): - self.__print_decl_header() - - def visit_destructor( self ): - self.__print_decl_header() - - def visit_member_operator( self ): - self.__print_decl_header() - - def visit_casting_operator( self ): - self.__print_decl_header() - - def visit_free_function( self ): - self.__print_decl_header() - - def visit_free_operator( self ): - self.__print_decl_header() - - def visit_class_declaration(self ): - self.__print_decl_header() - - def visit_class(self ): - self.__print_decl_header() - curr_level = self.level + 1 - class_type = 'class type: ' + "'%s'" % str(self.__inst.class_type) - print ' ' * curr_level * self.INTEND_SIZE + class_type.ljust( self.JUSTIFY ) - - def print_hierarchy(hierarchy_type, classes, curr_level): - print ' ' * curr_level * self.INTEND_SIZE + hierarchy_type.ljust( self.JUSTIFY ) - curr_level += 1 - for class_ in classes: - class_str = 'class: ' + "'%s'" % str(class_.related_class.decl_string) - print ' ' * curr_level * self.INTEND_SIZE + class_str.ljust( self.JUSTIFY ) - access = 'access: ' + "'%s'" % str(class_.access) - print ' ' * (curr_level + 1)* self.INTEND_SIZE + access.ljust( self.JUSTIFY ) - - if self.__inst.bases: - print_hierarchy( 'base classes: ', self.__inst.bases, curr_level ) - - if self.__inst.derived: - print_hierarchy( 'derived classes: ', self.__inst.derived, curr_level ) - - def print_members(members_type, members, curr_level): - print ' ' * curr_level * self.INTEND_SIZE + members_type.ljust( self.JUSTIFY ) - curr_level += 1 - for member in members: - prn = printer_t( curr_level + 1 ) - prn.instance = member - declarations.apply_visitor( prn, member ) - - print_members( 'public: ', self.__inst.public_members, curr_level ) - print_members( 'protected: ', self.__inst.protected_members, curr_level ) - print_members( 'private: ', self.__inst.private_members, curr_level ) - - def visit_enumeration(self): - self.__print_decl_header() - curr_level = self.level + 1 - print ' ' * curr_level * self.INTEND_SIZE + 'values: '.ljust( self.JUSTIFY ) - curr_level += 1 - for name, value in self.__inst.values.items(): - print ' ' * curr_level * self.INTEND_SIZE, name, ':', value - - def visit_namespace(self ): - self.__print_decl_header() - for decl in self.__inst.declarations: - prn = printer_t( self.level + 1 ) - prn.instance = decl - declarations.apply_visitor( prn, decl ) - - def visit_typedef(self ): - self.__print_decl_header() - curr_level = self.level + 1 - print ' ' * curr_level * self.INTEND_SIZE + 'alias to: ', self.__inst.type.decl_string - - def visit_variable(self ): - self.__print_decl_header() - curr_level = self.level + 1 - print ' ' * curr_level * self.INTEND_SIZE, 'type: ', self.__inst.type.decl_string - print ' ' * curr_level * self.INTEND_SIZE, 'value: ', self.__inst.value - -if __name__ == "__main__": - include_std_header = os.path.join( autoconfig.data_directory, 'include_std.hpp' ) - include_std_header = os.path.join( autoconfig.data_directory, 'include_all.hpp' ) - decls = parser.parse( [include_std_header] ) - prn = printer_t() - for decl in decls: - prn.instance = decl - declarations.apply_visitor( prn, decl ) - Deleted: pygccxml_dev/unittests/pygccxml.profile =================================================================== (Binary files differ) Deleted: pygccxml_dev/unittests/windows.py =================================================================== --- pygccxml_dev/unittests/windows.py 2006-04-27 06:18:41 UTC (rev 9) +++ pygccxml_dev/unittests/windows.py 2006-04-28 07:37:38 UTC (rev 10) @@ -1,33 +0,0 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -import sys -import copy -import pickle -import unittest -import tempfile -import autoconfig -from pprint import pformat -from sets import Set as set - -import time -import pygccxml -from pygccxml.utils import * -from pygccxml.parser import * -from pygccxml.declarations import * - -start = time.clock() - -wins = parse( [r"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\windows.h"] ) - -end = time.clock() - -print 'parsing take ', end - start, ' seconds' - -#wins = make_flatten( wins ) -print 'len:', len(wins) -for decl in wins: - print decl.__class__.__name__, decl.name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-04-27 06:18:48
|
Revision: 9 Author: roman_yakovenko Date: 2006-04-26 23:18:41 -0700 (Wed, 26 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=9&view=rev Log Message: ----------- Fixing the bug reported by Matthias.Name of constructors is set properly now. Modified Paths: -------------- pygccxml_dev/pygccxml/parser/linker.py Modified: pygccxml_dev/pygccxml/parser/linker.py =================================================================== --- pygccxml_dev/pygccxml/parser/linker.py 2006-04-26 13:32:40 UTC (rev 8) +++ pygccxml_dev/pygccxml/parser/linker.py 2006-04-27 06:18:41 UTC (rev 9) @@ -100,14 +100,16 @@ #GCC-XML sometimes generates constructors with names that does not match #class name. I think this is because those constructors are compiler #generated. I need to find out more about this and to talk with Brad + + new_name = self.__inst.name + if templates.is_instantiation( new_name ): + new_name = templates.name( new_name ) + for decl in self.__inst.declarations: if not isinstance( decl, constructor_t ): continue - if '.' in self.__inst.name or '$' in self.__inst.name: - new_name = self.__inst.parent.name - if templates.is_instantiation( new_name ): - new_name = templates.name( new_name ) - self.__inst.name = new_name + if '.' in decl.name or '$' in decl.name: + decl.name = new_name bases = self.__inst.bases.split() self.__inst.bases = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-04-26 13:33:16
|
Revision: 8 Author: roman_yakovenko Date: 2006-04-26 06:32:40 -0700 (Wed, 26 Apr 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=8&view=rev Log Message: ----------- testing commit notification Modified Paths: -------------- pyplusplus_dev/examples/pyboost_dev/pyboost/date_time/_date_time_.suo Modified: pyplusplus_dev/examples/pyboost_dev/pyboost/date_time/_date_time_.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Roman <rom...@us...> - 2006-04-24 03:48:08
|
Update of /cvsroot/pygccxml/source/pyplusplus/module_creator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10876/pyplusplus/module_creator Modified Files: creator.py Log Message: fixing exposing functions Index: creator.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/module_creator/creator.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** creator.py 23 Apr 2006 14:39:00 -0000 1.67 --- creator.py 24 Apr 2006 03:47:58 -0000 1.68 *************** *** 394,404 **** if self.__curr_decl.ignore: return fwrapper = None self.__types_db.update( self.__curr_decl ) ! if self._is_overridable( self.__curr_decl ): class_wrapper = self.__curr_parent.wrapper fwrapper = code_creators.function_wrapper_t( function=self.__curr_decl ) class_wrapper.adopt_creator( fwrapper ) - access_level = self.__curr_decl.parent.find_out_member_access_type( self.__curr_decl ) if access_level == declarations.ACCESS_TYPES.PRIVATE: return --- 394,406 ---- if self.__curr_decl.ignore: return + if self.__curr_decl.name == 'invert_sign': + i = 0 fwrapper = None self.__types_db.update( self.__curr_decl ) ! access_level = self.__curr_decl.parent.find_out_member_access_type( self.__curr_decl ) ! if self._is_overridable( self.__curr_decl ) or access_level == declarations.ACCESS_TYPES.PROTECTED: class_wrapper = self.__curr_parent.wrapper fwrapper = code_creators.function_wrapper_t( function=self.__curr_decl ) class_wrapper.adopt_creator( fwrapper ) if access_level == declarations.ACCESS_TYPES.PRIVATE: return |
From: Roman <rom...@us...> - 2006-04-24 03:48:08
|
Update of /cvsroot/pygccxml/source/pyplusplus/code_creators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10876/pyplusplus/code_creators Modified Files: calldef.py Log Message: fixing exposing functions Index: calldef.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_creators/calldef.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** calldef.py 23 Apr 2006 14:17:27 -0000 1.54 --- calldef.py 24 Apr 2006 03:47:58 -0000 1.55 *************** *** 106,118 **** % ( pure_virtual, declarations.full_name( self.declaration ) ) ) else: ! if access_type == declarations.ACCESS_TYPES.PROTECTED: ! result.append( '(%s)(&%s)' ! % ( self.wrapper.static_function_type(), self.wrapper.static_full_name() ) ) ! else: #public not pure virtual ! if create_with_signature: result.append( '(%s)(&%s)' % ( self.declaration.decl_string, fdname ) ) else: ! result.append( '&%s' % fdname ) ! if self.wrapper: result.append( self._PARAM_SEPARATOR ) if create_with_signature: --- 106,129 ---- % ( pure_virtual, declarations.full_name( self.declaration ) ) ) else: ! if isinstance( self.declaration, declarations.member_function_t ) \ ! and self.declaration.has_static: ! if self.wrapper: ! result.append( '(%s)(&%s)' ! % ( self.wrapper.static_function_type(), self.wrapper.static_full_name() ) ) ! else: result.append( '(%s)(&%s)' % ( self.declaration.decl_string, fdname ) ) + + else: + if create_with_signature: + if access_type == declarations.ACCESS_TYPES.PROTECTED: + result.append( '(%s)(&%s)' % ( self.wrapper.function_type(), self.wrapper.full_name() ) ) + else: + result.append( '(%s)(&%s)' % ( self.declaration.decl_string, fdname ) ) else: ! if access_type == declarations.ACCESS_TYPES.PROTECTED: ! result.append( '&%s' % self.wrapper.full_name() ) ! else: ! result.append( '&%s' % fdname ) ! if self.wrapper and access_type != declarations.ACCESS_TYPES.PROTECTED: result.append( self._PARAM_SEPARATOR ) if create_with_signature: *************** *** 180,190 **** default_function_name = property( _get_default_function_name, _set_default_function_name ) - def _inst_arg_type( self ): - inst_arg_type = declarations.declarated_t( self.declaration.parent ) - if self.declaration.has_const: - inst_arg_type = declarations.const_t(inst_arg_type) - inst_arg_type = declarations.reference_t(inst_arg_type) - return inst_arg_type - def function_type(self): return declarations.member_function_type_t.create_decl_string( --- 191,194 ---- *************** *** 195,202 **** def static_function_type(self): ! arg_types = [] ! if not self.declaration.has_static: ! arg_types.append( self._inst_arg_type() ) ! arg_types.extend( map( lambda arg: arg.type, self.declaration.arguments ) ) return declarations.free_function_type_t.create_decl_string( return_type=self.declaration.return_type --- 199,203 ---- def static_function_type(self): ! arg_types = map( lambda arg: arg.type, self.declaration.arguments ) return declarations.free_function_type_t.create_decl_string( return_type=self.declaration.return_type *************** *** 247,255 **** def _create_static_declaration( self ): ! if self.declaration.has_static: ! template = 'static %(return_type)s %(name)s( %(args)s )' ! else: ! template = 'static %(return_type)s %(name)s( %(wrapped_type)s %(wrapped_inst)s%(args)s )' ! args = [] for index, arg in enumerate( self.declaration.arguments ): --- 248,253 ---- def _create_static_declaration( self ): ! template = 'static %(return_type)s %(name)s( %(args)s )' ! args = [] for index, arg in enumerate( self.declaration.arguments ): *************** *** 257,268 **** args_str = ', '.join( args ) - if args and not self.declaration.has_static: - args_str = ', ' + args_str return template % { 'return_type' : self.declaration.return_type.decl_string , 'name' : self.declaration.name - , 'wrapped_type' : self._inst_arg_type().decl_string - , 'wrapped_inst' : self._wrapped_class_inst_name , 'args' : args_str } --- 255,262 ---- *************** *** 358,367 **** } - def _create_body(self): - if self.declaration.virtuality == declarations.VIRTUALITY_TYPES.PURE_VIRTUAL: - return self._create_pure_virtual_body() - else: - return self._create_virtual_body() - def _create_default_body(self): function_call = self._create_function_call() --- 352,355 ---- *************** *** 372,417 **** return body def _create_static_body(self): assert isinstance( self.declaration, declarations.member_function_t ) ! result = [] ! fptr_type_name = 'function_ptr_t' ! fptr_var_name = 'fptr' ! ftype = self.declaration.function_type() ! if declarations.templates.is_instantiation( self.declaration.parent.name ): ! #MSVC has small problem, so this is a fix ! result.append( ''.join( ['typedef ' ! , self.declaration.parent.name ! , ' ' ! , self.parent.class_creator.alias ! , ';' ])) ! has_const_str = '' ! if self.declaration.has_const: ! has_const_str = 'const' ! typedef_str = declarations.member_function_type_t.TYPEDEF_NAME_TEMPLATE \ ! % { 'typedef_name' : fptr_type_name ! , 'return_type' : self.declaration.return_type.decl_string ! , 'class' : self.parent.class_creator.alias ! , 'arguments' : ','.join( map( lambda x: x.type.decl_string, self.declaration.arguments ) ) ! , 'has_const' : has_const_str } ! result.append( ''.join( ['typedef ' + typedef_str + ';'] ) ) ! else: ! result.append( 'typedef ' + ftype.create_typedef( fptr_type_name ) + ';' ) ! ! result.append( '%s %s(&%s);' ! % ( fptr_type_name ! , fptr_var_name ! , declarations.full_name( self.declaration ) ) ) ! template = '( %(wrapped_class_inst_name)s.*%(fptr_var_name)s )(%(args)s);' ! if self.declaration.has_static: ! template = '( *%(fptr_var_name)s )(%(args)s);' ! else: ! template = '( %(wrapped_class_inst_name)s.*%(fptr_var_name)s )(%(args)s);' ! if not declarations.is_same( self.declaration.return_type, declarations.void_t ): ! template = 'return ' + template ! result.append( template ! % dict( wrapped_class_inst_name=self._wrapped_class_inst_name ! , fptr_var_name=fptr_var_name ! , args=self._create_args_list() ) ) ! return os.linesep.join( result ) def _create_function(self): --- 360,378 ---- return body + def _create_non_virtual_body(self): + function_call = self._create_function_call() + wrapped_class_name = algorithm.create_identifier( self, self.declaration.parent.decl_string ) + body = 'this->' + wrapped_class_name + '::' + function_call + if not declarations.is_void( self.declaration.return_type ): + body = 'return ' + body + return body + def _create_static_body(self): assert isinstance( self.declaration, declarations.member_function_t ) ! fcall = '%s( %s );' % ( declarations.full_name( self.declaration ) ! , self._create_args_list() ) ! if not declarations.is_same( self.declaration.return_type, declarations.void_t() ): ! fcall = 'return ' + fcall ! return fcall def _create_function(self): *************** *** 419,424 **** if self.declaration.virtuality == declarations.VIRTUALITY_TYPES.PURE_VIRTUAL: answer.append( self.indent( self._create_pure_virtual_body() ) ) ! else: answer.append( self.indent( self._create_virtual_body() ) ) answer.append( '}' ) return os.linesep.join( answer ) --- 380,387 ---- if self.declaration.virtuality == declarations.VIRTUALITY_TYPES.PURE_VIRTUAL: answer.append( self.indent( self._create_pure_virtual_body() ) ) ! elif self.declaration.virtuality == declarations.VIRTUALITY_TYPES.VIRTUAL: answer.append( self.indent( self._create_virtual_body() ) ) + else: + answer.append( self.indent( self._create_non_virtual_body() ) ) answer.append( '}' ) return os.linesep.join( answer ) *************** *** 438,456 **** def _create_impl(self): answer = [] ! if self.declaration.virtuality != declarations.VIRTUALITY_TYPES.PURE_VIRTUAL \ ! and self.declaration.access_type == declarations.ACCESS_TYPES.PROTECTED: answer.append( self._create_static_function() ) ! if declarations.is_reference( self.declaration.return_type ): ! return os.linesep.join( answer ) ! ! if self.declaration.virtuality != declarations.VIRTUALITY_TYPES.NOT_VIRTUAL: ! if answer: ! answer.append('') answer.append( self._create_function() ) ! ! if self.declaration.virtuality == declarations.VIRTUALITY_TYPES.VIRTUAL: ! answer.append('') ! answer.append( self._create_default_function() ) return os.linesep.join( answer ) --- 401,416 ---- def _create_impl(self): + if self.declaration.name == 'invert_sign': + i = 0 answer = [] ! if self.declaration.has_static: ! #we will come here only in case the function is protected answer.append( self._create_static_function() ) ! else: answer.append( self._create_function() ) ! ! if self.declaration.virtuality == declarations.VIRTUALITY_TYPES.VIRTUAL: ! answer.append('') ! answer.append( self._create_default_function() ) return os.linesep.join( answer ) |
From: Roman <rom...@us...> - 2006-04-24 03:47:07
|
Update of /cvsroot/pygccxml/source/pygccxml/declarations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10275/pygccxml/declarations Modified Files: pattern_parser.py Log Message: Fixing bug in pattern parser Index: pattern_parser.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/pattern_parser.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pattern_parser.py 6 Apr 2006 06:15:56 -0000 1.5 --- pattern_parser.py 24 Apr 2006 03:47:01 -0000 1.6 *************** *** 109,122 **** def join( self, name, args ): args = filter( None, args) if not args: ! return ''.join( [ name ! , self.__begin ! , ' ' ! , self.__end ] ) else: ! return ''.join( [ name ! , self.__begin ! , ' ' ! , ', '.join( args ) ! , ' ' ! , self.__end ] ) \ No newline at end of file --- 109,119 ---- def join( self, name, args ): args = filter( None, args) + args_str = '' if not args: ! args_str = ' ' ! elif 1 == len( args ): ! args_str = ' ' + args[0] + ' ' else: ! args_str = ' ' + ', '.join( args ) + ' ' ! ! return ''.join( [ name, self.__begin, args_str, self.__end ] ) |
From: Roman <rom...@us...> - 2006-04-23 14:39:06
|
Update of /cvsroot/pygccxml/source/pyplusplus/module_creator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29364/pyplusplus/module_creator Modified Files: creator.py Log Message: adding new functionality: if class is used as member variabel, but does not have public assign operator, def_readonly will be used if class has pointer as member variable, it is exposed correctly Index: creator.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/module_creator/creator.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** creator.py 20 Apr 2006 05:40:04 -0000 1.66 --- creator.py 23 Apr 2006 14:39:00 -0000 1.67 *************** *** 162,169 **** members = [] for member in class_decl.public_members: ! if isinstance( member, declarations.variable_t ) \ ! and member.bits == 0 \ ! and member.name == "": ! continue #alignement bit members.append( member ) #protected and private virtual functions that not overridable and not pure --- 162,172 ---- members = [] for member in class_decl.public_members: ! if isinstance( member, declarations.variable_t ) : ! if member.bits == 0 and member.name == "": ! continue #alignement bit ! type_ = declarations.remove_const( member.type ) ! if declarations.is_pointer( type_ ) \ ! and member.type_qualifiers.has_static: ! continue #right now I don't know what code should be generated in this case members.append( member ) #protected and private virtual functions that not overridable and not pure *************** *** 239,248 **** if isinstance( member, declarations.destructor_t ): continue ! if isinstance( member, declarations.variable_t ) and member.bits: ! return True if isinstance( member, declarations.class_t ): return True - if isinstance( member, declarations.variable_t ) and declarations.is_array( member.type ): - return True if isinstance( member, declarations.member_calldef_t ): if member.access_type != declarations.ACCESS_TYPES.PUBLIC: --- 242,254 ---- if isinstance( member, declarations.destructor_t ): continue ! if isinstance( member, declarations.variable_t ): ! if member.bits: ! return True ! if declarations.is_pointer( member.type ): ! return True ! if declarations.is_array( member.type ): ! return True if isinstance( member, declarations.class_t ): return True if isinstance( member, declarations.member_calldef_t ): if member.access_type != declarations.ACCESS_TYPES.PUBLIC: *************** *** 600,603 **** --- 606,612 ---- wrapper = code_creators.array_mv_wrapper_t( variable=self.__curr_decl ) maker = code_creators.array_mv_t( variable=self.__curr_decl, wrapper=wrapper ) + elif declarations.is_pointer( self.__curr_decl.type ): + wrapper = code_creators.member_variable_wrapper_t( variable=self.__curr_decl ) + maker = code_creators.member_variable_t( variable=self.__curr_decl, wrapper=wrapper ) else: maker = code_creators.member_variable_t( variable=self.__curr_decl ) |
From: Roman <rom...@us...> - 2006-04-23 14:39:06
|
Update of /cvsroot/pygccxml/source/pyplusplus/code_creators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29364/pyplusplus/code_creators Modified Files: __init__.py code_creator.py member_variable.py Log Message: adding new functionality: if class is used as member variabel, but does not have public assign operator, def_readonly will be used if class has pointer as member variable, it is exposed correctly Index: code_creator.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_creators/code_creator.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** code_creator.py 16 Mar 2006 14:48:45 -0000 1.10 --- code_creator.py 23 Apr 2006 14:39:00 -0000 1.11 *************** *** 23,26 **** --- 23,27 ---- __INDENTATION = ' ' LINE_LENGTH = 80 + PARAM_SEPARATOR = ', ' def __init__(self, parent=None): """Constructor. Index: __init__.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_creators/__init__.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** __init__.py 16 Mar 2006 14:48:45 -0000 1.24 --- __init__.py 23 Apr 2006 14:39:00 -0000 1.25 *************** *** 61,64 **** --- 61,65 ---- from member_variable import member_variable_base_t from member_variable import member_variable_t + from member_variable import member_variable_wrapper_t from member_variable import bit_field_t from member_variable import bit_field_wrapper_t Index: member_variable.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_creators/member_variable.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** member_variable.py 20 Apr 2006 05:36:43 -0000 1.14 --- member_variable.py 23 Apr 2006 14:39:00 -0000 1.15 *************** *** 28,36 **** self._wrapper = new_wrapper wrapper = property( _get_wrapper, _set_wrapper ) - - #TODO: - #> On Wednesday, 19. April 2006 23:05, Ralf W. Grosse-Kunstleve wrote: - #> .add_property("p", make_function(&A::get_p, - #> return_value_policy<reference_existing_object>())) class member_variable_t( member_variable_base_t ): --- 28,31 ---- *************** *** 38,81 **** Creates boost.python code that exposes member variable. """ ! __PARAM_SEPARATOR = ', ' ! def __init__(self, variable, parent=None ): ! member_variable_base_t.__init__( self, variable=variable, parent=parent) ! def _generate_variable_body( self ): tmpl = None ! if not self.declaration.type_qualifiers.has_static: ! tmpl = '( "%(alias)s", &%(name)s )' else: ! tmpl = '( "%(alias)s", %(name)s )' result = tmpl % { ! 'alias' : self.alias , 'name' : algorithm.create_identifier( self, self.declaration.decl_string ) } return result ! def _generate_variable( self ): ! result = [] ! type_ = self.declaration.type if declarations.is_pointer( type_ ): type_ = declarations.remove_pointer( type_ ) if declarations.is_reference( type_ ): type_ = declarations.remove_reference( type_ ) if isinstance( type_, declarations.const_t ): ! result.append( 'def_readonly' ) else: ! result.append( 'def_readwrite' ) ! result.append( self._generate_variable_body() ) ! return ''.join( result ) def _create_impl(self): return self._generate_variable() class bit_field_t( member_variable_base_t ): """ Creates boost.python code that exposes bit fields member variables """ - - _PARAM_SEPARATOR = ', ' def __init__(self, variable, wrapper, parent=None ): member_variable_base_t.__init__( self --- 33,236 ---- Creates boost.python code that exposes member variable. """ + def __init__(self, variable, wrapper=None, parent=None ): + member_variable_base_t.__init__( self, variable=variable, wrapper=wrapper, parent=parent) ! #> On Wednesday, 19. April 2006 23:05, Ralf W. Grosse-Kunstleve wrote: ! #> .add_property("p", make_function(&A::get_p, return_value_policy<reference_existing_object>())) ! def _generate_for_pointer( self ): ! if self.declaration.type_qualifiers.has_static: ! add_property = 'add_static_property' ! else: ! add_property = 'add_property' ! answer = [ add_property ] ! answer.append( '( ' ) ! answer.append('"%s"' % self.alias) ! answer.append( self.PARAM_SEPARATOR ) ! ! call_pol = call_policies.return_value_policy( call_policies.reference_existing_object ).create( self ) ! make_function = algorithm.create_identifier( self, '::boost::python::make_function' ) ! answer.append( '%(mk_func)s( (%(getter_type)s)(&%(wfname)s), %(call_pol)s )' ! % { 'mk_func' : make_function ! , 'getter_type' : self.wrapper.getter_type ! , 'wfname' : self.wrapper.getter_full_name ! , 'call_pol' : call_pol } ) ! ! #don't generate setter method, right now I don't know how to do it. ! if False and self.wrapper.has_setter: ! answer.append( self.PARAM_SEPARATOR ) ! if self.declaration.type_qualifiers.has_static: ! call_pol = call_policies.default_call_policies().create(self) ! else: ! call_pol = call_policies.with_custodian_and_ward_postcall( 0, 1 ).create(self) ! answer.append( '%(mk_func)s( (%(setter_type)s)(&%(wfname)s), %(call_pol)s )' ! % { 'mk_func' : make_function ! , 'setter_type' : self.wrapper.setter_type ! , 'wfname' : self.wrapper.setter_full_name ! , 'call_pol' : call_pol } ) ! answer.append( ' ) ' ) ! ! code = ''.join( answer ) ! if len( code ) <= self.LINE_LENGTH: ! return code ! else: ! for i in range( len( answer ) ): ! if answer[i] == self.PARAM_SEPARATOR: ! answer[i] = os.linesep + self.indent( self.indent( self.indent( answer[i] ) ) ) ! return ''.join( answer ) ! ! def _generate_for_none_pointer( self ): tmpl = None ! if self.declaration.type_qualifiers.has_static: ! tmpl = '%(access)s( "%(alias)s", %(name)s )' else: ! tmpl = '%(access)s( "%(alias)s", &%(name)s )' ! ! access = 'def_readwrite' ! if self.is_read_only(): ! access = 'def_readonly' result = tmpl % { ! 'access' : access ! , 'alias' : self.alias , 'name' : algorithm.create_identifier( self, self.declaration.decl_string ) } + return result ! def is_read_only( self ): ! type_ = declarations.remove_alias( self.declaration.type ) if declarations.is_pointer( type_ ): type_ = declarations.remove_pointer( type_ ) + return isinstance( type_, declarations.const_t ) + if declarations.is_reference( type_ ): type_ = declarations.remove_reference( type_ ) + if isinstance( type_, declarations.const_t ): ! return True ! ! if isinstance( type_, declarations.declarated_t ) \ ! and isinstance( type_.declaration, declarations.class_t ) \ ! and not declarations.has_public_assign( type_.declaration ): ! return True ! return False ! ! def _generate_variable( self ): ! if declarations.is_pointer( self.declaration.type ): ! return self._generate_for_pointer() else: ! return self._generate_for_none_pointer() def _create_impl(self): return self._generate_variable() + class member_variable_wrapper_t( declaration_based.declaration_based_t ): + """ + Creates C++ code that creates accessor for pointer class variables + """ + #TODO: give user a way to set call policies + # treat void* pointer + indent = declaration_based.declaration_based_t.indent + MV_GET_TEMPLATE = os.linesep.join([ + 'static %(type)s get_%(name)s(%(cls_type)s inst ){' + , indent( 'return inst.%(name)s;' ) + , '}' + , '' + ]) + + MV_STATIC_GET_TEMPLATE = os.linesep.join([ + 'static %(type)s get_%(name)s(){' + , indent( 'return %(cls_type)s::%(name)s;' ) + , '}' + , '' + ]) + + MV_SET_TEMPLATE = os.linesep.join([ + 'static void set_%(name)s( %(cls_type)s inst, %(type)s new_value ){ ' + , indent( 'inst.%(name)s = new_value;' ) + , '}' + , '' + ]) + + MV_STATIC_SET_TEMPLATE = os.linesep.join([ + 'static void set_%(name)s( %(type)s new_value ){ ' + , indent( '%(cls_type)s::%(name)s = new_value;' ) + , '}' + , '' + ]) + + def __init__(self, variable, parent=None ): + declaration_based.declaration_based_t.__init__( self + , parent=parent + , declaration=variable) + + def _get_getter_full_name(self): + return self.parent.full_name + '::' + 'get_' + self.declaration.name + getter_full_name = property( _get_getter_full_name ) + + def inst_arg_type( self, has_const ): + inst_arg_type = declarations.declarated_t( self.declaration.parent ) + if has_const: + inst_arg_type = declarations.const_t(inst_arg_type) + inst_arg_type = declarations.reference_t(inst_arg_type) + return inst_arg_type + + def _get_getter_type(self): + if self.declaration.type_qualifiers.has_static: + arguments_types=[] + else: + arguments_types=[ self.inst_arg_type(True) ] + + return declarations.free_function_type_t.create_decl_string( + return_type=self.declaration.type + , arguments_types=arguments_types ) + getter_type = property( _get_getter_type ) + + def _get_setter_full_name(self): + return self.parent.full_name + '::' + 'set_' + self.declaration.name + setter_full_name = property(_get_setter_full_name) + + def _get_setter_type(self): + if self.declaration.type_qualifiers.has_static: + arguments_types=[ self.declaration.type ] + else: + arguments_types=[ self.inst_arg_type(False), self.declaration.type ] + + return declarations.free_function_type_t.create_decl_string( + return_type=declarations.void_t() + , arguments_types=arguments_types ) + setter_type = property( _get_setter_type ) + + def _get_has_setter( self ): + return not declarations.is_const( self.declaration.type.base ) + has_setter = property( _get_has_setter ) + + def _create_impl(self): + answer = [] + if self.declaration.type_qualifiers.has_static: + substitutions = { + 'type' : self.declaration.type.decl_string + , 'name' : self.declaration.name + , 'cls_type' : declarations.full_name( self.declaration.parent ) + } + answer.append( self.MV_STATIC_GET_TEMPLATE % substitutions) + if self.has_setter: + answer.append( self.MV_STATIC_SET_TEMPLATE % substitutions ) + else: + answer.append( self.MV_GET_TEMPLATE % { + 'type' : self.declaration.type.decl_string + , 'name' : self.declaration.name + , 'cls_type' : self.inst_arg_type( has_const=True ) }) + if self.has_setter: + answer.append( self.MV_SET_TEMPLATE % { + 'type' : self.declaration.type.decl_string + , 'name' : self.declaration.name + , 'cls_type' : self.inst_arg_type( has_const=False ) }) + return os.linesep.join( answer ) + class bit_field_t( member_variable_base_t ): """ Creates boost.python code that exposes bit fields member variables """ def __init__(self, variable, wrapper, parent=None ): member_variable_base_t.__init__( self *************** *** 92,101 **** answer.append( '( ' ) answer.append('"%s"' % self.alias) ! answer.append( self._PARAM_SEPARATOR ) answer.append( '(%s)(&%s)' % ( self.wrapper.getter_type, self.wrapper.getter_full_name ) ) if self.wrapper.has_setter: ! answer.append( self._PARAM_SEPARATOR ) answer.append( '(%s)(&%s)' % ( self.wrapper.setter_type, self.wrapper.setter_full_name ) ) --- 247,256 ---- answer.append( '( ' ) answer.append('"%s"' % self.alias) ! answer.append( self.PARAM_SEPARATOR ) answer.append( '(%s)(&%s)' % ( self.wrapper.getter_type, self.wrapper.getter_full_name ) ) if self.wrapper.has_setter: ! answer.append( self.PARAM_SEPARATOR ) answer.append( '(%s)(&%s)' % ( self.wrapper.setter_type, self.wrapper.setter_full_name ) ) *************** *** 107,114 **** else: for i in range( len( answer ) ): ! if answer[i] == self._PARAM_SEPARATOR: answer[i] = os.linesep + self.indent( self.indent( self.indent( answer[i] ) ) ) return ''.join( answer ) ! class bit_field_wrapper_t( declaration_based.declaration_based_t ): """ --- 262,269 ---- else: for i in range( len( answer ) ): ! if answer[i] == self.PARAM_SEPARATOR: answer[i] = os.linesep + self.indent( self.indent( self.indent( answer[i] ) ) ) return ''.join( answer ) ! class bit_field_wrapper_t( declaration_based.declaration_based_t ): """ *************** *** 177,182 **** Creates boost.python code that exposes array member variable. """ - - _PARAM_SEPARATOR = ', ' def __init__(self, variable, wrapper, parent=None ): member_variable_base_t.__init__( self --- 332,335 ---- *************** *** 193,197 **** answer.append( '( ' ) answer.append('"%s"' % self.declaration.name ) ! answer.append( os.linesep + self.indent( self._PARAM_SEPARATOR ) ) temp = [ algorithm.create_identifier( self, "::boost::python::make_function" ) ] temp.append( '( ' ) --- 346,350 ---- answer.append( '( ' ) answer.append('"%s"' % self.declaration.name ) ! answer.append( os.linesep + self.indent( self.PARAM_SEPARATOR ) ) temp = [ algorithm.create_identifier( self, "::boost::python::make_function" ) ] temp.append( '( ' ) *************** *** 200,204 **** , self.wrapper.wrapper_creator_full_name ) ) if not self.declaration.type_qualifiers.has_static: ! temp.append( os.linesep + self.indent( self._PARAM_SEPARATOR, 4 ) ) temp.append( call_policies.with_custodian_and_ward_postcall( 0, 1 ).create(self) ) temp.append( ' )' ) --- 353,357 ---- , self.wrapper.wrapper_creator_full_name ) ) if not self.declaration.type_qualifiers.has_static: ! temp.append( os.linesep + self.indent( self.PARAM_SEPARATOR, 4 ) ) temp.append( call_policies.with_custodian_and_ward_postcall( 0, 1 ).create(self) ) temp.append( ' )' ) |
From: Roman <rom...@us...> - 2006-04-23 14:39:06
|
Update of /cvsroot/pygccxml/source/pyplusplus/unittests/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29364/pyplusplus/unittests/data Modified Files: member_variables_to_be_exported.cpp member_variables_to_be_exported.hpp Added Files: private_assign_to_be_exported.hpp Log Message: adding new functionality: if class is used as member variabel, but does not have public assign operator, def_readonly will be used if class has pointer as member variable, it is exposed correctly --- NEW FILE: private_assign_to_be_exported.hpp --- // Copyright 2004 Roman Yakovenko. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef __private_assign_to_be_exported_hpp__ #define __private_assign_to_be_exported_hpp__ #include <memory> #include "boost/shared_ptr.hpp" namespace private_assign{ class item_t{ public: item_t() : m_value ( 24 ) {} private: item_t& operator=( const item_t& other ){ m_value = other.m_value; } public: int m_value; }; struct container_t{ container_t(){ m_item.m_value = 23; } item_t m_item; }; } #endif//__smart_pointers_to_be_exported_hpp__ Index: member_variables_to_be_exported.cpp =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/unittests/data/member_variables_to_be_exported.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** member_variables_to_be_exported.cpp 16 Nov 2005 06:05:23 -0000 1.3 --- member_variables_to_be_exported.cpp 23 Apr 2006 14:39:00 -0000 1.4 *************** *** 23,26 **** --- 23,42 ---- } + namespace pointers{ + + std::auto_ptr<tree_node_t> create_tree(){ + std::auto_ptr<tree_node_t> root( new tree_node_t() ); + root->data = new data_t(); + root->data->value = 0; + + root->left = new tree_node_t( root.get() ); + root->left->data = new data_t(); + root->left->data->value = 1; + + return root; + } + + } + } Index: member_variables_to_be_exported.hpp =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/unittests/data/member_variables_to_be_exported.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** member_variables_to_be_exported.hpp 23 Nov 2005 14:04:32 -0000 1.10 --- member_variables_to_be_exported.hpp 23 Apr 2006 14:39:00 -0000 1.11 *************** *** 6,9 **** --- 6,10 ---- #ifndef __member_variables_to_be_exported_hpp__ #define __member_variables_to_be_exported_hpp__ + #include <memory> namespace member_variables{ *************** *** 63,70 **** const variable_t vars[3]; ! int ivars[10]; int ivars2[10]; }; } --- 64,109 ---- const variable_t vars[3]; ! int ivars[10]; int ivars2[10]; }; + namespace pointers{ + + struct data_t{ + data_t() : value( 201 ) {} + int value; + static char* reserved; + }; + + struct tree_node_t{ + data_t *data; + tree_node_t *left; + tree_node_t *right; + const tree_node_t *parent; + + tree_node_t(const tree_node_t* parent=0) + : data(0) + , left( 0 ) + , right( 0 ) + , parent( parent ) + {} + + ~tree_node_t(){ + if( left ){ + delete left; + } + if( right ){ + delete right; + } + if( data ){ + delete data; + } + } + }; + + std::auto_ptr<tree_node_t> create_tree(); + + } + } |
From: Roman <rom...@us...> - 2006-04-23 14:39:05
|
Update of /cvsroot/pygccxml/source/pyplusplus/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29364/pyplusplus/unittests Modified Files: member_variables_tester.py test_all.py Added Files: private_assign_tester.py Log Message: adding new functionality: if class is used as member variabel, but does not have public assign operator, def_readonly will be used if class has pointer as member variable, it is exposed correctly Index: member_variables_tester.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/unittests/member_variables_tester.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** member_variables_tester.py 29 Mar 2006 04:26:58 -0000 1.15 --- member_variables_tester.py 23 Apr 2006 14:39:00 -0000 1.16 *************** *** 67,70 **** --- 67,89 ---- self.failUnless( array.get_ivars_item( index ) == index * index ) + tree = module.create_tree() + self.failUnless( tree.parent is None ) + self.failUnless( tree.data.value == 0 ) + self.failUnless( tree.right is None ) + self.failUnless( tree.left ) + self.failUnless( tree.left.data.value == 1 ) + + try: + tree.right = module.create_tree() + self.failUnless( 'Attribute error exception should be raised!' ) + except AttributeError: + pass + #self.failUnless( tree.right.parent is None ) + #self.failUnless( tree.right.data.value == 0 ) + #self.failUnless( tree.right.right is None ) + #self.failUnless( tree.right.left ) + #self.failUnless( tree.right.left.data.value == 1 ) + + def create_suite(): suite = unittest.TestSuite() Index: test_all.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/unittests/test_all.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** test_all.py 20 Apr 2006 05:35:40 -0000 1.37 --- test_all.py 23 Apr 2006 14:39:00 -0000 1.38 *************** *** 49,52 **** --- 49,53 ---- import pointer_as_arg_tester import factory_tester + import private_assign_tester def create_suite(times): *************** *** 94,97 **** --- 95,99 ---- , pointer_as_arg_tester , factory_tester + , private_assign_tester ] --- NEW FILE: private_assign_tester.py --- # Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) import os import sys import unittest import fundamental_tester_base class tester_t(fundamental_tester_base.fundamental_tester_base_t): EXTENSION_NAME = 'private_assign' def __init__( self, *args ): fundamental_tester_base.fundamental_tester_base_t.__init__( self , tester_t.EXTENSION_NAME , *args ) def run_tests(self, module): cont = module.container_t() self.failUnless( cont.m_item.m_value == 23 ) cont.m_item.m_value = 11 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() |
From: Roman <rom...@us...> - 2006-04-23 14:32:15
|
Update of /cvsroot/pygccxml/source/pyplusplus/decl_wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24629/pyplusplus/decl_wrappers Modified Files: decl_wrapper.py Log Message: If template instantiated class has only one alias ( typedef ), then this alias will be used. Index: decl_wrapper.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/decl_wrapper.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** decl_wrapper.py 20 Apr 2006 04:06:41 -0000 1.7 --- decl_wrapper.py 23 Apr 2006 14:32:12 -0000 1.8 *************** *** 43,52 **** def _get_alias(self): ! if self._alias: ! return self._alias ! elif declarations.templates.is_instantiation( self.name ): ! return self._generate_valid_name() ! else: ! return self.name def _set_alias(self, alias): --- 43,56 ---- def _get_alias(self): ! if not self._alias: ! if declarations.templates.is_instantiation( self.name ): ! if isinstance( self, declarations.class_t ) \ ! and 1 == len( set( map( lambda typedef: typedef.name, self.typedefs ) ) ): ! self._alias = self.typedefs[0].name ! else: ! self._alias = self._generate_valid_name() ! else: ! self._alias = self.name ! return self._alias def _set_alias(self, alias): |
From: Roman <rom...@us...> - 2006-04-23 14:17:31
|
Update of /cvsroot/pygccxml/source/pyplusplus/code_creators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13812/pyplusplus/code_creators Modified Files: calldef.py Log Message: fixing bug in calldef Index: calldef.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_creators/calldef.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** calldef.py 20 Apr 2006 05:35:40 -0000 1.53 --- calldef.py 23 Apr 2006 14:17:27 -0000 1.54 *************** *** 88,92 **** , '::boost::python::pure_virtual' ) if create_with_signature: ! if self.wrapper and self.declaration.access_type != declarations.ACCESS_TYPES.PUBLIC: result.append( '%s( (%s)(&%s) )' % ( pure_virtual --- 88,92 ---- , '::boost::python::pure_virtual' ) if create_with_signature: ! if self.wrapper and access_type != declarations.ACCESS_TYPES.PUBLIC: result.append( '%s( (%s)(&%s) )' % ( pure_virtual *************** *** 99,103 **** , declarations.full_name( self.declaration ) ) ) else: ! if self.wrapper and self.declaration.access_type != declarations.ACCESS_TYPES.PUBLIC: result.append( '%s( &%s )' % ( pure_virtual, self.wrapper.full_name() ) ) --- 99,103 ---- , declarations.full_name( self.declaration ) ) ) else: ! if self.wrapper and access_type != declarations.ACCESS_TYPES.PUBLIC: result.append( '%s( &%s )' % ( pure_virtual, self.wrapper.full_name() ) ) |
From: Roman <rom...@us...> - 2006-04-23 14:00:18
|
Update of /cvsroot/pygccxml/source/pyplusplus/code_creators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2941/pyplusplus/code_creators Modified Files: instruction.py Log Message: from now instruction by defualt will not write themself within the code Index: instruction.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_creators/instruction.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** instruction.py 10 Apr 2006 11:57:15 -0000 1.3 --- instruction.py 23 Apr 2006 14:00:14 -0000 1.4 *************** *** 12,19 **** """ #TODO: add silent option and make it default ! def __init__(self, parent): code_creator.code_creator_t.__init__(self, parent) def _create_impl(self): answer = [] for line in self._generate_description().split( os.linesep ): --- 12,33 ---- """ #TODO: add silent option and make it default ! def __init__(self, parent, silent=True): code_creator.code_creator_t.__init__(self, parent) + self._silent = silent + + def get_silent(self): + return self._silent + def set_silent(self, silent ): + self._silent = silent + + silent = property( get_silent, set_silent + , doc="""silent property controls, whether instruction + should be written within generated code or not. + Default value is True - not written.""" ) + def _create_impl(self): + if self.silent: + return '' answer = [] for line in self._generate_description().split( os.linesep ): |
From: Roman <rom...@us...> - 2006-04-23 12:59:29
|
Update of /cvsroot/pygccxml/source/pygccxml/declarations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27608/pygccxml/declarations Modified Files: scopedef.py Log Message: removing annoying logging message Index: scopedef.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/scopedef.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** scopedef.py 23 Apr 2006 12:13:25 -0000 1.12 --- scopedef.py 23 Apr 2006 12:59:25 -0000 1.13 *************** *** 148,152 **** Those hashtables allows to search declaration very quick. """ ! utils.logger.debug( "preparing data structures for query optimizer - started" ) start_time = time.clock() --- 148,153 ---- Those hashtables allows to search declaration very quick. """ ! if self.name == '::': ! utils.logger.debug( "preparing data structures for query optimizer - started" ) start_time = time.clock() *************** *** 177,183 **** map( lambda decl: decl.init_optimizer() , filter( lambda decl: isinstance( decl, scopedef_t ), self.declarations ) ) ! ! utils.logger.debug( "preparing data structures for query optimizer - done( %f seconds ). " ! % ( time.clock() - start_time ) ) self._optimized = True --- 178,184 ---- map( lambda decl: decl.init_optimizer() , filter( lambda decl: isinstance( decl, scopedef_t ), self.declarations ) ) ! if self.name == '::': ! utils.logger.debug( "preparing data structures for query optimizer - done( %f seconds ). " ! % ( time.clock() - start_time ) ) self._optimized = True |
From: Roman <rom...@us...> - 2006-04-23 12:13:47
|
Update of /cvsroot/pygccxml/source/pygccxml/unittests/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240/pygccxml/unittests/data Modified Files: core_cache.hpp patcher.hpp Log Message: 1. porting some tests to use new "select" interface 2. adding new type traits: has_public_assign 3. adding new patcher to treat GCC-XML default value typedef bug Index: core_cache.hpp =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/data/core_cache.hpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** core_cache.hpp 20 Apr 2006 10:11:26 -0000 1.55 --- core_cache.hpp 23 Apr 2006 12:13:25 -0000 1.56 *************** *** 22,26 **** #endif//__core_cache_hpp__ ! ! ! //touch//touch \ No newline at end of file --- 22,24 ---- #endif//__core_cache_hpp__ ! \ No newline at end of file Index: patcher.hpp =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/data/patcher.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** patcher.hpp 9 Feb 2006 11:33:56 -0000 1.4 --- patcher.hpp 23 Apr 2006 12:13:25 -0000 1.5 *************** *** 34,37 **** --- 34,50 ---- + namespace typedef_{ + + struct original_name{ + original_name(){} + }; + + typedef original_name alias; + + } + + void typedef__func( const typedef_::alias& position = typedef_::alias() ); + + /*struct default_arg_t{};*/ /*default_arg_t create_default_argument();*/ |
From: Roman <rom...@us...> - 2006-04-23 12:13:45
|
Update of /cvsroot/pygccxml/source/pygccxml/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240/pygccxml/parser Modified Files: patcher.py project_reader.py source_reader.py Log Message: 1. porting some tests to use new "select" interface 2. adding new type traits: has_public_assign 3. adding new patcher to treat GCC-XML default value typedef bug Index: patcher.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/patcher.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** patcher.py 6 Apr 2006 06:15:58 -0000 1.11 --- patcher.py 23 Apr 2006 12:13:25 -0000 1.12 *************** *** 143,148 **** name = call_invocation.name( dv ) base_type = declarations.base_type( arg.type ) ! return isinstance( base_type, declarations.declarated_t ) \ ! and base_type.declaration.name == name def __fix_constructor_call( self, func, arg ): --- 143,152 ---- name = call_invocation.name( dv ) base_type = declarations.base_type( arg.type ) ! if not isinstance( base_type, declarations.declarated_t ): ! return False ! decl = base_type.declaration ! return decl.name == name \ ! or ( isinstance( decl, declarations.class_t ) \ ! and name in map( lambda typedef: typedef.name, decl.typedefs ) ) def __fix_constructor_call( self, func, arg ): *************** *** 152,158 **** return False base_type = declarations.base_type( arg.type ) name, args = call_invocation.split( dv ) ! f_q_name = self.__join_names( declarations.full_name( base_type.declaration.parent ) ! , name ) return call_invocation.join( f_q_name, args ) --- 156,174 ---- return False base_type = declarations.base_type( arg.type ) + decl = base_type.declaration name, args = call_invocation.split( dv ) ! if decl.name != name: ! #we have some alias to the class ! relevant_typedefs = filter( lambda typedef: typedef.name == name ! , decl.typedefs ) ! if 1 == len( relevant_typedefs ): ! f_q_name = self.__join_names( declarations.full_name( relevant_typedefs[0].parent ) ! , name ) ! else:#in this case we can not say which typedef user uses: ! f_q_name = self.__join_names( declarations.full_name( decl.parent ) ! , decl.name ) ! else: ! f_q_name = self.__join_names( declarations.full_name( decl.parent ), name ) ! return call_invocation.join( f_q_name, args ) Index: source_reader.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/source_reader.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** source_reader.py 20 Apr 2006 04:32:16 -0000 1.29 --- source_reader.py 23 Apr 2006 12:13:25 -0000 1.30 *************** *** 41,44 **** --- 41,45 ---- for decl in classes: + del decl.typedefs[:] for typedef in typedefs: type_ = remove_alias( typedef.type ) *************** *** 49,53 **** class source_reader_t: ! def __init__( self, config, cache=None, decl_factory=None, enable_bind_typedefs=True): self.__search_directories = [] self.__config = config --- 50,54 ---- class source_reader_t: ! def __init__( self, config, cache=None, decl_factory=None ): self.__search_directories = [] self.__config = config *************** *** 61,65 **** if not decl_factory: self.__decl_factory = decl_factory_t() - self.__enable_bind_typedefs = enable_bind_typedefs def __raise_on_wrong_settings(self): --- 62,65 ---- *************** *** 259,264 **** linker_.instance = decl apply_visitor( linker_, decl ) ! if self.__enable_bind_typedefs: ! bind_typedefs( decls.itervalues() ) decls = filter( lambda inst: isinstance(inst, declaration_t) and not inst.parent, decls.itervalues() ) #some times gccxml report typedefs defined in no namespace --- 259,263 ---- linker_.instance = decl apply_visitor( linker_, decl ) ! bind_typedefs( decls.itervalues() ) decls = filter( lambda inst: isinstance(inst, declaration_t) and not inst.parent, decls.itervalues() ) #some times gccxml report typedefs defined in no namespace Index: project_reader.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/project_reader.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** project_reader.py 20 Apr 2006 04:32:16 -0000 1.31 --- project_reader.py 23 Apr 2006 12:13:25 -0000 1.32 *************** *** 169,174 **** reader = source_reader.source_reader_t( config , self.__dcache ! , self.__decl_factory ! , False ) decls = None if content_type == file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE: --- 169,173 ---- reader = source_reader.source_reader_t( config , self.__dcache ! , self.__decl_factory ) decls = None if content_type == file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE: |
From: Roman <rom...@us...> - 2006-04-23 12:13:45
|
Update of /cvsroot/pygccxml/source/pygccxml/declarations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240/pygccxml/declarations Modified Files: __init__.py algorithm.py scopedef.py type_traits.py Log Message: 1. porting some tests to use new "select" interface 2. adding new type traits: has_public_assign 3. adding new patcher to treat GCC-XML default value typedef bug Index: type_traits.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/type_traits.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** type_traits.py 6 Apr 2006 06:15:56 -0000 1.24 --- type_traits.py 23 Apr 2006 12:13:25 -0000 1.25 *************** *** 300,303 **** --- 300,312 ---- return bool( constructors ) + def has_public_assign(type): + """returns True if class has public assign operator, False otherwise""" + assert isinstance( type, class_declaration.class_t ) + decls = algorithm.find_all_declarations( type.public_members + , type=calldef.member_operator_t + , recursive=False ) + decls = filter( lambda decl: decl.symbol == '=', decls ) + return bool( decls ) + def has_public_destructor(type): """returns True if class has public destructor, False otherwise""" Index: __init__.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/__init__.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** __init__.py 20 Apr 2006 10:11:25 -0000 1.38 --- __init__.py 23 Apr 2006 12:13:25 -0000 1.39 *************** *** 67,70 **** --- 67,71 ---- from algorithm import declaration_files from algorithm import visit_function_has_not_been_found_t + from algorithm import get_global_namespace from calldef import VIRTUALITY_TYPES *************** *** 122,125 **** --- 123,127 ---- from type_traits import has_destructor from type_traits import has_trivial_copy + from type_traits import has_public_assign from type_traits import has_public_destructor from type_traits import has_public_constructor Index: algorithm.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/algorithm.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** algorithm.py 2 Mar 2006 05:53:14 -0000 1.18 --- algorithm.py 23 Apr 2006 12:13:25 -0000 1.19 *************** *** 108,111 **** --- 108,120 ---- yield internal + def get_global_namespace(decls): + import pygccxml.declarations + found = filter( lambda decl: decl.name == '::' + and isinstance( decl, pygccxml.declarations.namespace_t ) + , make_flatten( decls ) ) + if len( found ) == 1: + return found[0] + raise RuntimeError( "Unable to find global namespace." ) + class match_declaration_t: """ Index: scopedef.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/scopedef.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** scopedef.py 20 Apr 2006 10:11:25 -0000 1.11 --- scopedef.py 23 Apr 2006 12:13:25 -0000 1.12 *************** *** 40,44 **** Example:: ! ns - referers to global namespace ns.member_function( "do_something ) - will return reference to member function named "do_something". If there is no such function exception --- 40,44 ---- Example:: ! ns - referrers to global namespace ns.member_function( "do_something ) - will return reference to member function named "do_something". If there is no such function exception *************** *** 284,300 **** ! def decl( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): """Finds any declaration by criteria. Please see L{scopedef_t} for full explanation.""" return self._find_single( self._impl_matchers[ scopedef_t.decl ] , name=name , function=function , header_dir=header_dir , header_file=header_file , recursive=recursive) ! def decls( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): return self._find_multiple( self._impl_matchers[ scopedef_t.decl ] , name=name , function=function , header_dir=header_dir , header_file=header_file --- 284,302 ---- ! def decl( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): """Finds any declaration by criteria. Please see L{scopedef_t} for full explanation.""" return self._find_single( self._impl_matchers[ scopedef_t.decl ] , name=name , function=function + , decl_type=decl_type , header_dir=header_dir , header_file=header_file , recursive=recursive) ! def decls( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): return self._find_multiple( self._impl_matchers[ scopedef_t.decl ] , name=name , function=function + , decl_type=decl_type , header_dir=header_dir , header_file=header_file |
From: Roman <rom...@us...> - 2006-04-20 10:13:42
|
Update of /cvsroot/pygccxml/source/pyplusplus/decl_wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2821/pyplusplus/decl_wrappers Removed Files: mdecl_wrapper.py Log Message: mdecl_wrapper.py file has been moved to pygccxml/declarations directory --- mdecl_wrapper.py DELETED --- |
From: Roman <rom...@us...> - 2006-04-20 10:11:34
|
Update of /cvsroot/pygccxml/source/pygccxml/declarations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1204/pygccxml/declarations Modified Files: __init__.py namespace.py scopedef.py Added Files: mdecl_wrapper.py Log Message: moving select interface to pygccxml classes. Previous code should work unchanged, because I just moved it in hierarchy tree. --- NEW FILE: mdecl_wrapper.py --- # Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) class call_redirector_t( object ): """Internal class used to call some function of objects""" def __init__( self, name, decls ): object.__init__( self ) self.name = name self.decls = decls def __call__( self, *arguments, **keywords ): for d in self.decls: callable_ = getattr(d, self.name) callable_( *arguments, **keywords ) class mdecl_wrapper_t( object ): """Multiple declarations wrapper. The main purpose of this class is to allow an user to work on many declarations, as they were only one single declaration. Example: mb = module_builder_t( ... ) #lets say we want to exclude all member functions, that returns reference to int: mb.member_functions( return_type='int &' ).exclude() "exclude" function will be called on every function that match the criteria. """ def __init__( self, decls ): """@param decls: list of declarations to operate on. @type decls: list of L{declaration wrappers<decl_wrapper_t>} """ object.__init__( self ) self.__dict__['_decls'] = decls def __len__( self ): """returns the number of declarations""" return len( self._decls ) def __getitem__( self, index ): """provides access to declaration""" return self._decls[index] def __ensure_attribute( self, name ): invalid_decls = filter( lambda d: not hasattr( d, name ), self._decls ) if invalid_decls: raise RuntimeError( "Not all declarations have '%s' attribute." % name ) def __setattr__( self, name, value ): """Updates the value of attribute on all declarations. @param name: name of attribute @param value: new value of attribute """ self.__ensure_attribute( name ) for d in self._decls: setattr( d, name, value ) def __getattr__( self, name ): """@param name: name of method """ return call_redirector_t( name, self._decls ) Index: namespace.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/namespace.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** namespace.py 22 Mar 2006 10:38:29 -0000 1.10 --- namespace.py 20 Apr 2006 10:11:25 -0000 1.11 *************** *** 57,58 **** --- 57,116 ---- #if not keep_parent: # decl.parent=None + + def namespace( self, name=None, function=None, recursive=None ): + return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.namespace ] + , name=name + , function=function + , recursive=recursive ) + + def namespaces( self, name=None, function=None, recursive=None ): + return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.namespace ] + , name=name + , function=function + , recursive=recursive ) + + def free_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.free_function ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ namespace_t.free_function ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def free_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.free_function ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ namespace_t.free_function ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def free_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.free_operator ] + , name=name + , symbol=symbol + , function=function + , decl_type=self._impl_decl_types[ namespace_t.free_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def free_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.free_operator ] + , name=name + , symbol=symbol + , function=function + , decl_type=self._impl_decl_types[ namespace_t.free_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) \ No newline at end of file Index: __init__.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/__init__.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** __init__.py 16 Mar 2006 06:31:29 -0000 1.37 --- __init__.py 20 Apr 2006 10:11:25 -0000 1.38 *************** *** 149,152 **** from matcher import matcher from decl_printer import decl_printer_t ! from decl_printer import print_declarations \ No newline at end of file --- 149,229 ---- from matcher import matcher + from mdecl_wrapper import mdecl_wrapper_t + from decl_printer import decl_printer_t ! from decl_printer import print_declarations ! ! ! #implementation details: I need this trick in order to prevent recursive imports ! import scopedef ! ! scopedef.scopedef_t._impl_all_decl_types = [ ! scopedef.scopedef_t ! , enumeration_t ! , namespace_t ! , class_t ! , class_declaration_t ! , typedef_t ! , variable_t ! , calldef_t ! , member_calldef_t ! , free_calldef_t ! , operator_t ! , member_function_t ! , constructor_t ! , destructor_t ! , member_operator_t ! , casting_operator_t ! , free_function_t ! , free_operator_t ! ] ! ! impl_matchers = scopedef.scopedef_t._impl_matchers ! impl_decl_types = scopedef.scopedef_t._impl_decl_types ! ! impl_matchers[ scopedef.scopedef_t.decl ] = declaration_matcher_t ! ! impl_matchers[ scopedef.scopedef_t.class_ ] = declaration_matcher_t ! impl_decl_types[ scopedef.scopedef_t.class_ ] = class_t ! ! impl_matchers[ scopedef.scopedef_t.variable ] = variable_matcher_t ! ! impl_matchers[ scopedef.scopedef_t.calldef ] = calldef_matcher_t ! impl_decl_types[ scopedef.scopedef_t.calldef ] = calldef_t ! ! impl_matchers[ scopedef.scopedef_t.operator ] = operator_matcher_t ! ! impl_matchers[ scopedef.scopedef_t.member_function ] = calldef_matcher_t ! impl_decl_types[ scopedef.scopedef_t.member_function ] = member_function_t ! ! impl_matchers[ scopedef.scopedef_t.constructor ] = calldef_matcher_t ! impl_decl_types[ scopedef.scopedef_t.constructor ] = constructor_t ! ! impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t ! impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t ! ! impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t ! impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t ! ! impl_matchers[ scopedef.scopedef_t.casting_operator ] = calldef_matcher_t ! impl_decl_types[ scopedef.scopedef_t.casting_operator ] = casting_operator_t ! ! impl_matchers[ scopedef.scopedef_t.enumeration ] = declaration_matcher_t ! impl_decl_types[ scopedef.scopedef_t.enumeration ] = enumeration_t ! ! impl_matchers[ namespace_t.namespace ] = namespace_matcher_t ! ! impl_matchers[ namespace_t.free_function ] = calldef_matcher_t ! impl_decl_types[ namespace_t.free_function ] = free_function_t ! ! impl_matchers[ namespace_t.free_operator ] = operator_matcher_t ! impl_decl_types[ namespace_t.free_operator ] = free_operator_t ! ! ! ! ! ! ! ! ! Index: scopedef.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/scopedef.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** scopedef.py 15 Mar 2006 10:27:40 -0000 1.10 --- scopedef.py 20 Apr 2006 10:11:25 -0000 1.11 *************** *** 8,12 **** --- 8,18 ---- """ + import time + import algorithm + import filtering import declaration + import mdecl_wrapper + from pygccxml import utils + import matcher as matcher_module class scopedef_t( declaration.declaration_t ): *************** *** 16,23 **** --- 22,80 ---- children nodes. The children can be accessed via the C{declarations} property. + + Also this class provides "get/select/find" interface. Using this class you + can get instance or instances of internal declaration(s). + + You can find declaration(s) using next criteria: + 1. name - declaration name, could be full qualified name + 2. header_dir - directory, to which belongs file, that the declaration was declarated in. + header_dir should be absolute path. + 3. header_file - file that the declaration was declarated in. + 4. function - user ( your ) custom criteria. The interesting thing is that + this function will be joined with other arguments ( criteria ). + 5. recursive - the search declaration range, if True will be search in + internal declarations too. + + Every "select" API you can invoke and pass as first argument at declaration + name or function. This class will find out correctly what argument represents. + + Example:: + ns - referers to global namespace + ns.member_function( "do_something ) - will return reference to member + function named "do_something". If there is no such function exception + will be raised. If there is more then one function exception will be + raised too. + + Example 2:: + ns - referers to global namespace + do_smths = ns.member_functions( "do_something ) - will return instance + of L{mdecl_wrapper_t} object. This object allows you few things: + + 1. To iterate on selected declarations + 2. To set some property to desired value using one line of code only: + do_smths.call_policies = x + 3. To call some function on every instance using one line of code: + do_smths.exclude() + + Pay attention: you can not use "get" functions or properties. """ + + RECURSIVE_DEFAULT = True + ALLOW_EMPTY_MDECL_WRAPPER = False + + _impl_matchers = {} #this class variable is used to prevent recursive imports + _impl_decl_types = {} #this class variable is used to prevent recursive imports + _impl_all_decl_types = [] #this class variable is used to prevent recursive imports + def __init__( self, name='', parent=''): declaration.declaration_t.__init__( self, name, parent ) + self._optimized = False + self._type2decls = {} + self._type2name2decls = {} + self._type2decls_nr = {} + self._type2name2decls_nr = {} + self._all_decls = None + def _get__cmp__scope_items(self): raise NotImplementedError() *************** *** 46,47 **** --- 103,495 ---- def remove_declaration( self, decl ): raise NotImplementedError() + + + def __decl_types( self, decl ): + types = [] + bases = list( decl.__class__.__bases__ ) + visited = set() + if 'pygccxml' in decl.__class__.__module__: + types.append( decl.__class__ ) + while bases: + base = bases.pop() + if base is declaration.declaration_t: + continue + if base in visited: + continue + if 'pygccxml' not in base.__module__: + continue + types.append( base ) + bases.extend( base.__bases__ ) + return types + + def clear_optimizer(self): + """Cleans query optimizer state""" + self._optimized = False + self._type2decls = {} + self._type2name2decls = {} + self._type2decls_nr = {} + self._type2name2decls_nr = {} + self._all_decls = None + + map( lambda decl: decl.clear_optimizer() + , filter( lambda decl: isinstance( decl, scopedef_t ) + , self.declarations ) ) + + def init_optimizer(self): + """Initializes query optimizer state. + There are 4 internals hash tables: + 1. from type to declarations + 2. from type to declarations for non-recursive queries + 3. from type to name to declarations + 4. from type to name to declarations for non-recursive queries + + Almost every query includes declaration type information. Also very + common query is to search some declaration(s) by name or full name. + Those hashtables allows to search declaration very quick. + """ + utils.logger.debug( "preparing data structures for query optimizer - started" ) + start_time = time.clock() + + self.clear_optimizer() + + for dtype in scopedef_t._impl_all_decl_types: + self._type2decls[ dtype ] = [] + self._type2decls_nr[ dtype ] = [] + self._type2name2decls[ dtype ] = {} + self._type2name2decls_nr[ dtype ] = {} + + self._all_decls = algorithm.make_flatten( self.declarations ) + for decl in self._all_decls: + types = self.__decl_types( decl ) + for type_ in types: + self._type2decls[ type_ ].append( decl ) + name2decls = self._type2name2decls[ type_ ] + if not name2decls.has_key( decl.name ): + name2decls[ decl.name ] = [] + name2decls[ decl.name ].append( decl ) + if self is decl.parent: + self._type2decls_nr[ type_ ].append( decl ) + name2decls_nr = self._type2name2decls_nr[ type_ ] + if not name2decls_nr.has_key( decl.name ): + name2decls_nr[ decl.name ] = [] + name2decls_nr[ decl.name ].append( decl ) + + map( lambda decl: decl.init_optimizer() + , filter( lambda decl: isinstance( decl, scopedef_t ), self.declarations ) ) + + utils.logger.debug( "preparing data structures for query optimizer - done( %f seconds ). " + % ( time.clock() - start_time ) ) + self._optimized = True + + + def __normalize_args( self, **keywds ): + if callable( keywds['name'] ) and None is keywds['function']: + keywds['function'] = keywds['name'] + keywds['name'] = None + return keywds + + def __findout_recursive( self, **keywds ): + if None is keywds[ 'recursive' ]: + return self.RECURSIVE_DEFAULT + else: + return keywds[ 'recursive' ] + + def __findout_decl_type( self, match_class, **keywds ): + if keywds.has_key( 'decl_type' ): + return keywds['decl_type'] + + matcher_args = keywds.copy() + del matcher_args['function'] + del matcher_args['recursive'] + + matcher = match_class( **matcher_args ) + if matcher.decl_type: + return matcher.decl_type + return None + + def __create_matcher( self, match_class, **keywds ): + matcher_args = keywds.copy() + del matcher_args['function'] + del matcher_args['recursive'] + + matcher = match_class( **matcher_args ) + if keywds['function']: + utils.logger.info( 'running query: %s and <user defined function>' % str( matcher ) ) + return lambda decl: matcher( decl ) and keywds['function'](decl) + else: + utils.logger.info( 'running query: %s' % str( matcher ) ) + return matcher + + def __findout_range( self, name, decl_type, recursive ): + if not self._optimized: + utils.logger.info( 'running non optimized query - optimization has not been done' ) + decls = self.declarations + if recursive: + decls = algorithm.make_flatten( self.declarations ) + return decls + + if name and decl_type: + matcher = scopedef_t._impl_matchers[ scopedef_t.decl ]( name=name ) + if matcher.is_full_name(): + name = matcher.decl_name_only + if recursive: + utils.logger.info( 'query has been optimized on type and name' ) + return self._type2name2decls[decl_type][name] + else: + utils.logger.info( 'non recursive query has been optimized on type and name' ) + return self._type2name2decls_nr[decl_type][name] + elif decl_type: + if recursive: + utils.logger.info( 'query has been optimized on type' ) + return self._type2decls[ decl_type ] + else: + utils.logger.info( 'non recursive query has been optimized on type' ) + return self._type2decls_nr[ decl_type ] + else: + if recursive: + utils.logger.info( 'query has not been optimized ( hint: query does not contain type and/or name )' ) + return self._all_decls + else: + utils.logger.info( 'non recursive query has not been optimized ( hint: query does not contain type and/or name )' ) + return self.declarations + + def _find_single( self, match_class, **keywds ): + utils.logger.info( 'find single query execution - started' ) + start_time = time.clock() + norm_keywds = self.__normalize_args( **keywds ) + matcher = self.__create_matcher( match_class, **norm_keywds ) + dtype = self.__findout_decl_type( match_class, **norm_keywds ) + recursive_ = self.__findout_recursive( **norm_keywds ) + decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) + found = matcher_module.matcher.get_single( matcher, decls, False ) + utils.logger.info( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) ) + return found + + def _find_multiple( self, match_class, **keywds ): + utils.logger.info( 'find all query execution - started' ) + start_time = time.clock() + norm_keywds = self.__normalize_args( **keywds ) + matcher = self.__create_matcher( match_class, **norm_keywds ) + dtype = self.__findout_decl_type( match_class, **norm_keywds ) + recursive_ = self.__findout_recursive( **norm_keywds ) + decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) + found = matcher_module.matcher.find( matcher, decls, False ) + mfound = mdecl_wrapper.mdecl_wrapper_t( found ) + utils.logger.info( '%d declaration(s) that match query' % len(mfound) ) + utils.logger.info( 'find single query execution - done( %f seconds )' + % ( time.clock() - start_time ) ) + if not mfound and not self.ALLOW_EMPTY_MDECL_WRAPPER: + raise RuntimeError( "Multi declaration query returned 0 declarations." ) + return mfound + + + def decl( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + """Finds any declaration by criteria. Please see L{scopedef_t} for full explanation.""" + return self._find_single( self._impl_matchers[ scopedef_t.decl ] + , name=name + , function=function + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def decls( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.decl ] + , name=name + , function=function + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def class_( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.class_ ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.class_ ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def classes( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.class_ ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.class_ ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def variable( self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.variable ] + , name=name + , function=function + , type=type + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def variables( self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.variable ] + , name=name + , function=function + , type=type + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def calldef( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.calldef ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.calldef ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def calldefs( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.calldef ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.calldef ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.operator ] + , name=name + , symbol=symbol + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.operator ] + , name=name + , symbol=symbol + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def member_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.member_function ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.member_function ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def member_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.member_function ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.member_function ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def constructor( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.constructor ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.constructor ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def constructors( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.constructor ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.constructor ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def member_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.member_operator ] + , name=name + , symbol=symbol + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.member_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def member_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.member_operator ] + , name=name + , symbol=symbol + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.member_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def casting_operator( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.casting_operator ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.casting_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def casting_operators( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.casting_operator ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.casting_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def enumeration( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + return self._find_single( self._impl_matchers[ scopedef_t.enumeration ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.enumeration ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + #adding small aliase + enum = enumeration + + def enumerations( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + return self._find_multiple( self._impl_matchers[ scopedef_t.enumeration ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.enumeration ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + #adding small aliase + enums = enumerations \ No newline at end of file |