Update of /cvsroot/pygccxml/source/pyplusplus/examples/tnfox
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28954/pyplusplus/examples/tnfox
Modified Files:
call_policies.py create_tnfox.py declarations_to_exclude.py
environment.py files_to_exclude.py tnfox.vcproj
Log Message:
There are a lot of changes, sorry CVS did not worked for week or something like this
Changes
1. Lots of code clean up
2. Adding and updating documentation
3. Adding new method on decl_wrapper - readme. This method will return list of msgs to the developer.
For example if function takes by reference fundamental type it will say that this function could not be called from Python
4. Logging functionlity has been added to file writers too
5. Few bug fixes
6. For operator [] call policies is always set.
Index: call_policies.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/tnfox/call_policies.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** call_policies.py 30 Mar 2006 05:56:17 -0000 1.9
--- call_policies.py 6 Apr 2006 06:16:07 -0000 1.10
***************
*** 73,76 ****
--- 73,77 ----
, "::FX::FXBitmap::getData" : return_internal_reference()
, "::FX::FXBitmapView::getBitmap" : return_internal_reference()
+ , "::FX::FXCharset::clear" : return_self()
, "::FX::FXColorSelector::acceptButton" : return_internal_reference()
, "::FX::FXColorSelector::cancelButton" : return_internal_reference()
***************
*** 90,93 ****
--- 91,95 ----
, "::FX::FXDirSelector::acceptButton" : return_internal_reference()
, "::FX::FXDirSelector::cancelButton" : return_internal_reference()
+ , "::FX::FXDockBar::findDockAtSide" : return_value_policy( reference_existing_object )
, "::FX::FXDockBar::findDockNear" : return_value_policy( reference_existing_object )
, "::FX::FXDockBar::getDryDock" : return_value_policy( reference_existing_object )
***************
*** 205,208 ****
--- 207,211 ----
, "::FX::FXId::getApp" : return_value_policy( reference_existing_object )
, "::FX::FXId::getEventLoop" : return_value_policy( reference_existing_object )
+ , "::FX::FXId::getVisual" : return_value_policy( reference_existing_object )
, "::FX::FXImageFrame::getImage" : return_internal_reference()
, "::FX::FXImage::getData" : return_internal_reference()
***************
*** 256,259 ****
--- 259,264 ----
, "::FX::FXMDIChild::getIcon" : return_internal_reference()
, "::FX::FXMDIChild::getMenu" : return_internal_reference()
+ , "::FX::FXMDIChild::getWindowIcon" : return_internal_reference()
+ , "::FX::FXMDIChild::getWindowMenu" : return_internal_reference()
, "::FX::FXMDIClient::getActiveChild" : return_internal_reference()
, "::FX::FXMenuButton::getMenu" : return_internal_reference()
***************
*** 278,290 ****
--- 283,301 ----
, "::FX::FXOptionMenu::getCurrent" : return_internal_reference()
, "::FX::FXOptionMenu::getMenu" : return_internal_reference()
+ , "::FX::FXOptionMenu::getPopup" : return_internal_reference()
, "::FX::FXPopup::getGrabOwner" : return_internal_reference()
, "::FX::FXPopup::getNextActive" : return_internal_reference()
, "::FX::FXPopup::getPrevActive" : return_internal_reference()
, "::FX::FXProcess::instance" : return_value_policy( reference_existing_object )
+ , "::FX::FXProcess::permissions" : return_internal_reference()
, "::FX::FXProcess::threadPool" : return_value_policy( reference_existing_object )
, "::FX::FXProgressBar::getFont" : return_internal_reference()
, "::FX::FXQuatd::adjust" : return_self()
, "::FX::FXQuatf::adjust" : return_self()
+ #does not exist in sources
+ #, "::FX::FXRanged::clipTo" : return_self()
, "::FX::FXRanged::include" : return_self()
+ #does not exist in sources
+ #, "::FX::FXRangef::clipTo" : return_self()
, "::FX::FXRangef::include" : return_self()
, "::FX::FXRealSpinner::getFont" : return_internal_reference()
***************
*** 308,311 ****
--- 319,323 ----
, "::FX::FXSpheref::include" : return_self()
, "::FX::FXSpinner::getFont" : return_internal_reference()
+ , "::FX::FXSplashWindow::getFont" : return_internal_reference()
, "::FX::FXSplashWindow::getIcon" : return_internal_reference()
, "::FX::FXSplitter::findHSplit" : return_internal_reference()
***************
*** 321,326 ****
--- 333,341 ----
, "::FX::FXSQLDBCursor::statement" : return_value_policy( reference_existing_object )
, "::FX::FXSQLDBRegistry::processRegistry" : return_value_policy( reference_existing_object )
+ , "::FX::FXSQLDBServer::addDatabase" : return_self()
, "::FX::FXSQLDBStatement::bind" : return_self()
, "::FX::FXSQLDBStatement::driver" : return_value_policy( reference_existing_object )
+ , "::FX::FXSQLDB_ipc::setIsAsynchronous" : return_self()
+ , "::FX::FXSQLDB_ipc::setPrefetching" : return_self()
, "::FX::FXSSLKey::asymmetricKey" : return_internal_reference()
, "::FX::FXSSLKey::setAsymmetricKey" : return_self()
***************
*** 354,357 ****
--- 369,376 ----
, "::FX::FXTime::toUTC" : return_self()
, "::FX::FXToggleButton::getAltIcon" : return_internal_reference()
+ , "::FX::FXToolBar::findDockAtSide" : return_value_policy( reference_existing_object )
+ , "::FX::FXToolBar::findDockNear" : return_value_policy( reference_existing_object )
+ , "::FX::FXToolBar::getDryDock" : return_value_policy( reference_existing_object )
+ , "::FX::FXToolBar::getWetDock" : return_value_policy( reference_existing_object )
, "::FX::FXToolTip::getFont" : return_internal_reference()
, "::FX::FXTopWindow::getIcon" : return_value_policy( reference_existing_object )
***************
*** 428,431 ****
--- 447,451 ----
, "::FX::QDir::entryInfoList" : return_internal_reference()
, "::FX::QGZipDevice::GZData" : return_value_policy( reference_existing_object )
+ , "::FX::QIODevice::permissions" : return_internal_reference()
, "::FX::QMemArray<unsigned char>::data" : return_internal_reference()
, "::FX::QMemArray<unsigned char>::assign" : return_self()
***************
*** 441,444 ****
--- 461,465 ----
, "::FX::QPtrVector<FX::FXWindow>::getLast" : return_internal_reference()
, "::FX::QPtrVector<FX::FXWindow>::first" : return_internal_reference()
+ , "::FX::QPtrVector<FX::FXWindow>::last" : return_internal_reference()
, "::FX::QPtrVector<FX::FXWindow>::int_vector" : return_self()
, "::FX::QPtrVector<FX::Generic::BoundFunctorV>::data" : return_internal_reference()
***************
*** 465,467 ****
--- 486,489 ----
, "::FX::FXObjectListOf<FX::FXHeaderItem>::list" : return_internal_reference()
, "::FX::FXObjectListOf<FX::FXIconItem>::list" : return_internal_reference()
+ , "::FX::QBZip2Device::BZ2Data" : return_internal_reference()
}
Index: environment.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/tnfox/environment.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** environment.py 5 Dec 2005 08:10:58 -0000 1.5
--- environment.py 6 Apr 2006 06:16:07 -0000 1.6
***************
*** 8,12 ****
class settings:
! module_name='tnfox'
boost_path = ''
boost_libs_path = ''
--- 8,12 ----
class settings:
! module_name='TnFOX'
boost_path = ''
boost_libs_path = ''
***************
*** 27,31 ****
, "FX_INCLUDE_ABSOLUTELY_EVERYTHING"
, "FOXPYTHONDLL_EXPORTS"
! , "FX_NO_GLOBAL_NAMESPACE" ]
if 'big'==sys.byteorder:
defined_symbols.append("FOX_BIGENDIAN=1")
--- 27,35 ----
, "FX_INCLUDE_ABSOLUTELY_EVERYTHING"
, "FOXPYTHONDLL_EXPORTS"
! , "FX_NO_GLOBAL_NAMESPACE"
! , "FOXPYTHONDLL"]
! # For debugging purposes to get far smaller bindings, you can define FX_DISABLEGUI
! defined_symbols.append("FX_DISABLEGUI=1")
!
if 'big'==sys.byteorder:
defined_symbols.append("FOX_BIGENDIAN=1")
Index: create_tnfox.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/tnfox/create_tnfox.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** create_tnfox.py 30 Mar 2006 05:56:17 -0000 1.18
--- create_tnfox.py 6 Apr 2006 06:16:07 -0000 1.19
***************
*** 5,20 ****
# http://www.boost.org/LICENSE_1_0.txt)
! import os
import time
from environment import settings
- from pygccxml import parser
from pygccxml import declarations
from pyplusplus import code_creators
- from pyplusplus import module_creator
from pyplusplus import file_writers
- from pyplusplus import utils as pypp_utils
- from pyplusplus import decl_wrappers
from pyplusplus import module_builder
import aliases
--- 5,18 ----
# http://www.boost.org/LICENSE_1_0.txt)
! import os, sys
import time
from environment import settings
from pygccxml import declarations
from pyplusplus import code_creators
from pyplusplus import file_writers
from pyplusplus import module_builder
+ from pyplusplus.module_builder import call_policies
+
import aliases
***************
*** 29,44 ****
fx_ns = mb.namespace( 'FX' )
fx_ns.include()
! fx_ns.decls( declarations_to_exclude.is_excluded ).exclude()
! fx_ns.decls( lambda decl: decl.name.startswith('FXIPCMsg') ).exclude()
fx_ns.namespace( 'Pol' ).exclude()
fx_ns.decls( files_to_exclude.is_excluded ).exclude()
! #find FXFunctorTarget constructor that takes 1 argument of some type
! fx_ns.constructors( name='FXFunctorTarget', arg_types=[None] ).exclude()
! fx_ns.class_( 'QValueList<FX::Pol::knowReferrers::ReferrerEntry>').exclude()
! fx_ns.class_( 'QPtrVector<FX::Generic::BoundFunctorV>').exclude()
! #Niall? wrapper for this function could not be compiled
! FXSQLDBStatement = fx_ns.class_( 'FXSQLDBStatement' )
! FXSQLDBStatement.member_function( name='bind', arg_types=[None,None,None] ).exclude()
!
for func in fx_ns.calldefs():
#I want to exclude all functions that returns pointer to pointer
--- 27,39 ----
fx_ns = mb.namespace( 'FX' )
fx_ns.include()
! fx_ns.decls( declarations_to_exclude.is_excluded ).exclude()
! fx_ns.decls( lambda decl: decl.name.startswith('FXIPCMsgHolder') ).exclude()
fx_ns.namespace( 'Pol' ).exclude()
fx_ns.decls( files_to_exclude.is_excluded ).exclude()
! fx_ns.class_( 'QValueList<FX::Pol::knowReferrers::ReferrerEntry>').exclude()
! try:
! fx_ns.class_( 'QPtrVector<FX::Generic::BoundFunctorV>').exclude()
! except: pass
!
for func in fx_ns.calldefs():
#I want to exclude all functions that returns pointer to pointer
***************
*** 46,49 ****
--- 41,46 ----
if declarations.is_pointer( func.return_type ):
temp = declarations.remove_pointer( func.return_type )
+ if declarations.is_void( temp ):
+ continue #export function that returns void*
if declarations.is_fundamental( temp ) and not declarations.is_const(temp):
func.exclude()
***************
*** 53,60 ****
func.exclude()
! #decls = fx_ns.decls( lambda decl: decl.alias in declarations_to_exclude.declarations_aliases )
! #decls.exclude()
!
def set_call_policies(mb):
#first of all call policies defined within data base
for fname, call_pol in call_policies.db.items():
--- 50,69 ----
func.exclude()
! QIODeviceS = fx_ns.class_( 'QIODeviceS' )
! QIODeviceS.member_function( 'open', recursive=False ).exclude()
! QIODeviceS.member_function( 'truncate', recursive=False ).exclude()
! QIODeviceS.member_function( 'readBlockFrom', recursive=False ).exclude()
! QIODeviceS.member_function( 'writeBlockTo', recursive=False ).exclude()
!
! fx_ns.casting_operators().exclude()
!
!
def set_call_policies(mb):
+
+ #for func in mb.calldefs():
+ # if "QMemArray" in func.name:
+ # print "HERE!", func.name, func.parent.name, [x.name for x in func.arguments]
+ #sys.exit(0)
+
#first of all call policies defined within data base
for fname, call_pol in call_policies.db.items():
***************
*** 64,85 ****
else:
mb.calldefs( fname ).call_policies = call_pol
! except Exception, error:
! print '> error: %s, %s' %( fname, str( error ) )
! copy_funcs = mb.calldefs( lambda decl: 'FXGL' in decl.parent.name and decl.name == 'copy' )
! copy_funcs.call_policies = decl_wrappers.return_value_policy( decl_wrappers.manage_new_object )
! take_funcs = mb.calldefs( lambda decl: 'QPtrVector<' in decl.parent.name \
! and decl.name == 'take' \
! and declarations.is_pointer( decl.return_type ) )
! # Set reference_existing object only on the overload not returning a bool
! take_funcs.call_policies = decl_wrappers.return_value_policy( decl_wrappers.reference_existing_object )
! mb.calldefs( 'manufacture' ).call_policies \
! = decl_wrappers.return_value_policy( decl_wrappers.manage_new_object )
! mb.calldefs( 'getMetaClass' ).call_policies \
! = decl_wrappers.return_value_policy( decl_wrappers.reference_existing_object )
#third calculated
! return_by_value = decl_wrappers.return_value_policy( decl_wrappers.return_by_value )
! return_internal_ref = decl_wrappers.return_internal_reference()
const_t = declarations.const_t
pointer_t = declarations.pointer_t
--- 73,105 ----
else:
mb.calldefs( fname ).call_policies = call_pol
! except:
! print "ERROR, skipping! was:",sys.exc_info()[0],sys.exc_info()[1]
!
! try:
! copy_funcs = mb.calldefs( lambda decl: 'FXGL' in decl.parent.name and decl.name == 'copy' )
! copy_funcs.call_policies = call_policies.return_value_policy( call_policies.manage_new_object )
! except:
! print "ERROR, skipping! was:",sys.exc_info()[0],sys.exc_info()[1]
! try:
! take_funcs = mb.calldefs( lambda decl: 'QPtrVector<' in decl.parent.name \
! and decl.name == 'take' \
! and declarations.is_pointer( decl.return_type ) )
! # Set reference_existing object only on the overload not returning a bool
! take_funcs.call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
! except:
! print "ERROR, skipping! was:",sys.exc_info()[0],sys.exc_info()[1]
!
! try:
! mb.calldefs( 'manufacture' ).call_policies \
! = call_policies.return_value_policy( call_policies.manage_new_object )
! mb.calldefs( 'getMetaClass' ).call_policies \
! = call_policies.return_value_policy( call_policies.reference_existing_object )
! except:
! print "ERROR, skipping! was:",sys.exc_info()[0],sys.exc_info()[1]
#third calculated
! return_by_value = call_policies.return_value_policy( call_policies.return_by_value )
! return_internal_ref = call_policies.return_internal_reference()
const_t = declarations.const_t
pointer_t = declarations.pointer_t
***************
*** 97,103 ****
#~ mb.calldefs( return_type=type_ ).call_policies = policy
- #for name in 'FXVec4d', 'FXVec4f', 'FXVec3d', 'FXVec3f', 'QMemArray<unsigned char>':
- # mb.casting_operators( name ).call_policies = return_internal_ref
-
return None
--- 117,120 ----
***************
*** 128,140 ****
extmodule.adopt_creator( code_creators.namespace_using_t('::FX'), position )
extmodule.user_defined_directories.append( settings.generated_files_dir )
-
- def create_module():
- parser_config = parser.config_t( )
fx_xml = os.path.join( settings.xml_files, 'fx.xml' )
! mb = module_builder.module_builder_t( [ parser.create_cached_source_fc( 'fx.h', fx_xml ) ]
, gccxml_path=settings.gccxml_path
, include_paths=[settings.boost_path, settings.tnfox_include_path]
, define_symbols=settings.defined_symbols_gccxml )
print 'filtering declarations'
filter_decls( mb )
--- 145,175 ----
extmodule.adopt_creator( code_creators.namespace_using_t('::FX'), position )
extmodule.user_defined_directories.append( settings.generated_files_dir )
+ def add_error_codes( mb ):
+ error_codes_header = os.path.join( settings.tnfox_include_path, 'FXErrCodes.h' )
+ #in future version of pyplusplus I will add new code creator
+ tmpl = '::boost::python::scope().attr("%(name)s") = %(value)s;'
+ body = mb.code_creator.body
+ for line in file( error_codes_header ):
+ line = line.rstrip( os.linesep )
+ parts = line.split(' ')
+ if 3 != len(parts):
+ continue
+ if not parts[0].startswith( '#define' ):
+ continue
+ define_var = code_creators.custom_text_t(
+ tmpl % { 'name':parts[1]
+ , 'value':parts[2] } )
+
+ body.adopt_creator( define_var )
+
+ def create_module():
fx_xml = os.path.join( settings.xml_files, 'fx.xml' )
! mb = module_builder.module_builder_t( [ module_builder.create_cached_source_fc( 'fx.h', fx_xml ) ]
, gccxml_path=settings.gccxml_path
, include_paths=[settings.boost_path, settings.tnfox_include_path]
, define_symbols=settings.defined_symbols_gccxml )
+
+ mb.run_query_optimizer()
print 'filtering declarations'
filter_decls( mb )
***************
*** 151,154 ****
--- 186,190 ----
print 'customizing module'
customize_module( mb )
+ add_error_codes( mb )
print 'customizing module - done'
return mb
***************
*** 157,160 ****
--- 193,198 ----
print 'writing module to files'
assert isinstance( mb, module_builder.module_builder_t )
+ if not os.path.exists( settings.generated_files_dir ):
+ os.mkdir( settings.generated_files_dir )
start_time = time.clock()
file_writers.write_file( os.path.join( settings.generated_files_dir, color_array.file_name )
Index: declarations_to_exclude.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/tnfox/declarations_to_exclude.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** declarations_to_exclude.py 29 Mar 2006 04:26:58 -0000 1.10
--- declarations_to_exclude.py 6 Apr 2006 06:16:07 -0000 1.11
***************
*** 66,70 ****
, "::FX::FXWindow::remColormapWindows"
, "::FX::QHostAddress::ip6Addr"
- , "::FX::QIODevice::readLine"
, "::FX::QMemArray::begin"
, "::FX::QMemArray::data"
--- 66,69 ----
***************
*** 126,131 ****
, "::FX::FXEventLoop"
, "::FX::TnFXAppEventLoop::executeRetCode"
- , "::FX::QIODevice"
- , "::FX::QIODeviceS"
]
--- 125,128 ----
***************
*** 164,166 ****
def is_excluded( decl ):
! return declarations.full_name( decl ) in to_be_excluded or is_deprecated( decl )
\ No newline at end of file
--- 161,163 ----
def is_excluded( decl ):
! return declarations.full_name( decl ) in to_be_excluded or is_deprecated( decl )
Index: files_to_exclude.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/tnfox/files_to_exclude.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** files_to_exclude.py 29 Mar 2006 04:26:58 -0000 1.3
--- files_to_exclude.py 6 Apr 2006 06:16:07 -0000 1.4
***************
*** 14,17 ****
--- 14,18 ----
, "FXErrCodes.h"
, "FXFileStream.h"
+ , "FXFunctorTarget.h"
, "FXGenericTools.h"
, "FXHash.h"
***************
*** 26,33 ****
, "FXRollback.h"
, "FXSecure.h"
- , "FXStringDict.h"
, "FXString.h"
, "FXTextCodec.h"
- , "FXURL.h"
, "FXUTF16Codec.h"
, "FXUTF32Codec.h"
--- 27,32 ----
***************
*** 36,39 ****
--- 35,39 ----
#Niall?
, "QThread.h"
+ , "FXWinLinks.h"
]
Index: tnfox.vcproj
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/tnfox/tnfox.vcproj,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** tnfox.vcproj 1 Feb 2006 07:31:43 -0000 1.7
--- tnfox.vcproj 6 Apr 2006 06:16:07 -0000 1.8
***************
*** 21,25 ****
Optimization="0"
AdditionalIncludeDirectories="C:\python\libs;D:\pygccxml_sources\source\pyplusplus\examples\tnfox\TnFOX\include;D:\boost_cvs;D:\pygccxml_sources\source\pyplusplus\examples\tnfox\TnFOX\Python"
! PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FXDISABLE_GLOBALALLOCATORREPLACEMENTS;FX_INCLUDE_ABSOLUTELY_EVERYTHING;FOXPYTHONDLL_EXPORTS;FOX_BIGENDIAN"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
--- 21,25 ----
Optimization="0"
AdditionalIncludeDirectories="C:\python\libs;D:\pygccxml_sources\source\pyplusplus\examples\tnfox\TnFOX\include;D:\boost_cvs;D:\pygccxml_sources\source\pyplusplus\examples\tnfox\TnFOX\Python"
! PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FXDISABLE_GLOBALALLOCATORREPLACEMENTS;FX_INCLUDE_ABSOLUTELY_EVERYTHING;FOXPYTHONDLL_EXPORTS;FOX_BIGENDIAN;FOXPYTHONDLL"
MinimalRebuild="TRUE"
[...3828 lines suppressed...]
<File
***************
*** 2025,2032 ****
--- 2062,2077 ----
</File>
<File
+ RelativePath=".\generated\TnFXAppEventLoop.pypp.cpp">
+ </File>
+ <File
RelativePath=".\generated\TnFXAppEventLoop.pypp.hpp">
</File>
</Filter>
<Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|