pygccxml-commit Mailing List for C++ Python language bindings (Page 35)
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...> - 2007-04-19 21:13:17
|
Revision: 1008
http://svn.sourceforge.net/pygccxml/?rev=1008&view=rev
Author: roman_yakovenko
Date: 2007-04-19 14:13:19 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
calculated only once some variables
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/linker.py
pygccxml_dev/pygccxml/parser/scanner.py
Modified: pygccxml_dev/pygccxml/parser/linker.py
===================================================================
--- pygccxml_dev/pygccxml/parser/linker.py 2007-04-19 16:28:15 UTC (rev 1007)
+++ pygccxml_dev/pygccxml/parser/linker.py 2007-04-19 21:13:19 UTC (rev 1008)
@@ -23,9 +23,9 @@
return self.__inst
def _set_inst(self, inst):
self.__inst = inst
- if isinstance( self.__inst, declaration_t ):
- if self.__inst.location is not None:
- self.__inst.location.file_name = self.__files[self.__inst.location.file_name]
+ #use inst, to reduce attribute access time
+ if isinstance( inst, declaration_t ) and inst.location:
+ inst.location.file_name = self.__files[inst.location.file_name]
instance = property( _get_inst, _set_inst )
def __link_type(self, type_id):
@@ -248,4 +248,4 @@
def visit_declarated( self ):
if isinstance( self.__inst.declaration, types.StringTypes ):
- self.__inst.declaration = self.__decls[self.__inst.declaration]
\ No newline at end of file
+ self.__inst.declaration = self.__decls[self.__inst.declaration]
Modified: pygccxml_dev/pygccxml/parser/scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/scanner.py 2007-04-19 16:28:15 UTC (rev 1007)
+++ pygccxml_dev/pygccxml/parser/scanner.py 2007-04-19 21:13:19 UTC (rev 1008)
@@ -182,23 +182,21 @@
if name in self.deep_declarations:
self.__inst = obj
self.__read_access( attrs )
+ element_id = attrs.get(XML_AN_ID, None)
if isinstance( obj, declaration_t ):
self.__update_membership( attrs )
- self.__declarations[ attrs[XML_AN_ID] ] = obj
+ self.__declarations[ element_id ] = obj
if not isinstance( obj, namespace_t ):
self.__read_location( obj, attrs )
- if isinstance( obj, scopedef_t):
- #deprecated
- #self.__read_members( obj, attrs )
- if isinstance( obj, class_t ):
- self.__read_bases( obj, attrs )
+ if isinstance( obj, class_t):
+ self.__read_bases( obj, attrs )
self.__read_artificial(obj, attrs)
self.__read_mangled( obj, attrs)
self.__read_demangled( obj, attrs)
elif isinstance( obj, type_t ):
- self.__types[ attrs[XML_AN_ID] ] = obj
+ self.__types[ element_id ] = obj
elif isinstance( obj, types.StringTypes ):
- self.__files[ attrs[XML_AN_ID] ] = obj
+ self.__files[ element_id ] = obj
else:
self.logger.warning( 'Unknown object type has been found.'
+ ' Please report this bug to pygccxml development team.' )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-19 16:28:14
|
Revision: 1007
http://svn.sourceforge.net/pygccxml/?rev=1007&view=rev
Author: roman_yakovenko
Date: 2007-04-19 09:28:15 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
bug fix
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py
pyplusplus_dev/pyplusplus/messages/warnings_.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-04-19 16:26:58 UTC (rev 1006)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-04-19 16:28:15 UTC (rev 1007)
@@ -115,7 +115,7 @@
mark these functions and provide and explanation to the user.
"""
self.overridable = False
- self._non_overridable_reason = reason
+ self._non_overridable_reason = messages.W0000 % reason
@property
def transformations(self):
Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py
===================================================================
--- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-04-19 16:26:58 UTC (rev 1006)
+++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-04-19 16:28:15 UTC (rev 1007)
@@ -22,7 +22,9 @@
def __mod__( self, values ):
str_value = super( message_type, self ).__str__()
return message_type( str_value % values, self.identifier )
-
+
+W0000 = '%s' #general message, usefull in few cases
+
W1000 = 'Py++, by default, does not expose internal compilers declarations. '\
'Names of those declarations usually start with "__".'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-19 16:26:56
|
Revision: 1006
http://svn.sourceforge.net/pygccxml/?rev=1006&view=rev
Author: roman_yakovenko
Date: 2007-04-19 09:26:58 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
testing performance on pretty big xml file ( 31Mb )
Modified Paths:
--------------
pygccxml_dev/unittests/test_performance.py
Added Paths:
-----------
pygccxml_dev/unittests/data/big.xml.bz2
Added: pygccxml_dev/unittests/data/big.xml.bz2
===================================================================
(Binary files differ)
Property changes on: pygccxml_dev/unittests/data/big.xml.bz2
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: pygccxml_dev/unittests/test_performance.py
===================================================================
--- pygccxml_dev/unittests/test_performance.py 2007-04-19 16:15:51 UTC (rev 1005)
+++ pygccxml_dev/unittests/test_performance.py 2007-04-19 16:26:58 UTC (rev 1006)
@@ -6,19 +6,22 @@
import os
import sys
import time
+import pstats
+import cProfile
import autoconfig
-
from pygccxml import *
+
+
dcache_file_name = os.path.join( autoconfig.data_directory, 'pygccxml.cache' )
if os.path.exists(dcache_file_name):
os.remove(dcache_file_name)
def test_on_windows_dot_h():
- windows_header = r"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\windows.h"
+ windows_header = r"D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\windows.h"
clock_prev = time.clock()
dcache = parser.file_cache_t(dcache_file_name)
- reader = parser.source_reader_t( parser.config_t(), dcache )
+ reader = parser.source_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path), dcache )
reader.read_file(windows_header)
dcache.flush()
clock_now = time.clock()
@@ -26,7 +29,7 @@
clock_prev = time.clock()
dcache = parser.file_cache_t(dcache_file_name)
- reader = parser.source_reader_t( parser.config_t(), dcache )
+ reader = parser.source_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path), dcache )
reader.read_file(windows_header)
clock_now = time.clock()
print 'with cache : %f seconds' % ( clock_now - clock_prev )
@@ -37,7 +40,7 @@
include_std_header = os.path.join( autoconfig.data_directory, 'include_std.hpp' )
clock_prev = time.clock()
dcache = parser.file_cache_t(dcache_file_name)
- reader = parser.source_reader_t( parser.config_t(), dcache )
+ reader = parser.source_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path), dcache )
reader.read_file(include_std_header)
dcache.flush()
clock_now = time.clock()
@@ -45,7 +48,7 @@
clock_prev = time.clock()
dcache = parser.file_cache_t(dcache_file_name)
- reader = parser.source_reader_t( parser.config_t(), dcache )
+ reader = parser.source_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path), dcache )
reader.read_file(include_std_header)
clock_now = time.clock()
print 'with cache : %f seconds' % ( clock_now - clock_prev )
@@ -57,7 +60,7 @@
include_std_header = os.path.join( autoconfig.data_directory, 'include_std.hpp' )
clock_prev = time.clock()
dcache = parser.file_cache_t(dcache_file_name)
- reader = parser.project_reader_t( parser.config_t(), dcache )
+ reader = parser.project_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path), dcache )
reader.read_files([include_std_header])
dcache.flush()
clock_now = time.clock()
@@ -65,29 +68,42 @@
clock_prev = time.clock()
dcache = parser.file_cache_t(dcache_file_name)
- reader = parser.project_reader_t( parser.config_t(), dcache )
+ reader = parser.project_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path), dcache )
reader.read_files([include_std_header])
clock_now = time.clock()
print 'with cache : %f seconds' % ( clock_now - clock_prev )
def profile_project():
include_std_header = os.path.join( autoconfig.data_directory, 'include_std.hpp' )
- reader = parser.project_reader_t( parser.config_t() )
+ reader = parser.project_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path) )
reader.read_files([include_std_header])
def profile_project2():
- include_std_header = r"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\windows.h"
- reader = parser.project_reader_t( parser.config_t() )
+ include_std_header = r"D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\windows.h"
+ reader = parser.project_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path) )
reader.read_files([include_std_header])
+def parse_big_file():
+ reader = parser.project_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path) )
+
+ reader.read_files([parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'big.xml' ) )])
+
+
if __name__ == "__main__":
- test_on_windows_dot_h()
- test_source_on_include_std_dot_hpp()
- test_project_on_include_std_dot_hpp()
- #~ import profile
- #~ profile.run('profile_project()', 'pygccxml.profile')
- #~ import pstats
- #~ pdata = pstats.Stats('pygccxml.profile')
- #~ pdata.strip_dirs()
- #~ pdata.sort_stats('cumulative', 'time').print_stats(15)
- #~ pdata.print_callers('find_all_declarations')
\ No newline at end of file
+
+ #~ test_on_windows_dot_h()
+ #~ test_source_on_include_std_dot_hpp()
+ #~ test_project_on_include_std_dot_hpp()
+ print 'running'
+ cProfile.run('parse_big_file()', 'pygccxml.profile')
+ print 'running - done'
+ print 'loading file'
+ pdata = pstats.Stats('pygccxml.profile')
+ print 'loading file - done'
+ print 'striping dirs'
+ pdata.strip_dirs()
+ print 'striping dirs - done'
+ print 'sorting stats'
+ pdata.sort_stats('cumulative', 'time').print_stats(476)
+ print 'sorting stats - done'
+ #pdata.print_callers('find_all_declarations')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-19 16:15:52
|
Revision: 1005
http://svn.sourceforge.net/pygccxml/?rev=1005&view=rev
Author: roman_yakovenko
Date: 2007-04-19 09:15:51 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
removing useless code
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/patcher.py
Modified: pygccxml_dev/pygccxml/parser/patcher.py
===================================================================
--- pygccxml_dev/pygccxml/parser/patcher.py 2007-04-19 11:23:51 UTC (rev 1004)
+++ pygccxml_dev/pygccxml/parser/patcher.py 2007-04-19 16:15:51 UTC (rev 1005)
@@ -25,7 +25,7 @@
def patch_it(self):
for decl in declarations.make_flatten( self.decls ):
if not isinstance( decl, declarations.calldef_t ):
- continue
+ continue
for arg in decl.arguments:
if not arg.default_value:
continue
@@ -67,7 +67,13 @@
def __is_invalid_integral(self, func, arg):
type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) )
- return declarations.is_integral( type_ )
+ if not declarations.is_integral( type_ ):
+ return False
+ try:
+ int( arg.default_value )
+ return False
+ except:
+ return True
def __fix_invalid_integral(self, func, arg):
try:
@@ -113,14 +119,9 @@
enums = filter( lambda decl: isinstance( decl, declarations.enumeration_t )
, scope.declarations )
for enum_decl in enums:
- valnames = map(lambda x: x[0], enum_decl.values)
- valnums = map(lambda x: x[1], enum_decl.values)
- if default_value in valnames:
+ if enum_decl.has_value_name( default_value ):
return enum_decl
- if default_value in valnums:
- return enum_decl
- else:
- return None
+ return None
def __is_double_call( self, func, arg ):
call_invocation = declarations.call_invocation
@@ -197,4 +198,4 @@
patcher2 = fix_casting_operator_name_patcher_t( decls )
patcher2.patch_it()
return patcher.decls
-
\ No newline at end of file
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-19 11:23:52
|
Revision: 1004
http://svn.sourceforge.net/pygccxml/?rev=1004&view=rev
Author: roman_yakovenko
Date: 2007-04-19 04:23:51 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
even faster implementation of xml parser
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/etree_scanner.py
Modified: pygccxml_dev/pygccxml/parser/etree_scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/etree_scanner.py 2007-04-19 09:44:45 UTC (rev 1003)
+++ pygccxml_dev/pygccxml/parser/etree_scanner.py 2007-04-19 11:23:51 UTC (rev 1004)
@@ -19,22 +19,37 @@
def __recursive_saxify(self, element ):
self.__handler.startElement( element.tag, element.attrib )
- if element.text:
- self.__handler.characters(element.text)
+ #~ if element.text:
+ #~ self.__handler.characters(element.text)
map( self.__recursive_saxify, element )
self.__handler.endElement( element.tag )
- if element.tail:
- self.__handler.characters(element.tail)
+ #~ if element.tail:
+ #~ self.__handler.characters(element.tail)
class etree_scanner_t( scanner.scanner_t ):
def __init__(self, gccxml_file, decl_factory, *args ):
scanner.scanner_t.__init__( self, gccxml_file, decl_factory, *args )
- def read( self ):
+ def read( self ):
tree = ElementTree.parse( self.gccxml_file )
saxifier = etree_saxifier_t( tree, self )
- saxifier.saxify()
+ saxifier.saxify()
+
+class ietree_scanner_t( scanner.scanner_t ):
+ def __init__(self, gccxml_file, decl_factory, *args ):
+ scanner.scanner_t.__init__( self, gccxml_file, decl_factory, *args )
+ def read( self ):
+ context = ElementTree.iterparse(self.gccxml_file, events=("start", "end"))
+ for event, elem in context:
+ if event == 'start':
+ self.startElement( elem.tag, elem.attrib )
+ else:
+ self.endElement( elem.tag )
+ elem.clear()
+ self.endDocument()
+
+etree_scanner_t = ietree_scanner_t
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-19 09:44:44
|
Revision: 1003
http://svn.sourceforge.net/pygccxml/?rev=1003&view=rev
Author: roman_yakovenko
Date: 2007-04-19 02:44:45 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
small improvements to the code
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/etree_scanner.py
Modified: pygccxml_dev/pygccxml/parser/etree_scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/etree_scanner.py 2007-04-19 08:51:24 UTC (rev 1002)
+++ pygccxml_dev/pygccxml/parser/etree_scanner.py 2007-04-19 09:44:45 UTC (rev 1003)
@@ -7,36 +7,27 @@
import xml.etree.cElementTree as ElementTree
class etree_saxifier_t(object):
- """Produces SAX events for an element and children."""
- def __init__(self, element_or_tree, content_handler):
- try:
- element = element_or_tree.getroot()
- except AttributeError:
- element = element_or_tree
- self._element = element
- self._content_handler = content_handler
+ def __init__(self, etree, handler):
+ self.__root_elem = etree.getroot()
+ self.__handler = handler
def saxify(self):
- self._content_handler.startDocument()
- self._recursive_saxify(self._element, {})
- self._content_handler.endDocument()
+ self.__handler.startDocument()
+ self.__recursive_saxify( self.__root_elem )
+ self.__handler.endDocument()
- def _recursive_saxify(self, element, prefixes):
- attrs = {}
- for attr in element.items():
- attrs[ attr[0] ] = attr[1]
-
- content_handler = self._content_handler
- content_handler.startElement( element.tag, attrs )
+ def __recursive_saxify(self, element ):
+ self.__handler.startElement( element.tag, element.attrib )
if element.text:
- content_handler.characters(element.text)
- for child in element:
- self._recursive_saxify(child, prefixes)
- content_handler.endElement( element.tag )
+ self.__handler.characters(element.text)
+
+ map( self.__recursive_saxify, element )
+
+ self.__handler.endElement( element.tag )
if element.tail:
- content_handler.characters(element.tail)
+ self.__handler.characters(element.tail)
class etree_scanner_t( scanner.scanner_t ):
def __init__(self, gccxml_file, decl_factory, *args ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-19 08:51:23
|
Revision: 1002
http://svn.sourceforge.net/pygccxml/?rev=1002&view=rev
Author: roman_yakovenko
Date: 2007-04-19 01:51:24 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
adding cElementTree parser - for big xml file the gain in speed could be more than 5%
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/scanner.py
pygccxml_dev/pygccxml/parser/source_reader.py
Added Paths:
-----------
pygccxml_dev/pygccxml/parser/etree_scanner.py
Added: pygccxml_dev/pygccxml/parser/etree_scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/etree_scanner.py (rev 0)
+++ pygccxml_dev/pygccxml/parser/etree_scanner.py 2007-04-19 08:51:24 UTC (rev 1002)
@@ -0,0 +1,49 @@
+# Copyright 2004 Roman Yakovenko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+import scanner
+import xml.etree.cElementTree as ElementTree
+
+class etree_saxifier_t(object):
+ """Produces SAX events for an element and children."""
+ def __init__(self, element_or_tree, content_handler):
+ try:
+ element = element_or_tree.getroot()
+ except AttributeError:
+ element = element_or_tree
+ self._element = element
+ self._content_handler = content_handler
+
+ def saxify(self):
+ self._content_handler.startDocument()
+ self._recursive_saxify(self._element, {})
+ self._content_handler.endDocument()
+
+ def _recursive_saxify(self, element, prefixes):
+ attrs = {}
+ for attr in element.items():
+ attrs[ attr[0] ] = attr[1]
+
+ content_handler = self._content_handler
+ content_handler.startElement( element.tag, attrs )
+
+ if element.text:
+ content_handler.characters(element.text)
+ for child in element:
+ self._recursive_saxify(child, prefixes)
+ content_handler.endElement( element.tag )
+
+ if element.tail:
+ content_handler.characters(element.tail)
+
+class etree_scanner_t( scanner.scanner_t ):
+ def __init__(self, gccxml_file, decl_factory, *args ):
+ scanner.scanner_t.__init__( self, gccxml_file, decl_factory, *args )
+
+ def read( self ):
+ tree = ElementTree.parse( self.gccxml_file )
+ saxifier = etree_saxifier_t( tree, self )
+ saxifier.saxify()
+
Modified: pygccxml_dev/pygccxml/parser/scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/scanner.py 2007-04-19 07:19:18 UTC (rev 1001)
+++ pygccxml_dev/pygccxml/parser/scanner.py 2007-04-19 08:51:24 UTC (rev 1002)
@@ -165,6 +165,12 @@
def members(self):
return self.__members
+ def startElementNS(self, name, qname, attrs):
+ return self.startElement( name[1], attrs )
+
+ def endElementNS(self, name, qname):
+ return self.endElement( name[1] )
+
def startElement(self, name, attrs):
try:
if name not in self.__readers:
Modified: pygccxml_dev/pygccxml/parser/source_reader.py
===================================================================
--- pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-19 07:19:18 UTC (rev 1001)
+++ pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-19 08:51:24 UTC (rev 1002)
@@ -8,7 +8,12 @@
import config
import pygccxml.utils
import linker
-import scanner
+
+try: #select faster xml parser
+ from etree_scanner import etree_scanner_t as scanner_t
+except:
+ from scanner import scanner_t
+
import declarations_cache
import patcher
from pygccxml.declarations import *
@@ -308,7 +313,7 @@
return file_path
def __parse_gccxml_created_file( self, gccxml_file ):
- scanner_ = scanner.scanner_t( gccxml_file, self.__decl_factory )
+ scanner_ = scanner_t( gccxml_file, self.__decl_factory )
scanner_.read()
decls = scanner_.declarations()
types = scanner_.types()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-19 07:19:17
|
Revision: 1001
http://svn.sourceforge.net/pygccxml/?rev=1001&view=rev
Author: roman_yakovenko
Date: 2007-04-19 00:19:18 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
small improvement
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/scanner.py
Modified: pygccxml_dev/pygccxml/parser/scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/scanner.py 2007-04-19 06:52:25 UTC (rev 1000)
+++ pygccxml_dev/pygccxml/parser/scanner.py 2007-04-19 07:19:18 UTC (rev 1001)
@@ -139,6 +139,8 @@
def read( self ):
xml.sax.parse( self.gccxml_file, self )
+
+ def endDocument( self ):
#updating membership
members_mapping = {}
for gccxml_id, members in self.__members.iteritems():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-19 06:52:35
|
Revision: 1000
http://svn.sourceforge.net/pygccxml/?rev=1000&view=rev
Author: roman_yakovenko
Date: 2007-04-18 23:52:25 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
small optimization to message treatment
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
pyplusplus_dev/pyplusplus/messages/__init__.py
pyplusplus_dev/pyplusplus/messages/warnings_.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-04-18 18:51:07 UTC (rev 999)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-04-19 06:52:25 UTC (rev 1000)
@@ -3,8 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-"""defines base class for all classes, that will keep Py++ code generator engine
-instructions."""
+"""defines base class for all code generator configuration classes"""
import algorithm
from pyplusplus import _logging_
@@ -12,15 +11,12 @@
from pyplusplus import messages
class decl_wrapper_t(object):
- SPECIAL_TYPEDEF_PICK_ANY = True
- """Declaration interface.
+ """code generator declaration configuration base class
- This class represents the interface to the declaration tree. Its
- main purpose is to "decorate" the nodes in the tree with
- information about how the binding is to be created. Instances of
- this class are never created by the user, instead they are
- returned by the API.
+ This class contains configuration that could be applied to all declarations.
"""
+
+ SPECIAL_TYPEDEF_PICK_ANY = True
def __init__(self):
object.__init__(self)
@@ -35,7 +31,7 @@
@property
def logger( self ):
- """returns reference to L{_logging_.loggers.declarations}"""
+ """reference to L{_logging_.loggers.declarations}"""
return _logging_.loggers.declarations
def _get_documentation( self ):
@@ -43,7 +39,7 @@
def _set_documentation( self, value ):
self._documentation = value
documentation = property( _get_documentation, _set_documentation
- , doc="Using this property you can set documentation of the declaration." )
+ , doc="exposed declaration Python documentation string" )
def _generate_valid_name(self, name=None):
if name == None:
@@ -89,10 +85,10 @@
def _set_alias(self, alias):
self._alias = alias
alias = property( _get_alias, _set_alias
- , doc="Using this property you can easily change Python name of declaration" )
+ , doc="the name under which, Python will know the declaration" )
def rename( self, new_name ):
- """renames the declaration name, under which it is exposed"""
+ """give new name to the declaration, under which Python will know the declaration"""
self.alias = new_name
def _get_ignore( self ):
@@ -100,28 +96,32 @@
def _set_ignore( self, value ):
self._ignore = value
ignore = property( _get_ignore, _set_ignore
- ,doc="If you set ignore to True then this declaration will not be exported." )
+ , doc="boolean flag, which says whether to export declaration to Python or not" )
def _get_already_exposed_impl( self ):
return self._already_exposed
-
+
def _get_already_exposed( self ):
return self._get_already_exposed_impl()
def _set_already_exposed( self, value ):
self._already_exposed = value
- already_exposed = property( _get_already_exposed, _set_already_exposed )
+ already_exposed = property( _get_already_exposed, _set_already_exposed
+ , doc="boolean flag, which says whether the declaration is already exposed or not" )
def exclude( self ):
- """Exclude "self" and child declarations from being exposed."""
+ """exclude "self" and child declarations from being exposed."""
self.ignore = True
def include( self, already_exposed=False ):
- """Include "self" and child declarations to be exposed."""
+ """include "self" and child declarations to be exposed."""
self.ignore = False
self.already_exposed = already_exposed
def why_not_exportable( self ):
- """returns strings that explains why this declaration could not be exported or None otherwise"""
+ """return the reason( string ) that explains why this declaration could not be exported
+
+ If declaration could be exported, than method will return None
+ """
if None is self._exportable_reason:
self.get_exportable()
return self._exportable_reason
@@ -130,6 +130,7 @@
return ''
def get_exportable( self ):
+ """return True if declaration could be exposed to Python, False otherwise"""
if self._exportable is None:
if self.name.startswith( '__' ) or '.' in self.name:
self._exportable_reason = messages.W1000
@@ -143,6 +144,10 @@
self._exportable = not bool( self._exportable_reason )
return self._exportable
def set_exportable( self, exportable ):
+ """change "exportable" status
+
+ This function should be use in case Py++ made a mistake and signed the
+ declaration as unexportable."""
self._exportable = exportable
exportable = property( get_exportable, set_exportable
@@ -152,13 +157,11 @@
return []
def readme( self, skip_ignored=True ):
- """This function will returns some hints/tips/description of problems
- that applied to the declarations. For example function that has argument
- reference to some fundamental type could be exported, but could not be called
- from Python
-
- @param skip_ignored: if True, messages that user asked to not reported
- will not be returned
+ """return important information( hints/tips/warning message ) Py++ has about
+ this declaration.
+
+ skip_ignored argument allows you to control the information reported to you.
+ For more information please read: http://www.language-binding.net/pyplusplus/documentation/warnings.html
"""
msgs = []
if not self.exportable:
@@ -179,12 +182,13 @@
@property
def disabled_messaged( self ):
+ """list of messages to ignore"""
return self.__msgs_to_ignore
def disable_messages( self, *args ):
- """Using this method you can tell to Py++ to not report some specifiec warnings.
+ """set messages, which should not be reported to you
- Usage example: decl.ignore_warnings( messages.W1001, messages.W1040 )
+ Usage example: decl.disable_messages( messages.W1001, messages.W1040 )
"""
for msg in args:
msg_id = messages.find_out_message_id( msg )
Modified: pyplusplus_dev/pyplusplus/messages/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/messages/__init__.py 2007-04-18 18:51:07 UTC (rev 999)
+++ pyplusplus_dev/pyplusplus/messages/__init__.py 2007-04-19 06:52:25 UTC (rev 1000)
@@ -8,16 +8,19 @@
"""
from warnings_ import *
-import re
-__RE_GET_WARNING_ID = re.compile( r'warning\s(?P<id>W(\d){4})' )
+#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 ):
- match_obj = __RE_GET_WARNING_ID.search(msg)
- if not match_obj:
- return None
- else:
- return match_obj.group( 'id' )
+ return msg.identifier
-
DISABLE_MESSAGES = [
W1000, W1001, W1002, W1011, W1012, W1013, W1015, W1019, W1030, W1034, W1039
]
Modified: pyplusplus_dev/pyplusplus/messages/warnings_.py
===================================================================
--- pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-04-18 18:51:07 UTC (rev 999)
+++ pyplusplus_dev/pyplusplus/messages/warnings_.py 2007-04-19 06:52:25 UTC (rev 1000)
@@ -7,6 +7,22 @@
reported to user.
"""
+class message_type(str):
+ """implementation details"""
+ def __new__(self, value, identifier):
+ return str.__new__(self, value )
+
+ def __init__(self, value, identifier ):
+ self.__identifier = identifier
+
+ @property
+ def identifier( self ):
+ return self.__identifier
+
+ def __mod__( self, values ):
+ str_value = super( message_type, self ).__str__()
+ return message_type( str_value % values, self.identifier )
+
W1000 = 'Py++, by default, does not expose internal compilers declarations. '\
'Names of those declarations usually start with "__".'
@@ -153,7 +169,6 @@
'Be sure to take a look on Py++ defined call policies: ' \
'http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies'
-
W1051 = 'The function takes as argument (name=%s, pos=%d) "%s" type. ' \
'You have to specify a call policies or to use "Function Transformation" ' \
'functionality.'
@@ -170,13 +185,20 @@
int( identifier[1:] )
except:
continue
-
- globals()[ identifier ] = 'warning %s: %s' % ( identifier, explanation )
+ msg = '%s %s: %s' % ( 'warning', identifier, explanation)
+ globals()[ identifier ] = message_type( msg, identifier )
del warnings
del identifier
del explanation
+if __name__ == '__main__':
+ x = W1051 % ( 'xxxxxxxx', 122, 'yyyyyyyyyy' )
+ print x, x.__class__.__name__
+ print '\n\n\n'
+ y = W1000
+ print y
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-18 18:51:07
|
Revision: 999
http://svn.sourceforge.net/pygccxml/?rev=999&view=rev
Author: roman_yakovenko
Date: 2007-04-18 11:51:07 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
adding documentation about "include" functionality
Modified Paths:
--------------
pyplusplus_dev/docs/documentation/index.rest
pyplusplus_dev/docs/documentation/inserting_code.rest
Modified: pyplusplus_dev/docs/documentation/index.rest
===================================================================
--- pyplusplus_dev/docs/documentation/index.rest 2007-04-18 06:22:31 UTC (rev 998)
+++ pyplusplus_dev/docs/documentation/index.rest 2007-04-18 18:51:07 UTC (rev 999)
@@ -30,7 +30,7 @@
Overview
--------
-* `API docs`_ - contains API documentation, including source code, generated by `epydoc`_
+* `API docs`_ - contains API documentation, including source code, generated by `epydoc`_
.. _`API docs` : ./apidocs/index.html
.. _`epydoc` : http://epydoc.sourceforge.net/
@@ -43,26 +43,26 @@
.. _`architecture` : ./architecture.html
-* `best practices`_ - `Py++`_ is huge, this document will explain you how to
+* `best practices`_ - `Py++`_ is huge, this document will explain you how to
effectively use it
.. _`best practices`: ./best_practices.html
-* `documentation string`_ - explains how to automaticly extract a documentation
+* `documentation string`_ - explains how to automaticly extract a documentation
from the source files and put it as Python documentation string
.. _`documentation string` : ./doc_string.html
-* `feedback`_ - `Py++`_ could be used as some kind of validator. It checks the
- exposed declarations and reports the potential errors. Thus you are able to
- create high quality Python bindings from the beginning. This document also
+* `warnings`_ - `Py++`_ could be used as some kind of validator. It checks the
+ exposed declarations and reports the potential errors. Thus you are able to
+ create high quality Python bindings from the beginning. This document also
describes how to supress the errors\\warnings.
-.. _`feedback` : ./feedback.html
+.. _`warnings` : ./warnings.html
* `functions & operators`_ - contains a complete guide to exposing functions and
operators, including "call policies" and description of different caveats
-
+
.. _`functions & operators` : ../functions/functions.html
* `hints`_ - describes few techinques, which will help you with exposing template
@@ -70,28 +70,28 @@
.. _`hints`: ./hints.html
-* `how to ... ?`_ - contains answers for different frequently asked questions
+* `how to ... ?`_ - contains answers for different frequently asked questions
.. _`how to ... ?` : ./how_to.html
* `inserting code`_ - a complete guide for insert your code into the generated one
-.. _`inserting code` : ./inserting_code.html
+.. _`inserting code` : ./inserting_code.html
-* `multi-module development`_ - describes how expose hierarchy of classes, which
+* `multi-module development`_ - describes how expose hierarchy of classes, which
is spread few different libraries
.. _`multi-module development`: ./multi_module_development.html
-* `properties`_ - describes how to create class properties using `Py++`_ and
+* `properties`_ - describes how to create class properties using `Py++`_ and
built-in algorithm for automatic properties recognition
.. _`properties`: ./properties.html
* `tutorials`_ - don't know where to start? Start here. Small and simple example
- will help you to start with `Py++`_. If you want to evaluate `Py++`_ you will
+ will help you to start with `Py++`_. If you want to evaluate `Py++`_ you will
find here small and handy GUI program.
-
+
.. _`tutorials` : ./tutorials/tutorials.html
.. _`Epydoc` : http://epydoc.sourceforge.net/
Modified: pyplusplus_dev/docs/documentation/inserting_code.rest
===================================================================
--- pyplusplus_dev/docs/documentation/inserting_code.rest 2007-04-18 06:22:31 UTC (rev 998)
+++ pyplusplus_dev/docs/documentation/inserting_code.rest 2007-04-18 18:51:07 UTC (rev 999)
@@ -194,8 +194,48 @@
for cls in mb.classes( relevant classes only ):
inject_code( cls )
+------------
+Header files
+------------
+Now, when you know how to add your code to a generated one, I think you also should
+now how to add your own set of include directives to the generated files. There
+are few ways to do this.
+1. The easiest and the most effective one - tell to `Py++`_ that generated code
+ for the declaration should include additional files:
+
+ .. code-block:: Python
+
+ mb = module_builder_t( ... )
+ my_class = mb.class_( ... )
+ my_class.include_files.append( "vector" )
+
+ Every declaration has ``include_files`` property. This is a list of header files,
+ you want to include from the generated file(s).
+
+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
+
+ mb = module_builder_t( ... )
+ ...
+ mb.build_code_creator( ... )
+ mb.code_creator.add_include( "iostream" )
+
+ You can also replace all (to be) generated header files with your own set:
+
+ .. code-block:: Python
+
+ mb.code_creator.replace_included_headers( ["stdafx.h"] )
+
+Of course you can, and may be should, use both approaches.
+
+I suggest you to spend some time and to tweak `Py++`_ to generate source code
+with as little as possible include directives. This will save you huge amount of
+time later.
+
.. _`Py++` : ./../pyplusplus.html
.. _`pygccxml` : ./../../pygccxml/pygccxml.html
.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-18 06:22:36
|
Revision: 998
http://svn.sourceforge.net/pygccxml/?rev=998&view=rev
Author: roman_yakovenko
Date: 2007-04-17 23:22:31 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
adding handling user defined header files to "multiple files writer"
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
pyplusplus_dev/pyplusplus/file_writers/single_file.py
pyplusplus_dev/pyplusplus/file_writers/writer.py
Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-04-17 21:07:13 UTC (rev 997)
+++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-04-18 06:22:31 UTC (rev 998)
@@ -164,7 +164,10 @@
answer.append( include_cc.create() )
else:# user header file - always include
answer.append( include_cc.create() )
-
+
+ map( lambda user_header: answer.append( '#include "%s"' % user_header )
+ , self.get_user_headers( creators ) )
+
for creator in creators:
header = self.find_out_value_traits_header( creator )
if header:
Modified: pyplusplus_dev/pyplusplus/file_writers/single_file.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/single_file.py 2007-04-17 21:07:13 UTC (rev 997)
+++ pyplusplus_dev/pyplusplus/file_writers/single_file.py 2007-04-18 06:22:31 UTC (rev 998)
@@ -7,7 +7,6 @@
import os
import writer
-from pyplusplus import code_creators
class single_file_t(writer.writer_t):
"""generates all code into single cpp file"""
@@ -21,14 +20,9 @@
file_name = property( _get_file_name )
def write(self):
- user_headers = []
- creators = filter( lambda creator: isinstance( creator, code_creators.declaration_based_t )
- , code_creators.make_flatten( self.extmodule ) )
- map( lambda creator: user_headers.extend( creator.get_user_headers() )
- , creators )
- user_headers = code_creators.code_creator_t.unique_headers( user_headers )
+ headers = self.get_user_headers( [self.extmodule] )
map( lambda header: self.extmodule.add_include( header )
- , user_headers )
+ , headers )
self.write_code_repository( os.path.split( self.file_name )[0] )
self.write_file( self.file_name, self.extmodule.create() )
-
\ No newline at end of file
+
Modified: pyplusplus_dev/pyplusplus/file_writers/writer.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-04-17 21:07:13 UTC (rev 997)
+++ pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-04-18 06:22:31 UTC (rev 998)
@@ -8,6 +8,7 @@
import os
import time
from pyplusplus import _logging_
+from pyplusplus import code_creators
from pyplusplus import code_repository
class writer_t(object):
@@ -98,4 +99,11 @@
f.write( fcontent_new )
f.close()
writer_t.logger.info( 'file "%s" - updated( %f seconds )' % ( fname, time.clock() - start_time ) )
-
+
+ def get_user_headers( self, creators ):
+ headers = []
+ creators = filter( lambda creator: isinstance( creator, code_creators.declaration_based_t )
+ , creators )
+ map( lambda creator: headers.extend( creator.get_user_headers() )
+ , creators )
+ return code_creators.code_creator_t.unique_headers( headers )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-17 21:07:12
|
Revision: 997
http://svn.sourceforge.net/pygccxml/?rev=997&view=rev
Author: roman_yakovenko
Date: 2007-04-17 14:07:13 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
adding user defined header files to generated code
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/compound.py
pyplusplus_dev/pyplusplus/code_creators/declaration_based.py
pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
pyplusplus_dev/pyplusplus/file_writers/single_file.py
Modified: pyplusplus_dev/pyplusplus/code_creators/compound.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/compound.py 2007-04-17 12:40:13 UTC (rev 996)
+++ pyplusplus_dev/pyplusplus/code_creators/compound.py 2007-04-17 21:07:13 UTC (rev 997)
@@ -86,3 +86,4 @@
if unique:
files = self.unique_headers( files )
return files
+
\ No newline at end of file
Modified: pyplusplus_dev/pyplusplus/code_creators/declaration_based.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/declaration_based.py 2007-04-17 12:40:13 UTC (rev 996)
+++ pyplusplus_dev/pyplusplus/code_creators/declaration_based.py 2007-04-17 21:07:13 UTC (rev 997)
@@ -50,4 +50,7 @@
if None is self.declaration.documentation:
return ''
return self.declaration.documentation
-
\ No newline at end of file
+
+ def get_user_headers( self, recursive=False, unique=False ):
+ """return list of user header files to be included from the generated file"""
+ return self.declaration.include_files
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-04-17 12:40:13 UTC (rev 996)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-04-17 21:07:13 UTC (rev 997)
@@ -31,6 +31,7 @@
self._exportable_reason = None
self._documentation = None
self.__msgs_to_ignore = set()
+ self._include_files = []
@property
def logger( self ):
@@ -150,7 +151,6 @@
def _readme_impl( self ):
return []
-
def readme( self, skip_ignored=True ):
"""This function will returns some hints/tips/description of problems
that applied to the declarations. For example function that has argument
@@ -192,3 +192,8 @@
raise RuntimeError( "Unable to find out message id. The message is: " + msg )
self.__msgs_to_ignore.add( msg )
disable_warnings = disable_messages
+
+ @property
+ def include_files( self ):
+ """list of header files, to be included from the file, the generated code will be placed-in"""
+ return self._include_files
\ No newline at end of file
Modified: pyplusplus_dev/pyplusplus/file_writers/single_file.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/single_file.py 2007-04-17 12:40:13 UTC (rev 996)
+++ pyplusplus_dev/pyplusplus/file_writers/single_file.py 2007-04-17 21:07:13 UTC (rev 997)
@@ -7,11 +7,10 @@
import os
import writer
+from pyplusplus import code_creators
class single_file_t(writer.writer_t):
- """
- This class writes all code into single file.
- """
+ """generates all code into single cpp file"""
def __init__(self, extmodule, file_name):
writer.writer_t.__init__(self, extmodule)
@@ -21,6 +20,15 @@
return self.__fname
file_name = property( _get_file_name )
- def write(self):
+ def write(self):
+ user_headers = []
+ creators = filter( lambda creator: isinstance( creator, code_creators.declaration_based_t )
+ , code_creators.make_flatten( self.extmodule ) )
+ map( lambda creator: user_headers.extend( creator.get_user_headers() )
+ , creators )
+ user_headers = code_creators.code_creator_t.unique_headers( user_headers )
+ map( lambda header: self.extmodule.add_include( header )
+ , user_headers )
self.write_code_repository( os.path.split( self.file_name )[0] )
- self.write_file( self.file_name, self.extmodule.create() )
\ No newline at end of file
+ self.write_file( self.file_name, self.extmodule.create() )
+
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-17 12:40:19
|
Revision: 996
http://svn.sourceforge.net/pygccxml/?rev=996&view=rev
Author: roman_yakovenko
Date: 2007-04-17 05:40:13 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
small docs improvements
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py
pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py
pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py 2007-04-17 07:28:51 UTC (rev 995)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py 2007-04-17 12:40:13 UTC (rev 996)
@@ -3,34 +3,11 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-"""Declaration decorators.
+"""Code generator configuration classes
-This sub-package contains the Py++ specific declaration objects
-that are the nodes of the declaration tree. In addition to the
-interface of the declarations in the pygccxml package the objects in
-this package also provide a I{decoration} interface. This interface
-allows customizing the bindings and influences the code creators that
-have to be generated in subsequent steps.
-
-Each node is derived from its corresponding node in the pygccxml
-package and from a decorator base class.
-
-You may encounter the following objects in a declaration tree:
-
- - L{namespace_t}
- - L{typedef_t}
- - L{variable_t}
- - L{enumeration_t}
- - L{casting_operator_t}
- - L{free_function_t}
- - L{free_operator_t}
- - L{class_declaration_t}
- - L{class_t}
- - L{constructor_t}
- - L{destructor_t}
- - L{member_function_t}
- - L{member_operator_t}
-
+L{pygccxml.declarations} package contains classes, which describe C++ declarations.
+This package contains classes that derive from the L{pygccxml.declarations} classes.
+The classes in this package allow you to configure the code generator.
"""
import algorithm
@@ -110,9 +87,7 @@
import python_traits
class dwfactory_t( declarations.decl_factory_t ):
- """
- declarations factory class
- """
+ """declarations factory class"""
def __init__(self):
declarations.decl_factory_t.__init__(self)
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py 2007-04-17 07:28:51 UTC (rev 995)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py 2007-04-17 12:40:13 UTC (rev 996)
@@ -9,6 +9,7 @@
import python_traits
from pygccxml import declarations
+#keeps file name, where Py++ defined call policies will be defined
PYPP_CALL_POLICIES_HEADER_FILE = "__call_policies.pypp.hpp"
class CREATION_POLICY:
@@ -17,7 +18,7 @@
AS_TEMPLATE_ARGUMENT = 'as template argument'
class call_policy_t(object):
- """Base class for all call polices classes"""
+ """base class for all classes, which generate "call policies" code"""
def __init__(self):
object.__init__(self)
@@ -36,18 +37,19 @@
return code
def create_type(self):
+ """return call policies class declaration as string"""
return self.create( None, CREATION_POLICY.AS_TEMPLATE_ARGUMENT )
def create_template_arg( self, function_creator ):
+ """return call policies class declaration as string"""
return self.create( function_creator, CREATION_POLICY.AS_TEMPLATE_ARGUMENT )
def is_default( self ):
- """Returns True is self is instance of L{default_call_policies_t} class"""
- #Small hack that allows to write nicer code
+ """return True is self is instance of L{default_call_policies_t} class"""
return False
def is_predefined( self ):
- """Returns True if call policy is defined in Boost.Python library, False otherwise"""
+ """return True if call policy is defined in Boost.Python library, False otherwise"""
return True
def _create_impl( self, function_creator ):
@@ -55,11 +57,11 @@
@property
def header_file(self):
- """Return name of the header file to be included"""
+ """return a name of the header file the call policy is defined in"""
return "boost/python.hpp"
class default_call_policies_t(call_policy_t):
- """implementation for ::boost::python::default_call_policies"""
+ """implements code generation for boost::python::default_call_policies"""
def __init__( self ):
call_policy_t.__init__( self )
@@ -73,11 +75,11 @@
return 'default_call_policies'
def default_call_policies():
- """create ::boost::python::default_call_policies"""
+ """create ::boost::python::default_call_policies call policies code generator"""
return default_call_policies_t()
class compound_policy_t( call_policy_t ):
- """base class for all call policies, except default one"""
+ """base class for all call policies, except the default one"""
def __init__( self, base=None ):
call_policy_t.__init__( self )
self._base = base
@@ -111,7 +113,7 @@
return declarations.templates.join( name, args )
class return_argument_t( compound_policy_t ):
- """implementation for ::boost::python::return_argument call policies"""
+ """implements code generation for boost::python::return_argument call policies"""
def __init__( self, position=1, base=None):
compound_policy_t.__init__( self, base )
self._position = position
@@ -135,12 +137,15 @@
return [ str( self.position ) ]
def return_arg( arg_pos, base=None ):
+ """create boost::python::return_arg call policies code generator"""
return return_argument_t( arg_pos, base )
def return_self(base=None):
+ """create boost::python::return_self call policies code generator"""
return return_argument_t( 1, base )
class return_internal_reference_t( compound_policy_t ):
+ """implements code generation for boost::python::return_internal_reference call policies"""
def __init__( self, position=1, base=None):
compound_policy_t.__init__( self, base )
self._position = position
@@ -158,9 +163,11 @@
return [ str( self.position ) ]
def return_internal_reference( arg_pos=1, base=None):
+ """create boost::python::return_internal_reference call policies code generator"""
return return_internal_reference_t( arg_pos, base )
class with_custodian_and_ward_t( compound_policy_t ):
+ """implements code generation for boost::python::with_custodian_and_ward call policies"""
def __init__( self, custodian, ward, base=None):
compound_policy_t.__init__( self, base )
self._custodian = custodian
@@ -185,9 +192,11 @@
return [ str( self.custodian ), str( self.ward ) ]
def with_custodian_and_ward( custodian, ward, base=None):
+ """create boost::python::with_custodian_and_ward call policies code generator"""
return with_custodian_and_ward_t( custodian, ward, base )
class with_custodian_and_ward_postcall_t( with_custodian_and_ward_t ):
+ """implements code generation for boost::python::with_custodian_and_ward_postcall call policies"""
def __init__( self, custodian, ward, base=None):
with_custodian_and_ward_t.__init__( self, custodian, ward, base )
@@ -195,9 +204,11 @@
return '::boost::python::with_custodian_and_ward_postcall'
def with_custodian_and_ward_postcall( custodian, ward, base=None):
+ """create boost::python::with_custodian_and_ward_postcall call policies code generator"""
return with_custodian_and_ward_postcall_t( custodian, ward, base )
class return_value_policy_t( compound_policy_t ):
+ """implements code generation for boost::python::return_value_policy call policies"""
def __init__( self, result_converter_generator, base=None):
compound_policy_t.__init__( self, base )
self._result_converter_generator = result_converter_generator
@@ -245,6 +256,7 @@
return_pointee_value = '::pyplusplus::call_policies::return_pointee_value'
def return_value_policy( result_converter_generator, base=None):
+ """create boost::python::return_value_policy call policies code generator"""
return return_value_policy_t( result_converter_generator, base )
def is_return_opaque_pointer_policy( policy ):
@@ -253,7 +265,7 @@
and policy.result_converter_generator == return_opaque_pointer
class custom_call_policies_t(call_policy_t):
- """implementation for user defined call policies"""
+ """implements code generation for user defined call policies"""
def __init__( self, call_policies, header_file=None ):
call_policy_t.__init__( self )
self.__call_policies = call_policies
@@ -273,10 +285,14 @@
, doc="""Return name of the header file to be included""" )
def custom_call_policies(call_policies, header_file=None):
- """create custom\\user defined call policies"""
+ """create custom\\user defined call policies code generator"""
return custom_call_policies_t(call_policies, header_file)
class memory_managers:
+ """implements code generation for Py++ defined memory managers
+
+ For complete documentation and usage example see http://language-binding.net/pyplusplus/documentation/functions/call_policies.html
+ """
none = 'none'
delete_ = 'delete_'
all = [ none, delete_ ]
@@ -289,6 +305,10 @@
return mem_manager
class convert_array_to_tuple_t( compound_policy_t ):
+ """implements code generation for Py++ defined "as_tuple" value policy
+
+ For complete documentation and usage example see http://language-binding.net/pyplusplus/documentation/functions/call_policies.html
+ """
def __init__( self, array_size, memory_manager, make_object_call_policies=None, base=None):
compound_policy_t.__init__( self, base )
self._array_size = array_size
@@ -324,7 +344,6 @@
self._make_objec_call_policies = new_make_objec_call_policies
make_objec_call_policies = property( _get_make_objec_call_policies, _set_make_objec_call_policies )
-
def _get_name(self, function_creator):
return '::boost::python::return_value_policy'
@@ -339,9 +358,14 @@
return [ declarations.templates.join( as_tuple, as_tuple_args ) ]
def convert_array_to_tuple( array_size, memory_manager, make_object_call_policies=None, base=None ):
+ """create boost::python::return_value_policy< py++::as_tuple > call policies code generator"""
return convert_array_to_tuple_t( array_size, memory_manager, make_object_call_policies, base )
class return_range_t( call_policy_t ):
+ """implements code generation for Py++ defined "return_range" call policies
+
+ For complete documentation and usage example see http://language-binding.net/pyplusplus/documentation/functions/call_policies.html
+ """
HEADER_FILE = "__return_range.pypp.hpp"
def __init__( self, get_size_class, value_type, value_policies):
call_policy_t.__init__( self )
@@ -384,6 +408,7 @@
return declarations.templates.join( name, args )
def return_range( function, get_size_class, value_policies=None ):
+ """create Py++ defined return_range call policies code generator"""
r_type = function.return_type
if not declarations.is_pointer( r_type ):
raise TypeError( 'Function "%s" return type should be pointer, got "%s"'
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-04-17 07:28:51 UTC (rev 995)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-04-17 12:40:13 UTC (rev 996)
@@ -3,19 +3,18 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-"""defines class that configure "callable" declaration exposing"""
+"""contains classes that allow to configure code generation for free\\member functions, operators and etc."""
import os
import user_text
import algorithm
import decl_wrapper
-import python_traits
from pyplusplus import messages
from pygccxml import declarations
from pyplusplus import function_transformers as ft
class calldef_t(decl_wrapper.decl_wrapper_t):
- """base class for all decl_wrappers callable objects classes."""
+ """base class, for code generator configration, for function declaration classes."""
BOOST_PYTHON_MAX_ARITY = 10
"""Boost.Python configuration macro value.
@@ -105,30 +104,35 @@
@property
def non_overridable_reason( self ):
+ """returns the reason the function could not be overriden"""
return self._non_overridable_reason
def mark_as_non_overridable( self, reason ):
+ """mark this function as non-overridable
+
+ Not all fucntions could be overrided from Python, for example virtual function
+ that returns non const reference to a member variable. Py++ allows you to
+ mark these functions and provide and explanation to the user.
+ """
self.overridable = False
self._non_overridable_reason = reason
@property
def transformations(self):
- """Get method for property 'function_transformers'.
-
- Returns a reference to the internal list (which may be modified).
- """
+ """return list of function transformations that should be applied on the function"""
if None is self._transformations:
#TODO: for trivial cases get_size( int&, int& ) Py++ should guess
#function transformers
self._transformations = []
return self._transformations
- def add_transformation(self, *args, **keywd):
- """Set method for property 'function_transformers'.
+ def add_transformation(self, *transformer_creators, **keywd):
+ """add new function transformation.
- args is a list of transformers
+ transformer_creators - list of transformer creators, which should be applied on the function
+ keywd - keyword arguments for L{function_transformation_t} class initialization
"""
- self.transformations.append( ft.function_transformation_t( self, args, **keywd ) )
+ self.transformations.append( ft.function_transformation_t( self, transformer_creators, **keywd ) )
def _exportable_impl_derived( self ):
return ''
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-17 07:28:51
|
Revision: 995
http://svn.sourceforge.net/pygccxml/?rev=995&view=rev
Author: roman_yakovenko
Date: 2007-04-17 00:28:51 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
another set of improvements and optimizations related to include file treatment
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/module.py
pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
pyplusplus_dev/pyplusplus/file_writers/writer.py
pyplusplus_dev/pyplusplus/module_creator/creator.py
pyplusplus_dev/unittests/convenience_tester.py
Modified: pyplusplus_dev/pyplusplus/code_creators/module.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/module.py 2007-04-17 07:16:21 UTC (rev 994)
+++ pyplusplus_dev/pyplusplus/code_creators/module.py 2007-04-17 07:28:51 UTC (rev 995)
@@ -4,7 +4,6 @@
# http://www.boost.org/LICENSE_1_0.txt)
import os
-import types
import custom
import license
import include
@@ -23,18 +22,8 @@
"""Constructor.
"""
compound.compound_t.__init__(self)
- self.__system_headers = []
-
- def add_system_header( self, header ):
- normalize = include_directories.include_directories_t.normalize
- normalized_header = normalize( header )
- if normalized_header not in self.__system_headers:
- self.__system_headers.append( normalized_header )
-
- def is_system_header( self, header ):
- normalize = include_directories.include_directories_t.normalize
- return normalize( header ) in self.__system_headers
-
+ self.__body = None
+
def _get_include_dirs(self):
include_dirs = algorithm.creator_finder.find_by_class_instance(
what=include_directories.include_directories_t
@@ -62,19 +51,16 @@
return include_dirs.user_defined
user_defined_directories = property( _get_user_defined_directories )
- def _get_body(self):
- found = algorithm.creator_finder.find_by_class_instance( what=module_body.module_body_t
+ @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 not found:
- return None
- else:
- return found[0]
- body = property( _get_body,
- doc="""A module_body_t object or None.
- @type: L{module_body_t}
- """
- )
+ if found:
+ self.__body = found[0]
+ return self.__body
def _get_license( self ):
if isinstance( self.creators[0], license.license_t ):
@@ -107,22 +93,7 @@
return i
else:
return 0
-
- def first_include_index(self):
- """Return the children index of the first 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) ):
- if isinstance( self.creators[i], include.include_t ):
- return i
- else:
- raise RuntimeError( "include_t creator has not been found." )
-
def replace_included_headers( self, headers, leave_system_headers=True ):
to_be_removed = []
for creator in self.creators:
@@ -132,7 +103,7 @@
break
for creator in to_be_removed:
- if creator.header in self.__system_headers:
+ if creator.is_system:
if not leave_system_headers:
self.remove_creator( creator )
elif creator.is_user_defined:
@@ -183,8 +154,9 @@
code = self.unindent(code)
return os.linesep.join( includes ) + 2 * os.linesep + code + os.linesep
- def add_include( self, header ):
- self.adopt_include( include.include_t( header=header, user_defined=True ) )
+ 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 )
@@ -199,19 +171,5 @@
def adopt_declaration_creator( self, creator ):
self.adopt_creator( creator, self.creators.index( self.body ) )
- def add_declaration_code( self, code, position ):
- creator = custom.custom_text_t( code )
- last_include = self.last_include_index()
- pos = max( last_include + 1, position )
- pos = min( pos, self.creators.index( self.body ) )
- self.adopt_creator( creator, pos )
-
-
-
-
-
-
-
-
-
-
+ def add_declaration_code( self, code, position ):
+ self.adopt_declaration_creator( custom.custom_text_t( code ) )
Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-04-17 07:16:21 UTC (rev 994)
+++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-04-17 07:28:51 UTC (rev 995)
@@ -12,7 +12,6 @@
from pygccxml import declarations
from pyplusplus import decl_wrappers
from pyplusplus import code_creators
-from pyplusplus import code_repository
#TODO: to add namespace_alias_t classes
class multiple_files_t(writer.writer_t):
@@ -44,6 +43,9 @@
self.write_main = write_main
self.written_files = []
self.ref_count_creators = ( code_creators.opaque_type_registrator_t, )
+ self.__predefined_include_creators \
+ = filter( lambda creator: isinstance( creator, code_creators.include_t )
+ , self.extmodule.creators )
def write_file( self, fpath, content ):
self.written_files.append( fpath )
@@ -155,12 +157,9 @@
dependend_on_headers.extend( creator.get_system_headers( recursive=True ) )
dependend_on_headers = unique_headers( map( normalize, dependend_on_headers ) )
-
- include_creators = filter( lambda creator: isinstance( creator, code_creators.include_t )
- , self.extmodule.creators )
-
- for include_cc in include_creators:
- if self.extmodule.is_system_header( include_cc.header ):
+
+ for include_cc in self.__predefined_include_creators:
+ if include_cc.is_system:
if include_cc.header in dependend_on_headers:
answer.append( include_cc.create() )
else:# user header file - always include
Modified: pyplusplus_dev/pyplusplus/file_writers/writer.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-04-17 07:16:21 UTC (rev 994)
+++ pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-04-17 07:28:51 UTC (rev 995)
@@ -47,10 +47,14 @@
def write_code_repository(self, dir):
"""creates files defined in L{code_repository} package"""
+ system_headers = self.extmodule.get_system_headers( recursive=True )
for cr in code_repository.all:
- if self.__extmodule.is_system_header( cr.file_name ):
+ if cr.file_name in system_headers:
+ #check whether file from code repository is used
self.write_file( os.path.join( dir, cr.file_name ), cr.code )
-
+ #named_tuple.py is a special case :-(
+ self.write_file( os.path.join( dir, code_repository.named_tuple.file_name )
+ , code_repository.named_tuple.code )
@staticmethod
def write_file( fpath, content ):
"""Write a source file.
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-04-17 07:16:21 UTC (rev 994)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-04-17 07:28:51 UTC (rev 995)
@@ -299,11 +299,6 @@
creators.reverse()
self.__module_body.adopt_creators( creators, 0 )
- def __include_header( self, header, system=False ):
- self.__extmodule.adopt_include( code_creators.include_t( header ) )
- if system:
- self.__extmodule.add_system_header( header )
-
def create(self, decl_headers=None):
"""Create and return the module for the extension.
@@ -325,14 +320,16 @@
creator.target_configuration = self.__target_configuration
#last action.
self._append_user_code()
+
+ add_include = self.__extmodule.add_include
#add system headers
system_headers = self.__extmodule.get_system_headers( recursive=True, unique=True )
- map( lambda header: self.__include_header( header, system=True )
+ map( lambda header: add_include( header, user_defined=False, system=True )
, system_headers )
#add user defined header files
if decl_headers is None:
decl_headers = declarations.declaration_files( self.__decls )
- map( lambda header: self.__include_header( header )
+ map( lambda header: add_include( header, user_defined=False, system=False )
, decl_headers )
self.__dependencies_manager.inform_user()
Modified: pyplusplus_dev/unittests/convenience_tester.py
===================================================================
--- pyplusplus_dev/unittests/convenience_tester.py 2007-04-17 07:16:21 UTC (rev 994)
+++ pyplusplus_dev/unittests/convenience_tester.py 2007-04-17 07:28:51 UTC (rev 995)
@@ -24,8 +24,7 @@
mb.add_registration_code( 'bp::def( "ensure_int_sequence", &pyplusplus::convenience::ensure_uniform_sequence<int> );' )
mb.build_code_creator( self.EXTENSION_NAME )
- mb.code_creator.add_include( "__convenience.pypp.hpp" )
- mb.code_creator.add_system_header( code_repository.convenience.file_name )
+ mb.code_creator.add_include( code_repository.convenience.file_name, system=True )
def run_tests(self, module):
self.failIfRaisesAny( module.ensure_sequence, [1,2,3], -1 )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-17 07:16:20
|
Revision: 994
http://svn.sourceforge.net/pygccxml/?rev=994&view=rev
Author: roman_yakovenko
Date: 2007-04-17 00:16:21 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
introducing few small optimizations:
include and namespace code creators always generate same code - from now they will do it only once
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/include.py
pyplusplus_dev/pyplusplus/code_creators/namespace.py
Modified: pyplusplus_dev/pyplusplus/code_creators/include.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/include.py 2007-04-17 07:13:00 UTC (rev 993)
+++ pyplusplus_dev/pyplusplus/code_creators/include.py 2007-04-17 07:16:21 UTC (rev 994)
@@ -3,25 +3,30 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-import os
import code_creator
-import algorithm
import include_directories
class include_t(code_creator.code_creator_t):
"""
Creates C++ code for include directive
"""
- def __init__( self, header, user_defined=False ):
+ def __init__( self, header, user_defined=False, system=False ):
code_creator.code_creator_t.__init__(self)
self._header = include_directories.include_directories_t.normalize( header )
self._include_dirs_optimization = None #This parameter will be set from module_t.create function
self._user_defined = user_defined
+ self._system = system
+ self.__created_code = None
@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):
@@ -34,7 +39,7 @@
self._include_dirs_optimization = include_dirs
include_dirs_optimization = property( _get_include_dirs_optimization, _set_include_dirs_optimization )
- def _create_impl(self):
+ def _create_include_directive_code(self):
header = self.header.strip()
if header.startswith( '"' ) or header.startswith( '<' ):
return '#include %s' % self.header
@@ -48,5 +53,10 @@
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_headers_impl( self ):
return []
Modified: pyplusplus_dev/pyplusplus/code_creators/namespace.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/namespace.py 2007-04-17 07:13:00 UTC (rev 993)
+++ pyplusplus_dev/pyplusplus/code_creators/namespace.py 2007-04-17 07:16:21 UTC (rev 994)
@@ -10,6 +10,7 @@
code_creator.code_creator_t.__init__( self )
self._alias = alias
self._full_namespace_name = full_namespace_name
+ self.__created_code = None
def _get_alias( self ):
return self._alias
@@ -24,7 +25,11 @@
full_namespace_name = property( _get_full_namespace_name, _set_full_namespace_name )
def _create_impl(self):
- return 'namespace %s = %s;' % ( self.alias, self.full_namespace_name )
+ if self.__created_code:
+ return self.__created_code
+ else:
+ self.__created_code = 'namespace %s = %s;' % ( self.alias, self.full_namespace_name )
+ return self.__created_code
def _get_system_headers_impl( self ):
return []
@@ -33,6 +38,7 @@
def __init__( self, namespace_name ):
code_creator.code_creator_t.__init__(self )
self._namespace_name = namespace_name
+ self.__created_code = None
def _get_namespace_name( self ):
return self._namespace_name.lstrip( '::' )
@@ -41,7 +47,11 @@
namespace_name = property( _get_namespace_name, _set_namespace_name )
def _create_impl(self):
- return 'using namespace %s;' % self.namespace_name
+ 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_headers_impl( self ):
return []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-17 07:13:02
|
Revision: 993
http://svn.sourceforge.net/pygccxml/?rev=993&view=rev
Author: roman_yakovenko
Date: 2007-04-17 00:13:00 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
small docs improvements
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py
pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2007-04-15 19:34:49 UTC (rev 992)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2007-04-17 07:13:00 UTC (rev 993)
@@ -3,25 +3,27 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-"""
-This module is a collection of unrelated algorithms, that works on code creators
-tree.
-"""
+"""Contains few unrelated algorithms, which works on code creators tree"""
import re
from pygccxml import declarations
def creators_affect_on_me( me ):
- """This algorithm finds all code creators that can influence on code generated
- by me. Description of algorithm::
+ """Find all relevant code creators, which influennce on code generated by "me".
+ C++ allows to define aliases to namespaces. Py++ allows user to define aliases
+ to the namespace and will take this aliases into account when it generates
+ the code.
+
+ Example:
+
[a b c d e f g]
|
+ [k l m]
|
+ [y x] <-- we are here ( x )
- The answer of this algorithm is [y,l,k,d,c,b,a]
+ return value is: [y,l,k,d,c,b,a]
"""
class impl:
def __init__( self, creator):
@@ -47,10 +49,13 @@
__RE_VALID_IDENTIFIER = re.compile( r"[_a-z]\w*", re.I | re.L | re.U )
def create_valid_name(name):
+ """Create valid name\\Python identifier from a string
+
+ As input this functions takes valid C++ name\identifier and replaces all invalid
+ characters.
+
+ Invalid characters are introduced by a template instantiation.
"""
- This function takes valid C++ class\\function name and will return valid
- Python name. I need this function in order to expose template instantiations
- """
global __RE_VALID_IDENTIFIER
match_found = __RE_VALID_IDENTIFIER.match(name)
if match_found and ( match_found.end() - match_found.start() == len(name) ):
@@ -78,10 +83,7 @@
def create_identifier(creator, full_name ):
- """
- This function will find all relevant namespace aliases and will return new
- full name that takes into account namespace aliases.
- """
+ """Return new full name, which takes into account namespace aliases"""
from pyplusplus import code_creators
dset = creators_affect_on_me( creator )
@@ -96,8 +98,14 @@
return full_name
class registration_order:
+ """class-namespace, introduce few functions, which deals with functions
+ registration order problem: http://www.language-binding.net/pyplusplus/documentation/functions/registration_order.html
+ """
+
@staticmethod
def is_related( t1, t2 ):
+ """Check whether two types\\classes t1 and t2 could introduce the problem"""
+
if declarations.is_pointer( t1 ) and declarations.is_pointer( t2 ):
return registration_order.is_related( declarations.remove_pointer( t1 )
, declarations.remove_pointer( t2 ) )
@@ -124,6 +132,7 @@
@staticmethod
def select_problematics( calldef ):
+ """Return list of problematic functions for function "calldef" """
if 1 != len( calldef.required_args ):
return []
problematics = []
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py 2007-04-15 19:34:49 UTC (rev 992)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py 2007-04-17 07:13:00 UTC (rev 993)
@@ -3,14 +3,8 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-"""
-This modules contains definition of call policies classes. Call policies names
-are same, that used in boost.python library.
+"""Contains definition of call policies classes"""
-For every class that implements code creation of call policies, there is a
-convinience function.
-"""
-
import algorithm
import python_traits
from pygccxml import declarations
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 19:34:52
|
Revision: 992
http://svn.sourceforge.net/pygccxml/?rev=992&view=rev
Author: roman_yakovenko
Date: 2007-04-15 12:34:49 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
improving docs
Modified Paths:
--------------
pyplusplus_dev/docs/documentation/www_configuration.py
Added Paths:
-----------
pyplusplus_dev/docs/documentation/feedback.html
pyplusplus_dev/docs/documentation/warnings.rest
Removed Paths:
-------------
pyplusplus_dev/docs/documentation/feedback.rest
Added: pyplusplus_dev/docs/documentation/feedback.html
===================================================================
--- pyplusplus_dev/docs/documentation/feedback.html (rev 0)
+++ pyplusplus_dev/docs/documentation/feedback.html 2007-04-15 19:34:49 UTC (rev 992)
@@ -0,0 +1,9 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="0; URL=./warnings.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="./warnings.html">./warnings.html</a>
+</body>
+</html>
Deleted: pyplusplus_dev/docs/documentation/feedback.rest
===================================================================
--- pyplusplus_dev/docs/documentation/feedback.rest 2007-04-15 19:26:09 UTC (rev 991)
+++ pyplusplus_dev/docs/documentation/feedback.rest 2007-04-15 19:34:49 UTC (rev 992)
@@ -1,222 +0,0 @@
-=============
-Py++ feedback
-=============
-
-.. contents:: Table of contents
-
-------------
-Introduction
-------------
-
-`Py++`_ has been created with few goals in mind:
-
-* to allow users create `Python`_ bindings for large projects using the `Boost.Python`_
- library
-
-* to minimize maintenance time
-
-* to serve as a user's guide for `Boost.Python`_ library
-
-
-Those goals all have something in common. In order to achieve them, `Py++`_ must
-give useful feedback to the user. Because `Py++`_ understands the
-declarations it exports, it can scan declarations for potential problems, report
-them and in some cases provide hints about how to resolve the problem. Few examples:
-
-*
- .. code-block:: C++
-
- struct Y{ ... };
-
- .. code-block:: C++
-
- struct X{
- ...
- virtual Y& do_smth();
- };
-
- Member function ``do_smth`` can not be overridden in Python because... [FILL IN HERE].
-
-*
- .. code-block:: C++
-
- struct window{
- ...
- void get_size( int& height, int& width ) const;
- };
-
- Member function ``get_size`` can be exposed to Python, but it will not be callable because [FILL IN HERE].
-
-* In order to expose free/member function that takes more than 10 arguments user
- should define ``BOOST_PYTHON_MAX_ARITY`` macro.
-
-*
- .. code-block:: C++
-
- struct X{
- ...
- };
-
- void do_smth( X x );
-
- If you expose ``do_smth`` function and don't expose struct ``X``, `Py++`_
- will tell you that struct ``X`` is used in exported declaration, but was not
- exposed.
-
-For these problems and many other `Py++`_ gives a nice explanation
-and sometimes a link to the relevant information on the Internet.
-
-I don't know what about you, but I found these messages pretty useful. They allow
-me to deliver Python bindings with higher quality.
-
--------------
-How it works?
--------------
-
-In previous paragraph, I described some pretty useful functionality but what should you
-do to enable it? - *Nothing!* By default, `Py++`_ only prints the
-important messages to ``stdout``. More over it prints them only for declarations
-that are going to be exported.
-
-`Py++`_ uses the python `logging`_ package to write all user messages. By
-default, messages with ``DEBUG`` level will be skipped, all other messages will
-be reported.
-
---------
-Warnings
---------
-
-Example of the warning:
-::
-
- WARNING: containers::item_t [struct]
- > warning W1020: Py++ will generate class wrapper - hand written code
- > should be added to the wrapper class
-
-Almost every warning reported by `Py++`_ consists from 3 parts:
-
-* description of the declaration it refers to: "containers::item_t [struct]"
-
-* warning unique identifier: "W1020"
-
-* short explanation of the problem: "Py++ will generate class wrapper - hand
- written code should be added to the wrapper class"
-
----------------
-API Description
----------------
-
-How to disable warning(s)?
---------------------------
-
-Every warning has unique identifier. In the example I gave it was ``W1020``.
-
-.. code-block:: Python
-
- from pyplusplus import messages
- from pyplusplus import module_builder
-
- mb = module_builder.module_builder_t( ... )
- xyz = mb.class_( XYZ )
- xyz.disable_warnings( messages.W1020 )
-
-It is also possible to disable warnings for all declarations. ``pyplusplus.messages``
-package defines ``DISABLE_MESSAGES`` variable. This variable( ``list`` ) keeps
-all warnings, which should not be reported. Use ``messages.disable`` function to
-edit it:
-
-.. code-block:: Python
-
- messages.disable( messages.W1020 )
-
-
-Logging API
------------
-
-If you are here, it probably means that you are not pleased with default configuration
-and want to change it, right?
-
-1. If you simply want to change the logging message level:
-
- .. code-block:: Python
-
- import logging
- from pyplusplus import module_builder
-
- .. code-block:: Python
-
- module_builder.set_logger_level( logging.DEBUG )
-
-
-2. But what if you want to disable some messages and leave others? This is also possible.
- `Py++`_ and `pygccxml`_ do not use a single logger. Almost every internal
- package has its own logger. So you can enable one logger and disable another one.
-
- The `pygccxml`_ package defines all loggers in the ``pygccxml.utils`` package.
-
- The `Py++`_ package defines all loggers in the ``pyplusplus._logging_`` package.
-
- Both packages define a ``loggers`` class. Those classes keep references to
- different loggers. The ``loggers`` classes look very similar to the next class:
-
- .. code-block:: Python
-
- import logging #standard Python package
-
- def _create_logger_( name ):
- logger = logging.getLogger(name)
- ...
- return logger
-
- class loggers:
- file_writer = _create_logger_( 'pyplusplus.file_writer' )
- declarations = _create_logger_( 'pyplusplus.declarations' )
- module_builder = _create_logger_( 'pyplusplus.module_builder' )
- root = logging.getLogger( 'pyplusplus' )
- all = [ root, file_writer, module_builder, declarations ]
-
- You can use these references in the ``logging`` package to complete
- your task of adjusting individual loggers.
-
- One more thing, `Py++`_ automatically splits long message, where line
- length defaults to 70 characters. Thus it is very convenient to read them on your screen.
- If you want to use different tools to monitor those messages, consider to use
- standard `Formatter`_ class, instead of ``multi_line_formatter_t`` one.
-
-
-Declarations API
-----------------
-
-Every declaration class has the following methods:
-
-* ``why_not_exportable( self )``
-
- This method explains why a declaration could not be exported. The return value
- is a string or ``None``. ``None`` is returned if the declaration is exportable.
-
- Property ``exportable`` will be set to ``True`` if declaration is exportable,
- and to ``False`` otherwise.
-
-* ``readme( self )``
-
- This method gives you access to all tips/hints/warnings `Py++`_ has about
- the declaration. This methods returns a list of strings. If the declaration is
- not exportable, than first message within the list is an explanation, why it
- is not exportable.
-
-
-.. _`Formatter` : http://docs.python.org/lib/node357.html
-.. _`logging` : http://docs.python.org/lib/module-logging.html
-.. _`Py++` : ./../pyplusplus.html
-.. _`pygccxml` : ./../../pygccxml/pygccxml.html
-.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html
-.. _`Python`: http://www.python.org
-.. _`GCC-XML`: http://www.gccxml.org
-
-..
- Local Variables:
- mode: indented-text
- indent-tabs-mode: nil
- sentence-end-double-space: t
- fill-column: 70
- End:
Copied: pyplusplus_dev/docs/documentation/warnings.rest (from rev 987, pyplusplus_dev/docs/documentation/feedback.rest)
===================================================================
--- pyplusplus_dev/docs/documentation/warnings.rest (rev 0)
+++ pyplusplus_dev/docs/documentation/warnings.rest 2007-04-15 19:34:49 UTC (rev 992)
@@ -0,0 +1,222 @@
+=============
+Py++ warnings
+=============
+
+.. contents:: Table of contents
+
+------------
+Introduction
+------------
+
+`Py++`_ has been created with few goals in mind:
+
+* to allow users create `Python`_ bindings for large projects using the `Boost.Python`_
+ library
+
+* to minimize maintenance time
+
+* to serve as a user's guide for `Boost.Python`_ library
+
+
+Those goals all have something in common. In order to achieve them, `Py++`_ must
+give useful feedback to the user. Because `Py++`_ understands the declarations
+it exports, it can scan declarations for potential problems, report them and in
+some cases provide hints about how to resolve the problem. Few examples:
+
+*
+ .. code-block:: C++
+
+ struct Y{ ... };
+
+ .. code-block:: C++
+
+ struct X{
+ ...
+ virtual Y& do_smth();
+ };
+
+ Member function ``do_smth`` can not be overridden in Python because... [FILL IN HERE].
+
+*
+ .. code-block:: C++
+
+ struct window{
+ ...
+ void get_size( int& height, int& width ) const;
+ };
+
+ Member function ``get_size`` can be exposed to Python, but it will not be callable because [FILL IN HERE].
+
+* In order to expose free/member function that takes more than 10 arguments user
+ should define ``BOOST_PYTHON_MAX_ARITY`` macro.
+
+*
+ .. code-block:: C++
+
+ struct X{
+ ...
+ };
+
+ void do_smth( X x );
+
+ If you expose ``do_smth`` function and don't expose struct ``X``, `Py++`_
+ will tell you that struct ``X`` is used in exported declaration, but was not
+ exposed.
+
+For these problems and many other `Py++`_ gives a nice explanation
+and sometimes a link to the relevant information on the Internet.
+
+I don't know what about you, but I found these messages pretty useful. They allow
+me to deliver Python bindings with higher quality.
+
+-------------
+How it works?
+-------------
+
+In previous paragraph, I described some pretty useful functionality but what should you
+do to enable it? - *Nothing!* By default, `Py++`_ only prints the
+important messages to ``stdout``. More over it prints them only for declarations
+that are going to be exported.
+
+`Py++`_ uses the python `logging`_ package to write all user messages. By
+default, messages with ``DEBUG`` level will be skipped, all other messages will
+be reported.
+
+--------
+Warnings
+--------
+
+Example of the warning:
+::
+
+ WARNING: containers::item_t [struct]
+ > warning W1020: Py++ will generate class wrapper - hand written code
+ > should be added to the wrapper class
+
+Almost every warning reported by `Py++`_ consists from 3 parts:
+
+* description of the declaration it refers to: "containers::item_t [struct]"
+
+* warning unique identifier: "W1020"
+
+* short explanation of the problem: "Py++ will generate class wrapper - hand
+ written code should be added to the wrapper class"
+
+---------------
+API Description
+---------------
+
+How to disable warning(s)?
+--------------------------
+
+Every warning has unique identifier. In the example I gave it was ``W1020``.
+
+.. code-block:: Python
+
+ from pyplusplus import messages
+ from pyplusplus import module_builder
+
+ mb = module_builder.module_builder_t( ... )
+ xyz = mb.class_( XYZ )
+ xyz.disable_warnings( messages.W1020 )
+
+It is also possible to disable warnings for all declarations. ``pyplusplus.messages``
+package defines ``DISABLE_MESSAGES`` variable. This variable( ``list`` ) keeps
+all warnings, which should not be reported. Use ``messages.disable`` function to
+edit it:
+
+.. code-block:: Python
+
+ messages.disable( messages.W1020 )
+
+
+Logging API
+-----------
+
+If you are here, it probably means that you are not pleased with default configuration
+and want to change it, right?
+
+1. If you simply want to change the logging message level:
+
+ .. code-block:: Python
+
+ import logging
+ from pyplusplus import module_builder
+
+ .. code-block:: Python
+
+ module_builder.set_logger_level( logging.DEBUG )
+
+
+2. But what if you want to disable some messages and leave others? This is also possible.
+ `Py++`_ and `pygccxml`_ do not use a single logger. Almost every internal
+ package has its own logger. So you can enable one logger and disable another one.
+
+ The `pygccxml`_ package defines all loggers in the ``pygccxml.utils`` package.
+
+ The `Py++`_ package defines all loggers in the ``pyplusplus._logging_`` package.
+
+ Both packages define a ``loggers`` class. Those classes keep references to
+ different loggers. The ``loggers`` classes look very similar to the next class:
+
+ .. code-block:: Python
+
+ import logging #standard Python package
+
+ def _create_logger_( name ):
+ logger = logging.getLogger(name)
+ ...
+ return logger
+
+ class loggers:
+ file_writer = _create_logger_( 'pyplusplus.file_writer' )
+ declarations = _create_logger_( 'pyplusplus.declarations' )
+ module_builder = _create_logger_( 'pyplusplus.module_builder' )
+ root = logging.getLogger( 'pyplusplus' )
+ all = [ root, file_writer, module_builder, declarations ]
+
+ You can use these references in the ``logging`` package to complete
+ your task of adjusting individual loggers.
+
+ One more thing, `Py++`_ automatically splits long message, where line
+ length defaults to 70 characters. Thus it is very convenient to read them on your screen.
+ If you want to use different tools to monitor those messages, consider to use
+ standard `Formatter`_ class, instead of ``multi_line_formatter_t`` one.
+
+
+Declarations API
+----------------
+
+Every declaration class has the following methods:
+
+* ``why_not_exportable( self )``
+
+ This method explains why a declaration could not be exported. The return value
+ is a string or ``None``. ``None`` is returned if the declaration is exportable.
+
+ Property ``exportable`` will be set to ``True`` if declaration is exportable,
+ and to ``False`` otherwise.
+
+* ``readme( self )``
+
+ This method gives you access to all tips/hints/warnings `Py++`_ has about
+ the declaration. This methods returns a list of strings. If the declaration is
+ not exportable, than first message within the list is an explanation, why it
+ is not exportable.
+
+
+.. _`Formatter` : http://docs.python.org/lib/node357.html
+.. _`logging` : http://docs.python.org/lib/module-logging.html
+.. _`Py++` : ./../pyplusplus.html
+.. _`pygccxml` : ./../../pygccxml/pygccxml.html
+.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html
+.. _`Python`: http://www.python.org
+.. _`GCC-XML`: http://www.gccxml.org
+
+..
+ Local Variables:
+ mode: indented-text
+ indent-tabs-mode: nil
+ sentence-end-double-space: t
+ fill-column: 70
+ End:
Modified: pyplusplus_dev/docs/documentation/www_configuration.py
===================================================================
--- pyplusplus_dev/docs/documentation/www_configuration.py 2007-04-15 19:26:09 UTC (rev 991)
+++ pyplusplus_dev/docs/documentation/www_configuration.py 2007-04-15 19:34:49 UTC (rev 992)
@@ -1,6 +1,6 @@
name = 'documentation'
main_html_file = 'index.html'
-files_to_skip = ['indexing_suite_v2.html']
+files_to_skip = ['indexing_suite_v2.html', 'feedback.html']
names = { 'containers' : 'STL containers'
, 'how_to' : 'how to ... ?'
, 'doc_string' : 'documentation string'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 19:26:07
|
Revision: 991
http://svn.sourceforge.net/pygccxml/?rev=991&view=rev
Author: roman_yakovenko
Date: 2007-04-15 12:26:09 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
update docs
Modified Paths:
--------------
pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.rest
Modified: pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.rest
===================================================================
--- pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.rest 2007-04-15 19:24:57 UTC (rev 990)
+++ pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.rest 2007-04-15 19:26:09 UTC (rev 991)
@@ -16,7 +16,7 @@
It is all about module interface and user expectations. If you can translate all
your exceptions to built-in ones, than you are fine. You don't have to read this
-"lesson", but Boost.Python `exception translator`_ documentation.
+guide, but Boost.Python `exception translator`_ documentation.
.. _`exception translator` : http://boost.org/libs/python/doc/v2/exception_translator.html
@@ -47,7 +47,7 @@
Files
-----
-* `exceptions.cpp`_ file contains source code for the "lesson"
+* `exceptions.cpp`_ file contains source code for the guide
* `sconstruct`_ file contains build instructions for scons build tool.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 19:24:57
|
Revision: 990
http://svn.sourceforge.net/pygccxml/?rev=990&view=rev
Author: roman_yakovenko
Date: 2007-04-15 12:24:57 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
adding "exceptions" lesson
Modified Paths:
--------------
pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.rest
Added Paths:
-----------
pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.zip
Modified: pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.rest
===================================================================
--- pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.rest 2007-04-15 18:57:23 UTC (rev 989)
+++ pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.rest 2007-04-15 19:24:57 UTC (rev 990)
@@ -10,42 +10,52 @@
.. include:: ./definition.rest
--------
-Content
--------
+-------------------
+What's the problem?
+-------------------
-This example actually consist from 2 small, well documented examples.
+It is all about module interface and user expectations. If you can translate all
+your exceptions to built-in ones, than you are fine. You don't have to read this
+"lesson", but Boost.Python `exception translator`_ documentation.
-The first one shows how to handle conversion between tuples: `boost::tuples::tuple`_
-and Python tuple.
+.. _`exception translator` : http://boost.org/libs/python/doc/v2/exception_translator.html
-.. _`boost::tuples::tuple` : http://boost.org/libs/tuple/doc/tuple_users_guide.html
+My use case was different. I was supposed to export the exception classes and make
+them play nice with the ``try ... except`` mechanism. I mean, users should be able
+to:
-The second one shows how to add an automatic conversion from Python tuple to
-some registered class. The class registration allows you to use its functionality
-and enjoy from automatic conversion.
+ 1. "except" all exceptions using ``except Exception, err:`` statement
+ 2. "except" the exposed library defined exception classes
+
+I thought about few possible solutions to the problem. My first attempt was to
+add a missing functionality to Boost.Python library. Well, I quickly found out
+that the task is not a trivial one.
+
+The next solution, I thought about, was to expose the exception class as-is and
+to define new class in Python, which derives from it and the built-in ``Exception``.
+I implemented it and when I run the code I've got ``TypeError``:
+"Error when calling the metaclass bases multiple bases have instance lay-out conflict".
+
+The only solution left was to use "aggregation with automatic delegation". I mean
+instead of deriving from the exception class, I will keep it as a member variable
+in a class defined in Python, which derives from the built-in ``Exception`` one.
+Every time user access an attribute, the class defined in Python will automatically
+redirect the request to the variable. This technique is explained much better here:
+http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52295 .
+
Files
-----
-* `tuples.hpp`_ file contains Boost.Tuple to\\from Python tuple conversion
- implementation
+* `exceptions.cpp`_ file contains source code for the "lesson"
-* `tuples_tester.cpp`_ file contains few functions, which test the tuples
- conversion functionality
-
-* `custom_rvalue.cpp`_ file contains example of registration custom r-value
- converter
-
* `sconstruct`_ file contains build instructions for scons build tool.
-* `test.py`_ file contains complete unit tests for both example
+* `test.py`_ file contains complete unit test suite
All files contain comments, which describe what and why was done.
-.. _`tuples.hpp` : ./tuples.hpp.html
-.. _`tuples_tester.cpp` : ./tuples_tester.cpp.html
-.. _`custom_rvalue.cpp` : ./custom_rvalue.cpp.html
+.. _`exceptions.cpp` : ./exceptions.cpp.html
.. _`sconstruct` : ./sconstruct.html
.. _`test.py` : ./test.py.html
@@ -53,9 +63,9 @@
Download
--------
-`automatic_conversion.zip`_
+`exceptions.zip`_
-.. _`automatic_conversion.zip` : ./automatic_conversion.zip
+.. _`exceptions.zip` : ./exceptions.zip
.. _`Py++` : ./../pyplusplus.html
Added: pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.zip
===================================================================
(Binary files differ)
Property changes on: pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 18:57:23
|
Revision: 989
http://svn.sourceforge.net/pygccxml/?rev=989&view=rev
Author: roman_yakovenko
Date: 2007-04-15 11:57:23 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
the file is not needed anymore, better and simpler implementation was introduced
Removed Paths:
-------------
pyplusplus_dev/pyplusplus/module_creator/header_files_manager.py
Deleted: pyplusplus_dev/pyplusplus/module_creator/header_files_manager.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/header_files_manager.py 2007-04-15 18:51:57 UTC (rev 988)
+++ pyplusplus_dev/pyplusplus/module_creator/header_files_manager.py 2007-04-15 18:57:23 UTC (rev 989)
@@ -1,50 +0,0 @@
-# Copyright 2004 Roman Yakovenko.
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-
-from pygccxml import declarations
-from pyplusplus import code_creators
-from pyplusplus import code_repository
-
-class manager_t( object ):
- def __init__( self, extmodule ):
- object.__init__( self )
- self.__extmodule = extmodule
- self.__already_included = set()
- self.normalize = code_creators.include_directories_t.normalize
-
- self.__extmodule.add_system_header( "boost/python.hpp" )
- self.__extmodule.adopt_creator( code_creators.include_t( header="boost/python.hpp" ) )
-
- def include( self, header, system=False, user_defined=False ):
- normalized_header = self.normalize( header )
- if normalized_header not in self.__already_included:
- self.__already_included.add( normalized_header )
- self.__extmodule.adopt_include( code_creators.include_t( header, user_defined=user_defined ) )
- if system:
- self.__extmodule.add_system_header( header )
-
- def include_call_policy( self, call_policy ):
- if not call_policy:
- return
- if call_policy.is_predefined():
- #boost/python.hpp is already included
- return
- self.include( call_policy.header_file, system=True )
-
- def include_ft( self, required_headers ): #include function transformation headers
- required_headers = map( self.normalize, required_headers )
- for header in required_headers:
- system = bool( header in code_repository.headers )
- self.include( header, system=system, user_defined=True )
-
- if not self.__extmodule.is_system_header( code_repository.named_tuple.file_name ):
- self.__extmodule.add_system_header( code_repository.named_tuple.file_name )
-
-
-
-
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 18:51:56
|
Revision: 988
http://svn.sourceforge.net/pygccxml/?rev=988&view=rev
Author: roman_yakovenko
Date: 2007-04-15 11:51:57 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
improving system header file handling + simplifying creator_t class implementation
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/code_creator.py
pyplusplus_dev/pyplusplus/code_creators/compound.py
pyplusplus_dev/pyplusplus/code_creators/module.py
pyplusplus_dev/pyplusplus/module_creator/creator.py
Modified: pyplusplus_dev/pyplusplus/code_creators/code_creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2007-04-15 10:45:52 UTC (rev 987)
+++ pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2007-04-15 18:51:57 UTC (rev 988)
@@ -114,10 +114,13 @@
"""Return list of system header files the generated code depends on"""
raise NotImplementedError(self.__class__.__name__)
- def get_system_headers( self, recursive=False ):
+ def get_system_headers( self, recursive=False, unique=False ):
files = [ "boost/python.hpp" ]
files.extend( self._get_system_headers_impl() )
- return filter( None, files)
+ files = filter( None, files)
+ if unique:
+ files = self.unique_headers( files )
+ return files
def beautify( self, code ):
"""
Modified: pyplusplus_dev/pyplusplus/code_creators/compound.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/compound.py 2007-04-15 10:45:52 UTC (rev 987)
+++ pyplusplus_dev/pyplusplus/code_creators/compound.py 2007-04-15 18:51:57 UTC (rev 988)
@@ -76,10 +76,13 @@
internals[index] = internals[index] + os.linesep
return os.linesep.join( internals )
- def get_system_headers( self, recursive=False ):
+ def get_system_headers( self, recursive=False, unique=False ):
files = [ "boost/python.hpp" ]
files.extend( self._get_system_headers_impl() )
if recursive:
for creator in self._creators:
- files.extend( creator.get_system_headers(recursive) )
+ files.extend( creator.get_system_headers(recursive, unique=False) )
+ files = filter( None, files )
+ if unique:
+ files = self.unique_headers( files )
return files
Modified: pyplusplus_dev/pyplusplus/code_creators/module.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/module.py 2007-04-15 10:45:52 UTC (rev 987)
+++ pyplusplus_dev/pyplusplus/code_creators/module.py 2007-04-15 18:51:57 UTC (rev 988)
@@ -150,7 +150,15 @@
@param include_creator: Include creator object
@type include_creator: L{include_t}
"""
- self.adopt_creator( include_creator, self.last_include_index() + 1 )
+ 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()
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-04-15 10:45:52 UTC (rev 987)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-04-15 18:51:57 UTC (rev 988)
@@ -8,7 +8,6 @@
import sort_algorithms
import dependencies_manager
import opaque_types_manager
-import header_files_manager
import call_policies_resolver
from pygccxml import declarations
@@ -90,7 +89,6 @@
self.__types_db = types_database.types_database_t()
self.__extmodule = code_creators.module_t()
- self.__header_files_manager = header_files_manager.manager_t( self.__extmodule )
if boost_python_ns_name:
bp_ns_alias = code_creators.namespace_alias_t( alias=boost_python_ns_name
, full_namespace_name='::boost::python' )
@@ -270,10 +268,7 @@
used_containers = filter( lambda cls: cls.indexing_suite.include_files
, used_containers )
used_containers.sort( cmp_by_name )
- for cls in used_containers:
- map( lambda header: self.__header_files_manager.include(header, system=True)
- , cls.indexing_suite.include_files )
-
+ for cls in used_containers:
for msg in cls.readme():
self.decl_logger.warn( "%s;%s" % ( cls, msg ) )
@@ -304,6 +299,11 @@
creators.reverse()
self.__module_body.adopt_creators( creators, 0 )
+ def __include_header( self, header, system=False ):
+ self.__extmodule.adopt_include( code_creators.include_t( header ) )
+ if system:
+ self.__extmodule.add_system_header( header )
+
def create(self, decl_headers=None):
"""Create and return the module for the extension.
@@ -312,12 +312,6 @@
@returns: Returns the root of the code creators tree
@rtype: L{module_t<code_creators.module_t>}
"""
- if decl_headers is None:
- decl_headers = declarations.declaration_files( self.__decls )
-
- map( lambda header: self.__header_files_manager.include( header )
- , decl_headers )
-
# Invoke the appropriate visit_*() method on all decls
for decl in self.__decls:
self.curr_decl = decl
@@ -331,7 +325,18 @@
creator.target_configuration = self.__target_configuration
#last action.
self._append_user_code()
+ #add system headers
+ system_headers = self.__extmodule.get_system_headers( recursive=True, unique=True )
+ map( lambda header: self.__include_header( header, system=True )
+ , system_headers )
+ #add user defined header files
+ if decl_headers is None:
+ decl_headers = declarations.declaration_files( self.__decls )
+ map( lambda header: self.__include_header( header )
+ , decl_headers )
+
self.__dependencies_manager.inform_user()
+
return self.__extmodule
def visit_member_function( self ):
@@ -340,7 +345,6 @@
self.__dependencies_manager.add_exported( self.curr_decl )
if None is self.curr_decl.call_policies:
self.curr_decl.call_policies = self.__call_policies_resolver( self.curr_decl )
- self.__header_files_manager.include_call_policy( self.curr_decl.call_policies )
maker_cls, fwrapper_cls = creators_wizard.find_out_mem_fun_creator_classes( self.curr_decl )
@@ -367,10 +371,6 @@
self.curr_code_creator.adopt_creator( maker )
self.__opaque_types_manager.register_opaque( maker, self.curr_decl )
- if self.curr_decl.transformations:
- required_headers = self.curr_decl.transformations[0].required_headers()
- self.__header_files_manager.include_ft( required_headers )
-
if self.curr_decl.has_static:
#static_method should be created only once.
found = filter( lambda creator: isinstance( creator, code_creators.static_method_t )
@@ -396,7 +396,6 @@
maker = code_creators.constructor_t( constructor=self.curr_decl, wrapper=cwrapper )
if None is self.curr_decl.call_policies:
self.curr_decl.call_policies = self.__call_policies_resolver( self.curr_decl )
- self.__header_files_manager.include_call_policy( self.curr_decl.call_policies )
self.curr_code_creator.adopt_creator( maker )
def visit_destructor( self ):
@@ -415,7 +414,6 @@
self.__dependencies_manager.add_exported( self.curr_decl )
if None is self.curr_decl.call_policies:
self.curr_decl.call_policies = self.__call_policies_resolver( self.curr_decl )
- self.__header_files_manager.include_call_policy( self.curr_decl.call_policies )
self.__types_db.update( self.curr_decl )
if not self.curr_decl.parent.is_abstract and not declarations.is_reference( self.curr_decl.return_type ):
@@ -447,7 +445,6 @@
self.__dependencies_manager.add_exported( f )
if None is f.call_policies:
f.call_policies = self.__call_policies_resolver( f )
- self.__header_files_manager.include_call_policy( f.call_policies )
overloads_cls_creator = code_creators.free_fun_overloads_class_t( overloads )
self.__extmodule.adopt_declaration_creator( overloads_cls_creator )
@@ -468,13 +465,9 @@
self.__dependencies_manager.add_exported( self.curr_decl )
if None is self.curr_decl.call_policies:
self.curr_decl.call_policies = self.__call_policies_resolver( self.curr_decl )
- self.__header_files_manager.include_call_policy( self.curr_decl.call_policies )
maker = None
if self.curr_decl.transformations:
- required_headers = self.curr_decl.transformations[0].required_headers()
- self.__header_files_manager.include_ft( required_headers )
-
wrapper = code_creators.free_fun_transformed_wrapper_t( self.curr_decl )
self.__extmodule.adopt_declaration_creator( wrapper )
maker = code_creators.free_fun_transformed_t( self.curr_decl, wrapper )
@@ -516,7 +509,6 @@
self.__dependencies_manager.add_exported( f )
if None is f.call_policies:
f.call_policies = self.__call_policies_resolver( f )
- self.__header_files_manager.include_call_policy( f.call_policies )
overloads_cls_creator = code_creators.mem_fun_overloads_class_t( overloads )
self.__extmodule.adopt_declaration_creator( overloads_cls_creator )
@@ -628,7 +620,6 @@
self.__dependencies_manager.add_exported( self.curr_decl )
if declarations.is_array( self.curr_decl.type ):
- self.__header_files_manager.include(code_repository.array_1.file_name, system=True )
if self._register_array_1( self.curr_decl.type ):
array_1_registrator = code_creators.array_1_registrator_t( array_type=self.curr_decl.type )
self.curr_code_creator.adopt_creator( array_1_registrator )
@@ -658,10 +649,8 @@
elif declarations.is_reference( self.curr_decl.type ):
if None is self.curr_decl.getter_call_policies:
self.curr_decl.getter_call_policies = self.__call_policies_resolver( self.curr_decl, 'get' )
- self.__header_files_manager.include_call_policy( self.curr_decl.getter_call_policies )
if None is self.curr_decl.setter_call_policies:
self.curr_decl.setter_call_policies = self.__call_policies_resolver( self.curr_decl, 'set' )
- self.__header_files_manager.include_call_policy( self.curr_decl.setter_call_policies )
wrapper = code_creators.mem_var_ref_wrapper_t( variable=self.curr_decl )
maker = code_creators.mem_var_ref_t( variable=self.curr_decl, wrapper=wrapper )
self.__opaque_types_manager.register_opaque( maker, self.curr_decl )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 10:45:53
|
Revision: 987
http://svn.sourceforge.net/pygccxml/?rev=987&view=rev
Author: roman_yakovenko
Date: 2007-04-15 03:45:52 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
improving generate code - removing system include files, that could not be included
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py
pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
pyplusplus_dev/unittests/algorithms_tester.py
Modified: pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2007-04-15 10:17:05 UTC (rev 986)
+++ pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2007-04-15 10:45:52 UTC (rev 987)
@@ -56,9 +56,13 @@
if self.extmodule.license:
answer.append( self.extmodule.license.create() )
- answer.append( self.create_include_code( [class_creator] ) )
+ creators = [class_creator]
+ if class_creator.wrapper:
+ creators.append( class_creator.wrapper )
+
+ answer.append( self.create_include_code( creators ) )
answer.append( '' )
- answer.append( self.create_namespaces_code( [class_creator] ) )
+ answer.append( self.create_namespaces_code( creators ) )
if class_creator.wrapper:
answer.append( class_creator.wrapper.create() )
Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-04-15 10:17:05 UTC (rev 986)
+++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-04-15 10:45:52 UTC (rev 987)
@@ -12,6 +12,7 @@
from pygccxml import declarations
from pyplusplus import decl_wrappers
from pyplusplus import code_creators
+from pyplusplus import code_repository
#TODO: to add namespace_alias_t classes
class multiple_files_t(writer.writer_t):
@@ -143,16 +144,29 @@
def create_include_code( self, creators, head_headers=None, tail_headers=None ):
answer = []
normalize = code_creators.include_directories_t.normalize
+ unique_headers = code_creators.code_creator_t.unique_headers
+
if head_headers:
answer.extend( map( lambda header: '#include "%s"' % normalize( header )
, head_headers ) )
- # Include all 'global' include files...
- includes = filter( lambda creator: isinstance( creator, code_creators.include_t )
- , self.extmodule.creators )
- answer.extend( map( lambda creator: creator.create(), includes ) )
-
+ dependend_on_headers = []
for creator in creators:
+ dependend_on_headers.extend( creator.get_system_headers( recursive=True ) )
+
+ dependend_on_headers = unique_headers( map( normalize, dependend_on_headers ) )
+
+ include_creators = filter( lambda creator: isinstance( creator, code_creators.include_t )
+ , self.extmodule.creators )
+
+ for include_cc in include_creators:
+ if self.extmodule.is_system_header( include_cc.header ):
+ if include_cc.header in dependend_on_headers:
+ answer.append( include_cc.create() )
+ else:# user header file - always include
+ answer.append( include_cc.create() )
+
+ for creator in creators:
header = self.find_out_value_traits_header( creator )
if header:
answer.append( '#include "%s"' % header )
Modified: pyplusplus_dev/unittests/algorithms_tester.py
===================================================================
--- pyplusplus_dev/unittests/algorithms_tester.py 2007-04-15 10:17:05 UTC (rev 986)
+++ pyplusplus_dev/unittests/algorithms_tester.py 2007-04-15 10:45:52 UTC (rev 987)
@@ -13,6 +13,7 @@
from pyplusplus import module_creator
from pyplusplus import module_builder
from pyplusplus import utils as pypp_utils
+from pyplusplus import function_transformers as ft
class indent_tester_t(unittest.TestCase):
def test( self ):
@@ -150,6 +151,15 @@
int m_dummy;
struct x_nested{};
+
+ float* get_rate(){
+ return 0;
+ }
+
+ virtual void get_size( int& i, int& j ){
+ i = 0;
+ j = 0;
+ }
};
}
"""
@@ -168,7 +178,9 @@
mb.calldefs( 'get_opaque' ).call_policies \
= module_builder.call_policies.return_value_policy( module_builder.call_policies.return_opaque_pointer )
mb.class_( 'op_struct' ).exclude()
-
+ mb.mem_fun( 'get_rate' ).call_policies \
+ = module_builder.call_policies.return_value_policy( module_builder.call_policies.return_pointee_value )
+ mb.mem_fun( 'get_size' ).add_transformation( ft.output(0) )
mb.build_code_creator('x_class_multi')
mb.split_module( autoconfig.build_dir
, [ mb.class_( '::tester::x' ) ]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 10:17:04
|
Revision: 986
http://svn.sourceforge.net/pygccxml/?rev=986&view=rev
Author: roman_yakovenko
Date: 2007-04-15 03:17:05 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
better implementation of "include" method
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/module_creator/creator.py
pyplusplus_dev/pyplusplus/module_creator/header_files_manager.py
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-04-15 10:15:47 UTC (rev 985)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-04-15 10:17:05 UTC (rev 986)
@@ -367,7 +367,7 @@
self.curr_code_creator.adopt_creator( maker )
self.__opaque_types_manager.register_opaque( maker, self.curr_decl )
- if self.curr_decl.transformations:
+ if self.curr_decl.transformations:
required_headers = self.curr_decl.transformations[0].required_headers()
self.__header_files_manager.include_ft( required_headers )
Modified: pyplusplus_dev/pyplusplus/module_creator/header_files_manager.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/header_files_manager.py 2007-04-15 10:15:47 UTC (rev 985)
+++ pyplusplus_dev/pyplusplus/module_creator/header_files_manager.py 2007-04-15 10:17:05 UTC (rev 986)
@@ -19,11 +19,9 @@
def include( self, header, system=False, user_defined=False ):
normalized_header = self.normalize( header )
- if normalized_header in self.__already_included:
- return
- else:
+ if normalized_header not in self.__already_included:
self.__already_included.add( normalized_header )
- self.__extmodule.adopt_include( code_creators.include_t( header, user_defined=user_defined ) )
+ self.__extmodule.adopt_include( code_creators.include_t( header, user_defined=user_defined ) )
if system:
self.__extmodule.add_system_header( header )
@@ -38,7 +36,6 @@
def include_ft( self, required_headers ): #include function transformation headers
required_headers = map( self.normalize, required_headers )
for header in required_headers:
- # Check whether the header is already included
system = bool( header in code_repository.headers )
self.include( header, system=system, user_defined=True )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 10:15:45
|
Revision: 985
http://svn.sourceforge.net/pygccxml/?rev=985&view=rev
Author: roman_yakovenko
Date: 2007-04-15 03:15:47 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
fixing required headers reporting
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/calldef.py
pyplusplus_dev/pyplusplus/code_creators/calldef_transformed.py
pyplusplus_dev/pyplusplus/code_creators/module.py
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-04-15 10:10:24 UTC (rev 984)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-04-15 10:15:47 UTC (rev 985)
@@ -180,6 +180,8 @@
if self.declaration.transformations:
ft = self.declaration.transformations[0]
files.extend( ft.required_headers() )
+ if self.declaration.call_policies:
+ files.append( self.declaration.call_policies.header_file )
return files
class free_function_t( calldef_t ):
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef_transformed.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef_transformed.py 2007-04-15 10:10:24 UTC (rev 984)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef_transformed.py 2007-04-15 10:15:47 UTC (rev 985)
@@ -9,9 +9,9 @@
import calldef_utils
import class_declaration
from pygccxml import declarations
+from pyplusplus import code_repository
from calldef import calldef_t, calldef_wrapper_t
import pyplusplus.function_transformers as function_transformers
-from pyplusplus import code_repository
#TODO: constructors also can have transformation defined. We should use make _init
# function for this purpose
@@ -416,3 +416,8 @@
def _create_impl(self):
return os.linesep.join([ self.create_override(), '', self.create_default() ])
+
+ def _get_system_headers_impl( self ):
+ files = super( mem_fun_v_transformed_wrapper_t, self )._get_system_headers_impl()
+ files.append( code_repository.convenience.file_name )
+ return files
Modified: pyplusplus_dev/pyplusplus/code_creators/module.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/module.py 2007-04-15 10:10:24 UTC (rev 984)
+++ pyplusplus_dev/pyplusplus/code_creators/module.py 2007-04-15 10:15:47 UTC (rev 985)
@@ -27,7 +27,9 @@
def add_system_header( self, header ):
normalize = include_directories.include_directories_t.normalize
- self.__system_headers.append( normalize( header ) )
+ normalized_header = normalize( header )
+ if normalized_header not in self.__system_headers:
+ self.__system_headers.append( normalized_header )
def is_system_header( self, header ):
normalize = include_directories.include_directories_t.normalize
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-04-15 10:10:23
|
Revision: 984
http://svn.sourceforge.net/pygccxml/?rev=984&view=rev
Author: roman_yakovenko
Date: 2007-04-15 03:10:24 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
making required_headers method to be "pure virtual"
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/function_transformers/transformer.py
pyplusplus_dev/pyplusplus/function_transformers/transformers.py
Modified: pyplusplus_dev/pyplusplus/function_transformers/transformer.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/transformer.py 2007-04-15 06:33:36 UTC (rev 983)
+++ pyplusplus_dev/pyplusplus/function_transformers/transformer.py 2007-04-15 10:10:24 UTC (rev 984)
@@ -12,13 +12,14 @@
return_ = -1
#return_ is a spacial const, which represent an index of return type
-class transformer_t:
+class transformer_t(object):
"""Base class for a function transformer."""
USE_1_BASED_INDEXING = False
def __init__(self, function):
"""@param function: reference to function declaration"""
+ object.__init__( self )
self.__function = function
@property
@@ -28,7 +29,7 @@
def required_headers( self ):
"""Returns list of header files that transformer generated code depends on."""
- return []
+ raise NotImplementedError( self.__class__.__name__ )
def get_argument( self, reference ):
"""returns reference to the desired argument
Modified: pyplusplus_dev/pyplusplus/function_transformers/transformers.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2007-04-15 06:33:36 UTC (rev 983)
+++ pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2007-04-15 10:10:24 UTC (rev 984)
@@ -145,6 +145,9 @@
def configure_virtual_mem_fun( self, controller ):
self.__configure_v_mem_fun_default( controller.default_controller )
+ def required_headers( self ):
+ """Returns list of header files that transformer generated code depends on."""
+ return []
# input_t
class input_t(type_modifier_t):
@@ -533,4 +536,8 @@
def configure_virtual_mem_fun( self, controller ):
raise NotImplementedError()
+
+ def required_headers( self ):
+ """Returns list of header files that transformer generated code depends on."""
+ return []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|