pygccxml-commit Mailing List for C++ Python language bindings (Page 75)
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: Roman <rom...@us...> - 2006-04-20 10:11:34
|
Update of /cvsroot/pygccxml/source/pyplusplus/decl_wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1204/pyplusplus/decl_wrappers Modified Files: __init__.py namespace_wrapper.py scopedef_wrapper.py Log Message: moving select interface to pygccxml classes. Previous code should work unchanged, because I just moved it in hierarchy tree. Index: namespace_wrapper.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/namespace_wrapper.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** namespace_wrapper.py 6 Apr 2006 06:15:59 -0000 1.6 --- namespace_wrapper.py 20 Apr 2006 10:11:26 -0000 1.7 *************** *** 11,70 **** scopedef_wrapper.scopedef_t.__init__( self ) declarations.namespace_t.__init__(self, *arguments, **keywords ) ! ! def namespace( self, name=None, function=None, recursive=None ): ! return self._find_single( declarations.namespace_matcher_t ! , name=name ! , function=function ! , recursive=recursive ) ! ! def namespaces( self, name=None, function=None, recursive=None ): ! return self._find_multiple( declarations.namespace_matcher_t ! , name=name ! , function=function ! , recursive=recursive ) ! ! def free_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): ! return self._find_single( declarations.calldef_matcher_t ! , name=name ! , function=function ! , decl_type=declarations.free_function_t ! , return_type=return_type ! , arg_types=arg_types ! , header_dir=header_dir ! , header_file=header_file ! , recursive=recursive ) ! ! def free_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): ! return self._find_multiple( declarations.calldef_matcher_t ! , name=name ! , function=function ! , decl_type=declarations.free_function_t ! , return_type=return_type ! , arg_types=arg_types ! , header_dir=header_dir ! , header_file=header_file ! , recursive=recursive) ! ! def free_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): ! return self._find_single( declarations.operator_matcher_t ! , name=name ! , symbol=symbol ! , function=function ! , decl_type=declarations.free_operator_t ! , return_type=return_type ! , arg_types=arg_types ! , header_dir=header_dir ! , header_file=header_file ! , recursive=recursive ) ! ! def free_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): ! return self._find_multiple( declarations.operator_matcher_t ! , name=name ! , symbol=symbol ! , function=function ! , decl_type=declarations.free_operator_t ! , return_type=return_type ! , arg_types=arg_types ! , header_dir=header_dir ! , header_file=header_file ! , recursive=recursive ) --- 11,13 ---- scopedef_wrapper.scopedef_t.__init__( self ) declarations.namespace_t.__init__(self, *arguments, **keywords ) ! Index: scopedef_wrapper.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/scopedef_wrapper.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** scopedef_wrapper.py 20 Apr 2006 04:06:41 -0000 1.10 --- scopedef_wrapper.py 20 Apr 2006 10:11:26 -0000 1.11 *************** *** 5,164 **** import decl_wrapper - from pygccxml import declarations - import mdecl_wrapper - from sets import Set as set - import time - from pyplusplus import _logging_ class scopedef_t(decl_wrapper.decl_wrapper_t): """ In C++ there are 2 declarations that can contain definition of other ! declarations: class and namespace. This class is used as abase class for both of them. - - Also this class provides "get/select/find" interface. Using this class you - can get instance or instances of internal declaration(s). - - You can find declaration(s) using next criteria: - 1. name - declaration name, could be full qualified name - 2. header_dir - directory, to which belongs file, that the declaration was declarated in. - header_dir should be absolute path. - 3. header_file - file that the declaration was declarated in. - 4. function - user ( your ) custom criteria. The interesting thing is that - this function will be joined with other arguments ( criteria ). - 5. recursive - the search declaration range, if True will be search in - internal declarations too. - - Every "select" API you can invoke and pass as first argument at declaration - name or function. This class will find out correctly what argument represents. - - Example:: - ns - referers to global namespace - ns.member_function( "do_something ) - will return reference to member - function named "do_something". If there is no such function exception - will be raised. If there is more then one function exception will be - raised too. - - Example 2:: - ns - referers to global namespace - do_smths = ns.member_functions( "do_something ) - will return instance - of L{mdecl_wrapper_t} object. This object allows you few things: - - 1. To iterate on selected declarations - 2. To set some property to desired value using one line of code only: - do_smths.call_policies = x - 3. To call some function on every instance using one line of code: - do_smths.exclude() - - Pay attention: you can not use "get" functions or properties. """ ! ! RECURSIVE_DEFAULT = True ! ALLOW_EMPTY_MDECL_WRAPPER = False ! def __init__(self): decl_wrapper.decl_wrapper_t.__init__( self ) - - self.__optimized = False - self.__type2decls = {} - self.__type2name2decls = {} - self.__type2decls_nr = {} - self.__type2name2decls_nr = {} - self.__all_decls = None - - def __decl_types( self, decl ): - types = [] - bases = list( decl.__class__.__bases__ ) - visited = set() - while bases: - base = bases.pop() - if base is declarations.declaration_t: - continue - if base in visited: - continue - if 'pygccxml' not in base.__module__: - continue - types.append( base ) - bases.extend( base.__bases__ ) - return types - - def clear_optimizer(self): - """Cleans query optimizer state""" - self.__optimized = False - self.__type2decls = {} - self.__type2name2decls = {} - self.__type2decls_nr = {} - self.__type2name2decls_nr = {} - self.__all_decls = None - - map( lambda decl: decl.clear_optimizer() - , filter( lambda decl: isinstance( decl, declarations.scopedef_t ) - , self.declarations ) ) - - def init_optimizer(self): - """Initializes query optimizer state. - There are 4 internals hash tables: - 1. from type to declarations - 2. from type to declarations for non-recursive queries - 3. from type to name to declarations - 4. from type to name to declarations for non-recursive queries - - Almost every query includes declaration type information. Also very - common query is to search some declaration(s) by name or full name. - Those hashtables allows to search declaration very quick. - """ - _logging_.logger.debug( "preparing data structures for query optimizer - started" ) - start_time = time.clock() - - self.clear_optimizer() - - decl_types = [ declarations.scopedef_t - , declarations.enumeration_t - , declarations.namespace_t - , declarations.class_t - , declarations.class_declaration_t - , declarations.typedef_t - , declarations.variable_t - , declarations.calldef_t - , declarations.member_calldef_t - , declarations.free_calldef_t - , declarations.operator_t - , declarations.member_function_t - , declarations.constructor_t - , declarations.destructor_t - , declarations.member_operator_t - , declarations.casting_operator_t - , declarations.free_function_t - , declarations.free_operator_t ] - for dtype in decl_types: - self.__type2decls[ dtype ] = [] - self.__type2decls_nr[ dtype ] = [] - self.__type2name2decls[ dtype ] = {} - self.__type2name2decls_nr[ dtype ] = {} - - self.__all_decls = declarations.make_flatten( self.declarations ) - for decl in self.__all_decls: - types = self.__decl_types( decl ) - for type_ in types: - self.__type2decls[ type_ ].append( decl ) - name2decls = self.__type2name2decls[ type_ ] - if not name2decls.has_key( decl.name ): - name2decls[ decl.name ] = [] - name2decls[ decl.name ].append( decl ) - if self is decl.parent: - self.__type2decls_nr[ type_ ].append( decl ) - name2decls_nr = self.__type2name2decls_nr[ type_ ] - if not name2decls_nr.has_key( decl.name ): - name2decls_nr[ decl.name ] = [] - name2decls_nr[ decl.name ].append( decl ) - - map( lambda decl: decl.init_optimizer() - , filter( lambda decl: isinstance( decl, declarations.scopedef_t ) - , self.declarations ) ) - _logging_.logger.debug( "preparing data structures for query optimizer - done( %f seconds ). " - % ( time.clock() - start_time ) ) - self.__optimized = True - def exclude( self ): """Exclude "self" and child declarations from being exposed.""" --- 5,19 ---- import decl_wrapper class scopedef_t(decl_wrapper.decl_wrapper_t): """ In C++ there are 2 declarations that can contain definition of other ! declarations: class and namespace. This class is used as a base class for both of them. """ ! def __init__(self): decl_wrapper.decl_wrapper_t.__init__( self ) def exclude( self ): """Exclude "self" and child declarations from being exposed.""" *************** *** 171,483 **** map( lambda decl: decl.include(), self.declarations ) - def __normalize_args( self, **keywds ): - if callable( keywds['name'] ) and None is keywds['function']: - keywds['function'] = keywds['name'] - keywds['name'] = None - return keywds - - def __findout_recursive( self, **keywds ): - if None is keywds[ 'recursive' ]: - return self.RECURSIVE_DEFAULT - else: - return keywds[ 'recursive' ] - - def __findout_decl_type( self, match_class, **keywds ): - if keywds.has_key( 'decl_type' ): - return keywds['decl_type'] - - matcher_args = keywds.copy() - del matcher_args['function'] - del matcher_args['recursive'] - - matcher = match_class( **matcher_args ) - if matcher.decl_type: - return matcher.decl_type - return None - - def __create_matcher( self, match_class, **keywds ): - matcher_args = keywds.copy() - del matcher_args['function'] - del matcher_args['recursive'] - - matcher = match_class( **matcher_args ) - if keywds['function']: - _logging_.logger.info( 'running query: %s and <user defined function>' % str( matcher ) ) - return lambda decl: matcher( decl ) and keywds['function'](decl) - else: - _logging_.logger.info( 'running query: %s' % str( matcher ) ) - return matcher - - def __findout_range( self, name, decl_type, recursive ): - if not self.__optimized: - _logging_.logger.info( 'running non optimized query - optimization has not been done' ) - decls = self.declarations - if recursive: - decls = declarations.make_flatten( self.declarations ) - return decls - - if name and decl_type: - matcher = declarations.declaration_matcher_t( name=name ) - if matcher.is_full_name(): - name = matcher.decl_name_only - if recursive: - _logging_.logger.info( 'query has been optimized on type and name' ) - return self.__type2name2decls[decl_type][name] - else: - _logging_.logger.info( 'non recursive query has been optimized on type and name' ) - return self.__type2name2decls_nr[decl_type][name] - elif decl_type: - if recursive: - _logging_.logger.info( 'query has been optimized on type' ) - return self.__type2decls[ decl_type ] - else: - _logging_.logger.info( 'non recursive query has been optimized on type' ) - return self.__type2decls_nr[ decl_type ] - else: - if recursive: - _logging_.logger.info( 'query has not been optimized ( hint: query does not contain type and/or name )' ) - return self.__all_decls - else: - _logging_.logger.info( 'non recursive query has not been optimized ( hint: query does not contain type and/or name )' ) - return self.declarations - - def _find_single( self, match_class, **keywds ): - _logging_.logger.info( 'find single query execution - started' ) - start_time = time.clock() - norm_keywds = self.__normalize_args( **keywds ) - matcher = self.__create_matcher( match_class, **norm_keywds ) - dtype = self.__findout_decl_type( match_class, **norm_keywds ) - recursive_ = self.__findout_recursive( **norm_keywds ) - decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) - found = declarations.matcher.get_single( matcher, decls, False ) - _logging_.logger.info( 'find single query execution - done( %f seconds )' - % ( time.clock() - start_time ) ) - return found - - def _find_multiple( self, match_class, **keywds ): - _logging_.logger.info( 'find all query execution - started' ) - start_time = time.clock() - norm_keywds = self.__normalize_args( **keywds ) - matcher = self.__create_matcher( match_class, **norm_keywds ) - dtype = self.__findout_decl_type( match_class, **norm_keywds ) - recursive_ = self.__findout_recursive( **norm_keywds ) - decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) - found = declarations.matcher.find( matcher, decls, False ) - mfound = mdecl_wrapper.mdecl_wrapper_t( found ) - _logging_.logger.info( '%d declaration(s) that match query' % len(mfound) ) - _logging_.logger.info( 'find single query execution - done( %f seconds )' - % ( time.clock() - start_time ) ) - if not mfound and not self.ALLOW_EMPTY_MDECL_WRAPPER: - raise RuntimeError( "Multi declaration query returned 0 declarations." ) - return mfound - - def decl( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - """Finds any declaration by criteria. Please see L{scopedef_t} for full explanation.""" - return self._find_single( declarations.declaration_matcher_t - , name=name - , function=function - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def decls( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.declaration_matcher_t - , name=name - , function=function - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def class_( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.declaration_matcher_t - , name=name - , function=function - , decl_type=declarations.class_t - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def classes( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.declaration_matcher_t - , name=name - , function=function - , decl_type=declarations.class_t - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def variable( self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.variable_matcher_t - , name=name - , function=function - , type=type - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def variables( self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.variable_matcher_t - , name=name - , function=function - , type=type - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def calldef( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.calldef_matcher_t - , name=name - , function=function - , decl_type=declarations.calldef_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def calldefs( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.calldef_matcher_t - , name=name - , function=function - , decl_type=declarations.calldef_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.operator_matcher_t - , name=name - , symbol=symbol - , function=function - , decl_type=decl_type - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.operator_matcher_t - , name=name - , symbol=symbol - , function=function - , decl_type=decl_type - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def member_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.calldef_matcher_t - , name=name - , function=function - , decl_type=declarations.member_function_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def member_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.calldef_matcher_t - , name=name - , function=function - , decl_type=declarations.member_function_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def constructor( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.calldef_matcher_t - , name=name - , function=function - , decl_type=declarations.constructor_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def constructors( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.calldef_matcher_t - , name=name - , function=function - , decl_type=declarations.constructor_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def member_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.operator_matcher_t - , name=name - , symbol=symbol - , function=function - , decl_type=declarations.member_operator_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def member_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.operator_matcher_t - , name=name - , symbol=symbol - , function=function - , decl_type=declarations.member_operator_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def casting_operator( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.calldef_matcher_t - , name=name - , function=function - , decl_type=declarations.casting_operator_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def casting_operators( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.calldef_matcher_t - , name=name - , function=function - , decl_type=declarations.casting_operator_t - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def enumeration( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - return self._find_single( declarations.declaration_matcher_t - , name=name - , function=function - , decl_type=declarations.enumeration_t - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - #adding small aliase - enum = enumeration - - def enumerations( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - return self._find_multiple( declarations.declaration_matcher_t - , name=name - , function=function - , decl_type=declarations.enumeration_t - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - #adding small aliase - enums = enumerations --- 26,27 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 19 Mar 2006 05:45:14 -0000 1.5 --- __init__.py 20 Apr 2006 10:11:26 -0000 1.6 *************** *** 86,91 **** from decl_wrapper_printer import print_declarations - from mdecl_wrapper import mdecl_wrapper_t - from user_text import user_text_t from user_text import class_user_text_t --- 86,89 ---- |
From: Roman <rom...@us...> - 2006-04-20 10:11:34
|
Update of /cvsroot/pygccxml/source/pygccxml/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1204/pygccxml/unittests Modified Files: typedefs_tester.py Log Message: moving select interface to pygccxml classes. Previous code should work unchanged, because I just moved it in hierarchy tree. Index: typedefs_tester.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/typedefs_tester.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** typedefs_tester.py 20 Apr 2006 04:32:16 -0000 1.1 --- typedefs_tester.py 20 Apr 2006 10:11:26 -0000 1.2 *************** *** 23,31 **** if not self.declarations: self.declarations = parser.parse( [self.header], self.config ) ! def test( self ): ! item_cls = declarations.find_declaration( self.declarations ! , type=declarations.class_t ! , name='item_t' ) self.failUnless( item_cls, "unable to find class 'item_t'" ) self.failUnless( len( item_cls.typedefs ) == 1 ) --- 23,33 ---- if not self.declarations: self.declarations = parser.parse( [self.header], self.config ) ! self.global_ns = declarations.find_declaration( self.declarations ! , type=declarations.namespace_t ! , name='::' ) ! self.global_ns.init_optimizer() ! def test( self ): ! item_cls = self.global_ns.class_( name='item_t' ) self.failUnless( item_cls, "unable to find class 'item_t'" ) self.failUnless( len( item_cls.typedefs ) == 1 ) |
From: Roman <rom...@us...> - 2006-04-20 10:11:34
|
Update of /cvsroot/pygccxml/source/pyplusplus/module_builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1204/pyplusplus/module_builder Modified Files: __init__.py Log Message: moving select interface to pygccxml classes. Previous code should work unchanged, because I just moved it in hierarchy tree. Index: __init__.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/module_builder/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 20 Apr 2006 04:06:44 -0000 1.3 --- __init__.py 20 Apr 2006 10:11:26 -0000 1.4 *************** *** 24,27 **** --- 24,28 ---- from pygccxml.parser import file_cache_t from pygccxml.parser import file_configuration_t + from pygccxml.declarations import mdecl_wrapper_t #aliases for functionality located in decl_wrappers package *************** *** 43,48 **** from pyplusplus.decl_wrappers import scopedef_t - from pyplusplus.decl_wrappers import mdecl_wrapper_t - from pyplusplus.decl_wrappers import print_declarations --- 44,47 ---- |
From: Roman <rom...@us...> - 2006-04-20 10:11:31
|
Update of /cvsroot/pygccxml/source/pygccxml/unittests/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1204/pygccxml/unittests/data Modified Files: core_cache.hpp Log Message: moving select interface to pygccxml classes. Previous code should work unchanged, because I just moved it in hierarchy tree. Index: core_cache.hpp =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/data/core_cache.hpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** core_cache.hpp 20 Apr 2006 04:06:41 -0000 1.54 --- core_cache.hpp 20 Apr 2006 10:11:26 -0000 1.55 *************** *** 24,26 **** ! //touch \ No newline at end of file --- 24,26 ---- ! //touch//touch \ No newline at end of file |
From: Roman <rom...@us...> - 2006-04-20 05:40:10
|
Update of /cvsroot/pygccxml/source/pyplusplus/module_creator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14507/pyplusplus/module_creator Modified Files: creator.py Log Message: changes, that has been done in order to support CVS version of GCC-XML Index: creator.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/module_creator/creator.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** creator.py 9 Apr 2006 05:17:15 -0000 1.65 --- creator.py 20 Apr 2006 05:40:04 -0000 1.66 *************** *** 210,214 **** # See: http://public.kitware.com/pipermail/gccxml/2004-October/000486.html decls = filter( lambda x: not (x.is_artificial and ! not (isinstance(x, declarations.class_t))) , decls ) # Filter out internal compiler methods --- 210,214 ---- # See: http://public.kitware.com/pipermail/gccxml/2004-October/000486.html decls = filter( lambda x: not (x.is_artificial and ! not (isinstance(x, ( declarations.class_t, declarations.enumeration_t)))) , decls ) # Filter out internal compiler methods |
From: Roman <rom...@us...> - 2006-04-20 05:40:08
|
Update of /cvsroot/pygccxml/source/pyplusplus/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14507/pyplusplus/unittests Modified Files: free_functions_tester.py Log Message: changes, that has been done in order to support CVS version of GCC-XML Index: free_functions_tester.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/unittests/free_functions_tester.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** free_functions_tester.py 29 Mar 2006 04:26:58 -0000 1.8 --- free_functions_tester.py 20 Apr 2006 05:40:04 -0000 1.9 *************** *** 9,13 **** import fundamental_tester_base ! class free_functions_tester_t(fundamental_tester_base.fundamental_tester_base_t): EXTENSION_NAME = 'free_functions' --- 9,13 ---- import fundamental_tester_base ! class tester_t(fundamental_tester_base.fundamental_tester_base_t): EXTENSION_NAME = 'free_functions' *************** *** 15,19 **** fundamental_tester_base.fundamental_tester_base_t.__init__( self ! , free_functions_tester_t.EXTENSION_NAME , *args ) --- 15,19 ---- fundamental_tester_base.fundamental_tester_base_t.__init__( self ! , tester_t.EXTENSION_NAME , *args ) *************** *** 27,31 **** def create_suite(): suite = unittest.TestSuite() ! suite.addTest( unittest.makeSuite(free_functions_tester_t)) return suite --- 27,31 ---- def create_suite(): suite = unittest.TestSuite() ! suite.addTest( unittest.makeSuite(tester_t)) return suite |
From: Roman <rom...@us...> - 2006-04-20 05:40:08
|
Update of /cvsroot/pygccxml/source/pyplusplus/decl_wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14507/pyplusplus/decl_wrappers Modified Files: algorithm.py Log Message: changes, that has been done in order to support CVS version of GCC-XML Index: algorithm.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/algorithm.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** algorithm.py 6 Apr 2006 06:15:59 -0000 1.4 --- algorithm.py 20 Apr 2006 05:40:04 -0000 1.5 *************** *** 70,73 **** --- 70,75 ---- , ']' : '_c_sq_brace_' , '=' : '_equal_' + , '.' : '_dot_' + , '$' : '_dollar_' } for orig, dest in replace_table.items(): |
From: Roman <rom...@us...> - 2006-04-20 05:38:20
|
Update of /cvsroot/pygccxml/source/pyplusplus/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13273/pyplusplus/unittests Modified Files: autoconfig.py Log Message: From now testers on Linux will run again Python 2.4 Index: autoconfig.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/unittests/autoconfig.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** autoconfig.py 6 Apr 2006 06:16:09 -0000 1.22 --- autoconfig.py 20 Apr 2006 05:38:16 -0000 1.23 *************** *** 55,59 **** libpath = [ '/home/roman/boost_cvs/bin' ] cpppath = [ boost_path ! , '/usr/include/python2.3' ] ccflags = [] cmd_clean = 'scons --clean --file=%s' --- 55,59 ---- libpath = [ '/home/roman/boost_cvs/bin' ] cpppath = [ boost_path ! , '/usr/include/python2.4' ] ccflags = [] cmd_clean = 'scons --clean --file=%s' |
From: Roman <rom...@us...> - 2006-04-20 05:36:47
|
Update of /cvsroot/pygccxml/source/pyplusplus/code_creators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11897/pyplusplus/code_creators Modified Files: member_variable.py Log Message: TODO: change generated code, in order to support pointer member variables Index: member_variable.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_creators/member_variable.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** member_variable.py 10 Apr 2006 11:57:15 -0000 1.13 --- member_variable.py 20 Apr 2006 05:36:43 -0000 1.14 *************** *** 29,32 **** --- 29,37 ---- wrapper = property( _get_wrapper, _set_wrapper ) + #TODO: + #> On Wednesday, 19. April 2006 23:05, Ralf W. Grosse-Kunstleve wrote: + #> .add_property("p", make_function(&A::get_p, + #> return_value_policy<reference_existing_object>())) + class member_variable_t( member_variable_base_t ): """ |
From: Roman <rom...@us...> - 2006-04-20 05:35:46
|
Update of /cvsroot/pygccxml/source/pyplusplus/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11158/pyplusplus/unittests Modified Files: test_all.py Added Files: factory_tester.py Log Message: bug fix: wrong code has been generated for public pure virtual function, when class has wrapper --- NEW FILE: factory_tester.py --- # Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) import os import sys import unittest import fundamental_tester_base class tester_t(fundamental_tester_base.fundamental_tester_base_t): EXTENSION_NAME = 'factory' def __init__( self, *args ): fundamental_tester_base.fundamental_tester_base_t.__init__( self , tester_t.EXTENSION_NAME , *args ) def run_tests(self, module): conrete_inst = module.create() self.failUnless( 1 == conrete_inst.run() ) def create_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) return suite def run_suite(): unittest.TextTestRunner(verbosity=2).run( create_suite() ) if __name__ == "__main__": run_suite() Index: test_all.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/unittests/test_all.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** test_all.py 26 Mar 2006 07:20:56 -0000 1.36 --- test_all.py 20 Apr 2006 05:35:40 -0000 1.37 *************** *** 48,51 **** --- 48,52 ---- import optional_bug_tester import pointer_as_arg_tester + import factory_tester def create_suite(times): *************** *** 92,95 **** --- 93,97 ---- , optional_bug_tester , pointer_as_arg_tester + , factory_tester ] |
From: Roman <rom...@us...> - 2006-04-20 05:35:46
|
Update of /cvsroot/pygccxml/source/pyplusplus/unittests/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11158/pyplusplus/unittests/data Added Files: factory_to_be_exported.cpp factory_to_be_exported.hpp Log Message: bug fix: wrong code has been generated for public pure virtual function, when class has wrapper --- NEW FILE: factory_to_be_exported.hpp --- // Copyright 2004 Roman Yakovenko. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef __factory_to_be_exported_hpp__ #define __factory_to_be_exported_hpp__ #include <memory> namespace factory{ class abstract{ public: virtual int run() const = 0; }; std::auto_ptr<abstract> create(); } #endif//__factory_to_be_exported_hpp__ --- NEW FILE: factory_to_be_exported.cpp --- // 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) #include "factory_to_be_exported.hpp" namespace factory{ class concrete : public abstract{ virtual int run( ) const{ return 1; } }; std::auto_ptr<abstract> create(){ return std::auto_ptr<abstract>( new concrete() ); } } |
From: Roman <rom...@us...> - 2006-04-20 05:35:43
|
Update of /cvsroot/pygccxml/source/pyplusplus/code_creators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11158/pyplusplus/code_creators Modified Files: calldef.py Log Message: bug fix: wrong code has been generated for public pure virtual function, when class has wrapper Index: calldef.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_creators/calldef.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** calldef.py 10 Apr 2006 11:57:15 -0000 1.52 --- calldef.py 20 Apr 2006 05:35:40 -0000 1.53 *************** *** 88,92 **** , '::boost::python::pure_virtual' ) if create_with_signature: ! if self.wrapper: result.append( '%s( (%s)(&%s) )' % ( pure_virtual --- 88,92 ---- , '::boost::python::pure_virtual' ) if create_with_signature: ! if self.wrapper and self.declaration.access_type != declarations.ACCESS_TYPES.PUBLIC: result.append( '%s( (%s)(&%s) )' % ( pure_virtual *************** *** 99,103 **** , declarations.full_name( self.declaration ) ) ) else: ! if self.wrapper: result.append( '%s( &%s )' % ( pure_virtual, self.wrapper.full_name() ) ) --- 99,103 ---- , declarations.full_name( self.declaration ) ) ) else: ! if self.wrapper and self.declaration.access_type != declarations.ACCESS_TYPES.PUBLIC: result.append( '%s( &%s )' % ( pure_virtual, self.wrapper.full_name() ) ) |
From: Roman <rom...@us...> - 2006-04-20 04:32:21
|
Update of /cvsroot/pygccxml/source/pygccxml/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26712/pygccxml/parser Modified Files: linker.py project_reader.py scanner.py source_reader.py Log Message: Adding new feature: instance of class_t has now references to all it's typedes. This will allow pyplusplus to suggest/set better alais without user invocation. Index: linker.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/linker.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** linker.py 2 Mar 2006 05:51:39 -0000 1.12 --- linker.py 20 Apr 2006 04:32:16 -0000 1.13 *************** *** 19,23 **** self.__files = files self.__inst = None ! def _get_inst(self): return self.__inst --- 19,23 ---- self.__files = files self.__inst = None ! def _get_inst(self): return self.__inst *************** *** 76,80 **** def visit_constructor( self ): self.__link_calldef() ! def visit_destructor( self ): self.__link_calldef() --- 76,80 ---- def visit_constructor( self ): self.__link_calldef() ! def visit_destructor( self ): self.__link_calldef() *************** *** 98,101 **** --- 98,113 ---- def visit_class(self ): self.__link_members() + #GCC-XML sometimes generates constructors with names that does not match + #class name. I think this is because those constructors are compiler + #generated. I need to find out more about this and to talk with Brad + for decl in self.__inst.declarations: + if not isinstance( decl, constructor_t ): + continue + if '.' in self.__inst.name or '$' in self.__inst.name: + new_name = self.__inst.parent.name + if templates.is_instantiation( new_name ): + new_name = templates.name( new_name ) + self.__inst.name = new_name + bases = self.__inst.bases.split() self.__inst.bases = [] *************** *** 109,113 **** self.__inst.bases.append( hierarchy_info_t( base_decl, access ) ) base_decl.derived.append( hierarchy_info_t( self.__inst, access ) ) ! def visit_enumeration(self ): pass --- 121,125 ---- self.__inst.bases.append( hierarchy_info_t( base_decl, access ) ) base_decl.derived.append( hierarchy_info_t( self.__inst, access ) ) ! def visit_enumeration(self ): pass Index: scanner.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/scanner.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** scanner.py 20 Apr 2006 04:06:41 -0000 1.24 --- scanner.py 20 Apr 2006 04:32:16 -0000 1.25 *************** *** 6,9 **** --- 6,10 ---- import os import types + import pprint import xml.sax import warnings *************** *** 167,199 **** def startElement(self, name, attrs): ! if name not in self.__readers: ! return ! obj = self.__readers[name]( attrs ) ! if not obj: ! return #it means that we worked on internals ! #for example EnumValue of function argument ! if name in self.deep_declarations: ! self.__inst = obj ! self.__read_access( attrs ) ! if isinstance( obj, declaration_t ): ! self.__update_membership( attrs ) ! self.__declarations[ attrs[XML_AN_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 ) ! self.__read_artificial(obj, attrs) ! self.__read_mangled( obj, attrs) ! elif isinstance( obj, type_t ): ! self.__types[ attrs[XML_AN_ID] ] = obj ! elif isinstance( obj, types.StringTypes ): ! self.__files[ attrs[XML_AN_ID] ] = obj ! else: ! logger.warning( 'Unknown object type has been found.' ! + ' Please report this bug to pygccxml development team.' ) ! def endElement(self, name): if name in self.deep_declarations: --- 168,206 ---- def startElement(self, name, attrs): ! try: ! if name not in self.__readers: ! return ! obj = self.__readers[name]( attrs ) ! if not obj: ! return #it means that we worked on internals ! #for example EnumValue of function argument ! if name in self.deep_declarations: ! self.__inst = obj ! self.__read_access( attrs ) ! if isinstance( obj, declaration_t ): ! self.__update_membership( attrs ) ! self.__declarations[ attrs[XML_AN_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 ) ! self.__read_artificial(obj, attrs) ! self.__read_mangled( obj, attrs) ! elif isinstance( obj, type_t ): ! self.__types[ attrs[XML_AN_ID] ] = obj ! elif isinstance( obj, types.StringTypes ): ! self.__files[ attrs[XML_AN_ID] ] = obj ! else: ! logger.warning( 'Unknown object type has been found.' ! + ' Please report this bug to pygccxml development team.' ) ! except Exception, error: ! msg = 'error occured, while parsing element with name "%s" and attrs "%s".' ! msg = msg + os.linesep + 'Error: %s.' % str( error ) ! logger.error( msg % ( name, pprint.pformat( attrs.keys() ) ) ) ! raise ! def endElement(self, name): if name in self.deep_declarations: *************** *** 230,237 **** def __read_file( self, attrs ): ! return attrs[XML_AN_NAME] def __read_namespace(self, attrs): ! ns_name = attrs[XML_AN_NAME] if '.' in ns_name: #if '.' in namespace then this is mangled namespace -> in c++ namespace{...} --- 237,244 ---- def __read_file( self, attrs ): ! return attrs.get( XML_AN_NAME, '' ) def __read_namespace(self, attrs): ! ns_name = attrs.get( XML_AN_NAME, '' ) if '.' in ns_name: #if '.' in namespace then this is mangled namespace -> in c++ namespace{...} *************** *** 242,246 **** def __read_enumeration(self, attrs): ! enum_name = attrs[XML_AN_NAME] if '$_' in enum_name or '._' in enum_name: #it means that this is unnamed enum. in c++ enum{ x }; --- 249,253 ---- def __read_enumeration(self, attrs): ! enum_name = attrs.get( XML_AN_NAME, '' ) if '$_' in enum_name or '._' in enum_name: #it means that this is unnamed enum. in c++ enum{ x }; *************** *** 249,253 **** def __read_enumeration_value( self, attrs ): ! self.__inst.values[attrs[XML_AN_NAME]] = attrs[XML_AN_INIT] def __read_array_type( self, attrs ): --- 256,260 ---- def __read_enumeration_value( self, attrs ): ! self.__inst.values[attrs.get( XML_AN_NAME, '' )] = attrs[XML_AN_INIT] def __read_array_type( self, attrs ): *************** *** 285,292 **** def __read_fundamental_type(self, attrs ): try: ! return FUNDAMENTAL_TYPES[ attrs[XML_AN_NAME] ] except KeyError: raise RuntimeError( "pygccxml error: unable to find fundamental type with name '%s'." ! % attrs[XML_AN_NAME] ) def __read_offset_type( self,attrs ): --- 292,299 ---- def __read_fundamental_type(self, attrs ): try: ! return FUNDAMENTAL_TYPES[ attrs.get( XML_AN_NAME, '' ) ] except KeyError: raise RuntimeError( "pygccxml error: unable to find fundamental type with name '%s'." ! % attrs.get( XML_AN_NAME, '' ) ) def __read_offset_type( self,attrs ): *************** *** 311,315 **** calldef.return_type = attrs.get( XML_AN_RETURNS, None ) if isinstance( calldef, declaration_t ): ! calldef.name = attrs[ XML_AN_NAME ] calldef.has_extern = attrs.get( XML_AN_EXTERN, False ) calldef.exceptions = attrs.get( XML_AN_THROW, "" ).split() --- 318,322 ---- calldef.return_type = attrs.get( XML_AN_RETURNS, None ) if isinstance( calldef, declaration_t ): ! calldef.name = attrs.get(XML_AN_NAME, '') calldef.has_extern = attrs.get( XML_AN_EXTERN, False ) calldef.exceptions = attrs.get( XML_AN_THROW, "" ).split() *************** *** 340,344 **** def __read_typedef(self, attrs ): ! return self.__decl_factory.create_typedef( name=attrs[XML_AN_NAME], type=attrs[XML_AN_TYPE]) def __read_variable(self, attrs ): --- 347,351 ---- def __read_typedef(self, attrs ): ! return self.__decl_factory.create_typedef( name=attrs.get( XML_AN_NAME, '' ), type=attrs[XML_AN_TYPE]) def __read_variable(self, attrs ): *************** *** 349,353 **** if bits: bits = int( bits ) ! return self.__decl_factory.create_variable( name=attrs[XML_AN_NAME] , type=attrs[XML_AN_TYPE] , type_qualifiers=type_qualifiers --- 356,360 ---- if bits: bits = int( bits ) ! return self.__decl_factory.create_variable( name=attrs.get( XML_AN_NAME, '' ) , type=attrs[XML_AN_TYPE] , type_qualifiers=type_qualifiers Index: source_reader.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/source_reader.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** source_reader.py 6 Apr 2006 06:15:58 -0000 1.28 --- source_reader.py 20 Apr 2006 04:32:16 -0000 1.29 *************** *** 19,24 **** RuntimeError.__init__( self, msg ) class source_reader_t: ! def __init__( self, config, cache=None, decl_factory=None): self.__search_directories = [] self.__config = config --- 19,53 ---- RuntimeError.__init__( self, msg ) + + def bind_typedefs( decls ): + """ + This function binds between class and it's typedefs. + + @param decls: list of all declarations + @type all_classes: list of L{declaration_t} items + + @return: None + """ + typedefs = [] + classes = [] + for decl in decls: + if isinstance( decl, class_t ): + classes.append( decl ) + elif isinstance( decl, typedef_t ): + typedefs.append( decl ) + else: + pass + + + for decl in classes: + for typedef in typedefs: + type_ = remove_alias( typedef.type ) + if not isinstance( type_, declarated_t ): + continue + if type_.declaration is decl: + decl.typedefs.append( typedef ) + class source_reader_t: ! def __init__( self, config, cache=None, decl_factory=None, enable_bind_typedefs=True): self.__search_directories = [] self.__config = config *************** *** 32,35 **** --- 61,65 ---- if not decl_factory: self.__decl_factory = decl_factory_t() + self.__enable_bind_typedefs = enable_bind_typedefs def __raise_on_wrong_settings(self): *************** *** 90,93 **** --- 120,124 ---- if 'win' in sys.platform : cmd_line = '"%s"' % cmd_line + logger.debug( 'gccxml cmd: %s' % cmd_line ) return cmd_line *************** *** 207,211 **** except Exception: return file_path ! def __parse_gccxml_created_file( self, gccxml_file ): scanner_ = scanner.scanner_t( gccxml_file, self.__decl_factory ) --- 238,242 ---- except Exception: return file_path ! def __parse_gccxml_created_file( self, gccxml_file ): scanner_ = scanner.scanner_t( gccxml_file, self.__decl_factory ) *************** *** 228,231 **** --- 259,264 ---- linker_.instance = decl apply_visitor( linker_, decl ) + if self.__enable_bind_typedefs: + bind_typedefs( decls.itervalues() ) decls = filter( lambda inst: isinstance(inst, declaration_t) and not inst.parent, decls.itervalues() ) #some times gccxml report typedefs defined in no namespace Index: project_reader.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/parser/project_reader.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** project_reader.py 20 Apr 2006 04:06:41 -0000 1.30 --- project_reader.py 20 Apr 2006 04:32:16 -0000 1.31 *************** *** 167,171 **** header = prj_file content_type = file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE ! reader = source_reader.source_reader_t( config, self.__dcache, self.__decl_factory ) decls = None if content_type == file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE: --- 167,174 ---- header = prj_file content_type = file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE ! reader = source_reader.source_reader_t( config ! , self.__dcache ! , self.__decl_factory ! , False ) decls = None if content_type == file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE: *************** *** 206,209 **** --- 209,213 ---- logger.info( "Relinking declared types ..." ) self._relink_declarated_types( leaved_classes, types ) + source_reader.bind_typedefs( pygccxml.declarations.make_flatten( answer ) ) return answer |
From: Roman <rom...@us...> - 2006-04-20 04:32:20
|
Update of /cvsroot/pygccxml/source/pygccxml/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26712/pygccxml/unittests Modified Files: decl_printer_tester.py declarations_tester.py test_all.py Added Files: typedefs_tester.py Log Message: Adding new feature: instance of class_t has now references to all it's typedes. This will allow pyplusplus to suggest/set better alais without user invocation. Index: declarations_tester.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/declarations_tester.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** declarations_tester.py 2 Mar 2006 05:55:41 -0000 1.4 --- declarations_tester.py 20 Apr 2006 04:32:16 -0000 1.5 *************** *** 88,98 **** no_return_1_arg = find_declaration( ns.declarations, type=free_function_t, name='no_return_1_arg' ) self.failUnless( no_return_1_arg, "unable to find 'no_return_1_arg' function" ) ! self._test_calldef_args( no_return_1_arg, [ argument_t( name='arg0', type=int_t() )] ) return_default_args = find_declaration( ns.declarations, type=free_function_t, name='return_default_args' ) self.failUnless( return_default_args, "unable to find 'return_default_args' function" ) self._test_calldef_args( return_default_args ! , [ argument_t( name='arg0', type=int_t(), default_value='1' ) ! , argument_t( name='arg1', type=bool_t(), default_value='false' ) ] ) self._test_calldef_exceptions( return_default_args, [] ) --- 88,103 ---- no_return_1_arg = find_declaration( ns.declarations, type=free_function_t, name='no_return_1_arg' ) self.failUnless( no_return_1_arg, "unable to find 'no_return_1_arg' function" ) ! self.failUnless( no_return_1_arg.arguments[0].name in [ 'arg', 'arg0' ] ) ! self._test_calldef_args( no_return_1_arg, [ argument_t( name=no_return_1_arg.arguments[0].name, type=int_t() )] ) return_default_args = find_declaration( ns.declarations, type=free_function_t, name='return_default_args' ) self.failUnless( return_default_args, "unable to find 'return_default_args' function" ) + self.failUnless( return_default_args.arguments[0].name in [ 'arg', 'arg0' ] ) + self.failUnless( return_default_args.arguments[1].name in [ 'arg1', 'flag' ] ) self._test_calldef_args( return_default_args ! , [ argument_t( name=return_default_args.arguments[0].name ! , type=int_t(), default_value='1' ) ! , argument_t( name=return_default_args.arguments[1].name ! , type=bool_t(), default_value='false' ) ] ) self._test_calldef_exceptions( return_default_args, [] ) Index: test_all.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/test_all.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_all.py 6 Mar 2006 05:02:40 -0000 1.18 --- test_all.py 20 Apr 2006 04:32:16 -0000 1.19 *************** *** 32,35 **** --- 32,36 ---- import cache_enums_tester import decl_printer_tester + import typedefs_tester def create_suite(): *************** *** 62,65 **** --- 63,67 ---- , cache_enums_tester , decl_printer_tester + , typedefs_tester ] Index: decl_printer_tester.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/decl_printer_tester.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** decl_printer_tester.py 22 Mar 2006 11:08:11 -0000 1.2 --- decl_printer_tester.py 20 Apr 2006 04:32:16 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- , 'core_overloads_1.hpp' , 'core_overloads_2.hpp' + , 'typedefs_base.hpp' ] prj_reader = parser.project_reader_t( self.config ) *************** *** 35,39 **** writer = lambda decl: None declarations.print_declarations( self.decls, writer=writer ) ! def test__str__(self): decls = declarations.make_flatten(self.decls) --- 36,41 ---- writer = lambda decl: None declarations.print_declarations( self.decls, writer=writer ) ! #declarations.print_declarations( self.decls ) ! def test__str__(self): decls = declarations.make_flatten(self.decls) --- NEW FILE: typedefs_tester.py --- # Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) import unittest import autoconfig import parser_test_case from pygccxml import utils from pygccxml import parser from pygccxml import declarations class tester_src_t( parser_test_case.parser_test_case_t ): #tester source reader COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE def __init__(self, *args ): parser_test_case.parser_test_case_t.__init__( self, *args ) self.header = 'typedefs_base.hpp' self.declarations = None def setUp(self): if not self.declarations: self.declarations = parser.parse( [self.header], self.config ) def test( self ): item_cls = declarations.find_declaration( self.declarations , type=declarations.class_t , name='item_t' ) self.failUnless( item_cls, "unable to find class 'item_t'" ) self.failUnless( len( item_cls.typedefs ) == 1 ) self.failUnless( item_cls.typedefs[0].name == 'Item' ) class tester_prj_t( parser_test_case.parser_test_case_t ): #tester source reader COMPILATION_MODE = parser.COMPILATION_MODE.FILE_BY_FILE def __init__(self, *args ): parser_test_case.parser_test_case_t.__init__( self, *args ) self.declarations = None def setUp(self): if not self.declarations: self.declarations = parser.parse( [ 'typedefs1.hpp', 'typedefs2.hpp' ] , self.config , self.COMPILATION_MODE ) def test( self ): item_cls = declarations.find_declaration( self.declarations , type=declarations.class_t , name='item_t' ) self.failUnless( item_cls, "unable to find class 'item_t'" ) self.failUnless( len( item_cls.typedefs ) == 3 ) expected_aliases = set( ['Item', 'Item1', 'Item2' ] ) real_aliases = set( map( lambda typedef: typedef.name, item_cls.typedefs ) ) self.failUnless( real_aliases == expected_aliases ) def create_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_src_t)) suite.addTest( unittest.makeSuite(tester_prj_t)) return suite def run_suite(): unittest.TextTestRunner(verbosity=2).run( create_suite() ) if __name__ == "__main__": run_suite() |
From: Roman <rom...@us...> - 2006-04-20 04:32:20
|
Update of /cvsroot/pygccxml/source/pygccxml/declarations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26712/pygccxml/declarations Modified Files: class_declaration.py decl_printer.py Log Message: Adding new feature: instance of class_t has now references to all it's typedes. This will allow pyplusplus to suggest/set better alais without user invocation. Index: class_declaration.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/class_declaration.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** class_declaration.py 22 Mar 2006 10:39:12 -0000 1.20 --- class_declaration.py 20 Apr 2006 04:32:16 -0000 1.21 *************** *** 97,101 **** self._private_members = [] self._protected_members = [] ! def __str__(self): name = algorithm.full_name(self) --- 97,102 ---- self._private_members = [] self._protected_members = [] ! self._typedefs = [] ! def __str__(self): name = algorithm.full_name(self) *************** *** 204,207 **** --- 205,215 ---- , doc="list of all protected L{members<declaration_t>}" ) + def _get_typedefs(self): + return self._typedefs + def _set_typedefs( self, new_typedefs ): + self._typedefs = new_typedefs + typedefs = property( _get_typedefs, _set_typedefs + , doc="List of aliases/typedefs to this instance") + def _get_declarations_impl(self): return self.get_members() Index: decl_printer.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/decl_printer.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** decl_printer.py 22 Mar 2006 10:43:12 -0000 1.3 --- decl_printer.py 20 Apr 2006 04:32:16 -0000 1.4 *************** *** 130,133 **** --- 130,138 ---- self.writer( ' ' * curr_level * self.INDENT_SIZE + class_type.ljust( self.JUSTIFY ) + os.linesep ) + if self.__inst.typedefs: + aliases = map( lambda typedef: typedef.name, self.__inst.typedefs ) + msg = 'aliases: ' + `aliases` + self.writer( ' ' * curr_level * self.INDENT_SIZE + msg.ljust( self.JUSTIFY ) + os.linesep ) + def print_hierarchy(hierarchy_type, classes, curr_level): self.writer( ' ' * curr_level * self.INDENT_SIZE + hierarchy_type.ljust( self.JUSTIFY ) + os.linesep ) |
From: Roman <rom...@us...> - 2006-04-20 04:32:20
|
Update of /cvsroot/pygccxml/source/pygccxml/unittests/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26712/pygccxml/unittests/data Added Files: typedefs1.hpp typedefs2.hpp typedefs_base.hpp Log Message: Adding new feature: instance of class_t has now references to all it's typedes. This will allow pyplusplus to suggest/set better alais without user invocation. --- NEW FILE: typedefs2.hpp --- // Copyright 2004 Roman Yakovenko. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef __typedefs2_hpp__ #define __typedefs2_hpp__ #include "typedefs_base.hpp" namespace typedefs{ typedef item_t Item2; } #endif//__typedefs2_hpp__ --- NEW FILE: typedefs1.hpp --- // Copyright 2004 Roman Yakovenko. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef __typedefs1_hpp__ #define __typedefs1_hpp__ #include "typedefs_base.hpp" namespace typedefs{ typedef item_t Item1; } #endif//__typedefs1_hpp__ --- NEW FILE: typedefs_base.hpp --- // Copyright 2004 Roman Yakovenko. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef __typedefs_hpp__ #define __typedefs_hpp__ namespace typedefs{ struct item_t{}; typedef item_t Item; } #endif//__typedefs_hpp__ |
From: Roman <rom...@us...> - 2006-04-20 04:07:20
|
Update of /cvsroot/pygccxml/source/pyplusplus/docs/examples/date_time In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/docs/examples/date_time Modified Files: date_time.rest Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: date_time.rest =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/docs/examples/date_time/date_time.rest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** date_time.rest 16 Jan 2006 07:33:07 -0000 1.1 --- date_time.rest 20 Apr 2006 04:06:41 -0000 1.2 *************** *** 16,20 **** `date_time`_ is a cross-platform and open source C++ library designed to provide a basis for performing efficient time calculations. The `date_time`_ library has ! been created by Jeff Garland. In this example I am referring to version 1.33.1. What is the `pyplusplus`_? --- 16,20 ---- `date_time`_ is a cross-platform and open source C++ library designed to provide a basis for performing efficient time calculations. The `date_time`_ library has ! been created by Jeff Garland. What is the `pyplusplus`_? *************** *** 72,76 **** 2. customization_data.py - contains a table of aliases and other data ! 3. create_date_time.py - main file 4. sconstruct - build configuration file --- 72,76 ---- 2. customization_data.py - contains a table of aliases and other data ! 3. generate_code.py - main file 4. sconstruct - build configuration file *************** *** 84,102 **** Where x.y.z is the version of `pyplusplus`_ you are using. ! --------------------------------------------- ! Step 1: preparing declarations to be exported ! --------------------------------------------- ! ! At this step I had to create a set of declarations, that should be exported to ! `Python`_. For this purpose I have used `pygccxml`_ as C++ declarations reader. There were few problems I should have solved at this stage. ! 1. Compilation of the `date_time`_ library takes time, a lot of time. This is a ! real problem. Fortunately `pygccxml`_ provides solution to the problem. ! It allows to create, save and read `GCC-XML`_ generated file. Instead ! of parsing source files each time, `pygccxml`_ parses xml files only. Now, it takes only few seconds to read declarations. - - See create_date_time.py - *exporter_t.read_declarations* function. 2. The `date_time`_ library makes an extensive use of an other C++ libraries. --- 84,97 ---- Where x.y.z is the version of `pyplusplus`_ you are using. ! ------------------------ ! What should be exportes? ! ------------------------ ! The result of this step should be set of declarations I want to export to Python. There were few problems I should have solved at this stage. ! 1. Compilation of the `date_time`_ library takes some time. Fortunately ! `pygccxml`_ allows to create, save and read `GCC-XML`_ generated file. ! Instead of parsing source files each time, `pygccxml`_ parses xml files only. Now, it takes only few seconds to read declarations. 2. The `date_time`_ library makes an extensive use of an other C++ libraries. *************** *** 107,252 **** way I filtered out most of the declarations I do not need. ! See create_date_time.py - *exporter_t.filter_declarations* function. ! ! --------------------------------- ! Step 2: creating extension module ! --------------------------------- ! ! At this step `pyplusplus`_ associates C++ declaration with one or more code ! creators. There is a lot of work done here, but who cares? Small, simple and ! well defined interface of *module_creator.creator_t* class makes this step ! easy. There is something that *module_creator.creator_t* can not do: to guess ! call policies. Well, not a big deal. I defined custom call policies resolver. ! ! See create_date_time.py - *identify_call_policies* function for definition of ! custom call policies resolver. ! ! Also take a look at create_date_time.py - *exporter_t.filter_declarations* ! function. ! ! ------------------------------------ ! Step 3: customizing extension module ! ------------------------------------ ! ! There is a lot of customization that can be applied on extension module. ! Lets start: ! ! * Almost every source file in C++ starts from including an other file. ! `pyplusplus`_ can generate *#include* directives with relative paths. User ! just have to set root directories. That's all. There is some nice side ! effect: for cross-platform libraries generated code is cross-platform too. ! ! * Human should be able to read generated code. More over, one of the goals ! of `pyplusplus`_ is to generate code as close as possible to hand written ! one. One of the aspects of generating such code is namespace aliasing. ! I don't like to read/write code that looks like this: ! *boost::posix_time::ptime pt( boost::posix_time::not_a_date_time ); * ! I prefer: ! *namespace bpt=boost::posix_time;* ! *bpt::ptime pt( bpt::not_a_date_time );* ! This is my personal taste, but I am sure that a lot of people will agree ! with me. So I configured extension module to use predefined namespace ! aliases. ! ! * There is a small rule in C++: template function that was not used is not ! instantiated. Nice rule, but in my case it made a problem: some ! operators and member functions were not exported. The solution is simple. ! I had to add missing functionality by hand. Luckily `pyplusplus`_ allows ! to add user code almost in any place. Using unit test I have found all ! classes, that missed some functionality and added it. ! ! * Operators. The `date_time`_ library is using `boost.operators`_ framework to ! implement operators overloading. This causes a small problem in `Python`_ ! code. Operators, defined in based class, were not visible while using ! derived class. After small conversation with people, from boost.python ! list, the solution was found - to redefine all operators in derived class. ! This functionality was missing in `pyplusplus`_. It took me one hour to ! implement it. *code_creator.class_t* class from now has new property ! called *redefine_operators*. All I needed to do, in order to export ! operators in derived class, is to turn the flag on. ! ! * The `date_time`_ make an extensive use of templates. This means that exported ! class name is not valid `Python`_ identifier. For example: ! *typedef weeks_duration<boost::date_time::duration_traits_adapted> weeks;* ! *weeks_duration<boost::date_time::duration_traits_adapted>* is not valid ! `Python`_ identifier. Also `pyplusplus`_ is able to create valid `Python`_ ! identifier for such case. Those names are not idial. Solution: I created a ! table that maps between original class name to aliases. During the ! extension module customization process I reset the aliases of the exported ! classes. The result: `Python`_ bindings have exactly the same names as in ! C++. This also solves an other very important issue: original library ! documentation and examples - they could be reused, without any changes. ! See create_date_time.py - *exporter_t.customize_extmodule* function. ! ----------------------------- ! Step 4: writing code to files ! ----------------------------- Functionality provided by `pyplusplus`_ was good enough for this use case. More over, `pyplusplus`_ writes code into file only in case the code is different. This functionality was specially useful - small compilation time. ! See create_date_time.py - *exporter_t.write_files* function. ---------- Conclusion ---------- ! I think I proved, at least for my self, that `pyplusplus`_ is not only useful but ! also ready for hard work! Here is summury list of raised problems and implemented ! solutions: ! ! + Problem: ! ! What is the easiest way to define a set of declarations to be exported? ! ! Solution: ! ! The easiest way to define a set of declaration to be exported is to use ! project native layout - namespaces. ! ! + Problem: ! ! How to reduce compilation time? ! ! Solution: ! ! 1. `pygccxml`_ has been configured to work with XML files and not sources. ! ! 2. `pyplusplus`_ has multiple files mode, in which code is written into ! the file only when it had been changed. ! ! + Problem: ! ! I'd like to set function "X" call policies, based on the fact "Y". ! ! Solution: ! ! `pyplusplus`_ allows to create user defined call policies plug in. ! `pygccxml`_ allows user to analize function return and arguments types. ! ! + Problem: ! ! I'd like to insert code "X" at location "Y". ! ! Solution: ! ! `pyplusplus`_ allows to insert user code almost any where. ! ! I think those are common problems, for programmers who try to create `Python`_ ! bindings to some library. More over I think that `pygccxml`_ + `pyplusplus`_ ! provide good solution. ! ! There is one important result - ready to use, good date\\time library for ! `Python`_. You can download `Python`_ packages for Linux ( `Python`_ 2.3 ) or ! Windows (`Python`_ 2.4 ) from http://sourceforge.net/project/showfiles.php?group_id=118209. ! ! I am going to continue development of the `Python`_ bindings for `boost.date_time`_ ! library. ! An other important result is that `pyplusplus`_ gained one more excelent test ! case. .. _`environment.py`: http://cvs.sourceforge.net/viewcvs.py/pygccxml/source/pyplusplus/examples/py_easybmp/environment.py?view=markup --- 102,162 ---- way I filtered out most of the declarations I do not need. ! ---------------------- ! Configure declarations ! ---------------------- ! There is a lot of configuration have been applied on declarations: ! 1. Every template instantiation class has been renamed. The result: `Python`_ ! bindings have exactly the same names as in C++. This also solves an other very ! important issue: original library documentation and examples - they could be ! reused, without any changes. You can take a look on py_date_time/unittests ! directory content. ! 2. Namespace aliases have been introduced. ``bpt`` is shorter then ! ``boost::posix_time``. As a result, generated code is more readable. + 3. Operators. The `date_time`_ library is using `boost.operators`_ framework to + implement operators overloading. This causes a small problem in `Python`_ + code. Operators, defined in based class, were not visible while using + derived class. After small conversation with people, from boost.python + list, the solution was found - to redefine all operators in derived class. + This functionality was missing in `pyplusplus`_. It took me one hour to + implement it. *code_creator.class_t* class from now has new property + called *redefine_operators*. All I needed to do, in order to export + operators in derived class, is to turn the flag on. + + --------------------- + Writing code to files + --------------------- Functionality provided by `pyplusplus`_ was good enough for this use case. More over, `pyplusplus`_ writes code into file only in case the code is different. This functionality was specially useful - small compilation time. ! ----------- ! Small bonus ! ----------- ! `boost.date_time`_ library is under development. There were a lot of changes ! from version 1.33 to 1.34. Nevertheless I almost did not spend time to change ! or update my script. The main reason is of course the script I wrote. Instead ! of working on every single class/function/file, `pyplusplus`_ allowed me to ! create a set of rules, that work on whole set of declarations. ---------- Conclusion ---------- + As for me, `pyplusplus`_ is ready for hard work! + * Big and complex C++ library has been exposed to `Python`_ in few days only. + * You can see from script, that there is no need in deep knowledge of `boost.python`_ library. + * Python gain an excelent functionality for dealing with date/time. + * Real world, 3rd party project is used in testing of `pyplusplus`_. ! -------- ! Download ! -------- ! http://sourceforge.net/project/showfiles.php?group_id=118209. + I am going to continue development of the `Python`_ bindings for + `boost.date_time`_ library. .. _`environment.py`: http://cvs.sourceforge.net/viewcvs.py/pygccxml/source/pyplusplus/examples/py_easybmp/environment.py?view=markup |
From: Roman <rom...@us...> - 2006-04-20 04:07:19
|
Update of /cvsroot/pygccxml/source/pyplusplus/docs/ConferenceIsrael2006 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/docs/ConferenceIsrael2006 Modified Files: presentation-talk.rest Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: presentation-talk.rest =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/docs/ConferenceIsrael2006/presentation-talk.rest,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** presentation-talk.rest 28 Feb 2006 07:31:33 -0000 1.7 --- presentation-talk.rest 20 Apr 2006 04:06:41 -0000 1.8 *************** *** 379,383 **** for users, so that wrapping a code takes on the look of a kind of declarative interface definition language (IDL). But this approach has price - compilation ! time. For realy big projects you need compilation farm. pyplusplus does not good documentation. This is temporal. I am working on this --- 379,383 ---- for users, so that wrapping a code takes on the look of a kind of declarative interface definition language (IDL). But this approach has price - compilation ! time. For really big projects you need compilation farm. pyplusplus does not good documentation. This is temporal. I am working on this |
From: Roman <rom...@us...> - 2006-04-20 04:07:18
|
Update of /cvsroot/pygccxml/source/pyplusplus/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/docs Modified Files: download.rest pyplusplus.rest Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: pyplusplus.rest =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/docs/pyplusplus.rest,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pyplusplus.rest 9 Apr 2006 05:17:14 -0000 1.8 --- pyplusplus.rest 20 Apr 2006 04:06:41 -0000 1.9 *************** *** 31,44 **** --------------------- ! `pyplusplus`_ does not reinvent the wheel. `pyplusplus`_ uses 'GCC C++ compiler`_ to parse C++ source files. To be more precision, the tool chain looks like this: 1. source code is passed to `GCC-XML`_ ! 2. `GCC-XML`_ passes it to 'GCC C++ compiler`_ 3. `GCC-XML`_ generates an XML description of a C++ program from GCC's internal representation. 4. `pyplusplus`_ uses `pygccxml`_ package to read `GCC-XML`_ generated file. ! In short, you can be sure, that all your declarations are read correctly. .. _`GCC C++ compiler` : http://www.gnu.org/software/gcc --- 31,44 ---- --------------------- ! `pyplusplus`_ does not reinvent the wheel. `pyplusplus`_ uses `GCC C++ compiler`_ to parse C++ source files. To be more precision, the tool chain looks like this: 1. source code is passed to `GCC-XML`_ ! 2. `GCC-XML`_ passes it to `GCC C++ compiler`_ 3. `GCC-XML`_ generates an XML description of a C++ program from GCC's internal representation. 4. `pyplusplus`_ uses `pygccxml`_ package to read `GCC-XML`_ generated file. ! The bottom line - you can be sure, that all your declarations are read correctly. .. _`GCC C++ compiler` : http://www.gnu.org/software/gcc *************** *** 93,97 **** classes could be configured in many ways to satisfy your needs. But sometimes this is still not enough. There are use cases when you need full control over ! generated code. One of the bigest problems, with code generators in general, is modifying generated code and preserving changes. How many code generators did you use or know, that allow you to put your code any where or to reorder generated --- 93,97 ---- classes could be configured in many ways to satisfy your needs. But sometimes this is still not enough. There are use cases when you need full control over ! generated code. One of the biggest problems, with code generators in general, is modifying generated code and preserving changes. How many code generators did you use or know, that allow you to put your code any where or to reorder generated *************** *** 174,178 **** * write code into file if there were changes ! * user licence is written at the top of every file * ... --- 174,178 ---- * write code into file if there were changes ! * user license is written at the top of every file * ... Index: download.rest =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/docs/download.rest,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** download.rest 6 Apr 2006 06:15:59 -0000 1.2 --- download.rest 20 Apr 2006 04:06:41 -0000 1.3 *************** *** 19,30 **** -------- ! Please use `this`__ link to download `pyplusplus`_. ! __ https://sourceforge.net/project/showfiles.php?group_id=118209 ---------- CVS access ---------- ! Using `this`__ link you can get access to the latest source code. ! __ https://sourceforge.net/cvs/?group_id=118209 ------------ --- 19,29 ---- -------- ! https://sourceforge.net/project/showfiles.php?group_id=118209 ---------- CVS access ---------- ! ! https://sourceforge.net/cvs/?group_id=118209 ------------ *************** *** 37,41 **** | ``python setup.py install`` ! After this command complete you should have installed `pyplusplus`_ package. ------------ --- 36,40 ---- | ``python setup.py install`` ! After this command complete, you should have installed `pyplusplus`_ package. ------------ *************** *** 43,56 **** ------------ - * `Python`_ - * `pygccxml`_ - * `GCC-XML`_ - - * `boost.python`_ - * `Docutils`_ - only in case you want to create\\extend current documentation - .. _`pyplusplus` : ./pyplusplus.html .. _`pygccxml` : ./../pygccxml/pygccxml.html --- 42,48 ---- |
From: Roman <rom...@us...> - 2006-04-20 04:07:18
|
Update of /cvsroot/pygccxml/source/pyplusplus/docs/tutorials In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/docs/tutorials Modified Files: module_builder.rest tutorials.rest Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: module_builder.rest =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/docs/tutorials/module_builder.rest,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** module_builder.rest 12 Apr 2006 07:40:34 -0000 1.3 --- module_builder.rest 20 Apr 2006 04:06:42 -0000 1.4 *************** *** 15,20 **** -------- ! I guess you decided to try to use `pyplusplus`_ API. Good! So lets start. ! First of all please take a look on two files: * `hello_world.hpp`_ - C++ source code, that we want to export to Python --- 15,20 ---- -------- ! I guess you decided to try `pyplusplus`_ API. Good! Lets start. First of all, ! please take a look on two files: * `hello_world.hpp`_ - C++ source code, that we want to export to Python *************** *** 30,35 **** ---------------- ! `pyplusplus`_ is built from a few packages, but there is only one package you ! should realy to be familiar with - ``module_builder``. This module is some kind of facade to low level API. It provides simple and intuitive API. The main class within this package is ``module_builder_t``. The instance of this class will --- 30,35 ---- ---------------- ! `pyplusplus`_ is built from a few packages, but there is only one package, you ! should really to be familiar with - ``module_builder``. This package is some kind of facade to low level API. It provides simple and intuitive API. The main class within this package is ``module_builder_t``. The instance of this class will *************** *** 60,64 **** Parsing of source files is done within this method. Post condition of this method is - all declarations has been successfully extracted from the sources ! files using the settings you provided. -------------------------- --- 60,64 ---- Parsing of source files is done within this method. Post condition of this method is - all declarations has been successfully extracted from the sources ! files. -------------------------- *************** *** 67,72 **** Not all declarations should be exported! Not every declaration could be exported without human invocation! As you already saw from example, `pyplusplus`_ provides ! simple and powerful declarations query interface. By default only declarations, ! that belongs to files you have asked to parse and to files, that lies in the same directories as parsed files, will be exported: :: --- 67,72 ---- Not all declarations should be exported! Not every declaration could be exported without human invocation! As you already saw from example, `pyplusplus`_ provides ! simple and powerful declarations query interface. By default, only declarations ! that belongs to files, you have asked to parse, and to files, that lies in the same directories as parsed files, will be exported: :: *************** *** 83,92 **** All declarations that belongs to ``include`` directory will be signed as included ! to exposing. All other declarations will be ignored. ! You can change this final set of exported declarations by calling ``exclude`` or ! ``include`` methods on declarations. ! Basically this is a second step of code generation process. During this step you could/should/may change `pyplusplus`_ defaults: --- 83,92 ---- All declarations that belongs to ``include`` directory will be signed as included ! to exporting. All other declarations will be ignored. ! You can change the set of exported declarations by calling ``exclude`` or ! ``include`` methods, on declarations. ! Basically, this is a second step of code generation process. During this step you could/should/may change `pyplusplus`_ defaults: *************** *** 97,105 **** I think it is critical for beginers to see what is going on, right? ! ``module_builder_t`` class has ``print_declarations``_ method. You can print whole declarations tree or some specific declaration. Very convinient, very useful. ----------------------------------- ! module_builder_t build_code_creator ----------------------------------- --- 97,105 ---- I think it is critical for beginers to see what is going on, right? ! ``module_builder_t`` class has ``print_declarations`` method. You can print whole declarations tree or some specific declaration. Very convinient, very useful. ----------------------------------- ! module_builder_t.build_code_creator ----------------------------------- Index: tutorials.rest =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/docs/tutorials/tutorials.rest,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tutorials.rest 12 Apr 2006 07:40:34 -0000 1.2 --- tutorials.rest 20 Apr 2006 04:06:42 -0000 1.3 *************** *** 16,29 **** `pyplusplus`_ includes a `graphical interface`_. `Graphical interface`_ ! is invoked with the ``pyplusplus_gui`` command, or with ``pyplusplus_gui.pyw`` in ! the scripts subdirectory of the `Python`_ installation directory. ! My advise to you is to start with `graphical interface`_, because: ! * you don't have to learn new API ! * few clicks with mouse and you have `boost.python`_ code for your file(s) ! * it is very easy to evaluate `pyplusplus`_ using it ! * you can check whether `GCC-XML`_ is able to compile your code or not ! * you can use it as a guide to `boost.python`_ library ! * you can use it as a wizard to `pyplusplus`_ package .. _`graphical interface` : ./pyplusplus_demo.png --- 16,29 ---- `pyplusplus`_ includes a `graphical interface`_. `Graphical interface`_ ! is invoked with the ``pyplusplus_gui`` command, or with ``pyplusplus_gui.pyw`` ! from the ``scripts`` subdirectory of the `Python`_ installation directory. ! My advise to you - start with `graphical interface`_, because: ! * you don't have to learn new API ! * few clicks with mouse and you have `boost.python`_ code for your file(s) ! * it is very easy to evaluate `pyplusplus`_ using it ! * you can check whether `GCC-XML`_ is able to compile your code or not ! * you can use it as a guide to `boost.python`_ library ! * it is able to generate `pyplusplus`_ code for you .. _`graphical interface` : ./pyplusplus_demo.png *************** *** 45,51 **** To be written. I think I should cover here the usage of code creators and code creator's tree. Meanwhile you can take a look on the content of ! ``examples/custom_code_creator`` directory. It contains example how to create ! your own code creator. To be more specific it exposes ``get*`` and ``set*`` ! methods as a property. .. _`pyplusplus` : ./../pyplusplus.html --- 45,51 ---- To be written. I think I should cover here the usage of code creators and code creator's tree. Meanwhile you can take a look on the content of ! ``examples/custom_code_creator`` directory. It contains example, that shows how ! to create your own code creator. To be more specific, it exposes ``get*`` and ! ``set*`` methods as a single property. .. _`pyplusplus` : ./../pyplusplus.html |
From: Roman <rom...@us...> - 2006-04-20 04:07:18
|
Update of /cvsroot/pygccxml/source/pyplusplus/docs/comparisons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/docs/comparisons Modified Files: pyste.rest Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: pyste.rest =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/docs/comparisons/pyste.rest,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pyste.rest 6 Apr 2006 06:15:59 -0000 1.2 --- pyste.rest 20 Apr 2006 04:06:41 -0000 1.3 *************** *** 67,70 **** --- 67,71 ---- Pyste ----- + Carefully read `Pyste`_ definition - *************** *** 101,104 **** --- 102,106 ---- pyplusplus ---------- + `pyplusplus`_ has 2 user interfaces: *************** *** 362,366 **** * `pyplusplus`_ has small nice future - "license". User can specify the ! licence and it will appear in every generated file. * `pyplusplus`_ allows user to define custom call policies resolver. See --- 364,368 ---- * `pyplusplus`_ has small nice future - "license". User can specify the ! license and it will appear in every generated file. * `pyplusplus`_ allows user to define custom call policies resolver. See *************** *** 391,397 **** This comparison was a little unfair. First of all `Pyste`_ is no more under ! active development\\suppport. Second, `Pyste`_ has been written 2 years ago and ! had different goal. Next defintions will help you to understand the main ! difference beetween `Pyste`_ and `pyplusplus`_. `Pyste`_ --- 393,399 ---- This comparison was a little unfair. First of all `Pyste`_ is no more under ! active development\\support. Second, `Pyste`_ has been written 2 years ago and ! had different goal. Next definitions will help you to understand the main ! difference between `Pyste`_ and `pyplusplus`_. `Pyste`_ |
From: Roman <rom...@us...> - 2006-04-20 04:07:17
|
Update of /cvsroot/pygccxml/source/pyplusplus/decl_wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/decl_wrappers Modified Files: call_policies.py calldef_wrapper.py class_wrapper.py decl_wrapper.py scopedef_wrapper.py Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: decl_wrapper.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/decl_wrapper.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** decl_wrapper.py 6 Apr 2006 15:25:38 -0000 1.6 --- decl_wrapper.py 20 Apr 2006 04:06:41 -0000 1.7 *************** *** 18,22 **** __REPOTED_REPLACES.append( msg ) ! class ERROR_BEHAVIOUR: PRINT = 'print' RAISE = 'raise' --- 18,22 ---- __REPOTED_REPLACES.append( msg ) ! class ERROR_BEHAVIOR: PRINT = 'print' RAISE = 'raise' *************** *** 78,89 **** #return False ! #def _finalize_impl( self, error_behaviour ): #pass ! #def finalize( self, error_behaviour=None): #try: #self._finalize_impl( self ) #except Exception, error: ! #if None is error_behaviour or error_behaviour == ERROR_BEHAVIOUR.PRINT: #print 'Unable to finalize declaration: ', str( error ) #else: --- 78,89 ---- #return False ! #def _finalize_impl( self, error_behavior ): #pass ! #def finalize( self, error_behavior=None): #try: #self._finalize_impl( self ) #except Exception, error: ! #if None is error_behavior or error_behavior == ERROR_BEHAVIOR.PRINT: #print 'Unable to finalize declaration: ', str( error ) #else: Index: call_policies.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/call_policies.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** call_policies.py 6 Apr 2006 06:15:59 -0000 1.3 --- call_policies.py 20 Apr 2006 04:06:41 -0000 1.4 *************** *** 4,7 **** --- 4,15 ---- # 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. + + For every class that implements code creation of call policies, there is a + convinience function. + """ + from pygccxml import declarations import algorithm Index: scopedef_wrapper.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/scopedef_wrapper.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** scopedef_wrapper.py 12 Apr 2006 07:40:34 -0000 1.9 --- scopedef_wrapper.py 20 Apr 2006 04:06:41 -0000 1.10 *************** *** 12,16 **** class scopedef_t(decl_wrapper.decl_wrapper_t): ! """In C++ there are 2 declarations that can contain definition of other declarations: class and namespace. This class is used as abase class for both of them. --- 12,17 ---- class scopedef_t(decl_wrapper.decl_wrapper_t): ! """ ! In C++ there are 2 declarations that can contain definition of other declarations: class and namespace. This class is used as abase class for both of them. *************** *** 32,37 **** name or function. This class will find out correctly what argument represents. ! Example: ! ns - referers to global namespace ns.member_function( "do_something ) - will return reference to member --- 33,37 ---- name or function. This class will find out correctly what argument represents. ! Example:: ns - referers to global namespace ns.member_function( "do_something ) - will return reference to member *************** *** 40,45 **** raised too. ! Example 2: ! ns - referers to global namespace do_smths = ns.member_functions( "do_something ) - will return instance --- 40,44 ---- raised too. ! Example 2:: ns - referers to global namespace do_smths = ns.member_functions( "do_something ) - will return instance *************** *** 53,57 **** Pay attention: you can not use "get" functions or properties. - """ --- 52,55 ---- Index: calldef_wrapper.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/calldef_wrapper.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** calldef_wrapper.py 6 Apr 2006 06:15:59 -0000 1.4 --- calldef_wrapper.py 20 Apr 2006 04:06:41 -0000 1.5 *************** *** 58,62 **** return False ! def _finalize_impl( self, error_behaviour ): if not isinstance( self, declarations.member_calldef_t ): pass --- 58,62 ---- return False ! def _finalize_impl( self, error_behavior ): if not isinstance( self, declarations.member_calldef_t ): pass Index: class_wrapper.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/class_wrapper.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** class_wrapper.py 20 Mar 2006 05:47:56 -0000 1.3 --- class_wrapper.py 20 Apr 2006 04:06:41 -0000 1.4 *************** *** 63,69 **** return False ! def _finalize_impl( self, error_behaviour ): for decl in self.declarations: ! decl.finalize( error_behaviour ) def _get_user_code( self ): --- 63,69 ---- return False ! def _finalize_impl( self, error_behavior ): for decl in self.declarations: ! decl.finalize( error_behavior ) def _get_user_code( self ): |
From: Roman <rom...@us...> - 2006-04-20 04:07:17
|
Update of /cvsroot/pygccxml/source/pyplusplus/code_repository In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/code_repository Modified Files: __init__.py array_1.py Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: array_1.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_repository/array_1.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** array_1.py 23 Nov 2005 06:09:53 -0000 1.2 --- array_1.py 20 Apr 2006 04:06:41 -0000 1.3 *************** *** 4,7 **** --- 4,12 ---- # http://www.boost.org/LICENSE_1_0.txt) + """ + This file contains C++ code needed to export one dimensional static arrays. + """ + + namespace = "pyplusplus::containers::static_sized" Index: __init__.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/code_repository/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 22 Nov 2005 09:38:15 -0000 1.1 --- __init__.py 20 Apr 2006 04:06:41 -0000 1.2 *************** *** 4,11 **** # http://www.boost.org/LICENSE_1_0.txt) ! #The basic idea after this package is to create C++ classes and functions ! #that will help to export C++ code. ! import array_1 all = [ array_1 ] \ No newline at end of file --- 4,17 ---- # http://www.boost.org/LICENSE_1_0.txt) + """ + Code repository package is used as a repository of C++ classes/functions. + Those classes/functions solve problems, that are typical to most projects. + Right now, this package contains set of classes that help to export one + dimensional static arrays. For example: ! C{char data[23];} + """ + + import array_1 all = [ array_1 ] \ No newline at end of file |
From: Roman <rom...@us...> - 2006-04-20 04:07:15
|
Update of /cvsroot/pygccxml/source/pyplusplus/examples/py_date_time In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/examples/py_date_time Modified Files: generate_code.py Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: generate_code.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/py_date_time/generate_code.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** generate_code.py 6 Apr 2006 06:29:35 -0000 1.1 --- generate_code.py 20 Apr 2006 04:06:42 -0000 1.2 *************** *** 23,27 **** def _create_xml_file( self ): #On windows I have some problems to compile boost.date_time ! #library, so I will use xml files generated on linux config = parser.config_t( gccxml_path=settings.gccxml_path , include_paths=[settings.boost_path] --- 23,27 ---- def _create_xml_file( self ): #On windows I have some problems to compile boost.date_time ! #library, so I use xml files generated on linux config = parser.config_t( gccxml_path=settings.gccxml_path , include_paths=[settings.boost_path] |
From: Roman <rom...@us...> - 2006-04-20 04:07:15
|
Update of /cvsroot/pygccxml/source/pyplusplus/docs/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6005/pyplusplus/docs/examples Modified Files: examples.rest Log Message: I was ill and did not have my TortoiseCVS :-). This commit contains documentation changes only. Those changes had been done for latest release version. Index: examples.rest =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/docs/examples/examples.rest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** examples.rest 9 Apr 2006 05:17:14 -0000 1.5 --- examples.rest 20 Apr 2006 04:06:42 -0000 1.6 *************** *** 5,28 **** .. contents:: Table of contents ! -------------- ! pyplusplus GUI ! -------------- ! ! The best example of generated code, that `pyplusplus`_ could provide is a ! creating `boost.python`_ bindings from your code. It is possible. `pyplusplus`_ ! has nice standalone `GUI`_. I hope, it will help you to evaluate `pyplusplus`_. ! Standalone executable exists for next platforms: ! ! * Debian 3.1 with Python 2.3 ! ! * Windows XP with Python 2.4 ! I am almost sure you can run it on an other distributions and with installed ! different Python version, but I did not test it. In order to get it you have ! to download `pyplusplus`_ package. ! That is not all. `pyplusplus`_ `GUI`_ contains small wizard, that will create ! for you, initial `pyplusplus`_ code. Try this option and you will not be ! disappointed. ------- --- 5,16 ---- .. contents:: Table of contents ! ------------------- ! Graphical interface ! ------------------- ! `pyplusplus`_ has nice, small and simple graphical interface. Please, read ! `tutorials`_ for more information. ! .. _`tutorials` : ./../tutorials/tutorials.html ------- *************** *** 41,49 **** I thought that running unit tests is not enough. I wanted to check `pyplusplus`_ ! on big and complex projects. Also I wanted to check, whether it realy simple to create fully working Python bindings for such projects. The short answer it is not. The long answer is `here`__. ! __ : ./date_time/date_time.html .. _`GUI`: ./../tutorials/pyplusplus_demo.png --- 29,37 ---- I thought that running unit tests is not enough. I wanted to check `pyplusplus`_ ! on big and complex projects. Also I wanted to check, whether it really simple to create fully working Python bindings for such projects. The short answer it is not. The long answer is `here`__. ! .. __ : ./date_time/date_time.html .. _`GUI`: ./../tutorials/pyplusplus_demo.png |