Skip to content

Commit

Permalink
One more step to make 'vector' example work for Scilab
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Couvert committed Apr 10, 2012
1 parent b5d0f09 commit f216289
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Lib/scilab/scicontainer.swg
Expand Up @@ -30,7 +30,7 @@
# endif
#endif

%include <pyiterators.swg>
%include <sciiterators.swg>

/**** The PySequence C++ Wrap ***/

Expand Down Expand Up @@ -539,8 +539,8 @@ namespace swig

%typemap(out,noblock=1,fragment="SwigPySequence_Cont")
iterator, reverse_iterator, const_iterator, const_reverse_iterator {
$result = SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
$result = SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
}
%typemap(out,noblock=1,fragment="SwigPySequence_Cont")
std::pair<iterator, iterator>, std::pair<const_iterator, const_iterator> {
Expand Down Expand Up @@ -592,15 +592,15 @@ namespace swig
%extend {
swig::SwigPyIterator* iterator(PyObject **PYTHON_SELF) {
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
}
}

#if defined(SWIGPYTHON_BUILTIN)
%feature("python:slot", "tp_iter", functype="getiterfunc") iterator;
#else
%pythoncode {def __iter__(self): return self.iterator()}
// TODO
//%scilabcode {def __iter__(self): return self.iterator()}
#endif
}

#endif //SWIG_EXPORT_ITERATOR_METHODS
%enddef

Expand Down Expand Up @@ -636,8 +636,8 @@ namespace swig


%define %swig_sequence_methods_common(Sequence...)
%swig_sequence_iterator(%arg(Sequence))
%swig_container_methods(%arg(Sequence))
%swig_sequence_iterator(%arg(Sequence))
%swig_container_methods(%arg(Sequence))

%fragment("SwigPySequence_Base");

Expand Down

0 comments on commit f216289

Please sign in to comment.