Update of /cvsroot/pygccxml/source/pyplusplus/examples/py_date_time
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32522/pyplusplus/examples/py_date_time
Modified Files:
_date_time_.suo _date_time_.vcproj create_date_time.py
environment.py
Added Files:
profile_pypp.py
Log Message:
module_builder_t class interface has been changed:
as we agrees with Matthias: every step should be done explicitly:
declaration parsing in __init__( I decided about this )
build_code_creator() <- creates code creators tree, user has full control on module_creator.creator_t class initialization
write_module <- writes module to file
split_module <- splits module code to mutliple files
I will post about those changes on mailing list later.
Index: environment.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/py_date_time/environment.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** environment.py 28 Nov 2005 10:47:02 -0000 1.7
--- environment.py 21 Mar 2006 08:07:25 -0000 1.8
***************
*** 22,26 ****
date_time_pypp_include = ''
! defined_symbols = []#[ 'BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS'
# , 'DATE_TIME_INLINE' ]
if sys.platform == 'win32':
--- 22,26 ----
date_time_pypp_include = ''
! defined_symbols = ['BOOST_DATE_TIME_NO_MEMBER_INIT']#[ 'BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS'
# , 'DATE_TIME_INLINE' ]
if sys.platform == 'win32':
--- NEW FILE: profile_pypp.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 hotshot
import hotshot.stats
from environment import settings
import create_date_time
if __name__ == "__main__":
statistics_file = os.path.join( settings.generated_files_dir, 'profile.stat' )
profile = hotshot.Profile(statistics_file)
profile.runcall( create_date_time.export )
profile.close()
statistics = hotshot.stats.load( statistics_file )
statistics.strip_dirs()
statistics.sort_stats( 'time', 'calls' )
statistics.print_stats( 20 )
Index: create_date_time.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/py_date_time/create_date_time.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** create_date_time.py 20 Mar 2006 05:47:56 -0000 1.32
--- create_date_time.py 21 Mar 2006 08:07:25 -0000 1.33
***************
*** 14,19 ****
from pygccxml import declarations
from pyplusplus import code_creators
- from pyplusplus import module_creator
- from pyplusplus import file_writers
import customization_data
from pyplusplus import module_builder
--- 14,17 ----
***************
*** 45,50 ****
def create_module_builder(self):
date_time_xml_file = self._create_xml_file()
! mb = module_builder.module_builder_t( settings.module_name
! , [ parser.create_gccxml_fc( date_time_xml_file ) ]
, self.__parser_config )
if sys.platform == 'win32':
--- 43,47 ----
def create_module_builder(self):
date_time_xml_file = self._create_xml_file()
! mb = module_builder.module_builder_t( [ parser.create_gccxml_fc( date_time_xml_file ) ]
, self.__parser_config )
if sys.platform == 'win32':
***************
*** 65,80 ****
def filter_declarations(self, mb ):
mb.global_ns.exclude()
! mb.namespace( '::pyplusplus' ).include()
! mb.namespace( '::boost::posix_time' ).include()
! mb.namespace( '::boost::date_time' ).include()
! mb.namespace( '::boost::gregorian' ).include()
! mb.namespace( '::boost::local_time' ).include()
! mb.classes( lambda decl: decl.name.startswith( 'constrained_value' ) ).include()
to_be_removed = [ 'month_str_to_ushort', 'from_stream_type', 'parse_date' ]
! mb.calldefs( lambda decl: decl.name in to_be_removed ).exclude()
! to_be_removed = [ 'c_time', 'duration_traits_long', 'duration_traits_adapted' ]
! mb.classes( lambda decl: decl.name in to_be_removed ).exclude()
starts_with = [ 'time_resolution_traits<'
--- 62,82 ----
def filter_declarations(self, mb ):
mb.global_ns.exclude()
! mb.global_ns.namespace( 'pyplusplus', recursive=False ).include()
! boost_ns = mb.global_ns.namespace( 'boost', recursive=False )
! boost_ns.namespace( 'posix_time', recursive=False ).include()
! boost_ns.namespace( 'date_time', recursive=False ).include()
! boost_ns.namespace( 'gregorian', recursive=False ).include()
! boost_ns.namespace( 'local_time', recursive=False ).include()
! boost_ns.classes( lambda decl: decl.name.startswith( 'constrained_value<' ) ).include()
to_be_removed = [ 'month_str_to_ushort', 'from_stream_type', 'parse_date' ]
! boost_ns.calldefs( lambda decl: decl.name in to_be_removed ).exclude()
! to_be_removed = [ 'c_time'
! , 'duration_traits_long'
! , 'duration_traits_adapted'
! , 'posix_time_system_config' #TODO find out link bug
! , 'millisec_posix_time_system_config' ]
! boost_ns.classes( lambda decl: decl.name in to_be_removed ).exclude()
starts_with = [ 'time_resolution_traits<'
***************
*** 86,103 ****
, 'special_values_formatter<' ]
for name in starts_with:
! mb.classes( lambda decl: decl.name.startswith( name ) ).exclude()
ends_with = [ '_impl', '_traits', '_config', '_formatter']
for name in starts_with:
! mb.classes( lambda decl: decl.name.endswith( name ) ).exclude()
#boost.date_time has problem to create local_[micro]sec_clock
#variable, it has nothing to do with pyplusplus
! empty_classes = ['local_microsec_clock', 'local_sec_clock', 'microsec_clock', 'second_clock' ]
! classes = mb.classes( lambda decl: decl.alias in empty_classes )
classes.exclude()
classes.ignore = False
- #todo: fix me
tdi = mb.class_( lambda decl: decl.alias == 'time_duration_impl' )
tdi_init = tdi.constructor( arg_types=[None, None, None, None], recursive=False)
--- 88,104 ----
, 'special_values_formatter<' ]
for name in starts_with:
! boost_ns.classes( lambda decl: decl.name.startswith( name ) ).exclude()
ends_with = [ '_impl', '_traits', '_config', '_formatter']
for name in starts_with:
! boost_ns.classes( lambda decl: decl.name.endswith( name ) ).exclude()
#boost.date_time has problem to create local_[micro]sec_clock
#variable, it has nothing to do with pyplusplus
! empty_classes = ['local_microsec_clock', 'local_sec_clock' ]
! classes = boost_ns.classes( lambda decl: decl.alias in empty_classes )
classes.exclude()
classes.ignore = False
tdi = mb.class_( lambda decl: decl.alias == 'time_duration_impl' )
tdi_init = tdi.constructor( arg_types=[None, None, None, None], recursive=False)
***************
*** 106,110 ****
def fix_free_template_functions(self, mb):
! mb.free_functions().create_with_signature = True
#This function fixes some boost.date_time function signatures
--- 107,112 ----
def fix_free_template_functions(self, mb):
! boost_ns = mb.global_ns.namespace( 'boost', recursive=False )
! boost_ns.free_functions().create_with_signature = True
#This function fixes some boost.date_time function signatures
***************
*** 115,119 ****
, 'parse_undelimited_date'
, 'str_from_delimited_time_duration']
! functions = mb.free_functions( lambda decl: decl.name in tmpl_on_return_type )
for function in functions:
function.alias = function.name
--- 117,121 ----
, 'parse_undelimited_date'
, 'str_from_delimited_time_duration']
! functions = boost_ns.free_functions( lambda decl: decl.name in tmpl_on_return_type )
for function in functions:
function.alias = function.name
***************
*** 122,126 ****
#template on second argument
! functions = mb.free_functions( 'from_simple_string_type' )
functions.create_with_signature = False
for function in functions:
--- 124,128 ----
#template on second argument
! functions = boost_ns.free_functions( 'from_simple_string_type' )
functions.create_with_signature = False
for function in functions:
***************
*** 139,143 ****
, 'to_sql_string_type' ]
! functions = mb.free_functions( lambda decl: decl.name in tmpl_on_char_type )
for function in functions:
function.alias = function.name
--- 141,145 ----
, 'to_sql_string_type' ]
! functions = boost_ns.free_functions( lambda decl: decl.name in tmpl_on_char_type )
for function in functions:
function.alias = function.name
***************
*** 151,155 ****
def replace_include_directives( self, mb ):
! extmodule = mb.module_creator
includes = filter( lambda creator: isinstance( creator, code_creators.include_t )
, extmodule.creators )
--- 153,157 ----
def replace_include_directives( self, mb ):
! extmodule = mb.code_creator
includes = filter( lambda creator: isinstance( creator, code_creators.include_t )
, extmodule.creators )
***************
*** 160,167 ****
def add_code( self, mb ):
- #boost.date_time has a lot of templates, not all functions
- #are instantiated during GCCXML scan.
- min_template = 'def( "min", &%s::min, bp::default_call_policies() )'
- max_template = 'def( "max", &%s::max, bp::default_call_policies() )'
as_number_template = 'def( "as_number", &%(class_def)s::operator %(class_def)s::value_type, bp::default_call_policies() )'
--- 162,165 ----
***************
*** 185,189 ****
def beautify_code( self, mb ):
! extmodule = mb.module_creator
position = extmodule.last_include_index() + 1
extmodule.adopt_creator( code_creators.namespace_using_t( 'boost' )
--- 183,187 ----
def beautify_code( self, mb ):
! extmodule = mb.code_creator
position = extmodule.last_include_index() + 1
extmodule.adopt_creator( code_creators.namespace_using_t( 'boost' )
***************
*** 201,205 ****
def customize_extmodule( self, mb ):
! extmodule = mb.module_creator
#beautifying include code generation
extmodule.license = customization_data.license
--- 199,203 ----
def customize_extmodule( self, mb ):
! extmodule = mb.code_creator
#beautifying include code generation
extmodule.license = customization_data.license
***************
*** 213,217 ****
def write_files( self, mb ):
! mb.write_multiple_files( settings.generated_files_dir )
shutil.copyfile( os.path.join( settings.date_time_pypp_include, 'date_time_wrapper.hpp' )
, os.path.join( settings.generated_files_dir, 'date_time_wrapper.hpp' ) )
--- 211,215 ----
def write_files( self, mb ):
! mb.split_module( settings.generated_files_dir )
shutil.copyfile( os.path.join( settings.date_time_pypp_include, 'date_time_wrapper.hpp' )
, os.path.join( settings.generated_files_dir, 'date_time_wrapper.hpp' ) )
***************
*** 223,226 ****
--- 221,227 ----
self.fix_free_template_functions( mb )
self.add_code( mb )
+
+ mb.build_code_creator( settings.module_name )
+
self.customize_extmodule( mb )
self.write_files( mb )
Index: _date_time_.vcproj
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/py_date_time/_date_time_.vcproj,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** _date_time_.vcproj 20 Mar 2006 05:47:56 -0000 1.5
--- _date_time_.vcproj 21 Mar 2006 08:07:25 -0000 1.6
***************
*** 127,226 ****
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
- RelativePath=".\generated\__impl_details_1.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_10.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_11.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_12.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_13.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_14.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_15.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_16.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_17.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_18.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_19.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_2.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_20.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_21.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_22.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_23.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_24.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_25.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_26.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_27.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_28.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_29.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_3.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_30.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_31.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_32.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_4.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_5.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_6.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_7.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_8.pypp.cpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_9.pypp.cpp">
- </File>
- <File
RelativePath=".\generated\_date_time_.main.cpp">
</File>
--- 127,130 ----
***************
*** 501,600 ****
</File>
<File
- RelativePath=".\generated\__impl_details_1.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_10.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_11.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_12.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_13.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_14.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_15.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_16.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_17.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_18.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_19.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_2.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_20.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_21.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_22.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_23.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_24.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_25.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_26.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_27.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_28.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_29.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_3.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_30.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_31.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_32.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_4.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_5.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_6.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_7.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_8.pypp.hpp">
- </File>
- <File
- RelativePath=".\generated\__impl_details_9.pypp.hpp">
- </File>
- <File
RelativePath=".\generated\_date_time__enumerations.pypp.hpp">
</File>
--- 405,408 ----
***************
*** 768,774 ****
</File>
<File
- RelativePath=".\generated\millisec_posix_time_system_config.pypp.hpp">
- </File>
- <File
RelativePath=".\generated\milliseconds.pypp.hpp">
</File>
--- 576,579 ----
Index: _date_time_.suo
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/examples/py_date_time/_date_time_.suo,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
Binary files /tmp/cvsaOI8aC and /tmp/cvs1vBap9 differ
|