pygccxml-commit Mailing List for C++ Python language bindings (Page 16)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(190) |
Apr
(166) |
May
(170) |
Jun
(75) |
Jul
(105) |
Aug
(131) |
Sep
(99) |
Oct
(84) |
Nov
(67) |
Dec
(54) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(66) |
Feb
(49) |
Mar
(25) |
Apr
(62) |
May
(21) |
Jun
(34) |
Jul
(9) |
Aug
(21) |
Sep
(5) |
Oct
|
Nov
(63) |
Dec
(34) |
| 2008 |
Jan
(10) |
Feb
(42) |
Mar
(26) |
Apr
(25) |
May
(6) |
Jun
(40) |
Jul
(18) |
Aug
(29) |
Sep
(6) |
Oct
(32) |
Nov
(14) |
Dec
(56) |
| 2009 |
Jan
(127) |
Feb
(52) |
Mar
(2) |
Apr
(10) |
May
(29) |
Jun
(3) |
Jul
|
Aug
(16) |
Sep
(4) |
Oct
(11) |
Nov
(8) |
Dec
(14) |
| 2010 |
Jan
(31) |
Feb
(1) |
Mar
(7) |
Apr
(9) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
(8) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <rom...@us...> - 2008-12-21 19:02:12
|
Revision: 1482
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1482&view=rev
Author: roman_yakovenko
Date: 2008-12-21 19:02:08 +0000 (Sun, 21 Dec 2008)
Log Message:
-----------
Removed Paths:
-------------
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.suo
Deleted: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-21 13:19:34
|
Revision: 1481
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1481&view=rev
Author: roman_yakovenko
Date: 2008-12-21 13:19:29 +0000 (Sun, 21 Dec 2008)
Log Message:
-----------
small refactoring to allow addition of other code generators
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/module_builder/__init__.py
pyplusplus_dev/pyplusplus/module_builder/builder.py
Added Paths:
-----------
pyplusplus_dev/pyplusplus/module_builder/extension_builder.py
Modified: pyplusplus_dev/pyplusplus/module_builder/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_builder/__init__.py 2008-12-20 21:53:34 UTC (rev 1480)
+++ pyplusplus_dev/pyplusplus/module_builder/__init__.py 2008-12-21 13:19:29 UTC (rev 1481)
@@ -12,7 +12,7 @@
U{web site<http://www.language-binding.net>}
"""
-from builder import module_builder_t
+from extension_builder import extension_module_builder_t as module_builder_t
#aliases for functionality located in pygccxml.parser module
from pygccxml.parser import COMPILATION_MODE
Modified: pyplusplus_dev/pyplusplus/module_builder/builder.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_builder/builder.py 2008-12-20 21:53:34 UTC (rev 1480)
+++ pyplusplus_dev/pyplusplus/module_builder/builder.py 2008-12-21 13:19:29 UTC (rev 1481)
@@ -5,217 +5,46 @@
import os
import sys
-import time
-import types
-import warnings
-from pygccxml import parser
-from pygccxml import declarations as decls_package
-
-from pyplusplus import utils
from pyplusplus import _logging_
from pyplusplus import decl_wrappers
-from pyplusplus import file_writers
-from pyplusplus import code_creators
-from pyplusplus import module_creator as mcreator_package
-class module_builder_t(object):
+class base_builder_t(object):
"""
- This class provides users with simple and intuitive interface to Py++
- and/or pygccxml functionality. If this is your first attempt to use Py++
- consider to read tutorials. You can find them on U{web site<http://www.language-binding.net>}.
"""
def __init__( self
- , files
- , gccxml_path=''
- , working_directory='.'
- , include_paths=None
- , define_symbols=None
- , undefine_symbols=None
- , start_with_declarations=None
- , compilation_mode=None
- , cache=None
- , optimize_queries=True
- , ignore_gccxml_output=False
- , indexing_suite_version=1
- , cflags=""
+ , global_ns=None
, encoding='ascii'
- , compiler=None):
+ , working_directory='.' ):
"""
- @param files: list of files, declarations from them you want to export
- @type files: list of strings or L{file_configuration_t} instances
-
- @param gccxml_path: path to gccxml binary. If you don't pass this argument,
- pygccxml parser will try to locate it using you environment PATH variable
- @type gccxml_path: str
-
- @param include_paths: additional header files location. You don't have to
- specify system and standard directories.
- @type include_paths: list of strings
-
- @param define_symbols: list of symbols to be defined for preprocessor.
- @param define_symbols: list of strings
-
- @param undefine_symbols: list of symbols to be undefined for preprocessor.
- @param undefine_symbols: list of strings
-
- @param cflags: Raw string to be added to gccxml command line.
"""
object.__init__( self )
self.logger = _logging_.loggers.module_builder
self.__encoding = encoding
- gccxml_config = parser.config_t(
- gccxml_path=gccxml_path
- , working_directory=working_directory
- , include_paths=include_paths
- , define_symbols=define_symbols
- , undefine_symbols=undefine_symbols
- , start_with_declarations=start_with_declarations
- , ignore_gccxml_output=ignore_gccxml_output
- , cflags=cflags
- , compiler=compiler)
+ self.__global_ns = global_ns
- #may be in future I will add those directories to user_defined_directories
- #to self.__code_creator.
- self.__working_dir = os.path.abspath( working_directory )
+ def __get_global_ns( self ):
+ return self.__global_ns
- self.__parsed_files = map( decls_package.filtering.normalize_path
- , parser.project_reader_t.get_os_file_names( files ) )
- tmp = map( lambda file_: os.path.split( file_ )[0], self.__parsed_files )
- self.__parsed_dirs = filter( None, tmp )
+ def __set_global_ns( self, global_ns ):
+ self.__global_ns = global_ns
- self.__global_ns = self.__parse_declarations( files
- , gccxml_config
- , compilation_mode
- , cache
- , indexing_suite_version)
- self.__code_creator = None
- if optimize_queries:
- self.run_query_optimizer()
+ global_ns = property( __get_global_ns, __set_global_ns
+ , doc="""reference to global namespace""" )
- self.__declarations_code_head = []
- self.__declarations_code_tail = []
-
- self.__registrations_code_head = []
- self.__registrations_code_tail = []
-
@property
- def global_ns( self ):
- """reference to global namespace"""
- return self.__global_ns
-
- @property
def encoding( self ):
return self.__encoding
- def register_module_dependency( self, other_module_generated_code_dir ):
- """``already_exposed`` solution is pretty good when you mix hand-written
- modules with Py++ generated. It doesn't work/scale for "true"
- multi-module development. This is exactly the reason why ``Py++``_
- offers "semi automatic" solution.
-
- For every exposed module, ``Py++``_ generates "exposed_decl.pypp.txt" file.
- This file contains the list of all parsed declarations and whether they
- were included or excluded. Later, when you work on another module, you
- can tell ``Py++``_ that the current module depends on the previously
- generated one. ``Py++``_ will load "exposed_decl.pypp.txt" file and
- update the declarations.
- """
-
- db = utils.exposed_decls_db_t()
- db.load( other_module_generated_code_dir )
- db.update_decls( self.global_ns )
-
def run_query_optimizer(self):
"""
It is possible to optimze time that takes to execute queries. In most cases
this is done from __init__ method. But there are use-case, when you need
to disable optimizer at __init__ and run it later.
"""
- self.__global_ns.init_optimizer()
+ self.global_ns.init_optimizer()
- def __parse_declarations( self, files, gccxml_config, compilation_mode, cache, indexing_suite_version ):
- if None is gccxml_config:
- gccxml_config = parser.config_t()
- if None is compilation_mode:
- compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE
- start_time = time.clock()
- self.logger.debug( 'parsing files - started' )
- reader = parser.project_reader_t( gccxml_config, cache, decl_wrappers.dwfactory_t() )
- decls = reader.read_files( files, compilation_mode )
-
- self.logger.debug( 'parsing files - done( %f seconds )' % ( time.clock() - start_time ) )
- self.logger.debug( 'settings declarations defaults - started' )
-
- global_ns = decls_package.matcher.get_single(
- decls_package.namespace_matcher_t( name='::' )
- , decls )
- if indexing_suite_version != 1:
- for cls in global_ns.classes():
- cls.indexing_suite_version = indexing_suite_version
- for cls in global_ns.decls(decl_type=decls_package.class_declaration_t):
- cls.indexing_suite_version = indexing_suite_version
-
- start_time = time.clock()
- self.__apply_decls_defaults(decls)
- self.logger.debug( 'settings declarations defaults - done( %f seconds )'
- % ( time.clock() - start_time ) )
- return global_ns
-
- def __filter_by_location( self, flatten_decls ):
- for decl in flatten_decls:
- if not decl.location:
- continue
- fpath = decls_package.filtering.normalize_path( decl.location.file_name )
- if decls_package.filtering.contains_parent_dir( fpath, self.__parsed_dirs ):
- continue
- if fpath in self.__parsed_files:
- continue
- found = False
- for pfile in self.__parsed_files:
- if fpath.endswith( pfile ):
- found = True
- break
- if not found:
- decl.exclude()
-
- def __apply_decls_defaults(self, decls):
- flatten_decls = decls_package.make_flatten( decls )
- self.__filter_by_location( flatten_decls )
- call_policies_resolver = mcreator_package.built_in_resolver_t()
- calldefs = filter( lambda decl: isinstance( decl, decls_package.calldef_t )
- , flatten_decls )
- map( lambda calldef: calldef.set_call_policies( call_policies_resolver( calldef ) )
- , calldefs )
- mem_vars = filter( lambda decl: isinstance( decl, decls_package.variable_t )
- and isinstance( decl.parent, decls_package.class_t )
- , flatten_decls )
- map( lambda mem_var: mem_var.set_getter_call_policies( call_policies_resolver( mem_var, 'get' ) )
- , mem_vars )
- map( lambda mem_var: mem_var.set_setter_call_policies( call_policies_resolver( mem_var, 'set' ) )
- , mem_vars )
-
- @property
- def declarations_code_head( self ):
- "List of user code, that will be added to the head of the declarations section."
- return self.__declarations_code_head
-
- @property
- def declarations_code_tail( self ):
- "List of user code, that will be added to the tail of the declarations section."
- return self.__declarations_code_tail
-
- @property
- def registrations_code_head( self ):
- "List of user code, that will be added to the head of the registrations section."
- return self.__registrations_code_head
-
- @property
- def registrations_code_tail( self ):
- "List of user code, that will be added to the tail of the registrations section."
- return self.__registrations_code_tail
-
def print_declarations(self, decl=None, detailed=True, recursive=True, writer=sys.stdout.write):
"""
This function will print detailed description of all declarations or
@@ -228,225 +57,6 @@
decl = self.global_ns
decl_wrappers.print_declarations( decl, detailed, recursive, writer )
- def build_code_creator( self
- , module_name
- , boost_python_ns_name='bp'
- , create_casting_constructor=True
- , call_policies_resolver_=None
- , types_db=None
- , target_configuration=None
- , enable_indexing_suite=True
- , doc_extractor=None):
- """
- Creates L{module_t} code creator.
-
- @param module_name: module name
- @type module_name: string
-
- @param boost_python_ns_name: boost::python namespace alias, by default
- it is 'bp'
- @type boost_python_ns_name: string
-
- @param call_policies_resolver_: callable, that will be invoked on every
- calldef object. It should return call policies.
- @type call_policies_resolver_: callable
- @param doc_extractor: callable, that takes as argument reference to declaration
- and returns documentation string
- @type doc_extractor: callable or None
- """
- if not create_casting_constructor:
- msg = os.linesep.join([
- "create_casting_constructor argument is deprecated."
- , "If want to disable boost::python::implicitly_convertible code generation, consider to use allow_implicit_conversion constructor property"
- , ">>> mb = module_builder_t(...)"
- , ">>> mb.constructors().allow_implicit_conversion = False"])
- warnings.warn(msg, DeprecationWarning, stacklevel=2)
-
- self.global_ns.constructors(allow_empty=True).allow_implicit_conversion = False
-
- creator = mcreator_package.creator_t( self.global_ns
- , module_name
- , boost_python_ns_name
- , call_policies_resolver_
- , types_db
- , target_configuration
- , enable_indexing_suite
- , doc_extractor)
- self.__code_creator = creator.create()
- self.__code_creator.replace_included_headers(self.__parsed_files)
- #I think I should ask users, what they expect
- #self.__code_creator.user_defined_directories.append( self.__working_dir )
- #map( self.__code_creator.user_defined_directories.append
- # , self.__parsed_dirs )
-
- return self.__code_creator
-
- @property
- def code_creator( self ):
- "reference to L{code_creators.module_t} instance"
- if not self.__code_creator:
- raise RuntimeError( "self.module is equal to None. Did you forget to call build_code_creator function?" )
- return self.__code_creator
-
- def has_code_creator( self ):
- """
- Function, that will return True if build_code_creator function has been
- called and False otherwise
- """
- return not ( None is self.__code_creator )
-
- def add_declaration_code( self, code, tail=True ):
- if tail:
- self.__declarations_code_tail.append( code )
- else:
- self.__declarations_code_head.append( code )
-
- def add_registration_code( self, code, tail=True ):
- if tail:
- self.__registrations_code_tail.append( code )
- else:
- self.__registrations_code_head.append( code )
-
- def add_constants( self, **keywds ):
- """adds code that exposes some constants to Python.
-
- For example:
- mb.add_constants( version='"1.2.3"' )
- or
- mb.add_constants( **{ version:'"1.2.3"' } )
- will generate next code:
- boost::python::scope().attr("version") = "1.2.3";
- """
- tmpl = 'boost::python::scope().attr("%(name)s") = %(value)s;'
- for name, value in keywds.items():
- if not isinstance( value, types.StringTypes ):
- value = str( value )
- self.add_registration_code( tmpl % dict( name=name, value=value) )
-
-
- def __merge_user_code( self ):
- for code in self.__declarations_code_tail:
- self.code_creator.add_declaration_code( code, -1 )
-
- for code in self.__declarations_code_head:
- self.code_creator.add_declaration_code( code, 0 )
-
- body = self.code_creator.body
-
- for code in self.__registrations_code_tail:
- body.adopt_creator( code_creators.custom_text_t( code ), -1 )
-
- for code in self.__registrations_code_head:
- body.adopt_creator( code_creators.custom_text_t( code ), 0 )
-
-
- def write_module( self, file_name ):
- """
- Writes module to single file
- @param file_name: file name
- @type file_name: string
- """
- self.__merge_user_code()
- file_writers.write_file( self.code_creator, file_name, encoding=self.encoding )
-
- def __work_on_unused_files( self, dir_name, written_files, on_unused_file_found ):
- all_files = os.listdir( dir_name )
- all_files = map( lambda fname: os.path.join( dir_name, fname ), all_files )
- all_files = filter( file_writers.has_pypp_extenstion, all_files )
-
- unused_files = set( all_files ).difference( set( written_files ) )
- for fpath in unused_files:
- try:
- if on_unused_file_found is os.remove:
- self.logger.info( 'removing file "%s"' % fpath )
- on_unused_file_found( fpath )
- except Exception, error:
- self.logger.exception( "Exception was catched, while executing 'on_unused_file_found' function." )
-
- def split_module( self
- , dir_name
- , huge_classes=None
- , on_unused_file_found=os.remove
- , use_files_sum_repository=False):
- """
- Writes module to multiple files
-
- @param dir_name: directory name
- @type dir_name: string
-
- @param huge_classes: list that contains reference to classes, that should be split
-
- @param on_unused_file_found: callable object that represents the action that should be taken on
- file, which is no more in use
-
- @use_files_sum_repository: Py++ can generate file, which will contain md5 sum of every generated file.
- Next time you generate code, md5sum will be loaded from the file and compared.
- This could speed-up code generation process by 10-15%.
- """
- self.__merge_user_code()
-
- files_sum_repository = None
- if use_files_sum_repository:
- cache_file = os.path.join( dir_name, self.code_creator.body.name + '.md5.sum' )
- files_sum_repository = file_writers.cached_repository_t( cache_file )
-
- written_files = []
- if None is huge_classes:
- written_files = file_writers.write_multiple_files(
- self.code_creator
- , dir_name
- , files_sum_repository=files_sum_repository
- , encoding=self.encoding)
- else:
- written_files = file_writers.write_class_multiple_files(
- self.code_creator
- , dir_name
- , huge_classes
- , files_sum_repository=files_sum_repository
- , encoding=self.encoding)
- self.__work_on_unused_files( dir_name, written_files, on_unused_file_found )
-
- return written_files
-
- def balanced_split_module( self
- , dir_name
- , number_of_files
- , on_unused_file_found=os.remove
- , use_files_sum_repository=False):
- """
- Writes module to fixed number of multiple cpp files
-
- @param number_of_files: the desired number of generated cpp files
- @type number_of_files: int
-
- @param dir_name: directory name
- @type dir_name: string
-
- @param on_unused_file_found: callable object that represents the action that should be taken on
- file, which is no more in use
-
- @use_files_sum_repository: Py++ can generate file, which will contain md5 sum of every generated file.
- Next time you generate code, md5sum will be loaded from the file and compared.
- This could speed-up code generation process by 10-15%.
- """
- self.__merge_user_code()
-
- files_sum_repository = None
- if use_files_sum_repository:
- cache_file = os.path.join( dir_name, self.code_creator.body.name + '.md5.sum' )
- files_sum_repository = file_writers.cached_repository_t( cache_file )
-
- written_files = file_writers.write_balanced_files( self.code_creator
- , dir_name
- , number_of_buckets=number_of_files
- , files_sum_repository=files_sum_repository
- , encoding=self.encoding)
-
- self.__work_on_unused_files( dir_name, written_files, on_unused_file_found )
-
- return written_files
-
-
#select decl(s) interfaces
def decl( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ):
"""Please see L{decl_wrappers.scopedef_t} class documentation"""
@@ -701,9 +311,3 @@
, header_dir=header_dir
, header_file=header_file
, recursive=recursive )
-
- def _get_BOOST_PYTHON_MAX_ARITY( self ):
- return decl_wrappers.calldef_t.BOOST_PYTHON_MAX_ARITY
- def _set_BOOST_PYTHON_MAX_ARITY( self, value ):
- decl_wrappers.calldef_t.BOOST_PYTHON_MAX_ARITY = value
- BOOST_PYTHON_MAX_ARITY = property( _get_BOOST_PYTHON_MAX_ARITY, _set_BOOST_PYTHON_MAX_ARITY )
Added: pyplusplus_dev/pyplusplus/module_builder/extension_builder.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_builder/extension_builder.py (rev 0)
+++ pyplusplus_dev/pyplusplus/module_builder/extension_builder.py 2008-12-21 13:19:29 UTC (rev 1481)
@@ -0,0 +1,429 @@
+# Copyright 2004-2008 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 time
+import types
+import builder
+import warnings
+
+from pygccxml import parser
+from pygccxml import declarations as decls_package
+
+from pyplusplus import utils
+from pyplusplus import _logging_
+from pyplusplus import decl_wrappers
+from pyplusplus import file_writers
+from pyplusplus import code_creators
+from pyplusplus import module_creator as mcreator_package
+
+class extension_module_builder_t(builder.base_builder_t):
+ """
+ This class provides users with simple and intuitive interface to Py++
+ and/or pygccxml functionality. If this is your first attempt to use Py++
+ consider to read tutorials. You can find them on U{web site<http://www.language-binding.net>}.
+ """
+
+ def __init__( self
+ , files
+ , gccxml_path=''
+ , working_directory='.'
+ , include_paths=None
+ , define_symbols=None
+ , undefine_symbols=None
+ , start_with_declarations=None
+ , compilation_mode=None
+ , cache=None
+ , optimize_queries=True
+ , ignore_gccxml_output=False
+ , indexing_suite_version=1
+ , cflags=""
+ , encoding='ascii'
+ , compiler=None):
+ """
+ @param files: list of files, declarations from them you want to export
+ @type files: list of strings or L{file_configuration_t} instances
+
+ @param gccxml_path: path to gccxml binary. If you don't pass this argument,
+ pygccxml parser will try to locate it using you environment PATH variable
+ @type gccxml_path: str
+
+ @param include_paths: additional header files location. You don't have to
+ specify system and standard directories.
+ @type include_paths: list of strings
+
+ @param define_symbols: list of symbols to be defined for preprocessor.
+ @param define_symbols: list of strings
+
+ @param undefine_symbols: list of symbols to be undefined for preprocessor.
+ @param undefine_symbols: list of strings
+
+ @param cflags: Raw string to be added to gccxml command line.
+ """
+ builder.base_builder_t.__init__( self
+ , global_ns=None
+ , encoding=encoding
+ , working_directory=working_directory )
+
+ gccxml_config = parser.config_t( gccxml_path=gccxml_path
+ , working_directory=working_directory
+ , include_paths=include_paths
+ , define_symbols=define_symbols
+ , undefine_symbols=undefine_symbols
+ , start_with_declarations=start_with_declarations
+ , ignore_gccxml_output=ignore_gccxml_output
+ , cflags=cflags
+ , compiler=compiler)
+
+ #may be in future I will add those directories to user_defined_directories
+ #to self.__code_creator.
+ self.__working_dir = os.path.abspath( working_directory )
+
+ self.__parsed_files = map( decls_package.filtering.normalize_path
+ , parser.project_reader_t.get_os_file_names( files ) )
+ tmp = map( lambda file_: os.path.split( file_ )[0], self.__parsed_files )
+ self.__parsed_dirs = filter( None, tmp )
+
+ self.global_ns = self.__parse_declarations( files
+ , gccxml_config
+ , compilation_mode
+ , cache
+ , indexing_suite_version)
+ self.__code_creator = None
+ if optimize_queries:
+ self.run_query_optimizer()
+
+ self.__declarations_code_head = []
+ self.__declarations_code_tail = []
+
+ self.__registrations_code_head = []
+ self.__registrations_code_tail = []
+
+
+
+ def register_module_dependency( self, other_module_generated_code_dir ):
+ """``already_exposed`` solution is pretty good when you mix hand-written
+ modules with Py++ generated. It doesn't work/scale for "true"
+ multi-module development. This is exactly the reason why ``Py++``_
+ offers "semi automatic" solution.
+
+ For every exposed module, ``Py++``_ generates "exposed_decl.pypp.txt" file.
+ This file contains the list of all parsed declarations and whether they
+ were included or excluded. Later, when you work on another module, you
+ can tell ``Py++``_ that the current module depends on the previously
+ generated one. ``Py++``_ will load "exposed_decl.pypp.txt" file and
+ update the declarations.
+ """
+
+ db = utils.exposed_decls_db_t()
+ db.load( other_module_generated_code_dir )
+ db.update_decls( self.global_ns )
+
+
+ def __parse_declarations( self, files, gccxml_config, compilation_mode, cache, indexing_suite_version ):
+ if None is gccxml_config:
+ gccxml_config = parser.config_t()
+ if None is compilation_mode:
+ compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE
+ start_time = time.clock()
+ self.logger.debug( 'parsing files - started' )
+ reader = parser.project_reader_t( gccxml_config, cache, decl_wrappers.dwfactory_t() )
+ decls = reader.read_files( files, compilation_mode )
+
+ self.logger.debug( 'parsing files - done( %f seconds )' % ( time.clock() - start_time ) )
+ self.logger.debug( 'settings declarations defaults - started' )
+
+ global_ns = decls_package.matcher.get_single(
+ decls_package.namespace_matcher_t( name='::' )
+ , decls )
+ if indexing_suite_version != 1:
+ for cls in global_ns.classes():
+ cls.indexing_suite_version = indexing_suite_version
+ for cls in global_ns.decls(decl_type=decls_package.class_declaration_t):
+ cls.indexing_suite_version = indexing_suite_version
+
+ start_time = time.clock()
+ self.__apply_decls_defaults(decls)
+ self.logger.debug( 'settings declarations defaults - done( %f seconds )'
+ % ( time.clock() - start_time ) )
+ return global_ns
+
+ def __filter_by_location( self, flatten_decls ):
+ for decl in flatten_decls:
+ if not decl.location:
+ continue
+ fpath = decls_package.filtering.normalize_path( decl.location.file_name )
+ if decls_package.filtering.contains_parent_dir( fpath, self.__parsed_dirs ):
+ continue
+ if fpath in self.__parsed_files:
+ continue
+ found = False
+ for pfile in self.__parsed_files:
+ if fpath.endswith( pfile ):
+ found = True
+ break
+ if not found:
+ decl.exclude()
+
+ def __apply_decls_defaults(self, decls):
+ flatten_decls = decls_package.make_flatten( decls )
+ self.__filter_by_location( flatten_decls )
+ call_policies_resolver = mcreator_package.built_in_resolver_t()
+ calldefs = filter( lambda decl: isinstance( decl, decls_package.calldef_t )
+ , flatten_decls )
+ map( lambda calldef: calldef.set_call_policies( call_policies_resolver( calldef ) )
+ , calldefs )
+ mem_vars = filter( lambda decl: isinstance( decl, decls_package.variable_t )
+ and isinstance( decl.parent, decls_package.class_t )
+ , flatten_decls )
+ map( lambda mem_var: mem_var.set_getter_call_policies( call_policies_resolver( mem_var, 'get' ) )
+ , mem_vars )
+ map( lambda mem_var: mem_var.set_setter_call_policies( call_policies_resolver( mem_var, 'set' ) )
+ , mem_vars )
+
+ @property
+ def declarations_code_head( self ):
+ "List of user code, that will be added to the head of the declarations section."
+ return self.__declarations_code_head
+
+ @property
+ def declarations_code_tail( self ):
+ "List of user code, that will be added to the tail of the declarations section."
+ return self.__declarations_code_tail
+
+ @property
+ def registrations_code_head( self ):
+ "List of user code, that will be added to the head of the registrations section."
+ return self.__registrations_code_head
+
+ @property
+ def registrations_code_tail( self ):
+ "List of user code, that will be added to the tail of the registrations section."
+ return self.__registrations_code_tail
+
+ def build_code_creator( self
+ , module_name
+ , boost_python_ns_name='bp'
+ , create_casting_constructor=True
+ , call_policies_resolver_=None
+ , types_db=None
+ , target_configuration=None
+ , enable_indexing_suite=True
+ , doc_extractor=None):
+ """
+ Creates L{module_t} code creator.
+
+ @param module_name: module name
+ @type module_name: string
+
+ @param boost_python_ns_name: boost::python namespace alias, by default
+ it is 'bp'
+ @type boost_python_ns_name: string
+
+ @param call_policies_resolver_: callable, that will be invoked on every
+ calldef object. It should return call policies.
+ @type call_policies_resolver_: callable
+ @param doc_extractor: callable, that takes as argument reference to declaration
+ and returns documentation string
+ @type doc_extractor: callable or None
+ """
+ if not create_casting_constructor:
+ msg = os.linesep.join([
+ "create_casting_constructor argument is deprecated."
+ , "If want to disable boost::python::implicitly_convertible code generation, consider to use allow_implicit_conversion constructor property"
+ , ">>> mb = module_builder_t(...)"
+ , ">>> mb.constructors().allow_implicit_conversion = False"])
+ warnings.warn(msg, DeprecationWarning, stacklevel=2)
+
+ self.global_ns.constructors(allow_empty=True).allow_implicit_conversion = False
+
+ creator = mcreator_package.creator_t( self.global_ns
+ , module_name
+ , boost_python_ns_name
+ , call_policies_resolver_
+ , types_db
+ , target_configuration
+ , enable_indexing_suite
+ , doc_extractor)
+ self.__code_creator = creator.create()
+ self.__code_creator.replace_included_headers(self.__parsed_files)
+ #I think I should ask users, what they expect
+ #self.__code_creator.user_defined_directories.append( self.__working_dir )
+ #map( self.__code_creator.user_defined_directories.append
+ # , self.__parsed_dirs )
+
+ return self.__code_creator
+
+ @property
+ def code_creator( self ):
+ "reference to L{code_creators.module_t} instance"
+ if not self.__code_creator:
+ raise RuntimeError( "self.module is equal to None. Did you forget to call build_code_creator function?" )
+ return self.__code_creator
+
+ def has_code_creator( self ):
+ """
+ Function, that will return True if build_code_creator function has been
+ called and False otherwise
+ """
+ return not ( None is self.__code_creator )
+
+ def add_declaration_code( self, code, tail=True ):
+ if tail:
+ self.__declarations_code_tail.append( code )
+ else:
+ self.__declarations_code_head.append( code )
+
+ def add_registration_code( self, code, tail=True ):
+ if tail:
+ self.__registrations_code_tail.append( code )
+ else:
+ self.__registrations_code_head.append( code )
+
+ def add_constants( self, **keywds ):
+ """adds code that exposes some constants to Python.
+
+ For example:
+ mb.add_constants( version='"1.2.3"' )
+ or
+ mb.add_constants( **{ version:'"1.2.3"' } )
+ will generate next code:
+ boost::python::scope().attr("version") = "1.2.3";
+ """
+ tmpl = 'boost::python::scope().attr("%(name)s") = %(value)s;'
+ for name, value in keywds.items():
+ if not isinstance( value, types.StringTypes ):
+ value = str( value )
+ self.add_registration_code( tmpl % dict( name=name, value=value) )
+
+
+ def __merge_user_code( self ):
+ for code in self.__declarations_code_tail:
+ self.code_creator.add_declaration_code( code, -1 )
+
+ for code in self.__declarations_code_head:
+ self.code_creator.add_declaration_code( code, 0 )
+
+ body = self.code_creator.body
+
+ for code in self.__registrations_code_tail:
+ body.adopt_creator( code_creators.custom_text_t( code ), -1 )
+
+ for code in self.__registrations_code_head:
+ body.adopt_creator( code_creators.custom_text_t( code ), 0 )
+
+
+ def write_module( self, file_name ):
+ """
+ Writes module to single file
+ @param file_name: file name
+ @type file_name: string
+ """
+ self.__merge_user_code()
+ file_writers.write_file( self.code_creator, file_name, encoding=self.encoding )
+
+ def __work_on_unused_files( self, dir_name, written_files, on_unused_file_found ):
+ all_files = os.listdir( dir_name )
+ all_files = map( lambda fname: os.path.join( dir_name, fname ), all_files )
+ all_files = filter( file_writers.has_pypp_extenstion, all_files )
+
+ unused_files = set( all_files ).difference( set( written_files ) )
+ for fpath in unused_files:
+ try:
+ if on_unused_file_found is os.remove:
+ self.logger.info( 'removing file "%s"' % fpath )
+ on_unused_file_found( fpath )
+ except Exception, error:
+ self.logger.exception( "Exception was catched, while executing 'on_unused_file_found' function." )
+
+ def split_module( self
+ , dir_name
+ , huge_classes=None
+ , on_unused_file_found=os.remove
+ , use_files_sum_repository=False):
+ """
+ Writes module to multiple files
+
+ @param dir_name: directory name
+ @type dir_name: string
+
+ @param huge_classes: list that contains reference to classes, that should be split
+
+ @param on_unused_file_found: callable object that represents the action that should be taken on
+ file, which is no more in use
+
+ @use_files_sum_repository: Py++ can generate file, which will contain md5 sum of every generated file.
+ Next time you generate code, md5sum will be loaded from the file and compared.
+ This could speed-up code generation process by 10-15%.
+ """
+ self.__merge_user_code()
+
+ files_sum_repository = None
+ if use_files_sum_repository:
+ cache_file = os.path.join( dir_name, self.code_creator.body.name + '.md5.sum' )
+ files_sum_repository = file_writers.cached_repository_t( cache_file )
+
+ written_files = []
+ if None is huge_classes:
+ written_files = file_writers.write_multiple_files(
+ self.code_creator
+ , dir_name
+ , files_sum_repository=files_sum_repository
+ , encoding=self.encoding)
+ else:
+ written_files = file_writers.write_class_multiple_files(
+ self.code_creator
+ , dir_name
+ , huge_classes
+ , files_sum_repository=files_sum_repository
+ , encoding=self.encoding)
+ self.__work_on_unused_files( dir_name, written_files, on_unused_file_found )
+
+ return written_files
+
+ def balanced_split_module( self
+ , dir_name
+ , number_of_files
+ , on_unused_file_found=os.remove
+ , use_files_sum_repository=False):
+ """
+ Writes module to fixed number of multiple cpp files
+
+ @param number_of_files: the desired number of generated cpp files
+ @type number_of_files: int
+
+ @param dir_name: directory name
+ @type dir_name: string
+
+ @param on_unused_file_found: callable object that represents the action that should be taken on
+ file, which is no more in use
+
+ @use_files_sum_repository: Py++ can generate file, which will contain md5 sum of every generated file.
+ Next time you generate code, md5sum will be loaded from the file and compared.
+ This could speed-up code generation process by 10-15%.
+ """
+ self.__merge_user_code()
+
+ files_sum_repository = None
+ if use_files_sum_repository:
+ cache_file = os.path.join( dir_name, self.code_creator.body.name + '.md5.sum' )
+ files_sum_repository = file_writers.cached_repository_t( cache_file )
+
+ written_files = file_writers.write_balanced_files( self.code_creator
+ , dir_name
+ , number_of_buckets=number_of_files
+ , files_sum_repository=files_sum_repository
+ , encoding=self.encoding)
+
+ self.__work_on_unused_files( dir_name, written_files, on_unused_file_found )
+
+ return written_files
+
+ def _get_BOOST_PYTHON_MAX_ARITY( self ):
+ return decl_wrappers.calldef_t.BOOST_PYTHON_MAX_ARITY
+ def _set_BOOST_PYTHON_MAX_ARITY( self, value ):
+ decl_wrappers.calldef_t.BOOST_PYTHON_MAX_ARITY = value
+ BOOST_PYTHON_MAX_ARITY = property( _get_BOOST_PYTHON_MAX_ARITY, _set_BOOST_PYTHON_MAX_ARITY )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-20 21:53:38
|
Revision: 1480
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1480&view=rev
Author: roman_yakovenko
Date: 2008-12-20 21:53:34 +0000 (Sat, 20 Dec 2008)
Log Message:
-----------
adding convenience methods and some "understandings"
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/cpptypes/tester.py
Modified: pyplusplus_dev/pyplusplus/cpptypes/tester.py
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/tester.py 2008-12-20 19:23:18 UTC (rev 1479)
+++ pyplusplus_dev/pyplusplus/cpptypes/tester.py 2008-12-20 21:53:34 UTC (rev 1480)
@@ -24,9 +24,11 @@
return self.func( *args, **keywd )
class mem_fun_factory( object ):
- def __init__( self, dll, class_ ):
+ def __init__( self, dll, wrapper, class_name, namespace='' ):
self.dll = dll
- self.this_type = ctypes.POINTER( class_ )
+ self.namespace = namespace
+ self.class_name = class_name
+ self.this_type = ctypes.POINTER( wrapper )
def __call__( self, name, **keywd ):
if 'argtypes' not in keywd:
@@ -35,8 +37,58 @@
keywd['argtypes'].insert( 0, self.this_type )
return public( self.dll, name, **keywd )
+ def __get_ns_name(self):
+ if self.namespace:
+ return self.namespace + '::'
+ else:
+ return ''
-class Number(ctypes.Structure):
+ def default_constructor( self ):
+ return self( '%(ns)s%(class_name)s::%(class_name)s(void)'
+ % dict( ns=self.__get_ns_name()
+ , class_name=self.class_name ) )
+
+ def constructor( self, argtypes_str, **keywd ):
+ return self( '%(ns)s%(class_name)s::%(class_name)s(%(args)s)'
+ % dict( ns=self.__get_ns_name()
+ , class_name=self.class_name
+ , args=argtypes_str )
+ , **keywd )
+
+ def copy_constructor( self ):
+ return self( '%(ns)s%(class_name)s::%(class_name)s(%(class_name)s const &)'
+ % dict( ns=self.__get_ns_name()
+ , class_name=self.class_name )
+ , argtypes=[self.this_type] )
+
+ def destructor( self ):
+ return self( '%(ns)s%(class_name)s::~%(class_name)s(void)'
+ % dict( ns=self.__get_ns_name()
+ , class_name=self.class_name ) )
+
+ def operator_assign( self ):
+ return self( '%(ns)s%(class_name)s & %(class_name)s::operator=(%(class_name)s const &)'
+ % dict( ns=self.__get_ns_name()
+ , class_name=self.class_name )
+ , restype=self.this_type
+ , argtypes=[self.this_type] )
+
+ def method( self, name, restype_str=None, argtypes_str=None, **keywd ):
+ if None is restype_str:
+ restype_str = 'void'
+ if None is argtypes_str:
+ argtypes_str = 'void'
+
+ return self( '%(return_)s %(ns)s%(class_name)s::%(method_name)s(%(args)s)'
+ % dict( return_=restype_str
+ , ns=self.__get_ns_name()
+ , class_name=self.class_name
+ , method_name=name
+ , args=argtypes_str )
+ , **keywd )
+
+#names should be preserved
+class number_t(ctypes.Structure):
#http://www.phpcompiler.org/articles/virtualinheritance.html,
_fields_ = [("vptr", ctypes.POINTER(ctypes.c_void_p)),
("m_value", ctypes.c_int)]
@@ -50,7 +102,7 @@
self._methods_['default_constructor']( self.__this )
elif isinstance( x, int ):
self._methods_['from_int_constructor']( self.__this, x )
- elif isinstance( x, Number ):
+ elif isinstance( x, number_t ):
self._methods_['copy_constructor']( self.__this, ctypes.byref( x ) )
else:
raise RuntimeError( "Wrong argument" )
@@ -61,64 +113,117 @@
def set_value( self, *args, **keywd ):
return self._methods_['set_value']( self.__this, *args, **keywd )
+ def clone( self, *args, **keywd ):
+ return self._methods_['clone']( self.__this, *args, **keywd )
+
def print_it( self, *args, **keywd ):
return self._methods_['print_it']( self.__this, *args, **keywd )
+ def operator_assign( self, *args, **keywd ):
+ return self._methods_['operator_assign']( self.__this, *args, **keywd )
+
+ def __del__(self):
+ self._methods_['destructor']( self.__this )
+
+class auto_ptr(ctypes.Structure):
+ #http://www.phpcompiler.org/articles/virtualinheritance.html,
+ _fields_ = [("pointer", ctypes.POINTER(ctypes.c_void_p))]
+
+ _methods_ = {}
+
+ def __init__(self, x=None):
+ self.__this = ctypes.byref( self )
+ #overloading example
+ if None is x:
+ self._methods_['default_constructor']( self.__this )
+ elif isinstance( x, int ):
+ self._methods_['from_pointer_constructor']( self.__this, x )
+ elif isinstance( x, auto_ptr ):
+ self._methods_['copy_constructor']( self.__this, ctypes.byref( x ) )
+ else:
+ raise RuntimeError( "Wrong argument" )
+
+ def get( self, *args, **keywd ):
+ return self._methods_['get']( self.__this, *args, **keywd )
+
+ def release( self, *args, **keywd ):
+ return self._methods_['release']( self.__this, *args, **keywd )
+
def assign( self, *args, **keywd ):
return self._methods_['assign']( self.__this, *args, **keywd )
def __del__(self):
self._methods_['destructor']( self.__this )
+#important note: the methods of the class could only be generated after all class were defined.
+#For example: class X{ std::auto_ptr<X> clone(); };
-mem_fun = mem_fun_factory( mydll, Number )
-Number._methods_ = {
- #constructors
- 'default_constructor' : mem_fun( 'number_t::number_t(void)' )
- , 'from_int_constructor' : mem_fun( 'number_t::number_t(int)', argtypes=[ctypes.c_int] )
- , 'copy_constructor' : mem_fun( 'number_t::number_t(number_t const &)', argtypes=[ctypes.POINTER(Number)] )
- #member functions
- , 'get_value' : mem_fun( 'int number_t::get_value(void)', restype=ctypes.c_int )
- , 'set_value' : mem_fun( 'void number_t::set_value(int)', argtypes=[ctypes.c_int])
- , 'print_it' : mem_fun( 'void number_t::print_it(void)' )
- #operator=
- , 'assign' : mem_fun( "number_t & number_t::operator=(number_t const &)"
- , restype=ctypes.POINTER(Number)
- , argtypes=[ctypes.POINTER(Number)] )
- #destructor
- , 'destructor' : mem_fun( 'number_t::~number_t(void)' )
+mfcreator = mem_fun_factory( mydll, number_t, 'number_t' )
+number_t._methods_ = {
+ 'default_constructor' : mfcreator.default_constructor()
+ , 'copy_constructor' : mfcreator.copy_constructor()
+ , 'operator_assign' : mfcreator.operator_assign()
+ , 'destructor' : mfcreator.destructor()
+ , 'from_int_constructor' : mfcreator.constructor( argtypes_str='int', argtypes=[ctypes.c_int] )
+ , 'get_value' : mfcreator.method( 'get_value', restype_str='int', restype=ctypes.c_int )
+ , 'set_value' : mfcreator.method( 'set_value', argtypes_str='int', argtypes=[ctypes.c_int])
+ , 'print_it' : mfcreator.method( 'print_it' )
+ , 'clone' : mfcreator.method( 'clone', restype_str="number_t", restype=number_t )
+ , 'clone_ptr' : mfcreator.method( 'clone_ptr', restype_str="std::auto_ptr<number_t>", restype=auto_ptr )
}
-del mem_fun
+del mfcreator
+#~ mfcreator = mem_fun_factory( mydll, auto_ptr )
+#~ auto_ptr._methods_ = {
+ #~ 'default_constructor' : mfcreator.default_constructor()
+ #~ , 'operator_assign' : mfcreator.operator_assign()
+ #~ , 'destructor' : mfcreator.destructor()
+ #~ u'std::auto_ptr<number_t>::auto_ptr<number_t>(number_t *)': u'??0?$auto_ptr@Vnumber_t@@@std@@QAE@PAVnumber_t@@@Z',
+ #~ u'std::auto_ptr<number_t>::auto_ptr<number_t>(std::auto_ptr<number_t> &)': u'??0?$auto_ptr@Vnumber_t@@@std@@QAE@AAV01@@Z',
+
+
+
+ #~ u'number_t * std::auto_ptr<number_t>::get(void)': u'?get@?$auto_ptr@Vnumber_t@@@std@@QBEPAVnumber_t@@XZ',
+ #~ u'number_t * std::auto_ptr<number_t>::release(void)': u'?release@?$auto_ptr@Vnumber_t@@@std@@QAEPAVnumber_t@@XZ',
+
+
+#~ }
+#~ del mfcreator
+
class tester_t( unittest.TestCase ):
def test_constructors(self):
- obj1 = Number(32)
+ obj1 = number_t(32)
self.failUnless( obj1.m_value == 32 )
- obj2 = Number()
+ obj2 = number_t()
self.failUnless( obj2.m_value == 0 )
- obj3 = Number(obj1)
+ obj3 = number_t(obj1)
self.failUnless( obj3.m_value == obj1.m_value == 32 )
def test_get_value( self ):
- obj = Number(99)
+ obj = number_t(99)
self.failUnless( 99 == obj.get_value() )
def test_set_value( self ):
- obj = Number()
+ obj = number_t()
obj.set_value( 13 )
self.failUnless( 13 == obj.get_value() == obj.m_value )
- def test_assign( self ):
- obj1 = Number(1)
- obj2 = Number(2)
- x = obj1.assign( obj2 )
+ def test_operator_assign( self ):
+ obj1 = number_t(1)
+ obj2 = number_t(2)
+ x = obj1.operator_assign( obj2 )
#there are special cases, where ctypes could introduce "optimized" behaviour and not create new python object
self.failUnless( x is obj1 )
self.failUnless( obj1.m_value == obj2.m_value )
+ def test_clone( self ):
+ obj1 = number_t(1)
+ obj2 = obj1.clone()
+ self.fail( obj1.get_value() == obj2.get_value() )
+
def main():
- obj = Number(42)
+ obj = number_t(42)
print obj.m_value
print hex(obj.vptr[0])
obj.print_it()
@@ -133,6 +238,7 @@
# * write something very smart and bugy and let the smart people to improve it
+
"""
TODO:
@@ -151,5 +257,7 @@
The user will have to change the code to add
template class __declspec(dllexport) std::auto_ptr< number_t >;
and recompile
+ * how should we deal with namespaces?
+ * member function signatures should be generate outside of the classes.
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-20 19:23:21
|
Revision: 1479
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1479&view=rev
Author: roman_yakovenko
Date: 2008-12-20 19:23:18 +0000 (Sat, 20 Dec 2008)
Log Message:
-----------
making the test work again.
Changes: no cyclic references, the lookup in dll is done only once.
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.cpp
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.h
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.suo
pyplusplus_dev/pyplusplus/cpptypes/mydll/release/mydll.dll
pyplusplus_dev/pyplusplus/cpptypes/tester.py
Added Paths:
-----------
pyplusplus_dev/pyplusplus/cpptypes/name_mapping.py
Modified: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.cpp
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.cpp 2008-12-19 22:50:32 UTC (rev 1478)
+++ pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.cpp 2008-12-20 19:23:18 UTC (rev 1479)
@@ -34,6 +34,10 @@
return number_t(*this);
}
+std::auto_ptr<number_t> number_t::clone_ptr() const{
+ return std::auto_ptr<number_t>( new number_t( *this ) );
+}
+
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
Modified: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.h
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.h 2008-12-19 22:50:32 UTC (rev 1478)
+++ pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.h 2008-12-20 19:23:18 UTC (rev 1479)
@@ -1,5 +1,7 @@
#pragma once
+#include <memory>
+
class __declspec(dllexport) number_t{
public:
number_t();
@@ -10,8 +12,9 @@
void set_value(int x);
number_t clone() const;
-
+ std::auto_ptr<number_t> clone_ptr() const;
private:
int m_value;
};
+template class __declspec(dllexport) std::auto_ptr< number_t >;
Modified: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.suo
===================================================================
(Binary files differ)
Modified: pyplusplus_dev/pyplusplus/cpptypes/mydll/release/mydll.dll
===================================================================
(Binary files differ)
Added: pyplusplus_dev/pyplusplus/cpptypes/name_mapping.py
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/name_mapping.py (rev 0)
+++ pyplusplus_dev/pyplusplus/cpptypes/name_mapping.py 2008-12-20 19:23:18 UTC (rev 1479)
@@ -0,0 +1,94 @@
+"""
+The "data" dictionary was generate dusing the following code:
+
+
+import pprint
+from pygccxml.msvc import mspdb
+from pygccxml import declarations
+from pygccxml.msvc import common_utils as msvc_utils
+
+pdb_file = r'E:\development\language-binding\pyplusplus_dev\pyplusplus\cpptypes\mydll\release\mydll.pdb'
+
+reader = mspdb.decl_loader_t( pdb_file )
+opt = mspdb.enums.UNDECORATE_NAME_OPTIONS.UNDNAME_SCOPES_ONLY
+
+d = {}
+for smbl in reader.public_symbols.itervalues():
+ name = smbl.name
+ undecorated_name = smbl.get_undecoratedNameEx(opt)
+ d[ name ] = undecorated_name
+ d[ undecorated_name ] = name
+
+pprint.pprint( d )
+
+
+Obviously the result is too big and some additional work should be done.
+"""
+
+data = \
+{u'??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z': u'std::basic_ostream<char,std::char_traits<char> > & std::operator<<<std::char_traits<char> >(std::basic_ostream<char,std::char_traits<char> > &,char const *)',
+ u'??0?$auto_ptr@Vnumber_t@@@std@@QAE@AAV01@@Z': u'std::auto_ptr<number_t>::auto_ptr<number_t>(std::auto_ptr<number_t> &)',
+ u'??0?$auto_ptr@Vnumber_t@@@std@@QAE@PAVnumber_t@@@Z': u'std::auto_ptr<number_t>::auto_ptr<number_t>(number_t *)',
+ u'??0?$auto_ptr@Vnumber_t@@@std@@QAE@U?$auto_ptr_ref@Vnumber_t@@@1@@Z': u'std::auto_ptr<number_t>::auto_ptr<number_t>(std::auto_ptr_ref<number_t>)',
+ u'??0number_t@@QAE@ABV0@@Z': u'number_t::number_t(number_t const &)',
+ u'??0number_t@@QAE@H@Z': u'number_t::number_t(int)',
+ u'??0number_t@@QAE@XZ': u'number_t::number_t(void)',
+ u'??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@AAV12@@Z': u'std::basic_ostream<char,std::char_traits<char> >::sentry::sentry(std::basic_ostream<char,std::char_traits<char> > &)',
+ u'??1?$auto_ptr@Vnumber_t@@@std@@QAE@XZ': u'std::auto_ptr<number_t>::~auto_ptr<number_t>(void)',
+ u'??1_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ': u'std::basic_ostream<char,std::char_traits<char> >::_Sentry_base::~_Sentry_base(void)',
+ u'??1number_t@@UAE@XZ': u'number_t::~number_t(void)',
+ u'??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ': u'std::basic_ostream<char,std::char_traits<char> >::sentry::~sentry(void)',
+ u'??2@YAPAXI@Z': u'void * operator new(unsigned int)',
+ u'??3@YAXPAX@Z': u'void operator delete(void *)',
+ u'??4?$auto_ptr@Vnumber_t@@@std@@QAEAAV01@AAV01@@Z': u'std::auto_ptr<number_t> & std::auto_ptr<number_t>::operator=(std::auto_ptr<number_t> &)',
+ u'??4?$auto_ptr@Vnumber_t@@@std@@QAEAAV01@U?$auto_ptr_ref@Vnumber_t@@@1@@Z': u'std::auto_ptr<number_t> & std::auto_ptr<number_t>::operator=(std::auto_ptr_ref<number_t>)',
+ u'??4number_t@@QAEAAV0@ABV0@@Z': u'number_t & number_t::operator=(number_t const &)',
+ u'??C?$auto_ptr@Vnumber_t@@@std@@QBEPAVnumber_t@@XZ': u'number_t * std::auto_ptr<number_t>::operator->(void)',
+ u'??D?$auto_ptr@Vnumber_t@@@std@@QBEAAVnumber_t@@XZ': u'number_t & std::auto_ptr<number_t>::operator*(void)',
+ u'??_Enumber_t@@UAEPAXI@Z': u"void * number_t::`vector deleting destructor'(unsigned int)",
+ u'??_F?$auto_ptr@Vnumber_t@@@std@@QAEXXZ': u"void std::auto_ptr<number_t>::`default constructor closure'(void)",
+ u'??_M@YGXPAXIHP6EX0@Z@Z': u"void `eh vector destructor iterator'(void *,unsigned int,int,void (*)(void *))",
+ u'??_V@YAXPAX@Z': u'void operator delete[](void *)',
+ u'?clone@number_t@@QBE?AV1@XZ': u'number_t number_t::clone(void)',
+ u'?clone_ptr@number_t@@QBE?AV?$auto_ptr@Vnumber_t@@@std@@XZ': u'std::auto_ptr<number_t> number_t::clone_ptr(void)',
+ u'?get@?$auto_ptr@Vnumber_t@@@std@@QBEPAVnumber_t@@XZ': u'number_t * std::auto_ptr<number_t>::get(void)',
+ u'?get_value@number_t@@QBEHXZ': u'int number_t::get_value(void)',
+ u'?print_it@number_t@@QBEXXZ': u'void number_t::print_it(void)',
+ u'?release@?$auto_ptr@Vnumber_t@@@std@@QAEPAVnumber_t@@XZ': u'number_t * std::auto_ptr<number_t>::release(void)',
+ u'?reset@?$auto_ptr@Vnumber_t@@@std@@QAEXPAVnumber_t@@@Z': u'void std::auto_ptr<number_t>::reset(number_t *)',
+ u'?set_value@number_t@@QAEXH@Z': u'void number_t::set_value(int)',
+ u'?terminate@@YAXXZ': u'void terminate(void)',
+ u'_DllMain@12': u'_DllMain@12',
+ u'_atexit': u'_atexit',
+ u'int number_t::get_value(void)': u'?get_value@number_t@@QBEHXZ',
+ u'number_t & number_t::operator=(number_t const &)': u'??4number_t@@QAEAAV0@ABV0@@Z',
+ u'number_t & std::auto_ptr<number_t>::operator*(void)': u'??D?$auto_ptr@Vnumber_t@@@std@@QBEAAVnumber_t@@XZ',
+ u'number_t * std::auto_ptr<number_t>::get(void)': u'?get@?$auto_ptr@Vnumber_t@@@std@@QBEPAVnumber_t@@XZ',
+ u'number_t * std::auto_ptr<number_t>::operator->(void)': u'??C?$auto_ptr@Vnumber_t@@@std@@QBEPAVnumber_t@@XZ',
+ u'number_t * std::auto_ptr<number_t>::release(void)': u'?release@?$auto_ptr@Vnumber_t@@@std@@QAEPAVnumber_t@@XZ',
+ u'number_t number_t::clone(void)': u'?clone@number_t@@QBE?AV1@XZ',
+ u'number_t::number_t(int)': u'??0number_t@@QAE@H@Z',
+ u'number_t::number_t(number_t const &)': u'??0number_t@@QAE@ABV0@@Z',
+ u'number_t::number_t(void)': u'??0number_t@@QAE@XZ',
+ u'number_t::~number_t(void)': u'??1number_t@@UAE@XZ',
+ u'std::auto_ptr<number_t> & std::auto_ptr<number_t>::operator=(std::auto_ptr<number_t> &)': u'??4?$auto_ptr@Vnumber_t@@@std@@QAEAAV01@AAV01@@Z',
+ u'std::auto_ptr<number_t> & std::auto_ptr<number_t>::operator=(std::auto_ptr_ref<number_t>)': u'??4?$auto_ptr@Vnumber_t@@@std@@QAEAAV01@U?$auto_ptr_ref@Vnumber_t@@@1@@Z',
+ u'std::auto_ptr<number_t> number_t::clone_ptr(void)': u'?clone_ptr@number_t@@QBE?AV?$auto_ptr@Vnumber_t@@@std@@XZ',
+ u'std::auto_ptr<number_t>::auto_ptr<number_t>(number_t *)': u'??0?$auto_ptr@Vnumber_t@@@std@@QAE@PAVnumber_t@@@Z',
+ u'std::auto_ptr<number_t>::auto_ptr<number_t>(std::auto_ptr<number_t> &)': u'??0?$auto_ptr@Vnumber_t@@@std@@QAE@AAV01@@Z',
+ u'std::auto_ptr<number_t>::auto_ptr<number_t>(std::auto_ptr_ref<number_t>)': u'??0?$auto_ptr@Vnumber_t@@@std@@QAE@U?$auto_ptr_ref@Vnumber_t@@@1@@Z',
+ u'std::auto_ptr<number_t>::~auto_ptr<number_t>(void)': u'??1?$auto_ptr@Vnumber_t@@@std@@QAE@XZ',
+ u'std::basic_ostream<char,std::char_traits<char> > & std::operator<<<std::char_traits<char> >(std::basic_ostream<char,std::char_traits<char> > &,char const *)': u'??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z',
+ u'std::basic_ostream<char,std::char_traits<char> >::_Sentry_base::~_Sentry_base(void)': u'??1_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ',
+ u'std::basic_ostream<char,std::char_traits<char> >::sentry::sentry(std::basic_ostream<char,std::char_traits<char> > &)': u'??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@AAV12@@Z',
+ u'std::basic_ostream<char,std::char_traits<char> >::sentry::~sentry(void)': u'??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ',
+ u"void * number_t::`vector deleting destructor'(unsigned int)": u'??_Enumber_t@@UAEPAXI@Z',
+ u'void * operator new(unsigned int)': u'??2@YAPAXI@Z',
+ u"void `eh vector destructor iterator'(void *,unsigned int,int,void (*)(void *))": u'??_M@YGXPAXIHP6EX0@Z@Z',
+ u'void number_t::print_it(void)': u'?print_it@number_t@@QBEXXZ',
+ u'void number_t::set_value(int)': u'?set_value@number_t@@QAEXH@Z',
+ u'void operator delete(void *)': u'??3@YAXPAX@Z',
+ u'void operator delete[](void *)': u'??_V@YAXPAX@Z',
+ u"void std::auto_ptr<number_t>::`default constructor closure'(void)": u'??_F?$auto_ptr@Vnumber_t@@@std@@QAEXXZ',
+ u'void std::auto_ptr<number_t>::reset(number_t *)': u'?reset@?$auto_ptr@Vnumber_t@@@std@@QAEXPAVnumber_t@@@Z',
+ u'void terminate(void)': u'?terminate@@YAXXZ'}
Modified: pyplusplus_dev/pyplusplus/cpptypes/tester.py
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/tester.py 2008-12-19 22:50:32 UTC (rev 1478)
+++ pyplusplus_dev/pyplusplus/cpptypes/tester.py 2008-12-20 19:23:18 UTC (rev 1479)
@@ -1,7 +1,6 @@
import ctypes
import unittest
-import decorators
-
+import name_mapping
mydll = ctypes.CPPDLL( './mydll/release/mydll.dll' )
#we should keep somewhere decorated-undecorated name mappings
@@ -11,71 +10,87 @@
# GCCXML reports mangled and demangled names of the function, but it is not a cross platform( compile ) solution.
# It looks like I will have to cause mspdb package to work ( from where ctypes loads dlls? ctypes.windll.msvcr90 ???
+mydll.name_mapping = name_mapping.data
-tmp = [ ( "number_t::number_t(class number_t const &)", "??0number_t@@QAE@ABV0@@Z" )
- , ( "number_t::number_t(int)", "??0number_t@@QAE@H@Z" )
- , ( "number_t::number_t(void)", "??0number_t@@QAE@XZ" )
- , ( "number_t::~number_t(void)", "??1number_t@@UAE@XZ" )
- , ( "class number_t & number_t::operator=(class number_t const &)", "??4number_t@@QAEAAV0@ABV0@@Z" )
- , ( "const number_t::'vftable'", "??_7number_t@@6B@" )
- , ( "int number_t::get_value(void)", "?get_value@number_t@@QBEHXZ" )
- , ( "void number_t::print_it(void)", "?print_it@number_t@@QBEXXZ" )
- , ( "void number_t::set_value(int)", "?set_value@number_t@@QAEXH@Z" ) ]
-
-mydll.name_mapping = {}
-for n1, n2 in tmp:
- mydll.name_mapping[n1] = n2
- mydll.name_mapping[n2] = n1
-
# what is the best way to treat overloaded constructors
class public( object ):
- def __init__(self, dll, this, name, restype=None, argtypes=None ):
- self.this = this #reference to class instance
+ def __init__(self, dll, name, restype=None, argtypes=None ):
self.name = name
self.func = getattr( dll, dll.name_mapping[name] )
self.func.restype = restype
- this_call_arg_types = [ ctypes.POINTER( this._obj.__class__ ) ]
- if argtypes:
- this_call_arg_types.extend( argtypes )
- self.func.argtypes = this_call_arg_types
+ self.func.argtypes = argtypes
def __call__(self, *args, **keywd ):
- return self.func( self.this, *args, **keywd )
+ return self.func( *args, **keywd )
class mem_fun_factory( object ):
- def __init__( self, dll, this ):
+ def __init__( self, dll, class_ ):
self.dll = dll
- self.this = this
+ self.this_type = ctypes.POINTER( class_ )
- def __call__( self, *args, **keywd ):
- return public( self.dll, self.this, *args, **keywd )
+ def __call__( self, name, **keywd ):
+ if 'argtypes' not in keywd:
+ keywd['argtypes'] = [ self.this_type ]
+ else:
+ keywd['argtypes'].insert( 0, self.this_type )
+ return public( self.dll, name, **keywd )
+
class Number(ctypes.Structure):
#http://www.phpcompiler.org/articles/virtualinheritance.html,
_fields_ = [("vptr", ctypes.POINTER(ctypes.c_void_p)),
("m_value", ctypes.c_int)]
+ _methods_ = {}
+
def __init__(self, x=None):
- mem_fun = mem_fun_factory( mydll, ctypes.byref( self ) )
- self.get_value = mem_fun( 'int number_t::get_value(void)', restype=ctypes.c_int )
- self.set_value = mem_fun( 'void number_t::set_value(int)', argtypes=[ctypes.c_int])
- self.print_it = mem_fun( 'void number_t::print_it(void)' )
- self.assign = mem_fun( "class number_t & number_t::operator=(class number_t const &)"
- , restype=ctypes.POINTER(Number)
- , argtypes=[ctypes.POINTER(Number)] )
+ self.__this = ctypes.byref( self )
#overloading example
if None is x:
- mem_fun( 'number_t::number_t(void)' )()
+ self._methods_['default_constructor']( self.__this )
elif isinstance( x, int ):
- mem_fun( 'number_t::number_t(int)', argtypes=[ctypes.c_int] )( x )
+ self._methods_['from_int_constructor']( self.__this, x )
elif isinstance( x, Number ):
- mem_fun( 'number_t::number_t(class number_t const &)', argtypes=[ctypes.POINTER(Number)] )( ctypes.byref( x ) )
+ self._methods_['copy_constructor']( self.__this, ctypes.byref( x ) )
else:
raise RuntimeError( "Wrong argument" )
+ def get_value( self, *args, **keywd ):
+ return self._methods_['get_value']( self.__this, *args, **keywd )
+
+ def set_value( self, *args, **keywd ):
+ return self._methods_['set_value']( self.__this, *args, **keywd )
+
+ def print_it( self, *args, **keywd ):
+ return self._methods_['print_it']( self.__this, *args, **keywd )
+
+ def assign( self, *args, **keywd ):
+ return self._methods_['assign']( self.__this, *args, **keywd )
+
def __del__(self):
- public( mydll, ctypes.byref(self), "number_t::~number_t(void)" )()
+ self._methods_['destructor']( self.__this )
+
+mem_fun = mem_fun_factory( mydll, Number )
+Number._methods_ = {
+ #constructors
+ 'default_constructor' : mem_fun( 'number_t::number_t(void)' )
+ , 'from_int_constructor' : mem_fun( 'number_t::number_t(int)', argtypes=[ctypes.c_int] )
+ , 'copy_constructor' : mem_fun( 'number_t::number_t(number_t const &)', argtypes=[ctypes.POINTER(Number)] )
+ #member functions
+ , 'get_value' : mem_fun( 'int number_t::get_value(void)', restype=ctypes.c_int )
+ , 'set_value' : mem_fun( 'void number_t::set_value(int)', argtypes=[ctypes.c_int])
+ , 'print_it' : mem_fun( 'void number_t::print_it(void)' )
+ #operator=
+ , 'assign' : mem_fun( "number_t & number_t::operator=(number_t const &)"
+ , restype=ctypes.POINTER(Number)
+ , argtypes=[ctypes.POINTER(Number)] )
+ #destructor
+ , 'destructor' : mem_fun( 'number_t::~number_t(void)' )
+}
+del mem_fun
+
+
class tester_t( unittest.TestCase ):
def test_constructors(self):
obj1 = Number(32)
@@ -129,5 +144,12 @@
class X{...};
class Y{ X x; public: const X& get_x() const { return x;} };
I think our solution should be very similar to Boost.Python call policies. It is definitely possible to go without it.
+* template classes:
+ in the following use case, the members of std:auto_ptr class are not exported
+ class number_t{...};
+ std::auto_ptr<number_t> do_smth();
+ The user will have to change the code to add
+ template class __declspec(dllexport) std::auto_ptr< number_t >;
+ and recompile
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-19 22:50:38
|
Revision: 1478
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1478&view=rev
Author: roman_yakovenko
Date: 2008-12-19 22:50:32 +0000 (Fri, 19 Dec 2008)
Log Message:
-----------
commit few changes, which allow to extract all public(exported) symbols
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/common_utils.py
pygccxml_dev/pygccxml/msvc/mspdb/enums.py
pygccxml_dev/pygccxml/msvc/mspdb/loader.py
pygccxml_dev/unittests/autoconfig.py
Added Paths:
-----------
pygccxml_dev/unittests/mspdb_playground.py
Property Changed:
----------------
pygccxml_dev/pygccxml/msvc/
Property changes on: pygccxml_dev/pygccxml/msvc
___________________________________________________________________
Added: svn:ignore
+ *.pyc
Modified: pygccxml_dev/pygccxml/msvc/common_utils.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/common_utils.py 2008-12-18 06:51:01 UTC (rev 1477)
+++ pygccxml_dev/pygccxml/msvc/common_utils.py 2008-12-19 22:50:32 UTC (rev 1478)
@@ -1,28 +1,23 @@
import ctypes
-import ctypes.wintypes
-import config as msvc_cfg
class UNDECORATE_NAME_OPTIONS:
- UNDNAME_COMPLETE = 0x0000 #Enables full undecoration.
- UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords.
- UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords.
- UNDNAME_NO_FUNCTION_RETURNS = 0x0004 #Disables expansion of return type for primary declaration.
- UNDNAME_NO_ALLOCATION_MODEL = 0x0008 #Disables expansion of the declaration model.
- UNDNAME_NO_ALLOCATION_LANGUAGE = 0x0010 #Disables expansion of the declaration language specifier.
- UNDNAME_RESERVED1 = 0x0020 #RESERVED.
- UNDNAME_RESERVED2 = 0x0040 #RESERVED.
- UNDNAME_NO_THISTYPE = 0x0060 #Disables all modifiers on the this type.
- UNDNAME_NO_ACCESS_SPECIFIERS = 0x0080 #Disables expansion of access specifiers for members.
- UNDNAME_NO_THROW_SIGNATURES = 0x0100 #Disables expansion of "throw-signatures" for functions and pointers to functions.
- UNDNAME_NO_MEMBER_TYPE = 0x0200 #Disables expansion of static or virtual members.
- UNDNAME_NO_RETURN_UDT_MODEL = 0x0400 #Disables expansion of the Microsoft model for UDT returns.
- UNDNAME_32_BIT_DECODE = 0x0800 #Undecorates 32-bit decorated names.
- UNDNAME_NAME_ONLY = 0x1000 #Gets only the name for primary declaration; returns just [scope::]name. Expands template params.
- UNDNAME_TYPE_ONLY = 0x2000 #Input is just a type encoding; composes an abstract declarator.
- UNDNAME_HAVE_PARAMETERS = 0x4000 #The real template parameters are available.
- UNDNAME_NO_ECSU = 0x8000 #Suppresses enum/class/struct/union.
- UNDNAME_NO_IDENT_CHAR_CHECK = 0x10000 #Suppresses check for valid identifier characters.
- UNDNAME_NO_PTR64 = 0x20000 #Does not include ptr64 in output.
+ UNDNAME_COMPLETE = 0
+ UNDNAME_NO_LEADING_UNDERSCORES = 1
+ UNDNAME_NO_MS_KEYWORDS = 2
+ UNDNAME_NO_FUNCTION_RETURNS = 4
+ UNDNAME_NO_ALLOCATION_MODEL = 8
+ UNDNAME_NO_ALLOCATION_LANGUAGE = 16
+ UNDNAME_NO_MS_THISTYPE = 32
+ UNDNAME_NO_CV_THISTYPE = 64
+ UNDNAME_NO_THISTYPE = 96
+ UNDNAME_NO_ACCESS_SPECIFIERS = 128
+ UNDNAME_NO_THROW_SIGNATURES = 256
+ UNDNAME_NO_MEMBER_TYPE = 512
+ UNDNAME_NO_RETURN_UDT_MODEL = 1024
+ UNDNAME_32_BIT_DECODE = 2048
+ UNDNAME_NAME_ONLY = 4096
+ UNDNAME_NO_ARGUMENTS = 8192
+ UNDNAME_NO_SPECIAL_SYMS = 16384
UNDNAME_SCOPES_ONLY = UNDNAME_NO_LEADING_UNDERSCORES \
| UNDNAME_NO_MS_KEYWORDS \
@@ -31,40 +26,18 @@
| UNDNAME_NO_ALLOCATION_LANGUAGE \
| UNDNAME_NO_ACCESS_SPECIFIERS \
| UNDNAME_NO_THROW_SIGNATURES \
- | UNDNAME_NO_MEMBER_TYPE \
- | UNDNAME_NO_ECSU \
- | UNDNAME_NO_IDENT_CHAR_CHECK
+ | UNDNAME_NO_MEMBER_TYPE
-#__unDName definition was taken from:
-#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
-msvcrxx = ctypes.windll.msvcr71 #ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
-free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type
-malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type
+undecorate_name_impl = ctypes.windll.dbghelp.UnDecorateSymbolName
+undecorate_name_impl.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint]
-
-__unDName = msvcrxx.__unDName
-__unDName.argtypes = [ ctypes.c_char_p #undecorated name
- , ctypes.c_char_p #decorated name
- , ctypes.c_int #sizeof undecorated name
- , malloc_type
- , free_type
- , ctypes.c_ushort #flags
- ]
-__unDName.restype = ctypes.c_char_p
-
-
def undecorate_name( name, options=None ):
- if not name:
- return ''
if options is None:
- options = UNDECORATE_NAME_OPTIONS.UNDNAME_NO_ECSU
- buffer_size = 1024 * 32
- undecorated_name = ctypes.create_string_buffer('\0' * buffer_size) #should be enouph for any symbol
- __unDName( undecorated_name
- , name
- , buffer_size
- , malloc_type( msvcrxx.malloc )
- , free_type( msvcrxx.free )
- , options )
- return undecorated_name.value
+ options = UNDECORATE_NAME_OPTIONS.UNDNAME_COMPLETE
+ buffer = ctypes.create_string_buffer(1024*16)
+ res = undecorate_name_impl(name, buffer, ctypes.sizeof(buffer), options)
+ if res:
+ return str(buffer[:res])
+ else:
+ return name
Modified: pygccxml_dev/pygccxml/msvc/mspdb/enums.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/mspdb/enums.py 2008-12-18 06:51:01 UTC (rev 1477)
+++ pygccxml_dev/pygccxml/msvc/mspdb/enums.py 2008-12-19 22:50:32 UTC (rev 1478)
@@ -58,3 +58,46 @@
DataIsStaticMember = 8
DataIsConstant = 9
+
+class UNDECORATE_NAME_OPTIONS:
+ UNDNAME_COMPLETE = 0x0000 #Enables full undecoration.
+ UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords.
+ UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords.
+ UNDNAME_NO_FUNCTION_RETURNS = 0x0004 #Disables expansion of return type for primary declaration.
+ UNDNAME_NO_ALLOCATION_MODEL = 0x0008 #Disables expansion of the declaration model.
+ UNDNAME_NO_ALLOCATION_LANGUAGE = 0x0010 #Disables expansion of the declaration language specifier.
+ UNDNAME_RESERVED1 = 0x0020 #RESERVED.
+ UNDNAME_RESERVED2 = 0x0040 #RESERVED.
+ UNDNAME_NO_THISTYPE = 0x0060 #Disables all modifiers on the this type.
+ UNDNAME_NO_ACCESS_SPECIFIERS = 0x0080 #Disables expansion of access specifiers for members.
+ UNDNAME_NO_THROW_SIGNATURES = 0x0100 #Disables expansion of "throw-signatures" for functions and pointers to functions.
+ UNDNAME_NO_MEMBER_TYPE = 0x0200 #Disables expansion of static or virtual members.
+ UNDNAME_NO_RETURN_UDT_MODEL = 0x0400 #Disables expansion of the Microsoft model for UDT returns.
+ UNDNAME_32_BIT_DECODE = 0x0800 #Undecorates 32-bit decorated names.
+ UNDNAME_NAME_ONLY = 0x1000 #Gets only the name for primary declaration; returns just [scope::]name. Expands template params.
+ UNDNAME_TYPE_ONLY = 0x2000 #Input is just a type encoding; composes an abstract declarator.
+ UNDNAME_HAVE_PARAMETERS = 0x4000 #The real template parameters are available.
+ UNDNAME_NO_ECSU = 0x8000 #Suppresses enum/class/struct/union.
+ UNDNAME_NO_IDENT_CHAR_CHECK = 0x10000 #Suppresses check for valid identifier characters.
+ UNDNAME_NO_PTR64 = 0x20000 #Does not include ptr64 in output.
+
+ UNDNAME_SCOPES_ONLY = UNDNAME_NO_LEADING_UNDERSCORES \
+ | UNDNAME_NO_MS_KEYWORDS \
+ | UNDNAME_NO_FUNCTION_RETURNS \
+ | UNDNAME_NO_ALLOCATION_MODEL \
+ | UNDNAME_NO_ALLOCATION_LANGUAGE \
+ | UNDNAME_NO_ACCESS_SPECIFIERS \
+ | UNDNAME_NO_THROW_SIGNATURES \
+ | UNDNAME_NO_MEMBER_TYPE \
+ | UNDNAME_NO_ECSU \
+ | UNDNAME_NO_IDENT_CHAR_CHECK
+
+ UNDNAME_SHORT_UNIQUE = UNDNAME_NO_LEADING_UNDERSCORES \
+ | UNDNAME_NO_MS_KEYWORDS \
+ | UNDNAME_NO_ALLOCATION_MODEL \
+ | UNDNAME_NO_ALLOCATION_LANGUAGE \
+ | UNDNAME_NO_ACCESS_SPECIFIERS \
+ | UNDNAME_NO_THROW_SIGNATURES \
+ | UNDNAME_NO_MEMBER_TYPE \
+ | UNDNAME_NO_ECSU \
+ | UNDNAME_NO_IDENT_CHAR_CHECK
Modified: pygccxml_dev/pygccxml/msvc/mspdb/loader.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/mspdb/loader.py 2008-12-18 06:51:01 UTC (rev 1477)
+++ pygccxml_dev/pygccxml/msvc/mspdb/loader.py 2008-12-19 22:50:32 UTC (rev 1478)
@@ -83,13 +83,37 @@
smbls = {}
for smbl in itertools.imap( as_symbol, as_enum_variant( self.symbols_table._NewEnum ) ):
smbl.uname = msvc_utils.undecorate_name( smbl.name, msvc_utils.UNDECORATE_NAME_OPTIONS.UNDNAME_SCOPES_ONLY )
- def smbl_undecorate_name( options = None ):
+ def smbl_undecorate_name( options=None ):
return msvc_utils.undecorate_name( smbl.name, options )
smbl.undecorate_name = smbl_undecorate_name
smbls[ smbl.symIndexId ] = smbl
self.logger.info( 'loading symbols(%d) from the file - done', len( smbls ) )
return smbls
+ @utils.cached
+ def public_symbols( self ):
+ self.logger.info( 'loading public symbols from the file' )
+ smbls = {}
+ for smbl in self.symbols.itervalues():
+ if not smbl.function:
+ continue
+ if not smbl.name:
+ continue
+ undecorated_name = smbl.get_undecoratedNameEx( enums.UNDECORATE_NAME_OPTIONS.UNDNAME_SCOPES_ONLY )
+ if not undecorated_name:
+ continue
+ if smbl.name.startswith( '__' ):
+ continue
+ if undecorated_name.startswith( '__' ):
+ continue
+ if undecorated_name.startswith( '@' ):
+ continue
+ if undecorated_name.startswith( 'type_info::' ):
+ continue
+ smbls[ smbl.symIndexId ] = smbl
+ self.logger.info( 'loading public symbols(%d) from the file - done', len( smbls ) )
+ return smbls
+
def __load_nss(self):
def ns_filter( smbl ):
self.logger.debug( '__load_ns.ns_filter, %s', smbl.uname )
@@ -701,3 +725,4 @@
if not isinstance( my_type, declarations.volatile_t ):
my_type = declarations.volatile_t( my_type )
return my_type
+
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2008-12-18 06:51:01 UTC (rev 1477)
+++ pygccxml_dev/unittests/autoconfig.py 2008-12-19 22:50:32 UTC (rev 1478)
@@ -44,13 +44,13 @@
keywd[ 'gccxml_path'] = gccxml_path
gccxml = pygccxml.parser.gccxml_configuration_t( **keywd )
- pdb_loader = None
- if sys.platform == 'win32':
- from pygccxml.msvc import mspdb
- pdb_file = os.path.join( data_directory, 'msvc_build', 'Debug', 'msvc_build.pdb' )
- if os.path.exists( pdb_file ):
- pdb_loader = mspdb.decl_loader_t( pdb_file )
- pdb_loader.read()
+ #~ pdb_loader = None
+ #~ if sys.platform == 'win32':
+ #~ from pygccxml.msvc import mspdb
+ #~ pdb_file = os.path.join( data_directory, 'msvc_build', 'Debug', 'msvc_build.pdb' )
+ #~ if os.path.exists( pdb_file ):
+ #~ pdb_loader = mspdb.decl_loader_t( pdb_file )
+ #~ pdb_loader.read()
def get_pdb_global_ns():
if cxx_parsers_cfg.pdb_loader:
Added: pygccxml_dev/unittests/mspdb_playground.py
===================================================================
--- pygccxml_dev/unittests/mspdb_playground.py (rev 0)
+++ pygccxml_dev/unittests/mspdb_playground.py 2008-12-19 22:50:32 UTC (rev 1478)
@@ -0,0 +1,37 @@
+import os
+import unittest
+import autoconfig
+
+import pprint
+from pygccxml.msvc import mspdb
+from pygccxml import declarations
+from pygccxml.msvc import common_utils as msvc_utils
+
+pdb_file = r'E:\development\language-binding\pyplusplus_dev\pyplusplus\cpptypes\mydll\release\mydll.pdb'
+
+reader = mspdb.decl_loader_t( pdb_file )
+opt = mspdb.enums.UNDECORATE_NAME_OPTIONS.UNDNAME_SHORT_UNIQUE
+
+d = {}
+for smbl in reader.public_symbols.itervalues():
+ name = smbl.name
+ undecorated_name = smbl.get_undecoratedNameEx(opt).strip()
+ if undecorated_name.endswith( ')const' ):
+ undecorated_name = undecorated_name[ : -len('const')]
+ d[ name ] = undecorated_name
+ d[ undecorated_name ] = name
+
+pprint.pprint( d )
+
+#~ reader.read()
+#~ f = file( 'decls.cpp', 'w+' )
+#~ declarations.print_declarations( reader.global_ns, writer=lambda line: f.write(line+'\n') )
+#~ f.close()
+
+#~ f = file( 'symbols.txt', 'w+')
+#~ for smbl in reader.symbols.itervalues():
+ #~ f.write( smbl.uname )
+ #~ f.write( os.linesep )
+ #~ f.write( '\t' + str(smbl.name) )
+#~ f.close()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-18 06:51:04
|
Revision: 1477
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1477&view=rev
Author: roman_yakovenko
Date: 2008-12-18 06:51:01 +0000 (Thu, 18 Dec 2008)
Log Message:
-----------
rename pdb module to mspdb
Modified Paths:
--------------
pygccxml_dev/setup.py
Modified: pygccxml_dev/setup.py
===================================================================
--- pygccxml_dev/setup.py 2008-12-17 21:59:33 UTC (rev 1476)
+++ pygccxml_dev/setup.py 2008-12-18 06:51:01 UTC (rev 1477)
@@ -62,7 +62,7 @@
'pygccxml.parser',
'pygccxml.msvc',
'pygccxml.msvc.bsc',
- 'pygccxml.msvc.pdb',
+ 'pygccxml.msvc.mspdb',
'pygccxml.utils' ],
cmdclass = {"doc" : doc_cmd}
)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-17 22:22:09
|
Revision: 1475
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1475&view=rev
Author: roman_yakovenko
Date: 2008-12-17 21:43:57 +0000 (Wed, 17 Dec 2008)
Log Message:
-----------
adding ctypes-cpp tester
Added Paths:
-----------
pyplusplus_dev/pyplusplus/cpptypes/
pyplusplus_dev/pyplusplus/cpptypes/decorators.py
pyplusplus_dev/pyplusplus/cpptypes/decorators.pyc
pyplusplus_dev/pyplusplus/cpptypes/get_exports.py
pyplusplus_dev/pyplusplus/cpptypes/mydll/
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.cpp
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.h
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.sln
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.suo
pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.vcproj
pyplusplus_dev/pyplusplus/cpptypes/mydll/release/
pyplusplus_dev/pyplusplus/cpptypes/mydll/release/mydll.dll
pyplusplus_dev/pyplusplus/cpptypes/tester.py
Added: pyplusplus_dev/pyplusplus/cpptypes/decorators.py
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/decorators.py (rev 0)
+++ pyplusplus_dev/pyplusplus/cpptypes/decorators.py 2008-12-17 21:43:57 UTC (rev 1475)
@@ -0,0 +1,9 @@
+class public( object ):
+ def __init__(self , dll, decorated_name, return_type, argumen_types):
+ self.decorated_name = decorated_name
+ self.func = getattr( dll, decorated_name )
+ self.func.restype = return_type
+ self.func.argtypes = argumen_types
+
+ def __call__(self, *args, **keywd ):
+ return self.func( *args, **keywd )
Added: pyplusplus_dev/pyplusplus/cpptypes/decorators.pyc
===================================================================
(Binary files differ)
Property changes on: pyplusplus_dev/pyplusplus/cpptypes/decorators.pyc
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pyplusplus_dev/pyplusplus/cpptypes/get_exports.py
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/get_exports.py (rev 0)
+++ pyplusplus_dev/pyplusplus/cpptypes/get_exports.py 2008-12-17 21:43:57 UTC (rev 1475)
@@ -0,0 +1,289 @@
+# This code was contributed by 'leppton', see
+# https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1559219&group_id=5470
+#
+# This example shows how to use ctypes module to read all
+# function names from dll export directory
+
+import os
+if os.name != "nt":
+ raise Exception("Wrong OS")
+
+import ctypes as ctypes
+import ctypes.wintypes as wintypes
+
+def convert_cdef_to_pydef(line):
+ """\
+convert_cdef_to_pydef(line_from_c_header_file) -> python_tuple_string
+'DWORD var_name[LENGTH];' -> '("var_name", DWORD*LENGTH)'
+
+doesn't work for all valid c/c++ declarations"""
+ l = line[:line.find(';')].split()
+ if len(l) != 2:
+ return None
+ type_ = l[0]
+ name = l[1]
+ i = name.find('[')
+ if i != -1:
+ name, brac = name[:i], name[i:][1:-1]
+ return '("%s", %s*%s)'%(name,type_,brac)
+ else:
+ return '("%s", %s)'%(name,type_)
+
+def convert_cdef_to_structure(cdef, name, data_dict=ctypes.__dict__):
+ """\
+convert_cdef_to_structure(struct_definition_from_c_header_file)
+ -> python class derived from ctypes.Structure
+
+limited support for c/c++ syntax"""
+ py_str = '[\n'
+ for line in cdef.split('\n'):
+ field = convert_cdef_to_pydef(line)
+ if field != None:
+ py_str += ' '*4 + field + ',\n'
+ py_str += ']\n'
+
+ pyarr = eval(py_str, data_dict)
+ class ret_val(ctypes.Structure):
+ _fields_ = pyarr
+ ret_val.__name__ = name
+ ret_val.__module__ = None
+ return ret_val
+
+#struct definitions we need to read dll file export table
+winnt = (
+ ('IMAGE_DOS_HEADER', """\
+ WORD e_magic;
+ WORD e_cblp;
+ WORD e_cp;
+ WORD e_crlc;
+ WORD e_cparhdr;
+ WORD e_minalloc;
+ WORD e_maxalloc;
+ WORD e_ss;
+ WORD e_sp;
+ WORD e_csum;
+ WORD e_ip;
+ WORD e_cs;
+ WORD e_lfarlc;
+ WORD e_ovno;
+ WORD e_res[4];
+ WORD e_oemid;
+ WORD e_oeminfo;
+ WORD e_res2[10];
+ LONG e_lfanew;
+"""),
+
+ ('IMAGE_FILE_HEADER', """\
+ WORD Machine;
+ WORD NumberOfSections;
+ DWORD TimeDateStamp;
+ DWORD PointerToSymbolTable;
+ DWORD NumberOfSymbols;
+ WORD SizeOfOptionalHeader;
+ WORD Characteristics;
+"""),
+
+ ('IMAGE_DATA_DIRECTORY', """\
+ DWORD VirtualAddress;
+ DWORD Size;
+"""),
+
+ ('IMAGE_OPTIONAL_HEADER32', """\
+ WORD Magic;
+ BYTE MajorLinkerVersion;
+ BYTE MinorLinkerVersion;
+ DWORD SizeOfCode;
+ DWORD SizeOfInitializedData;
+ DWORD SizeOfUninitializedData;
+ DWORD AddressOfEntryPoint;
+ DWORD BaseOfCode;
+ DWORD BaseOfData;
+ DWORD ImageBase;
+ DWORD SectionAlignment;
+ DWORD FileAlignment;
+ WORD MajorOperatingSystemVersion;
+ WORD MinorOperatingSystemVersion;
+ WORD MajorImageVersion;
+ WORD MinorImageVersion;
+ WORD MajorSubsystemVersion;
+ WORD MinorSubsystemVersion;
+ DWORD Win32VersionValue;
+ DWORD SizeOfImage;
+ DWORD SizeOfHeaders;
+ DWORD CheckSum;
+ WORD Subsystem;
+ WORD DllCharacteristics;
+ DWORD SizeOfStackReserve;
+ DWORD SizeOfStackCommit;
+ DWORD SizeOfHeapReserve;
+ DWORD SizeOfHeapCommit;
+ DWORD LoaderFlags;
+ DWORD NumberOfRvaAndSizes;
+ IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
+""",
+ {'IMAGE_NUMBEROF_DIRECTORY_ENTRIES':16}),
+
+ ('IMAGE_NT_HEADERS', """\
+ DWORD Signature;
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_OPTIONAL_HEADER32 OptionalHeader;
+"""),
+
+ ('IMAGE_EXPORT_DIRECTORY', """\
+ DWORD Characteristics;
+ DWORD TimeDateStamp;
+ WORD MajorVersion;
+ WORD MinorVersion;
+ DWORD Name;
+ DWORD Base;
+ DWORD NumberOfFunctions;
+ DWORD NumberOfNames;
+ DWORD AddressOfFunctions;
+ DWORD AddressOfNames;
+ DWORD AddressOfNameOrdinals;
+"""),
+ )
+
+#Construct python ctypes.Structures from above definitions
+data_dict = dict(wintypes.__dict__)
+for definition in winnt:
+ name = definition[0]
+ def_str = definition[1]
+ if len(definition) == 3:
+ data_dict.update(definition[2])
+ type_ = convert_cdef_to_structure(def_str, name, data_dict)
+ data_dict[name] = type_
+ globals()[name] = type_
+
+ ptype = ctypes.POINTER(type_)
+ pname = 'P'+name
+ data_dict[pname] = ptype
+ globals()[pname] = ptype
+
+del data_dict
+del winnt
+
+class DllException(Exception):
+ pass
+
+def read_export_table(dll_name, mmap=False, use_kernel=False):
+ """\
+read_export_table(dll_name [,mmap=False [,use_kernel=False]]])
+ -> list of exported names
+
+default is to load dll into memory: dll sections are aligned to
+page boundaries, dll entry points is called, etc...
+
+with mmap=True dll file image is mapped to memory, Relative Virtual
+Addresses (RVAs) must be mapped to real addresses manually
+
+with use_kernel=True direct kernel32.dll calls are used,
+instead of python mmap module
+
+see http://www.windowsitlibrary.com/Content/356/11/1.html
+for details on Portable Executable (PE) file format
+"""
+ if not mmap:
+ dll = ctypes.cdll.LoadLibrary(dll_name)
+ if dll == None:
+ raise DllException("Cant load dll")
+ base_addr = dll._handle
+
+ else:
+ if not use_kernel:
+ fileH = open(dll_name)
+ if fileH == None:
+ raise DllException("Cant load dll")
+ import mmap
+ m = mmap.mmap(fileH.fileno(), 0, None, mmap.ACCESS_READ)
+ # id(m)+8 sucks, is there better way?
+ base_addr = ctypes.cast(id(m)+8, ctypes.POINTER(ctypes.c_int))[0]
+ else:
+ kernel32 = ctypes.windll.kernel32
+ if kernel32 == None:
+ raise DllException("cant load kernel")
+ fileH = kernel32.CreateFileA(dll_name, 0x00120089, 1,0,3,0,0)
+ if fileH == 0:
+ raise DllException("Cant open, errcode = %d"%kernel32.GetLastError())
+ mapH = kernel32.CreateFileMappingW(fileH,0,0x8000002,0,0,0)
+ if mapH == 0:
+ raise DllException("Cant mmap, errocode = %d"%kernel32.GetLastError())
+ base_addr = ctypes.windll.kernel32.MapViewOfFile(mapH, 0x4, 0, 0, 0)
+ if base_addr == 0:
+ raise DllException("Cant mmap(2), errocode = %d"%kernel32.GetLastError())
+
+ dbghelp = ctypes.windll.dbghelp
+ if dbghelp == None:
+ raise DllException("dbghelp.dll not installed")
+ pimage_nt_header = dbghelp.ImageNtHeader(base_addr)
+ if pimage_nt_header == 0:
+ raise DllException("Cant find IMAGE_NT_HEADER")
+
+ #Functions like dbghelp.ImageNtHeader above have no type information
+ #let's make one prototype for extra buzz
+ #PVOID ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders, PVOID Base,
+ # ULONG Rva, PIMAGE_SECTION_HEADER* LastRvaSection)
+ # we use integers instead of pointers, coz integers are better
+ # for pointer arithmetic
+ prototype = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.c_int,
+ ctypes.c_int, ctypes.c_int, ctypes.c_int)
+ paramflags = ((1,"NtHeaders",pimage_nt_header),(1,"Base",base_addr),(1,"Rva"),(1,"LastRvaSection",0))
+ ImageRvaToVa = prototype(('ImageRvaToVa', dbghelp), paramflags)
+
+ def cast_rva(rva, type_):
+ va = base_addr + rva
+ if mmap and va > pimage_nt_header:
+ va = ImageRvaToVa(Rva=rva)
+ if va == 0:
+ raise DllException("ImageRvaToVa failed")
+ return ctypes.cast(va, type_)
+
+ if not mmap:
+ dos_header = cast_rva(0, PIMAGE_DOS_HEADER)[0]
+ if dos_header.e_magic != 0x5A4D:
+ raise DllException("IMAGE_DOS_HEADER.e_magic error")
+ nt_header = cast_rva(dos_header.e_lfanew, PIMAGE_NT_HEADERS)[0]
+ else:
+ nt_header = ctypes.cast(pimage_nt_header, PIMAGE_NT_HEADERS)[0]
+ if nt_header.Signature != 0x00004550:
+ raise DllException("IMAGE_NT_HEADERS.Signature error")
+
+ opt_header = nt_header.OptionalHeader
+ if opt_header.Magic != 0x010b:
+ raise DllException("IMAGE_OPTIONAL_HEADERS32.Magic error")
+
+ ret_val = []
+ exports_dd = opt_header.DataDirectory[0]
+ if opt_header.NumberOfRvaAndSizes > 0 or exports_dd != 0:
+ export_dir = cast_rva(exports_dd.VirtualAddress, PIMAGE_EXPORT_DIRECTORY)[0]
+
+ nNames = export_dir.NumberOfNames
+ if nNames > 0:
+ PNamesType = ctypes.POINTER(ctypes.c_int * nNames)
+ names = cast_rva(export_dir.AddressOfNames, PNamesType)[0]
+ for rva in names:
+ name = cast_rva(rva, ctypes.c_char_p).value
+ ret_val.append(name)
+
+ if mmap:
+ if use_kernel:
+ kernel32.UnmapViewOfFile(base_addr)
+ kernel32.CloseHandle(mapH)
+ kernel32.CloseHandle(fileH)
+ else:
+ m.close()
+ fileH.close()
+ return ret_val
+
+
+if __name__ == '__main__':
+ import sys
+ if len(sys.argv) != 2:
+ print 'usage: %s dll_file_name'%sys.argv[0]
+ sys.exit()
+## names = read_export_table(sys.argv[1], mmap=False, use_kernel=False)
+ names = read_export_table(sys.argv[1], mmap=False, use_kernel=False)
+ for name in names:
+ print name
+
+
Added: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.cpp
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.cpp (rev 0)
+++ pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.cpp 2008-12-17 21:43:57 UTC (rev 1475)
@@ -0,0 +1,52 @@
+#include "mydll.h"
+#include "windows.h"
+#include <iostream>
+
+number_t::number_t()
+: m_value(0)
+{
+// std::cout << "{C++} number_t( 0 )" << std::endl;
+}
+
+
+number_t::number_t(int value)
+: m_value(value)
+{
+// std::cout << "{C++} number_t( " << value << " )" << std::endl;
+}
+
+number_t::~number_t() {
+// std::cout << "{C++} ~number_t()" << std::endl;
+}
+void number_t::print_it() const {
+ std::cout << "{C++} value: " << m_value << std::endl;
+}
+
+int number_t::get_value() const{
+ return m_value;
+}
+
+void number_t::set_value(int x){
+ m_value = x;
+}
+
+number_t number_t::clone() const{
+ return number_t(*this);
+}
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
Added: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.h
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.h (rev 0)
+++ pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.h 2008-12-17 21:43:57 UTC (rev 1475)
@@ -0,0 +1,17 @@
+#pragma once
+
+class __declspec(dllexport) number_t{
+public:
+ number_t();
+ explicit number_t(int value);
+ virtual ~number_t();
+ void print_it() const;
+ int get_value() const;
+ void set_value(int x);
+
+ number_t clone() const;
+
+private:
+ int m_value;
+};
+
Added: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.sln
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.sln (rev 0)
+++ pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.sln 2008-12-17 21:43:57 UTC (rev 1475)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mydll", "mydll.vcproj", "{E7A34C45-534F-43A6-AF95-3CA2428619E2}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E7A34C45-534F-43A6-AF95-3CA2428619E2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E7A34C45-534F-43A6-AF95-3CA2428619E2}.Debug|Win32.Build.0 = Debug|Win32
+ {E7A34C45-534F-43A6-AF95-3CA2428619E2}.Release|Win32.ActiveCfg = Release|Win32
+ {E7A34C45-534F-43A6-AF95-3CA2428619E2}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Added: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.suo
===================================================================
(Binary files differ)
Property changes on: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.suo
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.vcproj
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.vcproj (rev 0)
+++ pyplusplus_dev/pyplusplus/cpptypes/mydll/mydll.vcproj 2008-12-17 21:43:57 UTC (rev 1475)
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="mydll"
+ ProjectGUID="{E7A34C45-534F-43A6-AF95-3CA2428619E2}"
+ RootNamespace="mydll"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MYDLL_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MYDLL_EXPORTS"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\mydll.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\mydll.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: pyplusplus_dev/pyplusplus/cpptypes/mydll/release/mydll.dll
===================================================================
(Binary files differ)
Property changes on: pyplusplus_dev/pyplusplus/cpptypes/mydll/release/mydll.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pyplusplus_dev/pyplusplus/cpptypes/tester.py
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/tester.py (rev 0)
+++ pyplusplus_dev/pyplusplus/cpptypes/tester.py 2008-12-17 21:43:57 UTC (rev 1475)
@@ -0,0 +1,133 @@
+import ctypes
+import unittest
+import decorators
+
+mydll = ctypes.CPPDLL( './mydll/release/mydll.dll' )
+
+#we should keep somewhere decorated-undecorated name mappings
+#I don't feel like parsing source code is a good strategy
+# - there is no way to create mangled name for a function. In this example, other way is used - binary file is parsed
+# and the functions are mapped to dll entry using "human readable" format.
+# GCCXML reports mangled and demangled names of the function, but it is not a cross platform( compile ) solution.
+# It looks like I will have to cause mspdb package to work ( from where ctypes loads dlls? ctypes.windll.msvcr90 ???
+
+
+tmp = [ ( "number_t::number_t(class number_t const &)", "??0number_t@@QAE@ABV0@@Z" )
+ , ( "number_t::number_t(int)", "??0number_t@@QAE@H@Z" )
+ , ( "number_t::number_t(void)", "??0number_t@@QAE@XZ" )
+ , ( "number_t::~number_t(void)", "??1number_t@@UAE@XZ" )
+ , ( "class number_t & number_t::operator=(class number_t const &)", "??4number_t@@QAEAAV0@ABV0@@Z" )
+ , ( "const number_t::'vftable'", "??_7number_t@@6B@" )
+ , ( "int number_t::get_value(void)", "?get_value@number_t@@QBEHXZ" )
+ , ( "void number_t::print_it(void)", "?print_it@number_t@@QBEXXZ" )
+ , ( "void number_t::set_value(int)", "?set_value@number_t@@QAEXH@Z" ) ]
+
+mydll.name_mapping = {}
+for n1, n2 in tmp:
+ mydll.name_mapping[n1] = n2
+ mydll.name_mapping[n2] = n1
+
+# what is the best way to treat overloaded constructors
+class public( object ):
+ def __init__(self, dll, this, name, restype=None, argtypes=None ):
+ self.this = this #reference to class instance
+ self.name = name
+ self.func = getattr( dll, dll.name_mapping[name] )
+ self.func.restype = restype
+ this_call_arg_types = [ ctypes.POINTER( this._obj.__class__ ) ]
+ if argtypes:
+ this_call_arg_types.extend( argtypes )
+ self.func.argtypes = this_call_arg_types
+
+ def __call__(self, *args, **keywd ):
+ return self.func( self.this, *args, **keywd )
+
+class mem_fun_factory( object ):
+ def __init__( self, dll, this ):
+ self.dll = dll
+ self.this = this
+
+ def __call__( self, *args, **keywd ):
+ return public( self.dll, self.this, *args, **keywd )
+
+class Number(ctypes.Structure):
+ #http://www.phpcompiler.org/articles/virtualinheritance.html,
+ _fields_ = [("vptr", ctypes.POINTER(ctypes.c_void_p)),
+ ("m_value", ctypes.c_int)]
+
+ def __init__(self, x=None):
+ mem_fun = mem_fun_factory( mydll, ctypes.byref( self ) )
+ self.get_value = mem_fun( 'int number_t::get_value(void)', restype=ctypes.c_int )
+ self.set_value = mem_fun( 'void number_t::set_value(int)', argtypes=[ctypes.c_int])
+ self.print_it = mem_fun( 'void number_t::print_it(void)' )
+ self.assign = mem_fun( "class number_t & number_t::operator=(class number_t const &)"
+ , restype=ctypes.POINTER(Number)
+ , argtypes=[ctypes.POINTER(Number)] )
+ #overloading example
+ if None is x:
+ mem_fun( 'number_t::number_t(void)' )()
+ elif isinstance( x, int ):
+ mem_fun( 'number_t::number_t(int)', argtypes=[ctypes.c_int] )( x )
+ elif isinstance( x, Number ):
+ mem_fun( 'number_t::number_t(class number_t const &)', argtypes=[ctypes.POINTER(Number)] )( ctypes.byref( x ) )
+ else:
+ raise RuntimeError( "Wrong argument" )
+
+ def __del__(self):
+ public( mydll, ctypes.byref(self), "number_t::~number_t(void)" )()
+
+class tester_t( unittest.TestCase ):
+ def test_constructors(self):
+ obj1 = Number(32)
+ self.failUnless( obj1.m_value == 32 )
+ obj2 = Number()
+ self.failUnless( obj2.m_value == 0 )
+ obj3 = Number(obj1)
+ self.failUnless( obj3.m_value == obj1.m_value == 32 )
+
+ def test_get_value( self ):
+ obj = Number(99)
+ self.failUnless( 99 == obj.get_value() )
+
+ def test_set_value( self ):
+ obj = Number()
+ obj.set_value( 13 )
+ self.failUnless( 13 == obj.get_value() == obj.m_value )
+
+ def test_assign( self ):
+ obj1 = Number(1)
+ obj2 = Number(2)
+ x = obj1.assign( obj2 )
+ #there are special cases, where ctypes could introduce "optimized" behaviour and not create new python object
+ self.failUnless( x is obj1 )
+ self.failUnless( obj1.m_value == obj2.m_value )
+
+def main():
+ obj = Number(42)
+ print obj.m_value
+ print hex(obj.vptr[0])
+ obj.print_it()
+ print '42 == ', obj.get_value()
+
+if __name__ == "__main__":
+ unittest.main()
+
+#problems:
+#consider generic algorithm for resolving overloaded functions call
+# * function name should be unique
+# * write something very smart and bugy and let the smart people to improve it
+
+
+"""
+TODO:
+
+* I think more testers and "demos", before I write code generator:
+ * a class instance passed\returned by value\reference\pointer\smart pointer
+ * function overloading
+ * how much code, we can put in the helper files. I mean class like "public". Or std::vector - there is no reason, to define\generate this class every time
+ * how we are going to manage relationship between objects:
+ class X{...};
+ class Y{ X x; public: const X& get_x() const { return x;} };
+ I think our solution should be very similar to Boost.Python call policies. It is definitely possible to go without it.
+
+"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-17 21:59:36
|
Revision: 1476
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1476&view=rev
Author: roman_yakovenko
Date: 2008-12-17 21:59:33 +0000 (Wed, 17 Dec 2008)
Log Message:
-----------
adding ctypes-cpp tester - remove unnecessary files
Removed Paths:
-------------
pyplusplus_dev/pyplusplus/cpptypes/decorators.py
pyplusplus_dev/pyplusplus/cpptypes/decorators.pyc
pyplusplus_dev/pyplusplus/cpptypes/get_exports.py
Deleted: pyplusplus_dev/pyplusplus/cpptypes/decorators.py
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/decorators.py 2008-12-17 21:43:57 UTC (rev 1475)
+++ pyplusplus_dev/pyplusplus/cpptypes/decorators.py 2008-12-17 21:59:33 UTC (rev 1476)
@@ -1,9 +0,0 @@
-class public( object ):
- def __init__(self , dll, decorated_name, return_type, argumen_types):
- self.decorated_name = decorated_name
- self.func = getattr( dll, decorated_name )
- self.func.restype = return_type
- self.func.argtypes = argumen_types
-
- def __call__(self, *args, **keywd ):
- return self.func( *args, **keywd )
Deleted: pyplusplus_dev/pyplusplus/cpptypes/decorators.pyc
===================================================================
(Binary files differ)
Deleted: pyplusplus_dev/pyplusplus/cpptypes/get_exports.py
===================================================================
--- pyplusplus_dev/pyplusplus/cpptypes/get_exports.py 2008-12-17 21:43:57 UTC (rev 1475)
+++ pyplusplus_dev/pyplusplus/cpptypes/get_exports.py 2008-12-17 21:59:33 UTC (rev 1476)
@@ -1,289 +0,0 @@
-# This code was contributed by 'leppton', see
-# https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1559219&group_id=5470
-#
-# This example shows how to use ctypes module to read all
-# function names from dll export directory
-
-import os
-if os.name != "nt":
- raise Exception("Wrong OS")
-
-import ctypes as ctypes
-import ctypes.wintypes as wintypes
-
-def convert_cdef_to_pydef(line):
- """\
-convert_cdef_to_pydef(line_from_c_header_file) -> python_tuple_string
-'DWORD var_name[LENGTH];' -> '("var_name", DWORD*LENGTH)'
-
-doesn't work for all valid c/c++ declarations"""
- l = line[:line.find(';')].split()
- if len(l) != 2:
- return None
- type_ = l[0]
- name = l[1]
- i = name.find('[')
- if i != -1:
- name, brac = name[:i], name[i:][1:-1]
- return '("%s", %s*%s)'%(name,type_,brac)
- else:
- return '("%s", %s)'%(name,type_)
-
-def convert_cdef_to_structure(cdef, name, data_dict=ctypes.__dict__):
- """\
-convert_cdef_to_structure(struct_definition_from_c_header_file)
- -> python class derived from ctypes.Structure
-
-limited support for c/c++ syntax"""
- py_str = '[\n'
- for line in cdef.split('\n'):
- field = convert_cdef_to_pydef(line)
- if field != None:
- py_str += ' '*4 + field + ',\n'
- py_str += ']\n'
-
- pyarr = eval(py_str, data_dict)
- class ret_val(ctypes.Structure):
- _fields_ = pyarr
- ret_val.__name__ = name
- ret_val.__module__ = None
- return ret_val
-
-#struct definitions we need to read dll file export table
-winnt = (
- ('IMAGE_DOS_HEADER', """\
- WORD e_magic;
- WORD e_cblp;
- WORD e_cp;
- WORD e_crlc;
- WORD e_cparhdr;
- WORD e_minalloc;
- WORD e_maxalloc;
- WORD e_ss;
- WORD e_sp;
- WORD e_csum;
- WORD e_ip;
- WORD e_cs;
- WORD e_lfarlc;
- WORD e_ovno;
- WORD e_res[4];
- WORD e_oemid;
- WORD e_oeminfo;
- WORD e_res2[10];
- LONG e_lfanew;
-"""),
-
- ('IMAGE_FILE_HEADER', """\
- WORD Machine;
- WORD NumberOfSections;
- DWORD TimeDateStamp;
- DWORD PointerToSymbolTable;
- DWORD NumberOfSymbols;
- WORD SizeOfOptionalHeader;
- WORD Characteristics;
-"""),
-
- ('IMAGE_DATA_DIRECTORY', """\
- DWORD VirtualAddress;
- DWORD Size;
-"""),
-
- ('IMAGE_OPTIONAL_HEADER32', """\
- WORD Magic;
- BYTE MajorLinkerVersion;
- BYTE MinorLinkerVersion;
- DWORD SizeOfCode;
- DWORD SizeOfInitializedData;
- DWORD SizeOfUninitializedData;
- DWORD AddressOfEntryPoint;
- DWORD BaseOfCode;
- DWORD BaseOfData;
- DWORD ImageBase;
- DWORD SectionAlignment;
- DWORD FileAlignment;
- WORD MajorOperatingSystemVersion;
- WORD MinorOperatingSystemVersion;
- WORD MajorImageVersion;
- WORD MinorImageVersion;
- WORD MajorSubsystemVersion;
- WORD MinorSubsystemVersion;
- DWORD Win32VersionValue;
- DWORD SizeOfImage;
- DWORD SizeOfHeaders;
- DWORD CheckSum;
- WORD Subsystem;
- WORD DllCharacteristics;
- DWORD SizeOfStackReserve;
- DWORD SizeOfStackCommit;
- DWORD SizeOfHeapReserve;
- DWORD SizeOfHeapCommit;
- DWORD LoaderFlags;
- DWORD NumberOfRvaAndSizes;
- IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
-""",
- {'IMAGE_NUMBEROF_DIRECTORY_ENTRIES':16}),
-
- ('IMAGE_NT_HEADERS', """\
- DWORD Signature;
- IMAGE_FILE_HEADER FileHeader;
- IMAGE_OPTIONAL_HEADER32 OptionalHeader;
-"""),
-
- ('IMAGE_EXPORT_DIRECTORY', """\
- DWORD Characteristics;
- DWORD TimeDateStamp;
- WORD MajorVersion;
- WORD MinorVersion;
- DWORD Name;
- DWORD Base;
- DWORD NumberOfFunctions;
- DWORD NumberOfNames;
- DWORD AddressOfFunctions;
- DWORD AddressOfNames;
- DWORD AddressOfNameOrdinals;
-"""),
- )
-
-#Construct python ctypes.Structures from above definitions
-data_dict = dict(wintypes.__dict__)
-for definition in winnt:
- name = definition[0]
- def_str = definition[1]
- if len(definition) == 3:
- data_dict.update(definition[2])
- type_ = convert_cdef_to_structure(def_str, name, data_dict)
- data_dict[name] = type_
- globals()[name] = type_
-
- ptype = ctypes.POINTER(type_)
- pname = 'P'+name
- data_dict[pname] = ptype
- globals()[pname] = ptype
-
-del data_dict
-del winnt
-
-class DllException(Exception):
- pass
-
-def read_export_table(dll_name, mmap=False, use_kernel=False):
- """\
-read_export_table(dll_name [,mmap=False [,use_kernel=False]]])
- -> list of exported names
-
-default is to load dll into memory: dll sections are aligned to
-page boundaries, dll entry points is called, etc...
-
-with mmap=True dll file image is mapped to memory, Relative Virtual
-Addresses (RVAs) must be mapped to real addresses manually
-
-with use_kernel=True direct kernel32.dll calls are used,
-instead of python mmap module
-
-see http://www.windowsitlibrary.com/Content/356/11/1.html
-for details on Portable Executable (PE) file format
-"""
- if not mmap:
- dll = ctypes.cdll.LoadLibrary(dll_name)
- if dll == None:
- raise DllException("Cant load dll")
- base_addr = dll._handle
-
- else:
- if not use_kernel:
- fileH = open(dll_name)
- if fileH == None:
- raise DllException("Cant load dll")
- import mmap
- m = mmap.mmap(fileH.fileno(), 0, None, mmap.ACCESS_READ)
- # id(m)+8 sucks, is there better way?
- base_addr = ctypes.cast(id(m)+8, ctypes.POINTER(ctypes.c_int))[0]
- else:
- kernel32 = ctypes.windll.kernel32
- if kernel32 == None:
- raise DllException("cant load kernel")
- fileH = kernel32.CreateFileA(dll_name, 0x00120089, 1,0,3,0,0)
- if fileH == 0:
- raise DllException("Cant open, errcode = %d"%kernel32.GetLastError())
- mapH = kernel32.CreateFileMappingW(fileH,0,0x8000002,0,0,0)
- if mapH == 0:
- raise DllException("Cant mmap, errocode = %d"%kernel32.GetLastError())
- base_addr = ctypes.windll.kernel32.MapViewOfFile(mapH, 0x4, 0, 0, 0)
- if base_addr == 0:
- raise DllException("Cant mmap(2), errocode = %d"%kernel32.GetLastError())
-
- dbghelp = ctypes.windll.dbghelp
- if dbghelp == None:
- raise DllException("dbghelp.dll not installed")
- pimage_nt_header = dbghelp.ImageNtHeader(base_addr)
- if pimage_nt_header == 0:
- raise DllException("Cant find IMAGE_NT_HEADER")
-
- #Functions like dbghelp.ImageNtHeader above have no type information
- #let's make one prototype for extra buzz
- #PVOID ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders, PVOID Base,
- # ULONG Rva, PIMAGE_SECTION_HEADER* LastRvaSection)
- # we use integers instead of pointers, coz integers are better
- # for pointer arithmetic
- prototype = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.c_int,
- ctypes.c_int, ctypes.c_int, ctypes.c_int)
- paramflags = ((1,"NtHeaders",pimage_nt_header),(1,"Base",base_addr),(1,"Rva"),(1,"LastRvaSection",0))
- ImageRvaToVa = prototype(('ImageRvaToVa', dbghelp), paramflags)
-
- def cast_rva(rva, type_):
- va = base_addr + rva
- if mmap and va > pimage_nt_header:
- va = ImageRvaToVa(Rva=rva)
- if va == 0:
- raise DllException("ImageRvaToVa failed")
- return ctypes.cast(va, type_)
-
- if not mmap:
- dos_header = cast_rva(0, PIMAGE_DOS_HEADER)[0]
- if dos_header.e_magic != 0x5A4D:
- raise DllException("IMAGE_DOS_HEADER.e_magic error")
- nt_header = cast_rva(dos_header.e_lfanew, PIMAGE_NT_HEADERS)[0]
- else:
- nt_header = ctypes.cast(pimage_nt_header, PIMAGE_NT_HEADERS)[0]
- if nt_header.Signature != 0x00004550:
- raise DllException("IMAGE_NT_HEADERS.Signature error")
-
- opt_header = nt_header.OptionalHeader
- if opt_header.Magic != 0x010b:
- raise DllException("IMAGE_OPTIONAL_HEADERS32.Magic error")
-
- ret_val = []
- exports_dd = opt_header.DataDirectory[0]
- if opt_header.NumberOfRvaAndSizes > 0 or exports_dd != 0:
- export_dir = cast_rva(exports_dd.VirtualAddress, PIMAGE_EXPORT_DIRECTORY)[0]
-
- nNames = export_dir.NumberOfNames
- if nNames > 0:
- PNamesType = ctypes.POINTER(ctypes.c_int * nNames)
- names = cast_rva(export_dir.AddressOfNames, PNamesType)[0]
- for rva in names:
- name = cast_rva(rva, ctypes.c_char_p).value
- ret_val.append(name)
-
- if mmap:
- if use_kernel:
- kernel32.UnmapViewOfFile(base_addr)
- kernel32.CloseHandle(mapH)
- kernel32.CloseHandle(fileH)
- else:
- m.close()
- fileH.close()
- return ret_val
-
-
-if __name__ == '__main__':
- import sys
- if len(sys.argv) != 2:
- print 'usage: %s dll_file_name'%sys.argv[0]
- sys.exit()
-## names = read_export_table(sys.argv[1], mmap=False, use_kernel=False)
- names = read_export_table(sys.argv[1], mmap=False, use_kernel=False)
- for name in names:
- print name
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-17 19:04:00
|
Revision: 1474
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1474&view=rev
Author: roman_yakovenko
Date: 2008-12-17 19:03:56 +0000 (Wed, 17 Dec 2008)
Log Message:
-----------
update testers to the boost svn
Modified Paths:
--------------
pyplusplus_dev/unittests/dwrapper_printer_tester.py
pyplusplus_dev/unittests/exposed_decls_db_tester.py
pyplusplus_dev/unittests/mdecl_wrapper_tester.py
Modified: pyplusplus_dev/unittests/dwrapper_printer_tester.py
===================================================================
--- pyplusplus_dev/unittests/dwrapper_printer_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
+++ pyplusplus_dev/unittests/dwrapper_printer_tester.py 2008-12-17 19:03:56 UTC (rev 1474)
@@ -7,6 +7,7 @@
import sys
import unittest
import autoconfig
+import pygccxml
from pyplusplus import module_builder
class tester_t(unittest.TestCase):
Modified: pyplusplus_dev/unittests/exposed_decls_db_tester.py
===================================================================
--- pyplusplus_dev/unittests/exposed_decls_db_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
+++ pyplusplus_dev/unittests/exposed_decls_db_tester.py 2008-12-17 19:03:56 UTC (rev 1474)
@@ -7,6 +7,7 @@
import sys
import unittest
import autoconfig
+import pygccxml
from pygccxml import parser
from pygccxml import declarations
from pyplusplus import decl_wrappers
@@ -25,7 +26,7 @@
enum bbb{ b=2 };
void fff();
};
-
+
int VVV;
void FFF( int );
}
@@ -41,13 +42,13 @@
struct yyy{
struct{ int i;};
};
-
+
struct zzz{
union{
int x; float y;
};
};
-
+
namespace{
int xxxx;
}
@@ -57,23 +58,24 @@
def test(self):
db = pypp_utils.exposed_decls_db_t()
- config = parser.config_t( gccxml_path=autoconfig.gccxml.executable )
+ config = parser.config_t( gccxml_path=autoconfig.gccxml.executable
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
reader = parser.project_reader_t( config, None, decl_wrappers.dwfactory_t() )
decls = reader.read_files( [parser.create_text_fc(self.CODE)] )
-
+
global_ns = declarations.get_global_namespace( decls )
ns = global_ns.namespace( 'ns' )
ns_skip = global_ns.namespace( 'ns_skip' )
- global_ns.exclude()
+ global_ns.exclude()
ns.include()
-
+
db.register_decls( global_ns, [] )
-
+
for x in ns.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == True )
-
+
for x in ns_skip.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == False )
Modified: pyplusplus_dev/unittests/mdecl_wrapper_tester.py
===================================================================
--- pyplusplus_dev/unittests/mdecl_wrapper_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
+++ pyplusplus_dev/unittests/mdecl_wrapper_tester.py 2008-12-17 19:03:56 UTC (rev 1474)
@@ -7,6 +7,7 @@
import sys
import unittest
import autoconfig
+import pygccxml
from pygccxml import declarations
from pyplusplus import module_builder
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-17 18:39:28
|
Revision: 1473
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1473&view=rev
Author: roman_yakovenko
Date: 2008-12-17 18:39:23 +0000 (Wed, 17 Dec 2008)
Log Message:
-----------
update testers to the boost svn
Modified Paths:
--------------
pyplusplus_dev/environment.py
pyplusplus_dev/unittests/algorithms_tester.py
pyplusplus_dev/unittests/already_exposed_tester.py
pyplusplus_dev/unittests/autoconfig.py
pyplusplus_dev/unittests/dwrapper_printer_tester.py
pyplusplus_dev/unittests/fundamental_tester_base.py
pyplusplus_dev/unittests/gui_wizard_tester.py
pyplusplus_dev/unittests/mdecl_wrapper_tester.py
pyplusplus_dev/unittests/ogre_generate_tester.py
pyplusplus_dev/unittests/particle_universe_generate_tester.py
pyplusplus_dev/unittests/unicode_bug.py
Modified: pyplusplus_dev/environment.py
===================================================================
--- pyplusplus_dev/environment.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/environment.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -37,7 +37,7 @@
if sys.platform == 'win32':
scons.suffix = '.pyd'
scons.ccflags = ['/MD', '/EHsc', '/GR', '/Zc:wchar_t', '/Zc:forScope', '-DBOOST_PYTHON_NO_PY_SIGNATURES' ]
- boost.libs = [ 'd:/dev/boost_svn/bin.v2/libs/python/build/msvc-7.1/release' ]
+ boost.libs = [ 'd:/dev/boost_svn/bin.v2/libs/python/build/msvc-7.1/release/threading-multi' ]
boost.include = 'd:/dev/boost_svn'
python.libs = 'e:/python25/libs'
python.include = 'e:/python25/include'
Modified: pyplusplus_dev/unittests/algorithms_tester.py
===================================================================
--- pyplusplus_dev/unittests/algorithms_tester.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/algorithms_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -7,6 +7,7 @@
import sys
import unittest
import autoconfig
+import pygccxml
from pygccxml import parser
from pygccxml import declarations
from pyplusplus import code_creators
@@ -24,7 +25,8 @@
def test(self):
mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( 'namespace enums{ enum { OK=1 }; }' ) ]
- , gccxml_path=autoconfig.gccxml.executable )
+ , gccxml_path=autoconfig.gccxml.executable
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
mb.namespace( name='::enums' ).include()
mb.build_code_creator('dummy')
flatten = code_creators.make_flatten(mb.code_creator.creators)
@@ -34,7 +36,7 @@
def test_find_by_declaration(self):
mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( 'namespace enums{ enum color{ red = 1}; }' )]
- , gccxml_path=autoconfig.gccxml.executable )
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
mb.namespace( name='::enums' ).include()
enum_matcher = declarations.match_declaration_t( name='color' )
mb.build_code_creator( 'dummy' )
@@ -46,7 +48,7 @@
def test_find_by_class_instance(self):
mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( 'namespace enums{ enum color{ red = 1}; }' )]
- , gccxml_path=autoconfig.gccxml.executable )
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
mb.namespace( name='::enums' ).include()
mb.build_code_creator('dummy')
enum_found = code_creators.creator_finder.find_by_class_instance(
@@ -67,7 +69,7 @@
return answer
def test(self):
- config = parser.config_t( gccxml_path=autoconfig.gccxml.executable )
+ config = parser.config_t( gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
code = []
code.append('struct a{};')
code.append('struct b{};')
@@ -95,7 +97,7 @@
def test(self):
mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( 'namespace arr{ struct x{ x( int arr[3][3], int ){} x( const x arr[3][3], int ){} }; }' )]
- , gccxml_path=autoconfig.gccxml.executable )
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
arr = mb.namespace( name='arr' )
mem_funs = arr.calldefs( 'x', arg_types=[None,None] )
for x in mem_funs:
@@ -115,7 +117,7 @@
def test(self):
mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( self.CODE )]
- , gccxml_path=autoconfig.gccxml.executable )
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
xxx = mb.namespace( name='xxx' )
fun = xxx.calldef( 'do_smth' )
self.failUnless( fun.readme() == [] )
@@ -133,12 +135,12 @@
struct derived : public base {
void f(int i);
using base::f;
- };
+ };
"""
def test(self):
mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( self.CODE )]
- , gccxml_path=autoconfig.gccxml.executable )
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
d = mb.class_( 'derived' )
f = d.mem_fun( 'f' )
self.failUnless( f.create_with_signature == True )
@@ -172,11 +174,11 @@
int m_dummy;
struct x_nested{};
-
+
float* get_rate(){
return 0;
}
-
+
virtual void get_size( int& i, int& j ){
i = 0;
j = 0;
@@ -187,7 +189,7 @@
def test(self):
mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( self.CLASS_DEF ) ]
- , gccxml_path=autoconfig.gccxml.executable )
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
mb.namespace( name='::tester' ).include()
x = mb.class_( 'x' )
x.add_registration_code( '//hello world reg' )
@@ -223,77 +225,77 @@
escaped_doc = module_builder.doc_extractor_i.escape_doc('Hello "Py++"')
self.failUnless( escaped_doc == '"Hello \\"Py++\\""' )
-class exclude_erronious_tester_t( unittest.TestCase ):
+class exclude_erronious_tester_t( unittest.TestCase ):
def test(self):
-
+
code = """
namespace xyz{
-
+
struct good{};
-
+
typedef void (*ff1)( int, int );
-
+
void f_bad( ff1 );
-
+
}
"""
-
- mb = module_builder.module_builder_t(
+
+ mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( code ) ]
- , gccxml_path=autoconfig.gccxml.executable )
-
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
+
xyz = mb.namespace( name='xyz' )
xyz.include()
-
+
xyz.exclude(compilation_errors=True)
-
+
self.failUnless( xyz.ignore == False )
self.failUnless( xyz.class_( 'good' ).ignore == False )
self.failUnless( xyz.free_fun( 'f_bad' ).ignore == True )
-class exclude_ellipsis_tester_t( unittest.TestCase ):
+class exclude_ellipsis_tester_t( unittest.TestCase ):
def test(self):
-
+
code = """
namespace xyz{
void do_smth( int, ... );
}
"""
-
- mb = module_builder.module_builder_t(
+
+ mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( code ) ]
- , gccxml_path=autoconfig.gccxml.executable )
-
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
+
do_smth = mb.free_fun( 'do_smth' )
-
+
self.failUnless( do_smth.exportable == False )
print do_smth.why_not_exportable()
-class constructors_code_tester_t( unittest.TestCase ):
+class constructors_code_tester_t( unittest.TestCase ):
def test(self):
-
+
code = """
namespace xyz{
struct Y;
-
+
struct X{
X();
- X( const X& );
+ X( const X& );
X( Y* );
};
}
"""
-
- mb = module_builder.module_builder_t(
+
+ mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( code ) ]
- , gccxml_path=autoconfig.gccxml.executable )
-
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
+
x = mb.class_( 'X' )
x.include()
x.constructors().body = ' //all constructors body'
x.null_constructor_body = ' //null constructor body'
x.copy_constructor_body = ' //copy constructor body'
-
+
mb.build_code_creator( 'XXX' )
code = mb.code_creator.create()
tmp = code.split( x.null_constructor_body )
Modified: pyplusplus_dev/unittests/already_exposed_tester.py
===================================================================
--- pyplusplus_dev/unittests/already_exposed_tester.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/already_exposed_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -7,46 +7,48 @@
import sys
import unittest
import autoconfig
+import pygccxml
from pyplusplus import utils
from pyplusplus import module_builder
import fundamental_tester_base
-class tester_t( unittest.TestCase ):
- def test(self):
+class tester_t( unittest.TestCase ):
+ def test(self):
fpath = os.path.join( autoconfig.data_directory, 'already_exposed_to_be_exported.hpp' )
mb = module_builder.module_builder_t( [module_builder.create_source_fc( fpath )]
- , gccxml_path=autoconfig.gccxml.executable )
-
+ , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
+
mb.global_ns.exclude()
mb.namespace( 'already_exposed' ).include()
mb.build_code_creator( 'already_exposed' )
-
+
already_exposed_dir = os.path.join( autoconfig.build_directory, 'already_exposed' )
mb.write_module( os.path.join( already_exposed_dir, 'already_exposed.cpp' ) )
-
+
#-----------------------------------------------------------------------
-
+
fpath = os.path.join( autoconfig.data_directory, 'already_exposed_2to_be_exported.hpp' )
mb = module_builder.module_builder_t( [module_builder.create_source_fc( fpath )]
- , gccxml_path=autoconfig.gccxml.executable )
-
+ , gccxml_path=autoconfig.gccxml.executable
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
+
mb.global_ns.exclude()
mb.namespace( 'to_be_exposed' ).include()
mb.build_code_creator( 'to_be_exposed' )
-
+
mb.register_module_dependency( already_exposed_dir )
mb.build_code_creator( 'to_be_exposed' )
to_be_exposed_dir = os.path.join( autoconfig.build_directory, 'to_be_exposed' )
mb.write_module( os.path.join( to_be_exposed_dir, 'to_be_exposed.cpp' ) )
-
+
body = mb.code_creator.body
self.failUnless( 2 == len( body.creators ) )
ae_derived_code = body.creators[0].create()
self.failUnless( mb.class_( 'ae_base' ).decl_string in ae_derived_code )
-
+
def create_suite():
- suite = unittest.TestSuite()
+ suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
return suite
Modified: pyplusplus_dev/unittests/autoconfig.py
===================================================================
--- pyplusplus_dev/unittests/autoconfig.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/autoconfig.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -21,8 +21,10 @@
from environment import scons, boost, python, gccxml, indexing_suite
+import pygccxml
+
class scons_config:
- libs = ['boost_python']
+ libs = []#['boost_python']
libpath = [ python.libs ] + boost.libs
cpppath = [ boost.include, python.include, indexing_suite.include ]
include_dirs = cpppath + [data_directory]
@@ -32,6 +34,10 @@
code = [
"import sys"
, "env = Environment()"
+ , "if 'linux' not in sys.platform:"
+ , " env['MSVS'] = {'VERSION': '%s'}" % str( pygccxml.utils.native_compiler.get_version()[1] )
+ , " env['MSVS_VERSION'] = '%s'" % str( pygccxml.utils.native_compiler.get_version()[1] )
+ , " Tool('msvc')(env)"
, "t = env.SharedLibrary( target=r'%(target)s'"
, " , source=[ %(sources)s ]"
, " , LIBS=[ %s ]" % ','.join( [ 'r"%s"' % lib for lib in scons_config.libs ] )
@@ -40,9 +46,9 @@
, " , CCFLAGS=[ %s ]" % ','.join( [ 'r"%s"' % flag for flag in scons.ccflags ] )
, " , SHLIBPREFIX=''"
, " , SHLIBSUFFIX='%s'" % scons.suffix #explicit better then implicit
- , ")"
- , "if 'linux' not in sys.platform:"
- , " env.AddPostAction(t, 'mt.exe -nologo -manifest %(target)s.pyd.manifest -outputresource:%(target)s.pyd;2' )" ]
+ , ")" ]
+ #~ , "if 'linux' not in sys.platform:"
+ #~ , " env.AddPostAction(t, 'mt.exe -nologo -manifest %(target)s.pyd.manifest -outputresource:%(target)s.pyd;2' )" ]
return os.linesep.join( code )
#I need this in order to allow Python to load just compiled modules
Modified: pyplusplus_dev/unittests/dwrapper_printer_tester.py
===================================================================
--- pyplusplus_dev/unittests/dwrapper_printer_tester.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/dwrapper_printer_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -21,17 +21,18 @@
]
return map( lambda f: os.path.join( autoconfig.data_directory, f )
, files )
-
+
def test(self):
mb = module_builder.module_builder_t( self._get_files()
, gccxml_path=autoconfig.gccxml.executable
, include_paths=[autoconfig.boost.include]
- , undefine_symbols=['__MINGW32__'])
+ , undefine_symbols=['__MINGW32__']
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())
writer = lambda decl: None
module_builder.print_declarations( mb.global_ns, writer=writer )
-
+
def create_suite():
- suite = unittest.TestSuite()
+ suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
return suite
@@ -39,4 +40,4 @@
unittest.TextTestRunner(verbosity=2).run( create_suite() )
if __name__ == "__main__":
- run_suite()
\ No newline at end of file
+ run_suite()
Modified: pyplusplus_dev/unittests/fundamental_tester_base.py
===================================================================
--- pyplusplus_dev/unittests/fundamental_tester_base.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/fundamental_tester_base.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -7,6 +7,7 @@
import sys
import unittest
import autoconfig
+import pygccxml
from pygccxml import parser
from pyplusplus import utils
from pygccxml import declarations
@@ -54,8 +55,8 @@
irrelevant_decl_types = ( declarations.typedef_t
, declarations.namespace_t
, declarations.free_operator_t )
- specially_exposed_decls = mb.code_creator.specially_exposed_decls
- for d in mb.decls():
+ specially_exposed_decls = mb.code_creator.specially_exposed_decls
+ for d in mb.decls():
if not d.exportable:
continue
elif isinstance( d, declarations.free_operator_t ):
@@ -64,13 +65,13 @@
if d in specially_exposed_decls:
continue
if exposed_db.is_exposed( d ):
- i = 0
+ i = 0
self.failUnless( not exposed_db.is_exposed( d )
, '''Declaration "%s" is NOT exposed, but for some reason it is marked as such.'''
% str( d ) )
#if d.ignore or not d.exportable or isinstance( d, irrelevant_decl_types ):
#continue
- #if d.parent and not d.parent.name:
+ #if d.parent and not d.parent.name:
#continue #unnamed classes
else:
self.failUnless( exposed_db.is_exposed( d )
@@ -95,17 +96,13 @@
def _create_extension_source_file(self):
global LICENSE
-
- #xml_file = os.path.split( self.__to_be_exported_header )[1]
- #xml_file = os.path.join( autoconfig.build_dir, xml_file + '.xml' )
- #xml_cached_fc = parser.create_cached_source_fc( self.__to_be_exported_header, xml_file )
- #mb = module_builder.module_builder_t( [xml_cached_fc]
mb = module_builder.module_builder_t( [self.__to_be_exported_header]
, gccxml_path=autoconfig.gccxml.executable
, include_paths=[autoconfig.boost.include]
, undefine_symbols=['__MINGW32__']
- , indexing_suite_version=self.__indexing_suite_version)
+ , indexing_suite_version=self.__indexing_suite_version
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())
for decl in mb.decls():
decl.documentation = '"documentation"'
self.customize( mb )
Modified: pyplusplus_dev/unittests/gui_wizard_tester.py
===================================================================
--- pyplusplus_dev/unittests/gui_wizard_tester.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/gui_wizard_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -11,12 +11,13 @@
#Configurating GCC-XML parser
#Basically you should copy here your makefile configuration
-parser_configuration = parser.config_t(
+parser_configuration = parser.config_t(
#path to GCC-XML binary
gccxml_path=r"c:/tools/gccxml/bin/gccxml.exe"
, working_directory=r"D:\pygccxml_sources\source\pyplusplus\unittests\data"
, include_paths=['D:/pygccxml_sources/source/pyplusplus/gui']
- , define_symbols=[] )
+ , define_symbols=[]
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
#Creating an instance of class that will help you to expose your declarations
mb = module_builder.module_builder_t( [r"D:\pygccxml_sources\source\pyplusplus\unittests\data\call_policies_to_be_exported.hpp"], parser_configuration )
@@ -28,4 +29,4 @@
mb.build_code_creator( module_name='pyplusplus' )
#Writing code to file.
-mb.write_module( './bindings.cpp' )
\ No newline at end of file
+mb.write_module( './bindings.cpp' )
Modified: pyplusplus_dev/unittests/mdecl_wrapper_tester.py
===================================================================
--- pyplusplus_dev/unittests/mdecl_wrapper_tester.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/mdecl_wrapper_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -27,56 +27,58 @@
mb = module_builder.module_builder_t( self._get_files()
, gccxml_path=autoconfig.gccxml.executable
, include_paths=[autoconfig.boost.include]
- , undefine_symbols=['__MINGW32__'] )
+ , undefine_symbols=['__MINGW32__']
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())
classes = filter( lambda d: isinstance( d, module_builder.class_t )
, declarations.make_flatten( mb.global_ns ) )
-
+
mdw = module_builder.mdecl_wrapper_t( classes )
#check set to property functionality
for d in mdw:
d.always_expose_using_scope = False
-
+
mdw.always_expose_using_scope = True
-
+
all_true = True
for d in mdw:
all_true &= d.always_expose_using_scope
-
+
self.failUnless( all_true )
-
- #check call method functionality
+
+ #check call method functionality
for d in mdw:
d.ignore = True
-
+
mdw.include()
-
+
all_false = False
for d in mdw:
all_true |= d.ignore
-
+
self.failUnless( not all_false )
-
+
#check for exception:
try:
mdw.call_policies = None
self.fail( "Runtime error has not been raised." )
except RuntimeError, err:
pass
-
+
def test__getitem__( self ):
mb = module_builder.module_builder_t( self._get_files()
, gccxml_path=autoconfig.gccxml.executable
, include_paths=[autoconfig.boost.include]
- , undefine_symbols=['__MINGW32__'] )
-
+ , undefine_symbols=['__MINGW32__']
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
+
public_bases = mb.classes( 'public_base_t' )
self.failUnless( 1 == len( public_bases ) )
public_bases.include()
self.failUnless( public_bases[0].ignore == False )
-
+
mb.global_ns[ 'public_base_t' ].exclude()
-
+
self.failUnless( public_bases[0].ignore == True )
#def test__getitem__2( self ):
@@ -84,7 +86,7 @@
#, gccxml_path=autoconfig.gccxml.executable
#, include_paths=[autoconfig.boost.include]
#, undefine_symbols=['__MINGW32__'] )
-
+
#mem_funs = mb.classes( 'public_base_t' ).member_functions('regular')
#print len(mem_funs)
##self.failUnless( 1 == len( public_bases ) )
@@ -92,15 +94,15 @@
#mem_funs.include()
#for mf in mem_funs:
#self.failUnless( mf.ignore == False )
-
+
#mb.global_ns[ 'public_base_t' ]['regular'].exclude()
-
+
#for mf in mem_funs:
#self.failUnless( mf.ignore == False )
def create_suite():
- suite = unittest.TestSuite()
+ suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
return suite
Modified: pyplusplus_dev/unittests/ogre_generate_tester.py
===================================================================
--- pyplusplus_dev/unittests/ogre_generate_tester.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/ogre_generate_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -18,41 +18,42 @@
from pyplusplus import utils as pypp_utils
from pyplusplus import function_transformers as ft
-class ogre_generate_tester_t(unittest.TestCase):
+class ogre_generate_tester_t(unittest.TestCase):
def test(self):
module_builder.set_logger_level( logging.CRITICAL )
messages.disable( *messages.all_warning_msgs )
-
+
ogre_file = autoconfig.data_directory.replace( 'pyplusplus_dev', 'pygccxml_dev' )
ogre_file = parser.create_gccxml_fc( os.path.join( ogre_file, 'ogre.1.7.xml' ) )
mb = module_builder.module_builder_t(
[ ogre_file ]
- , gccxml_path=autoconfig.gccxml.executable
- , indexing_suite_version=2)
-
+ , gccxml_path=autoconfig.gccxml.executable
+ , indexing_suite_version=2
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())
+
mb.global_ns.exclude()
mb.namespace('Ogre').include()
-
+
x = mb.global_ns.decls( lambda d: 'Animation*' in d.name and 'MapIterator' in d.name )
for y in x:
print y.name
print y.partial_name
print declarations.full_name( y, with_defaults=False )
-
+
target_dir = os.path.join( autoconfig.build_directory, 'ogre' )
#~ if os.path.exists( target_dir ):
#~ shutil.rmtree( target_dir )
#~ os.mkdir( target_dir )
-
+
mb.build_code_creator( 'Ogre3d' )
- mb.split_module( target_dir )
+ mb.split_module( target_dir )
def create_suite():
suite = unittest.TestSuite()
- suite.addTest( unittest.makeSuite(ogre_generate_tester_t))
+ suite.addTest( unittest.makeSuite(ogre_generate_tester_t))
return suite
def run_suite():
Modified: pyplusplus_dev/unittests/particle_universe_generate_tester.py
===================================================================
--- pyplusplus_dev/unittests/particle_universe_generate_tester.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/particle_universe_generate_tester.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -18,18 +18,19 @@
from pyplusplus import utils as pypp_utils
from pyplusplus import function_transformers as ft
-class ogre_generate_tester_t(unittest.TestCase):
+class ogre_generate_tester_t(unittest.TestCase):
def test(self):
module_builder.set_logger_level( logging.CRITICAL )
messages.disable( *messages.all_warning_msgs )
-
+
xml_file = parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'particleuniverse.xml' ) )
mb = module_builder.module_builder_t(
[ xml_file ]
- , gccxml_path=autoconfig.gccxml.executable
- , indexing_suite_version=2)
-
+ , gccxml_path=autoconfig.gccxml.executable
+ , indexing_suite_version=2
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())
+
mb.global_ns.exclude()
mb.namespace('ParticleUniverse').include()
mb.namespace('Ogre').include()
@@ -42,13 +43,13 @@
psp = mb.class_( '::ParticleUniverse::ParticleScriptParser' )
declarations.print_declarations( psp )
mb.build_code_creator( 'PU' )
- mb.split_module( target_dir )
+ mb.split_module( target_dir )
def create_suite():
suite = unittest.TestSuite()
- suite.addTest( unittest.makeSuite(ogre_generate_tester_t))
+ suite.addTest( unittest.makeSuite(ogre_generate_tester_t))
return suite
def run_suite():
Modified: pyplusplus_dev/unittests/unicode_bug.py
===================================================================
--- pyplusplus_dev/unittests/unicode_bug.py 2008-12-17 09:05:44 UTC (rev 1472)
+++ pyplusplus_dev/unittests/unicode_bug.py 2008-12-17 18:39:23 UTC (rev 1473)
@@ -3,6 +3,7 @@
import os
import unittest
import autoconfig
+import pygccxml
from pygccxml import parser
from pygccxml import declarations
from pyplusplus import code_creators
@@ -12,10 +13,11 @@
from pyplusplus import function_transformers as ft
-mb = module_builder.module_builder_t(
+mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( 'struct x{};' ) ]
- , gccxml_path=autoconfig.gccxml.executable
- , encoding='UTF-8')
+ , gccxml_path=autoconfig.gccxml.executable
+ , encoding='UTF-8'
+ , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())
mb.build_code_creator( module_name='unicode_bug' )
mb.code_creator.license = "//абвгдеёжзийклмнопрстуфхцчшщъыьэюя"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-17 09:05:48
|
Revision: 1472
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1472&view=rev
Author: roman_yakovenko
Date: 2008-12-17 09:05:44 +0000 (Wed, 17 Dec 2008)
Log Message:
-----------
functionality, which returns compiler name as gccxml expects was added
Modified Paths:
--------------
pygccxml_dev/pygccxml/utils/__init__.py
pygccxml_dev/unittests/autoconfig.py
Modified: pygccxml_dev/pygccxml/utils/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/utils/__init__.py 2008-12-16 22:16:38 UTC (rev 1471)
+++ pygccxml_dev/pygccxml/utils/__init__.py 2008-12-17 09:05:44 UTC (rev 1472)
@@ -165,4 +165,12 @@
from distutils import msvccompiler
return ( 'msvc', str( msvccompiler.get_build_version() ) )
+ @staticmethod
+ def get_gccxml_compiler():
+ compiler = native_compiler.get_version()
+ if not compiler:
+ return None
+ else:
+ return compiler[0] + compiler[1].replace( '.', '' )
+
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2008-12-16 22:16:38 UTC (rev 1471)
+++ pygccxml_dev/unittests/autoconfig.py 2008-12-17 09:05:44 UTC (rev 1472)
@@ -27,9 +27,7 @@
import pygccxml
print 'unittests will run on DEVELOPMENT version'
-compiler = pygccxml.utils.native_compiler.get_version()
-if compiler:
- compiler = compiler[0] + compiler[1].replace( '.', '' )
+compiler = pygccxml.utils.native_compiler.get_gccxml_compiler()
print 'GCCXML configured to simulate compiler ', compiler
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-16 23:22:37
|
Revision: 1471
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1471&view=rev
Author: roman_yakovenko
Date: 2008-12-16 22:16:38 +0000 (Tue, 16 Dec 2008)
Log Message:
-----------
adding ability to assign variable an address
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/member_variable.py
pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py
pyplusplus_dev/unittests/member_variables_tester.py
Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2008-12-16 13:16:38 UTC (rev 1470)
+++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2008-12-16 22:16:38 UTC (rev 1471)
@@ -656,15 +656,26 @@
def __init__(self, variable, wrapper=None ):
member_variable_base_t.__init__( self, variable=variable, wrapper=wrapper )
+ def has_setter( self ) :
+ return declarations.is_pointer( self.declaration.type ) \
+ and not declarations.is_const( self.declaration.type )
+
def _create_m_var( self ):
+ param_sep = self.PARAM_SEPARATOR
+ if self.has_setter() or self.documentation:
+ param_sep = os.linesep + self.indent( self.PARAM_SEPARATOR, 3 )
answer = [ 'add_property' ]
answer.append( '( ' )
answer.append('"%s"' % self.alias)
- answer.append( self.PARAM_SEPARATOR )
+ answer.append( param_sep )
answer.append( 'pyplus_conv::make_addressof_getter(&%s)'
% self.decl_identifier )
+ if self.has_setter():
+ answer.append( param_sep )
+ answer.append( 'pyplus_conv::make_address_setter(&%s)'
+ % self.decl_identifier )
if self.documentation:
- answer.append( self.PARAM_SEPARATOR )
+ answer.append( param_sep )
answer.append( self.documentation )
answer.append( ' ) ' )
return ''.join( answer )
Modified: pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py 2008-12-16 13:16:38 UTC (rev 1470)
+++ pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py 2008-12-16 22:16:38 UTC (rev 1471)
@@ -41,6 +41,16 @@
return size_t( boost::addressof( inst.*offset ) );
}
+template< typename TType, typename TMemVarType>
+void
+assign_address( TType* inst_ptr, TMemVarType TType::* offset, size_t address ){
+ if( !inst_ptr ){
+ throw std::runtime_error( "unable to dereference null pointer" );
+ }
+ TType& inst = *inst_ptr;
+ inst.*offset = reinterpret_cast< TMemVarType >( address );
+}
+
template< typename TType >
size_t
addressof_inst( const TType* inst_ptr){
@@ -61,6 +71,17 @@
, boost::mpl::vector< size_t, const TType* >() );
}
+template< typename TType, typename TMemVarType >
+boost::python::object
+make_address_setter( TMemVarType TType::* offset ){
+ namespace bpl = boost::python;
+ namespace pyppc = pyplusplus::convenience;
+ return bpl::make_function( boost::bind( &pyppc::assign_address< TType, TMemVarType >, _1, offset, _2 )
+ , bpl::default_call_policies()
+ , boost::mpl::vector< void, TType*, size_t >() );
+}
+
+
template< typename TType >
boost::python::object
make_addressof_inst_getter(){
Modified: pyplusplus_dev/unittests/member_variables_tester.py
===================================================================
--- pyplusplus_dev/unittests/member_variables_tester.py 2008-12-16 13:16:38 UTC (rev 1470)
+++ pyplusplus_dev/unittests/member_variables_tester.py 2008-12-16 22:16:38 UTC (rev 1471)
@@ -97,6 +97,15 @@
data = data_type.from_address( image.data )
for j in range(5):
self.failUnless( j == data[j] )
+
+ int_array = ctypes.c_int * 5
+ array = int_array()
+ for i in range( 5 ):
+ array[i] = 2*i
+ image.data = ctypes.addressof(array)
+ data = data_type.from_address( image.data )
+ for j in range(5):
+ self.failUnless( j*2 == data[j] )
data_type = ctypes.POINTER( ctypes.c_int )
data = data_type.from_address( module.image_t.none_image )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-16 13:16:42
|
Revision: 1470
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1470&view=rev
Author: roman_yakovenko
Date: 2008-12-16 13:16:38 +0000 (Tue, 16 Dec 2008)
Log Message:
-----------
rename pdb to mspdb
Modified Paths:
--------------
pygccxml_dev/unittests/pdb_tester.py
Modified: pygccxml_dev/unittests/pdb_tester.py
===================================================================
--- pygccxml_dev/unittests/pdb_tester.py 2008-12-16 12:56:36 UTC (rev 1469)
+++ pygccxml_dev/unittests/pdb_tester.py 2008-12-16 13:16:38 UTC (rev 1470)
@@ -2,7 +2,7 @@
import unittest
import autoconfig
-from pygccxml.msvc import pdb
+from pygccxml.msvc import mspdb
from pygccxml import declarations
from pygccxml.msvc import common_utils as msvc_utils
@@ -15,7 +15,7 @@
, 'msvc_build.pdb' )
def __splitter_tester_impl( self, name, expected_result ):
- splitter = pdb.impl_details.full_name_splitter_t( name )
+ splitter = mspdb.impl_details.full_name_splitter_t( name )
self.failUnless( len(splitter.scope_names) == len(expected_result) )
self.failUnless( splitter.scope_names == expected_result )
@@ -35,7 +35,7 @@
self.__splitter_tester_impl( name, expected_result )
def test_create_nss(self):
- reader = pdb.decl_loader_t( self.pdb_file )
+ reader = mspdb.decl_loader_t( self.pdb_file )
print reader.symbols_table.name
reader.read()
f = file( 'decls.cpp', 'w+' )
@@ -77,7 +77,7 @@
def test_pdbs( self ):
for f in filter( lambda f: f.endswith( 'pdb' ), os.listdir( r'E:\pdbs' ) ):
try:
- reader = pdb.decl_loader_t( f )
+ reader = mspdb.decl_loader_t( f )
reader.read()
f = file( d + '.txt', 'w+' )
declarations.print_declarations( reader.global_ns, writer=lambda line: f.write(line+'\n') )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-16 12:56:40
|
Revision: 1469
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1469&view=rev
Author: roman_yakovenko
Date: 2008-12-16 12:56:36 +0000 (Tue, 16 Dec 2008)
Log Message:
-----------
adding new functionality and improving initial environment handling
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/common_utils.py
pygccxml_dev/pygccxml/utils/__init__.py
pygccxml_dev/unittests/autoconfig.py
Modified: pygccxml_dev/pygccxml/msvc/common_utils.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/common_utils.py 2008-12-16 08:51:37 UTC (rev 1468)
+++ pygccxml_dev/pygccxml/msvc/common_utils.py 2008-12-16 12:56:36 UTC (rev 1469)
@@ -37,7 +37,7 @@
#__unDName definition was taken from:
#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
-msvcrxx = ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
+msvcrxx = ctypes.windll.msvcr71 #ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type
malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type
Modified: pygccxml_dev/pygccxml/utils/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/utils/__init__.py 2008-12-16 08:51:37 UTC (rev 1468)
+++ pygccxml_dev/pygccxml/utils/__init__.py 2008-12-16 12:56:36 UTC (rev 1469)
@@ -119,38 +119,50 @@
def fdel(s):
del s.__dict__[private]
super(cached, self).__init__(fget, fdel=fdel)
-
+
@staticmethod
def reset(self):
cls = self.__class__
for name in dir(cls):
attr = getattr(cls, name)
if isinstance(attr, cached):
- delattr(self, name)
+ delattr(self, name)
class enum( object ):
"""Usage example:
class fruits(enum):
apple = 0
orange = 1
-
+
fruits.has_value( 1 )
fruits.name_of( 1 )
"""
-
+
@classmethod
def has_value( cls, enum_numeric_value ):
- for name, value in cls.__dict__.iteritems():
+ for name, value in cls.__dict__.iteritems():
if enum_numeric_value == value:
return True
else:
return False
-
+
@classmethod
def name_of( cls, enum_numeric_value ):
- for name, value in cls.__dict__.iteritems():
+ for name, value in cls.__dict__.iteritems():
if enum_numeric_value == value:
return name
else:
raise RuntimeError( 'Unable to find name for value(%d) in enumeration "%s"'
% ( enum_numeric_value, cls.__name__ ) )
+
+class native_compiler:
+ """provides information about "native compiler", which was used to build this Python executable"""
+
+ @staticmethod
+ def get_version():
+ if 'win' not in sys.platform:
+ return None #not implemented yet
+ from distutils import msvccompiler
+ return ( 'msvc', str( msvccompiler.get_build_version() ) )
+
+
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2008-12-16 08:51:37 UTC (rev 1468)
+++ pygccxml_dev/unittests/autoconfig.py 2008-12-16 12:56:36 UTC (rev 1469)
@@ -12,24 +12,13 @@
this_module_dir_path = os.path.abspath ( os.path.dirname( sys.modules[__name__].__file__) )
-compiler = None
+
data_directory = os.path.join( this_module_dir_path, 'data' )
build_directory = os.path.join( this_module_dir_path, 'temp' )
-gccxml_07_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v07', sys.platform, 'bin' )
-gccxml_09_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v09', sys.platform, 'bin' )
+gccxml_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v09', sys.platform, 'bin' )
+gccxml_version = '__GCCXML_09__'
-gccxml_path = gccxml_09_path
-
-gccxml_version = '__GCCXML_07__'
-if '09' in gccxml_path:
- gccxml_version = '__GCCXML_09__'
-
-print 'compiler: ', gccxml_version
-
-if sys.platform == 'win32':
- compiler = 'msvc71'
-
try:
import pygccxml
print 'unittests will run on INSTALLED version'
@@ -38,25 +27,31 @@
import pygccxml
print 'unittests will run on DEVELOPMENT version'
+compiler = pygccxml.utils.native_compiler.get_version()
+if compiler:
+ compiler = compiler[0] + compiler[1].replace( '.', '' )
+
+print 'GCCXML configured to simulate compiler ', compiler
+
pygccxml.declarations.class_t.USE_DEMANGLED_AS_NAME = True
class cxx_parsers_cfg:
-
+
keywd = { 'working_directory' : data_directory
, 'define_symbols' : [ gccxml_version ]
, 'compiler' : compiler }
-
+
if os.path.exists( os.path.join( gccxml_path, 'gccxml' ) ) \
or os.path.exists( os.path.join( gccxml_path, 'gccxml.exe' ) ):
keywd[ 'gccxml_path'] = gccxml_path
gccxml = pygccxml.parser.gccxml_configuration_t( **keywd )
-
+
pdb_loader = None
if sys.platform == 'win32':
- from pygccxml.msvc import pdb
+ from pygccxml.msvc import mspdb
pdb_file = os.path.join( data_directory, 'msvc_build', 'Debug', 'msvc_build.pdb' )
if os.path.exists( pdb_file ):
- pdb_loader = pdb.decl_loader_t( pdb_file )
+ pdb_loader = mspdb.decl_loader_t( pdb_file )
pdb_loader.read()
def get_pdb_global_ns():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-16 08:51:42
|
Revision: 1468
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1468&view=rev
Author: roman_yakovenko
Date: 2008-12-16 08:51:37 +0000 (Tue, 16 Dec 2008)
Log Message:
-----------
update gccxml for windows ( built with msvc 7.1 )
Modified Paths:
--------------
gccxml_bin/v09/win32/bin/gccxml.exe
gccxml_bin/v09/win32/bin/gccxml_cc1plus.exe
gccxml_bin/v09/win32/bin/gccxml_vcconfig.exe
gccxml_bin/v09/win32/share/gccxml-0.9/GCC/find_flags
gccxml_bin/v09/win32/share/gccxml-0.9/gccxml_config
gccxml_bin/v09/win32/share/gccxml-0.9/gccxml_find_flags
gccxml_bin/v09/win32/share/man/man1/gccxml.1
Added Paths:
-----------
gccxml_bin/v09/win32/share/gccxml-0.9/GCC/3.4/bits/
gccxml_bin/v09/win32/share/gccxml-0.9/GCC/3.4/bits/gthr-default.h
gccxml_bin/v09/win32/share/gccxml-0.9/GCC/4.3/
gccxml_bin/v09/win32/share/gccxml-0.9/GCC/4.3/gccxml_builtins.h
gccxml_bin/v09/win32/share/gccxml-0.9/Sun/
gccxml_bin/v09/win32/share/gccxml-0.9/Sun/5.8/
gccxml_bin/v09/win32/share/gccxml-0.9/Sun/5.8/adaptation.patch
gccxml_bin/v09/win32/share/gccxml-0.9/Sun/README
gccxml_bin/v09/win32/share/gccxml-0.9/Sun/adapt_headers.sh
gccxml_bin/v09/win32/share/gccxml-0.9/Sun/find_flags
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/algorithm
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/comdef.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/comip.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/comutil.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/crtdbg.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/crtdefs.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/deque
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/eh.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/functional
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/iosfwd
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/iostream
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/iso646.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/iterator
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/limits
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/list
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/math.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/memory
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/process.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/setjmp.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/signal.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/typeinfo
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/vector
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/xdebug
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/xhash
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/xlocale
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/xstddef
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/xutility
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/yvals.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/PlatformSDK/
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/PlatformSDK/OAIdl.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/PlatformSDK/PropIdl.h
gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/PlatformSDK/WinNT.h
gccxml_bin/v09/win32/share/gccxml-0.9/VcInstall/vc9Include.patch
gccxml_bin/v09/win32/share/gccxml-0.9/VcInstall/vc9PlatformSDK.patch
Modified: gccxml_bin/v09/win32/bin/gccxml.exe
===================================================================
(Binary files differ)
Modified: gccxml_bin/v09/win32/bin/gccxml_cc1plus.exe
===================================================================
(Binary files differ)
Modified: gccxml_bin/v09/win32/bin/gccxml_vcconfig.exe
===================================================================
(Binary files differ)
Added: gccxml_bin/v09/win32/share/gccxml-0.9/GCC/3.4/bits/gthr-default.h
===================================================================
--- gccxml_bin/v09/win32/share/gccxml-0.9/GCC/3.4/bits/gthr-default.h (rev 0)
+++ gccxml_bin/v09/win32/share/gccxml-0.9/GCC/3.4/bits/gthr-default.h 2008-12-16 08:51:37 UTC (rev 1468)
@@ -0,0 +1,664 @@
+/* Threads compatibility routines for libgcc2 and libobjc. */
+/* Compile this one with gcc. */
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* As a special exception, if you link this library with other files,
+ some of which are compiled with GCC, to produce an executable,
+ this library does not by itself cause the resulting executable
+ to be covered by the GNU General Public License.
+ This exception does not however invalidate any other reasons why
+ the executable file might be covered by the GNU General Public License. */
+
+#ifndef _GLIBCXX_GCC_GTHR_POSIX_H
+#define _GLIBCXX_GCC_GTHR_POSIX_H
+
+/* POSIX threads specific definitions.
+ Easy, since the interface is just one-to-one mapping. */
+
+#define __GTHREADS 1
+
+/* Some implementations of <pthread.h> require this to be defined. */
+#if !defined(_REENTRANT) && defined(__osf__)
+#define _REENTRANT 1
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+#endif
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK && defined __GNUC_RH_RELEASE__ \
+ && ((__GNUC__ == 3 && __GNUC_MINOR__ == 4 && (__GNUC_PATCHLEVEL__ > 4 || (__GNUC_PATCHLEVEL__ == 4 && __GNUC_RH_RELEASE__ > 2))) \
+ || (__GNUC__ == 4 && __GNUC_MINOR__ == 0 && (__GNUC_PATCHLEVEL__ > 2 || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ > 6)))) \
+ && ! defined __attribute__
+# define __gthrw(name) \
+ extern __typeof(name) __gthrw_ ## name
+
+
+__gthrw(pthread_once);
+__gthrw(pthread_key_create);
+__gthrw(pthread_key_delete);
+__gthrw(pthread_getspecific);
+__gthrw(pthread_setspecific);
+__gthrw(pthread_create);
+
+__gthrw(pthread_mutex_lock);
+__gthrw(pthread_mutex_trylock);
+__gthrw(pthread_mutex_unlock);
+__gthrw(pthread_mutexattr_init);
+__gthrw(pthread_mutexattr_settype);
+__gthrw(pthread_mutexattr_destroy);
+
+__gthrw(pthread_mutex_init);
+
+# if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C. */
+__gthrw(pthread_cond_broadcast);
+__gthrw(pthread_cond_destroy);
+__gthrw(pthread_cond_init);
+__gthrw(pthread_cond_signal);
+__gthrw(pthread_cond_wait);
+__gthrw(pthread_exit);
+__gthrw(pthread_mutex_destroy);
+__gthrw(pthread_self);
+/* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but
+ we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */
+# ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(sched_get_priority_max);
+__gthrw(sched_get_priority_min);
+# endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+__gthrw(sched_yield);
+__gthrw(pthread_attr_destroy);
+__gthrw(pthread_attr_init);
+__gthrw(pthread_attr_setdetachstate);
+# ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(pthread_getschedparam);
+__gthrw(pthread_setschedparam);
+# endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+# endif /* _LIBOBJC || _LIBOBJC_WEAK */
+#else
+# if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+#pragma weak pthread_once
+#pragma weak pthread_key_create
+#pragma weak pthread_key_delete
+#pragma weak pthread_getspecific
+#pragma weak pthread_setspecific
+#pragma weak pthread_create
+
+#pragma weak pthread_mutex_lock
+#pragma weak pthread_mutex_trylock
+#pragma weak pthread_mutex_unlock
+#pragma weak pthread_mutexattr_init
+#pragma weak pthread_mutexattr_settype
+#pragma weak pthread_mutexattr_destroy
+
+#pragma weak pthread_mutex_init
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C. */
+#pragma weak pthread_cond_broadcast
+#pragma weak pthread_cond_destroy
+#pragma weak pthread_cond_init
+#pragma weak pthread_cond_signal
+#pragma weak pthread_cond_wait
+#pragma weak pthread_exit
+#pragma weak pthread_mutex_destroy
+#pragma weak pthread_self
+/* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but
+ we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#pragma weak sched_get_priority_max
+#pragma weak sched_get_priority_min
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#pragma weak sched_yield
+#pragma weak pthread_attr_destroy
+#pragma weak pthread_attr_init
+#pragma weak pthread_attr_setdetachstate
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#pragma weak pthread_getschedparam
+#pragma weak pthread_setschedparam
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+#endif /* __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK */
+
+#define __gthrw_pthread_once pthread_once
+#define __gthrw_pthread_key_create pthread_key_create
+#define __gthrw_pthread_key_delete pthread_key_delete
+#define __gthrw_pthread_getspecific pthread_getspecific
+#define __gthrw_pthread_setspecific pthread_setspecific
+#define __gthrw_pthread_create pthread_create
+
+#define __gthrw_pthread_mutex_lock pthread_mutex_lock
+#define __gthrw_pthread_mutex_trylock pthread_mutex_trylock
+#define __gthrw_pthread_mutex_unlock pthread_mutex_unlock
+#define __gthrw_pthread_mutexattr_init pthread_mutexattr_init
+#define __gthrw_pthread_mutexattr_settype pthread_mutexattr_settype
+#define __gthrw_pthread_mutexattr_destroy pthread_mutexattr_destroy
+
+#define __gthrw_pthread_mutex_init pthread_mutex_init
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C. */
+#define __gthrw_pthread_cond_broadcast pthread_cond_broadcast
+#define __gthrw_pthread_cond_destroy pthread_cond_destroy
+#define __gthrw_pthread_cond_init pthread_cond_init
+#define __gthrw_pthread_cond_signal pthread_cond_signal
+#define __gthrw_pthread_cond_wait pthread_cond_wait
+#define __gthrw_pthread_exit pthread_exit
+#define __gthrw_pthread_mutex_destroy pthread_mutex_destroy
+#define __gthrw_pthread_self pthread_self
+/* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but
+ we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#define __gthrw_sched_get_priority_max sched_get_priority_max
+#define __gthrw_sched_get_priority_min sched_get_priority_min
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#define __gthrw_sched_yield sched_yield
+#define __gthrw_pthread_attr_destroy pthread_attr_destroy
+#define __gthrw_pthread_attr_init pthread_attr_init
+#define __gthrw_pthread_attr_setdetachstate pthread_attr_setdetachstate
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#define __gthrw_pthread_getschedparam pthread_getschedparam
+#define __gthrw_pthread_setschedparam pthread_setschedparam
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+#endif
+
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+
+static inline int
+__gthread_active_p (void)
+{
+ static void *const __gthread_active_ptr = (void *) &__gthrw_pthread_create;
+ return __gthread_active_ptr != 0;
+}
+
+#else /* not __GXX_WEAK__ */
+
+static inline int
+__gthread_active_p (void)
+{
+ return 1;
+}
+
+#endif /* __GXX_WEAK__ */
+
+#ifdef _LIBOBJC
+
+/* This is the config.h file in libobjc/ */
+#include <config.h>
+
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+
+/* Key structure for maintaining thread specific storage */
+static pthread_key_t _objc_thread_storage;
+static pthread_attr_t _objc_thread_attribs;
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem. */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+ if (__gthread_active_p ())
+ {
+ /* Initialize the thread storage key */
+ if (__gthrw_pthread_key_create (&_objc_thread_storage, NULL) == 0)
+ {
+ /* The normal default detach state for threads is
+ * PTHREAD_CREATE_JOINABLE which causes threads to not die
+ * when you think they should. */
+ if (__gthrw_pthread_attr_init (&_objc_thread_attribs) == 0
+ && __gthrw_pthread_attr_setdetachstate (&_objc_thread_attribs,
+ PTHREAD_CREATE_DETACHED) == 0)
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+/* Close the threads subsystem. */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+ if (__gthread_active_p ()
+ && __gthrw_pthread_key_delete (_objc_thread_storage) == 0
+ && __gthrw_pthread_attr_destroy (&_objc_thread_attribs) == 0)
+ return 0;
+
+ return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution. */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (*func)(void *), void *arg)
+{
+ objc_thread_t thread_id;
+ pthread_t new_thread_handle;
+
+ if (!__gthread_active_p ())
+ return NULL;
+
+ if (!(__gthrw_pthread_create (&new_thread_handle, NULL, (void *) func, arg)))
+ thread_id = (objc_thread_t) new_thread_handle;
+ else
+ thread_id = NULL;
+
+ return thread_id;
+}
+
+/* Set the current thread's priority. */
+static inline int
+__gthread_objc_thread_set_priority (int priority)
+{
+ if (!__gthread_active_p ())
+ return -1;
+ else
+ {
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+ pthread_t thread_id = __gthrw_pthread_self ();
+ int policy;
+ struct sched_param params;
+ int priority_min, priority_max;
+
+ if (__gthrw_pthread_getschedparam (thread_id, &policy, ¶ms) == 0)
+ {
+ if ((priority_max = __gthrw_sched_get_priority_max (policy)) == -1)
+ return -1;
+
+ if ((priority_min = __gthrw_sched_get_priority_min (policy)) == -1)
+ return -1;
+
+ if (priority > priority_max)
+ priority = priority_max;
+ else if (priority < priority_min)
+ priority = priority_min;
+ params.sched_priority = priority;
+
+ /*
+ * The solaris 7 and several other man pages incorrectly state that
+ * this should be a pointer to policy but pthread.h is universally
+ * at odds with this.
+ */
+ if (__gthrw_pthread_setschedparam (thread_id, policy, ¶ms) == 0)
+ return 0;
+ }
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+ return -1;
+ }
+}
+
+/* Return the current thread's priority. */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+ if (__gthread_active_p ())
+ {
+ int policy;
+ struct sched_param params;
+
+ if (__gthrw_pthread_getschedparam (__gthrw_pthread_self (), &policy, ¶ms) == 0)
+ return params.sched_priority;
+ else
+ return -1;
+ }
+ else
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+ return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread. */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+ if (__gthread_active_p ())
+ __gthrw_sched_yield ();
+}
+
+/* Terminate the current thread. */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+ if (__gthread_active_p ())
+ /* exit the thread */
+ __gthrw_pthread_exit (&__objc_thread_exit_status);
+
+ /* Failed if we reached here */
+ return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread. */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+ if (__gthread_active_p ())
+ return (objc_thread_t) __gthrw_pthread_self ();
+ else
+ return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer. */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_setspecific (_objc_thread_storage, value);
+ else
+ {
+ thread_local_storage = value;
+ return 0;
+ }
+}
+
+/* Returns the thread's local storage pointer. */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_getspecific (_objc_thread_storage);
+ else
+ return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex. */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex)
+{
+ if (__gthread_active_p ())
+ {
+ mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
+
+ if (__gthrw_pthread_mutex_init ((pthread_mutex_t *) mutex->backend, NULL))
+ {
+ objc_free (mutex->backend);
+ mutex->backend = NULL;
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+/* Deallocate a mutex. */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
+{
+ if (__gthread_active_p ())
+ {
+ int count;
+
+ /*
+ * Posix Threads specifically require that the thread be unlocked
+ * for __gthrw_pthread_mutex_destroy to work.
+ */
+
+ do
+ {
+ count = __gthrw_pthread_mutex_unlock ((pthread_mutex_t *) mutex->backend);
+ if (count < 0)
+ return -1;
+ }
+ while (count);
+
+ if (__gthrw_pthread_mutex_destroy ((pthread_mutex_t *) mutex->backend))
+ return -1;
+
+ objc_free (mutex->backend);
+ mutex->backend = NULL;
+ }
+ return 0;
+}
+
+/* Grab a lock on a mutex. */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex)
+{
+ if (__gthread_active_p ()
+ && __gthrw_pthread_mutex_lock ((pthread_mutex_t *) mutex->backend) != 0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Try to grab a lock on a mutex. */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex)
+{
+ if (__gthread_active_p ()
+ && __gthrw_pthread_mutex_trylock ((pthread_mutex_t *) mutex->backend) != 0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex)
+{
+ if (__gthread_active_p ()
+ && __gthrw_pthread_mutex_unlock ((pthread_mutex_t *) mutex->backend) != 0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition. */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition)
+{
+ if (__gthread_active_p ())
+ {
+ condition->backend = objc_malloc (sizeof (pthread_cond_t));
+
+ if (__gthrw_pthread_cond_init ((pthread_cond_t *) condition->backend, NULL))
+ {
+ objc_free (condition->backend);
+ condition->backend = NULL;
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+/* Deallocate a condition. */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition)
+{
+ if (__gthread_active_p ())
+ {
+ if (__gthrw_pthread_cond_destroy ((pthread_cond_t *) condition->backend))
+ return -1;
+
+ objc_free (condition->backend);
+ condition->backend = NULL;
+ }
+ return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_cond_wait ((pthread_cond_t *) condition->backend,
+ (pthread_mutex_t *) mutex->backend);
+ else
+ return 0;
+}
+
+/* Wake up all threads waiting on this condition. */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition)
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_cond_broadcast ((pthread_cond_t *) condition->backend);
+ else
+ return 0;
+}
+
+/* Wake up one thread waiting on this condition. */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition)
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_cond_signal ((pthread_cond_t *) condition->backend);
+ else
+ return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_once (__gthread_once_t *once, void (*func) (void))
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_once (once, func);
+ else
+ return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
+{
+ return __gthrw_pthread_key_create (key, dtor);
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t key)
+{
+ return __gthrw_pthread_key_delete (key);
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t key)
+{
+ return __gthrw_pthread_getspecific (key);
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t key, const void *ptr)
+{
+ return __gthrw_pthread_setspecific (key, ptr);
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *mutex)
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_mutex_lock (mutex);
+ else
+ return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *mutex)
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_mutex_trylock (mutex);
+ else
+ return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *mutex)
+{
+ if (__gthread_active_p ())
+ return __gthrw_pthread_mutex_unlock (mutex);
+ else
+ return 0;
+}
+
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
+{
+ if (__gthread_active_p ())
+ {
+ pthread_mutexattr_t attr;
+ int r;
+
+ r = __gthrw_pthread_mutexattr_init (&attr);
+ if (!r)
+ r = __gthrw_pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+ if (!r)
+ r = __gthrw_pthread_mutex_init (mutex, &attr);
+ if (!r)
+ r = __gthrw_pthread_mutexattr_destroy (&attr);
+ return r;
+ }
+}
+#endif
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
+{
+ return __gthread_mutex_lock (mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
+{
+ return __gthread_mutex_trylock (mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
+{
+ return __gthread_mutex_unlock (mutex);
+}
+
+#endif /* _LIBOBJC */
+
+#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
Added: gccxml_bin/v09/win32/share/gccxml-0.9/GCC/4.3/gccxml_builtins.h
===================================================================
--- gccxml_bin/v09/win32/share/gccxml-0.9/GCC/4.3/gccxml_builtins.h (rev 0)
+++ gccxml_bin/v09/win32/share/gccxml-0.9/GCC/4.3/gccxml_builtins.h 2008-12-16 08:51:37 UTC (rev 1468)
@@ -0,0 +1,181 @@
+#define __builtin_apply(x,y,z) ((void*)0)
+#define __builtin_nan(x) (0.0)
+#define __builtin_nanf(x) (0.0f)
+#define __builtin_nanl(x) (0.0l)
+#define __builtin_huge_val(x) (0.0)
+#define __builtin_huge_valf(x) (0.0f)
+#define __builtin_huge_vall(x) (0.0l)
+#define __builtin_apply_args(x) ((void*)0)
+#define __builtin_types_compatible_p(x,y) 0
+#define __builtin_choose_expr(x,y,z) int
+#define __builtin_constant_p(x) 0
+void* __builtin_memchr(void const*, int, unsigned int);
+void __builtin_return (void *RESULT);
+void * __builtin_return_address (unsigned int LEVEL);
+void * __builtin_frame_address (unsigned int LEVEL);
+long __builtin_expect (long EXP, long C);
+void __builtin_prefetch (const void *ADDR, ...);
+double __builtin_inf (void);
+float __builtin_inff (void);
+long double __builtin_infl (void);
+double __builtin_nans (const char *str);
+float __builtin_nansf (const char *str);
+long double __builtin_nansl (const char *str);
+double __builtin_acos(double);
+float __builtin_acosf(float);
+long double __builtin_acosl(long double);
+double __builtin_asin(double);
+float __builtin_asinf(float);
+long double __builtin_asinl(long double);
+double __builtin_atan(double);
+double __builtin_atan2(double, double);
+float __builtin_atan2f(float, float);
+long double __builtin_atan2l(long double, long double);
+float __builtin_atanf(float);
+long double __builtin_atanl(long double);
+double __builtin_ceil(double);
+float __builtin_ceilf(float);
+long double __builtin_ceill(long double);
+double __builtin_cos(double);
+float __builtin_cosf(float);
+double __builtin_cosh(double);
+float __builtin_coshf(float);
+long double __builtin_coshl(long double);
+long double __builtin_cosl(long double);
+double __builtin_exp(double);
+float __builtin_expf(float);
+long double __builtin_expl(long double);
+double __builtin_fabs(double);
+float __builtin_fabsf(float);
+long double __builtin_fabsl(long double);
+double __builtin_floor(double);
+float __builtin_floorf(float);
+long double __builtin_floorl(long double);
+float __builtin_fmodf(float, float);
+long double __builtin_fmodl(long double, long double);
+double __builtin_frexp(double, int*);
+float __builtin_frexpf(float, int*);
+long double __builtin_frexpl(long double, int*);
+double __builtin_ldexp(double, int);
+float __builtin_ldexpf(float, int);
+long double __builtin_ldexpl(long double, int);
+double __builtin_log(double);
+double __builtin_log10(double);
+float __builtin_log10f(float);
+long double __builtin_log10l(long double);
+float __builtin_logf(float);
+long double __builtin_logl(long double);
+float __builtin_modff(float, float*);
+long double __builtin_modfl(long double, long double*);
+float __builtin_powf(float, float);
+long double __builtin_powl(long double, long double);
+double __builtin_powi(double, int);
+float __builtin_powif(float, int);
+long double __builtin_powil(long double, int);
+double __builtin_sin(double);
+float __builtin_sinf(float);
+double __builtin_sinh(double);
+float __builtin_sinhf(float);
+long double __builtin_sinhl(long double);
+long double __builtin_sinl(long double);
+double __builtin_sqrt(double);
+float __builtin_sqrtf(float);
+long double __builtin_sqrtl(long double);
+double __builtin_tan(double);
+float __builtin_tanf(float);
+double __builtin_tanh(double);
+float __builtin_tanhf(float);
+long double __builtin_tanhl(long double);
+long double __builtin_tanl(long double);
+float __builtin_cabsf(float __complex__);
+double __builtin_cabs(double __complex__);
+long double __builtin_cabsl(long double __complex__);
+float __builtin_cargf(float __complex__);
+double __builtin_carg(double __complex__);
+long double __builtin_cargl(long double __complex__);
+int __builtin_ctz(int);
+int __builtin_ctzl(long);
+int __builtin_ctzll(long long);
+int __builtin_popcount(int);
+int __builtin_popcountl(long);
+int __builtin_popcountll(long long);
+float __complex__ __builtin_ccosf(float __complex__);
+double __complex__ __builtin_ccos(double __complex__);
+long double __complex__ __builtin_ccosl(long double __complex__);
+float __complex__ __builtin_ccoshf(float __complex__);
+double __complex__ __builtin_ccosh(double __complex__);
+long double __complex__ __builtin_ccoshl(long double __complex__);
+float __complex__ __builtin_cexpf(float __complex__);
+double __complex__ __builtin_cexp(double __complex__);
+long double __complex__ __builtin_cexpl(long double __complex__);
+float __complex__ __builtin_clogf(float __complex__);
+double __complex__ __builtin_clog(double __complex__);
+long double __complex__ __builtin_clogl(long double __complex__);
+float __complex__ __builtin_csinf(float __complex__);
+double __complex__ __builtin_csin(double __complex__);
+long double __complex__ __builtin_csinl(long double __complex__);
+float __complex__ __builtin_csinhf(float __complex__);
+double __complex__ __builtin_csinh(double __complex__);
+long double __complex__ __builtin_csinhl(long double __complex__);
+float __complex__ __builtin_csqrtf(float __complex__);
+double __complex__ __builtin_csqrt(double __complex__);
+long double __complex__ __builtin_csqrtl(long double __complex__);
+float __complex__ __builtin_ctanf(float __complex__);
+double __complex__ __builtin_ctan(double __complex__);
+long double __complex__ __builtin_ctanl(long double __complex__);
+float __complex__ __builtin_ctanhf(float __complex__);
+double __complex__ __builtin_ctanh(double __complex__);
+long double __complex__ __builtin_ctanhl(long double __complex__);
+float __complex__ __builtin_cpowf(float __complex__, float __complex__);
+double __complex__ __builtin_cpow(double __complex__, double __complex__);
+long double __complex__ __builtin_cpowl(long double __complex__, long double __complex__);
+
+/* The GCC 4.3 parser hard-codes handling of these, so they do not
+ have real signatures. */
+bool __builtin_isfinite(...);
+bool __builtin_isinf(...);
+bool __builtin_isnan(...);
+bool __builtin_isnormal(...);
+bool __builtin_isgreater(...);
+bool __builtin_isgreaterequal(...);
+bool __builtin_isless(...);
+bool __builtin_islessequal(...);
+bool __builtin_islessgreater(...);
+bool __builtin_isunordered(...);
+
+/*
+
+GCC 4.3 has the following additional builtin compile-time constant
+expressions:
+
+ __builtin_va_arg ( assignment-expression , type-id )
+ __builtin_offsetof ( type-id , offsetof-expression )
+
+ __has_nothrow_assign(T)
+ __has_nothrow_constructor(T)
+ __has_nothrow_copy(T)
+ __has_trivial_assign(T)
+ __has_trivial_constructor(T)
+ __has_trivial_copy(T)
+ __has_trivial_destructor(T)
+ __has_virtual_destructor(T)
+ __is_abstract(T)
+ __is_base_of(Tbase,Tderived)
+ __is_class(T)
+ __is_convertible_to(Tfrom,Tto)
+ __is_empty(T)
+ __is_enum(T)
+ __is_pod(T)
+ __is_polymorphic(T)
+ __is_union(T)
+
+In order to really support these we would have to update GCC-XML's
+internal parser to be GCC 4.3. Since this has not yet been done we
+get most of the way by defining some of these as macros with fake
+answers. It is enough to get through GCC 4.3's C++98 standard
+library.
+*/
+
+#define __is_pod(x) false
+#define __is_empty(x) false
+#define __has_trivial_destructor(x) false
Modified: gccxml_bin/v09/win32/share/gccxml-0.9/GCC/find_flags
===================================================================
--- gccxml_bin/v09/win32/share/gccxml-0.9/GCC/find_flags 2008-12-15 20:53:49 UTC (rev 1467)
+++ gccxml_bin/v09/win32/share/gccxml-0.9/GCC/find_flags 2008-12-16 08:51:37 UTC (rev 1468)
@@ -4,8 +4,8 @@
# Program: GCC-XML
# Module: $RCSfile: find_flags,v $
# Language: C++
-# Date: $Date: 2007/11/02 19:03:40 $
-# Version: $Revision: 1.20 $
+# Date: $Date: 2008-08-07 15:36:08 $
+# Version: $Revision: 1.23 $
#
# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
# See Copyright.txt for details.
@@ -41,9 +41,16 @@
INCLUDES=`
echo "" | ${CXX} -v -x c++ -E ${CXXFLAGS} - 2>&1 |
awk '/^[^ \/].*$/ { if (f) { printf("\n"); exit } }
- /^[ ]*\/[^ ]*$/ { if (f) { printf("-I%s ",$0) } }
- /\#include <\.\.\..*$/ {f=1} ' - |
- sed 's/^-I /-I/;s/ -I / -I/g'
+ /^[ ]*(\/[^ ]*)( \(.*\))?$/ {
+ if (f) {
+ if (match($1,"/Frameworks")) {
+ printf("-F%s ",$1)
+ } else {
+ printf("-isystem%s ",$1)
+ }
+ }
+ }
+ /\#include <\.\.\..*$/ {f=1} ' -
`
# The support headers are located where this script is.
@@ -74,6 +81,9 @@
if [ "$MINOR_VERSION" = 96 ]; then
INCLUDES="-iwrapper\"$SELFPATH/2.96\" $INCLUDES"
fi
+elif [ "$MAJOR_VERSION" = 4 -a "$MINOR_VERSION" -ge 3 ]; then
+ INCLUDES="-iwrapper\"$SELFPATH/4.3\" $INCLUDES"
+ SPECIAL="-include \"gccxml_builtins.h\""
elif [ "$MAJOR_VERSION" = 4 -a "$MINOR_VERSION" -ge 2 ]; then
INCLUDES="-iwrapper\"$SELFPATH/4.2\" $INCLUDES"
SPECIAL="-include \"gccxml_builtins.h\""
Added: gccxml_bin/v09/win32/share/gccxml-0.9/Sun/5.8/adaptation.patch
===================================================================
--- gccxml_bin/v09/win32/share/gccxml-0.9/Sun/5.8/adaptation.patch (rev 0)
+++ gccxml_bin/v09/win32/share/gccxml-0.9/Sun/5.8/adaptation.patch 2008-12-16 08:51:37 UTC (rev 1468)
@@ -0,0 +1,168 @@
+Common subdirectories: ./iso and ../result/iso
+diff -r -u ./istream ../result/istream
+--- ./istream Fri Nov 16 16:40:47 2007
++++ ../result/istream Fri Nov 16 15:22:16 2007
+@@ -419,9 +419,11 @@
+ const istream_iterator<T,charT,traits,Distance>& x,
+ const istream_iterator<T,charT,traits,Distance>& y);
+ #else
+- friend inline bool operator== <> (
++/* SMOSS 29/08/07 inline not allowed in friend declaration */
++ friend /*inline*/ bool operator== <> (
+ const istream_iterator<T,charT,traits,Distance>& x,
+ const istream_iterator<T,charT,traits,Distance>& y);
++/* END SMOSS 29/08/07 inline not allowed in friend declaration */
+ #endif
+ public:
+ typedef charT char_type;
+diff -r -u ./math.h ../result/math.h
+--- ./math.h Fri Nov 16 17:25:29 2007
++++ ../result/math.h Fri Nov 16 15:22:16 2007
+@@ -313,6 +313,11 @@
+ #endif
+ /* END adopted by C99 */
+
++/* SMOSS 29/08/07 <floatingpoint.h> conflicts with stdlib_iso.h */
++#ifdef __EXTENSIONS__
++# undef __EXTENSIONS__
++#endif //__EXTENSIONS__
++/* END SMOSS 29/08/07 <floatingpoint.h> conflicts with stdlib_iso.h */
+ #if defined(__EXTENSIONS__) || !defined(__cplusplus)
+ #include <floatingpoint.h>
+ #endif
+@@ -319,6 +324,11 @@
+ #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */
+ #endif /* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) || ... */
+
++/* SMOSS 29/08/07 <floatingpoint.h> conflicts with stdlib_iso.h */
++#ifdef __EXTENSIONS__
++# define __EXTENSIONS__
++#endif //__EXTENSIONS__
++/* END SMOSS 29/08/07 <floatingpoint.h> conflicts with stdlib_iso.h */
+ #if defined(__cplusplus) && defined(__GNUC__)
+ #undef exception
+ #endif
+Common subdirectories: ./rw and ../result/rw
+diff -r -u ./streambuf ../result/streambuf
+--- ./streambuf Fri Nov 16 16:40:47 2007
++++ ../result/streambuf Fri Nov 16 15:22:16 2007
+@@ -927,7 +927,10 @@
+ * int_type snextc()
+ * returns the next character
+ */
+-
++/* SMOSS 29/08/07 Can't use typename in template specializations */
++#ifdef _TYPENAME
++# define _TYPENAME
++#endif
+ inline _TYPENAME basic_streambuf<char, char_traits<char> >::int_type
+ basic_streambuf<char, char_traits<char> >::snextc()
+ {
+@@ -1208,6 +1211,11 @@
+ {
+ return seekpos(sp, which);
+ }
++#ifdef _TYPENAME
++# define _TYPENAME typename
++# undef _OLD_TYPENAME
++#endif
++/* END SMOSS 29/08/07 Can't use typename in template specializations */
+
+ /*
+ * basic_streambuf *pubsetbuf(char_type *, streamsize)
+diff -r -u ./string ../result/string
+--- ./string Fri Nov 16 16:40:47 2007
++++ ../result/string Fri Nov 16 15:22:16 2007
+@@ -797,7 +797,9 @@
+ // Null string ref
+ //
+ #ifndef _RWSTD_NO_STATIC_DEF3
+- static __SUNW_GLOBAL const __null_ref_type __nullref;
++/* SMOSS 29/08/07 Can't resolve #define __SUNW_GLOBAL __global */
++ static /* __SUNW_GLOBAL */ const __null_ref_type __nullref;
++/* SMOSS 29/08/07 Can't resolve #define __SUNW_GLOBAL __global */
+ #endif
+
+ static __string_ref_type * __getNullRep ()
+Common subdirectories: ./sys and ../result/sys
+diff -r -u ./typeinfo ../result/typeinfo
+--- ./typeinfo Fri Nov 16 16:40:47 2007
++++ ../result/typeinfo Fri Nov 16 15:22:16 2007
+@@ -34,7 +34,8 @@
+ // Implementation
+ const void* __data;
+ type_info(const void*) throw();
+- friend __Cimpl::__type_info_friend;
++ /* SMOSS 29/08/07 Can't resolve */
++ //friend __Cimpl::__type_info_friend;
+ };
+
+ class bad_typeid: public exception {
+diff -r -u ./iso/stdlib_iso.h ../result/iso/stdlib_iso.h
+--- ./iso/stdlib_iso.h Fri Nov 16 16:40:47 2007
++++ ../result/iso/stdlib_iso.h Fri Nov 16 15:22:16 2007
+@@ -110,8 +110,10 @@
+ extern double atof(const char *);
+ extern int atoi(const char *);
+ extern long int atol(const char *);
++/* SMOSS 29/08/07
+ extern void *bsearch(const void *, const void *, size_t, size_t,
+ int (*)(const void *, const void *));
++*/
+ #if __cplusplus >= 199711L
+ extern "C++" {
+ void *bsearch(const void *, const void *, size_t, size_t,
+@@ -131,7 +133,6 @@
+ extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
+ size_t);
+ extern int mbtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
+-extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
+ #if __cplusplus >= 199711L
+ extern "C++" {
+ void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
+diff -r -u ./rw/iterator ../result/rw/iterator
+--- ./rw/iterator Fri Nov 16 17:03:59 2007
++++ ../result/rw/iterator Fri Nov 16 15:22:16 2007
+@@ -426,10 +426,12 @@
+ friend inline difference_type (std::operator-) (const self& x, const self& y);
+ friend inline self (std::operator+) (difference_type n, const self& x);
+ #else
+- friend inline bool operator== <> (const self& x, const self& y);
+- friend inline bool operator< <> (const self& x, const self& y);
+- friend inline difference_type operator- <> (const self& x, const self& y);
+- friend inline self operator+ <> (difference_type n, const self& x);
++/* SMOSS 29/08/07 removing 'inline' from friend declarations */
++ friend /*inline*/ bool operator== <> (const self& x, const self& y);
++ friend /*inline*/ bool operator< <> (const self& x, const self& y);
++ friend /*inline*/ difference_type operator- <> (const self& x, const self& y);
++ friend /*inline*/ self operator+ <> (difference_type n, const self& x);
++/* END SMOSS 29/08/07 removing 'inline' from friend declarations */
+ #endif
+ protected:
+
+@@ -581,7 +583,9 @@
+ typedef Reference reference;
+ typedef Pointer pointer;
+
+- friend inline bool operator== <> (const self& x, const self& y);
++/* SMOSS 29/08/07 removing 'inline' from friend declarations */
++ friend /*inline*/ bool operator== <> (const self& x, const self& y);
++/* END SMOSS 29/08/07 removing 'inline' from friend declarations */
+
+ protected:
+
+diff -r -u ./sys/regset.h ../result/sys/regset.h
+--- ./sys/regset.h Fri Nov 16 16:40:47 2007
++++ ../result/sys/regset.h Fri Nov 16 15:22:16 2007
+@@ -16,7 +16,10 @@
+ #pragma ident "@(#)regset.h 1.28 04/09/28 SMI" /* SVr4.0 1.1 */
+
+ #include <sys/feature_tests.h>
+-
++/* SMOSS 29/08/07 */
++//#include <inttypes.h>
++typedef long long unsigned int uint64_t;
++/* end SMOSS 29/08/08 */
+ #if !defined(_ASM)
+ #include <sys/int_types.h>
+ #endif
Added: gccxml_bin/v09/win32/share/gccxml-0.9/Sun/README
===================================================================
--- gccxml_bin/v09/win32/share/gccxml-0.9/Sun/README (rev 0)
+++ gccxml_bin/v09/win32/share/gccxml-0.9/Sun/README 2008-12-16 08:51:37 UTC (rev 1468)
@@ -0,0 +1,8 @@
+Sun CC support contributed by Pierre-Olivier Gaillard
+
+This is a small README file regarding gccxml support for Solaris and Sun CC 5.8.
+
+The Sun CC headers are not suitable for GCC and need to be adapted. The adapted files may not be redistributed freely. This forces you to perform the following operations:
+ ./adapt_headers.sh
+
+This will produce corrected header files in the 5.8 directory.
Added: gccxml_bin/v09/win32/share/gccxml-0.9/Sun/adapt_headers.sh
===================================================================
--- gccxml_bin/v09/win32/share/gccxml-0.9/Sun/adapt_headers.sh (rev 0)
+++ gccxml_bin/v09/win32/share/gccxml-0.9/Sun/adapt_headers.sh 2008-12-16 08:51:37 UTC (rev 1468)
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+INCLUDES=/usr/include
+CC_INCLUDES=`find_flags | perl -ne '($a) = m|-I([/a-zA-Z0-9_-]+/include/CC)|o ; print "$a\n" if $a'`
+
+cd 5.8
+
+cp $INCLUDES/math.h .
+cp $CC_INCLUDES/typeinfo .
+cp $CC_INCLUDES/Cstd/istream .
+cp $CC_INCLUDES/Cstd/streambuf .
+cp $CC_INCLUDES/Cstd/string .
+
+mkdir -p rw
+mkdir -p sys
+mkdir -p iso
+
+cp $CC_INCLUDES/Cstd/rw/iterator rw/iterator
+cp $INCLUDES/iso/stdio_iso.h iso
+cp $INCLUDES/iso/stdlib_iso.h iso
+
+cp $INCLUDES/sys/regset.h sys
+
+patch -p1 < adaptation.patch
Added: gccxml_bin/v09/win32/share/gccxml-0.9/Sun/find_flags
===================================================================
--- gccxml_bin/v09/win32/share/gccxml-0.9/Sun/find_flags (rev 0)
+++ gccxml_bin/v09/win32/share/gccxml-0.9/Sun/find_flags 2008-12-16 08:51:37 UTC (rev 1468)
@@ -0,0 +1,69 @@
+#!/bin/sh
+#=============================================================================
+#
+# Program: GCC-XML
+# Module: $RCSfile: find_flags,v $
+# Language: C++
+# Date: $Date: 2007-11-28 19:52:06 $
+# Version: $Revision: 1.1 $
+#
+# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+# See Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even
+# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the above copyright notices for more information.
+#
+#=============================================================================
+# Find the CC executable name.
+if test "x$1" = "x" ; then
+ if test "x${CXX}" = "x" ; then
+ CXX=CC
+ fi
+else
+ CXX="$1"
+ shift
+ CXXFLAGS="$@"
+fi
+
+GCCXML_PID="$$"
+cat > "/tmp/gccxml_identify_compiler_args$GCCXML_PID.cc" <<!
+#include <>
+!
+
+# Find the macro definition options.
+MACROS=`${CXX} /tmp/gccxml_identify_compiler_args$GCCXML_PID.cc -E -xdumpmacros=defs 2>&1 |
+ awk '{ if ($1 ~ /#define/) printf("-D%s=%s %s %s ",$2,$3,$4,$5) }'
+ `
+MACROS="-D__cplusplus=199711L -D__STDC__ -D_REENTRANT $MACROS"
+
+# Find the include path options.
+#todo test for truss
+INCLUDES=`truss -f -t openat ${CXX} -E /tmp/gccxml_identify_compiler_args$GCCXML_PID.cc 2>&1 |
+ awk '{if ($3 ~ /\"[A-Za-z0-9_\/.-]+\",/ && $3 !~ /tmp/)
+ if (tempString!=substr($3,2,length($3)-3))
+ {
+ tempString=substr($3,2,length($3)-3);
+ printf("-I%s ",tempString)
+ }
+ }'`
+
+#cleanup
+rm -rf "/tmp/gccxml_identify_compiler_args$GCCXML_PID.cc"
+
+# The support headers are located where this script is.
+SELFPATH=`echo $0 | sed -n '/\//{s/\/find_flags//;p;}'`
+if test "x$SELFPATH" = "x" ; then SELFPATH="." ; fi
+SELFPATH=`cd "$SELFPATH" ; pwd`
+
+# Find CC version
+CC_VERSION=`${CXX} -V 2>&1 | awk '{print $4}'`
+
+# Use hacked headers for CC 5.8
+if [ $CC_VERSION = 5.8 ]; then
+ INCLUDES="-iwrapper\"$SELFPATH/5.8\" $INCLUDES"
+fi
+
+# Format and print out the options.
+OPTIONS="$MACROS $INCLUDES $SPECIAL"
+echo $OPTIONS
Added: gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/algorithm
===================================================================
--- gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/algorithm (rev 0)
+++ gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/algorithm 2008-12-16 08:51:37 UTC (rev 1468)
@@ -0,0 +1,5711 @@
+// algorithm standard header
+#pragma once
+#ifndef _ALGORITHM_
+#define _ALGORITHM_
+#ifndef RC_INVOKED
+#include <memory>
+
+#ifdef _MSC_VER
+#pragma pack(push,_CRT_PACKING)
+#pragma warning(push,3)
+ #pragma warning(disable: 4244)
+#endif /* _MSC_VER */
+
+/* ------------------------------------------------------------------------ */
+/* Forward declare these now because they are used as non-dependent names. */
+_STDEXT_BEGIN
+template<class _InIt, class _OutIt, class _Ty>
+inline _OutIt unchecked_remove_copy(_InIt _First, _InIt _Last,
+ _OutIt _Dest, const _Ty& _Val);
+template<class _InIt, class _OutIt, class _Pr>
+inline _OutIt unchecked_remove_copy_if(_InIt _First, _InIt _Last,
+ _OutIt _Dest, _Pr _Pred);
+template<class _InIt1, class _InIt2, class _OutIt>
+inline _OutIt unchecked_merge(_InIt1 _First1, _InIt1 _Last1,
+ _InIt2 _First2, _InIt2 _Last2, _OutIt _Dest);
+template<class _InIt1, class _InIt2, class _OutIt, class _Pr>
+inline _OutIt unchecked_merge(_InIt1 _First1, _InIt1 _Last1,
+ _InIt2 _First2, _InIt2 _Last2, _OutIt _Dest,
+ _Pr _Pred);
+template<class _BidIt1, class _BidIt2, class _BidIt3>
+inline _BidIt3 _Unchecked_merge_backward(_BidIt1 _First1, _BidIt1 _Last1,
+ _BidIt2 _First2, _BidIt2 _Last2,
+ _BidIt3 _Dest);
+template<class _BidIt1, class _BidIt2, class _BidIt3, class _Pr>
+inline _BidIt3 _Unchecked_merge_backward(_BidIt1 _First1, _BidIt1 _Last1,
+ _BidIt2 _First2, _BidIt2 _Last2,
+ _BidIt3 _Dest, _Pr _Pred);
+template<class _BidIt, class _OutIt, class _Diff>
+inline void _Unchecked_chunked_merge(_BidIt _First, _BidIt _Last,
+ _OutIt _Dest, _Diff _Chunk,
+ _Diff _Count);
+template<class _BidIt, class _OutIt, class _Diff, class _Pr>
+inline void _Unchecked_chunked_merge(_BidIt _First, _BidIt _Last,
+ _OutIt _Dest, _Diff _Chunk,
+ _Diff _Count, _Pr _Pred);
+_STDEXT_END
+/* ------------------------------------------------------------------------ */
+
+_STD_BEGIN
+
+ // COMMON SORT PARAMETERS
+const int _ISORT_MAX = 32; // maximum size for insertion sort
+
+ // TEMPLATE FUNCTION for_each
+template<class _InIt,
+ class _Fn1> inline
+ _Fn1 for_each(_InIt _First, _InIt _Last, _Fn1 _Func)
+ { // perform function for each element
+ _DEBUG_RANGE(_First, _Last);
+ _DEBUG_POINTER(_Func);
+ _CHECKED_BASE_TYPE(_InIt) _ChkFirst(_CHECKED_BASE(_First));
+ _CHECKED_BASE_TYPE(_InIt) _ChkLast(_CHECKED_BASE(_Last));
+ for (; _ChkFirst != _ChkLast; ++_ChkFirst)
+ _Func(*_ChkFirst);
+ return (_Func);
+ }
+
+ // TEMPLATE FUNCTION find
+template<class _InIt, class _Ty>
+inline
+ _InIt _Find(_InIt _First, _InIt _Last, const _Ty& _Val)
+ { // find first matching _Val
+ _DEBUG_RANGE(_First, _Last);
+ for (; _First != _Last; ++_First)
+ if (*_First == _Val)
+ break;
+ return (_First);
+ }
+
+inline const char *_Find(const char *_First, const char *_Last, int _Val)
+ { // find first char that matches _Val
+ _DEBUG_RANGE(_First, _Last);
+ _First = (const char *)::memchr(_First, _Val, _Last - _First);
+ return (_First == 0 ? _Last : _First);
+ }
+
+inline const signed char *_Find(const signed char *_First,
+ const signed char *_Last, int _Val)
+ { // find first signed char that matches _Val
+ _DEBUG_RANGE(_First, _Last);
+ _First = (const signed char *)::memchr(_First, _Val,
+ _Last - _First);
+ return (_First == 0 ? _Last : _First);
+ }
+
+inline const unsigned char *_Find(const unsigned char *_First,
+ const unsigned char *_Last, int _Val)
+ { // find first unsigned char that matches _Val
+ _DEBUG_RANGE(_First, _Last);
+ _First = (const unsigned char *)::memchr(_First, _Val,
+ _Last - _First);
+ return (_First == 0 ? _Last : _First);
+ }
+
+template<class _InIt, class _Ty>
+inline
+ _InIt find(_InIt _First, _InIt _Last, const _Ty& _Val)
+ { // find first matching _Val
+ _ASSIGN_FROM_BASE(_First,
+ _Find(_CHECKED_BASE(_First), _CHECKED_BASE(_Last), _Val));
+ return (_First);
+ }
+
+ // TEMPLATE FUNCTION find_if
+template<class _InIt,
+ class _Pr> inline
+ _InIt _Find_if(_InIt _First, _InIt _Last, _Pr _Pred)
+ { // find first satisfying _Pred
+ _DEBUG_RANGE(_First, _Last);
+ _DEBUG_POINTER(_Pred);
+ for (; _First != _Last; ++_First)
+ if (_Pred(*_First))
+ break;
+ return (_First);
+ }
+
+template<class _InIt,
+ class _Pr> inline
+ _InIt find_if(_InIt _First, _InIt _Last, _Pr _Pred)
+ { // find first satisfying _Pred
+ _ASSIGN_FROM_BASE(_First,
+ _Find_if(_CHECKED_BASE(_First), _CHECKED_BASE(_Last), _Pred));
+ return (_First);
+ }
+
+ // TEMPLATE FUNCTION adjacent_find
+template<class _FwdIt> inline
+ _FwdIt _Adjacent_find(_FwdIt _First, _FwdIt _Last)
+ { // find first matching successor
+ _DEBUG_RANGE(_First, _Last);
+ for (_FwdIt _Firstb; (_Firstb = _First) != _Last && ++_First != _Last; )
+ if (*_Firstb == *_First)
+ return (_Firstb);
+ return (_Last);
+ }
+
+template<class _FwdIt> inline
+ _FwdIt adjacent_find(_FwdIt _First, _FwdIt _Last)
+ { // find first matching successor
+ _ASSIGN_FROM_BASE(_First,
+ _Adjacent_find(_CHECKED_BASE(_First), _CHECKED_BASE(_Last)));
+ return (_First);
+ }
+
+ // TEMPLATE FUNCTION adjacent_find WITH PRED
+template<class _FwdIt,
+ class _Pr> inline
+ _FwdIt _Adjacent_find(_FwdIt _First, _FwdIt _Last, _Pr _Pred)
+ { // find first satisfying _Pred with successor
+ _DEBUG_RANGE(_First, _Last);
+ _DEBUG_POINTER(_Pred);
+ for (_FwdIt _Firstb; (_Firstb = _First) != _Last && ++_First != _Last; )
+ if (_Pred(*_Firstb, *_First))
+ return (_Firstb);
+ return (_Last);
+ }
+
+template<class _FwdIt,
+ class _Pr> inline
+ _FwdIt adjacent_find(_FwdIt _First, _FwdIt _Last, _Pr _Pred)
+ { // find first satisfying _Pred with successor
+ _ASSIGN_FROM_BASE(_First,
+ _Adjacent_find(_CHECKED_BASE(_First), _CHECKED_BASE(_Last), _Pred));
+ return (_First);
+ }
+
+ // TEMPLATE FUNCTION count
+template<class _InIt,
+ class _Ty> inline
+ typename iterator_traits<_InIt>::difference_type
+ _Count(_InIt _First, _InIt _Last, const _Ty& _Val)
+ { // count elements that match _Val
+ _DEBUG_RANGE(_First, _Last);
+ typename iterator_traits<_InIt>::difference_type _Cnt = 0;
+
+ for (; _First != _Last; ++_First)
+ if (*_First == _Val)
+ ++_Cnt;
+ return (_Cnt);
+ }
+
+template<class _InIt,
+ class _Ty> inline
+ typename iterator_traits<_InIt>::difference_type
+ count(_InIt _First, _InIt _Last, const _Ty& _Val)
+ { // count elements that match _Val
+ return _Count(_CHECKED_BASE(_First), _CHECKED_BASE(_Last), _Val);
+ }
+
+ // TEMPLATE FUNCTION count_if
+template<class _InIt,
+ class _Pr> inline
+ typename iterator_traits<_InIt>::difference_type
+ _Count_if(_InIt _First, _InIt _Last, _Pr _Pred)
+ { // count elements satisfying _Pred
+ _DEBUG_RANGE(_First, _Last);
+ _DEBUG_POINTER(_Pred);
+ typename iterator_traits<_InIt>::difference_type _Count = 0;
+
+ for (; _First != _Last; ++_First)
+ if (_Pred(*_First))
+ ++_Count;
+ return (_Count);
+ }
+
+template<class _InIt,
+ class _Pr> inline
+ typename iterator_traits<_InIt>::difference_type
+ count_if(_InIt _First, _InIt _Last, _Pr _Pred)
+ { // count elements satisfying _Pred
+ return _Count_if(_CHECKED_BASE(_First), _CHECKED_BASE(_Last), _Pred);
+ }
+
+ // TEMPLATE FUNCTION search
+template<class _FwdIt1,
+ class _FwdIt2,
+ class _Diff1,
+ class _Diff2> inline
+ _FwdIt1 _Search(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _FwdIt2 _First2, _FwdIt2 _Last2, _Diff1 *, _Diff2 *)
+ { // find first [_First2, _Last2) match
+ _DEBUG_RANGE(_First1, _Last1);
+ _DEBUG_RANGE(_First2, _Last2);
+ _Diff1 _Count1 = 0;
+ _Distance(_First1, _Last1, _Count1);
+ _Diff2 _Count2 = 0;
+ _Distance(_First2, _Last2, _Count2);
+
+ for (; _Count2 <= _Count1; ++_First1, --_Count1)
+ { // room for match, try it
+ _FwdIt1 _Mid1 = _First1;
+ for (_FwdIt2 _Mid2 = _First2; ; ++_Mid1, ++_Mid2)
+ if (_Mid2 == _Last2)
+ return (_First1);
+ else if (!(*_Mid1 == *_Mid2))
+ break;
+ }
+ return (_Last1);
+ }
+
+template<class _FwdIt1,
+ class _FwdIt2> inline
+ _FwdIt1 search(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _FwdIt2 _First2, _FwdIt2 _Last2)
+ { // find first [_First2, _Last2) match
+ _ASSIGN_FROM_BASE(_First1,
+ _Search(_CHECKED_BASE(_First1), _CHECKED_BASE(_Last1),
+ _CHECKED_BASE(_First2), _CHECKED_BASE(_Last2),
+ _Dist_type(_First1), _Dist_type(_First2)));
+ return _First1;
+ }
+
+ // TEMPLATE FUNCTION search WITH PRED
+template<class _FwdIt1,
+ class _FwdIt2,
+ class _Diff1,
+ class _Diff2,
+ class _Pr> inline
+ _FwdIt1 _Search(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred, _Diff1 *, _Diff2 *)
+ { // find first [_First2, _Last2) satisfying _Pred
+ _DEBUG_RANGE(_First1, _Last1);
+ _DEBUG_RANGE(_First2, _Last2);
+ _DEBUG_POINTER(_Pred);
+ _Diff1 _Count1 = 0;
+ _Distance(_First1, _Last1, _Count1);
+ _Diff2 _Count2 = 0;
+ _Distance(_First2, _Last2, _Count2);
+
+ for (; _Count2 <= _Count1; ++_First1, --_Count1)
+ { // room for match, try it
+ _FwdIt1 _Mid1 = _First1;
+ for (_FwdIt2 _Mid2 = _First2; ; ++_Mid1, ++_Mid2)
+ if (_Mid2 == _Last2)
+ return (_First1);
+ else if (!_Pred(*_Mid1, *_Mid2))
+ break;
+ }
+ return (_Last1);
+ }
+
+template<class _FwdIt1,
+ class _FwdIt2,
+ class _Pr> inline
+ _FwdIt1 search(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred)
+ { // find first [_First2, _Last2) satisfying _Pred
+ _ASSIGN_FROM_BASE(_First1,
+ _Search(_CHECKED_BASE(_First1), _CHECKED_BASE(_Last1),
+ _CHECKED_BASE(_First2), _CHECKED_BASE(_Last2), _Pred,
+ _Dist_type(_First1), _Dist_type(_First2)));
+ return _First1;
+ }
+
+ // TEMPLATE FUNCTION search_n
+template<class _FwdIt1,
+ class _Diff2,
+ class _Ty> inline
+ _FwdIt1 _Search_n(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _Diff2 _Count, const _Ty& _Val, forward_iterator_tag)
+ { // find first _Count * _Val match, forward iterators
+ _DEBUG_RANGE(_First1, _Last1);
+ _FwdIt1 _Mid1;
+
+ if (_Count == 0)
+ return (_First1);
+
+ for (;; _First1 = ++_Mid1)
+ { // look for a long enough sequence
+ _Diff2 _Count1 = _Count;
+
+ for (; _First1 != _Last1; ++_First1)
+ if (*_First1 == _Val)
+ break; // found first match
+
+ for (_Mid1 = _First1;; )
+ if (--_Count1 == 0)
+ return (_First1); // found last match
+ else if (_Mid1 == _Last1 || !(*++_Mid1 == _Val))
+ break;
+ if (_Mid1 == _Last1)
+ return (_Last1);
+ }
+ }
+
+template<class _FwdIt1,
+ class _Diff2,
+ class _Ty> inline
+ _FwdIt1 _Search_n(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _Diff2 _Count, const _Ty& _Val, random_access_iterator_tag)
+ { // find first _Count * _Val match, random-access iterators
+ _DEBUG_RANGE(_First1, _Last1);
+ _FwdIt1 _Mid1;
+
+ if (_Count == 0)
+ return (_First1);
+
+ for (;; _First1 = ++_Mid1)
+ { // look for a long enough sequence
+ _FwdIt1 _Oldfirst1 = _First1;
+ _Diff2 _Count1 = _Count;
+
+ for (;; _First1 += _Count)
+ if (_First1 == _Last1)
+ return (_Last1); // end of sequence
+ else if (*_First1 == _Val)
+ break; // found a match
+ else if (_Last1 - _First1 < _Count)
+ return (_Last1); // not enough left for a match
+
+ _Mid1 = _First1;
+ if (_Oldfirst1 != _First1)
+ for (++_Oldfirst1; _Oldfirst1 != _First1; --_First1, --_Count1)
+ if (!(_First1[-1] == _Val))
+ break; // found beginning of sequence
+
+ for (;;)
+ if (--_Count1 == 0)
+ return (_First1); // found last match
+ else if (_Mid1 == _Last1 || !(*++_Mid1 == _Val))
+ break;
+ if (_Mid1 == _Last1)
+ return (_Last1);
+ }
+ }
+
+template<class _FwdIt1,
+ class _Diff2,
+ class _Ty> inline
+ _FwdIt1 search_n(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _Diff2 _Count, const _Ty& _Val)
+ { // find first _Count * _Val match
+ _ASSIGN_FROM_BASE(_First1,
+ _Search_n(_CHECKED_BASE(_First1), _CHECKED_BASE(_Last1), _Count, _Val,
+ _Iter_cat(_First1)));
+ return _First1;
+ }
+
+ // TEMPLATE FUNCTION search_n WITH PRED
+template<class _FwdIt1,
+ class _Diff2,
+ class _Ty,
+ class _Pr> inline
+ _FwdIt1 _Search_n(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _Diff2 _Count, const _Ty& _Val, _Pr _Pred, forward_iterator_tag)
+ { // find first _Count * _Val satisfying _Pred, forward iterators
+ _DEBUG_RANGE(_First1, _Last1);
+ _DEBUG_POINTER(_Pred);
+ _FwdIt1 _Mid1;
+
+ if (_Count == 0)
+ return (_First1);
+
+ for (;; _First1 = ++_Mid1)
+ { // look for a long enough sequence
+ _Diff2 _Count1 = _Count;
+
+ for (; _First1 != _Last1; ++_First1)
+ if (_Pred(*_First1, _Val))
+ break; // found first match
+
+ for (_Mid1 = _First1;; )
+ if (--_Count1 == 0)
+ return (_First1); // found last match
+ else if (_Mid1 == _Last1 || !_Pred(*++_Mid1, _Val))
+ break;
+ if (_Mid1 == _Last1)
+ return (_Last1);
+ }
+ }
+
+template<class _FwdIt1,
+ class _Diff2,
+ class _Ty,
+ class _Pr> inline
+ _FwdIt1 _Search_n(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _Diff2 _Count, const _Ty& _Val, _Pr _Pred, random_access_iterator_tag)
+ { // find first _Count * _Val satisfying _Pred, random-access iterators
+ _DEBUG_RANGE(_First1, _Last1);
+ _DEBUG_POINTER(_Pred);
+ _FwdIt1 _Mid1;
+
+ if (_Count == 0)
+ return (_First1);
+
+ for (;; _First1 = ++_Mid1)
+ { // look for a long enough sequence
+ _FwdIt1 _Oldfirst1 = _First1;
+ _Diff2 _Count1 = _Count;
+
+ for (;; _First1 += _Count)
+ if (_First1 == _Last1)
+ return (_Last1); // end of sequence
+ else if (_Pred(*_First1, _Val))
+ break; // found a match
+ else if (_Last1 - _First1 < _Count)
+ return (_Last1); // not enough left for a match
+
+ if (_Oldfirst1 != _First1)
+ for (++_Oldfirst1; _Oldfirst1 != _First1; --_First1, --_Count1)
+ if (!_Pred(_First1[-1], _Val))
+ break; // found beginning of sequence
+
+ for (_Mid1 = _First1;; )
+ if (--_Count1 == 0)
+ return (_First1); // found last match
+ else if (_Mid1 == _Last1 || !_Pred(*++_Mid1, _Val))
+ break;
+ if (_Mid1 == _Last1)
+ return (_Last1);
+ }
+ }
+
+template<class _FwdIt1,
+ class _Diff2,
+ class _Ty,
+ class _Pr> inline
+ _FwdIt1 search_n(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _Diff2 _Count, const _Ty& _Val, _Pr _Pred)
+ { // find first _Count * _Val satisfying _Pred
+ _ASSIGN_FROM_BASE(_First1,
+ _Search_n(_CHECKED_BASE(_First1), _CHECKED_BASE(_Last1), _Count, _Val, _Pred,
+ _Iter_cat(_First1)));
+ return _First1;
+ }
+
+ // TEMPLATE FUNCTION find_end
+template<class _FwdIt1,
+ class _FwdIt2,
+ class _Diff1,
+ class _Diff2> inline
+ _FwdIt1 _Find_end(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _FwdIt2 _First2, _FwdIt2 _Last2, _Diff1 *, _Diff2 *)
+ { // find last [_First2, _Last2) match
+ _DEBUG_RANGE(_First1, _Last1);
+ _DEBUG_RANGE(_First2, _Last2);
+ _Diff1 _Count1 = 0;
+ _Distance(_First1, _Last1, _Count1);
+ _Diff2 _Count2 = 0;
+ _Distance(_First2, _Last2, _Count2);
+ _FwdIt1 _Ans = _Last1;
+
+ if (0 < _Count2)
+ for (; _Count2 <= _Count1; ++_First1, --_Count1)
+ { // room for match, try it
+ _FwdIt1 _Mid1 = _First1;
+ for (_FwdIt2 _Mid2 = _First2; ; ++_Mid1)
+ if (!(*_Mid1 == *_Mid2))
+ break;
+ else if (++_Mid2 == _Last2)
+ { // potential answer, save it
+ _Ans = _First1;
+ break;
+ }
+ }
+ return (_Ans);
+ }
+
+template<class _FwdIt1,
+ class _FwdIt2> inline
+ _FwdIt1 find_end(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _FwdIt2 _First2, _FwdIt2 _Last2)
+ { // find last [_First2, _Last2) match
+ _ASSIGN_FROM_BASE(_First1,
+ _Find_end(_CHECKED_BASE(_First1), _CHECKED_BASE(_Last1),
+ _CHECKED_BASE(_First2), _CHECKED_BASE(_Last2),
+ _Dist_type(_First1), _Dist_type(_First2)));
+ return _First1;
+ }
+
+ // TEMPLATE FUNCTION find_end WITH PRED
+template<class _FwdIt1,
+ class _FwdIt2,
+ class _Diff1,
+ class _Diff2,
+ class _Pr> inline
+ _FwdIt1 _Find_end(_FwdIt1 _First1, _FwdIt1 _Last1,
+ _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred, _Diff1 *, _Diff2 *)
+ { // find last [_First2, _Last2) satisfying _Pred
+ _DEBUG_RANGE(_First1, _Last1);
+ _DEBUG_RANGE(_First2, _Last2);
+ _DEBUG_POINTER(_Pred);
+ _Diff1 _Count1 = 0;
+ _Distance(_First1, _Last1, _Count1);
+ _Diff2 _Count2 = 0;
+ _Distance(_First2, _Last2, _Count2);
+ _FwdIt1 _Ans = _Last1;
+
+ if (0 < _Coun...
[truncated message content] |
|
From: <rom...@us...> - 2008-12-15 20:53:53
|
Revision: 1467
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1467&view=rev
Author: roman_yakovenko
Date: 2008-12-15 20:53:49 +0000 (Mon, 15 Dec 2008)
Log Message:
-----------
adding ability to create "function transformation" for pure virtual functions
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/function_transformers/controllers.py
pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py
pyplusplus_dev/pyplusplus/function_transformers/templates.py
pyplusplus_dev/pyplusplus/module_creator/creators_wizard.py
pyplusplus_dev/unittests/autoconfig.py
pyplusplus_dev/unittests/bool_by_ref_tester.py
pyplusplus_dev/unittests/data/bool_by_ref_to_be_exported.hpp
pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp
Modified: pyplusplus_dev/pyplusplus/function_transformers/controllers.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/controllers.py 2008-12-13 21:24:18 UTC (rev 1466)
+++ pyplusplus_dev/pyplusplus/function_transformers/controllers.py 2008-12-15 20:53:49 UTC (rev 1467)
@@ -337,7 +337,26 @@
def default_controller( self ):
return self.__default_cntrl
+class pure_virtual_mem_fun_controller_t( virtual_mem_fun_controller_t ):
+ def __init__( self, function ):
+ virtual_mem_fun_controller_t.__init__(self, function)
+
+ class override_fun_controller_t( virtual_mem_fun_controller_t.override_fun_controller_t ):
+ def __init__( self, function ):
+ virtual_mem_fun_controller_t.override_fun_controller_t.__init__(self, function)
+
+ @property
+ def template( self ):
+ return templates.pure_virtual_mem_fun.override
+ class default_fun_controller_t( virtual_mem_fun_controller_t.default_fun_controller_t ):
+ def __init__( self, function ):
+ virtual_mem_fun_controller_t.default_fun_controller_t.__init__(self,function)
+
+ @property
+ def template( self ):
+ return templates.pure_virtual_mem_fun.default
+
#TODO: FT for constructor
#~ class constructor_controller_t( controller_base_t ):
Modified: pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py 2008-12-13 21:24:18 UTC (rev 1466)
+++ pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py 2008-12-15 20:53:49 UTC (rev 1467)
@@ -18,6 +18,8 @@
if isinstance( function.parent, declarations.class_t ):
if declarations.VIRTUALITY_TYPES.NOT_VIRTUAL == function.virtuality:
self.__controller = controllers.mem_fun_controller_t( function )
+ elif declarations.VIRTUALITY_TYPES.PURE_VIRTUAL == function.virtuality:
+ self.__controller = controllers.pure_virtual_mem_fun_controller_t( function )
else:
self.__controller = controllers.virtual_mem_fun_controller_t( function )
else:
Modified: pyplusplus_dev/pyplusplus/function_transformers/templates.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/templates.py 2008-12-13 21:24:18 UTC (rev 1466)
+++ pyplusplus_dev/pyplusplus/function_transformers/templates.py 2008-12-15 20:53:49 UTC (rev 1467)
@@ -55,6 +55,40 @@
, '}'
]))
+class pure_virtual_mem_fun:
+ override = Template( os.linesep.join([
+ 'virtual $return_type $function_name( $arg_declarations )$constness $throw{'
+ , ' namespace bpl = boost::python;'
+ , ' if( bpl::override $py_function_var = this->get_override( "$function_alias" ) ){'
+ , ' $declare_py_variables'
+ , ' $py_pre_call'
+ , ' ${save_py_result}bpl::call<bpl::object>( $py_function_var.ptr()$py_arg_expressions );'
+ , ' $py_post_call'
+ , ' $py_return'
+ , ' }'
+ , ' else{'
+ , ' PyErr_SetString(PyExc_NotImplementedError, "Attempted calling Pure Virtual function that is not implemented :$function_name");'
+ , ' boost::python::throw_error_already_set();'
+ , ' }'
+ , '}'
+ ]))
+
+ default = Template( os.linesep.join([
+ 'static $return_type $unique_function_name( $arg_declarations ){'
+ , ' $declare_variables'
+ , ' $pre_call'
+ , ' if( dynamic_cast< $wrapper_class $wrapped_inst_constness* >( boost::addressof( $wrapped_inst ) ) ){'
+ , ' PyErr_SetString(PyExc_NotImplementedError, "Attempted calling Pure Virtual function that is not implemented :$function_name");'
+ , ' boost::python::throw_error_already_set();'
+ , ' }'
+ , ' else{'
+ , ' $save_result$wrapped_inst.$function_name($arg_expressions);'
+ , ' }'
+ , ' $post_call'
+ , ' $return'
+ , '}'
+ ]))
+
#TODO: FT for constructor
#~ class constructor:
#~ #User cannot apply transformation on constructor of abstract class
Modified: pyplusplus_dev/pyplusplus/module_creator/creators_wizard.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creators_wizard.py 2008-12-13 21:24:18 UTC (rev 1466)
+++ pyplusplus_dev/pyplusplus/module_creator/creators_wizard.py 2008-12-15 20:53:49 UTC (rev 1467)
@@ -30,8 +30,12 @@
else:
maker_cls = code_creators.mem_fun_t
elif decl.virtuality == VIRTUALITY_TYPES.PURE_VIRTUAL:
- fwrapper_cls = code_creators.mem_fun_pv_wrapper_t
- maker_cls = code_creators.mem_fun_pv_t
+ if decl.transformations:
+ maker_cls = code_creators.mem_fun_v_transformed_t
+ fwrapper_cls = code_creators.mem_fun_v_transformed_wrapper_t
+ else:
+ fwrapper_cls = code_creators.mem_fun_pv_wrapper_t
+ maker_cls = code_creators.mem_fun_pv_t
else:
if decl.transformations:
fwrapper_cls = code_creators.mem_fun_v_transformed_wrapper_t
Modified: pyplusplus_dev/unittests/autoconfig.py
===================================================================
--- pyplusplus_dev/unittests/autoconfig.py 2008-12-13 21:24:18 UTC (rev 1466)
+++ pyplusplus_dev/unittests/autoconfig.py 2008-12-15 20:53:49 UTC (rev 1467)
@@ -30,8 +30,9 @@
@staticmethod
def create_sconstruct():
code = [
- "env = Environment()"
- , "env.SharedLibrary( target=r'%(target)s'"
+ "import sys"
+ , "env = Environment()"
+ , "t = env.SharedLibrary( target=r'%(target)s'"
, " , source=[ %(sources)s ]"
, " , LIBS=[ %s ]" % ','.join( [ 'r"%s"' % lib for lib in scons_config.libs ] )
, " , LIBPATH=[ %s ]" % ','.join( [ 'r"%s"' % path for path in scons_config.libpath ] )
@@ -39,8 +40,9 @@
, " , CCFLAGS=[ %s ]" % ','.join( [ 'r"%s"' % flag for flag in scons.ccflags ] )
, " , SHLIBPREFIX=''"
, " , SHLIBSUFFIX='%s'" % scons.suffix #explicit better then implicit
- , ")"
- , "env.AddPostAction('%(target)s', 'mt.exe -nologo -manifest %(target)s.pyd.manifest -outputresource:%(target)s.pyd;2' )" ]
+ , ")"
+ , "if 'linux' not in sys.platform:"
+ , " env.AddPostAction(t, 'mt.exe -nologo -manifest %(target)s.pyd.manifest -outputresource:%(target)s.pyd;2' )" ]
return os.linesep.join( code )
#I need this in order to allow Python to load just compiled modules
Modified: pyplusplus_dev/unittests/bool_by_ref_tester.py
===================================================================
--- pyplusplus_dev/unittests/bool_by_ref_tester.py 2008-12-13 21:24:18 UTC (rev 1466)
+++ pyplusplus_dev/unittests/bool_by_ref_tester.py 2008-12-15 20:53:49 UTC (rev 1467)
@@ -26,6 +26,8 @@
set_flag = mb.mem_fun( '::tests::listener::listen' )
set_flag.add_transformation( ft.inout(2) )
+ set_flag = mb.mem_fun( '::tests::listener::listenPV' )
+ set_flag.add_transformation( ft.inout(2) )
def run_tests(self, module):
class list1 ( module.listener ):
@@ -33,11 +35,16 @@
module.listener.__init__(self)
def listen( self, id, name, skip):
print "Python: listen called with", id, name, skip
- return 11## Test always returns True...
-
+ return skip + 1 ## Test always returns True...
+ def listenPV( self, id, name, skip):
+ print "Python: listenPV called with", id, name, skip
+ return skip + 1 ## Test always returns True...
+
c = list1()
ret = module.callListener( c )
print ret
+ ret = module.callListenerPV ( c )
+ print ret
def create_suite():
suite = unittest.TestSuite()
Modified: pyplusplus_dev/unittests/data/bool_by_ref_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/bool_by_ref_to_be_exported.hpp 2008-12-13 21:24:18 UTC (rev 1466)
+++ pyplusplus_dev/unittests/data/bool_by_ref_to_be_exported.hpp 2008-12-15 20:53:49 UTC (rev 1467)
@@ -7,15 +7,34 @@
public:
virtual void listen(int id, const std::string& name, int& skip) {
throw std::runtime_error ( std::string ("Virtual function listener::listen called!") );
- }
+ }
+ virtual void listenPV(int id, const std::string& name, int& skip) = 0;
};
bool callListener ( listener* myListener) {
int skip = 10;
std::cout << "C++: Calling myListener->listen\n";
myListener->listen(100, "test", skip);
- std::cout << "C++: Called OK " << skip <<"\n";
+ if (skip == 10)
+ throw std::runtime_error( "PROBLEM in C++: Called Returned with same value " );
+ else
+ std::cout << "C++: Called OK " << skip <<"\n";
+
return skip;
}
+
+bool callListenerPV ( listener* myListener) {
+ int skip = 10;
+ std::cout << "C++: Calling myListener->listen\n";
+ myListener->listenPV(100, "test", skip);
+ if (skip == 10){
+ throw std::runtime_error( "PROBLEM in C++: Called Returned with same value " );
+ }
+ else
+ std::cout << "C++: Called OK " << skip <<"\n";
+ return skip;
}
+
+
+}
Modified: pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp 2008-12-13 21:24:18 UTC (rev 1466)
+++ pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp 2008-12-15 20:53:49 UTC (rev 1467)
@@ -249,7 +249,7 @@
virtual void
render_queue_ended( int group_id
, const std::string& invocation
- , bool& repeat_this_invocation ){};
+ , bool& repeat_this_invocation ) = 0;
};
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-13 21:24:20
|
Revision: 1466
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1466&view=rev
Author: roman_yakovenko
Date: 2008-12-13 21:24:18 +0000 (Sat, 13 Dec 2008)
Log Message:
-----------
rename pdb to mspdb
Added Paths:
-----------
pygccxml_dev/pygccxml/msvc/mspdb/
Removed Paths:
-------------
pygccxml_dev/pygccxml/msvc/pdb/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-13 12:44:31
|
Revision: 1465
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1465&view=rev
Author: roman_yakovenko
Date: 2008-12-13 12:44:27 +0000 (Sat, 13 Dec 2008)
Log Message:
-----------
remove BOOST_PYTHON_DECL from the files - should enable header-only library on Windows
Modified Paths:
--------------
pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp 2008-12-09 20:30:09 UTC (rev 1464)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp 2008-12-13 12:44:27 UTC (rev 1465)
@@ -28,7 +28,7 @@
#include <boost/python/handle.hpp>
namespace boost { namespace python { namespace indexing {
- struct BOOST_PYTHON_DECL python_iterator
+ struct /*BOOST_PYTHON_DECL*/ python_iterator
{
python_iterator (boost::python::object obj)
: m_iter_obj (handle<> (PyObject_GetIter (obj.ptr()))),
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp 2008-12-09 20:30:09 UTC (rev 1464)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp 2008-12-13 12:44:27 UTC (rev 1465)
@@ -26,7 +26,7 @@
#include <algorithm>
namespace boost { namespace python { namespace indexing {
- struct BOOST_PYTHON_DECL slice : public boost::python::object
+ struct /*BOOST_PYTHON_DECL*/ slice : public boost::python::object
{
// This is just a thin wrapper around boost::python::object
// so that it is possible to register a special converter for
@@ -61,7 +61,7 @@
{}
};
- struct BOOST_PYTHON_DECL integer_slice
+ struct /*BOOST_PYTHON_DECL*/ integer_slice
{
// This class provides a convenient interface to Python slice
// objects that contain integer bound and stride values.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-09 20:30:13
|
Revision: 1464
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1464&view=rev
Author: roman_yakovenko
Date: 2008-12-09 20:30:09 +0000 (Tue, 09 Dec 2008)
Log Message:
-----------
making indexing suite v2 to be header only library
Modified Paths:
--------------
pyplusplus_dev/environment.py
pyplusplus_dev/indexing_suite_v2/indexing_suite/algorithms.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/container_proxy.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/container_suite.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/container_traits.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/deque.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/element_proxy.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/element_proxy_traits.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/int_slice_helper.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/iterator_range.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/iterator_traits.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/list.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/map.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/methods.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/multimap.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/pair.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/proxy_iterator.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/set.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/shared_proxy_impl.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/slice_handler.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/suite_utils.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/value_traits.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/vector.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/visitor.hpp
pyplusplus_dev/indexing_suite_v2/indexing_suite/workaround.hpp
pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
pyplusplus_dev/pyplusplus/code_repository/return_range.py
pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py
pyplusplus_dev/unittests/autoconfig.py
Modified: pyplusplus_dev/environment.py
===================================================================
--- pyplusplus_dev/environment.py 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/environment.py 2008-12-09 20:30:09 UTC (rev 1464)
@@ -4,6 +4,9 @@
this_module_dir_path = os.path.abspath ( os.path.dirname( sys.modules[__name__].__file__) )
+class indexing_suite:
+ include = os.path.join( this_module_dir_path, 'indexing_suite_v2' )
+
class boost:
libs = ''
include = ''
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/algorithms.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/algorithms.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/algorithms.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -13,6 +13,7 @@
// 2003/ 9/11 rmg File creation from suite_utils.hpp
// 2003/10/28 rmg Split container-specific versions into separate headers
// 2006/10/25 Roman Adding keys function to assoc_algorithms class
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: algorithms.hpp,v 1.1.2.15 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -20,12 +21,12 @@
#ifndef BOOST_PYTHON_INDEXING_ALGORITHMS_HPP
#define BOOST_PYTHON_INDEXING_ALGORITHMS_HPP
-#include <boost/python/suite/indexing/suite_utils.hpp>
+#include <indexing_suite/suite_utils.hpp>
#include <boost/type_traits.hpp>
#include <boost/python/errors.hpp>
-#include <boost/python/suite/indexing/int_slice_helper.hpp>
-#include <boost/python/suite/indexing/slice.hpp>
+#include <indexing_suite/int_slice_helper.hpp>
+#include <indexing_suite/slice.hpp>
#include <boost/mpl/if.hpp>
#include <boost/limits.hpp>
#include <algorithm>
@@ -158,7 +159,7 @@
ContainerTraits::visit_container_class (pyClass, policy);
}
-
+
protected:
static iterator find_or_throw (container &, index_param);
};
@@ -214,7 +215,7 @@
{
throw std::out_of_range (msg);
}
-
+
result = bound + ix;
}
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/container_proxy.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/container_proxy.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/container_proxy.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -21,6 +21,7 @@
// =======
// 2003/ 8/26 rmg File creation
// 2003/10/23 rmg Change pointer container from map to sequence
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: container_proxy.hpp,v 1.1.2.28 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -28,21 +29,21 @@
#ifndef BOOST_PYTHON_INDEXING_CONTAINER_PROXY_HPP
#define BOOST_PYTHON_INDEXING_CONTAINER_PROXY_HPP
-#include <boost/python/suite/indexing/proxy_iterator.hpp>
-#include <boost/python/suite/indexing/shared_proxy_impl.hpp>
-#include <boost/python/suite/indexing/element_proxy.hpp>
-#include <boost/python/suite/indexing/element_proxy_traits.hpp>
-#include <boost/python/suite/indexing/workaround.hpp>
-#include <boost/python/suite/indexing/methods.hpp>
+#include <indexing_suite/proxy_iterator.hpp>
+#include <indexing_suite/shared_proxy_impl.hpp>
+#include <indexing_suite/element_proxy.hpp>
+#include <indexing_suite/element_proxy_traits.hpp>
+#include <indexing_suite/workaround.hpp>
+#include <indexing_suite/methods.hpp>
#include <vector>
#include <cassert>
#include <boost/shared_ptr.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/iterator/iterator_traits.hpp>
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
namespace boost { namespace python { namespace indexing {
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/container_suite.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/container_suite.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/container_suite.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -12,6 +12,7 @@
// =======
// 2003/ 8/23 rmg File creation
// 2003/ 9/ 8 rmg Extracted trait facilities into container_traits.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: container_suite.hpp,v 1.1.2.7 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -19,9 +20,9 @@
#ifndef BOOST_PYTHON_INDEXING_CONTAINER_SUITE_HPP
#define BOOST_PYTHON_INDEXING_CONTAINER_SUITE_HPP
-#include <boost/python/suite/indexing/methods.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
-#include <boost/python/suite/indexing/visitor.hpp>
+#include <indexing_suite/methods.hpp>
+#include <indexing_suite/algorithms.hpp>
+#include <indexing_suite/visitor.hpp>
#include <boost/python/return_by_value.hpp>
#include <boost/python/return_value_policy.hpp>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/container_traits.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/container_traits.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/container_traits.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -15,6 +15,7 @@
// 2003/ 9/ 8 rmg Renamed container_traits.hpp
// 2003/10/28 rmg Split container-specific versions into separate headers
// 2004/ 1/28 rmg Convert to bitset-based feature selection
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: container_traits.hpp,v 1.1.2.15 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -22,9 +23,9 @@
#ifndef BOOST_PYTHON_INDEXING_CONTAINER_TRAITS_HPP
#define BOOST_PYTHON_INDEXING_CONTAINER_TRAITS_HPP
-#include <boost/python/suite/indexing/suite_utils.hpp>
-#include <boost/python/suite/indexing/methods.hpp>
-#include <boost/python/suite/indexing/value_traits.hpp>
+#include <indexing_suite/suite_utils.hpp>
+#include <indexing_suite/methods.hpp>
+#include <indexing_suite/value_traits.hpp>
#include <boost/type_traits.hpp>
#include <boost/call_traits.hpp>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/deque.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/deque.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/deque.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2003/10/28 rmg File creation from algo_selector.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: deque.hpp,v 1.1.2.6 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -18,9 +19,9 @@
#ifndef BOOST_PYTHON_INDEXING_DEQUE_HPP
#define BOOST_PYTHON_INDEXING_DEQUE_HPP
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
#include <deque>
namespace boost { namespace python { namespace indexing {
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/element_proxy.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/element_proxy.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/element_proxy.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -12,6 +12,7 @@
// History
// =======
// 2003/ 9/15 rmg File creation from container_proxy.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: element_proxy.hpp,v 1.1.2.10 2003/12/03 12:18:51 raoulgough Exp $
//
@@ -19,7 +20,7 @@
#ifndef BOOST_PYTHON_INDEXING_ELEMENT_PROXY_HPP
#define BOOST_PYTHON_INDEXING_ELEMENT_PROXY_HPP
-#include <boost/python/suite/indexing/shared_proxy_impl.hpp>
+#include <indexing_suite/shared_proxy_impl.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/get_pointer.hpp>
#include <boost/utility/addressof.hpp>
@@ -168,7 +169,7 @@
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
}} // namespace python::indexing
-#endif
+#endif
template<typename ContainerProxy>
typename ContainerProxy::raw_value_type *
@@ -181,7 +182,7 @@
// Don't hide these other get_pointer overloads
using boost::get_pointer;
}} // namespace python::indexing
-#endif
+#endif
}
#endif // BOOST_PYTHON_INDEXING_ELEMENT_PROXY_HPP
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/element_proxy_traits.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/element_proxy_traits.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/element_proxy_traits.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -17,6 +17,7 @@
// History
// =======
// 2003/10/23 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: element_proxy_traits.hpp,v 1.1.2.5 2003/12/05 17:36:14 raoulgough Exp $
//
@@ -24,8 +25,8 @@
#ifndef BOOST_PYTHON_INDEXING_ELEMENT_PROXY_TRAITS_HPP
#define BOOST_PYTHON_INDEXING_ELEMENT_PROXY_TRAITS_HPP
-#include <boost/python/suite/indexing/element_proxy.hpp>
-#include <boost/python/suite/indexing/value_traits.hpp>
+#include <indexing_suite/element_proxy.hpp>
+#include <indexing_suite/value_traits.hpp>
#include <boost/python/register_ptr_to_python.hpp>
#include <boost/python/implicit.hpp>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/int_slice_helper.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/int_slice_helper.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/int_slice_helper.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -9,6 +9,7 @@
// History
// =======
// 2003/10/13 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: int_slice_helper.hpp,v 1.1.2.10 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -17,7 +18,7 @@
#define BOOST_PYTHON_INDEXING_INT_SLICE_HELPER_HPP
# include <boost/python/errors.hpp>
-# include <boost/python/suite/indexing/workaround.hpp>
+# include <indexing_suite/workaround.hpp>
namespace boost { namespace python { namespace indexing {
template<typename Algorithms, typename SliceType>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/iterator_range.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/iterator_range.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/iterator_range.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -13,6 +13,7 @@
// =======
// 2003/ 9/ 9 rmg File creation as iterator_pair.hpp
// 2003/10/27 rmg Renamed iterator_range.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: iterator_range.hpp,v 1.1.2.7 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -27,10 +28,10 @@
#include <boost/type_traits/ice.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/iterator/iterator_traits.hpp>
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
-#include <boost/python/suite/indexing/iterator_traits.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
+#include <indexing_suite/iterator_traits.hpp>
namespace boost { namespace python { namespace indexing {
template<typename Iterator>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/iterator_traits.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/iterator_traits.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/iterator_traits.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -15,6 +15,7 @@
// =======
// 2003/ 8/23 rmg File creation as iterator_suite.hpp
// 2003/ 9/12 rmg Renamed iterator_traits.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: iterator_traits.hpp,v 1.1.2.14 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -22,9 +23,9 @@
#ifndef BOOST_PYTHON_INDEXING_ITERATOR_TRAITS_HPP
#define BOOST_PYTHON_INDEXING_ITERATOR_TRAITS_HPP
-#include <boost/python/suite/indexing/suite_utils.hpp>
-#include <boost/python/suite/indexing/methods.hpp>
-//#include <boost/python/suite/indexing/workaround.hpp>
+#include <indexing_suite/suite_utils.hpp>
+#include <indexing_suite/methods.hpp>
+//#include <indexing_suite/workaround.hpp>
//#include <boost/call_traits.hpp>
//#include <boost/type_traits.hpp>
@@ -154,7 +155,7 @@
forward_iter_sizer &sizer (std::forward_iterator_tag *);
bidirectional_iter_sizer &sizer (std::bidirectional_iterator_tag *);
random_access_iter_sizer &sizer (std::random_access_iterator_tag *);
-
+
template<size_t Size> struct traits_by_size {
// Default implementation gives only the most basic support
template<typename Iterator>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/list.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/list.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/list.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2003/10/28 rmg File creation from algo_selector.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: list.hpp,v 1.1.2.7 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -18,9 +19,9 @@
#ifndef BOOST_PYTHON_INDEXING_LIST_HPP
#define BOOST_PYTHON_INDEXING_LIST_HPP
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
#include <list>
#if BOOST_WORKAROUND (BOOST_MSVC, == 1200)
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/map.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/map.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/map.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2003/10/28 rmg File creation from algo_selector.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: map.hpp,v 1.1.2.6 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -18,12 +19,12 @@
#ifndef BOOST_PYTHON_INDEXING_MAP_HPP
#define BOOST_PYTHON_INDEXING_MAP_HPP
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
#include <boost/detail/workaround.hpp>
#include <map>
-#include <boost/python/suite/indexing/pair.hpp>
+#include <indexing_suite/pair.hpp>
namespace boost { namespace python { namespace indexing {
/////////////////////////////////////////////////////////////////////////
@@ -98,22 +99,22 @@
// Version to return only the mapped type
static boost::python::list keys( container & );
-
+
static void assign (container &, index_param, value_param);
static void insert (container &, index_param, value_param);
-
+
template<typename PythonClass, typename Policy>
static void visit_container_class( PythonClass &pyClass, Policy const &policy)
{
ContainerTraits::visit_container_class (pyClass, policy);
- pyClass.def( "keys", &self_type::keys );
-
+ pyClass.def( "keys", &self_type::keys );
+
typedef BOOST_DEDUCED_TYPENAME most_derived::container::value_type value_type;
mapping::register_value_type< PythonClass, value_type, Policy >( pyClass );
//now we can expose iterators functionality
pyClass.def( "__iter__", python::iterator< BOOST_DEDUCED_TYPENAME most_derived::container >() );
- }
-
+ }
+
};
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
@@ -175,7 +176,7 @@
return most_derived::find_or_throw (c, ix)->second;
}
-
+
template<typename ContainerTraits, typename Ovr>
boost::python::list
map_algorithms<ContainerTraits, Ovr>::keys( container &c )
@@ -192,10 +193,10 @@
}
//}
}
-
+
return _keys;
}
-
+
/////////////////////////////////////////////////////////////////////////
// Assign a value at a particular index (map version)
/////////////////////////////////////////////////////////////////////////
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/methods.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/methods.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/methods.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2004/ 1/11 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: methods.hpp,v 1.1.2.1 2004/02/08 18:57:42 raoulgough Exp $
//
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/multimap.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/multimap.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/multimap.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -9,18 +9,19 @@
// History
// =======
// 2006/10/27 Roman File creation from map.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
#ifndef BOOST_PYTHON_INDEXING_MULTIMAP_HPP
#define BOOST_PYTHON_INDEXING_MULTIMAP_HPP
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
#include <boost/detail/workaround.hpp>
#include <functional>
#include <map>
-#include <boost/python/suite/indexing/pair.hpp>
+#include <indexing_suite/pair.hpp>
namespace boost { namespace python { namespace indexing {
/////////////////////////////////////////////////////////////////////////
@@ -95,23 +96,23 @@
// Version to return only the mapped type
static boost::python::list keys( container & );
-
+
static void assign (container &, index_param, value_param);
static void insert (container &, index_param, value_param);
-
+
template<typename PythonClass, typename Policy>
static void visit_container_class( PythonClass &pyClass, Policy const &policy)
{
ContainerTraits::visit_container_class (pyClass, policy);
- pyClass.def( "keys", &self_type::keys );
+ pyClass.def( "keys", &self_type::keys );
typedef BOOST_DEDUCED_TYPENAME most_derived::container::value_type value_type;
mapping::register_value_type< PythonClass, value_type, Policy >( pyClass );
//now we can expose iterators functionality
pyClass.def( "__iter__", python::iterator< BOOST_DEDUCED_TYPENAME most_derived::container >() );
-
- }
+ }
+
};
template<
@@ -157,11 +158,11 @@
}
//}
}
-
+
return _keys;
}
-
-
+
+
/////////////////////////////////////////////////////////////////////////
// Assign a value at a particular index (map version)
/////////////////////////////////////////////////////////////////////////
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/pair.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/pair.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/pair.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -2,7 +2,7 @@
//
// Exposes std::pair< key, value > class
//
-// Copyright (c) 2007 Roman Yakovenko
+// Copyright (c) 2007 Roman Yakovenko
//
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
@@ -11,29 +11,30 @@
// History
// =======
// 2007/2/11 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
#ifndef BOOST_PYTHON_STD_PAIR_KEY_VALUE_11_02_2007_HPP
#define BOOST_PYTHON_STD_PAIR_KEY_VALUE_11_02_2007_HPP
#include <boost/config.hpp>
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
#include <boost/detail/workaround.hpp>
namespace boost { namespace python { namespace indexing { namespace mapping{
namespace details{
-
+
template< typename TValueType, typename TValueCallPolicies >
struct pair_exposer_t{
- typedef TValueType pair_type;
+ typedef TValueType pair_type;
typedef BOOST_DEDUCED_TYPENAME pair_type::first_type key_type;
typedef BOOST_DEDUCED_TYPENAME pair_type::second_type mapped_type;
typedef pair_exposer_t< TValueType, TValueCallPolicies > exposer_type;
-
+
pair_exposer_t(const std::string& name){
class_< pair_type >( name.c_str() )
.def( "__len__", &exposer_type::len )
@@ -41,7 +42,7 @@
.add_property( "key", &exposer_type::get_key )
.add_property( "value", &exposer_type::get_mapped );
}
-
+
private:
static size_t len( const pair_type& ){
@@ -67,32 +68,32 @@
}
}
}
-
+
static object get_key( const pair_type& p ){
return object( p.first );
}
-
+
static object get_mapped( pair_type& p ){
typedef BOOST_DEDUCED_TYPENAME TValueCallPolicies::result_converter rc_type;
typedef BOOST_DEDUCED_TYPENAME rc_type:: template apply< mapped_type >::type converter_type;
converter_type converter;
return object( handle<>( converter( p.second ) ) );
}
-
+
};
} //details
-
+
template< typename TPythonClass, typename TValueType, typename TValueCallPolicies >
-inline void register_value_type(TPythonClass &pyClass){
+inline void register_value_type(TPythonClass &pyClass){
typedef details::pair_exposer_t< TValueType, TValueCallPolicies > exposer_type;
-
+
object class_name(pyClass.attr("__name__"));
extract<std::string> class_name_extractor(class_name);
std::string pair_name = class_name_extractor() + "_entry";
-
+
exposer_type expose( pair_name );
}
-
+
} } } }
#endif // BOOST_PYTHON_STD_PAIR_KEY_VALUE_11_02_2007_HPP
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/proxy_iterator.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/proxy_iterator.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/proxy_iterator.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -10,6 +10,7 @@
// History
// =======
// 2003/10/ 8 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: proxy_iterator.hpp,v 1.1.2.8 2003/12/05 17:36:14 raoulgough Exp $
//
@@ -63,7 +64,7 @@
: ptr (p), index (i)
{
}
-
+
proxy_iterator (container_proxy_type *p, raw_iterator iter)
: ptr (p), index (iter - p->raw_container().begin())
{
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -13,6 +13,7 @@
// History
// =======
// 2003/ 9/10 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: python_iterator.hpp,v 1.1.2.5 2003/11/24 16:35:09 raoulgough Exp $
//
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/set.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/set.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/set.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2003/10/28 rmg File creation from algo_selector.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: set.hpp,v 1.1.2.6 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -18,9 +19,9 @@
#ifndef BOOST_PYTHON_INDEXING_SET_HPP
#define BOOST_PYTHON_INDEXING_SET_HPP
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
#include <boost/type_traits/is_const.hpp>
#include <set>
@@ -85,13 +86,13 @@
typedef typename Parent::index_param index_param;
static void insert (container &, index_param);
-
+
template<typename PythonClass, typename Policy>
static void visit_container_class( PythonClass &pyClass, Policy const &policy)
{
ContainerTraits::visit_container_class (pyClass, policy);
- pyClass.def( "add", &self_type::insert );
- }
+ pyClass.def( "add", &self_type::insert );
+ }
};
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/shared_proxy_impl.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/shared_proxy_impl.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/shared_proxy_impl.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -16,6 +16,7 @@
// History
// =======
// 2003/ 8/29 rmg File creation from container_proxy.hh
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: shared_proxy_impl.hpp,v 1.1.2.8 2003/11/24 14:28:31 raoulgough Exp $
//
@@ -24,7 +25,7 @@
#define BOOST_PYTHON_INDEXING_SHARED_PROXY_IMPL_HPP
#include <memory>
-#include <boost/python/suite/indexing/workaround.hpp>
+#include <indexing_suite/workaround.hpp>
namespace boost { namespace python { namespace indexing {
template<class ContainerProxy>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -9,6 +9,7 @@
// History
// =======
// 2003/ 9/10 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: slice.hpp,v 1.1.2.10 2003/11/24 14:28:31 raoulgough Exp $
//
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/slice_handler.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/slice_handler.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/slice_handler.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2003/ 9/ 9 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: slice_handler.hpp,v 1.1.2.10 2003/11/24 16:35:52 raoulgough Exp $
//
@@ -26,8 +27,8 @@
#include <boost/mpl/apply.hpp>
#include <algorithm>
-#include <boost/python/suite/indexing/slice.hpp>
-#include <boost/python/suite/indexing/python_iterator.hpp>
+#include <indexing_suite/slice.hpp>
+#include <indexing_suite/python_iterator.hpp>
namespace boost { namespace python { namespace indexing {
template<class Algorithms, class Policy>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/suite_utils.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/suite_utils.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/suite_utils.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2003/ 8/23 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: suite_utils.hpp,v 1.1.2.7 2003/11/24 14:28:31 raoulgough Exp $
//
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/value_traits.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/value_traits.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/value_traits.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -12,6 +12,7 @@
// History
// =======
// 2003/ 9/12 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: value_traits.hpp,v 1.1.2.6 2003/12/05 17:36:12 raoulgough Exp $
//
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/vector.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/vector.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/vector.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2003/10/28 rmg File creation from algo_selector.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: vector.hpp,v 1.1.2.6 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -18,9 +19,9 @@
#ifndef BOOST_PYTHON_INDEXING_VECTOR_HPP
#define BOOST_PYTHON_INDEXING_VECTOR_HPP
-#include <boost/python/suite/indexing/container_traits.hpp>
-#include <boost/python/suite/indexing/container_suite.hpp>
-#include <boost/python/suite/indexing/algorithms.hpp>
+#include <indexing_suite/container_traits.hpp>
+#include <indexing_suite/container_suite.hpp>
+#include <indexing_suite/algorithms.hpp>
#include <vector>
namespace boost { namespace python { namespace indexing {
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/visitor.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/visitor.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/visitor.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -12,6 +12,7 @@
// History
// =======
// 2003/ 9/11 rmg File creation from container_suite.hpp
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: visitor.hpp,v 1.1.2.16 2004/02/08 18:57:42 raoulgough Exp $
//
@@ -19,8 +20,8 @@
#ifndef BOOST_PYTHON_INDEXING_VISITOR_HPP
#define BOOST_PYTHON_INDEXING_VISITOR_HPP
-#include <boost/python/suite/indexing/slice_handler.hpp>
-#include <boost/python/suite/indexing/suite_utils.hpp> // Get index_style_t
+#include <indexing_suite/slice_handler.hpp>
+#include <indexing_suite/suite_utils.hpp> // Get index_style_t
#include <boost/python/def_visitor.hpp>
#include <boost/python/iterator.hpp>
Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/workaround.hpp
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing_suite/workaround.hpp 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/indexing_suite_v2/indexing_suite/workaround.hpp 2008-12-09 20:30:09 UTC (rev 1464)
@@ -11,6 +11,7 @@
// History
// =======
// 2003/10/21 rmg File creation
+// 2008/12/08 Roman Change indexing suite layout
//
// $Id: workaround.hpp,v 1.1.2.3 2003/11/17 19:27:13 raoulgough Exp $
//
Modified: pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2008-12-09 20:30:09 UTC (rev 1464)
@@ -18,7 +18,7 @@
declaration_based.declaration_based_t.__init__( self, declaration=container )
@property
- def configuration( self ):
+ def configuration( self ):
return self.declaration.indexing_suite
@property
@@ -46,12 +46,12 @@
args.append( no_proxy)
return declarations.templates.join( suite_identifier, args )
- def _create_impl(self):
+ def _create_impl(self):
return "def( %s() )" % self._create_suite_declaration()
def _get_system_headers_impl( self ):
return self.configuration.include_files
-
+
class indexing_suite2_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
def __init__(self, container ):
@@ -87,7 +87,7 @@
def _create_impl( self ):
if self.declaration.already_exposed:
return ''
-
+
answer = []
if self.does_user_disable_methods():
answer.append( self.generate_algorithm_mask() )
@@ -172,10 +172,9 @@
#if self.declaration.already_exposed:
# return ''
#This is the error to skip generation in case the class is already exposed,
- #because we still expose container, so it needs to know how to work with
+ #because we still expose container, so it needs to know how to work with
#the value_type
return self.generate_value_traits()
def _get_system_headers_impl( self ):
- return ['boost/python/suite/indexing/value_traits.hpp']
-
\ No newline at end of file
+ return ['indexing_suite/value_traits.hpp']
Modified: pyplusplus_dev/pyplusplus/code_repository/return_range.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_repository/return_range.py 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/pyplusplus/code_repository/return_range.py 2008-12-09 20:30:09 UTC (rev 1464)
@@ -25,28 +25,28 @@
#include "boost/python.hpp"
#include "boost/mpl/int.hpp"
#include "boost/function.hpp"
-#include "boost/python/suite/indexing/iterator_range.hpp"
+#include "indexing_suite/iterator_range.hpp"
#include "boost/python/object/class_detail.hpp"
#include "boost/type_traits/is_same.hpp"
namespace pyplusplus{ namespace call_policies{
namespace bpl = boost::python;
-namespace detail{
+namespace detail{
struct return_raw_data_ref{
-
- template <class T>
+
+ template <class T>
struct apply{
BOOST_STATIC_ASSERT( boost::is_pointer<T>::value );
-
+
struct type{
static bool convertible()
{ return true; }
- PyObject*
- operator()( T return_value) const{
+ PyObject*
+ operator()( T return_value) const{
if( !return_value ){
return bpl::detail::none();
}
@@ -54,7 +54,7 @@
typedef typename boost::remove_pointer< T >::type value_type;
typedef typename boost::remove_const< value_type >::type non_const_value_type;
non_const_value_type* data = const_cast<non_const_value_type*>( return_value );
- return PyCObject_FromVoidPtr( data, NULL );
+ return PyCObject_FromVoidPtr( data, NULL );
}
}
};
@@ -64,8 +64,8 @@
};
} //detail
-
-template < typename TGetSize, typename TValueType, typename TValuePolicies=bpl::default_call_policies >
+
+template < typename TGetSize, typename TValueType, typename TValuePolicies=bpl::default_call_policies >
struct return_range : bpl::default_call_policies{
typedef return_range< TGetSize, TValueType, TValuePolicies > this_type;
@@ -73,11 +73,11 @@
public:
typedef typename detail::return_raw_data_ref result_converter;
-
+
typedef TValueType value_type;
typedef TGetSize get_size_type;
typedef TValuePolicies value_policies_type;
-
+
typedef bpl::indexing::iterator_range<value_type*> range_type;
template <class ArgumentPackage>
@@ -90,16 +90,16 @@
}
value_type* raw_data = reinterpret_cast<value_type*>( PyCObject_AsVoidPtr( result ) );
Py_DECREF(result);//we don't need result anymore
-
+
bpl::tuple args_w( bpl::handle<>( bpl::borrowed( args ) ) );
register_range_class_on_demand();
-
+
get_size_type get_size;
range_type the_range( raw_data, raw_data + get_size( args_w ) );
-
+
bpl::object range_obj( the_range );
-
+
return bpl::incref( range_obj.ptr() );
}
private:
@@ -109,11 +109,11 @@
bpl::class_<range_type>( "_impl_details_range_iterator_", bpl::init<value_type*, value_type*>() )
.def(bpl::indexing::container_suite<range_type>() );
}
-
+
static void register_range_class( boost::mpl::false_ ){
//register range class with non default call policies
- unsigned long const methods_mask
- = bpl::indexing::all_methods
+ unsigned long const methods_mask
+ = bpl::indexing::all_methods
& ~( bpl::indexing::reorder_methods | bpl::indexing::search_methods ) ;
typedef bpl::indexing::iterator_range_suite< range_type, methods_mask > suite_type;
@@ -125,7 +125,7 @@
//Check the registry. If the class doesn't exist, register it.
bpl::handle<> class_obj(
bpl::objects::registered_class_object(bpl::type_id<range_type>()));
-
+
if( class_obj.get() == 0 ){
register_range_class( boost::is_same< bpl::default_call_policies, value_policies_type>() );
}
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py 2008-12-09 20:30:09 UTC (rev 1464)
@@ -34,14 +34,14 @@
containers = {
- 'vector' : "boost/python/suite/indexing/vector.hpp"
- , 'deque' : "boost/python/suite/indexing/deque.hpp"
- , 'list' : "boost/python/suite/indexing/list.hpp"
- , 'map' : "boost/python/suite/indexing/map.hpp"
- , 'multimap' : "boost/python/suite/indexing/multimap.hpp"
- , 'hash_map' : "boost/python/suite/indexing/map.hpp"
- , 'set' : "boost/python/suite/indexing/set.hpp"
- , 'hash_set' : "boost/python/suite/indexing/set.hpp"
+ 'vector' : "indexing_suite/vector.hpp"
+ , 'deque' : "indexing_suite/deque.hpp"
+ , 'list' : "indexing_suite/list.hpp"
+ , 'map' : "indexing_suite/map.hpp"
+ , 'multimap' : "indexing_suite/multimap.hpp"
+ , 'hash_map' : "indexing_suite/map.hpp"
+ , 'set' : "indexing_suite/set.hpp"
+ , 'hash_set' : "indexing_suite/set.hpp"
#TODO: queue, priority, stack, hash_multimap, multiset, hash_multiset
}
@@ -91,7 +91,7 @@
def element_type(self):
"""reference to container value_type( mapped_type ) type"""
return self.container_traits.element_type( self.container_class )
-
+
@property
def container_traits( self ):
"reference to container traits. See pygccxml documentation for more information."
@@ -174,6 +174,6 @@
self.__include_files = [] #not supported
else:
#impl details: the order of header files is IMPORTANT
- self.__include_files = [ "boost/python/suite/indexing/container_suite.hpp"
+ self.__include_files = [ "indexing_suite/container_suite.hpp"
, containers[ name ] ]
return self.__include_files
Modified: pyplusplus_dev/unittests/autoconfig.py
===================================================================
--- pyplusplus_dev/unittests/autoconfig.py 2008-12-08 21:36:39 UTC (rev 1463)
+++ pyplusplus_dev/unittests/autoconfig.py 2008-12-09 20:30:09 UTC (rev 1464)
@@ -15,16 +15,16 @@
data_directory = os.path.join( this_module_dir_path, 'data' )
build_directory = os.path.join( this_module_dir_path, 'temp' )
-build_dir = build_directory
+build_dir = build_directory
sys.path.append( os.path.dirname( this_module_dir_path ) )
-from environment import scons, boost, python, gccxml
+from environment import scons, boost, python, gccxml, indexing_suite
class scons_config:
libs = ['boost_python']
libpath = [ python.libs ] + boost.libs
- cpppath = [ boost.include, python.include ]
+ cpppath = [ boost.include, python.include, indexing_suite.include ]
include_dirs = cpppath + [data_directory]
@staticmethod
@@ -40,7 +40,7 @@
, " , SHLIBPREFIX=''"
, " , SHLIBSUFFIX='%s'" % scons.suffix #explicit better then implicit
, ")"
- , "env.AddPostAction('%(target)s', 'mt.exe -nologo -manifest %(target)s.pyd.manifest -outputresource:%(target)s.pyd;2' )" ]
+ , "env.AddPostAction('%(target)s', 'mt.exe -nologo -manifest %(target)s.pyd.manifest -outputresource:%(target)s.pyd;2' )" ]
return os.linesep.join( code )
#I need this in order to allow Python to load just compiled modules
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-08 22:55:26
|
Revision: 1463
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1463&view=rev
Author: roman_yakovenko
Date: 2008-12-08 21:36:39 +0000 (Mon, 08 Dec 2008)
Log Message:
-----------
renaming "indexing" directory to "indexing_suite"
Added Paths:
-----------
pyplusplus_dev/indexing_suite_v2/indexing_suite/
Removed Paths:
-------------
pyplusplus_dev/indexing_suite_v2/indexing/
Property changes on: pyplusplus_dev/indexing_suite_v2/indexing_suite
___________________________________________________________________
Added: svn:mergeinfo
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-12-07 11:15:08
|
Revision: 1462
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1462&view=rev
Author: roman_yakovenko
Date: 2008-12-07 11:15:01 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
commit new version from Hern?\195?\161n Ordiales
Modified Paths:
--------------
pyplusplus_dev/contrib/doc_extractors/doxygen.py
Modified: pyplusplus_dev/contrib/doc_extractors/doxygen.py
===================================================================
--- pyplusplus_dev/contrib/doc_extractors/doxygen.py 2008-11-28 17:49:30 UTC (rev 1461)
+++ pyplusplus_dev/contrib/doc_extractors/doxygen.py 2008-12-07 11:15:01 UTC (rev 1462)
@@ -8,8 +8,7 @@
class doxygen_doc_extractor:
"""
- Extracts Doxigen styled documentation from source
- or generates from description.
+ Extracts Doxygen styled documentation from source or generates it from description.
"""
def __init__(self):
#for caching source
@@ -51,60 +50,180 @@
if doc_lines:
final_doc_lines = [ line.replace("\n","\\n") for line in doc_lines[:-1] ]
final_doc_lines.append(doc_lines[-1].replace("\n",""))
- #final_doc_lines.insert(0, self.get_generic_doc(declaration))
return '\"' + ''.join(final_doc_lines) + '\"'
else:
return '\"\"'
- #return '\"'+self.get_generic_doc(declaration)+'\"'
#__call__()
- #def get_generic_doc(self, declaration):
- #"""
- #Generate call information about function or method
- #"""
- #try:
- #return "Help on %s" % str(declaration)
- #except:
- #pass
- #return ''
- ##get_generic_doc()
-
def clear_str(self, tmp_str):
"""
- Replace */! by Space and \breaf, \fn, \param, ...
+ Replace */! by space and \brief, @fn, \param, etc
"""
- clean = lambda tmp_str, sym, change2 = '': tmp_str.replace(sym, change2)
-
- tmp_str = reduce(clean, [tmp_str, '/', '*', '!', "\\brief", "\\fn",\
- "@brief", "@fn", "@ref", "\\ref", "\"", "\'", "\\c"])
-
- tmp_str = clean(tmp_str, "@param", "Param:")
- tmp_str = clean(tmp_str, "@see", "See:")
- tmp_str = clean(tmp_str, "@pre", "Pre-condition:")
- tmp_str = clean(tmp_str, "@throws", "Throws:")
- tmp_str = clean(tmp_str, "@throw", "Throw:")
- tmp_str = clean(tmp_str, "@todo", "TODO:")
- tmp_str = clean(tmp_str, "\param", "Param:")
- tmp_str = clean(tmp_str, "@ingroup", "Group")
- tmp_str = clean(tmp_str, "\ingroup", "Group")
- tmp_str = clean(tmp_str, "@return", "It return")
- tmp_str = clean(tmp_str, "\\return", "It return")
- tmp_str = clean(tmp_str, "\\warning", "Warning:")
- tmp_str = clean(tmp_str, "\\WARNING", "Warning:")
- tmp_str = clean(tmp_str, "@dot", "[Dot]")
- tmp_str = clean(tmp_str, "@enddot", "[/Dot]")
- tmp_str = clean(tmp_str, "@code", "[Code]")
- tmp_str = clean(tmp_str, "@endcode", "[/Code]")
+ tmp_str = reduce(clean, [tmp_str, '/','*','!',"\\brief","@brief","\\fn","@fn","\\ref","@ref", "\"", "\'", "\\c"])
+
+ #commands list taken form : http://www.stack.nl/~dimitri/doxygen/commands.html
+ replacement_list = [
+# "a",
+ "addindex",
+ "addtogroup",
+ "anchor",
+ "arg",
+ "attention",
+ "author",
+# "b",
+# "brief",
+ "bug",
+# "c",
+ "callgraph",
+ "callergraph",
+ "category",
+ "class",
+ ("code","[Code]"),
+ "cond",
+ "copybrief",
+ "copydetails",
+ "copydoc",
+ "date",
+ "def",
+ "defgroup",
+ "deprecated",
+ "details",
+ "dir",
+ "dontinclude",
+ ("dot","[Dot]"),
+ "dotfile",
+ "e",
+ "else",
+ "elseif",
+ "em",
+ ("endcode","[/Code]"),
+ "endcond",
+ ("enddot","[/Dot]"),
+ "endhtmlonly",
+ "endif",
+ "endlatexonly",
+ "endlink",
+ "endmanonly",
+ "endmsc",
+ "endverbatim",
+ "endxmlonly",
+ "enum",
+ "example",
+ "exception",
+ "extends",
+ "f$",
+ "f[",
+ "f]",
+ "f{",
+ "f}",
+ "file",
+# "fn",
+ "headerfile",
+ "hideinitializer",
+ "htmlinclude",
+ "htmlonly",
+ "if",
+ "ifnot",
+ "image",
+ "implements",
+ "include",
+ "includelineno",
+ "ingroup",
+ "internal",
+ "invariant",
+ "interface",
+ "latexonly",
+ "li",
+ "line",
+ "link",
+ "mainpage",
+ "manonly",
+ "memberof",
+ "msc",
+# "n",
+ "name",
+ "namespace",
+ "nosubgrouping",
+ "note",
+ "overload",
+# "p",
+ "package",
+ "page",
+ "par",
+ "paragraph",
+ "param",
+ "post",
+ "pre",
+# "private (PHP only)",
+# "privatesection (PHP only)",
+ "property",
+# "protected (PHP only)",
+# "protectedsection (PHP only)",
+ "protocol",
+# "public (PHP only)",
+# "publicsection (PHP only)",
+# "ref",
+ "relates",
+ "relatesalso",
+ "remarks",
+ "return",
+ "retval",
+ "sa",
+ "section",
+ "see",
+ "showinitializer",
+ "since",
+ "skip",
+ "skipline",
+ "struct",
+ "subpage",
+ "subsection",
+ "subsubsection",
+ "test",
+ "throw",
+ ("todo","TODO"),
+ "tparam",
+ "typedef",
+ "union",
+ "until",
+ "var",
+ "verbatim",
+ "verbinclude",
+ "version",
+ "warning",
+ "weakgroup",
+ "xmlonly",
+ "xrefitem",
+# "$",
+# "@",
+# "\",
+# "&",
+# "~",
+# "<",
+# ">",
+# "#",
+# "%",
+ ]
+
+ for command in replacement_list:
+ try:
+ old,new = command
+ except ValueError:
+ old = command
+ new = command.capitalize()+":"
+ tmp_str = clean(tmp_str, "@"+old, new)
+ tmp_str = clean(tmp_str, "\\"+old, new)
+
return tmp_str.lstrip()
#clean_str()
-
+
def is_code(self, tmp_str):
"""
- Detect if tmp_str is code
+ Detects if tmp_str is code or not
"""
try:
beg = tmp_str.lstrip()[:2]
- return beg != "//" and beg != "/*"
+ return beg != "//" and beg != "/*"
except:
pass
return False
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-11-28 17:49:34
|
Revision: 1461
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1461&view=rev
Author: roman_yakovenko
Date: 2008-11-28 17:49:30 +0000 (Fri, 28 Nov 2008)
Log Message:
-----------
Modified Paths:
--------------
pyplusplus_dev/docs/history/history.rest
Modified: pyplusplus_dev/docs/history/history.rest
===================================================================
--- pyplusplus_dev/docs/history/history.rest 2008-11-28 17:48:05 UTC (rev 1460)
+++ pyplusplus_dev/docs/history/history.rest 2008-11-28 17:49:30 UTC (rev 1461)
@@ -25,6 +25,7 @@
* Hernán Ordiales
* Bernd Fritzke
* Andrei Vermel
+* Carsten( spom.spom )
-----------
SVN Version
@@ -32,6 +33,8 @@
1. The bug related to exposing free operators was fixed. Many thanks to Andrei Vermel.
+2. Few bugs were fixed for 64Bit platform. Many thanks to Carsten.
+
-----------
Version 1.0
-----------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-11-28 17:48:10
|
Revision: 1460
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1460&view=rev
Author: roman_yakovenko
Date: 2008-11-28 17:48:05 +0000 (Fri, 28 Nov 2008)
Log Message:
-----------
fix for 64Bit issues. Thanks to Carsten for providing the patch
Modified Paths:
--------------
pyplusplus_dev/unittests/data/call_policies_to_be_exported.hpp
pyplusplus_dev/unittests/data/deepcopy_to_be_exported.hpp
Modified: pyplusplus_dev/unittests/data/call_policies_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/call_policies_to_be_exported.hpp 2008-11-27 20:38:51 UTC (rev 1459)
+++ pyplusplus_dev/unittests/data/call_policies_to_be_exported.hpp 2008-11-28 17:48:05 UTC (rev 1460)
@@ -11,7 +11,7 @@
namespace call_policies{
struct dummy{
- int id() { return int( this ); }
+ size_t id() { return (size_t)( this ); }
};
namespace return_arg{
@@ -87,7 +87,7 @@
};
struct return_range_image_t{
- return_range_image_t()
+ return_range_image_t()
: raw_data( "" )
{
raw_data += '1';
@@ -96,17 +96,17 @@
}
~return_range_image_t(){}
-
+
std::string raw_data;
-
+
const char* get_raw_data_const() const{
return raw_data.c_str();
}
-
+
char* get_raw_data(){
return &raw_data.at(0);
}
-
+
return_range_image_t* create_images(){
return_range_image_t* images = new return_range_image_t[3];
return_range_image_t x;
@@ -122,6 +122,6 @@
}
};
-}
+}
#endif//__call_policies_to_be_exported_hpp__
Modified: pyplusplus_dev/unittests/data/deepcopy_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/deepcopy_to_be_exported.hpp 2008-11-27 20:38:51 UTC (rev 1459)
+++ pyplusplus_dev/unittests/data/deepcopy_to_be_exported.hpp 2008-11-28 17:48:05 UTC (rev 1460)
@@ -12,9 +12,9 @@
struct item_t{
item_t(){
- id = reinterpret_cast< int >( this );
+ id = (size_t)( this );
}
- int id;
+ size_t id;
};
typedef std::vector< item_t > items_t;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-11-27 20:38:56
|
Revision: 1459
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1459&view=rev
Author: roman_yakovenko
Date: 2008-11-27 20:38:51 +0000 (Thu, 27 Nov 2008)
Log Message:
-----------
making indexing suite v2 functionality to be header only
Removed Paths:
-------------
pyplusplus_dev/indexing_suite_v2/src/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-11-27 20:30:32
|
Revision: 1458
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1458&view=rev
Author: roman_yakovenko
Date: 2008-11-27 20:30:22 +0000 (Thu, 27 Nov 2008)
Log Message:
-----------
making indexing suite v2 functionality to be header only
Removed Paths:
-------------
pyplusplus_dev/indexing_suite_v2/indexing/readme.txt
Deleted: pyplusplus_dev/indexing_suite_v2/indexing/readme.txt
===================================================================
--- pyplusplus_dev/indexing_suite_v2/indexing/readme.txt 2008-11-27 20:28:46 UTC (rev 1457)
+++ pyplusplus_dev/indexing_suite_v2/indexing/readme.txt 2008-11-27 20:30:22 UTC (rev 1458)
@@ -1,2 +0,0 @@
-Installation tip:
- copy the content of this directory to ".../boost/python/suite/indexing" directory.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|