Exemplo n.º 1
0
 def args_declaration(self):
     args = self.controller.wrapper_args[:]
     if self.controller.inst_arg:
         args.insert(0, self.controller.inst_arg)
     arg_utils = calldef_utils.argument_utils_t(
         self.declaration, algorithm.make_id_creator(self), args)
     return arg_utils.args_declaration()
Exemplo n.º 2
0
 def args_declaration( self ):
     args = self.controller.wrapper_args[:]
     if self.controller.inst_arg:
         args.insert( 0, self.controller.inst_arg )
     arg_utils = calldef_utils.argument_utils_t( 
                       self.declaration
                     , algorithm.make_id_creator( self )
                     , args )
     return arg_utils.args_declaration()
Exemplo n.º 3
0
    def create_override(self):
        cntrl = self.controller.override_controller

        tmpl_values = dict()
        tmpl_values['return_type'] = self.declaration.return_type.decl_string
        tmpl_values['function_name'] = self.declaration.name
        tmpl_values['arg_declarations'] = self.args_override_declaration()
        tmpl_values['constness'] = ''
        if self.declaration.has_const:
            tmpl_values['constness'] = ' const '
        tmpl_values['throw'] = self.throw_specifier_code()
        tmpl_values['py_function_var'] = cntrl.py_function_var
        tmpl_values['function_alias'] = self.declaration.alias
        tmpl_values['declare_py_variables'] \
            = os.linesep + os.linesep.join( map( lambda var: self.indent( var.declare_var_string(), 2 )
                                                 , cntrl.py_variables ) )

        tmpl_values['py_pre_call'] = os.linesep + self.indent(
            os.linesep.join(cntrl.py_pre_call), 2)
        tmpl_values['py_post_call'] = os.linesep + self.indent(
            os.linesep.join(cntrl.py_post_call), 2)
        tmpl_values['py_arg_expressions'] = ''
        if cntrl.py_arg_expressions:
            tmpl_values['py_arg_expressions'] \
                = ', ' + self.PARAM_SEPARATOR.join( cntrl.py_arg_expressions )

        tmpl_values[
            'save_py_result'] = "bpl::object %s = " % cntrl.py_result_variable.name
        tmpl_values['py_return'] = ''
        tmpl_values['cpp_return'] = ''
        if not declarations.is_void(self.declaration.return_type):
            tmpl_values['py_return'] \
                = 'return bpl::extract< %(type)s >( pyplus_conv::get_out_argument( %(py_result)s, 0 ) );' \
                  % { 'type' : self.declaration.return_type.decl_string
                    , 'py_result' : cntrl.py_result_variable.name }
            tmpl_values['cpp_return'] = 'return '

        tmpl_values['wrapped_class'] = self.wrapped_class_identifier()

        arg_utils = calldef_utils.argument_utils_t(
            self.declaration, algorithm.make_id_creator(self),
            self.declaration.arguments)
        tmpl_values['cpp_arg_expressions'] = arg_utils.call_args()

        f_def_code = cntrl.template.substitute(tmpl_values)
        return remove_duplicate_linesep(f_def_code)
Exemplo n.º 4
0
    def create_override(self):
        cntrl = self.controller.override_controller       
        
        tmpl_values = dict()
        tmpl_values['return_type' ] = self.declaration.return_type.decl_string 
        tmpl_values['function_name'] = self.declaration.name
        tmpl_values['arg_declarations'] = self.args_override_declaration()
        tmpl_values['constness'] = ''
        if self.declaration.has_const:
            tmpl_values['constness'] = ' const '
        tmpl_values['throw'] = self.throw_specifier_code()        
        tmpl_values['py_function_var'] = cntrl.py_function_var
        tmpl_values['function_alias'] = self.declaration.alias
        tmpl_values['declare_py_variables'] \
            = os.linesep + os.linesep.join( map( lambda var: self.indent( var.declare_var_string(), 2 )
                                                 , cntrl.py_variables ) )

        tmpl_values['py_pre_call'] = os.linesep + self.indent( os.linesep.join( cntrl.py_pre_call ), 2 )
        tmpl_values['py_post_call'] = os.linesep + self.indent( os.linesep.join( cntrl.py_post_call ), 2 )
        tmpl_values['py_arg_expressions'] = ''
        if cntrl.py_arg_expressions:
            tmpl_values['py_arg_expressions'] \
                = ', ' + self.PARAM_SEPARATOR.join( cntrl.py_arg_expressions )
            
        tmpl_values['save_py_result'] = "bpl::object %s = " % cntrl.py_result_variable.name
        tmpl_values['py_return'] = ''
        tmpl_values['cpp_return'] = ''
        if not declarations.is_void( self.declaration.return_type ):
            tmpl_values['py_return'] \
                = 'return bpl::extract< %(type)s >( pyplus_conv::get_out_argument( %(py_result)s, 0 ) );' \
                  % { 'type' : self.declaration.return_type.decl_string
                    , 'py_result' : cntrl.py_result_variable.name }
            tmpl_values['cpp_return'] = 'return '

        tmpl_values['wrapped_class'] = self.wrapped_class_identifier()

        arg_utils = calldef_utils.argument_utils_t( self.declaration
                                                   , algorithm.make_id_creator( self )
                                                   , self.declaration.arguments )
        tmpl_values['cpp_arg_expressions'] = arg_utils.call_args()

        f_def_code = cntrl.template.substitute(tmpl_values)
        return remove_duplicate_linesep( f_def_code )
Exemplo n.º 5
0
 def args_default_declaration(self):
     cntrl = self.controller.default_controller
     arg_utils = calldef_utils.argument_utils_t(
         self.declaration, algorithm.make_id_creator(self),
         [cntrl.inst_arg] + cntrl.wrapper_args)
     return arg_utils.args_declaration()
Exemplo n.º 6
0
 def args_declaration(self):
     arg_utils = calldef_utils.argument_utils_t(
         self.declaration, algorithm.make_id_creator(self),
         self.controller.wrapper_args)
     return arg_utils.args_declaration()
Exemplo n.º 7
0
 def args_default_declaration( self ):
     cntrl = self.controller.default_controller
     arg_utils = calldef_utils.argument_utils_t( self.declaration
                                                 , algorithm.make_id_creator( self )
                                                 , [cntrl.inst_arg] + cntrl.wrapper_args )
     return arg_utils.args_declaration()
Exemplo n.º 8
0
 def args_declaration( self ):
     arg_utils = calldef_utils.argument_utils_t( 
                       self.declaration
                     , algorithm.make_id_creator( self )
                     , self.controller.wrapper_args )
     return arg_utils.args_declaration()