pygccxml-commit Mailing List for C++ Python language bindings (Page 10)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(190) |
Apr
(166) |
May
(170) |
Jun
(75) |
Jul
(105) |
Aug
(131) |
Sep
(99) |
Oct
(84) |
Nov
(67) |
Dec
(54) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(66) |
Feb
(49) |
Mar
(25) |
Apr
(62) |
May
(21) |
Jun
(34) |
Jul
(9) |
Aug
(21) |
Sep
(5) |
Oct
|
Nov
(63) |
Dec
(34) |
| 2008 |
Jan
(10) |
Feb
(42) |
Mar
(26) |
Apr
(25) |
May
(6) |
Jun
(40) |
Jul
(18) |
Aug
(29) |
Sep
(6) |
Oct
(32) |
Nov
(14) |
Dec
(56) |
| 2009 |
Jan
(127) |
Feb
(52) |
Mar
(2) |
Apr
(10) |
May
(29) |
Jun
(3) |
Jul
|
Aug
(16) |
Sep
(4) |
Oct
(11) |
Nov
(8) |
Dec
(14) |
| 2010 |
Jan
(31) |
Feb
(1) |
Mar
(7) |
Apr
(9) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
(8) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <rom...@us...> - 2009-01-28 18:25:50
|
Revision: 1632
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1632&view=rev
Author: roman_yakovenko
Date: 2009-01-28 18:25:43 +0000 (Wed, 28 Jan 2009)
Log Message:
-----------
sphinx
Modified Paths:
--------------
index.rest
sphinx/conf.py
Modified: index.rest
===================================================================
--- index.rest 2009-01-28 14:42:41 UTC (rev 1631)
+++ index.rest 2009-01-28 18:25:43 UTC (rev 1632)
@@ -4,6 +4,11 @@
.. contents:: Table of contents
+.. toctree::
+ :maxdepth: 2
+
+ pydsc/pydsc
+
----------------
pygccxml package
----------------
@@ -68,7 +73,14 @@
.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html
+Indices and tables
+==================
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
+
.. _`pyboost` : ./pyplusplus/examples/boost/boost.html
.. _`boost.graph` : http://www.boost.org/libs/graph/doc/table_of_contents.html
.. _`boost.date_time` : http://boost.org/doc/html/date_time.html
Modified: sphinx/conf.py
===================================================================
--- sphinx/conf.py 2009-01-28 14:42:41 UTC (rev 1631)
+++ sphinx/conf.py 2009-01-28 18:25:43 UTC (rev 1632)
@@ -23,15 +23,18 @@
project_root = os.path.abspath('..')
doc_project_root = os.path.abspath('.')
-
-for entry in ( 'pydsc', 'pygccxml', 'pyplusplus' ):
- target = os.path.join( doc_project_root, entry )
- source = os.path.join( project_root, entry + '_dev', 'docs' )
+packages = ( 'pydsc', 'pygccxml', 'pyplusplus' )
+for pkg in packages:
+ target = os.path.join( doc_project_root, pkg )
+ sys.path.append( os.path.join( project_root, pkg + '_dev' ) )
+ source = os.path.join( project_root, pkg + '_dev', 'docs' )
if os.path.exists( target ):
shutil.rmtree( target )
shutil.copytree( source, target, ignore=shutil.ignore_patterns( r'.svn', '*.pyc', 'apidocs', 'www_configuration.py' ) )
shutil.copy( os.path.join( project_root, 'index.rest' ), doc_project_root )
+os.environ['PYDSC'] = 'sphinx'
+
# General configuration
# ---------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-28 14:42:55
|
Revision: 1631
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1631&view=rev
Author: roman_yakovenko
Date: 2009-01-28 14:42:41 +0000 (Wed, 28 Jan 2009)
Log Message:
-----------
converting pydsc documentation to sphinx
Modified Paths:
--------------
pydsc_dev/docs/definition.rest
pydsc_dev/docs/pydsc.rest
pydsc_dev/pydsc.py
Added Paths:
-----------
pydsc_dev/docs/api.rest
Added: pydsc_dev/docs/api.rest
===================================================================
--- pydsc_dev/docs/api.rest (rev 0)
+++ pydsc_dev/docs/api.rest 2009-01-28 14:42:41 UTC (rev 1631)
@@ -0,0 +1,7 @@
+=========
+pydsc API
+=========
+
+.. automodule:: pydsc
+ :members:
+
Modified: pydsc_dev/docs/definition.rest
===================================================================
--- pydsc_dev/docs/definition.rest 2009-01-28 11:49:43 UTC (rev 1630)
+++ pydsc_dev/docs/definition.rest 2009-01-28 14:42:41 UTC (rev 1631)
@@ -1 +1 @@
-`pydsc`_ - Python documentation string spell checker
\ No newline at end of file
+:mod:`pydsc` - PYthon Documentation string Spell Checker
Modified: pydsc_dev/docs/pydsc.rest
===================================================================
--- pydsc_dev/docs/pydsc.rest 2009-01-28 11:49:43 UTC (rev 1630)
+++ pydsc_dev/docs/pydsc.rest 2009-01-28 14:42:41 UTC (rev 1631)
@@ -4,6 +4,11 @@
.. contents:: Table of contents
+.. toctree::
+ :maxdepth: 2
+
+ API <api>
+
.. meta::
:description: Python documentation string spell checker
:keywords: Python, docstring, documentation, spell, check
@@ -19,52 +24,57 @@
What it is useful for?
----------------------
-Well, this project was born to solve real problem - I made a lot of mistakes,
-when I write source code documentation for my projects. I needed some way to
-check all the documentation strings. My goal was simplicity + easy customization.
-I achieved it. Here is example of usage of pydsc:
+The `pydsc`_ module checks documentation strings and comments for spelling errors.
+Usage example
+-------------
+
+It is very easy to start using :mod:`pydsc` module - just import it:
+
.. code-block:: python
import pydsc
- #every module that will be imported after pydsc will be checked
- #all errors will be printed to stdout
- import readline
---------------
-Spell checking
---------------
+and every module, that will be imported after it, will be checked. The errors
+will be printed to stdout.
-I did not reinvent the wheel. I use external spell checking engine. I checked
-around and found few spell check engines available from Python. I decided to use
-`PyEnchant`_. It is cross platform, has clean interface and responsive author.
+For example:
--------------
-Usage example
--------------
-
-Basic usage is really simple, but sometimes there is a need to:
- * skip\\exclude some words from checking
- * redefine error messages destination, for example to print to some file
- * exclude(include) files from(to) spell checking process by file location
- ( very useful option in multi-project environment )
-
-"More complex" example:
-
.. code-block:: python
import pydsc
- #check for spell errors only in files under "/home/roman/pygccxml" directory
- pydsc.include( "/home/roman/pygccxml" )
- pydsc.ignore( [ 'normcase', 'normpath' ] )
import readline
+:mod:`pydsc` contains few functions, which helps you to configure the spell checker:
+ * to define your own "ignore" dictionary
+ * to define the error messages destination (file, stdout)
+ * to define set of files, which should be included or excluded
+
+For more information see :mod:`pydsc` module.
+
+------------
+Spell engine
+------------
+
+:mod:`pydsc` modules uses `PyEnchant`_ one.
+
+The `PyEnchant`_ package provides interface for different spell engines:
+ * ispell
+ * aspell
+ * OpenOffice
+
--------
Download
--------
http://sourceforge.net/project/showfiles.php?group_id=118209
+------------
+Installation
+------------
+python setup.py install
+
+
.. _`pydsc`: ./pydsc.html
.. _`PyEnchant`: http://pyenchant.sourceforge.net/
Modified: pydsc_dev/pydsc.py
===================================================================
--- pydsc_dev/pydsc.py 2009-01-28 11:49:43 UTC (rev 1630)
+++ pydsc_dev/pydsc.py 2009-01-28 14:42:41 UTC (rev 1631)
@@ -4,73 +4,16 @@
# http://www.boost.org/LICENSE_1_0.txt)
"""
-Python Documentation Spell Checker.
+The pydsc module checks documentation strings and comments for spelling errors.
-The pydsc module contains functionality needed to check documentation strings
-and comments for spelling errors, within Python code. The pydsc module depends
-on PyEnchant spell checker. PyEnchant provides interface for different spell
-engines:
- * ispell
- * aspell
- * OpenOffice
-
-The use of the pydsc module is very simple - just import pydsc and all modules
-that will be imported after it will be checked. By default all spelling errors
-will be printed to sys.stdout. The pydsc checker could be customized in many
-different ways:
- * you can define set of files/directories that should be included/excluded
- from check process
- * you can redefine error messages destination
- * you can redefine and/or re-configurate spell checker
-
-Install:
-python setup.py install
-
Usage example:
-import pydsc
-import readline #errors will be printed to standart output
+.. code-block:: python
-more complex example ( taken from pygccxml project ):
-
-import pydsc
-#check only pygccxml package
-pydsc.include( r'D:\pygccxml_sources\sources\pygccxml_dev' )
-pydsc.ignore( [ 'Yakovenko'
- , 'Bierbaum'
- , 'org'
- , 'http'
- , 'bool'
- , 'str'
- , 'www'
- , 'param'
- , 'txt'
- , 'decl'
- , 'decls'
- , 'namespace'
- , 'namespaces'
- , 'enum'
- , 'const'
- , 'GCC'
- , 'xcc'
- , 'TODO'
- , 'typedef'
- , 'os'
- , 'normcase'
- , 'normpath'
- , 'scopedef'
- , 'ira'#part of Matthias mail address
- , 'uka'#part of Matthias mail address
- , 'de'#part of Matthias mail address
- , 'dat'#file extension of directory cache
- , 'config'#parameter description
- , 'gccxml'#parameter description
- , 'Py++'
- , 'pygccxml'
- , 'calldef'
- , 'XXX'
- , 'wstring'
- , 'py' ] )
+ import pydsc
+ pydsc.include( r'D:\pygccxml_dev\pygccxml' ) #check only pygccxml package
+ pydsc.exclude( r'C:\Python' ) #don't check standard library
+ pydsc.ignore([ 'Yakovenko', 'www', 'org', 'py' ])
"""
__version__ = '0.2' #current version
@@ -85,18 +28,15 @@
import __builtin__
from enchant import checker
-
-#TODO: source code encoding
-# -*- coding: encoding -*-
-# -*- coding: iso-8859-15 -*-
-
def normalize_path( some_path ):
"""return os.path.normcase( os.path.normpath( some_path ) )"""
return os.path.normcase( os.path.normpath( some_path ) )
class filter_by_path_t:
- """The instance of this class will help user to define filter, that will
- exclude modules from being checked"""
+ """
+ Utility class, should not be used directly.
+ """
+
class FILTER_TYPE:
"""defines few filter constants"""
INCLUDE = 'include'
@@ -142,13 +82,11 @@
class checker_t( object ):
"""
- applies spell check process on every imported module
+ Applies spell check process on every imported module.
- This is the main class of this module. This class applies spell check
- process on every imported module. Every documentation string within the
- module will be checked. Some comments will be checked too. You should read
- inspect module documentation, in order to find out which comments will be
- checked.
+ Every documentation string within the imported modules will be checked.
+ Some comments will be checked too. The :mod:`inspect` module is used to
+ extract documentation strings and comments
"""
def __init__( self
@@ -280,28 +218,29 @@
self.__checked.add( id(member) )
"""documentation spell checker instance"""
-doc_checker = checker_t( checker.SpellChecker( "en_US" ) )
+doc_checker = None
+if 'sphinx' not in os.environ['PYDSC']:
+ doc_checker = checker_t( checker.SpellChecker( "en_US" ) )
def exclude( what ):
"""
- Convenience function. It will exclude all modules, that their source file or
- parent directory belongs to "what".
+ excludes all modules, from the check process, that are lying in *what* directory(ies)
- what - list of paths, could contain file and directory names
+ *what* - a path or list of paths, could be or contain file and/or directory names
"""
doc_checker.filter = filter_by_path_t( what, filter_by_path_t.FILTER_TYPE.EXCLUDE )
def include( what ):
"""
- Convenience function. It will include only modules, that their source file
- or parent directory belongs to "what".
+ includes all modules, to the check process, that are lying in *what* directory(ies)
- what - list of paths, could contain file and directory names
+ *what* - a path or list of paths, could be or contain file and/or directory names
"""
doc_checker.filter = filter_by_path_t( what, filter_by_path_t.FILTER_TYPE.INCLUDE )
def ignore( what, case_sensitive=False ):
- """Adds word or list of words to the ignore list.
+ """
+ adds *what*, word or list of words, to the ignore list.
what - word(string) or list of words(strings) to be ignored.
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-28 12:34:43
|
Revision: 1630
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1630&view=rev
Author: roman_yakovenko
Date: 2009-01-28 11:49:43 +0000 (Wed, 28 Jan 2009)
Log Message:
-----------
removing a file, that was added by mistake
Removed Paths:
-------------
sphinx/index.rest
Deleted: sphinx/index.rest
===================================================================
--- sphinx/index.rest 2009-01-28 11:42:27 UTC (rev 1629)
+++ sphinx/index.rest 2009-01-28 11:49:43 UTC (rev 1630)
@@ -1,96 +0,0 @@
-===========================
-C++ Python language binding
-===========================
-
-.. contents:: Table of contents
-
-.. toctree::
- :maxdepth: 2
-
-----------------
-pygccxml package
-----------------
-
-* Do you need to parse C++ code?
-* Do you need to build code generator?
-* Do you need to create UML diagram?
-
-`pygccxml`_ is the way to go! `Learn more`__.
-
-.. __: `pygccxml`_
-
-------------
-Py++ package
-------------
-
-"I love deadlines. I love the whooshing noise they make as they go by."
- -- Douglas Adams
-
-Meet your deadlines with powerful code generator engine - `Py++`_.
-`Py++`_ package and `Boost.Python`_ library provide a complete solution for
-interfacing Python and C++. `Learn more`_.
-
-*European Space Agency*, *Ogre*, *PyOpenSG* and many others `use`__ Py++.
-
-.. _`Learn more` : `Py++`_
-
-.. __: ./pyplusplus/quotes.html
-
----------------
-pyboost package
----------------
-
-`Boost`_ provides free peer-reviewed portable C++ source libraries. `pyboost`_
-package export the following libraries to Python:
-
- * `Boost.Date_Time`_ - date time library designed to provide a basis for
- performing efficient time calculations
- * `Boost.CRC`_ - cyclic redundancy code computation objects
- * `Boost.Rational`_ - rational number class
- * `Boost.Random`_ - a complete system for random number generation
-
-Python bindings for `boost.graph`_ library is also available from
-http://www.osl.iu.edu/~dgregor/bgl-python .
-
--------------
-pydsc package
--------------
-
-Documentation strings contain spelling errors? `Fix them in a minute`_.
-
-.. _`Fix them in a minute` : `pydsc`_
-
------------------
-pyeasybmp package
------------------
-
-`EasyBMP`_ could be easier? Yes of course! Learn more about `EasyBMP Python bindings`_.
-
-.. _`EasyBMP Python bindings`: ./pyplusplus/examples/easybmp/easybmp.html
-
-
-.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
-
-.. _`pyboost` : ./pyplusplus/examples/boost/boost.html
-.. _`boost.graph` : http://www.boost.org/libs/graph/doc/table_of_contents.html
-.. _`boost.date_time` : http://boost.org/doc/html/date_time.html
-.. _`boost.crc` : http://boost.org/libs/crc/index.html
-.. _`boost.rational` : http://boost.org/libs/rational/index.html
-.. _`boost.random` : http://boost.org/libs/random/index.html
-
-.. _`Boost`: http://boost.org/
-.. _`Python`: http://www.python.org
-.. _`pygccxml`: ./pygccxml/pygccxml.html
-.. _`Py++`: ./pyplusplus/pyplusplus.html
-.. _`pydsc`: ./pydsc/pydsc.html
-.. _`EasyBMP`: http://easybmp.sourceforge.net/
-
-.. _`many others` : ./x.html
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-28 12:34:39
|
Revision: 1629
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1629&view=rev
Author: roman_yakovenko
Date: 2009-01-28 11:42:27 +0000 (Wed, 28 Jan 2009)
Log Message:
-----------
adding directory skeleton for sphinx
Added Paths:
-----------
sphinx/
sphinx/Makefile
sphinx/__static/
sphinx/__templates/
sphinx/conf.py
sphinx/index.rest
Property changes on: sphinx
___________________________________________________________________
Added: svn:ignore
+ __build
pydsc
pygccxml
pyplusplus
Added: sphinx/Makefile
===================================================================
--- sphinx/Makefile (rev 0)
+++ sphinx/Makefile 2009-01-28 11:42:27 UTC (rev 1629)
@@ -0,0 +1,75 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d __build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " changes to make an overview over all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+
+clean:
+ -rm -rf __build/*
+
+html:
+ mkdir -p __build/html __build/doctrees
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) __build/html
+ @echo
+ @echo "Build finished. The HTML pages are in __build/html."
+
+pickle:
+ mkdir -p __build/pickle __build/doctrees
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) __build/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+web: pickle
+
+json:
+ mkdir -p __build/json __build/doctrees
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) __build/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ mkdir -p __build/htmlhelp __build/doctrees
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) __build/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in __build/htmlhelp."
+
+latex:
+ mkdir -p __build/latex __build/doctrees
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) __build/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in __build/latex."
+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+ "run these through (pdf)latex."
+
+changes:
+ mkdir -p __build/changes __build/doctrees
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) __build/changes
+ @echo
+ @echo "The overview file is in __build/changes."
+
+linkcheck:
+ mkdir -p __build/linkcheck __build/doctrees
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) __build/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in __build/linkcheck/output.txt."
Added: sphinx/conf.py
===================================================================
--- sphinx/conf.py (rev 0)
+++ sphinx/conf.py 2009-01-28 11:42:27 UTC (rev 1629)
@@ -0,0 +1,205 @@
+# -*- coding: utf-8 -*-
+#
+# Language Binding documentation build configuration file, created by
+# sphinx-quickstart on Wed Jan 28 10:41:40 2009.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os, shutil
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+project_root = os.path.abspath('..')
+doc_project_root = os.path.abspath('.')
+
+for entry in ( 'pydsc', 'pygccxml', 'pyplusplus' ):
+ target = os.path.join( doc_project_root, entry )
+ source = os.path.join( project_root, entry + '_dev', 'docs' )
+ if os.path.exists( target ):
+ shutil.rmtree( target )
+ shutil.copytree( source, target, ignore=shutil.ignore_patterns( r'.svn', '*.pyc', 'apidocs', 'www_configuration.py' ) )
+shutil.copy( os.path.join( project_root, 'index.rest' ), doc_project_root )
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['__templates']
+
+# The suffix of source filenames.
+source_suffix = '.rest'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Language Binding'
+copyright = u'2009, Roman Yakovenko'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1.1'
+# The full version, including alpha/beta/rc tags.
+release = '1.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['__build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['__static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'LanguageBindingdoc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+ ('index', 'LanguageBinding.tex', ur'Language Binding Documentation',
+ ur'Roman Yakovenko', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/dev': None}
Added: sphinx/index.rest
===================================================================
--- sphinx/index.rest (rev 0)
+++ sphinx/index.rest 2009-01-28 11:42:27 UTC (rev 1629)
@@ -0,0 +1,96 @@
+===========================
+C++ Python language binding
+===========================
+
+.. contents:: Table of contents
+
+.. toctree::
+ :maxdepth: 2
+
+----------------
+pygccxml package
+----------------
+
+* Do you need to parse C++ code?
+* Do you need to build code generator?
+* Do you need to create UML diagram?
+
+`pygccxml`_ is the way to go! `Learn more`__.
+
+.. __: `pygccxml`_
+
+------------
+Py++ package
+------------
+
+"I love deadlines. I love the whooshing noise they make as they go by."
+ -- Douglas Adams
+
+Meet your deadlines with powerful code generator engine - `Py++`_.
+`Py++`_ package and `Boost.Python`_ library provide a complete solution for
+interfacing Python and C++. `Learn more`_.
+
+*European Space Agency*, *Ogre*, *PyOpenSG* and many others `use`__ Py++.
+
+.. _`Learn more` : `Py++`_
+
+.. __: ./pyplusplus/quotes.html
+
+---------------
+pyboost package
+---------------
+
+`Boost`_ provides free peer-reviewed portable C++ source libraries. `pyboost`_
+package export the following libraries to Python:
+
+ * `Boost.Date_Time`_ - date time library designed to provide a basis for
+ performing efficient time calculations
+ * `Boost.CRC`_ - cyclic redundancy code computation objects
+ * `Boost.Rational`_ - rational number class
+ * `Boost.Random`_ - a complete system for random number generation
+
+Python bindings for `boost.graph`_ library is also available from
+http://www.osl.iu.edu/~dgregor/bgl-python .
+
+-------------
+pydsc package
+-------------
+
+Documentation strings contain spelling errors? `Fix them in a minute`_.
+
+.. _`Fix them in a minute` : `pydsc`_
+
+-----------------
+pyeasybmp package
+-----------------
+
+`EasyBMP`_ could be easier? Yes of course! Learn more about `EasyBMP Python bindings`_.
+
+.. _`EasyBMP Python bindings`: ./pyplusplus/examples/easybmp/easybmp.html
+
+
+.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
+
+.. _`pyboost` : ./pyplusplus/examples/boost/boost.html
+.. _`boost.graph` : http://www.boost.org/libs/graph/doc/table_of_contents.html
+.. _`boost.date_time` : http://boost.org/doc/html/date_time.html
+.. _`boost.crc` : http://boost.org/libs/crc/index.html
+.. _`boost.rational` : http://boost.org/libs/rational/index.html
+.. _`boost.random` : http://boost.org/libs/random/index.html
+
+.. _`Boost`: http://boost.org/
+.. _`Python`: http://www.python.org
+.. _`pygccxml`: ./pygccxml/pygccxml.html
+.. _`Py++`: ./pyplusplus/pyplusplus.html
+.. _`pydsc`: ./pydsc/pydsc.html
+.. _`EasyBMP`: http://easybmp.sourceforge.net/
+
+.. _`many others` : ./x.html
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-28 06:34:57
|
Revision: 1628
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1628&view=rev
Author: roman_yakovenko
Date: 2009-01-28 06:34:53 +0000 (Wed, 28 Jan 2009)
Log Message:
-----------
remove dead code
Modified Paths:
--------------
ui/web/main.py
Modified: ui/web/main.py
===================================================================
--- ui/web/main.py 2009-01-27 08:43:02 UTC (rev 1627)
+++ ui/web/main.py 2009-01-28 06:34:53 UTC (rev 1628)
@@ -16,9 +16,6 @@
generator = web.template.frender('templates/generator_tmpl.html')
return generator()
- #~ form = forms.generator_t(action='/generated.html')
- #~ return render.generator(form)
-
class generated:
def POST(self, r_url=None ):
form = form_processor.generator_t( code_generator.manager_t(), web.input() )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-27 08:43:06
|
Revision: 1627
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1627&view=rev
Author: roman_yakovenko
Date: 2009-01-27 08:43:02 +0000 (Tue, 27 Jan 2009)
Log Message:
-----------
filtering empty lines
Modified Paths:
--------------
ui/web/form_processor.py
Modified: ui/web/form_processor.py
===================================================================
--- ui/web/form_processor.py 2009-01-27 08:35:56 UTC (rev 1626)
+++ ui/web/form_processor.py 2009-01-27 08:43:02 UTC (rev 1627)
@@ -31,7 +31,8 @@
include_dirs = self.__input['COMPILER_INCLUDE_DIRECTORIES']
include_dirs = include_dirs.split('\n')
- cfg.include_paths.extend([ idir.strip() for idir in include_dirs ])
+ include_dirs = filter( None, [ idir.strip() for idir in include_dirs ] )
+ cfg.include_paths.extend(include_dirs)
preprocessor_defs = self.__input['COMPILER_PREPROCESSOR_DEFINITIONS']
cfg.append_cflags( preprocessor_defs.replace( '\n', ' ' ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-27 08:36:00
|
Revision: 1626
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1626&view=rev
Author: roman_yakovenko
Date: 2009-01-27 08:35:56 +0000 (Tue, 27 Jan 2009)
Log Message:
-----------
smart_ptr value_type could be type - add treatment for this case
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py
Modified: pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py
===================================================================
--- pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py 2009-01-27 08:28:24 UTC (rev 1625)
+++ pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py 2009-01-27 08:35:56 UTC (rev 1626)
@@ -30,10 +30,10 @@
del result[ value ]
return result
- def __report_single( self, control_decl, duplicated, logger ):
+ def __report_single( self, control_decl, duplicated, logger ):
value = self.get_value( control_decl )
if value not in duplicated:
- return
+ return
buggy_decls = duplicated[value].copy()
buggy_decls.remove( control_decl )
warning = self.msg % ( value, os.linesep.join( map( str, buggy_decls ) ) )
@@ -99,7 +99,11 @@
if sptr_traits.is_smart_pointer( depend_on_decl ):
try:
value_type = sptr_traits.value_type( depend_on_decl )
- return self.__has_unexposed_dependency( exported_ids, value_type, dependency )
+ if isinstance( value_type, declarations.type_t ):
+ value_type = declarations.remove_cv( value_type )
+ value_type = declarations.remove_declarated( value_type )
+ if isinstance( value_type, declarations.declaration_t ):
+ return self.__has_unexposed_dependency( exported_ids, value_type, dependency )
except RuntimeError:
pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-27 08:28:33
|
Revision: 1625
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1625&view=rev
Author: roman_yakovenko
Date: 2009-01-27 08:28:24 +0000 (Tue, 27 Jan 2009)
Log Message:
-----------
fix small bug in matcher - don't match namespaces by their location
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/matchers.py
Modified: pygccxml_dev/pygccxml/declarations/matchers.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/matchers.py 2009-01-27 06:37:45 UTC (rev 1624)
+++ pygccxml_dev/pygccxml/declarations/matchers.py 2009-01-27 08:28:24 UTC (rev 1625)
@@ -177,7 +177,7 @@
else:
self.__opt_is_full_name = False
self.__decl_name_only = self.__opt_tmpl_name
- self.__name = templates.normalize( name )
+ self.__name = templates.normalize( name )
else:
if '::' in self.__name:
self.__opt_is_full_name = True
@@ -210,15 +210,21 @@
if not None is self.name:
if not self.check_name( decl ):
return False
- if not None is self.header_dir and decl.location:
- decl_dir = os.path.abspath( os.path.dirname( decl.location.file_name ) )
- decl_dir = utils.normalize_path( decl_dir )
- if decl_dir[:len(self.header_dir)] != self.header_dir:
+ if not None is self.header_dir:
+ if decl.location:
+ decl_dir = os.path.abspath( os.path.dirname( decl.location.file_name ) )
+ decl_dir = utils.normalize_path( decl_dir )
+ if decl_dir[:len(self.header_dir)] != self.header_dir:
+ return False
+ else:
return False
- if not None is self.header_file and decl.location:
- decl_file = os.path.abspath( decl.location.file_name )
- decl_file = utils.normalize_path( decl_file )
- if decl_file != self.header_file:
+ if not None is self.header_file:
+ if decl.location:
+ decl_file = os.path.abspath( decl.location.file_name )
+ decl_file = utils.normalize_path( decl_file )
+ if decl_file != self.header_file:
+ return False
+ else:
return False
return True
@@ -229,7 +235,7 @@
if self.name != templates.normalize( decl.name ) \
and self.name != templates.normalize( decl.partial_name ):
return False
- else:
+ else:
if self.name != templates.normalize( algorithm.full_name( decl, with_defaults=True ) ) \
and self.name != templates.normalize( algorithm.full_name( decl, with_defaults=False ) ):
return False
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-27 06:37:48
|
Revision: 1624
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1624&view=rev
Author: roman_yakovenko
Date: 2009-01-27 06:37:45 +0000 (Tue, 27 Jan 2009)
Log Message:
-----------
adding ability to pass config_t instance to module_builder_t
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py
Modified: pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py 2009-01-26 20:00:13 UTC (rev 1623)
+++ pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py 2009-01-27 06:37:45 UTC (rev 1624)
@@ -43,7 +43,8 @@
, indexing_suite_version=1
, cflags=""
, encoding='ascii'
- , compiler=None):
+ , compiler=None
+ , gccxml_config=None):
"""
@param files: list of files, declarations from them you want to export
@type files: list of strings or L{file_configuration_t} instances
@@ -63,18 +64,23 @@
@param undefine_symbols: list of strings
@param cflags: Raw string to be added to gccxml command line.
+
+ @param gccxml_config: instance of pygccxml.parser.config_t class, holds
+ gccxml( compiler ) configuration. You can use this argument instead of
+ passing the compiler configuration separatly.
"""
module_builder.module_builder_t.__init__( self, global_ns=None, encoding=encoding )
- gccxml_config = parser.config_t( gccxml_path=gccxml_path
- , working_directory=working_directory
- , include_paths=include_paths
- , define_symbols=define_symbols
- , undefine_symbols=undefine_symbols
- , start_with_declarations=start_with_declarations
- , ignore_gccxml_output=ignore_gccxml_output
- , cflags=cflags
- , compiler=compiler)
+ if not gccxml_config:
+ gccxml_config = parser.config_t( gccxml_path=gccxml_path
+ , working_directory=working_directory
+ , include_paths=include_paths
+ , define_symbols=define_symbols
+ , undefine_symbols=undefine_symbols
+ , start_with_declarations=start_with_declarations
+ , ignore_gccxml_output=ignore_gccxml_output
+ , cflags=cflags
+ , compiler=compiler)
#may be in future I will add those directories to user_defined_directories to self.__code_creator.
self.__parsed_files = map( pygccxml_utils.normalize_path
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 20:00:23
|
Revision: 1623
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1623&view=rev
Author: roman_yakovenko
Date: 2009-01-26 20:00:13 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
changing alias used for C++/Python and XML code blocks
Modified Paths:
--------------
pydsc_dev/docs/pydsc.rest
pygccxml_dev/docs/design.rest
pygccxml_dev/docs/history/history.rest
pygccxml_dev/docs/pygccxml.rest
pygccxml_dev/docs/query_interface.rest
pygccxml_dev/docs/upgrade_issues.rest
pyplusplus_dev/docs/comparisons/pyste.rest
pyplusplus_dev/docs/documentation/architecture.rest
pyplusplus_dev/docs/documentation/containers.rest
pyplusplus_dev/docs/documentation/ctypes/this_and_sizeof.rest
pyplusplus_dev/docs/documentation/ctypes/unions.rest
pyplusplus_dev/docs/documentation/ctypes/variables.rest
pyplusplus_dev/docs/documentation/doc_string.rest
pyplusplus_dev/docs/documentation/functions/call_policies/as_tuple.rest
pyplusplus_dev/docs/documentation/functions/call_policies/call_policies.rest
pyplusplus_dev/docs/documentation/functions/call_policies/custom_call_policies.rest
pyplusplus_dev/docs/documentation/functions/call_policies/return_addressof.rest
pyplusplus_dev/docs/documentation/functions/call_policies/return_pointee_value.rest
pyplusplus_dev/docs/documentation/functions/call_policies/return_range.rest
pyplusplus_dev/docs/documentation/functions/default_args.rest
pyplusplus_dev/docs/documentation/functions/make_constructor.rest
pyplusplus_dev/docs/documentation/functions/overloading.rest
pyplusplus_dev/docs/documentation/functions/registration_order.rest
pyplusplus_dev/docs/documentation/functions/transformation/inout.rest
pyplusplus_dev/docs/documentation/functions/transformation/input.rest
pyplusplus_dev/docs/documentation/functions/transformation/input_c_buffer.rest
pyplusplus_dev/docs/documentation/functions/transformation/input_static_array.rest
pyplusplus_dev/docs/documentation/functions/transformation/modify_type.rest
pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest
pyplusplus_dev/docs/documentation/functions/transformation/output.rest
pyplusplus_dev/docs/documentation/functions/transformation/output_static_array.rest
pyplusplus_dev/docs/documentation/functions/transformation/transfer_ownership.rest
pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest
pyplusplus_dev/docs/documentation/how_to/absolute_relative_paths.rest
pyplusplus_dev/docs/documentation/how_to/best_practices.rest
pyplusplus_dev/docs/documentation/how_to/exception_translation.rest
pyplusplus_dev/docs/documentation/how_to/file_name_too_long.rest
pyplusplus_dev/docs/documentation/how_to/hints.rest
pyplusplus_dev/docs/documentation/how_to/templates.rest
pyplusplus_dev/docs/documentation/inserting_code.rest
pyplusplus_dev/docs/documentation/multi_module_development.rest
pyplusplus_dev/docs/documentation/properties.rest
pyplusplus_dev/docs/documentation/split_module.rest
pyplusplus_dev/docs/documentation/tutorials/module_builder/module_builder.rest
pyplusplus_dev/docs/documentation/warnings.rest
pyplusplus_dev/docs/examples/boost/boost.rest
pyplusplus_dev/docs/history/history.rest
pyplusplus_dev/docs/peps/dsl_challenge.rest
pyplusplus_dev/docs/pyplusplus.rest
pyplusplus_dev/docs/troubleshooting_guide/easy_extending_guide/easy_extending_guide.rest
pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest
Modified: pydsc_dev/docs/pydsc.rest
===================================================================
--- pydsc_dev/docs/pydsc.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pydsc_dev/docs/pydsc.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -24,7 +24,7 @@
check all the documentation strings. My goal was simplicity + easy customization.
I achieved it. Here is example of usage of pydsc:
-.. code-block:: Python
+.. code-block:: python
import pydsc
#every module that will be imported after pydsc will be checked
@@ -51,7 +51,7 @@
"More complex" example:
-.. code-block:: Python
+.. code-block:: python
import pydsc
#check for spell errors only in files under "/home/roman/pygccxml" directory
Modified: pygccxml_dev/docs/design.rest
===================================================================
--- pygccxml_dev/docs/design.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pygccxml_dev/docs/design.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -255,13 +255,13 @@
Well, `GCC-XML`_ has few bugs, which could not be fixed from it. For example
-.. code-block:: cpp
+.. code-block:: c++
namespace ns1{ namespace ns2{
enum fruit{ apple, orange };
} }
-.. code-block:: cpp
+.. code-block:: c++
void fix_enum( ns1::ns2::fruit arg=ns1::ns2::apple );
Modified: pygccxml_dev/docs/history/history.rest
===================================================================
--- pygccxml_dev/docs/history/history.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pygccxml_dev/docs/history/history.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -47,7 +47,7 @@
Description:
- .. code-block:: cpp
+ .. code-block:: c++
void do_smth( int, ... )
@@ -322,7 +322,7 @@
4. Now you can pass operator symbol, as a name to query functions:
- .. code-block:: Python
+ .. code-block:: python
cls = global_namespace.class_( 'my_class' )
op = cls.operator( '<' )
@@ -355,7 +355,7 @@
So for example:
- .. code-block:: Python
+ .. code-block:: python
classes = ns.decls("class")
classes.decls("method")
Modified: pygccxml_dev/docs/pygccxml.rest
===================================================================
--- pygccxml_dev/docs/pygccxml.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pygccxml_dev/docs/pygccxml.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -51,7 +51,7 @@
Only 1 ( one ) line of code is needed:
-.. code-block:: Python
+.. code-block:: python
#global_ns is the reference to declarations, which describes global( :: ) namespace
global_ns.free_functions( "do_smth", return_type='void', arg_types=[None,'int'] )
Modified: pygccxml_dev/docs/query_interface.rest
===================================================================
--- pygccxml_dev/docs/query_interface.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pygccxml_dev/docs/query_interface.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -16,7 +16,7 @@
a reference to an integer. More over, I want those functions names to end with
"impl" string and they should be protected or private.
-.. code-block:: Python
+.. code-block:: python
#global_ns is the reference to an instance of namespace_t object, that
#represents global namespace
@@ -28,7 +28,7 @@
yourself, looking for one or many declarations, using one or two declaration properties.
For example:
-.. code-block:: Python
+.. code-block:: python
global_ns.namespaces( 'details' )
@@ -56,7 +56,7 @@
The usage of other methods is very similar to them. Here is definition of those
methods:
-.. code-block:: Python
+.. code-block:: python
def member_function( self,
name=None,
@@ -88,7 +88,7 @@
Python string, that contains member function name or full name.
- .. code-block:: Python
+ .. code-block:: python
do_smth = my_class.member_function( 'do_smth' )
do_smth = my_class.member_function( 'my_namespace::my_class::do_smth' )
@@ -99,7 +99,7 @@
build custom query. This object will be called with one argument - declaration,
and it should return ``True`` or ``False``.
- .. code-block:: Python
+ .. code-block:: python
impls = my_class.member_functions( lambda decl: decl.name.endswith( 'impl' ) )
@@ -111,7 +111,7 @@
the function return type. This argument can be string or an object that describes
C++ type.
- .. code-block:: Python
+ .. code-block:: python
mem_funcs = my_class.member_functions( return_type='int' )
@@ -128,7 +128,7 @@
to skip some argument type from within comparison, you put ``None``, into
relevant position within the list.
- .. code-block:: Python
+ .. code-block:: python
mem_funcs = my_class.member_functions( arg_types=[ None, 'int'] )
@@ -190,14 +190,14 @@
In order to help `Boost.Python`_ to manage objects life time, all functions
should have `call policies`_. For example:
-.. code-block:: cpp
+.. code-block:: c++
struct A{
A* clone() const { return new A(); }
...
};
-.. code-block:: cpp
+.. code-block:: c++
struct B{
B* clone() const { return new B(); }
@@ -208,7 +208,7 @@
The following code applies the `call policies`_ on all ``clone`` member functions within the
project:
-.. code-block:: Python
+.. code-block:: python
#global_ns - instance of namespace_t class, that contains reference to global namespace
clone = global_ns.member_functions( 'clone' )
@@ -219,7 +219,7 @@
exclude declaration, from being exported to Python. The following code will exclude
``clone`` member function from being exported:
-.. code-block:: Python
+.. code-block:: python
global_ns.member_functions( 'clone' ).exclude()
@@ -228,7 +228,7 @@
write loops, ``mdecl_wrapper_t`` class implements ``__len__``, ``__getitem__``
and ``__iter__`` methods. So you can write the following code:
-.. code-block:: Python
+.. code-block:: python
for clone in global_ns.member_functions( 'clone' ):
print clone.parent.name
Modified: pygccxml_dev/docs/upgrade_issues.rest
===================================================================
--- pygccxml_dev/docs/upgrade_issues.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pygccxml_dev/docs/upgrade_issues.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -37,7 +37,7 @@
C++ code:
-.. code-block:: cpp
+.. code-block:: c++
struct xyz_t{
int do_smth( double );
@@ -50,7 +50,7 @@
GCC-XML 0.7:
-.. code-block:: XML
+.. code-block:: xml
<Typedef id="_6" name="mfun_ptr_t" type="_5" />
<PointerType id="_5" type="_128" size="32" align="32"/>
@@ -64,7 +64,7 @@
GCC-XML 0.9:
-.. code-block:: XML
+.. code-block:: xml
<Typedef id="_97" name="mfun_ptr_t" type="_96" />
<PointerType id="_96" type="_147" size="32" align="32"/>
@@ -85,7 +85,7 @@
For example:
-.. code-block:: cpp
+.. code-block:: c++
const long unsigned int initialized = 10122004;
@@ -102,100 +102,100 @@
fixes some issues, but introduces another ones. Take a look on the following examples:
*
- .. code-block:: cpp
+ .. code-block:: c++
void fix_numeric( ull arg=(ull)-1 );
GCC-XML 0.7
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="arg" type="_7" default="0xffffffffffffffff"/>
GCC-XML 0.9
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="arg" type="_103" default="0xffffffffffffffffu"/>
*
- .. code-block:: cpp
+ .. code-block:: c++
void fix_function_call( int i=calc( 1,2,3) );
GCC-XML 0.7
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="i" type="_9" default="function_call::calc(int, int, int)(1, 2, 3)"/>
GCC-XML 0.9
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="i" type="_34" default="function_call::calc(1, 2, 3)"/>
*
- .. code-block:: cpp
+ .. code-block:: c++
void typedef__func( const typedef_::alias& position = typedef_::alias() );
GCC-XML 0.7
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="position" type="_1458" default="alias()"/>
GCC-XML 0.9
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="position" type="_1703" default="typedef_::original_name()"/>
*
- .. code-block:: cpp
+ .. code-block:: c++
void typedef__func2( const typedef_::alias& position = alias() );
GCC-XML 0.7
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="position" type="_1458" default="alias()"/>
GCC-XML 0.9
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="position" type="_1703" default="typedef_::original_name()"/>
*
- .. code-block:: cpp
+ .. code-block:: c++
node* clone_tree( const std::vector<std::string> &types=std::vector<std::string>() );
GCC-XML 0.7
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="types" type="_3336" default="vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >((&allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >()))"/>
GCC-XML 0.9
- .. code-block:: XML
+ .. code-block:: xml
<Argument name="types" type="_3096" default="std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(((const std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)((const std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >*)(& std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >()))))"/>
Basically `pygccxml`_ can't help you here. The good news is that you always can
change the default value expression from the script:
-.. code-block:: Python
+.. code-block:: python
#f is "calldef_t" instance
for arg in f.arguments:
@@ -211,7 +211,7 @@
Consider the following C++ code:
-.. code-block:: cpp
+.. code-block:: c++
template< unsigned long i1>
struct item_t{
Modified: pyplusplus_dev/docs/comparisons/pyste.rest
===================================================================
--- pyplusplus_dev/docs/comparisons/pyste.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/comparisons/pyste.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -186,15 +186,15 @@
* code creator that generates body of "overridden" virtual functions:
- .. code-block:: cpp
+ .. code-block:: c++
struct expensive_to_copy{...};
- .. code-block:: cpp
+ .. code-block:: c++
void do_smth( expensive_to_copy* x, const expensive_to_copy& y ){...}
- .. code-block:: cpp
+ .. code-block:: c++
void
do_smth(expensive_to_copy* x, const expensive_to_copy& y){
@@ -332,7 +332,7 @@
* To define namespace alias.
- .. code-block:: cpp
+ .. code-block:: c++
namespace dt = boost::date_time;
@@ -341,7 +341,7 @@
* Classes and functions support 2 modes of code generation. Example:
- .. code-block:: cpp
+ .. code-block:: c++
struct world{
void set(std::string msg) { this->msg = msg; }
@@ -351,7 +351,7 @@
First mode:
- .. code-block:: cpp
+ .. code-block:: c++
class_<world>("world")
.def("greet", &world::greet)
@@ -361,7 +361,7 @@
Second mode:
- .. code-block:: cpp
+ .. code-block:: c++
if( true ){
typedef class_<world> world_exposer_t;
Modified: pyplusplus_dev/docs/documentation/architecture.rest
===================================================================
--- pyplusplus_dev/docs/documentation/architecture.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/architecture.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -85,7 +85,7 @@
Before I explain how these services are integrated, take a look on the following source
code:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
@@ -225,7 +225,7 @@
Here is "cut & paste" of the relevant code from the source file:
- .. code-block:: Python
+ .. code-block:: python
def _create_impl(self):
result = []
Modified: pyplusplus_dev/docs/documentation/containers.rest
===================================================================
--- pyplusplus_dev/docs/documentation/containers.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/containers.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -80,7 +80,7 @@
indexing suite version 2, you should tell this to the ``module_builder_t.__init__``
method:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ..., indexing_suite_version=2 )
@@ -125,7 +125,7 @@
In this case there is no single place, where you can configure exported container
functionality. Please take a look on the following C++ code:
-.. code-block:: cpp
+.. code-block:: c++
struct item{
...
Modified: pyplusplus_dev/docs/documentation/ctypes/this_and_sizeof.rest
===================================================================
--- pyplusplus_dev/docs/documentation/ctypes/this_and_sizeof.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/ctypes/this_and_sizeof.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -15,7 +15,7 @@
Example
-------
- .. code-block:: Python
+ .. code-block:: python
mb = module_builder_t( ... )
cls = mb.class_( <<<your class>>> )
@@ -25,7 +25,7 @@
The `Python`_ class will contain two properties ``this`` and ``sizeof``. The usage
is pretty simple:
- .. code-block:: Python
+ .. code-block:: python
import ctypes
from <<<your module>>> import <<<your class>>> as data_t
Modified: pyplusplus_dev/docs/documentation/ctypes/unions.rest
===================================================================
--- pyplusplus_dev/docs/documentation/ctypes/unions.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/ctypes/unions.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -22,7 +22,7 @@
For this example I am going to use the following code:
- .. code-block:: cpp
+ .. code-block:: c++
struct data_t{
union actual_data_t{
@@ -34,7 +34,7 @@
As in many other cases, `Py++`_ does the job automatically:
- .. code-block:: Python
+ .. code-block:: python
mb = module_builder_t( ... )
mb.class_( 'data_t' ).include()
@@ -44,7 +44,7 @@
The generated code is boring, so I will skip it and will continue to the usage
example:
- .. code-block:: Python
+ .. code-block:: python
import ctypes
from <<<your module>>> import data_t
Modified: pyplusplus_dev/docs/documentation/ctypes/variables.rest
===================================================================
--- pyplusplus_dev/docs/documentation/ctypes/variables.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/ctypes/variables.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -21,7 +21,7 @@
Lets say you have the following C++ code:
- .. code-block:: cpp
+ .. code-block:: c++
struct bytes_t{
bytes_t(){
@@ -41,7 +41,7 @@
In order to get access to the ``bytes_t::data`` and ``bytes_t::x`` you
have to turn on ``expose_address`` property to ``True``:
- .. code-block:: Python
+ .. code-block:: python
mb = module_builder_t( ... )
bytes = mb.class_( 'bytes_t' )
@@ -51,7 +51,7 @@
and now it is a time to show some `ctypes`_ magic:
- .. code-block:: Python
+ .. code-block:: python
import ctypes
import your_module as m
Modified: pyplusplus_dev/docs/documentation/doc_string.rest
===================================================================
--- pyplusplus_dev/docs/documentation/doc_string.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/doc_string.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -15,7 +15,7 @@
API description
---------------
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
my_class = mb.class_( 'my_class' )
@@ -37,7 +37,7 @@
``doc_extractor`` is a callable object, which takes one argument - reference to declaration.
-.. code-block:: Python
+.. code-block:: python
def doc_extractor( decl ):
...
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/as_tuple.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/as_tuple.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/as_tuple.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -16,7 +16,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
struct vector3{
...
@@ -65,7 +65,7 @@
The `Py++`_ code is slightly different from the C++ one, but it is definitely shorter:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
from pyplusplus.module_builder import call_policies
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/call_policies.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/call_policies.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/call_policies.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -21,13 +21,13 @@
The call policies in `Py++`_ are named exactly as in `Boost.Python`_, only the
syntax is slightly different. For instance, this call policy:
-.. code-block:: cpp
+.. code-block:: c++
return_internal_reference< 1, with_custodian_and_ward<1, 2> >()
becomes in `Py++`_
-.. code-block:: Python
+.. code-block:: python
return_internal_reference( 1, with_custodian_and_ward(1, 2) )
@@ -41,7 +41,7 @@
C++ code:
- .. code-block:: cpp
+ .. code-block:: c++
struct data{...};
const data& do_smth( const data& d, int x );
@@ -53,7 +53,7 @@
Python code:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus import module_builder
from pyplusplus.module_builder import call_policies
@@ -130,7 +130,7 @@
* `Py++`_ generates code with
- .. code-block:: cpp
+ .. code-block:: c++
/* undefined call policies */
@@ -157,7 +157,7 @@
Example:
-.. code-block:: cpp
+.. code-block:: c++
struct identity_impl_t{};
typedef identity_impl_t* identity;
@@ -173,7 +173,7 @@
`Py++`_ code:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t(...)
mb.class_( 'identity_impl_t' ).opaque = True
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/custom_call_policies.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/custom_call_policies.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/custom_call_policies.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -15,7 +15,7 @@
Example
-------
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
from pyplusplus.module_builder import call_policies
@@ -26,7 +26,7 @@
Optionally you can specify name of the header file, which should be included:
-.. code-block:: Python
+.. code-block:: python
mb.free_function( ... ).call_policies \
= call_policies.custom_call_policies( <<<your call policies code>>>, "xyz.hpp" )
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/return_addressof.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/return_addressof.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/return_addressof.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -21,7 +21,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
int* get_value(){
static int buffer[] = { 0,1,2,3,4 };
@@ -36,7 +36,7 @@
The `Py++`_ code is not that different from what you already know:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
from pyplusplus.module_builder import call_policies
@@ -47,7 +47,7 @@
Python code:
-.. code-block:: Python
+.. code-block:: python
import ctypes
import my_module
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/return_pointee_value.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/return_pointee_value.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/return_pointee_value.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -12,7 +12,7 @@
can be used to wrap C++ functions, that return a pointer to a C++ object. The
policy implements the following logic:
-.. code-block:: cpp
+.. code-block:: c++
if( <<<return value is NULL pointer>>> ){
return None;
@@ -46,7 +46,7 @@
This technique and example was contributed by Maximilian Matthe.
-.. code-block:: cpp
+.. code-block:: c++
struct int_wrapper{
int_wrapper(int v)
@@ -83,7 +83,7 @@
Python code:
-.. code-block:: Python
+.. code-block:: python
import my_module
@@ -93,7 +93,7 @@
Return pointee value
--------------------
-.. code-block:: cpp
+.. code-block:: c++
float* get_value(){
static float value = 0.5;
@@ -115,7 +115,7 @@
The `Py++`_ code is not that different from what you already know:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
from pyplusplus.module_builder import call_policies
@@ -126,7 +126,7 @@
Python code:
-.. code-block:: Python
+.. code-block:: python
import my_module
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/return_range.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/return_range.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/return_range.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -18,7 +18,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
struct image_t{
@@ -49,7 +49,7 @@
``return_range`` class
----------------------
-.. code-block:: cpp
+.. code-block:: c++
template < typename TGetSize
, typename TValueType
@@ -80,7 +80,7 @@
* call operator with the following signature:
- .. code-block:: cpp
+ .. code-block:: c++
ssize_t operator()( boost::python::tuple args );
@@ -91,7 +91,7 @@
For our case, the following class could be defined:
-.. code-block:: cpp
+.. code-block:: c++
struct image_data_size_t{
ssize_t operator()( boost::python::tuple args ){
@@ -105,7 +105,7 @@
Passing all arguments, instead of single "self" argument gives you an ability
to treat functions, where the user asked to get access to the part of the array.
-.. code-block:: cpp
+.. code-block:: c++
struct image_t{
...
@@ -119,7 +119,7 @@
The following "get size" class treats this situation:
-.. code-block:: cpp
+.. code-block:: c++
struct image_data_size_t{
ssize_t operator()( boost::python::tuple args ){
@@ -151,7 +151,7 @@
I think, now you are ready to see the whole solution:
-.. code-block:: cpp
+.. code-block:: c++
namespace bpl = boost::python;
namespace ppc = pyplusplus::call_policies;
@@ -168,7 +168,7 @@
The `Py++`_ code is not that different from what you already know:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
from pyplusplus.module_builder import call_policies
@@ -206,7 +206,7 @@
Python usage code:
-.. code-block:: Python
+.. code-block:: python
from my_module import *
Modified: pyplusplus_dev/docs/documentation/functions/default_args.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/default_args.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/default_args.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -11,7 +11,7 @@
There is more than one way to export function with default arguments. Before we
proceed, please take a look on the following class:
-.. code-block:: cpp
+.. code-block:: c++
struct X
{
@@ -27,7 +27,7 @@
By default `Py++`_ exposes function with its default arguments.
-.. code-block:: cpp
+.. code-block:: c++
namespace bp = boost::python;
@@ -42,7 +42,7 @@
The additional value of the approach is keyword arguments. You will be able to
call function ``f`` like this:
-.. code-block:: Python
+.. code-block:: python
x = X()
x.f( a=13 )
@@ -55,7 +55,7 @@
macros can help to deal with default values too. You can turn ``use_overload_macro``
to ``True``:
-.. code-block:: Python
+.. code-block:: python
import module_builder
@@ -71,7 +71,7 @@
There is different trades-off between these approaches. In general you should
use the first one, until you have "registration order" problem:
-.. code-block:: cpp
+.. code-block:: c++
struct S1;
struct S2;
@@ -101,7 +101,7 @@
`Py++`_ doesn't have enough information to generate code with the right class
registration order. In this case you have to instruct `Py++`_ to use macros:
-.. code-block:: Python
+.. code-block:: python
import module_builder
@@ -122,7 +122,7 @@
Class constructors are special case:
-.. code-block:: cpp
+.. code-block:: c++
struct S1;
struct S2;
Modified: pyplusplus_dev/docs/documentation/functions/make_constructor.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/make_constructor.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/make_constructor.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -19,7 +19,7 @@
-------------
I am going to use the following code to demonstrate the functionality:
-.. code-block:: cpp
+.. code-block:: c++
#include <memory>
@@ -41,7 +41,7 @@
`Py++`_ configuration is pretty simple:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
@@ -62,7 +62,7 @@
The usage code is even more boring:
-.. code-block:: Python
+.. code-block:: python
from your_module import number_t
Modified: pyplusplus_dev/docs/documentation/functions/overloading.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/overloading.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/overloading.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -13,7 +13,7 @@
want to export, by specifying its type. Before we proceed, please take a look
on the following class:
-.. code-block:: cpp
+.. code-block:: c++
struct X
{
@@ -46,7 +46,7 @@
I am sure you will like "do nothing" approach. `Py++`_ recognize that you want to
export an overloaded function and will generate the right code:
-.. code-block:: cpp
+.. code-block:: c++
namespace bp = boost::python;
@@ -82,7 +82,7 @@
It is very important to understand it. Lets take a look on the following source code:
-.. code-block:: cpp
+.. code-block:: c++
struct Y{
@@ -99,7 +99,7 @@
code will not compile. You have to instruct `Py++`_ to generate code, which
contains function type:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
@@ -126,7 +126,7 @@
Consider to explicitly set ``create_with_signature`` to ``True``. It will save
your and your users time in future.
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
mb.calldefs().create_with_signature = True
@@ -149,7 +149,7 @@
You can instruct `Py++`_ to generate code, which will use the macros:
-.. code-block:: Python
+.. code-block:: python
import module_builder
Modified: pyplusplus_dev/docs/documentation/functions/registration_order.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/registration_order.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/registration_order.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -22,7 +22,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
struct tester_t{
tester_t() {}
@@ -43,7 +43,7 @@
`Py++`_ generates code, that register functions in the order they appear in the
source code:
-.. code-block:: cpp
+.. code-block:: c++
namespace bp = boost::python;
@@ -66,7 +66,7 @@
Do you want to guess what is the output of the following program:
-.. code-block:: Python
+.. code-block:: python
import my_module
tester = my_module.tester_t()
@@ -97,7 +97,7 @@
1. You can change alias of the function, by mangling the type of the argument
into it:
- .. code-block:: Python
+ .. code-block:: python
mb = module_builder_t( ... )
for f in mb.class_( 'tester_t' ).member_functions():
@@ -108,7 +108,7 @@
3. You can ask `Py++`_ to generate code, which takes into account the order of
declarations:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus.creators_factory import sort_algorithms
@@ -120,7 +120,7 @@
this you can change the aliases of the functions. The third step is to create
small "dispatch" function in Python:
- .. code-block:: Python
+ .. code-block:: python
import my_module
Modified: pyplusplus_dev/docs/documentation/functions/transformation/inout.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/inout.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/inout.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -24,7 +24,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
#include <string>
@@ -36,7 +36,7 @@
``std::string`` is mapped to `Python`_ string, which is immutable type, so you
have to create small wrapper for the function. The following `Py++`_ code does it for you:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
@@ -47,7 +47,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: cpp
+ .. code-block:: c++
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/input.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/input.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/input.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -18,7 +18,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
#include <string>
@@ -30,7 +30,7 @@
``std::string`` is mapped to `Python`_ string, which is immutable type, so you
have to create small wrapper for the function. The following `Py++`_ code does it for you:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
@@ -41,7 +41,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: cpp
+ .. code-block:: c++
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/input_c_buffer.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/input_c_buffer.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/input_c_buffer.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -20,7 +20,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
struct file_t{
void write( char* buffer, int size ) const;
@@ -29,7 +29,7 @@
In order to expose ``write`` member function we need to create small wrapper.
The following `Py++`_ code does it for you:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
@@ -40,7 +40,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: cpp
+ .. code-block:: c++
#include "__convenience.pypp.hpp" //Py++ header file, which contains few convenience function
Modified: pyplusplus_dev/docs/documentation/functions/transformation/input_static_array.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/input_static_array.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/input_static_array.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -20,7 +20,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
struct vector3{
@@ -36,7 +36,7 @@
In order to expose ``init`` member function we need to create small wrapper:
The following `Py++`_ code does it for you:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
@@ -47,7 +47,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: cpp
+ .. code-block:: c++
#include "__convenience.pypp.hpp" //Py++ header file, which contains few convenience function
Modified: pyplusplus_dev/docs/documentation/functions/transformation/modify_type.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/modify_type.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/modify_type.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -28,7 +28,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
#include <string>
@@ -40,7 +40,7 @@
``std::string`` is mapped to `Python`_ string, which is immutable type, so you
have to create small wrapper for the function. The following `Py++`_ code does it for you:
- .. code-block:: Python
+ .. code-block:: python
from pygccxml import declarations
from pyplusplus import module_builder
@@ -52,7 +52,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: cpp
+ .. code-block:: c++
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -20,7 +20,7 @@
name mangling to create function-wrappers for overloaded and\\or free functions.
Consider the following use case:
- .. code-block:: cpp
+ .. code-block:: c++
void get_distance( long& );
void get_distance( double& );
@@ -28,7 +28,7 @@
In order to expose ``get_distance`` functions you have to create 2 function
wrappers:
- .. code-block:: cpp
+ .. code-block:: c++
long get_distance_as_long(){...}
double get_distance_as_double(){...}
@@ -37,7 +37,7 @@
on return type only. You also have to exposes them under different aliases,
otherwise they will not be callable from `Python`_:
- .. code-block:: cpp
+ .. code-block:: c++
namespace bp = boost::python;
BOOST_PYTHON_MODULE(...){
@@ -64,7 +64,7 @@
If you are exposing an overloaded function, in that case `Py++`_ uses the ugly
function-wrapper name as an alias. It is up to you to change the alias:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
Modified: pyplusplus_dev/docs/documentation/functions/transformation/output.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/output.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/output.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -20,7 +20,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
#include <string>
@@ -32,7 +32,7 @@
``std::string`` is mapped to `Python`_ string, which is immutable type, so you
have to create small wrapper for the function. The following `Py++`_ code does it for you:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
@@ -43,7 +43,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: cpp
+ .. code-block:: c++
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/output_static_array.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/output_static_array.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/output_static_array.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -19,7 +19,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
struct vector3{
@@ -35,7 +35,7 @@
In order to expose ``get_values`` member function we need to create small wrapper.
The following `Py++`_ code does it for you:
- .. code-block:: Python
+ .. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
@@ -46,7 +46,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: cpp
+ .. code-block:: c++
#include "__convenience.pypp.hpp" //Py++ header file, which contains few convenience function
Modified: pyplusplus_dev/docs/documentation/functions/transformation/transfer_ownership.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/transfer_ownership.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/transfer_ownership.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -24,7 +24,7 @@
Example
-------
-.. code-block:: cpp
+.. code-block:: c++
struct resource_t{...};
@@ -36,7 +36,7 @@
have to create small wrapper, which will take ``std::auto_ptr`` as an argument.
The following `Py++`_ code does it for you:
- .. code-block:: Python
+ .. code-block:: python
from pygccxml import declarations
from pyplusplus import module_builder
@@ -51,7 +51,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: cpp
+ .. code-block:: c++
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -15,7 +15,7 @@
An often mentioned example that demonstrates the problem is the ``get_size()``
member function of a fictitious image class:
-.. code-block:: cpp
+.. code-block:: c++
void get_size(int& width, int& height);
@@ -25,13 +25,13 @@
way to expose this function to `Python`_ is to create small wrapper, which will
return a tuple. In `Python`_, the above function would instead be invoked like this:
-.. code-block:: Python
+.. code-block:: python
width, height = img.get_size()
and the wrapper could look like this:
-.. code-block:: cpp
+.. code-block:: c++
boost::python::tuple get_size( const image_t& img ){
int width;
@@ -57,7 +57,7 @@
to provide the semantics of an argument(s) and then it will take care of
producing the correct code:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
Modified: pyplusplus_dev/docs/documentation/how_to/absolute_relative_paths.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/absolute_relative_paths.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/how_to/absolute_relative_paths.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -18,14 +18,14 @@
`Py++`_ does not handle relative paths, as input, well. It tries, but there are uses
cases it fails. In these cases it generates empty module - nothing is exposed:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder( [ 'date_time/date_time.hpp' ], ... )
mb.split_module( ... )
I recommend you to use absolute paths instead of relative ones:
-.. code-block:: Python
+.. code-block:: python
import os
mb = module_builder( [ os.path.abspath('date_time/date_time.hpp') ], ... )
Modified: pyplusplus_dev/docs/documentation/how_to/best_practices.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/best_practices.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/how_to/best_practices.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -41,7 +41,7 @@
``module_builder_t.__init__`` method takes reference to an instance of cache
class or ``None``:
- .. code-block:: Python
+ .. code-block:: python
from module_builder import *
mb = module_builder_t( ..., cache=file_cache_t( <<<path to project cache file>>> ), ... )
@@ -60,7 +60,7 @@
implemented an initial version of the functionality. After small discussion,
we agreed on the following interface:
- .. code-block:: Python
+ .. code-block:: python
class module_builder_t( ... ):
...
@@ -77,7 +77,7 @@
`this error`_. `Py++`_ will automatically split generated code for the
huge classes to few files:
- .. code-block:: Python
+ .. code-block:: python
mb = module_builder_t( ... )
...
@@ -99,7 +99,7 @@
recommended that you use "os.path.abspath()" to transform the header file to
be processed into an absolute path:
- .. code-block:: Python
+ .. code-block:: python
#the following code will expose nothing
mb = module_builder( [ 'date_time/date_time.hpp' ], ... )
@@ -148,7 +148,7 @@
instead of loading the content of the previously generated file from the disk
and comparing against it.
- .. code-block:: Python
+ .. code-block:: python
mb = module_builder_t( ... )
...
Modified: pyplusplus_dev/docs/documentation/how_to/exception_translation.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/exception_translation.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/how_to/exception_translation.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -25,7 +25,7 @@
what should be done. I will use that example, to show how it could be done with
`Py++`_:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder_t
@@ -42,7 +42,7 @@
and than to create an instance of Python built-in exception. That is exactly why
`Py++`_ provides additional API:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
my_exception = mb.class_( 'my_exception' )
Modified: pyplusplus_dev/docs/documentation/how_to/file_name_too_long.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/file_name_too_long.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/how_to/file_name_too_long.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -13,7 +13,7 @@
Let me explain.
-.. code-block:: cpp
+.. code-block:: c++
template < class T>
struct holder{ ... };
@@ -27,7 +27,7 @@
It is pretty simple to change the alias of the class, or any other declaration:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
Modified: pyplusplus_dev/docs/documentation/how_to/hints.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/hints.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/how_to/hints.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -13,7 +13,7 @@
For example:
-.. code-block:: cpp
+.. code-block:: c++
#include <vector>
typedef std::vector< int > numbers;
@@ -23,7 +23,7 @@
`Py++`_ will use "numbers" as Python class name:
-.. code-block:: cpp
+.. code-block:: c++
using boost::python;
class_< std::vector< int > >( "numbers" )
@@ -38,7 +38,7 @@
The previous approach is "implicit" - `Py++`_ does something behind the scene.
Recently (version 0.8.6 ), another approach was introduced:
-.. code-block:: cpp
+.. code-block:: c++
#include <vector>
Modified: pyplusplus_dev/docs/documentation/how_to/templates.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/templates.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/how_to/templates.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -10,7 +10,7 @@
I would like to introduce the following piece of code. I am going to use it for most exlanations.
-.. code-block:: cpp
+.. code-block:: c++
// file point.h
template< class T>
@@ -39,14 +39,14 @@
You can instantiate template class using operator ``sizeof``:
-.. code-block:: cpp
+.. code-block:: c++
sizeof( point_t<int> );
In order to instantiate a function you have to call it:
-.. code-block:: cpp
+.. code-block:: c++
void instantiate(){
double x = distance( point_t<t>() );
@@ -64,7 +64,7 @@
can create a small code generator, which will "instantiate the class". It is
pretty easy to blend together the generated code and the existing one:
-.. code-block:: Python
+.. code-block:: python
from module_builder import module_builder_t, create_text_fc
@@ -83,7 +83,7 @@
Functions templated on return type
----------------------------------
-.. code-block:: cpp
+.. code-block:: c++
environment_t env;
std::string path = env.get_value< std::string >( "PATH" );
@@ -105,7 +105,7 @@
Generated code:
-.. code-block:: cpp
+.. code-block:: c++
bp::class_< environment_t >( "environment_t" )
...
@@ -116,7 +116,7 @@
The correct code:
-.. code-block:: cpp
+.. code-block:: c++
bp::class_< environment_t >( "environment_t" )
.def( "get_value"
@@ -128,7 +128,7 @@
The perfect one:
-.. code-block:: cpp
+.. code-block:: c++
bp::class_< environment_t >( "environment_t" )
...
@@ -141,7 +141,7 @@
`Py++`_ contains a work-around to the problem:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ..., optimize_queries=False, ... )
environment = mb.class_( "environment_t" )
Modified: pyplusplus_dev/docs/documentation/inserting_code.rest
===================================================================
--- pyplusplus_dev/docs/documentation/inserting_code.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/inserting_code.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -18,7 +18,7 @@
Almost every ``Boost.Python`` module has the following structure:
-.. code-block:: cpp
+.. code-block:: c++
//declarations code
...
@@ -45,7 +45,7 @@
Example
-------
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
mb.build_code_creator( ... )
@@ -60,7 +60,7 @@
``class_t`` declaration defines few methods, which add user code to the generated one.
Lets take a look on the following use case:
-.. code-block:: cpp
+.. code-block:: c++
struct window_t{
...
@@ -74,7 +74,7 @@
In the near future `Py++`_ will eliminate the need of creating hand
written wrapper for this use case.
-.. code-block:: cpp
+.. code-block:: c++
boost::python::tuple get_window_size( const window_t& win ){
int h(0), w(0);
@@ -84,7 +84,7 @@
Now you have to register it:
-.. code-block:: cpp
+.. code-block:: c++
using boost::python;
class_< window_t >( ... )
@@ -113,7 +113,7 @@
What is ``works_on_instance`` argument for? In our case, we added new method
to the class. The first argument of the call will be ``self``.
- .. code-block:: Python
+ .. code-block:: python
#From Python user can call this method like this:
win = window_t( )
@@ -121,7 +121,7 @@
If you will pass ``works_on_instance=False`` the following code will be generated:
- .. code-block:: cpp
+ .. code-block:: c++
{
class_< window_t > window_exporter( "window_t" );
@@ -132,7 +132,7 @@
And in this case, user will be forced to pass reference to ``window_t`` object:
- .. code-block:: cpp
+ .. code-block:: c++
win = window_t()
height, width = window_t.get_size( win )
@@ -140,7 +140,7 @@
Example
-------
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
window = mb.class_( 'window_t' )
@@ -177,7 +177,7 @@
Solution
--------
-.. code-block:: Python
+.. code-block:: python
def inject_code( cls ):
constructors = cls.constructors()
@@ -195,7 +195,7 @@
#If you need to add new class variables:
cls.add_wrapper_code( <<<variable declaration>>> )
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
for cls in mb.classes( <<<relevant classes only>>> ):
@@ -212,7 +212,7 @@
1. The easiest and the most effective one - tell to `Py++`_ that generated code
for the declaration should include additional files:
- .. code-block:: Python
+ .. code-block:: python
mb = module_builder_t( ... )
my_class = mb.class_( ... )
@@ -224,7 +224,7 @@
2. Other approach is a little bit low level, but it allows you to add your header
files to every generated file:
- .. code-block:: Python
+ .. code-block:: python
mb = module_builder_t( ... )
...
@@ -233,7 +233,7 @@
You can also replace all (to be) generated header files with your own set:
- .. code-block:: Python
+ .. code-block:: python
mb.code_creator.replace_included_headers( ["stdafx.h"] )
Modified: pyplusplus_dev/docs/documentation/multi_module_development.rest
===================================================================
--- pyplusplus_dev/docs/documentation/multi_module_development.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/multi_module_development.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -29,7 +29,7 @@
The code:
-.. code-block:: cpp
+.. code-block:: c++
namespace core{
class image_i{
@@ -55,7 +55,7 @@
Every `Py++`_ declaration has ``already_exposed`` property. This property says
to `Py++`_ that the declaration is already exposed in another module:
-.. code-block:: Python
+.. code-block:: python
#generate_code.py script
@@ -72,7 +72,7 @@
`Py++`_ will generate code very similar to the the following one:
-.. code-block:: cpp
+.. code-block:: c++
//file core.cpp
namespace bp = boost::python;
@@ -95,7 +95,7 @@
.def( "load", bp::pure_virtual( &::core::image_i::load ) );
}
-.. code-block:: cpp
+.. code-block:: c++
//file png.cpp
struct png_image_t_wrapper : png::png_image_t, bp::wrapper< png::png_image_t > {
@@ -143,7 +143,7 @@
Usage example:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
mb.register_module_dependency( <<<other module generated code directory>>> )
Modified: pyplusplus_dev/docs/documentation/properties.rest
===================================================================
--- pyplusplus_dev/docs/documentation/properties.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/properties.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -19,7 +19,7 @@
Usage example
-------------
-.. code-block:: cpp
+.. code-block:: c++
struct number{
...
@@ -30,7 +30,7 @@
float m_value;
}
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
number = mb.class_( 'number' )
@@ -43,7 +43,7 @@
built-in algorithm, which automatically recognizes properties and adds them to the
class:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
number = mb.class_( 'number' )
@@ -63,11 +63,11 @@
Consider the following use case:
-.. code-block:: cpp
+.. code-block:: c++
struct nested{ ... };
-.. code-block:: cpp
+.. code-block:: c++
struct data{
...
@@ -82,7 +82,7 @@
`call policies`_. Same precondition holds for exposing member function as
property:
-.. code-block:: Python
+.. code-block:: python
mb = module_builder_t( ... )
get_nested = mb.member_function( 'get_nested' )
Modified: pyplusplus_dev/docs/documentation/split_module.rest
===================================================================
--- pyplusplus_dev/docs/documentation/split_module.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/split_module.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -34,7 +34,7 @@
Usage example
-------------
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
@@ -86,7 +86,7 @@
Usage example
-------------
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
@@ -127,7 +127,7 @@
Usage example
-------------
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
@@ -148,7 +148,7 @@
Usage example
-------------
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
@@ -170,7 +170,7 @@
integrate/add this functionality to `Py++`_. Nevertheless, you can enjoy from
this time-saving feature:
-.. code-block:: Python
+.. code-block:: python
from pyplusplus import module_builder
from pyplusplus import code_creators
@@ -191,12 +191,12 @@
Class ``module_builder_t`` contains 3 functions, related to file generation:
*
- .. code-block:: Python
+ .. code-block:: python
def write_module( file_name )
*
- .. code-block:: Python
+ .. code-block:: python
def split_module( self
, dir_name
@@ -227,7 +227,7 @@
forced to recompile the whole project.
*
- .. code-block:: Python
+ .. code-block:: python
def balanced_split_module( self
, dir_name
Modified: pyplusplus_dev/docs/documentation/tutorials/module_builder/module_builder.rest
===================================================================
--- pyplusplus_dev/docs/documentation/tutorials/module_builder/module_builder.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/tutorials/module_builder/module_builder.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -124,7 +124,7 @@
open source projects it to have license text within every source file. You can
do it with one line of code only:
-.. code-block:: Python
+.. code-block:: python
mb.code_creator.license = <<<your license text>>>
Modified: pyplusplus_dev/docs/documentation/warnings.rest
===================================================================
--- pyplusplus_dev/docs/documentation/warnings.rest 2009-01-26 19:49:49 UTC (rev 1622)
+++ pyplusplus_dev/docs/documentation/warnings.rest 2009-01-26 20:00:13 UTC (rev 1623)
@@ -24,11 +24,11 @@
some cases provide hints about how to resolve the problem. Few examples:
*
- .. code-block:: cpp
+ .. code-block:: c++
struct Y{ ... };
- .. code-block:: cpp
+ .. code-block:: c++
struct X{
...
@@ -38,7 +38,7 @@
Member function ``do_smth`` cannot be overridden in Python because ... .
*
- .. code-block:: cpp
+ .. code-block:: c++
struct window{
...
@@ -51,7 +51,7 @@
should define ``BOOST_PYTHON_MAX_ARITY`` macro.
*...
[truncated message content] |
|
From: <rom...@us...> - 2009-01-26 19:49:53
|
Revision: 1622
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1622&view=rev
Author: roman_yakovenko
Date: 2009-01-26 19:49:49 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
changing alias used for C++ code blocks
Modified Paths:
--------------
pygccxml_dev/docs/design.rest
pygccxml_dev/docs/history/history.rest
pygccxml_dev/docs/query_interface.rest
pygccxml_dev/docs/upgrade_issues.rest
pyplusplus_dev/docs/comparisons/pyste.rest
pyplusplus_dev/docs/documentation/containers.rest
pyplusplus_dev/docs/documentation/ctypes/unions.rest
pyplusplus_dev/docs/documentation/ctypes/variables.rest
pyplusplus_dev/docs/documentation/functions/call_policies/as_tuple.rest
pyplusplus_dev/docs/documentation/functions/call_policies/call_policies.rest
pyplusplus_dev/docs/documentation/functions/call_policies/return_addressof.rest
pyplusplus_dev/docs/documentation/functions/call_policies/return_pointee_value.rest
pyplusplus_dev/docs/documentation/functions/call_policies/return_range.rest
pyplusplus_dev/docs/documentation/functions/default_args.rest
pyplusplus_dev/docs/documentation/functions/make_constructor.rest
pyplusplus_dev/docs/documentation/functions/overloading.rest
pyplusplus_dev/docs/documentation/functions/registration_order.rest
pyplusplus_dev/docs/documentation/functions/transformation/inout.rest
pyplusplus_dev/docs/documentation/functions/transformation/input.rest
pyplusplus_dev/docs/documentation/functions/transformation/input_c_buffer.rest
pyplusplus_dev/docs/documentation/functions/transformation/input_static_array.rest
pyplusplus_dev/docs/documentation/functions/transformation/modify_type.rest
pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest
pyplusplus_dev/docs/documentation/functions/transformation/output.rest
pyplusplus_dev/docs/documentation/functions/transformation/output_static_array.rest
pyplusplus_dev/docs/documentation/functions/transformation/transfer_ownership.rest
pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest
pyplusplus_dev/docs/documentation/how_to/file_name_too_long.rest
pyplusplus_dev/docs/documentation/how_to/hints.rest
pyplusplus_dev/docs/documentation/how_to/templates.rest
pyplusplus_dev/docs/documentation/inserting_code.rest
pyplusplus_dev/docs/documentation/multi_module_development.rest
pyplusplus_dev/docs/documentation/properties.rest
pyplusplus_dev/docs/documentation/warnings.rest
pyplusplus_dev/docs/history/history.rest
pyplusplus_dev/docs/peps/dsl_challenge.rest
pyplusplus_dev/docs/troubleshooting_guide/easy_extending_guide/easy_extending_guide.rest
pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest
Modified: pygccxml_dev/docs/design.rest
===================================================================
--- pygccxml_dev/docs/design.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pygccxml_dev/docs/design.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -255,13 +255,13 @@
Well, `GCC-XML`_ has few bugs, which could not be fixed from it. For example
-.. code-block:: C++
+.. code-block:: cpp
namespace ns1{ namespace ns2{
enum fruit{ apple, orange };
} }
-.. code-block:: C++
+.. code-block:: cpp
void fix_enum( ns1::ns2::fruit arg=ns1::ns2::apple );
Modified: pygccxml_dev/docs/history/history.rest
===================================================================
--- pygccxml_dev/docs/history/history.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pygccxml_dev/docs/history/history.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -47,7 +47,7 @@
Description:
- .. code-block:: C++
+ .. code-block:: cpp
void do_smth( int, ... )
Modified: pygccxml_dev/docs/query_interface.rest
===================================================================
--- pygccxml_dev/docs/query_interface.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pygccxml_dev/docs/query_interface.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -190,14 +190,14 @@
In order to help `Boost.Python`_ to manage objects life time, all functions
should have `call policies`_. For example:
-.. code-block:: C++
+.. code-block:: cpp
struct A{
A* clone() const { return new A(); }
...
};
-.. code-block:: C++
+.. code-block:: cpp
struct B{
B* clone() const { return new B(); }
Modified: pygccxml_dev/docs/upgrade_issues.rest
===================================================================
--- pygccxml_dev/docs/upgrade_issues.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pygccxml_dev/docs/upgrade_issues.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -37,7 +37,7 @@
C++ code:
-.. code-block:: C++
+.. code-block:: cpp
struct xyz_t{
int do_smth( double );
@@ -85,7 +85,7 @@
For example:
-.. code-block:: C++
+.. code-block:: cpp
const long unsigned int initialized = 10122004;
@@ -102,7 +102,7 @@
fixes some issues, but introduces another ones. Take a look on the following examples:
*
- .. code-block:: C++
+ .. code-block:: cpp
void fix_numeric( ull arg=(ull)-1 );
@@ -120,7 +120,7 @@
<Argument name="arg" type="_103" default="0xffffffffffffffffu"/>
*
- .. code-block:: C++
+ .. code-block:: cpp
void fix_function_call( int i=calc( 1,2,3) );
@@ -138,7 +138,7 @@
<Argument name="i" type="_34" default="function_call::calc(1, 2, 3)"/>
*
- .. code-block:: C++
+ .. code-block:: cpp
void typedef__func( const typedef_::alias& position = typedef_::alias() );
@@ -156,7 +156,7 @@
<Argument name="position" type="_1703" default="typedef_::original_name()"/>
*
- .. code-block:: C++
+ .. code-block:: cpp
void typedef__func2( const typedef_::alias& position = alias() );
@@ -175,7 +175,7 @@
*
- .. code-block:: C++
+ .. code-block:: cpp
node* clone_tree( const std::vector<std::string> &types=std::vector<std::string>() );
@@ -211,7 +211,7 @@
Consider the following C++ code:
-.. code-block:: C++
+.. code-block:: cpp
template< unsigned long i1>
struct item_t{
Modified: pyplusplus_dev/docs/comparisons/pyste.rest
===================================================================
--- pyplusplus_dev/docs/comparisons/pyste.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/comparisons/pyste.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -186,15 +186,15 @@
* code creator that generates body of "overridden" virtual functions:
- .. code-block:: C++
+ .. code-block:: cpp
struct expensive_to_copy{...};
- .. code-block:: C++
+ .. code-block:: cpp
void do_smth( expensive_to_copy* x, const expensive_to_copy& y ){...}
- .. code-block:: C++
+ .. code-block:: cpp
void
do_smth(expensive_to_copy* x, const expensive_to_copy& y){
@@ -332,7 +332,7 @@
* To define namespace alias.
- .. code-block:: C++
+ .. code-block:: cpp
namespace dt = boost::date_time;
@@ -341,7 +341,7 @@
* Classes and functions support 2 modes of code generation. Example:
- .. code-block:: C++
+ .. code-block:: cpp
struct world{
void set(std::string msg) { this->msg = msg; }
@@ -351,7 +351,7 @@
First mode:
- .. code-block:: C++
+ .. code-block:: cpp
class_<world>("world")
.def("greet", &world::greet)
@@ -361,7 +361,7 @@
Second mode:
- .. code-block:: C++
+ .. code-block:: cpp
if( true ){
typedef class_<world> world_exposer_t;
Modified: pyplusplus_dev/docs/documentation/containers.rest
===================================================================
--- pyplusplus_dev/docs/documentation/containers.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/containers.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -125,7 +125,7 @@
In this case there is no single place, where you can configure exported container
functionality. Please take a look on the following C++ code:
-.. code-block:: C++
+.. code-block:: cpp
struct item{
...
Modified: pyplusplus_dev/docs/documentation/ctypes/unions.rest
===================================================================
--- pyplusplus_dev/docs/documentation/ctypes/unions.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/ctypes/unions.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -22,7 +22,7 @@
For this example I am going to use the following code:
- .. code-block:: C++
+ .. code-block:: cpp
struct data_t{
union actual_data_t{
Modified: pyplusplus_dev/docs/documentation/ctypes/variables.rest
===================================================================
--- pyplusplus_dev/docs/documentation/ctypes/variables.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/ctypes/variables.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -21,7 +21,7 @@
Lets say you have the following C++ code:
- .. code-block:: C++
+ .. code-block:: cpp
struct bytes_t{
bytes_t(){
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/as_tuple.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/as_tuple.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/as_tuple.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -16,7 +16,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
struct vector3{
...
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/call_policies.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/call_policies.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/call_policies.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -21,7 +21,7 @@
The call policies in `Py++`_ are named exactly as in `Boost.Python`_, only the
syntax is slightly different. For instance, this call policy:
-.. code-block:: C++
+.. code-block:: cpp
return_internal_reference< 1, with_custodian_and_ward<1, 2> >()
@@ -41,7 +41,7 @@
C++ code:
- .. code-block:: C++
+ .. code-block:: cpp
struct data{...};
const data& do_smth( const data& d, int x );
@@ -130,7 +130,7 @@
* `Py++`_ generates code with
- .. code-block:: C++
+ .. code-block:: cpp
/* undefined call policies */
@@ -157,7 +157,7 @@
Example:
-.. code-block:: C++
+.. code-block:: cpp
struct identity_impl_t{};
typedef identity_impl_t* identity;
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/return_addressof.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/return_addressof.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/return_addressof.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -21,7 +21,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
int* get_value(){
static int buffer[] = { 0,1,2,3,4 };
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/return_pointee_value.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/return_pointee_value.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/return_pointee_value.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -12,7 +12,7 @@
can be used to wrap C++ functions, that return a pointer to a C++ object. The
policy implements the following logic:
-.. code-block:: C++
+.. code-block:: cpp
if( <<<return value is NULL pointer>>> ){
return None;
@@ -46,7 +46,7 @@
This technique and example was contributed by Maximilian Matthe.
-.. code-block:: C++
+.. code-block:: cpp
struct int_wrapper{
int_wrapper(int v)
@@ -93,7 +93,7 @@
Return pointee value
--------------------
-.. code-block:: C++
+.. code-block:: cpp
float* get_value(){
static float value = 0.5;
Modified: pyplusplus_dev/docs/documentation/functions/call_policies/return_range.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/call_policies/return_range.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/call_policies/return_range.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -18,7 +18,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
struct image_t{
@@ -49,7 +49,7 @@
``return_range`` class
----------------------
-.. code-block:: C++
+.. code-block:: cpp
template < typename TGetSize
, typename TValueType
@@ -80,7 +80,7 @@
* call operator with the following signature:
- .. code-block:: C++
+ .. code-block:: cpp
ssize_t operator()( boost::python::tuple args );
@@ -91,7 +91,7 @@
For our case, the following class could be defined:
-.. code-block:: C++
+.. code-block:: cpp
struct image_data_size_t{
ssize_t operator()( boost::python::tuple args ){
@@ -105,7 +105,7 @@
Passing all arguments, instead of single "self" argument gives you an ability
to treat functions, where the user asked to get access to the part of the array.
-.. code-block:: C++
+.. code-block:: cpp
struct image_t{
...
@@ -119,7 +119,7 @@
The following "get size" class treats this situation:
-.. code-block:: C++
+.. code-block:: cpp
struct image_data_size_t{
ssize_t operator()( boost::python::tuple args ){
@@ -151,7 +151,7 @@
I think, now you are ready to see the whole solution:
-.. code-block:: C++
+.. code-block:: cpp
namespace bpl = boost::python;
namespace ppc = pyplusplus::call_policies;
Modified: pyplusplus_dev/docs/documentation/functions/default_args.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/default_args.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/default_args.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -11,7 +11,7 @@
There is more than one way to export function with default arguments. Before we
proceed, please take a look on the following class:
-.. code-block:: C++
+.. code-block:: cpp
struct X
{
@@ -27,7 +27,7 @@
By default `Py++`_ exposes function with its default arguments.
-.. code-block:: C++
+.. code-block:: cpp
namespace bp = boost::python;
@@ -71,7 +71,7 @@
There is different trades-off between these approaches. In general you should
use the first one, until you have "registration order" problem:
-.. code-block:: C++
+.. code-block:: cpp
struct S1;
struct S2;
@@ -122,7 +122,7 @@
Class constructors are special case:
-.. code-block:: C++
+.. code-block:: cpp
struct S1;
struct S2;
Modified: pyplusplus_dev/docs/documentation/functions/make_constructor.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/make_constructor.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/make_constructor.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -19,7 +19,7 @@
-------------
I am going to use the following code to demonstrate the functionality:
-.. code-block:: C++
+.. code-block:: cpp
#include <memory>
Modified: pyplusplus_dev/docs/documentation/functions/overloading.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/overloading.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/overloading.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -13,7 +13,7 @@
want to export, by specifying its type. Before we proceed, please take a look
on the following class:
-.. code-block:: C++
+.. code-block:: cpp
struct X
{
@@ -46,7 +46,7 @@
I am sure you will like "do nothing" approach. `Py++`_ recognize that you want to
export an overloaded function and will generate the right code:
-.. code-block:: C++
+.. code-block:: cpp
namespace bp = boost::python;
@@ -82,7 +82,7 @@
It is very important to understand it. Lets take a look on the following source code:
-.. code-block:: C++
+.. code-block:: cpp
struct Y{
Modified: pyplusplus_dev/docs/documentation/functions/registration_order.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/registration_order.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/registration_order.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -22,7 +22,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
struct tester_t{
tester_t() {}
@@ -43,7 +43,7 @@
`Py++`_ generates code, that register functions in the order they appear in the
source code:
-.. code-block:: C++
+.. code-block:: cpp
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/inout.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/inout.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/inout.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -24,7 +24,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
#include <string>
@@ -47,7 +47,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: C++
+ .. code-block:: cpp
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/input.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/input.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/input.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -18,7 +18,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
#include <string>
@@ -41,7 +41,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: C++
+ .. code-block:: cpp
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/input_c_buffer.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/input_c_buffer.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/input_c_buffer.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -20,7 +20,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
struct file_t{
void write( char* buffer, int size ) const;
@@ -40,7 +40,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: C++
+ .. code-block:: cpp
#include "__convenience.pypp.hpp" //Py++ header file, which contains few convenience function
Modified: pyplusplus_dev/docs/documentation/functions/transformation/input_static_array.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/input_static_array.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/input_static_array.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -20,7 +20,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
struct vector3{
@@ -47,7 +47,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: C++
+ .. code-block:: cpp
#include "__convenience.pypp.hpp" //Py++ header file, which contains few convenience function
Modified: pyplusplus_dev/docs/documentation/functions/transformation/modify_type.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/modify_type.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/modify_type.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -28,7 +28,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
#include <string>
@@ -52,7 +52,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: C++
+ .. code-block:: cpp
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/name_mangling.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -20,7 +20,7 @@
name mangling to create function-wrappers for overloaded and\\or free functions.
Consider the following use case:
- .. code-block:: C++
+ .. code-block:: cpp
void get_distance( long& );
void get_distance( double& );
@@ -28,7 +28,7 @@
In order to expose ``get_distance`` functions you have to create 2 function
wrappers:
- .. code-block:: C++
+ .. code-block:: cpp
long get_distance_as_long(){...}
double get_distance_as_double(){...}
@@ -37,7 +37,7 @@
on return type only. You also have to exposes them under different aliases,
otherwise they will not be callable from `Python`_:
- .. code-block:: C++
+ .. code-block:: cpp
namespace bp = boost::python;
BOOST_PYTHON_MODULE(...){
Modified: pyplusplus_dev/docs/documentation/functions/transformation/output.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/output.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/output.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -20,7 +20,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
#include <string>
@@ -43,7 +43,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: C++
+ .. code-block:: cpp
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/output_static_array.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/output_static_array.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/output_static_array.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -19,7 +19,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
struct vector3{
@@ -46,7 +46,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: C++
+ .. code-block:: cpp
#include "__convenience.pypp.hpp" //Py++ header file, which contains few convenience function
Modified: pyplusplus_dev/docs/documentation/functions/transformation/transfer_ownership.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/transfer_ownership.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/transfer_ownership.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -24,7 +24,7 @@
Example
-------
-.. code-block:: C++
+.. code-block:: cpp
struct resource_t{...};
@@ -51,7 +51,7 @@
What you see below is the relevant pieces of generated code:
- .. code-block:: C++
+ .. code-block:: cpp
namespace bp = boost::python;
Modified: pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest
===================================================================
--- pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/functions/transformation/transformation.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -15,7 +15,7 @@
An often mentioned example that demonstrates the problem is the ``get_size()``
member function of a fictitious image class:
-.. code-block:: C++
+.. code-block:: cpp
void get_size(int& width, int& height);
@@ -31,7 +31,7 @@
and the wrapper could look like this:
-.. code-block:: C++
+.. code-block:: cpp
boost::python::tuple get_size( const image_t& img ){
int width;
Modified: pyplusplus_dev/docs/documentation/how_to/file_name_too_long.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/file_name_too_long.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/how_to/file_name_too_long.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -13,7 +13,7 @@
Let me explain.
-.. code-block:: C++
+.. code-block:: cpp
template < class T>
struct holder{ ... };
Modified: pyplusplus_dev/docs/documentation/how_to/hints.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/hints.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/how_to/hints.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -13,7 +13,7 @@
For example:
-.. code-block:: C++
+.. code-block:: cpp
#include <vector>
typedef std::vector< int > numbers;
@@ -23,7 +23,7 @@
`Py++`_ will use "numbers" as Python class name:
-.. code-block:: C++
+.. code-block:: cpp
using boost::python;
class_< std::vector< int > >( "numbers" )
@@ -38,7 +38,7 @@
The previous approach is "implicit" - `Py++`_ does something behind the scene.
Recently (version 0.8.6 ), another approach was introduced:
-.. code-block:: C++
+.. code-block:: cpp
#include <vector>
Modified: pyplusplus_dev/docs/documentation/how_to/templates.rest
===================================================================
--- pyplusplus_dev/docs/documentation/how_to/templates.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/how_to/templates.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -10,7 +10,7 @@
I would like to introduce the following piece of code. I am going to use it for most exlanations.
-.. code-block:: C++
+.. code-block:: cpp
// file point.h
template< class T>
@@ -39,14 +39,14 @@
You can instantiate template class using operator ``sizeof``:
-.. code-block:: C++
+.. code-block:: cpp
sizeof( point_t<int> );
In order to instantiate a function you have to call it:
-.. code-block:: C++
+.. code-block:: cpp
void instantiate(){
double x = distance( point_t<t>() );
@@ -83,7 +83,7 @@
Functions templated on return type
----------------------------------
-.. code-block:: C++
+.. code-block:: cpp
environment_t env;
std::string path = env.get_value< std::string >( "PATH" );
@@ -105,7 +105,7 @@
Generated code:
-.. code-block:: C++
+.. code-block:: cpp
bp::class_< environment_t >( "environment_t" )
...
@@ -116,7 +116,7 @@
The correct code:
-.. code-block:: C++
+.. code-block:: cpp
bp::class_< environment_t >( "environment_t" )
.def( "get_value"
@@ -128,7 +128,7 @@
The perfect one:
-.. code-block:: C++
+.. code-block:: cpp
bp::class_< environment_t >( "environment_t" )
...
Modified: pyplusplus_dev/docs/documentation/inserting_code.rest
===================================================================
--- pyplusplus_dev/docs/documentation/inserting_code.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/inserting_code.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -18,7 +18,7 @@
Almost every ``Boost.Python`` module has the following structure:
-.. code-block:: C++
+.. code-block:: cpp
//declarations code
...
@@ -60,7 +60,7 @@
``class_t`` declaration defines few methods, which add user code to the generated one.
Lets take a look on the following use case:
-.. code-block:: C++
+.. code-block:: cpp
struct window_t{
...
@@ -74,7 +74,7 @@
In the near future `Py++`_ will eliminate the need of creating hand
written wrapper for this use case.
-.. code-block:: C++
+.. code-block:: cpp
boost::python::tuple get_window_size( const window_t& win ){
int h(0), w(0);
@@ -84,7 +84,7 @@
Now you have to register it:
-.. code-block:: C++
+.. code-block:: cpp
using boost::python;
class_< window_t >( ... )
@@ -121,7 +121,7 @@
If you will pass ``works_on_instance=False`` the following code will be generated:
- .. code-block:: C++
+ .. code-block:: cpp
{
class_< window_t > window_exporter( "window_t" );
@@ -132,7 +132,7 @@
And in this case, user will be forced to pass reference to ``window_t`` object:
- .. code-block:: C++
+ .. code-block:: cpp
win = window_t()
height, width = window_t.get_size( win )
Modified: pyplusplus_dev/docs/documentation/multi_module_development.rest
===================================================================
--- pyplusplus_dev/docs/documentation/multi_module_development.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/multi_module_development.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -29,7 +29,7 @@
The code:
-.. code-block:: C++
+.. code-block:: cpp
namespace core{
class image_i{
@@ -72,7 +72,7 @@
`Py++`_ will generate code very similar to the the following one:
-.. code-block:: C++
+.. code-block:: cpp
//file core.cpp
namespace bp = boost::python;
@@ -95,7 +95,7 @@
.def( "load", bp::pure_virtual( &::core::image_i::load ) );
}
-.. code-block:: C++
+.. code-block:: cpp
//file png.cpp
struct png_image_t_wrapper : png::png_image_t, bp::wrapper< png::png_image_t > {
Modified: pyplusplus_dev/docs/documentation/properties.rest
===================================================================
--- pyplusplus_dev/docs/documentation/properties.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/properties.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -19,7 +19,7 @@
Usage example
-------------
-.. code-block:: C++
+.. code-block:: cpp
struct number{
...
@@ -63,11 +63,11 @@
Consider the following use case:
-.. code-block:: C++
+.. code-block:: cpp
struct nested{ ... };
-.. code-block:: C++
+.. code-block:: cpp
struct data{
...
Modified: pyplusplus_dev/docs/documentation/warnings.rest
===================================================================
--- pyplusplus_dev/docs/documentation/warnings.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/documentation/warnings.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -24,11 +24,11 @@
some cases provide hints about how to resolve the problem. Few examples:
*
- .. code-block:: C++
+ .. code-block:: cpp
struct Y{ ... };
- .. code-block:: C++
+ .. code-block:: cpp
struct X{
...
@@ -38,7 +38,7 @@
Member function ``do_smth`` cannot be overridden in Python because ... .
*
- .. code-block:: C++
+ .. code-block:: cpp
struct window{
...
@@ -51,7 +51,7 @@
should define ``BOOST_PYTHON_MAX_ARITY`` macro.
*
- .. code-block:: C++
+ .. code-block:: cpp
struct X{
...
Modified: pyplusplus_dev/docs/history/history.rest
===================================================================
--- pyplusplus_dev/docs/history/history.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/history/history.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -45,7 +45,7 @@
The change explanation.
- .. code-block:: C++
+ .. code-block:: cpp
struct A{
virtual void foo() {}
@@ -75,7 +75,7 @@
If you use "function transformation" functionality, than it is possible the
generated code will **NOT** work. Consider the following example:
- .. code-block:: C++
+ .. code-block:: cpp
struct A{
virtual void foo(int& i) {/*do smth*/}
@@ -98,7 +98,7 @@
The generated code, for class ``B``, is:
- .. code-block:: C++
+ .. code-block:: cpp
namespace bp = boost::python;
@@ -512,7 +512,7 @@
8. `Py++`_ now generates correct code for hierarchy of abstract classes:
- .. code-block:: C++
+ .. code-block:: cpp
struct abstract1{
virtual void do_smth() = 0;
Modified: pyplusplus_dev/docs/peps/dsl_challenge.rest
===================================================================
--- pyplusplus_dev/docs/peps/dsl_challenge.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/peps/dsl_challenge.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -16,7 +16,7 @@
I will use the following C++ code as an example:
-.. code-block:: C++
+.. code-block:: cpp
namespace geometry{
struct Point{
@@ -105,7 +105,7 @@
B-API does not work for template instantiated classes and functions. If we change
class ``Point`` to be template, the special syntax should be introduced:
- .. code-block:: C++
+ .. code-block:: cpp
template < class Numeric >
struct Point{
@@ -119,7 +119,7 @@
This is a trivial example, which is why it looks great. Consider the following class:
- .. code-block:: C++
+ .. code-block:: cpp
template< class String, class Allocator >
class regex{ ... }
Modified: pyplusplus_dev/docs/troubleshooting_guide/easy_extending_guide/easy_extending_guide.rest
===================================================================
--- pyplusplus_dev/docs/troubleshooting_guide/easy_extending_guide/easy_extending_guide.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/troubleshooting_guide/easy_extending_guide/easy_extending_guide.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -38,7 +38,7 @@
Consider the following function:
-.. code-block:: C++
+.. code-block:: cpp
int write( int* data, size_t size );
Modified: pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest
===================================================================
--- pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest 2009-01-26 15:03:04 UTC (rev 1621)
+++ pyplusplus_dev/docs/troubleshooting_guide/shared_ptr/shared_ptr.rest 2009-01-26 19:49:49 UTC (rev 1622)
@@ -20,7 +20,7 @@
It is also possible to solve the problem, without changing Boost.Python library:
- .. code-block:: C++
+ .. code-block:: cpp
namespace boost{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 15:03:06
|
Revision: 1621
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1621&view=rev
Author: roman_yakovenko
Date: 2009-01-26 15:03:04 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
fixing problems found by pychecker
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/algorithms_cache.py
pygccxml_dev/pygccxml/declarations/class_declaration.py
pygccxml_dev/pygccxml/declarations/container_traits.py
pygccxml_dev/pygccxml/declarations/cpptypes.py
pygccxml_dev/pygccxml/declarations/decl_printer.py
pygccxml_dev/pygccxml/declarations/dependencies.py
pygccxml_dev/pygccxml/declarations/function_traits.py
pygccxml_dev/pygccxml/declarations/scopedef.py
pygccxml_dev/pygccxml/declarations/type_traits.py
pygccxml_dev/pygccxml/parser/config.py
pygccxml_dev/pygccxml/parser/project_reader.py
pygccxml_dev/pygccxml/parser/source_reader.py
pygccxml_dev/pygccxml/utils/__init__.py
pygccxml_dev/unittests/autoconfig.py
Modified: pygccxml_dev/pygccxml/declarations/algorithms_cache.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -17,8 +17,8 @@
self._access_type = None
self._demangled_name = None
self._declaration_path = None
- self._partial_declaration_path = None
- self._container_key_type = None
+ self._partial_declaration_path = None
+ self._container_key_type = None
self._container_element_type = None
def disable( self ):
@@ -36,7 +36,7 @@
def _set_full_name( self, fname ):
if not self.enabled:
fname = None
- self._full_name = fname
+ self._full_name = fname
full_name = property( _get_full_name, _set_full_name )
def _get_full_partial_name( self ):
@@ -44,7 +44,7 @@
def _set_full_partial_name( self, fname ):
if not self.enabled:
fname = None
- self._full_partial_name = fname
+ self._full_partial_name = fname
full_partial_name = property( _get_full_partial_name, _set_full_partial_name )
def _get_access_type( self ):
@@ -59,8 +59,8 @@
return self._demangled_name
def _set_demangled_name( self, demangled_name ):
if not self.enabled:
- demangled_name = None
- self._demangled_name = demangled_name
+ demangled_name = None
+ self._demangled_name = demangled_name
demangled_name = property( _get_demangled_name, _set_demangled_name )
def _get_declaration_path( self ):
@@ -87,14 +87,14 @@
etype = None
self._container_element_type = etype
container_element_type = property( _get_container_element_type, _set_container_element_type )
-
+
def _get_container_key_type( self ):
return self._container_key_type
def _set_container_key_type( self, ktype ):
if not self.enabled:
ktype = None
self._container_key_type = ktype
- container_key_type = property( _get_container_key_type, _set_container_key_type )
+ container_key_type = property( _get_container_key_type, _set_container_key_type )
def reset( self ):
self.full_name = None
@@ -120,13 +120,13 @@
class type_algs_cache_t( object ):
enabled = True
-
+
@staticmethod
def disable():
type_algs_cache_t.enabled = False
@staticmethod
- def enable( self ):
+ def enable():
type_algs_cache_t.enabled = True
def __init__( self ):
@@ -139,9 +139,9 @@
if not type_algs_cache_t.enabled:
remove_alias = None
self._remove_alias = remove_alias
-
+
remove_alias = property( _get_remove_alias, _set_remove_alias )
def reset(self):
self.remove_alias = None
-
+
Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/class_declaration.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -13,7 +13,6 @@
"""
import scopedef
-import itertools
import compilers
import algorithm
import declaration
Modified: pygccxml_dev/pygccxml/declarations/container_traits.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/container_traits.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/container_traits.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -258,7 +258,7 @@
, container_name
, element_type_index
, element_type_typedef
- , defaults_remover
+ , defaults_remover
, key_type_index=None
, key_type_typedef=None ):
"""
@@ -267,7 +267,7 @@
arguments list
element_type_typedef - class typedef to the value\\mapped type
key_type_index - position of key type within template arguments list
- key_type_typedef - class typedef to the key type
+ key_type_typedef - class typedef to the key type
"""
self._name = container_name
self.remove_defaults_impl = defaults_remover
@@ -279,18 +279,18 @@
def name(self):
return self._name
- def get_container_or_none( self, type ):
+ def get_container_or_none( self, type_ ):
"""returns reference to the class declaration or None"""
- type = type_traits.remove_alias( type )
- type = type_traits.remove_cv( type )
+ type_ = type_traits.remove_alias( type_ )
+ type_ = type_traits.remove_cv( type_ )
cls = None
- if isinstance( type, cpptypes.declarated_t ):
- cls = type_traits.remove_alias( type.declaration )
- elif isinstance( type, class_declaration.class_t ):
- cls = type
- elif isinstance( type, class_declaration.class_declaration_t ):
- cls = type
+ if isinstance( type_, cpptypes.declarated_t ):
+ cls = type_traits.remove_alias( type_.declaration )
+ elif isinstance( type_, class_declaration.class_t ):
+ cls = type_
+ elif isinstance( type_, class_declaration.class_declaration_t ):
+ cls = type_
else:
return
@@ -301,29 +301,29 @@
if type_traits.impl_details.is_defined_in_xxx( ns, cls ):
return cls
- def is_my_case( self, type ):
+ def is_my_case( self, type_ ):
"""checks, whether type is STD container or not"""
- return bool( self.get_container_or_none( type ) )
+ return bool( self.get_container_or_none( type_ ) )
- def class_declaration( self, type ):
+ def class_declaration( self, type_ ):
"""returns reference to the class declaration"""
- cls = self.get_container_or_none( type )
+ cls = self.get_container_or_none( type_ )
if not cls:
- raise TypeError( 'Type "%s" is not instantiation of std::%s' % ( type.decl_string, self.name() ) )
+ raise TypeError( 'Type "%s" is not instantiation of std::%s' % ( type_.decl_string, self.name() ) )
return cls
- def is_sequence( self, type ):
+ def is_sequence( self, type_ ):
#raise exception if type is not container
- unused = self.class_declaration( type )
+ unused = self.class_declaration( type_ )
return self.key_type_index is None
-
- def is_mapping( self, type ):
- return not self.is_sequence( type )
- def __find_xxx_type( self, type, xxx_index, xxx_typedef, cache_property_name ):
- cls = self.class_declaration( type )
+ def is_mapping( self, type_ ):
+ return not self.is_sequence( type_ )
+
+ def __find_xxx_type( self, type_, xxx_index, xxx_typedef, cache_property_name ):
+ cls = self.class_declaration( type_ )
result = getattr( cls.cache, cache_property_name )
- if not result:
+ if not result:
if isinstance( cls, class_declaration.class_t ):
xxx_type = cls.typedef( xxx_typedef, recursive=False ).type
result = type_traits.remove_declarated( xxx_type )
@@ -336,29 +336,29 @@
setattr( cls.cache, cache_property_name, result )
return result
- def element_type( self, type ):
+ def element_type( self, type_ ):
"""returns reference to the class value\\mapped type declaration"""
- return self.__find_xxx_type( type
+ return self.__find_xxx_type( type_
, self.element_type_index
, self.element_type_typedef
, 'container_element_type')
- def key_type( self, type ):
- """returns reference to the class key type declaration"""
- if not self.is_mapping( type ):
- raise TypeError( 'Type "%s" is not "mapping" container' % str( type ) )
- return self.__find_xxx_type( type
+ def key_type( self, type_ ):
+ """returns reference to the class key type declaration"""
+ if not self.is_mapping( type_ ):
+ raise TypeError( 'Type "%s" is not "mapping" container' % str( type_ ) )
+ return self.__find_xxx_type( type_
, self.key_type_index
, self.key_type_typedef
, 'container_key_type' )
def remove_defaults( self, type_or_string ):
"""remove template defaults from a template class instantiation
-
+
For example:
- std::vector< int, std::allocator< int > >
+ std::vector< int, std::allocator< int > >
will become
- std::vector< int >
+ std::vector< int >
"""
name = type_or_string
if not isinstance( type_or_string, types.StringTypes ):
@@ -408,11 +408,11 @@
, defaults_eraser.erase_map_compare_allocator
, key_type_index=0
, key_type_typedef='key_type')
-
+
multimap_traits = create_traits( 'multimap'
, 1
, 'mapped_type'
- , defaults_eraser.erase_map_compare_allocator
+ , defaults_eraser.erase_map_compare_allocator
, key_type_index=0
, key_type_typedef='key_type')
@@ -420,15 +420,15 @@
hash_map_traits = create_traits( 'hash_map'
, 1
, 'mapped_type'
- , defaults_eraser.erase_hashmap_compare_allocator
+ , defaults_eraser.erase_hashmap_compare_allocator
, key_type_index=0
, key_type_typedef='key_type')
-
-
+
+
hash_multimap_traits = create_traits( 'hash_multimap'
, 1
, 'mapped_type'
- , defaults_eraser.erase_hashmap_compare_allocator
+ , defaults_eraser.erase_hashmap_compare_allocator
, key_type_index=0
, key_type_typedef='key_type')
@@ -436,7 +436,7 @@
, 0
, 'value_type'
, defaults_eraser.erase_compare_allocator)
-
+
multiset_traits = create_traits( 'multiset'
, 0
, 'value_type'
@@ -446,7 +446,7 @@
, 0
, 'value_type'
, defaults_eraser.erase_hash_allocator )
-
+
hash_multiset_traits = create_traits( 'hash_multiset'
, 0
, 'value_type'
Modified: pygccxml_dev/pygccxml/declarations/cpptypes.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/cpptypes.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/cpptypes.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -501,10 +501,10 @@
@return: L{free_function_type_t}
"""
+ f = lambda x: x.build_decl_string( with_defaults )
return free_function_type_t.NAME_TEMPLATE % {
'return_type' : return_type.build_decl_string( with_defaults )
- , 'arguments' : ','.join( map( lambda x: x.build_decl_string( with_defaults )
- , arguments_types ) ) }
+ , 'arguments' : ','.join( map( f, arguments_types ) ) }
def build_decl_string(self, with_defaults=True):
return self.create_decl_string( self.return_type, self.arguments_types, with_defaults )
@@ -523,11 +523,11 @@
@param name: the desired name of typedef
"""
#unused argument simplifies user code
+ f = lambda x: x.build_decl_string( with_defaults )
return free_function_type_t.TYPEDEF_NAME_TEMPLATE % {
'typedef_name' : typedef_name
, 'return_type' : self.return_type.build_decl_string( with_defaults )
- , 'arguments' : ','.join( map( lambda x: x.build_decl_string( with_defaults )
- , self.arguments_types ) ) }
+ , 'arguments' : ','.join( map( f, self.arguments_types ) ) }
class member_function_type_t( type_t, calldef_type_t ):
"""describes member function type"""
@@ -569,12 +569,12 @@
class_alias = self.class_inst.decl_string
else:
class_alias = self.class_inst.partial_decl_string
+ f = lambda x: x.build_decl_string(with_defaults)
return member_function_type_t.TYPEDEF_NAME_TEMPLATE % {
'typedef_name' : typedef_name
, 'return_type' : self.return_type.build_decl_string( with_defaults )
, 'class' : class_alias
- , 'arguments' : ','.join( map( lambda x: x.build_decl_string(with_defaults)
- , self.arguments_types ) )
+ , 'arguments' : ','.join( map( f, self.arguments_types ) )
, 'has_const' : has_const_str }
def create(self):
@@ -592,11 +592,11 @@
return_type_decl_string = ''
if return_type:
return_type_decl_string = return_type.build_decl_string( with_defaults )
+ f = lambda x: x.build_decl_string(with_defaults)
return member_function_type_t.NAME_TEMPLATE % {
'return_type' : return_type_decl_string
, 'class' : class_decl_string
- , 'arguments' : ','.join( map( lambda x: x.build_decl_string(with_defaults)
- , arguments_types ) )
+ , 'arguments' : ','.join( map( f, arguments_types ) )
, 'has_const' : has_const_str }
def build_decl_string(self, with_defaults=True):
Modified: pygccxml_dev/pygccxml/declarations/decl_printer.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/decl_printer.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/decl_printer.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -240,7 +240,7 @@
self.writer( value_level + "%s : %s"% (name, value) + os.linesep)
def visit_namespace(self ):
- if self.verbose == False and not self.__inst.declarations:
+ if not self.verbose and not self.__inst.declarations:
return #don't print info about empty namespaces
self.print_decl_header()
if self.__recursive:
Modified: pygccxml_dev/pygccxml/declarations/dependencies.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/dependencies.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/dependencies.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -79,9 +79,8 @@
def we_depend_on_them( decls ):
"""returns set of declarations. every item in the returned set, depends on a
declaration from the input"""
- import class_declaration #prevent cyclic imports
to_be_included = set()
for decl in decls:
- to_be_included.update( dependency_info_t.they_depend_on_me( decl ) )
+ to_be_included.update( dependency_info_t.i_depend_on_them( decl ) )
return to_be_included
Modified: pygccxml_dev/pygccxml/declarations/function_traits.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/function_traits.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/function_traits.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -13,17 +13,17 @@
def is_same_return_type( f1, f2 ):
#covariant returns
- #The return type of an overriding function shall be either identical to the
- #return type of the overridden function or covariant with the classes of the
- #functions. If a function D::f overrides a function B::f, the return types
+ #The return type of an overriding function shall be either identical to the
+ #return type of the overridden function or covariant with the classes of the
+ #functions. If a function D::f overrides a function B::f, the return types
#of the functions are covariant if they satisfy the following criteria:
#* both are pointers to classes or references to classes
- #* the class in the return type of B::f is the same class as the class in
- # the return type of D::f or, is an unambiguous direct or indirect base
+ #* the class in the return type of B::f is the same class as the class in
+ # the return type of D::f or, is an unambiguous direct or indirect base
# class of the class in the return type of D::f and is accessible in D
- #* both pointers or references have the same cv-qualification and the class
- # type in the return type of D::f has the same cv-qualification as or less
+ #* both pointers or references have the same cv-qualification and the class
+ # type in the return type of D::f has the same cv-qualification as or less
# cv-qualification than the class type in the return type of B::f.
if not f1.__class__ is f2.__class__:
@@ -43,11 +43,11 @@
rt2 = type_traits.remove_pointer( rt2 )
elif type_traits.is_reference( rt1 ) and type_traits.is_reference( rt2 ):
rt1 = type_traits.remove_reference( rt1 )
- rt2 = type_traits.remove_reference( rt2 )
+ rt2 = type_traits.remove_reference( rt2 )
else:
return type_traits.is_same( f1.return_type, f2.return_type)
if ( type_traits.is_const( rt1 ) and type_traits.is_const( rt2 ) ) \
- or ( False == type_traits.is_const( rt1 ) and False == type_traits.is_const( rt2 ) ):
+ or ( not type_traits.is_const( rt1 ) and not type_traits.is_const( rt2 ) ):
rt1 = type_traits.remove_const( rt1 )
rt2 = type_traits.remove_const( rt2 )
else:
@@ -62,8 +62,8 @@
return type_traits.is_same( c1, c2 ) \
or type_traits.is_base_and_derived( c1, c2 ) \
or type_traits.is_base_and_derived( c2, c1 )
-
+
def is_same_function( f1, f2 ):
"""returns true if f1 and f2 is same function
Modified: pygccxml_dev/pygccxml/declarations/scopedef.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/scopedef.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/scopedef.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -117,7 +117,7 @@
raise NotImplementedError()
def _get_declarations(self):
- if True == self._optimized:
+ if self._optimized:
return self._all_decls_not_recursive
else:
return self._get_declarations_impl()
@@ -309,7 +309,7 @@
#templates has tricky mode to compare them, so lets check the whole
#range
name = None
-
+
if name and decl_type:
matcher = scopedef_t._impl_matchers[ scopedef_t.decl ]( name=name )
if matcher.is_full_name():
Modified: pygccxml_dev/pygccxml/declarations/type_traits.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/type_traits.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/declarations/type_traits.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -16,7 +16,6 @@
"""
import os
-import types
import matchers
import typedef
import calldef
@@ -187,7 +186,7 @@
elif isinstance( nake_type, cpptypes.volatile_t ) \
and isinstance( nake_type.base, cpptypes.const_t ) \
and isinstance( nake_type.base.base, cpptypes.pointer_t ):
- return cpptypes.volatile_t( ctypes.const_t( nake_type.base.base.base ) )
+ return cpptypes.volatile_t( cpptypes.const_t( nake_type.base.base.base ) )
elif isinstance( nake_type.base, cpptypes.calldef_type_t ):
return type
else:
@@ -222,7 +221,7 @@
elif is_pointer( type_ ):
return remove_pointer( type_ )
else:
- assert 0
+ raise RuntimeError( "array_item_type functions takes as argument array or pointer types" )
def remove_reference(type):
"""removes reference from the type definition
@@ -252,15 +251,15 @@
else:
return nake_type.base
-def remove_declarated( type ):
- """removes type-declaration class-binder L{declarated_t} from the type
+def remove_declarated( type_ ):
+ """removes type-declaration class-binder L{declarated_t} from the type_
- If type is not L{declarated_t}, it will be returned as is
+ If type_ is not L{declarated_t}, it will be returned as is
"""
- type = remove_alias( type )
- if isinstance( type, cpptypes.declarated_t ):
- type = type.declaration
- return type
+ type_ = remove_alias( type_ )
+ if isinstance( type_, cpptypes.declarated_t ):
+ type_ = type_.declaration
+ return type_
def is_same(type1, type2):
"""returns True, if type1 and type2 are same types"""
@@ -316,22 +315,22 @@
def __init__( self, declaration_class ):
self.declaration_class = declaration_class
- def __apply_sequence( self, type ):
+ def __apply_sequence( self, type_ ):
for f in self.sequence:
- type = f( type )
- return type
+ type_ = f( type_ )
+ return type_
- def is_my_case( self, type ):
+ def is_my_case( self, type_ ):
"""returns True, if type represents the desired declaration, False otherwise"""
- return isinstance( self.__apply_sequence( type ), self.declaration_class )
+ return isinstance( self.__apply_sequence( type_ ), self.declaration_class )
- def get_declaration( self, type ):
+ def get_declaration( self, type_ ):
"""returns reference to the declaration
Precondition: self.is_my_case( type ) == True
"""
- assert self.is_my_case( type )
- return self.__apply_sequence( type )
+ assert self.is_my_case( type_ )
+ return self.__apply_sequence( type_ )
enum_traits = declaration_xxx_traits( enumeration.enumeration_t )
"""implements functionality, needed for convinient work with C++ enums"""
@@ -354,10 +353,10 @@
is_class_declaration = class_declaration_traits.is_my_case
"""returns True, if type represents C++ class declaration, False otherwise"""
-def find_trivial_constructor( type ):
+def find_trivial_constructor( type_ ):
"""returns reference to trivial constructor or None"""
- assert isinstance( type, class_declaration.class_t )
- return type.find_trivial_constructor()
+ assert isinstance( type_, class_declaration.class_t )
+ return type_.find_trivial_constructor()
def has_trivial_constructor( class_ ):
"""if class has public trivial constructor, this function will return reference to it, None otherwise"""
@@ -425,42 +424,42 @@
if decls:
return decls
-def has_public_binary_operator( type, operator_symbol ):
- """returns True, if type has public binary operator, otherwise False"""
- not_artificial = lambda decl: decl.is_artificial == False
- type = remove_alias( type )
- type = remove_cv( type )
- type = remove_declarated( type )
- assert isinstance( type, class_declaration.class_t )
+def has_public_binary_operator( type_, operator_symbol ):
+ """returns True, if type_ has public binary operator, otherwise False"""
+ not_artificial = lambda decl: not decl.is_artificial
+ type_ = remove_alias( type_ )
+ type_ = remove_cv( type_ )
+ type_ = remove_declarated( type_ )
+ assert isinstance( type_, class_declaration.class_t )
- if is_std_string( type ) or is_std_wstring( type ):
+ if is_std_string( type_ ) or is_std_wstring( type_ ):
#In some case compare operators of std::basic_string are not instantiated
return True
- operators = type.member_operators( function=matchers.custom_matcher_t( not_artificial ) \
- & matchers.access_type_matcher_t( 'public' )
+ operators = type_.member_operators( function=matchers.custom_matcher_t( not_artificial ) \
+ & matchers.access_type_matcher_t( 'public' )
, symbol=operator_symbol
, allow_empty=True
, recursive=False )
if operators:
return True
- t = cpptypes.declarated_t( type )
+ t = cpptypes.declarated_t( type_ )
t = cpptypes.const_t( t )
t = cpptypes.reference_t( t )
- operators = type.top_parent.operators( function=not_artificial
+ operators = type_.top_parent.operators( function=not_artificial
, arg_types=[t, None]
, symbol=operator_symbol
, allow_empty=True
, recursive=True )
if operators:
return True
- for bi in type.recursive_bases:
+ for bi in type_.recursive_bases:
assert isinstance( bi, class_declaration.hierarchy_info_t )
if bi.access_type != class_declaration.ACCESS_TYPES.PUBLIC:
continue
operators = bi.related_class.member_operators( function=matchers.custom_matcher_t( not_artificial ) \
- & matchers.access_type_matcher_t( 'public' )
+ & matchers.access_type_matcher_t( 'public' )
, symbol=operator_symbol
, allow_empty=True
, recursive=False )
@@ -843,7 +842,7 @@
class_ = class_traits.get_declaration( class_ )
true_header = "is_noncopyable(TRUE) - %s - " % class_.decl_string
- false_header = "is_noncopyable(false) - %s - " % class_.decl_string
+ #~ false_header = "is_noncopyable(false) - %s - " % class_.decl_string
if class_.class_type == class_declaration.CLASS_TYPES.UNION:
return False
@@ -989,12 +988,12 @@
"""small convenience class, which provides access to internal types"""
#TODO: add exists function
@staticmethod
- def get_by_name( type, name ):
- if class_traits.is_my_case( type ):
- cls = class_traits.declaration_class( type )
+ def get_by_name( type_, name ):
+ if class_traits.is_my_case( type_ ):
+ cls = class_traits.declaration_class( type_ )
return remove_declarated( cls.typedef( name, recursive=False ).type )
- elif class_declaration_traits.is_my_case( type ):
- cls = class_declaration_traits.get_declaration( type )
+ elif class_declaration_traits.is_my_case( type_ ):
+ cls = class_declaration_traits.get_declaration( type_ )
value_type_str = templates.args( cls.name )[0]
ref = impl_details.find_value_type( cls.top_parent, value_type_str )
if ref:
@@ -1004,102 +1003,102 @@
% ( name, cls.decl_string ) )
else:
raise RuntimeError( "Unable to find reference to internal type '%s' in type '%s'."
- % ( name, type.decl_string ) )
+ % ( name, type_.decl_string ) )
class smart_pointer_traits:
"""implements functionality, needed for convinient work with smart pointers"""
@staticmethod
- def is_smart_pointer( type ):
+ def is_smart_pointer( type_ ):
"""returns True, if type represents instantiation of C{boost::shared_ptr}, False otherwise"""
- type = remove_alias( type )
- type = remove_cv( type )
- type = remove_declarated( type )
- if not isinstance( type, ( class_declaration.class_declaration_t, class_declaration.class_t ) ):
+ type_ = remove_alias( type_ )
+ type_ = remove_cv( type_ )
+ type_ = remove_declarated( type_ )
+ if not isinstance( type_, ( class_declaration.class_declaration_t, class_declaration.class_t ) ):
return False
- if not impl_details.is_defined_in_xxx( 'boost', type ):
+ if not impl_details.is_defined_in_xxx( 'boost', type_ ):
return False
- return type.decl_string.startswith( '::boost::shared_ptr<' )
+ return type_.decl_string.startswith( '::boost::shared_ptr<' )
@staticmethod
- def value_type( type ):
+ def value_type( type_ ):
"""returns reference to boost::shared_ptr value type"""
- if not smart_pointer_traits.is_smart_pointer( type ):
- raise TypeError( 'Type "%s" is not instantiation of boost::shared_ptr' % type.decl_string )
- return internal_type_traits.get_by_name( type, "value_type" )
+ if not smart_pointer_traits.is_smart_pointer( type_ ):
+ raise TypeError( 'Type "%s" is not instantiation of boost::shared_ptr' % type_.decl_string )
+ return internal_type_traits.get_by_name( type_, "value_type" )
class auto_ptr_traits:
"""implements functionality, needed for convinient work with std::auto_ptr pointers"""
@staticmethod
- def is_smart_pointer( type ):
+ def is_smart_pointer( type_ ):
"""returns True, if type represents instantiation of C{boost::shared_ptr}, False otherwise"""
- type = remove_alias( type )
- type = remove_cv( type )
- type = remove_declarated( type )
- if not isinstance( type, ( class_declaration.class_declaration_t, class_declaration.class_t ) ):
+ type_ = remove_alias( type_ )
+ type_ = remove_cv( type_ )
+ type_ = remove_declarated( type_ )
+ if not isinstance( type_, ( class_declaration.class_declaration_t, class_declaration.class_t ) ):
return False
- if not impl_details.is_defined_in_xxx( 'std', type ):
+ if not impl_details.is_defined_in_xxx( 'std', type_ ):
return False
- return type.decl_string.startswith( '::std::auto_ptr<' )
+ return type_.decl_string.startswith( '::std::auto_ptr<' )
@staticmethod
- def value_type( type ):
+ def value_type( type_ ):
"""returns reference to boost::shared_ptr value type"""
- if not auto_ptr_traits.is_smart_pointer( type ):
- raise TypeError( 'Type "%s" is not instantiation of std::auto_ptr' % type.decl_string )
- return internal_type_traits.get_by_name( type, "element_type" )
+ if not auto_ptr_traits.is_smart_pointer( type_ ):
+ raise TypeError( 'Type "%s" is not instantiation of std::auto_ptr' % type_.decl_string )
+ return internal_type_traits.get_by_name( type_, "element_type" )
-def is_std_string( type ):
+def is_std_string( type_ ):
"""returns True, if type represents C++ std::string, False otherwise"""
decl_strings = [
'::std::basic_string<char,std::char_traits<char>,std::allocator<char> >'
, '::std::basic_string<char, std::char_traits<char>, std::allocator<char> >'
, '::std::string' ]
- if isinstance( type, types.StringTypes ):
- return type in decl_strings
+ if isinstance( type_, build_in_types.StringTypes ):
+ return type_ in decl_strings
else:
- type = remove_alias( type )
- return remove_cv( type ).decl_string in decl_strings
+ type_ = remove_alias( type_ )
+ return remove_cv( type_ ).decl_string in decl_strings
-def is_std_wstring( type ):
+def is_std_wstring( type_ ):
"""returns True, if type represents C++ std::wstring, False otherwise"""
decl_strings = [
'::std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >'
, '::std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >'
, '::std::wstring' ]
- if isinstance( type, types.StringTypes ):
- return type in decl_strings
+ if isinstance( type_, build_in_types.StringTypes ):
+ return type_ in decl_strings
else:
- type = remove_alias( type )
- return remove_cv( type ).decl_string in decl_strings
+ type_ = remove_alias( type_ )
+ return remove_cv( type_ ).decl_string in decl_strings
-def is_std_ostream( type ):
+def is_std_ostream( type_ ):
"""returns True, if type represents C++ std::string, False otherwise"""
decl_strings = [
'::std::basic_ostream<char, std::char_traits<char> >'
, '::std::basic_ostream<char,std::char_traits<char> >'
, '::std::ostream' ]
- if isinstance( type, types.StringTypes ):
- return type in decl_strings
+ if isinstance( type_, build_in_types.StringTypes ):
+ return type_ in decl_strings
else:
- type = remove_alias( type )
- return remove_cv( type ).decl_string in decl_strings
+ type_ = remove_alias( type_ )
+ return remove_cv( type_ ).decl_string in decl_strings
-def is_std_wostream( type ):
+def is_std_wostream( type_ ):
"""returns True, if type represents C++ std::string, False otherwise"""
decl_strings = [
'::std::basic_ostream<wchar_t, std::char_traits<wchar_t> >'
, '::std::basic_ostream<wchar_t,std::char_traits<wchar_t> >'
, '::std::wostream' ]
- if isinstance( type, types.StringTypes ):
- return type in decl_strings
+ if isinstance( type_, build_in_types.StringTypes ):
+ return type_ in decl_strings
else:
- type = remove_alias( type )
- return remove_cv( type ).decl_string in decl_strings
+ type_ = remove_alias( type_ )
+ return remove_cv( type_ ).decl_string in decl_strings
Modified: pygccxml_dev/pygccxml/parser/config.py
===================================================================
--- pygccxml_dev/pygccxml/parser/config.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/parser/config.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -98,7 +98,6 @@
def __ensure_dir_exists( self, dir_path, meaning ):
if os.path.isdir( dir_path ):
return
- msg = None
if os.path.exists( self.working_directory ):
raise RuntimeError( '%s("%s") does not exist!' % ( meaning, dir_path ) )
else:
@@ -219,9 +218,9 @@
Configuration file sceleton:
>>> start <<<
-
+
%s
-
+
>>> end <<<
configuration could be string( configuration file path ) or instance of
Modified: pygccxml_dev/pygccxml/parser/project_reader.py
===================================================================
--- pygccxml_dev/pygccxml/parser/project_reader.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/parser/project_reader.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -330,8 +330,8 @@
if dir_ and not os.path.exists( dir_ ):
os.makedirs( dir_ )
self.logger.info( 'Creating xml file "%s" from source file "%s" ... '
- % ( fc.cached_source_file, header ) )
- xml_file_path = reader.create_xml_file( header, fc.cached_source_file )
+ % ( fc.cached_source_file, fc.data ) )
+ xml_file_path = reader.create_xml_file( fc.data, fc.cached_source_file )
else:
xml_file_path = fc.cached_source_file
else:
Modified: pygccxml_dev/pygccxml/parser/source_reader.py
===================================================================
--- pygccxml_dev/pygccxml/parser/source_reader.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/parser/source_reader.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -193,10 +193,7 @@
return gccxml_file
def read_file( self, source_file ):
- if isinstance( self.__config, config.gccxml_configuration_t ):
- return self.read_gccxml_file( source_file )
- else:
- return self.read_synopsis_file( source_file )
+ return self.read_gccxml_file( source_file )
def read_gccxml_file(self, source_file):
"""
@@ -205,7 +202,7 @@
@param source_file: path to C++ source file
@type source_file: str
"""
- declarations, types = None, None
+ declarations = None
gccxml_file = ''
try:
ffname = self.__file_full_name(source_file)
Modified: pygccxml_dev/pygccxml/utils/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/utils/__init__.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/pygccxml/utils/__init__.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -79,7 +79,7 @@
This function is a wrapper aroung Python built-in function - tempfile.mkstemp
"""
if not prefix:
- prefix = tempfile.template
+ prefix = tempfile.gettempprefix()
fd, name = tempfile.mkstemp( suffix=suffix, prefix=prefix, dir=dir )
file_obj = os.fdopen( fd )
file_obj.close()
@@ -93,7 +93,8 @@
"""returns bool( filter( lambda dir: fpath.startswith( dir ), dirs ) )
precondition: dirs and fpath should be normalize_path'ed before calling this function
"""
- return bool( filter( lambda dir: fpath.startswith( dir ), dirs ) )
+ f = lambda dir_: fpath.startswith( dir_ )
+ return bool( filter( f, dirs ) )
def get_architecture():
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2009-01-26 11:22:43 UTC (rev 1620)
+++ pygccxml_dev/unittests/autoconfig.py 2009-01-26 15:03:04 UTC (rev 1621)
@@ -7,8 +7,8 @@
import sys
import getpass
-#__pychecker__ = 'limit=1000'
-#import pychecker.checker
+#~ os.environ['PYCHECKER'] = '--limit=1000 -q --no-argsused'
+#~ import pychecker.checker
this_module_dir_path = os.path.abspath ( os.path.dirname( sys.modules[__name__].__file__) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 11:22:44
|
Revision: 1620
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1620&view=rev
Author: roman_yakovenko
Date: 2009-01-26 11:22:43 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
updating version and history
Modified Paths:
--------------
pygccxml_dev/docs/history/history.rest
pygccxml_dev/pygccxml/__init__.py
Modified: pygccxml_dev/docs/history/history.rest
===================================================================
--- pygccxml_dev/docs/history/history.rest 2009-01-26 10:59:16 UTC (rev 1619)
+++ pygccxml_dev/docs/history/history.rest 2009-01-26 11:22:43 UTC (rev 1620)
@@ -26,6 +26,18 @@
-----------
+Version 1.1
+-----------
+
+1. Experimental back-ends based on ``.pdb`` and ``.bsc`` files were removed.
+
+2. Ability to extract different information from binary files ( ``.pdb``, ``.so``,
+ ``.map`` ) and merge it with a declarations tree was added.
+
+3. Ability to load `GCC-XML`_ configuration from ``.ini`` like file was added
+
+
+-----------
Version 1.0
-----------
@@ -47,7 +59,7 @@
which describe callables, have new property ``has_ellipsis``. It the value of
the property is ``True``, than the function has ellipsis in its definition.
-2. New expiremental back-end, based on ``.pdb`` (progam database file), was added.
+2. New experimental back-end, based on ``.pdb`` (progam database file), was added.
3. New high-level API wrapper for ``.bsc`` (browse source code file) was added.
Modified: pygccxml_dev/pygccxml/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/__init__.py 2009-01-26 10:59:16 UTC (rev 1619)
+++ pygccxml_dev/pygccxml/__init__.py 2009-01-26 11:22:43 UTC (rev 1620)
@@ -36,6 +36,6 @@
#TODO:
# 1. Add "explicit" property for constructors
-__version__ = '1.0.0'
+__version__ = '1.1.0'
__revision__ = 1080
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 10:59:25
|
Revision: 1619
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1619&view=rev
Author: roman_yakovenko
Date: 2009-01-26 10:59:16 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
adding documentation
Modified Paths:
--------------
pygccxml_dev/pygccxml/binary_parsers/__init__.py
pygccxml_dev/pygccxml/binary_parsers/parsers.py
pygccxml_dev/pygccxml/binary_parsers/undname.py
Modified: pygccxml_dev/pygccxml/binary_parsers/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/binary_parsers/__init__.py 2009-01-26 10:40:12 UTC (rev 1618)
+++ pygccxml_dev/pygccxml/binary_parsers/__init__.py 2009-01-26 10:59:16 UTC (rev 1619)
@@ -6,15 +6,19 @@
"""
contains classes that allows to extract different information from binary files
( .pdb, .map, .dll, .bsc, .so ) and integrate it with existing declarations tree
+
+The main function of this package is "merge_information"
"""
import undname
from parsers import merge_information
def undecorate_blob( blob ):
- """returns undecorated\unmangled string, created from blob"""
+ """returns undecorated\unmangled string, created from blob(exported symbol name)"""
return undname.undname_creator_t().undecorate_blob( blob )
def format_decl( decl, hint=None ):
- """returns string, that represents formatted decl, according to some rules"""
+ """returns string, that represents formatted declaration, according to some rules
+ hint valid values are: "msvc" and "nm"
+ """
return undname.undname_creator_t().format_decl( decl, hint=hint )
Modified: pygccxml_dev/pygccxml/binary_parsers/parsers.py
===================================================================
--- pygccxml_dev/pygccxml/binary_parsers/parsers.py 2009-01-26 10:40:12 UTC (rev 1618)
+++ pygccxml_dev/pygccxml/binary_parsers/parsers.py 2009-01-26 10:59:16 UTC (rev 1619)
@@ -7,8 +7,10 @@
"""
defines few simple classes( parsers ), which deals with .dll, .map, .so files.
-Those classes extract decorated\mangled names from the files. Later, they undecorate
-the name and extract the functions calling convention.
+Those classes extract decorated\mangled names from the files. Later the extracted
+symbols are used for:
+* building "dynamic library" public interface
+* extracting function calling convention
"""
import os
@@ -80,13 +82,13 @@
raise NotImplementedError()
def parse( self ):
- """main class method
+ """the main method of the class
loads information from the binary file and merges it into the declarations
tree.
- The return value of the function is dictionary, where key is decorated
- declaration name and value is a declaration.
+ The return value of the function is dictionary, where the key is
+ decorated/mangled declaration name and the value is a declaration.
"""
self.__loaded_symbols = self.load_symbols()
result = {}
@@ -103,7 +105,7 @@
CCTS = declarations.CALLING_CONVENTION_TYPES
class formated_mapping_parser_t( libparser_t ):
- """base parser class for few MSVC binary files"""
+ """convenience class, which formats existing declarations"""
def __init__( self, global_ns, binary_file, hint ):
libparser_t.__init__( self, global_ns, binary_file )
self.__formated_decls = {}
@@ -209,6 +211,7 @@
class so_file_parser_t( formated_mapping_parser_t ):
+ """parser for Linux .so file"""
nm_executable = 'nm'
#numeric-sort used for mapping between mangled and unmangled name
cmd_mangled = '%(nm)s --extern-only --dynamic --defined-only --numeric-sort %(lib)s'
Modified: pygccxml_dev/pygccxml/binary_parsers/undname.py
===================================================================
--- pygccxml_dev/pygccxml/binary_parsers/undname.py 2009-01-26 10:40:12 UTC (rev 1618)
+++ pygccxml_dev/pygccxml/binary_parsers/undname.py 2009-01-26 10:59:16 UTC (rev 1619)
@@ -58,7 +58,9 @@
SHORT_UNIQUE_NAME = UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_ECSU
class undname_creator_t:
- """formats declarations string representation and exported symbols, so they
+ """implementation details - should not be used directly
+
+ formats declarations string representation and exported symbols, so they
could be matched later.
The class formats variables, free and member functions, symbols exported from
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 10:40:19
|
Revision: 1618
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1618&view=rev
Author: roman_yakovenko
Date: 2009-01-26 10:40:12 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
removing deprecated functionality
Modified Paths:
--------------
pygccxml_dev/pygccxml/__init__.py
pygccxml_dev/pygccxml/binary_parsers/undname.py
pygccxml_dev/pygccxml/declarations/__init__.py
pygccxml_dev/pygccxml/declarations/scopedef.py
pygccxml_dev/pygccxml/utils/__init__.py
pygccxml_dev/unittests/test_all.py
pyplusplus_dev/pyplusplus/messages/__init__.py
pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py
pyplusplus_dev/unittests/fundamental_tester_base.py
Removed Paths:
-------------
pygccxml_dev/pygccxml/declarations/filtering.py
pygccxml_dev/unittests/filtering_tester.py
Modified: pygccxml_dev/pygccxml/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/__init__.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pygccxml_dev/pygccxml/__init__.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -34,8 +34,7 @@
import pygccxml.utils as utils
#TODO:
-# 1. Write documentation for filtering functionality.
-# 2. Add "explicit" property for constructors
+# 1. Add "explicit" property for constructors
__version__ = '1.0.0'
Modified: pygccxml_dev/pygccxml/binary_parsers/undname.py
===================================================================
--- pygccxml_dev/pygccxml/binary_parsers/undname.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pygccxml_dev/pygccxml/binary_parsers/undname.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -4,7 +4,14 @@
# http://www.boost.org/LICENSE_1_0.txt)
"""
-provides functionality needed to undecorate\demangle compiler generated unique names
+provides low-level functionality, needed to undecorate\demangle compiler generated
+unique names and map them to the declarations
+
+On Windows:
+ ctypes package is used to call UnDecorateSymbolName function from dbghelp.dll
+
+On Linux:
+ "nm" utility is used.
"""
import os
@@ -14,6 +21,8 @@
from pygccxml import declarations
class UNDECORATE_NAME_OPTIONS:
+ """defines few constants for UnDecorateSymbolName function"""
+
UNDNAME_COMPLETE = 0x0000 #Enables full undecoration.
UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords.
UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords.
@@ -48,39 +57,19 @@
SHORT_UNIQUE_NAME = UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_ECSU
-#~ The following code doesn't work - access violation
+class undname_creator_t:
+ """formats declarations string representation and exported symbols, so they
+ could be matched later.
-#~__unDName definition was taken from:
-#~http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
+ The class formats variables, free and member functions, symbols exported from
+ .dll, .map and .so files.
-#~ msvcrxx = ctypes.windll.msvcr90
-#~ free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type
-#~ malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type
-#~ __unDName = msvcrxx.__unDName
-#~ __unDName.argtypes = [ ctypes.c_char_p #undecorated name
- #~ , ctypes.c_char_p #decorated name
- #~ , ctypes.c_int #sizeof undecorated name
- #~ , malloc_type
- #~ , free_type
- #~ , ctypes.c_ushort #flags
- #~ ]
-#~ __unDName.restype = ctypes.c_char_p
-#~ def undecorate_name( name, options=None ):
- #~ if not name:
- #~ return ''
- #~ if options is None:
- #~ options = UNDECORATE_NAME_OPTIONS.SHORT_UNIQUE_NAME
- #~ buffer_size = 1024 * 32
- #~ undecorated_name = ctypes.create_string_buffer('\0' * buffer_size) #should be enouph for any symbol
- #~ __unDName( undecorated_name
- #~ , str(name)
- #~ , buffer_size
- #~ , malloc_type( msvcrxx.malloc )
- #~ , free_type( msvcrxx.free )
- #~ , options )
- #~ return undecorated_name.value
+ On Windows, the class works with unique name produced by MSVC compiler and
+ with undecorated names produced by dbghelp.dll
-class undname_creator_t:
+ On Linux, the class works with mangled names produced by GCC-XML ( GCC 4.2 )
+ compiler and demangled name produced by "nm" utility.
+ """
def __init__( self ):
if 'win32' in sys.platform:
import ctypes.wintypes
@@ -147,7 +136,6 @@
result = result.replace( ' ' + x, x )
return result
-
def __normalize( self, name ):
for what, with_ in self.__fundamental_types:
name = name.replace( what, with_ )
Modified: pygccxml_dev/pygccxml/declarations/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/__init__.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pygccxml_dev/pygccxml/declarations/__init__.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -217,8 +217,6 @@
import templates
import call_invocation
-from filtering import filtering
-
from decl_factory import decl_factory_t
from matchers import matcher_base_t
Deleted: pygccxml_dev/pygccxml/declarations/filtering.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/filtering.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pygccxml_dev/pygccxml/declarations/filtering.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -1,79 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-"""
-deprecated!
-
-This module defines few algorithms for filtering declarations.
-"""
-
-import os
-import algorithm
-
-class filtering:
- """deprecated!
-
- defines few algorithms for filtering declarations
- """
-
- @staticmethod
- def normalize_path( some_path ):
- """return os.path.normcase( os.path.normpath( some_path ) )"""
- return os.path.normcase( os.path.normpath( some_path ) )
-
- @staticmethod
- def contains_parent_dir( fpath, dirs ):
- #precondition: dirs and fpath should be normalize_path'ed before calling this function
- return bool( filter( lambda dir: fpath.startswith( dir ), dirs ) )
-
- @staticmethod
- def by_location( decls, locations ):
- """
- returns list of declarations that belongs to specified locations.
-
- This function works recursively. Pay attention: if you remove namespace,
- then you remove all declarations defined within the namespace.
-
- @param decls: declaration or list of declarations
- @type decls: L{declaration<declaration_t>} or list of L{declarations<declaration_t>}
-
- @param locations: list of directories and/or files names
- @type locations: list of strings
-
- @return: list of L{declarations<declaration_t>}
- """
- #precondition: decls is a list of op level namespaces
- #locations is list of directories and\or files
- temp_decls = algorithm.make_flatten( decls )
- locations = map( filtering.normalize_path, locations )
- dirs = filter( lambda location: os.path.isdir( location ), locations )
- files = filter( lambda location: os.path.isfile( location ), locations )
- result = []
- for decl in temp_decls:
- if not decl.location:
- result.append( decl )
- continue
- fpath = filtering.normalize_path( decl.location.file_name )
- if filtering.contains_parent_dir( fpath, dirs ) or fpath in files:
- result.append( decl )
- return result
-
- @staticmethod
- def user_defined( decls, matcher ):
- """
- returns list of declarations that match user specified criteria.
-
- This function works recursively.
-
- @param decls: declaration or list of declarations
- @type decls: L{declaration<declaration_t>} or list of L{declarations<declaration_t>}
-
- @param matcher: callable object, that takes 1 argument - declaration
- and returns True if object should stay, and false otherwise
-
- @return: list of L{declarations<declaration_t>}
- """
- #precondition: decls is a list of op level namespaces
- return filter( matcher, algorithm.make_flatten( decls ) )
Modified: pygccxml_dev/pygccxml/declarations/scopedef.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/scopedef.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pygccxml_dev/pygccxml/declarations/scopedef.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -9,7 +9,6 @@
import time
import algorithm
-import filtering
import templates
import declaration
import mdecl_wrapper
Modified: pygccxml_dev/pygccxml/utils/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/utils/__init__.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pygccxml_dev/pygccxml/utils/__init__.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -89,6 +89,13 @@
"""return os.path.normpath( os.path.normcase( some_path ) )"""
return os.path.normpath( os.path.normcase( some_path ) )
+def contains_parent_dir( fpath, dirs ):
+ """returns bool( filter( lambda dir: fpath.startswith( dir ), dirs ) )
+ precondition: dirs and fpath should be normalize_path'ed before calling this function
+ """
+ return bool( filter( lambda dir: fpath.startswith( dir ), dirs ) )
+
+
def get_architecture():
"""returns computer architecture: 32 or 64.
Deleted: pygccxml_dev/unittests/filtering_tester.py
===================================================================
--- pygccxml_dev/unittests/filtering_tester.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pygccxml_dev/unittests/filtering_tester.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -1,46 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import unittest
-import autoconfig
-import parser_test_case
-
-from pygccxml import parser
-from pygccxml import declarations
-
-class tester_t( parser_test_case.parser_test_case_t ):
- def __init__(self, *args):
- parser_test_case.parser_test_case_t.__init__(self, *args)
- self.__fname = 'declarations_for_filtering.hpp'
- self.__fpath = declarations.filtering.normalize_path(
- os.path.join( autoconfig.data_directory, self.__fname ) )
-
- def test_by_location(self):
- reader = parser.source_reader_t( self.config )
- decls = reader.read_file( self.__fname )
- decls_count = len( declarations.make_flatten( decls ) )
- filtered = declarations.filtering.by_location( decls, [autoconfig.data_directory] )
- flatten_filtered = declarations.make_flatten( filtered )
- self.failUnless( len( flatten_filtered ) != decls_count )
- for decl in flatten_filtered:
- if decl.location:
- self.failUnless( declarations.filtering.normalize_path( decl.location.file_name )
- , self.__fpath )
- self.failUnless( declarations.find_declaration( filtered
- , name='color'
- , type=declarations.enumeration_t
- , recursive=False) )
-
-def create_suite():
- suite = unittest.TestSuite()
- suite.addTest( unittest.makeSuite(tester_t))
- return suite
-
-def run_suite():
- unittest.TextTestRunner(verbosity=2).run( create_suite() )
-
-if __name__ == "__main__":
- run_suite()
\ No newline at end of file
Modified: pygccxml_dev/unittests/test_all.py
===================================================================
--- pygccxml_dev/unittests/test_all.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pygccxml_dev/unittests/test_all.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -19,7 +19,6 @@
import type_traits_tester
import core_tester
import xmlfile_reader_tester
-import filtering_tester
import text_reader_tester
import hierarchy_traveling
import patcher_tester
@@ -70,7 +69,6 @@
, type_traits_tester
, core_tester
, xmlfile_reader_tester
- , filtering_tester
, text_reader_tester
, hierarchy_traveling
, patcher_tester
Modified: pyplusplus_dev/pyplusplus/messages/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/messages/__init__.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pyplusplus_dev/pyplusplus/messages/__init__.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -8,16 +8,6 @@
"""
from warnings_ import *
-#implementation using regular expression is deprecated, I will leave it here for
-#some time to be sure that the new one does not cause any problems.
-#import re
-#__RE_GET_WARNING_ID = re.compile( r'warning\s(?P<id>W(\d){4})' )
-#match_obj = __RE_GET_WARNING_ID.search(msg)
-# if not match_obj:
-# return None
-# else:
-# return match_obj.group( 'id' )
-
def find_out_message_id( msg ):
return msg.identifier
Modified: pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -11,6 +11,7 @@
import module_builder
from pygccxml import parser
+from pygccxml import utils as pygccxml_utils
from pygccxml import declarations as decls_package
from pyplusplus import utils
@@ -76,7 +77,7 @@
, compiler=compiler)
#may be in future I will add those directories to user_defined_directories to self.__code_creator.
- self.__parsed_files = map( decls_package.filtering.normalize_path
+ self.__parsed_files = map( pygccxml_utils.normalize_path
, parser.project_reader_t.get_os_file_names( files ) )
tmp = map( lambda file_: os.path.split( file_ )[0], self.__parsed_files )
self.__parsed_dirs = filter( None, tmp )
@@ -151,8 +152,8 @@
for decl in flatten_decls:
if not decl.location:
continue
- fpath = decls_package.filtering.normalize_path( decl.location.file_name )
- if decls_package.filtering.contains_parent_dir( fpath, self.__parsed_dirs ):
+ fpath = pygccxml_utils.normalize_path( decl.location.file_name )
+ if pygccxml_utils.contains_parent_dir( fpath, self.__parsed_dirs ):
continue
if fpath in self.__parsed_files:
continue
@@ -203,7 +204,6 @@
def build_code_creator( self
, module_name
, boost_python_ns_name='bp'
- , create_casting_constructor=True
, call_policies_resolver_=None
, types_db=None
, target_configuration=None
@@ -226,16 +226,7 @@
and returns documentation string
@type doc_extractor: callable or None
"""
- if not create_casting_constructor:
- msg = os.linesep.join([
- "create_casting_constructor argument is deprecated."
- , "If want to disable boost::python::implicitly_convertible code generation, consider to use allow_implicit_conversion constructor property"
- , ">>> mb = module_builder_t(...)"
- , ">>> mb.constructors().allow_implicit_conversion = False"])
- warnings.warn(msg, DeprecationWarning, stacklevel=2)
- self.global_ns.constructors(allow_empty=True).allow_implicit_conversion = False
-
creator = creators_factory.bpcreator_t( self.global_ns
, module_name
, boost_python_ns_name
Modified: pyplusplus_dev/unittests/fundamental_tester_base.py
===================================================================
--- pyplusplus_dev/unittests/fundamental_tester_base.py 2009-01-26 09:11:26 UTC (rev 1617)
+++ pyplusplus_dev/unittests/fundamental_tester_base.py 2009-01-26 10:40:12 UTC (rev 1618)
@@ -102,7 +102,7 @@
, include_paths=[autoconfig.boost.include]
, undefine_symbols=['__MINGW32__']
, indexing_suite_version=self.__indexing_suite_version
- , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())
+ , compiler=autoconfig.cxx_parsers_cfg.gccxml.compiler)
for decl in mb.decls():
decl.documentation = '"documentation"'
self.customize( mb )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 09:11:36
|
Revision: 1617
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1617&view=rev
Author: roman_yakovenko
Date: 2009-01-26 09:11:26 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
moving config.py file to deprecated directory
Added Paths:
-----------
pygccxml_dev/deprecated/config.py
Removed Paths:
-------------
pygccxml_dev/pygccxml/binary_parsers/config.py
Copied: pygccxml_dev/deprecated/config.py (from rev 1607, pygccxml_dev/pygccxml/binary_parsers/config.py)
===================================================================
--- pygccxml_dev/deprecated/config.py (rev 0)
+++ pygccxml_dev/deprecated/config.py 2009-01-26 09:11:26 UTC (rev 1617)
@@ -0,0 +1,73 @@
+import os
+import sys
+import comtypes
+from pygccxml import utils
+import comtypes.client
+import _winreg as win_registry
+from distutils import msvccompiler
+
+class binaries_searcher_t:
+
+ def get_msbsc_path( self ):
+ relative_path = os.path.dirname( sys.modules[__name__].__file__)
+ absolute_path = os.path.abspath (relative_path)
+ return os.path.join( absolute_path, 'msbsc70.dll' )
+
+ def get_msvcr70_path( self ):
+ relative_path = os.path.dirname( sys.modules[__name__].__file__)
+ absolute_path = os.path.abspath (relative_path)
+ return os.path.join( absolute_path, 'msvcr70.dll' )
+
+
+ def get_msvcr_path( self ):
+ vss_installed = self.__get_installed_vs_dirs()
+ for f in utils.files_walker( vss_installed, ["*.dll"], ):
+ f_path, f_name = os.path.split( f.upper() )
+ if f_name.startswith( 'MSVCR' ):
+ return f
+ else:
+ raise RuntimeError( 'Unable to find msvcrXX.dll. Search path is: %s' % vss_installed )
+
+ def get_msdia_path( self ):
+ vss_installed = self.__get_installed_vs_dirs()
+ msdia_dlls = self.__get_msdia_dll_paths( vss_installed )
+ if 1 == len(msdia_dlls):
+ return msdia_dlls[0]
+ else:
+ #TODO find the highest version and use it.
+ pass
+
+ def __get_msdia_dll_paths( self, vss_installed ):
+ msdia_dlls = []
+ for vs in vss_installed:
+ debug_dir = os.path.join( vs, 'Common7', 'Packages', 'Debugger' )
+ files = filter( lambda f: f.startswith( 'msdia' ) and f.endswith( '.dll' )
+ , os.listdir( debug_dir ) )
+ if not files:
+ continue
+ msdia_dlls.extend([ os.path.join( debug_dir, f ) for f in files ])
+ if not msdia_dlls:
+ raise RuntimeError( 'pygccxml unable to find out msdiaXX.dll location' )
+ return msdia_dlls
+
+ def __get_installed_vs_dirs( self ):
+ vs_reg_path = 'Software\Microsoft\VisualStudio\SxS\VS7'
+ values = self.read_values( win_registry.HKEY_LOCAL_MACHINE, vs_reg_path )
+ return [ values.values()[0] ]
+
+ def read_keys(self, base, key):
+ return msvccompiler.read_keys(base, key)
+
+ def read_values(self, base, key):
+ return msvccompiler.read_values(base, key)
+
+bs = binaries_searcher_t()
+
+msdia_path = bs.get_msdia_path()
+print 'msdia path: ', msdia_path
+
+msbsc_path = bs.get_msbsc_path()
+print 'msbsc path: ', msbsc_path
+
+msvcr_path = bs.get_msvcr_path()
+print 'msvcr path: ', msvcr_path
Deleted: pygccxml_dev/pygccxml/binary_parsers/config.py
===================================================================
--- pygccxml_dev/pygccxml/binary_parsers/config.py 2009-01-26 07:55:08 UTC (rev 1616)
+++ pygccxml_dev/pygccxml/binary_parsers/config.py 2009-01-26 09:11:26 UTC (rev 1617)
@@ -1,73 +0,0 @@
-import os
-import sys
-import comtypes
-from pygccxml import utils
-import comtypes.client
-import _winreg as win_registry
-from distutils import msvccompiler
-
-class binaries_searcher_t:
-
- def get_msbsc_path( self ):
- relative_path = os.path.dirname( sys.modules[__name__].__file__)
- absolute_path = os.path.abspath (relative_path)
- return os.path.join( absolute_path, 'msbsc70.dll' )
-
- def get_msvcr70_path( self ):
- relative_path = os.path.dirname( sys.modules[__name__].__file__)
- absolute_path = os.path.abspath (relative_path)
- return os.path.join( absolute_path, 'msvcr70.dll' )
-
-
- def get_msvcr_path( self ):
- vss_installed = self.__get_installed_vs_dirs()
- for f in utils.files_walker( vss_installed, ["*.dll"], ):
- f_path, f_name = os.path.split( f.upper() )
- if f_name.startswith( 'MSVCR' ):
- return f
- else:
- raise RuntimeError( 'Unable to find msvcrXX.dll. Search path is: %s' % vss_installed )
-
- def get_msdia_path( self ):
- vss_installed = self.__get_installed_vs_dirs()
- msdia_dlls = self.__get_msdia_dll_paths( vss_installed )
- if 1 == len(msdia_dlls):
- return msdia_dlls[0]
- else:
- #TODO find the highest version and use it.
- pass
-
- def __get_msdia_dll_paths( self, vss_installed ):
- msdia_dlls = []
- for vs in vss_installed:
- debug_dir = os.path.join( vs, 'Common7', 'Packages', 'Debugger' )
- files = filter( lambda f: f.startswith( 'msdia' ) and f.endswith( '.dll' )
- , os.listdir( debug_dir ) )
- if not files:
- continue
- msdia_dlls.extend([ os.path.join( debug_dir, f ) for f in files ])
- if not msdia_dlls:
- raise RuntimeError( 'pygccxml unable to find out msdiaXX.dll location' )
- return msdia_dlls
-
- def __get_installed_vs_dirs( self ):
- vs_reg_path = 'Software\Microsoft\VisualStudio\SxS\VS7'
- values = self.read_values( win_registry.HKEY_LOCAL_MACHINE, vs_reg_path )
- return [ values.values()[0] ]
-
- def read_keys(self, base, key):
- return msvccompiler.read_keys(base, key)
-
- def read_values(self, base, key):
- return msvccompiler.read_values(base, key)
-
-bs = binaries_searcher_t()
-
-msdia_path = bs.get_msdia_path()
-print 'msdia path: ', msdia_path
-
-msbsc_path = bs.get_msbsc_path()
-print 'msbsc path: ', msbsc_path
-
-msvcr_path = bs.get_msvcr_path()
-print 'msvcr path: ', msvcr_path
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 07:55:12
|
Revision: 1616
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1616&view=rev
Author: roman_yakovenko
Date: 2009-01-26 07:55:08 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
merging ctypes and boost.python code creators into single file
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/__init__.py
Added Paths:
-----------
pyplusplus_dev/pyplusplus/code_creators/calldef_ctypes.py
Removed Paths:
-------------
pyplusplus_dev/pyplusplus/code_creators/function_definition.py
pyplusplus_dev/pyplusplus/code_creators/mem_fun_introduction.py
pyplusplus_dev/pyplusplus/code_creators/methods_definition.py
Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 07:32:48 UTC (rev 1615)
+++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 07:55:08 UTC (rev 1616)
@@ -93,7 +93,19 @@
#~ from calldef_transformed import constructor_transformed_t
#~ from calldef_transformed import constructor_transformed_wrapper_t
+from calldef_ctypes import del_definition_t
+from calldef_ctypes import del_introduction_t
+from calldef_ctypes import methods_definition_t
+from calldef_ctypes import mem_fun_definition_t
+from calldef_ctypes import mem_fun_introduction_t
+from calldef_ctypes import function_definition_t
+from calldef_ctypes import vmem_fun_introduction_t
+from calldef_ctypes import multi_method_definition_t
+from calldef_ctypes import init_definition_t
+from calldef_ctypes import init_introduction_t
+from calldef_ctypes import opaque_init_introduction_t
+
from global_variable import global_variable_base_t
from global_variable import global_variable_t
from global_variable import array_gv_t
@@ -152,22 +164,8 @@
from bookmark import bookmark_t
-#pure ctypes
from library_reference import library_reference_t
from name_mappings import name_mappings_t
-from mem_fun_introduction import mem_fun_introduction_t
-from mem_fun_introduction import vmem_fun_introduction_t
-from mem_fun_introduction import init_introduction_t
-from mem_fun_introduction import opaque_init_introduction_t
-from mem_fun_introduction import del_introduction_t
-from methods_definition import methods_definition_t
-from function_definition import function_definition_t
-from function_definition import init_definition_t
-from function_definition import multi_method_definition_t
-from function_definition import del_definition_t
-from function_definition import mem_fun_definition_t
from typedef_as_pyvar import typedef_as_pyvar_t
-
-
from embedded_code_repository import embedded_code_repository_t
Added: pyplusplus_dev/pyplusplus/code_creators/calldef_ctypes.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef_ctypes.py (rev 0)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef_ctypes.py 2009-01-26 07:55:08 UTC (rev 1616)
@@ -0,0 +1,359 @@
+# Copyright 2004-2008 Roman Yakovenko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+import os
+import compound
+import code_creator
+import ctypes_formatter
+import declaration_based
+from pygccxml import declarations
+
+CCT = declarations.CALLING_CONVENTION_TYPES
+
+function_prototype_mapping = {
+ CCT.UNKNOWN : 'CFUNCTYPE'
+ , CCT.CDECL : 'CFUNCTYPE'
+ , CCT.STDCALL : 'WINFUNCTYPE'
+ , CCT.THISCALL : 'CPPMETHODTYPE'
+ , CCT.FASTCALL : '<<<fastcall unsupported>>>'
+ , CCT.SYSTEM_DEFAULT : 'CFUNCTYPE'
+}
+
+assert len( function_prototype_mapping ) == len( CCT.all )
+
+class METHOD_MODE:
+ STAND_ALONE = "stand alone"
+ MULTI_METHOD = "multi method"
+ all = [ STAND_ALONE, MULTI_METHOD ]
+
+class mem_fun_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
+ def __init__( self, mem_fun ):
+ code_creator.code_creator_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, mem_fun )
+
+ def _create_impl(self):
+ tmpl = ['def %(alias)s( self, *args ):']
+ tmpl.append( self.indent('"""%(name)s"""') )
+ tmpl.append( self.indent("return self._methods_['%(alias)s']( ctypes.pointer( self ), *args )") )
+ return os.linesep.join( tmpl ) \
+ % dict( alias=self.declaration.alias, name=self.undecorated_decl_name )
+
+ def _get_system_files_impl( self ):
+ return []
+
+class vmem_fun_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
+ def __init__( self, mem_fun ):
+ code_creator.code_creator_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, mem_fun )
+
+ def _create_impl(self):
+ tmpl = ['def %(alias)s( self, *args ):']
+ tmpl.append( self.indent('"""%(name)s"""') )
+ tmpl.append( self.indent("return self._vtable_['%(ordinal)d'].%(alias)s( ctypes.pointer( self ), *args )") )
+ return os.linesep.join( tmpl ) \
+ % dict( alias=self.declaration.alias
+ , name=self.undecorated_decl_name
+ , ordinal=0)
+
+ def _get_system_files_impl( self ):
+ return []
+
+class init_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
+ def __init__( self, constructor ):
+ code_creator.code_creator_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, constructor )
+
+ def _create_impl(self):
+ tmpl = ['def __init__( self, *args ):']
+ tmpl.append( self.indent('"""%(name)s"""') )
+ tmpl.append( self.indent("return self._methods_['__init__']( ctypes.pointer( self ), *args )") )
+ return os.linesep.join( tmpl ) \
+ % dict( alias=self.declaration.alias, name=self.undecorated_decl_name )
+
+ def _get_system_files_impl( self ):
+ return []
+
+class opaque_init_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
+ def __init__( self, class_ ):
+ code_creator.code_creator_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, class_ )
+
+ def _create_impl(self):
+ tmpl = ['def __init__( self, *args, **keywd ):']
+ tmpl.append( self.indent('raise RuntimeError( "Unable to create instance of opaque type." )') )
+ return os.linesep.join( tmpl )
+
+ def _get_system_files_impl( self ):
+ return []
+
+class del_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
+ def __init__( self, constructor ):
+ code_creator.code_creator_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, constructor )
+
+ def _create_impl(self):
+ tmpl = ['def __del__( self ):']
+ tmpl.append( self.indent('"""%(name)s"""') )
+ tmpl.append( self.indent("return self._methods_['__del__']( ctypes.pointer( self ) )") )
+ return os.linesep.join( tmpl ) \
+ % dict( name=self.undecorated_decl_name )
+
+ def _get_system_files_impl( self ):
+ return []
+
+
+
+class methods_definition_t(compound.compound_t, declaration_based.declaration_based_t):
+ def __init__( self, class_ ):
+ compound.compound_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, class_ )
+
+ @property
+ def mem_fun_factory_var_name(self):
+ return "mfcreator"
+
+ def find_mutli_method( self, alias ):
+ global multi_method_definition_t
+ #~ import function_definition
+ #~ mmdef_t = function_definition.multi_method_definition_t
+ mmdef_t = multi_method_definition_t
+ multi_method_defs = self.find_by_creator_class( mmdef_t, unique=False )
+ if None is multi_method_defs:
+ return
+ multi_method_defs = filter( lambda cc: cc.multi_method_alias == alias
+ , multi_method_defs )
+ if multi_method_defs:
+ return multi_method_defs[0]
+ else:
+ return None
+
+
+ def _create_impl(self):
+ result = []
+ scope = declarations.algorithm.declaration_path( self.declaration )
+ del scope[0] #del :: from the global namespace
+ del scope[-1] #del self from the list
+
+ tmpl = '%(mem_fun_factory_var_name)s = ctypes_utils.mem_fun_factory( %(library_var_name)s, %(complete_py_name)s, "%(class_name)s", "%(ns)s" )'
+ if not scope:
+ tmpl = '%(mem_fun_factory_var_name)s = ctypes_utils.mem_fun_factory( %(library_var_name)s, %(complete_py_name)s, "%(class_name)s" )'
+
+ result.append( tmpl % dict( mem_fun_factory_var_name=self.mem_fun_factory_var_name
+ , library_var_name=self.top_parent.library_var_name
+ , complete_py_name=self.complete_py_name
+ , class_name=self.declaration.name
+ , ns='::'.join(scope) ) )
+
+ result.append( '%(complete_py_name)s._methods_ = { #class non-virtual member functions definition list'
+ % dict( complete_py_name=self.complete_py_name ) )
+ result.append( compound.compound_t.create_internal_code( self.creators ) )
+ result.append( '}' )
+ result.append( 'del %s' % self.mem_fun_factory_var_name )
+ return os.linesep.join( result )
+
+ def _get_system_files_impl( self ):
+ return []
+
+
+def get_mem_fun_factory_var_name( cc ):
+ while not isinstance( cc, methods_definition_t ):
+ cc = cc.parent
+ return cc.mem_fun_factory_var_name
+
+
+class callable_definition_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
+ def __init__( self, callable ):
+ code_creator.code_creator_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, callable )
+ self.__mode = METHOD_MODE.STAND_ALONE
+
+ def __get_mode(self):
+ return self.__mode
+ def __set_mode(self, new_mode):
+ assert new_mode in METHOD_MODE.all
+ self.__mode = new_mode
+ method_mode = property( __get_mode, __set_mode )
+
+ @property
+ def ftype( self ):
+ return self.declaration.function_type()
+
+ def join_arguments( self, args, group_in_list=True ):
+ args_str = ''
+ arg_separator = ', '
+ if 1 == len( args ):
+ args_str = ' ' + args[0] + ' '
+ else:
+ args_str = ' ' + arg_separator.join( args ) + ' '
+ if args_str.endswith( ' ' ):
+ args_str = args_str[:-1]
+ if group_in_list:
+ return '[%s]' % args_str
+ else:
+ return args_str
+
+ @property
+ def mem_fun_factory_var_name( self ):
+ return get_mem_fun_factory_var_name( self )
+
+ def restype_code(self):
+ if not declarations.is_void( self.ftype.return_type ):
+ return ctypes_formatter.as_ctype( self.ftype.return_type )
+ else:
+ return ''
+
+ def argtypes_code(self, group_in_list=True):
+ if not self.ftype.arguments_types:
+ return ''
+ args = map( ctypes_formatter.as_ctype, self.ftype.arguments_types )
+ return self.join_arguments( args, group_in_list )
+
+ def _get_system_files_impl( self ):
+ return []
+
+
+class function_definition_t(callable_definition_t):
+ def __init__( self, free_fun ):
+ callable_definition_t.__init__( self, free_fun )
+
+ def _create_impl(self):
+ global function_prototype_mapping
+ result = []
+ result.append( '%(alias)s_type = ctypes.%(prototype)s( %(restype)s%(argtypes)s )' )
+ result.append( '%(alias)s = %(alias)s_type( ( %(library_var_name)s.undecorated_names["%(undecorated_decl_name)s"], %(library_var_name)s ) )' )
+
+ restype = self.restype_code()
+ argtypes = self.argtypes_code( group_in_list=False )
+
+ return os.linesep.join( result ) \
+ % dict( alias=self.declaration.alias
+ , prototype=function_prototype_mapping[ self.declaration.calling_convention ]
+ , restype=self.iif( restype, restype, 'None' )
+ , argtypes=self.iif( argtypes, ',' + argtypes, '' )
+ , library_var_name=self.top_parent.library_var_name
+ , undecorated_decl_name=self.undecorated_decl_name )
+
+ #~ result.append( '%(alias)s = getattr( %(library_var_name)s, %(library_var_name)s.undecorated_names["%(undecorated_decl_name)s"] )'
+ #~ % dict( alias=self.declaration.alias
+ #~ , library_var_name=self.top_parent.library_var_name
+ #~ , undecorated_decl_name=self.undecorated_decl_name) )
+ #~ restype = self.restype_code()
+ #~ if restype:
+ #~ result.append( '%(alias)s.restype = %(restype)s'
+ #~ % dict( alias=self.declaration.alias, restype=restype ) )
+
+ #~ argtypes = self.argtypes_code()
+ #~ if argtypes:
+ #~ result.append( '%(alias)s.argtypes = %(argtypes)s'
+ #~ % dict( alias=self.declaration.alias, argtypes=argtypes ) )
+
+ return os.linesep.join( result )
+
+class init_definition_t( callable_definition_t ):
+ def __init__( self, constructor ):
+ callable_definition_t.__init__( self, constructor )
+
+ def _get_alias_impl( self ):
+ return "__init__"
+
+ def _create_impl(self):
+ tmpl = ''
+ substitue_dict = dict( mfcreator=self.mem_fun_factory_var_name )
+ if self.declaration.is_trivial_constructor:
+ tmpl = '%(mfcreator)s.default_constructor()'
+ elif self.declaration.is_copy_constructor:
+ tmpl = '%(mfcreator)s.copy_constructor()'
+ else:
+ tmpl = '"%(undecorated_decl_name)s", argtypes=%(args)s'
+ if self.method_mode == METHOD_MODE.STAND_ALONE:
+ tmpl = '%(mfcreator)s( ' + tmpl + ' )'
+ substitue_dict['args'] = self.argtypes_code()
+ substitue_dict['undecorated_decl_name'] = self.undecorated_decl_name
+ if self.method_mode == METHOD_MODE.STAND_ALONE:
+ tmpl = '"%s" : %s,' % ( self.alias, tmpl )
+ return tmpl % substitue_dict
+
+#TODO: aliases for a mem fun and const mem fun with the same name should be different
+
+class mem_fun_definition_t( callable_definition_t ):
+ def __init__( self, constructor ):
+ callable_definition_t.__init__( self, constructor )
+
+ def _create_impl(self):
+ result = []
+
+ result.append( '"%s"' % self.undecorated_decl_name )
+
+ restype = self.restype_code()
+ if self.method_mode == METHOD_MODE.STAND_ALONE and restype:
+ result.append( 'restype=%s' % restype )
+ argtypes = self.argtypes_code()
+ if argtypes:
+ result.append( 'argtypes=%s' % argtypes )
+ construction_code = ', '.join( result )
+ if self.method_mode == METHOD_MODE.MULTI_METHOD:
+ return construction_code
+ else:
+ return '"%(alias)s" : %(mfcreator)s( %(construction_code)s ),' \
+ % dict( alias=self.declaration.alias
+ , mfcreator=self.mem_fun_factory_var_name
+ , construction_code=construction_code )
+
+class multi_method_definition_t( compound.compound_t ):
+ def __init__( self ):
+ compound.compound_t.__init__( self )
+
+ def get_first_callable( self ):
+ return self.find_by_creator_class( callable_definition_t, unique=False )[0]
+
+ @property
+ def multi_method_alias(self):
+ return self.get_first_callable().alias
+
+ def _create_impl(self):
+ #small hack, this class should not be created at all if there is only one callable
+ if len( self.creators ) == 1:
+ if isinstance( self.creators[0], callable_definition_t ):
+ self.creators[0].method_mode = METHOD_MODE.STAND_ALONE
+ return self.creators[0].create()
+
+ result = []
+
+ return_type = self.get_first_callable().ftype.return_type
+ restype = ''
+ if return_type:
+ restype = self.iif( not declarations.is_void( return_type )
+ , ctypes_formatter.as_ctype( return_type )
+ , '' )
+
+ result.append( '"%(alias)s" : %(mfcreator)s.multi_method(%(restype)s)'
+ % dict( alias=self.multi_method_alias
+ , mfcreator=get_mem_fun_factory_var_name(self)
+ , restype=restype ) )
+ for creator in self.creators:
+ code = ''
+ if isinstance( creator, callable_definition_t ):
+ creator.method_mode = METHOD_MODE.MULTI_METHOD
+ code = '.register( %s )' % creator.create()
+ else:
+ code = creator.create()
+ result.append( self.indent( code, 4 ) )
+ result.append( self.indent( '.finalize(),', 4 ) )
+ return os.linesep.join( result )
+
+ def _get_system_files_impl( self ):
+ return []
+
+
+class del_definition_t( callable_definition_t ):
+ def __init__( self, destructor ):
+ callable_definition_t.__init__( self, destructor )
+
+ def _create_impl(self):
+ return '"__del__" : %(mfcreator)s.destructor(is_virtual=%(virtual)s),' \
+ % dict( mfcreator=self.mem_fun_factory_var_name
+ , virtual=self.iif( self.declaration.virtuality==declarations.VIRTUALITY_TYPES.NOT_VIRTUAL
+ , 'False'
+ , 'True' ) )
Deleted: pyplusplus_dev/pyplusplus/code_creators/function_definition.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/function_definition.py 2009-01-26 07:32:48 UTC (rev 1615)
+++ pyplusplus_dev/pyplusplus/code_creators/function_definition.py 2009-01-26 07:55:08 UTC (rev 1616)
@@ -1,233 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import compound
-import code_creator
-import ctypes_formatter
-import declaration_based
-from pygccxml import declarations
-
-#TODO - unable to call C function, if dll was loaded as CPPDLL
-
-CCT = declarations.CALLING_CONVENTION_TYPES
-
-function_prototype_mapping = {
- CCT.UNKNOWN : 'CFUNCTYPE'
- , CCT.CDECL : 'CFUNCTYPE'
- , CCT.STDCALL : 'WINFUNCTYPE'
- , CCT.THISCALL : 'CPPMETHODTYPE'
- , CCT.FASTCALL : '<<<fastcall unsupported>>>'
- , CCT.SYSTEM_DEFAULT : 'CFUNCTYPE'
-}
-
-assert len( function_prototype_mapping ) == len( CCT.all )
-
-class METHOD_MODE:
- STAND_ALONE = "stand alone"
- MULTI_METHOD = "multi method"
- all = [ STAND_ALONE, MULTI_METHOD ]
-
-
-def get_mem_fun_factory_var_name( cc ):
- import methods_definition
- while not isinstance( cc, methods_definition.methods_definition_t ):
- cc = cc.parent
- return cc.mem_fun_factory_var_name
-
-class callable_definition_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
- def __init__( self, callable ):
- code_creator.code_creator_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, callable )
- self.__mode = METHOD_MODE.STAND_ALONE
-
- def __get_mode(self):
- return self.__mode
- def __set_mode(self, new_mode):
- assert new_mode in METHOD_MODE.all
- self.__mode = new_mode
- method_mode = property( __get_mode, __set_mode )
-
- @property
- def ftype( self ):
- return self.declaration.function_type()
-
- def join_arguments( self, args, group_in_list=True ):
- args_str = ''
- arg_separator = ', '
- if 1 == len( args ):
- args_str = ' ' + args[0] + ' '
- else:
- args_str = ' ' + arg_separator.join( args ) + ' '
- if args_str.endswith( ' ' ):
- args_str = args_str[:-1]
- if group_in_list:
- return '[%s]' % args_str
- else:
- return args_str
-
- @property
- def mem_fun_factory_var_name( self ):
- return get_mem_fun_factory_var_name( self )
-
- def restype_code(self):
- if not declarations.is_void( self.ftype.return_type ):
- return ctypes_formatter.as_ctype( self.ftype.return_type )
- else:
- return ''
-
- def argtypes_code(self, group_in_list=True):
- if not self.ftype.arguments_types:
- return ''
- args = map( ctypes_formatter.as_ctype, self.ftype.arguments_types )
- return self.join_arguments( args, group_in_list )
-
- def _get_system_files_impl( self ):
- return []
-
-
-class function_definition_t(callable_definition_t):
- def __init__( self, free_fun ):
- callable_definition_t.__init__( self, free_fun )
-
- def _create_impl(self):
- global function_prototype_mapping
- result = []
- result.append( '%(alias)s_type = ctypes.%(prototype)s( %(restype)s%(argtypes)s )' )
- result.append( '%(alias)s = %(alias)s_type( ( %(library_var_name)s.undecorated_names["%(undecorated_decl_name)s"], %(library_var_name)s ) )' )
-
- restype = self.restype_code()
- argtypes = self.argtypes_code( group_in_list=False )
-
- return os.linesep.join( result ) \
- % dict( alias=self.declaration.alias
- , prototype=function_prototype_mapping[ self.declaration.calling_convention ]
- , restype=self.iif( restype, restype, 'None' )
- , argtypes=self.iif( argtypes, ',' + argtypes, '' )
- , library_var_name=self.top_parent.library_var_name
- , undecorated_decl_name=self.undecorated_decl_name )
-
- #~ result.append( '%(alias)s = getattr( %(library_var_name)s, %(library_var_name)s.undecorated_names["%(undecorated_decl_name)s"] )'
- #~ % dict( alias=self.declaration.alias
- #~ , library_var_name=self.top_parent.library_var_name
- #~ , undecorated_decl_name=self.undecorated_decl_name) )
- #~ restype = self.restype_code()
- #~ if restype:
- #~ result.append( '%(alias)s.restype = %(restype)s'
- #~ % dict( alias=self.declaration.alias, restype=restype ) )
-
- #~ argtypes = self.argtypes_code()
- #~ if argtypes:
- #~ result.append( '%(alias)s.argtypes = %(argtypes)s'
- #~ % dict( alias=self.declaration.alias, argtypes=argtypes ) )
-
- return os.linesep.join( result )
-
-class init_definition_t( callable_definition_t ):
- def __init__( self, constructor ):
- callable_definition_t.__init__( self, constructor )
-
- def _get_alias_impl( self ):
- return "__init__"
-
- def _create_impl(self):
- tmpl = ''
- substitue_dict = dict( mfcreator=self.mem_fun_factory_var_name )
- if self.declaration.is_trivial_constructor:
- tmpl = '%(mfcreator)s.default_constructor()'
- elif self.declaration.is_copy_constructor:
- tmpl = '%(mfcreator)s.copy_constructor()'
- else:
- tmpl = '"%(undecorated_decl_name)s", argtypes=%(args)s'
- if self.method_mode == METHOD_MODE.STAND_ALONE:
- tmpl = '%(mfcreator)s( ' + tmpl + ' )'
- substitue_dict['args'] = self.argtypes_code()
- substitue_dict['undecorated_decl_name'] = self.undecorated_decl_name
- if self.method_mode == METHOD_MODE.STAND_ALONE:
- tmpl = '"%s" : %s,' % ( self.alias, tmpl )
- return tmpl % substitue_dict
-
-#TODO: aliases for a mem fun and const mem fun with the same name should be different
-
-class mem_fun_definition_t( callable_definition_t ):
- def __init__( self, constructor ):
- callable_definition_t.__init__( self, constructor )
-
- def _create_impl(self):
- result = []
-
- result.append( '"%s"' % self.undecorated_decl_name )
-
- restype = self.restype_code()
- if self.method_mode == METHOD_MODE.STAND_ALONE and restype:
- result.append( 'restype=%s' % restype )
- argtypes = self.argtypes_code()
- if argtypes:
- result.append( 'argtypes=%s' % argtypes )
- construction_code = ', '.join( result )
- if self.method_mode == METHOD_MODE.MULTI_METHOD:
- return construction_code
- else:
- return '"%(alias)s" : %(mfcreator)s( %(construction_code)s ),' \
- % dict( alias=self.declaration.alias
- , mfcreator=self.mem_fun_factory_var_name
- , construction_code=construction_code )
-
-class multi_method_definition_t( compound.compound_t ):
- def __init__( self ):
- compound.compound_t.__init__( self )
-
- def get_first_callable( self ):
- return self.find_by_creator_class( callable_definition_t, unique=False )[0]
-
- @property
- def multi_method_alias(self):
- return self.get_first_callable().alias
-
- def _create_impl(self):
- #small hack, this class should not be created at all if there is only one callable
- if len( self.creators ) == 1:
- if isinstance( self.creators[0], callable_definition_t ):
- self.creators[0].method_mode = METHOD_MODE.STAND_ALONE
- return self.creators[0].create()
-
- result = []
-
- return_type = self.get_first_callable().ftype.return_type
- restype = ''
- if return_type:
- restype = self.iif( not declarations.is_void( return_type )
- , ctypes_formatter.as_ctype( return_type )
- , '' )
-
- result.append( '"%(alias)s" : %(mfcreator)s.multi_method(%(restype)s)'
- % dict( alias=self.multi_method_alias
- , mfcreator=get_mem_fun_factory_var_name(self)
- , restype=restype ) )
- for creator in self.creators:
- code = ''
- if isinstance( creator, callable_definition_t ):
- creator.method_mode = METHOD_MODE.MULTI_METHOD
- code = '.register( %s )' % creator.create()
- else:
- code = creator.create()
- result.append( self.indent( code, 4 ) )
- result.append( self.indent( '.finalize(),', 4 ) )
- return os.linesep.join( result )
-
- def _get_system_files_impl( self ):
- return []
-
-
-class del_definition_t( callable_definition_t ):
- def __init__( self, destructor ):
- callable_definition_t.__init__( self, destructor )
-
- def _create_impl(self):
- return '"__del__" : %(mfcreator)s.destructor(is_virtual=%(virtual)s),' \
- % dict( mfcreator=self.mem_fun_factory_var_name
- , virtual=self.iif( self.declaration.virtuality==declarations.VIRTUALITY_TYPES.NOT_VIRTUAL
- , 'False'
- , 'True' ) )
Deleted: pyplusplus_dev/pyplusplus/code_creators/mem_fun_introduction.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/mem_fun_introduction.py 2009-01-26 07:32:48 UTC (rev 1615)
+++ pyplusplus_dev/pyplusplus/code_creators/mem_fun_introduction.py 2009-01-26 07:55:08 UTC (rev 1616)
@@ -1,84 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import code_creator
-import declaration_based
-from pygccxml import declarations
-
-class mem_fun_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
- def __init__( self, mem_fun ):
- code_creator.code_creator_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, mem_fun )
-
- def _create_impl(self):
- tmpl = ['def %(alias)s( self, *args ):']
- tmpl.append( self.indent('"""%(name)s"""') )
- tmpl.append( self.indent("return self._methods_['%(alias)s']( ctypes.pointer( self ), *args )") )
- return os.linesep.join( tmpl ) \
- % dict( alias=self.declaration.alias, name=self.undecorated_decl_name )
-
- def _get_system_files_impl( self ):
- return []
-
-class vmem_fun_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
- def __init__( self, mem_fun ):
- code_creator.code_creator_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, mem_fun )
-
- def _create_impl(self):
- tmpl = ['def %(alias)s( self, *args ):']
- tmpl.append( self.indent('"""%(name)s"""') )
- tmpl.append( self.indent("return self._vtable_['%(ordinal)d'].%(alias)s( ctypes.pointer( self ), *args )") )
- return os.linesep.join( tmpl ) \
- % dict( alias=self.declaration.alias
- , name=self.undecorated_decl_name
- , ordinal=0)
-
- def _get_system_files_impl( self ):
- return []
-
-class init_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
- def __init__( self, constructor ):
- code_creator.code_creator_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, constructor )
-
- def _create_impl(self):
- tmpl = ['def __init__( self, *args ):']
- tmpl.append( self.indent('"""%(name)s"""') )
- tmpl.append( self.indent("return self._methods_['__init__']( ctypes.pointer( self ), *args )") )
- return os.linesep.join( tmpl ) \
- % dict( alias=self.declaration.alias, name=self.undecorated_decl_name )
-
- def _get_system_files_impl( self ):
- return []
-
-class opaque_init_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
- def __init__( self, class_ ):
- code_creator.code_creator_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, class_ )
-
- def _create_impl(self):
- tmpl = ['def __init__( self, *args, **keywd ):']
- tmpl.append( self.indent('raise RuntimeError( "Unable to create instance of opaque type." )') )
- return os.linesep.join( tmpl )
-
- def _get_system_files_impl( self ):
- return []
-
-class del_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
- def __init__( self, constructor ):
- code_creator.code_creator_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, constructor )
-
- def _create_impl(self):
- tmpl = ['def __del__( self ):']
- tmpl.append( self.indent('"""%(name)s"""') )
- tmpl.append( self.indent("return self._methods_['__del__']( ctypes.pointer( self ) )") )
- return os.linesep.join( tmpl ) \
- % dict( name=self.undecorated_decl_name )
-
- def _get_system_files_impl( self ):
- return []
Deleted: pyplusplus_dev/pyplusplus/code_creators/methods_definition.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/methods_definition.py 2009-01-26 07:32:48 UTC (rev 1615)
+++ pyplusplus_dev/pyplusplus/code_creators/methods_definition.py 2009-01-26 07:55:08 UTC (rev 1616)
@@ -1,58 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import compound
-import declaration_based
-from pygccxml import declarations
-
-class methods_definition_t(compound.compound_t, declaration_based.declaration_based_t):
- def __init__( self, class_ ):
- compound.compound_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, class_ )
-
- @property
- def mem_fun_factory_var_name(self):
- return "mfcreator"
-
- def find_mutli_method( self, alias ):
- import function_definition
- mmdef_t = function_definition.multi_method_definition_t
- multi_method_defs = self.find_by_creator_class( mmdef_t, unique=False )
- if None is multi_method_defs:
- return
- multi_method_defs = filter( lambda cc: cc.multi_method_alias == alias
- , multi_method_defs )
- if multi_method_defs:
- return multi_method_defs[0]
- else:
- return None
-
-
- def _create_impl(self):
- result = []
- scope = declarations.algorithm.declaration_path( self.declaration )
- del scope[0] #del :: from the global namespace
- del scope[-1] #del self from the list
-
- tmpl = '%(mem_fun_factory_var_name)s = ctypes_utils.mem_fun_factory( %(library_var_name)s, %(complete_py_name)s, "%(class_name)s", "%(ns)s" )'
- if not scope:
- tmpl = '%(mem_fun_factory_var_name)s = ctypes_utils.mem_fun_factory( %(library_var_name)s, %(complete_py_name)s, "%(class_name)s" )'
-
- result.append( tmpl % dict( mem_fun_factory_var_name=self.mem_fun_factory_var_name
- , library_var_name=self.top_parent.library_var_name
- , complete_py_name=self.complete_py_name
- , class_name=self.declaration.name
- , ns='::'.join(scope) ) )
-
- result.append( '%(complete_py_name)s._methods_ = { #class non-virtual member functions definition list'
- % dict( complete_py_name=self.complete_py_name ) )
- result.append( compound.compound_t.create_internal_code( self.creators ) )
- result.append( '}' )
- result.append( 'del %s' % self.mem_fun_factory_var_name )
- return os.linesep.join( result )
-
- def _get_system_files_impl( self ):
- return []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 07:32:52
|
Revision: 1615
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1615&view=rev
Author: roman_yakovenko
Date: 2009-01-26 07:32:48 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
merging ctypes and boost.python code creators into single file
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/__init__.py
pyplusplus_dev/pyplusplus/code_creators/member_variable.py
Removed Paths:
-------------
pyplusplus_dev/pyplusplus/code_creators/fields_definition.py
Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 06:55:33 UTC (rev 1614)
+++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 07:32:48 UTC (rev 1615)
@@ -111,6 +111,7 @@
from member_variable import mem_var_ref_t
from member_variable import mem_var_ref_wrapper_t
from member_variable import member_variable_addressof_t
+from member_variable import fields_definition_t
from class_declaration import class_t
from class_declaration import class_wrapper_t
@@ -160,7 +161,6 @@
from mem_fun_introduction import opaque_init_introduction_t
from mem_fun_introduction import del_introduction_t
-from fields_definition import fields_definition_t
from methods_definition import methods_definition_t
from function_definition import function_definition_t
from function_definition import init_definition_t
Deleted: pyplusplus_dev/pyplusplus/code_creators/fields_definition.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/fields_definition.py 2009-01-26 06:55:33 UTC (rev 1614)
+++ pyplusplus_dev/pyplusplus/code_creators/fields_definition.py 2009-01-26 07:32:48 UTC (rev 1615)
@@ -1,63 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import algorithm
-import code_creator
-import ctypes_formatter
-import declaration_based
-from pygccxml import declarations
-
-#TODO: don't hide public member variables
-#TODO: how _fields_ should be defined in a class hierarchy
-#TODO: fix 64bit issue with calculating vtable pointer size
-
-
-class fields_definition_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
- def __init__( self, class_ ):
- code_creator.code_creator_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, class_ )
-
- def has_unnamed_type( self, var ):
- type_ = declarations.remove_pointer( var.type )
- #~ type_ = declarations.remove_declarated( type_ )
- if declarations.class_traits.is_my_case( type_ ):
- cls = declarations.class_traits.get_declaration( type_ )
- return bool( not cls.name )
- else:
- return False
-
- def _create_impl(self):
- result = []
- anonymous_vars = self.declaration.vars( self.has_unnamed_type, recursive=False, allow_empty=True )
- if anonymous_vars:
- formated_vars = []
- for var in anonymous_vars:
- formated_vars.append( '"%s"' % var.alias )
- result.append( '%(complete_py_name)s._anonymous_ = [%(vars)s]'
- % dict( complete_py_name=self.complete_py_name
- , vars=', '.join( formated_vars ) ) )
-
- result.append( '%(complete_py_name)s._fields_ = [ #class %(decl_identifier)s'
- % dict( complete_py_name=self.complete_py_name
- , decl_identifier=self.decl_identifier) )
- if self.declaration.has_vtable:
- result.append( self.indent( '("_vtable_", ctypes.POINTER(ctypes.c_void_p)),' ) )
-
- vars = self.declaration.vars( allow_empty=True, recursive=False )
- if not vars:
- result.append( self.indent( '("__empty__", ctypes.c_char * 4)' ) )
- else:
- vars = vars.to_list()
- vars.sort( key=lambda d: d.location.line )
- for v in vars:
- result.append( self.indent( '("%(name)s", %(type)s),'
- % dict( name=v.alias
- ,type=ctypes_formatter.as_ctype( v.type ) ) ) )
- result.append( ']' )
- return os.linesep.join( result )
-
- def _get_system_files_impl( self ):
- return []
Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2009-01-26 06:55:33 UTC (rev 1614)
+++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2009-01-26 07:32:48 UTC (rev 1615)
@@ -6,12 +6,13 @@
import os
import algorithm
import code_creator
+import ctypes_formatter
import declaration_based
+import registration_based
+from pygccxml import declarations
from pyplusplus import code_repository
from pyplusplus.decl_wrappers import call_policies
from pyplusplus.decl_wrappers import python_traits
-import registration_based
-from pygccxml import declarations
class member_variable_base_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
@@ -673,7 +674,7 @@
if self.has_setter():
answer.append( param_sep )
answer.append( 'pyplus_conv::make_address_setter(&%s)'
- % self.decl_identifier )
+ % self.decl_identifier )
if self.documentation:
answer.append( param_sep )
answer.append( self.documentation )
@@ -694,3 +695,55 @@
return self._create_m_var()
def _get_system_files_impl( self ):
return [code_repository.ctypes_integration.file_name]
+
+
+#TODO: don't hide public member variables
+#TODO: how _fields_ should be defined in a class hierarchy
+#TODO: fix 64bit issue with calculating vtable pointer size
+
+class fields_definition_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
+ def __init__( self, class_ ):
+ code_creator.code_creator_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, class_ )
+
+ def has_unnamed_type( self, var ):
+ type_ = declarations.remove_pointer( var.type )
+ #~ type_ = declarations.remove_declarated( type_ )
+ if declarations.class_traits.is_my_case( type_ ):
+ cls = declarations.class_traits.get_declaration( type_ )
+ return bool( not cls.name )
+ else:
+ return False
+
+ def _create_impl(self):
+ result = []
+ anonymous_vars = self.declaration.vars( self.has_unnamed_type, recursive=False, allow_empty=True )
+ if anonymous_vars:
+ formated_vars = []
+ for var in anonymous_vars:
+ formated_vars.append( '"%s"' % var.alias )
+ result.append( '%(complete_py_name)s._anonymous_ = [%(vars)s]'
+ % dict( complete_py_name=self.complete_py_name
+ , vars=', '.join( formated_vars ) ) )
+
+ result.append( '%(complete_py_name)s._fields_ = [ #class %(decl_identifier)s'
+ % dict( complete_py_name=self.complete_py_name
+ , decl_identifier=self.decl_identifier) )
+ if self.declaration.has_vtable:
+ result.append( self.indent( '("_vtable_", ctypes.POINTER(ctypes.c_void_p)),' ) )
+
+ vars = self.declaration.vars( allow_empty=True, recursive=False )
+ if not vars:
+ result.append( self.indent( '("__empty__", ctypes.c_char * 4)' ) )
+ else:
+ vars = vars.to_list()
+ vars.sort( key=lambda d: d.location.line )
+ for v in vars:
+ result.append( self.indent( '("%(name)s", %(type)s),'
+ % dict( name=v.alias
+ ,type=ctypes_formatter.as_ctype( v.type ) ) ) )
+ result.append( ']' )
+ return os.linesep.join( result )
+
+ def _get_system_files_impl( self ):
+ return []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 06:55:37
|
Revision: 1614
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1614&view=rev
Author: roman_yakovenko
Date: 2009-01-26 06:55:33 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
merging ctypes and boost.python code creators into single file
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/__init__.py
pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
Removed Paths:
-------------
pyplusplus_dev/pyplusplus/code_creators/class_introduction.py
Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 06:49:48 UTC (rev 1613)
+++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 06:55:33 UTC (rev 1614)
@@ -45,6 +45,7 @@
from namespace import namespace_as_pyclass_t
from enum import enum_t
+from enum import pyenum_t
from calldef import free_function_t
from calldef import mem_fun_t
@@ -98,6 +99,7 @@
from global_variable import array_gv_t
from global_variable import array_gv_wrapper_t
from global_variable import global_variable_addressof_t
+from global_variable import global_variable_reference_t
from member_variable import member_variable_base_t
from member_variable import member_variable_t
@@ -113,6 +115,8 @@
from class_declaration import class_t
from class_declaration import class_wrapper_t
from class_declaration import class_declaration_t
+from class_declaration import class_introduction_t
+from class_declaration import class_declaration_introduction_t
from instruction import instruction_t
@@ -150,8 +154,6 @@
#pure ctypes
from library_reference import library_reference_t
from name_mappings import name_mappings_t
-from class_introduction import class_introduction_t
-from class_introduction import class_declaration_introduction_t
from mem_fun_introduction import mem_fun_introduction_t
from mem_fun_introduction import vmem_fun_introduction_t
from mem_fun_introduction import init_introduction_t
@@ -159,7 +161,6 @@
from mem_fun_introduction import del_introduction_t
from fields_definition import fields_definition_t
-from embedded_code_repository import embedded_code_repository_t
from methods_definition import methods_definition_t
from function_definition import function_definition_t
from function_definition import init_definition_t
@@ -167,5 +168,6 @@
from function_definition import del_definition_t
from function_definition import mem_fun_definition_t
from typedef_as_pyvar import typedef_as_pyvar_t
-from enum import pyenum_t
-from global_variable import global_variable_reference_t
+
+
+from embedded_code_repository import embedded_code_repository_t
Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2009-01-26 06:49:48 UTC (rev 1613)
+++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2009-01-26 06:55:33 UTC (rev 1614)
@@ -7,7 +7,9 @@
import types
import scoped
import calldef
+import compound
import algorithm
+import code_creator
import smart_pointers
import declaration_based
import registration_based
@@ -150,7 +152,7 @@
def _generate_noncopyable(self):
noncopyable_vars = self.declaration.find_noncopyable_vars()
copy_constr = self.declaration.find_copy_constructor()
-
+
if self.declaration.noncopyable \
or copy_constr and copy_constr.is_artificial and noncopyable_vars:
return algorithm.create_identifier( self, '::boost::noncopyable' )
@@ -198,7 +200,7 @@
args.append( self.wrapper.full_name )
else:
args.append( self.decl_identifier )
-
+
bases = self._generate_bases(base_creators)
if bases:
args.append( bases )
@@ -217,10 +219,10 @@
if self.documentation:
result.append( ', %s' % self.documentation )
used_init = None
- inits = filter( lambda x: isinstance( x, calldef.constructor_t ), self.creators )
+ inits = filter( lambda x: isinstance( x, calldef.constructor_t ), self.creators )
trivial_constructor = self.declaration.find_trivial_constructor()
-
+
if self.declaration.no_init:
result.append( ", " )
result.append( algorithm.create_identifier( self, '::boost::python::no_init' ) )
@@ -254,7 +256,7 @@
@property
def class_var_name(self):
return self.declaration.class_var_name
-
+
@property
def typedef_name( self ):
return self.class_var_name + '_t'
@@ -319,7 +321,7 @@
return self._generate_code_with_scope()
else:
return self._generate_code_no_scope()
-
+
def _get_system_files_impl( self ):
return []
@@ -340,7 +342,7 @@
self.declaration.wrapper_alias = walias
wrapper_alias = property( _get_wrapper_alias, _set_wrapper_alias )
- @property
+ @property
def base_wrappers( self ):
if self.declaration.is_abstract and not self._base_wrappers:
bases = [ hi.related_class for hi in self.declaration.bases ]
@@ -397,3 +399,60 @@
def _get_system_files_impl( self ):
return []
+
+
+ctypes_base_classes = {
+ declarations.CLASS_TYPES.CLASS : 'Structure'
+ , declarations.CLASS_TYPES.UNION : 'Union'
+ , declarations.CLASS_TYPES.STRUCT : 'Structure'
+}
+
+class class_introduction_t(compound.compound_t, declaration_based.declaration_based_t):
+ def __init__( self, class_ ):
+ compound.compound_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, class_ )
+
+ @property
+ def ctypes_base_class( self ):
+ global ctypes_base_classes
+ return ctypes_base_classes[ self.declaration.class_type ]
+
+ def _create_impl(self):
+ result = []
+ result.append( "class %(alias)s(ctypes.%(base)s):"
+ % dict( alias=self.alias, base=self.ctypes_base_class ) )
+ result.append( self.indent( '"""class %s"""' % self.decl_identifier ) )
+ if self.creators:
+ result.append( self.indent( '' ) )
+ result.append( compound.compound_t.create_internal_code( self.creators ) )
+
+ if isinstance( self.declaration.parent, declarations.namespace_t ) \
+ and self.declaration.parent is not self.declaration.top_parent: #not a global namespace
+ result.append("")
+ result.append( '%(ns_full_name)s = %(name)s'
+ % dict( ns_full_name=self.complete_py_name, name=self.alias ))
+ return os.linesep.join( result )
+
+ def _get_system_files_impl( self ):
+ return []
+
+
+class class_declaration_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
+ def __init__( self, class_declaration ):
+ code_creator.code_creator_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, class_declaration )
+
+ def _create_impl(self):
+ result = []
+ result.append( "class %s(ctypes.Structure):" % self.alias )
+ result.append( self.indent( '"""class declaration %s"""' % self.decl_identifier ) )
+ result.append( self.indent( '_fields_ = []' ) )
+
+ if isinstance( self.declaration.parent, declarations.namespace_t ) \
+ and self.declaration.parent is not self.declaration.top_parent: #not a global namespace
+ result.append( '%(ns_full_name)s = %(name)s'
+ % dict( ns_full_name=self.complete_py_name, name=self.alias ))
+ return os.linesep.join( result )
+
+ def _get_system_files_impl( self ):
+ return []
Deleted: pyplusplus_dev/pyplusplus/code_creators/class_introduction.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/class_introduction.py 2009-01-26 06:49:48 UTC (rev 1613)
+++ pyplusplus_dev/pyplusplus/code_creators/class_introduction.py 2009-01-26 06:55:33 UTC (rev 1614)
@@ -1,66 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import compound
-import code_creator
-import declaration_based
-from pygccxml import declarations
-
-ctypes_base_classes = {
- declarations.CLASS_TYPES.CLASS : 'Structure'
- , declarations.CLASS_TYPES.UNION : 'Union'
- , declarations.CLASS_TYPES.STRUCT : 'Structure'
-}
-
-class class_introduction_t(compound.compound_t, declaration_based.declaration_based_t):
- def __init__( self, class_ ):
- compound.compound_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, class_ )
-
- @property
- def ctypes_base_class( self ):
- global ctypes_base_classes
- return ctypes_base_classes[ self.declaration.class_type ]
-
- def _create_impl(self):
- result = []
- result.append( "class %(alias)s(ctypes.%(base)s):"
- % dict( alias=self.alias, base=self.ctypes_base_class ) )
- result.append( self.indent( '"""class %s"""' % self.decl_identifier ) )
- if self.creators:
- result.append( self.indent( '' ) )
- result.append( compound.compound_t.create_internal_code( self.creators ) )
-
- if isinstance( self.declaration.parent, declarations.namespace_t ) \
- and self.declaration.parent is not self.declaration.top_parent: #not a global namespace
- result.append("")
- result.append( '%(ns_full_name)s = %(name)s'
- % dict( ns_full_name=self.complete_py_name, name=self.alias ))
- return os.linesep.join( result )
-
- def _get_system_files_impl( self ):
- return []
-
-
-class class_declaration_introduction_t(code_creator.code_creator_t, declaration_based.declaration_based_t):
- def __init__( self, class_declaration ):
- code_creator.code_creator_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, class_declaration )
-
- def _create_impl(self):
- result = []
- result.append( "class %s(ctypes.Structure):" % self.alias )
- result.append( self.indent( '"""class declaration %s"""' % self.decl_identifier ) )
- result.append( self.indent( '_fields_ = []' ) )
-
- if isinstance( self.declaration.parent, declarations.namespace_t ) \
- and self.declaration.parent is not self.declaration.top_parent: #not a global namespace
- result.append( '%(ns_full_name)s = %(name)s'
- % dict( ns_full_name=self.complete_py_name, name=self.alias ))
- return os.linesep.join( result )
-
- def _get_system_files_impl( self ):
- return []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 06:49:52
|
Revision: 1613
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1613&view=rev
Author: roman_yakovenko
Date: 2009-01-26 06:49:48 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
merging ctypes and boost.python code creators into single file
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/__init__.py
pyplusplus_dev/pyplusplus/code_creators/include.py
pyplusplus_dev/pyplusplus/code_creators/module.py
pyplusplus_dev/pyplusplus/code_creators/namespace.py
Removed Paths:
-------------
pyplusplus_dev/pyplusplus/code_creators/import_.py
pyplusplus_dev/pyplusplus/code_creators/namespace_as_pyclass.py
Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 06:34:05 UTC (rev 1612)
+++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 06:49:48 UTC (rev 1613)
@@ -14,6 +14,7 @@
The base class for all code creators is L{code_creator_t}.
"""
+
from code_creator import code_creator_t
from code_creator import separator_t
from compound import compound_t
@@ -35,11 +36,13 @@
from module_body import module_body_t
from include import include_t
+from include import import_t
from unnamed_enum import unnamed_enum_t
from namespace import namespace_alias_t
from namespace import namespace_using_t
+from namespace import namespace_as_pyclass_t
from enum import enum_t
@@ -118,6 +121,7 @@
from license import license_t
from module import bpmodule_t
+from module import ctypes_module_t
from smart_pointers import held_type_t
from smart_pointers import smart_pointers_converter_t
@@ -144,11 +148,8 @@
from bookmark import bookmark_t
#pure ctypes
-from module import ctypes_module_t
-from import_ import import_t
from library_reference import library_reference_t
from name_mappings import name_mappings_t
-from namespace_as_pyclass import namespace_as_pyclass_t
from class_introduction import class_introduction_t
from class_introduction import class_declaration_introduction_t
from mem_fun_introduction import mem_fun_introduction_t
Deleted: pyplusplus_dev/pyplusplus/code_creators/import_.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/import_.py 2009-01-26 06:34:05 UTC (rev 1612)
+++ pyplusplus_dev/pyplusplus/code_creators/import_.py 2009-01-26 06:49:48 UTC (rev 1613)
@@ -1,21 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import code_creator
-import include_directories
-
-
-class import_t(code_creator.code_creator_t):
- """Creates Python import directive"""
- def __init__( self, module_name ):
- code_creator.code_creator_t.__init__(self)
- self._module_name = module_name
-
- def _create_impl(self):
- return 'import %(module)s' % dict( module=os.path.splitext(self._module_name)[0] )
-
- def _get_system_files_impl( self ):
- return []
Modified: pyplusplus_dev/pyplusplus/code_creators/include.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/include.py 2009-01-26 06:34:05 UTC (rev 1612)
+++ pyplusplus_dev/pyplusplus/code_creators/include.py 2009-01-26 06:49:48 UTC (rev 1613)
@@ -3,6 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
+import os
import code_creator
import include_directories
@@ -21,29 +22,29 @@
@property
def is_user_defined(self):
return self._user_defined
-
+
@property
def is_system(self):
"""Return True if header file is system( Boost.Python or Py++ ) header file"""
return self._system
-
+
def _get_header(self):
return self._header
def _set_header(self, header):
self._header = include_directories.include_directories_t.normalize( header )
header = property( _get_header, _set_header )
-
+
def _get_include_dirs_optimization(self):
return self._include_dirs_optimization
def _set_include_dirs_optimization(self, include_dirs):
self._include_dirs_optimization = include_dirs
- include_dirs_optimization = property( _get_include_dirs_optimization, _set_include_dirs_optimization )
-
+ include_dirs_optimization = property( _get_include_dirs_optimization, _set_include_dirs_optimization )
+
def _create_include_directive_code(self):
header = self.header.strip()
if header.startswith( '"' ) or header.startswith( '<' ):
return '#include %s' % self.header
-
+
if not self.include_dirs_optimization:
return '#include "%s"' % self.header
else:
@@ -52,11 +53,24 @@
return '#include <%s>' % normalize_header
else:
return '#include "%s"' % normalize_header
-
+
def _create_impl(self):
if not self.__created_code:
self.__created_code = self._create_include_directive_code()
return self.__created_code
-
+
def _get_system_files_impl( self ):
return []
+
+
+class import_t(code_creator.code_creator_t):
+ """Creates Python import directive"""
+ def __init__( self, module_name ):
+ code_creator.code_creator_t.__init__(self)
+ self._module_name = module_name
+
+ def _create_impl(self):
+ return 'import %(module)s' % dict( module=os.path.splitext(self._module_name)[0] )
+
+ def _get_system_files_impl( self ):
+ return []
Modified: pyplusplus_dev/pyplusplus/code_creators/module.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/module.py 2009-01-26 06:34:05 UTC (rev 1612)
+++ pyplusplus_dev/pyplusplus/code_creators/module.py 2009-01-26 06:49:48 UTC (rev 1613)
@@ -5,7 +5,6 @@
import os
import custom
-import import_
import license
import include
import compound
Modified: pyplusplus_dev/pyplusplus/code_creators/namespace.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/namespace.py 2009-01-26 06:34:05 UTC (rev 1612)
+++ pyplusplus_dev/pyplusplus/code_creators/namespace.py 2009-01-26 06:49:48 UTC (rev 1613)
@@ -3,7 +3,10 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
+import os
+import compound
import code_creator
+import declaration_based
class namespace_alias_t(code_creator.code_creator_t):
def __init__( self, alias, full_namespace_name ):
@@ -23,7 +26,7 @@
def _set_full_namespace_name( self, new_full_namespace_name ):
self._full_namespace_name = new_full_namespace_name
full_namespace_name = property( _get_full_namespace_name, _set_full_namespace_name )
-
+
def _create_impl(self):
if self.__created_code:
return self.__created_code
@@ -45,13 +48,32 @@
def _set_namespace_name( self, new_namespace_name ):
self._namespace_name = new_namespace_name
namespace_name = property( _get_namespace_name, _set_namespace_name )
-
+
def _create_impl(self):
if self.__created_code:
return self.__created_code
else:
self.__created_code = 'using namespace %s;' % self.namespace_name
return self.__created_code
-
+
def _get_system_files_impl( self ):
return []
+
+
+class namespace_as_pyclass_t(compound.compound_t, declaration_based.declaration_based_t):
+ def __init__( self, ns ):
+ compound.compound_t.__init__(self)
+ declaration_based.declaration_based_t.__init__( self, ns )
+
+ def _create_impl(self):
+ result = []
+ result.append( "class %s:" % self.alias )
+ result.append( self.indent( '"""namespace %s"""' % self.decl_identifier ) )
+ if self.creators:
+ result.append( self.indent( "" ) )
+ result.append( compound.compound_t.create_internal_code( self.creators ) )
+ return os.linesep.join( result )
+
+ def _get_system_files_impl( self ):
+ return []
+
Deleted: pyplusplus_dev/pyplusplus/code_creators/namespace_as_pyclass.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/namespace_as_pyclass.py 2009-01-26 06:34:05 UTC (rev 1612)
+++ pyplusplus_dev/pyplusplus/code_creators/namespace_as_pyclass.py 2009-01-26 06:49:48 UTC (rev 1613)
@@ -1,25 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import compound
-import declaration_based
-
-class namespace_as_pyclass_t(compound.compound_t, declaration_based.declaration_based_t):
- def __init__( self, ns ):
- compound.compound_t.__init__(self)
- declaration_based.declaration_based_t.__init__( self, ns )
-
- def _create_impl(self):
- result = []
- result.append( "class %s:" % self.alias )
- result.append( self.indent( '"""namespace %s"""' % self.decl_identifier ) )
- if self.creators:
- result.append( self.indent( "" ) )
- result.append( compound.compound_t.create_internal_code( self.creators ) )
- return os.linesep.join( result )
-
- def _get_system_files_impl( self ):
- return []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 06:34:11
|
Revision: 1612
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1612&view=rev
Author: roman_yakovenko
Date: 2009-01-26 06:34:05 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
merging different module classes in the same file
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/__init__.py
pyplusplus_dev/pyplusplus/code_creators/module.py
Removed Paths:
-------------
pyplusplus_dev/pyplusplus/code_creators/bpmodule.py
pyplusplus_dev/pyplusplus/code_creators/modules.py
Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 06:32:49 UTC (rev 1611)
+++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2009-01-26 06:34:05 UTC (rev 1612)
@@ -117,7 +117,7 @@
from license import license_t
-from bpmodule import bpmodule_t
+from module import bpmodule_t
from smart_pointers import held_type_t
from smart_pointers import smart_pointers_converter_t
@@ -144,7 +144,7 @@
from bookmark import bookmark_t
#pure ctypes
-from ctypes_module import ctypes_module_t
+from module import ctypes_module_t
from import_ import import_t
from library_reference import library_reference_t
from name_mappings import name_mappings_t
Deleted: pyplusplus_dev/pyplusplus/code_creators/bpmodule.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/bpmodule.py 2009-01-26 06:32:49 UTC (rev 1611)
+++ pyplusplus_dev/pyplusplus/code_creators/bpmodule.py 2009-01-26 06:34:05 UTC (rev 1612)
@@ -1,157 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-import os
-import custom
-import module
-import include
-import namespace
-import compound
-import algorithm
-import module_body
-import include_directories
-
-class bpmodule_t(module.module_t):
- """This class represents the source code for the entire extension module.
-
- The root of the code creator tree is always a module_t object.
- """
- def __init__(self, global_ns):
- """Constructor.
- """
- module.module_t.__init__(self, global_ns, bpmodule_t.CODE_GENERATOR_TYPES.BOOST_PYTHON)
- self.__body = None
-
- def _get_include_dirs(self):
- include_dirs = algorithm.creator_finder.find_by_class_instance(
- what=include_directories.include_directories_t
- , where=self.creators
- , recursive=False)
- if 0 == len( include_dirs ):
- include_dirs = include_directories.include_directories_t()
- if self.license:
- self.adopt_creator( include_dirs, 1 )
- else:
- self.adopt_creator( include_dirs, 0 )
- return include_dirs
- elif 1 == len( include_dirs ):
- return include_dirs[0]
- else:
- assert not "only single instance of include_directories_t should exist"
-
- def _get_std_directories(self):
- include_dirs = self._get_include_dirs()
- return include_dirs.std
- std_directories = property( _get_std_directories )
-
- def _get_user_defined_directories(self):
- include_dirs = self._get_include_dirs()
- return include_dirs.user_defined
- user_defined_directories = property( _get_user_defined_directories )
-
- @property
- def body(self):
- """Return reference to L{module_body_t} code creator"""
- if None is self.__body:
- found = algorithm.creator_finder.find_by_class_instance( what=module_body.module_body_t
- , where=self.creators
- , recursive=False )
- if found:
- self.__body = found[0]
- return self.__body
-
- def last_include_index(self):
- """Return the children index of the last L{include_t} object.
-
- An exception is raised when there is no include_t object among
- the children creators.
-
- @returns: Children index
- @rtype: int
- """
- for i in range( len(self.creators) - 1, -1, -1 ):
- if isinstance( self.creators[i], include.include_t ):
- return i
- else:
- return 0
-
- def replace_included_headers( self, headers, leave_system_headers=True ):
- to_be_removed = []
- for creator in self.creators:
- if isinstance( creator, include.include_t ):
- to_be_removed.append( creator )
- elif isinstance( creator, module_body.module_body_t ):
- break
-
- for creator in to_be_removed:
- if creator.is_system:
- if not leave_system_headers:
- self.remove_creator( creator )
- elif creator.is_user_defined:
- pass
- else:
- self.remove_creator( creator )
- map( lambda header: self.adopt_include( include.include_t( header=header ) )
- , headers )
-
- def adopt_include(self, include_creator):
- """Insert an L{include_t} object.
-
- The include creator is inserted right after the last include file.
-
- @param include_creator: Include creator object
- @type include_creator: L{include_t}
- """
- lii = self.last_include_index()
- if lii == 0:
- if not self.creators:
- lii = -1
- elif not isinstance( self.creators[0], include.include_t ):
- lii = -1
- else:
- pass
- self.adopt_creator( include_creator, lii + 1 )
-
- def do_include_dirs_optimization(self):
- include_dirs = self._get_include_dirs()
- includes = filter( lambda creator: isinstance( creator, include.include_t )
- , self.creators )
- for include_creator in includes:
- include_creator.include_dirs_optimization = include_dirs
-
- def _create_impl(self):
- self.do_include_dirs_optimization()
- index = 0
- code = []
- for index in range( len( self.creators ) ):
- if not isinstance( self.creators[index], include.include_t ):
- break
- else:
- code.append( self.creators[index].create() )
- if code:
- code.append( 2* os.linesep )
- code.append( self.create_internal_code( self.creators[index:], indent_code=False ))
- code.append( os.linesep )
- return os.linesep.join( code )
-
- def add_include( self, header, user_defined=True, system=False ):
- creator = include.include_t( header=header, user_defined=user_defined, system=system )
- self.adopt_include( creator )
-
- def add_namespace_usage( self, namespace_name ):
- self.adopt_creator( namespace.namespace_using_t( namespace_name )
- , self.last_include_index() + 1 )
-
- def add_namespace_alias( self, alias, full_namespace_name ):
- self.adopt_creator( namespace.namespace_alias_t(
- alias=alias
- , full_namespace_name=full_namespace_name )
- , self.last_include_index() + 1 )
-
- def adopt_declaration_creator( self, creator ):
- self.adopt_creator( creator, self.creators.index( self.body ) )
-
- def add_declaration_code( self, code, position ):
- self.adopt_declaration_creator( custom.custom_text_t( code ) )
Modified: pyplusplus_dev/pyplusplus/code_creators/module.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/module.py 2009-01-26 06:32:49 UTC (rev 1611)
+++ pyplusplus_dev/pyplusplus/code_creators/module.py 2009-01-26 06:34:05 UTC (rev 1612)
@@ -4,13 +4,21 @@
# http://www.boost.org/LICENSE_1_0.txt)
import os
+import custom
+import import_
import license
import include
import compound
+import namespace
import algorithm
+import module_body
+import library_reference
import declaration_based
+import include_directories
from pygccxml import utils
+
+
class module_t(compound.compound_t):
"""This class represents the source code for the entire extension module.
@@ -22,7 +30,7 @@
compound.compound_t.__init__(self)
self.__global_ns = global_ns
self._code_generator = code_generator_type
-
+
@property
def global_ns(self):
"reference to global_ns ( namespace_t ) declaration"
@@ -64,3 +72,170 @@
return set( decls )
+
+
+class bpmodule_t(module_t):
+ """This class represents the source code for the entire extension module.
+
+ The root of the code creator tree is always a module_t object.
+ """
+ def __init__(self, global_ns):
+ """Constructor.
+ """
+ module_t.__init__(self, global_ns, bpmodule_t.CODE_GENERATOR_TYPES.BOOST_PYTHON)
+ self.__body = None
+
+ def _get_include_dirs(self):
+ include_dirs = algorithm.creator_finder.find_by_class_instance(
+ what=include_directories.include_directories_t
+ , where=self.creators
+ , recursive=False)
+ if 0 == len( include_dirs ):
+ include_dirs = include_directories.include_directories_t()
+ if self.license:
+ self.adopt_creator( include_dirs, 1 )
+ else:
+ self.adopt_creator( include_dirs, 0 )
+ return include_dirs
+ elif 1 == len( include_dirs ):
+ return include_dirs[0]
+ else:
+ assert not "only single instance of include_directories_t should exist"
+
+ def _get_std_directories(self):
+ include_dirs = self._get_include_dirs()
+ return include_dirs.std
+ std_directories = property( _get_std_directories )
+
+ def _get_user_defined_directories(self):
+ include_dirs = self._get_include_dirs()
+ return include_dirs.user_defined
+ user_defined_directories = property( _get_user_defined_directories )
+
+ @property
+ def body(self):
+ """Return reference to L{module_body_t} code creator"""
+ if None is self.__body:
+ found = algorithm.creator_finder.find_by_class_instance( what=module_body.module_body_t
+ , where=self.creators
+ , recursive=False )
+ if found:
+ self.__body = found[0]
+ return self.__body
+
+ def last_include_index(self):
+ """Return the children index of the last L{include_t} object.
+
+ An exception is raised when there is no include_t object among
+ the children creators.
+
+ @returns: Children index
+ @rtype: int
+ """
+ for i in range( len(self.creators) - 1, -1, -1 ):
+ if isinstance( self.creators[i], include.include_t ):
+ return i
+ else:
+ return 0
+
+ def replace_included_headers( self, headers, leave_system_headers=True ):
+ to_be_removed = []
+ for creator in self.creators:
+ if isinstance( creator, include.include_t ):
+ to_be_removed.append( creator )
+ elif isinstance( creator, module_body.module_body_t ):
+ break
+
+ for creator in to_be_removed:
+ if creator.is_system:
+ if not leave_system_headers:
+ self.remove_creator( creator )
+ elif creator.is_user_defined:
+ pass
+ else:
+ self.remove_creator( creator )
+ map( lambda header: self.adopt_include( include.include_t( header=header ) )
+ , headers )
+
+ def adopt_include(self, include_creator):
+ """Insert an L{include_t} object.
+
+ The include creator is inserted right after the last include file.
+
+ @param include_creator: Include creator object
+ @type include_creator: L{include_t}
+ """
+ lii = self.last_include_index()
+ if lii == 0:
+ if not self.creators:
+ lii = -1
+ elif not isinstance( self.creators[0], include.include_t ):
+ lii = -1
+ else:
+ pass
+ self.adopt_creator( include_creator, lii + 1 )
+
+ def do_include_dirs_optimization(self):
+ include_dirs = self._get_include_dirs()
+ includes = filter( lambda creator: isinstance( creator, include.include_t )
+ , self.creators )
+ for include_creator in includes:
+ include_creator.include_dirs_optimization = include_dirs
+
+ def _create_impl(self):
+ self.do_include_dirs_optimization()
+ index = 0
+ code = []
+ for index in range( len( self.creators ) ):
+ if not isinstance( self.creators[index], include.include_t ):
+ break
+ else:
+ code.append( self.creators[index].create() )
+ if code:
+ code.append( 2* os.linesep )
+ code.append( self.create_internal_code( self.creators[index:], indent_code=False ))
+ code.append( os.linesep )
+ return os.linesep.join( code )
+
+ def add_include( self, header, user_defined=True, system=False ):
+ creator = include.include_t( header=header, user_defined=user_defined, system=system )
+ self.adopt_include( creator )
+
+ def add_namespace_usage( self, namespace_name ):
+ self.adopt_creator( namespace.namespace_using_t( namespace_name )
+ , self.last_include_index() + 1 )
+
+ def add_namespace_alias( self, alias, full_namespace_name ):
+ self.adopt_creator( namespace.namespace_alias_t(
+ alias=alias
+ , full_namespace_name=full_namespace_name )
+ , self.last_include_index() + 1 )
+
+ def adopt_declaration_creator( self, creator ):
+ self.adopt_creator( creator, self.creators.index( self.body ) )
+
+ def add_declaration_code( self, code, position ):
+ self.adopt_declaration_creator( custom.custom_text_t( code ) )
+
+
+
+class ctypes_module_t(module_t):
+ """This class represents the source code for the entire extension module.
+
+ The root of the code creator tree is always a module_t object.
+ """
+ def __init__(self, global_ns):
+ """Constructor.
+ """
+ module_t.__init__(self, global_ns, ctypes_module_t.CODE_GENERATOR_TYPES.CTYPES)
+
+ def _create_impl(self):
+ return self.create_internal_code( self.creators, indent_code=False )
+
+ @utils.cached
+ def library_var_name(self):
+ for creator in self.creators:
+ if isinstance( creator, library_reference.library_reference_t ):
+ return creator.library_var_name
+ else:
+ raise RuntimeError( "Internal Error: library_reference_t creator was not created" )
Deleted: pyplusplus_dev/pyplusplus/code_creators/modules.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/modules.py 2009-01-26 06:32:49 UTC (rev 1611)
+++ pyplusplus_dev/pyplusplus/code_creators/modules.py 2009-01-26 06:34:05 UTC (rev 1612)
@@ -1,4 +0,0 @@
-# Copyright 2004-2008 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-26 06:32:58
|
Revision: 1611
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1611&view=rev
Author: roman_yakovenko
Date: 2009-01-26 06:32:49 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
small refactoring to clear ctypes code creators
Added Paths:
-----------
pyplusplus_dev/pyplusplus/code_creators/modules.py
Copied: pyplusplus_dev/pyplusplus/code_creators/modules.py (from rev 1607, pyplusplus_dev/pyplusplus/code_creators/bpmodule.py)
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/modules.py (rev 0)
+++ pyplusplus_dev/pyplusplus/code_creators/modules.py 2009-01-26 06:32:49 UTC (rev 1611)
@@ -0,0 +1,4 @@
+# Copyright 2004-2008 Roman Yakovenko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-25 20:03:53
|
Revision: 1610
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1610&view=rev
Author: roman_yakovenko
Date: 2009-01-25 20:03:48 +0000 (Sun, 25 Jan 2009)
Log Message:
-----------
porting tester to linux
Modified Paths:
--------------
pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.cpp
pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.h
Modified: pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.cpp
===================================================================
--- pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.cpp 2009-01-25 09:15:15 UTC (rev 1609)
+++ pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.cpp 2009-01-25 20:03:48 UTC (rev 1610)
@@ -1 +1,4 @@
#include "circular_references.h"
+
+void use_bar( bar_t* ){
+}
Modified: pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.h
===================================================================
--- pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.h 2009-01-25 09:15:15 UTC (rev 1609)
+++ pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.h 2009-01-25 20:03:48 UTC (rev 1610)
@@ -15,3 +15,5 @@
int a, b;
struct foo_t foo;
};
+
+void EXPORT_SYMBOL use_bar( bar_t* );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-25 09:15:24
|
Revision: 1609
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1609&view=rev
Author: roman_yakovenko
Date: 2009-01-25 09:15:15 +0000 (Sun, 25 Jan 2009)
Log Message:
-----------
adding circular_references test case
Modified Paths:
--------------
pyplusplus_dev/unittests/ctypes_tester.py
pyplusplus_dev/unittests/sconstruct
Added Paths:
-----------
pyplusplus_dev/unittests/data/ctypes/circular_references/
pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.cpp
pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.h
pyplusplus_dev/unittests/data/ctypes/circular_references/sconscript
Modified: pyplusplus_dev/unittests/ctypes_tester.py
===================================================================
--- pyplusplus_dev/unittests/ctypes_tester.py 2009-01-25 06:34:33 UTC (rev 1608)
+++ pyplusplus_dev/unittests/ctypes_tester.py 2009-01-25 09:15:15 UTC (rev 1609)
@@ -216,13 +216,23 @@
mb.class_( 'value_t<int>' ).alias = 'int_value_t'
def test(self):
- v = self.module_ref.int_value_t()
- self.module_ref.init( v )
- self.failUnless( v.value == 2009 )
- self.failUnless( v.get_value() != 2009, "thiscall is not working yet" )
+ pass
+class circular_references_tester_t( ctypes_base_tester_t ):
+ def __init__( self, *args, **keywd ):
+ ctypes_base_tester_t.__init__( self, 'circular_references', *args, **keywd )
+ def customize( self, mb ):
+ pass
+ def test(self):
+ bar = self.module_ref.bar_t()
+ foo = self.module_ref.foo_t()
+
+ #TODO: add typedefs
+ #TODO: sort structs and classes by dependencies
+ pass #just test that module could be loaded
+
def create_suite():
suite = unittest.TestSuite()
#~ if 'win' in sys.platform:
@@ -235,6 +245,7 @@
suite.addTest( unittest.makeSuite(variables_tester_t))
suite.addTest( unittest.makeSuite(varargs_tester_t))
suite.addTest( unittest.makeSuite(templates_tester_t))
+ suite.addTest( unittest.makeSuite(circular_references_tester_t))
return suite
def run_suite():
Added: pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.cpp
===================================================================
--- pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.cpp (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.cpp 2009-01-25 09:15:15 UTC (rev 1609)
@@ -0,0 +1 @@
+#include "circular_references.h"
Added: pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.h
===================================================================
--- pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.h (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes/circular_references/circular_references.h 2009-01-25 09:15:15 UTC (rev 1609)
@@ -0,0 +1,17 @@
+#include "libconfig.h"
+
+struct foo_t;
+struct bar_t;
+
+typedef int (*foo_func_type)( struct foo_t* );
+typedef int (*bar_func_type)( struct bar_t* );
+
+struct EXPORT_SYMBOL foo_t{
+ foo_func_type* f_foo;
+ bar_func_type* f_bar;
+};
+
+struct EXPORT_SYMBOL bar_t{
+ int a, b;
+ struct foo_t foo;
+};
Added: pyplusplus_dev/unittests/data/ctypes/circular_references/sconscript
===================================================================
--- pyplusplus_dev/unittests/data/ctypes/circular_references/sconscript (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes/circular_references/sconscript 2009-01-25 09:15:15 UTC (rev 1609)
@@ -0,0 +1,7 @@
+Import('*')
+
+target_name = 'circular_references'
+shlib = env.SharedLibrary( target=target_name
+ , source=[ target_name + '.cpp' ]
+ , CPPPATH=['#data'] )
+env.Alias( target_name, shlib )
Modified: pyplusplus_dev/unittests/sconstruct
===================================================================
--- pyplusplus_dev/unittests/sconstruct 2009-01-25 06:34:33 UTC (rev 1608)
+++ pyplusplus_dev/unittests/sconstruct 2009-01-25 09:15:15 UTC (rev 1609)
@@ -33,7 +33,8 @@
, 'anonymous'
, 'variables'
, 'varargs'
- , 'templates' ]
+ , 'templates'
+ , 'circular_references' ]
for s in scripts:
SConscript( 'data/ctypes/%s/sconscript' % s
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2009-01-25 06:34:45
|
Revision: 1608
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1608&view=rev
Author: roman_yakovenko
Date: 2009-01-25 06:34:33 +0000 (Sun, 25 Jan 2009)
Log Message:
-----------
adding templates test case
Modified Paths:
--------------
pyplusplus_dev/unittests/ctypes_tester.py
pyplusplus_dev/unittests/sconstruct
Added Paths:
-----------
pyplusplus_dev/unittests/data/ctypes/templates/
pyplusplus_dev/unittests/data/ctypes/templates/sconscript
pyplusplus_dev/unittests/data/ctypes/templates/templates.cpp
pyplusplus_dev/unittests/data/ctypes/templates/templates.h
Modified: pyplusplus_dev/unittests/ctypes_tester.py
===================================================================
--- pyplusplus_dev/unittests/ctypes_tester.py 2009-01-21 20:07:41 UTC (rev 1607)
+++ pyplusplus_dev/unittests/ctypes_tester.py 2009-01-25 06:34:33 UTC (rev 1608)
@@ -61,7 +61,7 @@
binaries_dir = os.path.dirname( self.symbols_file )
if os.path.exists( binaries_dir ):
- print '\nrmdir ', binaries_dir
+ print '\nrmdir ', binaries_dir
shutil.rmtree( binaries_dir )
autoconfig.scons_config.compile( self.__build_scons_cmd(), cwd=autoconfig.this_module_dir_path )
@@ -208,6 +208,21 @@
def test(self):
self.failUnless( 21 == self.module_ref.sum_ints( 3, 5,7,9) )
+class templates_tester_t( ctypes_base_tester_t ):
+ def __init__( self, *args, **keywd ):
+ ctypes_base_tester_t.__init__( self, 'templates', *args, **keywd )
+
+ def customize( self, mb ):
+ mb.class_( 'value_t<int>' ).alias = 'int_value_t'
+
+ def test(self):
+ v = self.module_ref.int_value_t()
+ self.module_ref.init( v )
+ self.failUnless( v.value == 2009 )
+ self.failUnless( v.get_value() != 2009, "thiscall is not working yet" )
+
+
+
def create_suite():
suite = unittest.TestSuite()
#~ if 'win' in sys.platform:
@@ -219,6 +234,7 @@
suite.addTest( unittest.makeSuite(anonymous_tester_t))
suite.addTest( unittest.makeSuite(variables_tester_t))
suite.addTest( unittest.makeSuite(varargs_tester_t))
+ suite.addTest( unittest.makeSuite(templates_tester_t))
return suite
def run_suite():
Added: pyplusplus_dev/unittests/data/ctypes/templates/sconscript
===================================================================
--- pyplusplus_dev/unittests/data/ctypes/templates/sconscript (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes/templates/sconscript 2009-01-25 06:34:33 UTC (rev 1608)
@@ -0,0 +1,7 @@
+Import('*')
+
+target_name = 'templates'
+shlib = env.SharedLibrary( target=target_name
+ , source=[ target_name + '.cpp' ]
+ , CPPPATH=['#data'] )
+env.Alias( target_name, shlib )
Added: pyplusplus_dev/unittests/data/ctypes/templates/templates.cpp
===================================================================
--- pyplusplus_dev/unittests/data/ctypes/templates/templates.cpp (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes/templates/templates.cpp 2009-01-25 06:34:33 UTC (rev 1608)
@@ -0,0 +1,5 @@
+#include "templates.h"
+
+void EXPORT_SYMBOL init( value_t<int>& x){
+ x.value = 2009;
+}
Added: pyplusplus_dev/unittests/data/ctypes/templates/templates.h
===================================================================
--- pyplusplus_dev/unittests/data/ctypes/templates/templates.h (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes/templates/templates.h 2009-01-25 06:34:33 UTC (rev 1608)
@@ -0,0 +1,11 @@
+#include "libconfig.h"
+
+template< class ValueType >
+struct value_t{
+ ValueType get_value(){ return value;}
+ ValueType value;
+};
+
+void EXPORT_SYMBOL init( value_t<int>& );
+
+template class EXPORT_SYMBOL value_t<int>;
Modified: pyplusplus_dev/unittests/sconstruct
===================================================================
--- pyplusplus_dev/unittests/sconstruct 2009-01-21 20:07:41 UTC (rev 1607)
+++ pyplusplus_dev/unittests/sconstruct 2009-01-25 06:34:33 UTC (rev 1608)
@@ -32,7 +32,8 @@
, 'include_algorithm'
, 'anonymous'
, 'variables'
- , 'varargs']
+ , 'varargs'
+ , 'templates' ]
for s in scripts:
SConscript( 'data/ctypes/%s/sconscript' % s
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|