[pygccxml-commit] SF.net SVN: pygccxml:[1790] pyplusplus_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2009-12-27 21:15:50
|
Revision: 1790 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1790&view=rev Author: roman_yakovenko Date: 2009-12-27 21:15:38 +0000 (Sun, 27 Dec 2009) Log Message: ----------- move "treat_char_ptr_as_binary_data" to public interface Modified Paths: -------------- pyplusplus_dev/pyplusplus/module_builder/ctypes_builder.py pyplusplus_dev/unittests/ctypes_tester.py Modified: pyplusplus_dev/pyplusplus/module_builder/ctypes_builder.py =================================================================== --- pyplusplus_dev/pyplusplus/module_builder/ctypes_builder.py 2009-12-27 21:00:38 UTC (rev 1789) +++ pyplusplus_dev/pyplusplus/module_builder/ctypes_builder.py 2009-12-27 21:15:38 UTC (rev 1790) @@ -47,6 +47,8 @@ if optimize_queries: self.run_query_optimizer() + self.__treat_char_ptr_as_binary_data = None + def __parse_declarations( self, files, gccxml_config, compilation_mode=None, cache=None ): if None is gccxml_config: gccxml_config = parser.config_t() @@ -79,12 +81,27 @@ anonymous_vars = self.global_ns.vars( '', recursive=True, allow_empty=True ) anonymous_vars.alias = '_' + def __get_treat_char_ptr_as_binary_data(self): + if self.has_code_creator(): + return self.code_creator.treat_char_ptr_as_binary_data + else: + return self.__treat_char_ptr_as_binary_data + def __set_treat_char_ptr_as_binary_data( self, value ): + self.__treat_char_ptr_as_binary_data = value + if self.has_code_creator(): + self.code_creator.treat_char_ptr_as_binary_data = value + + treat_char_ptr_as_binary_data = property( __get_treat_char_ptr_as_binary_data, __set_treat_char_ptr_as_binary_data, + doc="""If True, Py++ will generate "POINTER( char )", instead of "c_char_p" for "char*" type. By default it is False""" ) + def build_code_creator( self, library_path, doc_extractor=None ): creator = creators_factory.ctypes_creator_t( self.global_ns , library_path , self.__blob2decl ) self.__code_creator = creator.create() self.__code_creator.update_documentation( doc_extractor ) + if self.__treat_char_ptr_as_binary_data != None: + self.__code_creator.treat_char_ptr_as_binary_data = self.__treat_char_ptr_as_binary_data return self.__code_creator @property Modified: pyplusplus_dev/unittests/ctypes_tester.py =================================================================== --- pyplusplus_dev/unittests/ctypes_tester.py 2009-12-27 21:00:38 UTC (rev 1789) +++ pyplusplus_dev/unittests/ctypes_tester.py 2009-12-27 21:15:38 UTC (rev 1790) @@ -49,9 +49,6 @@ def customize(self, mb ): pass - def customize_cc( self, mb ): - pass - def __build_scons_cmd( self ): cmd = autoconfig.scons.cmd_build + ' ' + self.base_name if autoconfig.cxx_parsers_cfg.gccxml.compiler == 'msvc71': @@ -71,7 +68,6 @@ mb = ctypes_module_builder_t( [self.header], self.symbols_file, autoconfig.cxx_parsers_cfg.gccxml ) self.customize( mb ) mb.build_code_creator( self.library_file ) - self.customize_cc( mb ) mb.write_module( os.path.join( self.project_dir, 'binaries', self.base_name + '.py' ) ) sys.path.insert( 0, os.path.join( self.project_dir, 'binaries' ) ) __import__( self.base_name ) @@ -221,8 +217,8 @@ def __init__( self, *args, **keywd ): ctypes_base_tester_t.__init__( self, 'char_ptr_as_binary_data', *args, **keywd ) - def customize_cc( self, mb ): - mb.code_creator.treat_char_ptr_as_binary_data = True + def customize( self, mb ): + mb.treat_char_ptr_as_binary_data = True def test(self): data = self.module_ref.get_empty() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |