[pygccxml-commit] SF.net SVN: pygccxml:[1662]
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2009-02-08 13:54:02
|
Revision: 1662
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1662&view=rev
Author: roman_yakovenko
Date: 2009-02-08 13:53:58 +0000 (Sun, 08 Feb 2009)
Log Message:
-----------
sphinx
Modified Paths:
--------------
pygccxml_dev/pygccxml/binary_parsers/parsers.py
pygccxml_dev/pygccxml/binary_parsers/undname.py
pyplusplus_dev/pyplusplus/__init__.py
pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py
pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
pyplusplus_dev/pyplusplus/code_creators/code_creator.py
pyplusplus_dev/pyplusplus/code_creators/enum.py
pyplusplus_dev/pyplusplus/code_creators/include_directories.py
pyplusplus_dev/pyplusplus/code_creators/member_variable.py
pyplusplus_dev/pyplusplus/code_creators/name_mappings.py
pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py
pyplusplus_dev/pyplusplus/creators_factory/bpcreator.py
pyplusplus_dev/pyplusplus/creators_factory/types_database.py
pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py
pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py
pyplusplus_dev/pyplusplus/file_writers/__init__.py
pyplusplus_dev/pyplusplus/file_writers/balanced_files.py
pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py
pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
pyplusplus_dev/pyplusplus/function_transformers/__init__.py
pyplusplus_dev/pyplusplus/function_transformers/transformer.py
pyplusplus_dev/pyplusplus/function_transformers/transformers.py
pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py
sphinx/ignore_dictionary.txt
Modified: pygccxml_dev/pygccxml/binary_parsers/parsers.py
===================================================================
--- pygccxml_dev/pygccxml/binary_parsers/parsers.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pygccxml_dev/pygccxml/binary_parsers/parsers.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -70,14 +70,14 @@
def load_symbols( self ):
"""loads public( shared ) symbols from the binary file.
- This method should be overiden in the derived classes.
+ This method should be overridden in the derived classes.
"""
raise NotImplementedError()
def merge( self, symbol):
"""extracts and merges information from the symbol to the declarations tree.
- This method should be overiden in the derived classes.
+ This method should be overridden in the derived classes.
"""
raise NotImplementedError()
@@ -132,7 +132,7 @@
formated_mapping_parser_t.__init__( self, global_ns, map_file_path, 'msvc' )
def load_symbols( self ):
- """returns dictionary { decorated symbol : orignal declaration name }"""
+ """returns dictionary { decorated symbol : original declaration name }"""
f = file( self.binary_file )
lines = []
was_exports = False
Modified: pygccxml_dev/pygccxml/binary_parsers/undname.py
===================================================================
--- pygccxml_dev/pygccxml/binary_parsers/undname.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pygccxml_dev/pygccxml/binary_parsers/undname.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -8,7 +8,7 @@
unique names and map them to the declarations
On Windows:
- ctypes package is used to call UnDecorateSymbolName function from dbghelp.dll
+ ctypes package is used to call `UnDecorateSymbolName` function from `dbghelp.dll`
On Linux:
"nm" utility is used.
@@ -21,7 +21,7 @@
from pygccxml import declarations
class UNDECORATE_NAME_OPTIONS:
- """defines few constants for UnDecorateSymbolName function"""
+ """defines few constants for `UnDecorateSymbolName` function"""
UNDNAME_COMPLETE = 0x0000 #Enables full undecoration.
UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords.
@@ -200,12 +200,12 @@
def format_decl(self, decl, hint=None):
"""returns string, which contains full function name formatted exactly as
- result of dbghelp.UnDecorateSymbolName, with UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_ECSU
+ result of `dbghelp.UnDecorateSymbolName`, with UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_ECSU
options.
- Different compilers\utilities undecorate/demangle magled string ( unique names ) in a different way.
- hint argument will tell pygccxml how to format declarations, so it couls be mapped later to the blob.
- The valid options are" msvc, nm
+ Different compilers\utilities undecorate/demangle mangled string ( unique names ) in a different way.
+ `hint` argument will tell pygccxml how to format declarations, so they could be mapped later to the blobs.
+ The valid options are: "msvc" and "nm".
"""
name = None
if hint is None:
Modified: pyplusplus_dev/pyplusplus/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/__init__.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/__init__.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -15,7 +15,7 @@
in the headers. You can then modify (decorate) this tree to customize
the bindings. After that, a I{code creators} tree is created where
each node represents a block of C++ source code. So you can change any piece of
-code befor it is written to disk. As a last step, these source code blocks are
+code before it is written to disk. As a last step, these source code blocks are
finally written into one or more C++ source files, which can then be compiled to
generate the final Python module.
@@ -40,7 +40,7 @@
if not hasattr( pygccxml, '__revision__' ) or pygccxml.__revision__ < 1080:
msg = 'This revision of `Py++` requieres pygccxml revision to be ' \
'greater or equal to %d. ' \
- 'Please install right pygccxml version.'
+ 'Please install right pygccxml version.'
raise AssertionError( msg % pygccxml.__revision__ )
#Known issues:
Modified: pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py
===================================================================
--- pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -66,15 +66,15 @@
def formatMessage(msgline, width=70):
"""Format a long single line message so that it is easier to read.
- msgline is a string containing a single message. It can either be
- a plain message string which is reformatted using the textwrap
+ `msgline` is a string containing a single message. It can either be
+ a plain message string which is reformatted using the :mod:`textwrap`
module or it can be of the form <declaration>;<message> where <declaration>
is the declaration string and <message> an arbitrary message. Lines of this
form will be separated so that the declaration and the message appear in
individual text blocks, where every line of message will start
with '>' character.
- width is the maximum width of any text blocks (without indendation).
+ width is the maximum width of any text blocks (without indentation).
"""
txts = msgline.split(";")
# Ensure that there are no more than two items in txts
Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -325,10 +325,9 @@
def _get_system_files_impl( self ):
return []
-#open question: should I put class wrapper under some specifiec namespace?
class class_wrapper_t( scoped.scoped_t ):
"""
- Creates C++ code that creates wrapper arround some class
+ creates C++ code, which creates wrapper around a class
"""
def __init__(self, declaration, class_creator ):
Modified: pyplusplus_dev/pyplusplus/code_creators/code_creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -17,9 +17,9 @@
The purpose of a code creator is the generation of a block of C++
source code as it will appear in the final source code for the
- extension module. The source code is obtained by calling the L{create()}
- method. Derived classes must implement the L{_create_impl()} method
- which is called by the create() method.
+ extension module. The source code is obtained by calling the :meth:`code_creator_t.create`
+ method. Derived classes must implement the :meth:`code_creator_t._create_impl` method
+ which is called by the :meth:`code_creator_t.create` method.
"""
PYPLUSPLUS_NS_NAME = 'pyplusplus'
__INDENTATION = ' '
@@ -101,7 +101,7 @@
def create(self):
"""
generates source code
-
+
:rtype: str
"""
code = self._create_impl()
@@ -197,8 +197,8 @@
:type line: str
:param language: the programming language, the line was written in. Possible values: C++, Python
:type line: str
-
- :rtype: bool
+
+ :rtype: bool
"""
assert isinstance( line, types.StringTypes )
l = line.lstrip()
Modified: pyplusplus_dev/pyplusplus/code_creators/enum.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/enum.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/code_creators/enum.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -12,7 +12,7 @@
class enum_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
"""
- Creates boost.python code that expose C++ enum
+ create code that exposes C++ enumeration
"""
def __init__(self, enum ):
registration_based.registration_based_t.__init__( self )
Modified: pyplusplus_dev/pyplusplus/code_creators/include_directories.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/include_directories.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/code_creators/include_directories.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -10,8 +10,8 @@
class include_directories_t(instruction.instruction_t):
"""
The instance of this class holds a list of user defined directories.
- L{include_t} and {precompiled_header_t} code creators use it to generate
- relative include directives.
+ :class:`code_creators.include_t` and :class:`code_creators.precompiled_header_t`
+ code creators use it to generate relative include directives.
"""
def __init__(self):
instruction.instruction_t.__init__(self)
@@ -21,7 +21,7 @@
@staticmethod
def normalize( path ):
return os.path.normpath( os.path.normcase( path ) )
-
+
def _get_user_defined(self):
self._user_defined = map( self.normalize, self._user_defined )
return self._user_defined
@@ -41,7 +41,7 @@
headers.append( self.normalize( header ) )
dname = os.path.commonprefix( headers )
return dname in headers[:-1]
-
+
def is_user_defined(self, header):
return not self.is_std( header )
@@ -62,15 +62,14 @@
headers = self.std + self.user_defined
answer = self._remove_common_prefix( header, headers )
return answer.replace( '\\', '/' )
-
+
def _generate_description(self):
desc = ["std directories: " + pprint.pformat( self.std )]
- temp = pprint.pformat( self.user_defined )
+ temp = pprint.pformat( self.user_defined )
if os.linesep not in temp:
#fixing bug on windows where linesep == \n\r
#while pformat uses \n
temp = temp.replace( '\n', os.linesep )
desc.append( "user defined directories: " + temp )
return os.linesep.join( desc )
-
-
\ No newline at end of file
+
Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -167,7 +167,7 @@
class member_variable_wrapper_t( code_creator.code_creator_t
, declaration_based.declaration_based_t ):
"""
- Creates C++ code that creates accessor for pointer class variables
+ creates get/set accessors for class variables, that has type pointer
"""
#TODO: give user a way to set call policies
# treat void* pointer
@@ -316,7 +316,7 @@
class bit_field_wrapper_t( code_creator.code_creator_t
, declaration_based.declaration_based_t ):
"""
- Creates C++ code that creates accessor for bit fields
+ creates get/set accessors for bit fields
"""
indent = code_creator.code_creator_t.indent
@@ -431,13 +431,9 @@
return []
-#TODO: generated fucntion should be static and take instance of the wrapped class
-#as first argument.
class array_mv_wrapper_t( code_creator.code_creator_t
, declaration_based.declaration_based_t ):
- """
- Creates C++ code that register array class.
- """
+ """registers array class"""
def __init__(self, variable ):
code_creator.code_creator_t.__init__( self )
@@ -499,7 +495,7 @@
class mem_var_ref_t( member_variable_base_t ):
"""
- Creates C++ code that creates accessor for class member variable, that has type reference.
+ creates get/set accessors for class member variable, that has type reference.
"""
def __init__(self, variable, wrapper ):
member_variable_base_t.__init__( self, variable=variable, wrapper=wrapper )
@@ -554,7 +550,7 @@
class mem_var_ref_wrapper_t( code_creator.code_creator_t
, declaration_based.declaration_based_t ):
"""
- Creates C++ code that creates accessor for class member variable, that has type reference.
+ creates get/set accessors for class member variable, that has type reference.
"""
indent = code_creator.code_creator_t.indent
Modified: pyplusplus_dev/pyplusplus/code_creators/name_mappings.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/name_mappings.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/code_creators/name_mappings.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -8,7 +8,7 @@
class name_mappings_t(code_creator.code_creator_t):
- """creates dictionery { [un]decorated name : [un]decorated name }"""
+ """creates dictionary { [un]decorated name : [un]decorated name }"""
def __init__( self, exported_symbols ):
code_creator.code_creator_t.__init__(self)
Modified: pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -12,14 +12,14 @@
templates = declarations.templates
class held_type_t(object):
- """ Helper class that can hold name of smart_ptr type and create
+ """ Helper class that can hold name of `smart_ptr` type and create
identifier for held type from that given a creator.
"""
def __init__( self, smart_ptr ):
- """ smart_ptr: string of ptr type. Ex: 'boost::shared_ptr' """
+ """ smart_ptr: string of ptr type. Ex: `boost::shared_ptr`"""
object.__init__( self )
self._smart_ptr = smart_ptr
-
+
def _get_smart_ptr( self ):
return self._smart_ptr
def _set_smart_ptr( self, ptr ):
@@ -28,26 +28,28 @@
def create( self, creator):
""" Return string of type to use for held type.
- Ex: boost::shared_ptr<Class>
+ Ex: `boost::shared_ptr` class
"""
smart_ptr = algorithm.create_identifier( creator, self.smart_ptr )
arg = algorithm.create_identifier( creator, creator.declaration.decl_string )
return templates.join( smart_ptr, [ arg ] )
-
+
class smart_pointer_registrator_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
- """ Convertor for boost::python::register_ptr_to_python<PTR>.
- Lets boost python know that it can use smart_ptr to hold a an object.
- See: http://www.boost.org/libs/python/doc/v2/register_ptr_to_python.html
"""
+ Converter for `boost::python::register_ptr_to_python`.
+
+ Lets boost python know that it can use `smart_ptr` to hold a an object.
+ See: http://www.boost.org/libs/python/doc/v2/register_ptr_to_python.html
+ """
def __init__( self, smart_ptr, class_creator ):
- """ smart_ptr: string of ptr type. Ex: 'boost::shared_ptr' """
+ """`smart_ptr`: string of pointer type. Ex: `boost::shared_ptr`"""
registration_based.registration_based_t.__init__( self )
declaration_based.declaration_based_t.__init__( self, class_creator.declaration )
self._smart_ptr = smart_ptr
self._class_creator = class_creator
self.works_on_instance = False
-
+
def _get_smart_ptr( self ):
return self._smart_ptr
def _set_smart_ptr( self, ptr ):
@@ -60,7 +62,7 @@
self._class_creator = cc
class_creator = property( _get_class_creator, _set_class_creator )
- def _create_impl(self):
+ def _create_impl(self):
if self.declaration.already_exposed:
return ''
if self.class_creator \
@@ -76,7 +78,7 @@
def _get_system_files_impl( self ):
return []
-
+
class smart_pointers_converter_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
""" creator for boost::python::implicitly_convertible.
@@ -94,27 +96,26 @@
def _get_target(self):
return self._target
target = property( _get_target )
-
+
def _get_source(self):
return self.declaration
source = property( _get_source )
-
+
def _get_smart_ptr( self ):
return self._smart_ptr
def _set_smart_ptr( self, ptr ):
self._smart_ptr = ptr
- smart_ptr = property( _get_smart_ptr, _set_smart_ptr )
+ smart_ptr = property( _get_smart_ptr, _set_smart_ptr )
def _instantiate_smart_ptr( self, decl ):
identifier = algorithm.create_identifier( self, decl.partial_decl_string )
return templates.join( self.smart_ptr, [identifier] )
-
- def _create_impl(self):
+
+ def _create_impl(self):
implicitly_convertible = algorithm.create_identifier( self, '::boost::python::implicitly_convertible' )
from_arg = self._instantiate_smart_ptr( self.source )
to_arg = self._instantiate_smart_ptr( self.target )
- return templates.join(implicitly_convertible, [ from_arg, to_arg ] ) + '();'
-
+ return templates.join(implicitly_convertible, [ from_arg, to_arg ] ) + '();'
+
def _get_system_files_impl( self ):
return []
-
\ No newline at end of file
Modified: pyplusplus_dev/pyplusplus/creators_factory/bpcreator.py
===================================================================
--- pyplusplus_dev/pyplusplus/creators_factory/bpcreator.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/creators_factory/bpcreator.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -204,9 +204,10 @@
assert not "unknown instace of registrator: " % str( registered )
def _treat_smart_pointers( self ):
- """ Go to all class creators and apply held_type and creator registrators
- as needed.
"""
+ goes over all class creators and apply held_type and registers smart pointers
+ classes as needed
+ """
find_classes = code_creators.creator_finder.find_by_class_instance
class_creators = find_classes( what=code_creators.class_t
, where=self.__extmodule.body.creators
@@ -324,8 +325,8 @@
create and return the module for the extension - code creators tree root.
:param decl_headers: If None the headers for the wrapped decls are automatically found.
- But you can pass a list of headers here to override that search.
- @rtype: :class:`code_creators.module_t`
+ But you can pass a list of headers here to override that search.
+ :rtype: :class:`code_creators.module_t`
"""
# Invoke the appropriate visit_*() method on all decls
for decl in self.__decls:
Modified: pyplusplus_dev/pyplusplus/creators_factory/types_database.py
===================================================================
--- pyplusplus_dev/pyplusplus/creators_factory/types_database.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/creators_factory/types_database.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -15,11 +15,11 @@
self.__variables = {} # decl_string : [type]
self.__return_types = {} # decl_string : [type]
self.__arguments_types = {} #decl_string : [type]
- self.__smart_ptrs = [ 'shared_ptr', 'auto_ptr' ]
+ self.__smart_ptrs = [ 'shared_ptr', 'auto_ptr' ]
self.__fundamental_strs = declarations.FUNDAMENTAL_TYPES.keys()
self.__normalize_data = [ ',', '<', '>', '*', '&', '(', ')', '::' ]
self.__containers = set()
-
+
def update( self, decl ):
if isinstance( decl, declarations.calldef_t ):
if not isinstance( decl, declarations.constructor_t ):
@@ -30,13 +30,13 @@
self._update_db( self.__variables, decl.type )
else:
assert not "types_database_t class can not process " + str( decl )
-
+
def _is_relevant(self, decl_string):
for smart_ptr in self.__smart_ptrs:
if smart_ptr in decl_string:
return True
return False
-
+
def _is_relevant_inst( self, name, args ):
return self._is_relevant( name )
@@ -53,68 +53,68 @@
#will return True is type was treated
type_ = declarations.remove_alias( type_ )
type_ = declarations.remove_pointer( type_ )
- type_ = declarations.remove_reference( type_ )
- type_ = declarations.remove_cv( type_ )
- type_ = declarations.remove_declarated( type_ )
-
+ type_ = declarations.remove_reference( type_ )
+ type_ = declarations.remove_cv( type_ )
+ type_ = declarations.remove_declarated( type_ )
+
class_traits = declarations.class_traits
class_declaration_traits = declarations.class_declaration_traits
if not class_traits.is_my_case( type_ ) and not class_declaration_traits.is_my_case( type_ ):
return False
-
+
if class_traits.is_my_case( type_ ):
container_cls = class_traits.get_declaration( type_ )
else:
container_cls = class_declaration_traits.get_declaration( type_ )
-
+
if None is container_cls.indexing_suite:
return False
-
- try:
+
+ try:
#check extraction of element type from container
container_cls.indexing_suite.element_type
except RuntimeError:
decls_logger = _logging_.loggers.declarations
if not messages.filter_disabled_msgs([messages.W1042], container_cls.disabled_messages ):
- return #user disabled property warning
- decls_logger.warn( "%s;%s" % ( container_cls, messages.W1042 ) )
+ return #user disabled property warning
+ decls_logger.warn( "%s;%s" % ( container_cls, messages.W1042 ) )
self.__containers.add( container_cls )
return True
-
+
def _update_db( self, db, type_ ):
if self._update_containers_db( type_ ):
return
- decl_string = self._normalize( declarations.base_type( type_ ).decl_string )
+ decl_string = self._normalize( declarations.base_type( type_ ).decl_string )
if not templates.is_instantiation( decl_string ):
- return
+ return
if not self._is_relevant( decl_string ):
return
insts = filter( lambda inst: self._is_relevant_inst( inst[0], inst[1] )
- , templates.split_recursive( decl_string ) )
+ , templates.split_recursive( decl_string ) )
for smart_ptr, args in insts:
- assert len( args ) == 1
+ assert len( args ) == 1
pointee = self._normalize( args[0] )
if not db.has_key(pointee):
db[ pointee ] = []
smart_ptr = self._normalize( smart_ptr )
if (smart_ptr, type_) not in db[pointee]:
db[ pointee ].append( (smart_ptr, type_) )
-
+
def _find_smart_ptrs( self, db, class_decl ):
decl_string = self._normalize( class_decl.decl_string )
if db.has_key( decl_string ):
return db[ decl_string ]
else:
return None
-
+
def create_holder( self, class_decl ):
#holder should be created when we pass object created in python
#as parameter to function in C++ that takes the smart pointer by reference
found = self._find_smart_ptrs( self.__arguments_types, class_decl )
if not found:
return None#not found or ambiguty
-
+
held_type = None
for smart_ptr, type_ in found:
if declarations.is_reference( type_ ) and not declarations.is_const( type_.base ):
@@ -122,7 +122,7 @@
if not held_type or 'shared_ptr' in smart_ptr:
held_type = temp
return held_type
-
+
def _create_registrators_from_db( self, db, class_creator, registered ):
spregistrator_t = code_creators.smart_pointer_registrator_t
found = self._find_smart_ptrs( db, class_creator.declaration )
@@ -133,11 +133,14 @@
, registered )
if not already_registered:
registered.append( spregistrator_t( smart_ptr=smart_ptr, class_creator=class_creator) )
-
+
def create_registrators( self, class_creator ):
- """ Look for places where the class may be used as smart_ptr.
- - If found then create smart_pointer_registrator_t for that class and ptr type.
"""
+ looks for all places where the class may be used as smart pointer.
+
+ If found, then creates :class:`code_creators.smart_pointer_registrator_t`
+ for that class and pointer type.
+ """
spconverter_t = code_creators.smart_pointers_converter_t
registrators = []
dbs = [ self.__arguments_types, self.__return_types, self.__variables ]
@@ -163,20 +166,20 @@
, target=class_creator.declaration )
answer.append( converter )
return answer
-
+
def _print_single_db(self, db):
for decl_string in db.keys():
print 'decl_string : ', decl_string
for smart_ptr, type_ in db[ decl_string ]:
print ' smart_ptr : ', smart_ptr
print ' type_ : ', type_.decl_string
-
+
def print_db( self ):
dbs = [ self.__arguments_types, self.__return_types, self.__variables ]
for db in dbs:
self._print_single_db( db )
-
+
def _get_used_containers( self ):
return self.__containers
used_containers = property( _get_used_containers)
-
+
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -14,7 +14,7 @@
from pyplusplus import function_transformers as ft
class calldef_t(decl_wrapper.decl_wrapper_t):
- """base class, for code generator configration, for function declaration classes."""
+ """base class, for code generator configuration, for function declaration classes."""
BOOST_PYTHON_MAX_ARITY = 10
"""Boost.Python configuration macro value.
@@ -125,13 +125,14 @@
@property
def non_overridable_reason( self ):
- """returns the reason the function could not be overriden"""
+ """returns the reason the function could not be overridden"""
return self._non_overridable_reason
def mark_as_non_overridable( self, reason ):
- """mark this function as non-overridable
+ """
+ mark this function as final - user will not be able to override it from Python
- Not all fucntions could be overrided from Python, for example virtual function
+ Not all functions could be overridden 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.
"""
@@ -248,7 +249,7 @@
self._default_precall_code = []
def add_override_precall_code(self, code):
- """add code, which should be executed, before overrided member function call"""
+ """add code, which should be executed, before overridden member function call"""
self._override_precall_code.append( code )
@property
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -12,7 +12,7 @@
"""defines a set of properties, that will instruct `Py++` how to expose the typedef
Today, `Py++` does not exposes typedefs, but this could be changed in future.
- In C++, it is a common practises to give an aliases to the class. May be in
+ In C++, it is a common practices to give an aliases to the class. May be in
future, `Py++` will generate code, that will register all those aliases.
"""
@@ -20,7 +20,7 @@
declarations.typedef_t.__init__(self, *arguments, **keywords )
decl_wrapper.decl_wrapper_t.__init__( self )
self.__is_directive = None
-
+
@property
def is_directive( self ):
if None is self.__is_directive:
Modified: pyplusplus_dev/pyplusplus/file_writers/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/__init__.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/file_writers/__init__.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -4,16 +4,7 @@
# http://www.boost.org/LICENSE_1_0.txt)
"""
-This package contains few classes, that writes L{code_creators.module_t} to files.
-
-Right now 3 strategies were implemented:
-
- 1. All code is written in one file
-
- 2. Classic strategy of deviding classes to files: one class in one header + source files.
-
- 2.1 Huge classes are splitten to few source files.
-
+This package contains few classes, which write :class:`code_creators.module_t` to files.
"""
import types
@@ -47,7 +38,7 @@
return mfs.written_files
def write_balanced_files( extmodule, dir_path, number_of_buckets, files_sum_repository=None, encoding='ascii' ):
- """writes extmodule to fixed number of multiple cpp files"""
+ """writes extmodule to fixed number of multiple .cpp files"""
mfs = balanced_files_t( extmodule, dir_path, number_of_buckets, files_sum_repository=files_sum_repository, encoding=encoding )
mfs.write()
return mfs.written_files
Modified: pyplusplus_dev/pyplusplus/file_writers/balanced_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/balanced_files.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/file_writers/balanced_files.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -3,7 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-"""defines a class that writes L{code_creators.bpmodule_t} to multiple files"""
+"""defines a class that writes :class:`code_creators.bpmodule_t` to multiple files"""
import os
import math
@@ -34,7 +34,7 @@
"""Constructor.
:param extmodule: The root of a code creator tree
- :type extmodule: bpmodule_t
+ :type extmodule: :class:`code_creators.bpmodule_t`
:param directory_path: The output directory where the source files are written
:type directory_path: str
@@ -48,15 +48,15 @@
def split_classes( self ):
class_creators = filter( lambda x: isinstance(x, ( code_creators.class_t, code_creators.class_declaration_t ) )
, self.extmodule.body.creators )
-
- class_creators = filter( lambda cc: not cc.declaration.already_exposed
+
+ class_creators = filter( lambda cc: not cc.declaration.already_exposed
, class_creators )
-
- buckets = split_sequence(class_creators, len(class_creators)/self.number_of_buckets )
+
+ buckets = split_sequence(class_creators, len(class_creators)/self.number_of_buckets )
if len(buckets) > self.number_of_buckets:
buckets[len(buckets)-2] += buckets[len(buckets)-1]
- buckets = buckets[:len(buckets)-1]
-
+ buckets = buckets[:len(buckets)-1]
+
for index, bucket in enumerate( buckets ):
self.split_creators( bucket
, '_classes_%d' % (index+1)
Modified: pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -3,7 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-"""defines a class that writes L{code_creators.bpmodule_t} to multiple files, the class
+"""defines a class that writes :class:`code_creators.bpmodule_t` to multiple files, the class
also splits huge C++ classes to few source files
"""
@@ -24,7 +24,7 @@
2. pyplusplus will generate
wrapper header - header that will contain code generated for class wrappers
classes h/cpp - will contain registration code for internal classes
- memfun h/cpp - will contain registration code for member functions
+ `memfun` h/cpp - will contain registration code for member functions
alias + _main h/cpp this class will contain main registration function.
"""
@@ -69,7 +69,7 @@
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( creators ) )
Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -3,7 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-"""defines a class that writes L{code_creators.bpmodule_t} to multiple files"""
+"""defines a class that writes :class:`code_creators.bpmodule_t` to multiple files"""
import os
import writer
@@ -117,8 +117,6 @@
:param file_name: A string that uniquely identifies the file name
:type file_name: str
- :param function_name: The name of the register_xyz() function
- :type function_name: str
:rtype: str
"""
tmpl = os.linesep.join([
@@ -221,10 +219,12 @@
:param file_name: The base name of the corresponding include file (without extension)
:type file_name: str
- :param function_name: The name of the register_xyz() function
+
+ :param function_name: "register" function name
:type function_name: str
- :param creators: The code creators that create the register_xyz() function
- :type creators: list of code_creator_t
+
+ :param creators: "register" function code creators
+ :type creators: list of :class:`code_creators.code_creator_t`
:rtype: str
"""
declaration_creators = []
@@ -334,12 +334,15 @@
"""Write non-class creators into a particular .h/.cpp file.
:param creators: The code creators that should be written
- :type creators: list of code_creator_t
+ :type creators: list of :class:`code_creators.code_creator_t`
+
:param pattern: Name pattern that is used for constructing the final output file name
:type pattern: str
- :param function_name: The name of the register_xyz() function
+
+ :param function_name: "register" function name
:type function_name: str
- :param registrator_pos: The position of the code creator that creates the code to invoke the register_xyz() function.
+
+ :param registrator_pos: The position of the code creator that creates the code to invoke the "register" function.
:type registrator_pos: int
"""
if not creators:
@@ -385,17 +388,18 @@
creators = filter( lambda x: isinstance(x, free_functions ), self.extmodule.body.creators )
self.split_creators( creators, '_free_functions', 'register_free_functions', -1 )
- #TODO: move write_main to __init__
def write(self):
- """ Write out the module.
- Creates a separate source/header combo for each class and for enums, globals,
- and free functions.
- If write_main is True it writes out a main file that calls all the registration methods.
- After this call split_header_names and split_method_names will contain
- all the header files and registration methods used. This can be used by
- user code to create custom registration methods if main is not written.
"""
+ writes out the module.
+ Creates a separate source/header combo for each class and for enumerations,
+ globals and free functions.
+ If :meth:`write_main` is True it writes out a main file that calls all the registration methods.
+ After this call :meth:`split_header_names` and :meth:`split_method_names`
+ will contain all the header files and registration methods used. This
+ can be used by user code to create custom registration methods if main is not written.
+ """
+
self.write_code_repository( self.__directory_path )
self.save_exposed_decls_db( self.__directory_path )
Modified: pyplusplus_dev/pyplusplus/function_transformers/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/__init__.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/function_transformers/__init__.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -1,21 +1,7 @@
# Helper classes for wrapper function creation
-"""This sub-package provides text substitution services for creating C++ functions.
+"""This sub-package implements function transformation functionality"""
-The helper classes in this package are meant to be used by the actual
-calldef code creators (that are not part of this sub-package). They
-implement the core of the "arg policy" mechanism which can be used by
-a user to modify the source code for a function.
-
-The main class of this sub-package is the class L{substitution_manager_t}. This
-class maintains two sets of special variables, one for the wrapper function
-and one for the virtual function, and provides text substitution services.
-The variables contain parts of source code that can be inserted into the
-function source code template which is generated by the user of the class.
-
-
-"""
-
from transformer import transformer_t
import transformers
from function_transformation import function_transformation_t
Modified: pyplusplus_dev/pyplusplus/function_transformers/transformer.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/transformer.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/function_transformers/transformer.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -14,15 +14,15 @@
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
+ @property
def function( self ):
"""reference to the function, for which a wrapper will be generated"""
return self.__function
@@ -33,7 +33,7 @@
def get_argument( self, reference ):
"""returns reference to the desired argument
-
+
:param reference: name( str ) or index( int ) of the argument
"""
if isinstance( reference, str ):
@@ -49,9 +49,9 @@
def get_type( self, reference ):
"""returns type of the desired argument or return type of the function
-
+
:param reference: name( str ) or index( int ) of the argument
- """
+ """
global return_
if isinstance( reference, int ) and reference == return_:
return self.function.return_type
@@ -59,35 +59,36 @@
return self.get_argument( reference ).type
def configure_mem_fun( self, controller ):
- """Transformers should overridde the method, in order to define custom
+ """Transformers should override the method, in order to define custom
transformation for non-virtual member function.
-
- :param controller: instance of L{mem_fun_controller_t} class
+
+ :param controller: instance of :class:`mem_fun_controller_t` class
"""
raise NotImplementedError(self.__class__.__name__)
-
+
def configure_free_fun( self, controller ):
- """Transformers should overridde the method, in order to define custom
+ """
+ transformers should override the method, in order to define custom
transformation for free function.
-
+
:param controller: instance of L{free_fun_controller_t} class
- """
+ """
raise NotImplementedError(self.__class__.__name__)
-
+
def configure_virtual_mem_fun( self, controller ):
- """Transformers should overridde the method, in order to define custom
+ """Transformers should override the method, in order to define custom
transformation for virtual member function.
-
- :param controller: instance of L{virtual_mem_fun_controller_t} class
- """
+
+ :param controller: instance of :class:`virtual_mem_fun_controller_t` class
+ """
raise NotImplementedError(self.__class__.__name__)
#TODO: FT for constructor
#~ def configure_constructor( self, controller ):
- #~ """Transformers should overridde the method, in order to define custom
+ #~ """Transformers should override the method, in order to define custom
#~ transformation for constructor.
-
+
#~ :param controller: instance of L{constructor_controller_t} class
- #~ """
+ #~ """
#~ raise NotImplementedError(self.__class__.__name__)
-
+
Modified: pyplusplus_dev/pyplusplus/function_transformers/transformers.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/function_transformers/transformers.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -5,17 +5,8 @@
#
# Initial author: Matthias Baas
-"""This module contains the standard argument policy objects.
+"""defines few argument transformation classes"""
-The following policies are available:
-
- - L{output_t}
- - L{input_t}
- - L{inout_t}
- - L{input_array_t}
- - L{output_array_t}
- - L{type_modifier_t}
-"""
import os
import string
import transformer
@@ -56,7 +47,7 @@
The specified argument must be a reference or a pointer.
- :param arg_ref: Index of the argument that is an output value (the first arg has index 1).
+ :param arg_ref: Index of the argument that is an output value.
:type arg_ref: int
"""
self.arg = self.get_argument( arg_ref )
@@ -155,15 +146,12 @@
The reference on the specified variable is removed.
- void setValue(int& v) -> setValue(v)
+ void set_value(int& v) -> void set_value(int v)
"""
def __init__(self, function, arg_ref):
- """Constructor.
-
- The specified argument must be a reference or a pointer.
-
- :param idx: Index of the argument that is an output value (the first arg has index 1).
+ """
+ :param idx: Index of the argument that is an output value.
:type idx: int
"""
type_modifier_t.__init__( self, function, arg_ref, remove_ref_or_ptr )
@@ -180,10 +168,9 @@
"""Handles a single input variable.
Replaces the actual argument type with some integral type, so you
- can use ctypes package.
+ could use :mod:`ctypes` package.
- void do_smth(int** image) -> do_smth(unsigned int addressof_image)
-
+ void do_something(int** image) -> do_something(unsigned int image_address)
"""
def __init__(self, function, arg_ref):
@@ -191,7 +178,7 @@
The specified argument must be a reference or a pointer.
- :param idx: Index of the argument that is an output value (the first arg has index 1).
+ :param idx: Index of the argument that is an output value.
:type idx: int
"""
modifier = lambda type_: declarations.FUNDAMENTAL_TYPES[ 'unsigned int' ]
@@ -204,11 +191,10 @@
def __str__(self):
return "from_address(%s)"%(self.arg.name)
-# inout_t
class inout_t(transformer.transformer_t):
"""Handles a single input/output variable.
- void foo(int& v) -> v = foo(v)
+ void do_something(int& v) -> v = do_something(v)
"""
def __init__(self, function, arg_ref):
@@ -216,7 +202,7 @@
The specified argument must be a reference or a pointer.
- :param idx: Index of the argument that is an in/out value (the first arg has index 1).
+ :param idx: Index of the argument that is an in/out value
:type idx: int
"""
transformer.transformer_t.__init__( self, function )
@@ -276,8 +262,9 @@
class input_static_array_t(transformer.transformer_t):
"""Handles an input array with fixed size.
- void setVec3(double* v) -> setVec3(object v)
- # v must be a sequence of 3 floats
+ void do_something(double* v) -> do_something(object v2)
+
+ where v2 is a Python sequence
"""
def __init__(self, function, arg_ref, size):
@@ -360,7 +347,7 @@
def __init__(self, function, arg_ref, size):
"""Constructor.
- :param idx: Index of the argument that is an output array (the first arg has index 1).
+ :param idx: Index of the argument that is an output array.
:type idx: int
:param size: The fixed size of the output array
:type size: int
@@ -441,7 +428,7 @@
class input_c_buffer_t(transformer.transformer_t):
- """Handles an input of C buffere:
+ """handles an input of C buffer:
void write( byte *buffer, int size ) -> void write( python sequence )
"""
Modified: pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py 2009-02-08 08:23:25 UTC (rev 1661)
+++ pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py 2009-02-08 13:53:58 UTC (rev 1662)
@@ -67,7 +67,7 @@
:param gccxml_config: instance of pygccxml.parser.config_t class, holds
gccxml( compiler ) configuration. You can use this argument instead of
- passing the compiler configuration separatly.
+ passing the compiler configuration separately.
"""
module_builder.module_builder_t.__init__( self, global_ns=None, encoding=encoding )
@@ -247,7 +247,7 @@
@property
def code_creator( self ):
- "reference to L{code_creators.bpmodule_t} instance"
+ "reference to :class:`code_creators.bpmodule_t` instance"
if not self.__code_creator:
raise RuntimeError( "self.module is equal to None. Did you forget to call build_code_creator function?" )
return self.__code_creator
Modified: sphinx/ignore_dictionary.txt
===================================================================
--- sphinx/ignore_dictionary.txt 2009-02-08 08:23:25 UTC (rev 1661)
+++ sphinx/ignore_dictionary.txt 2009-02-08 13:53:58 UTC (rev 1662)
@@ -27,3 +27,15 @@
gcc
noncopyable
Bierbaum
+ctypes
+dll
+cpp
+pdb
+bsc
+undecorate
+Beltrame
+Kunstleve
+Grosse
+msvc
+demangle
+demangled
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|