2 // Include fundamental fragemt definitions
3 %include <typemaps/fragments.swg>
5 // Look for user fragments file.
6 %include <octfragments.swg>
8 // Octave fragments for primitive types
9 %include <octprimtypes.swg>
11 // Octave fragments for char* strings
12 //%include <octstrings.swg>
15 #ifndef SWIG_DIRECTOR_TYPEMAPS
16 #define SWIG_DIRECTOR_TYPEMAPS
20 #define SWIG_Object octave_value
21 #define VOID_Object octave_value()
24 // Octave allows implicit conversion
25 #define %implicitconv_flag $implicitconv
29 #define SWIG_AppendOutput(result, obj) SWIG_Octave_AppendOutput(result, obj)
32 #define SWIG_SetConstant(name, obj) SWIG_Octave_SetConstant(module_ns,name,obj)
35 #define SWIG_Octave_Raise(OBJ, TYPE, DESC) error("C++ side threw an exception of type " TYPE)
36 #define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type, desc)
38 // Include the unified typemap library
39 %include <typemaps/swigtypemaps.swg>
42 %typemap(constcode,noblock=1) int double {
43 SWIG_Octave_SetConstant(module_ns,"$symname",octave_value($value));
46 %typecheck(SWIG_TYPECHECK_SWIGOBJECT) SWIG_Object "$1 = (*$input).is_defined();";
47 %typecheck(SWIG_TYPECHECK_SWIGOBJECT) octave_value_list "$1 = true;";
49 %typemap(in) (octave_value_list varargs,...) {
50 for (int j=$argnum-1;j<args.length();++j)
53 %typecheck(2000) (octave_value_list varargs,...) {
57 %typemap(in) (const octave_value_list& varargs,...) (octave_value_list tmp) {
58 for (int j=$argnum-1;j<args.length();++j)
62 %typecheck(2000) (const octave_value_list& varargs,...) {
66 %typemap(out) octave_value_list {
69 %typemap(out,noblock=1) Octave_map {
72 %typemap(out,noblock=1) NDArray {
75 %typemap(out,noblock=1) Cell {
81 %typemap(out,noblock=1) const SWIGTYPE & SMARTPOINTER {
82 $result = SWIG_NewPointerObj(%new_copy(*$1, $*ltype), $descriptor, SWIG_POINTER_OWN | %newpointer_flags);
85 %typemap(ret) const SWIGTYPE & SMARTPOINTER, SWIGTYPE SMARTPOINTER {
86 octave_swig_type* lobj=Swig::swig_value_deref($result);
88 std::list<octave_value_list> idx;
89 idx.push_back(octave_value("__deref__"));
90 idx.push_back(octave_value_list());
91 octave_value_list ovl(lobj->subsref(".(",idx));
92 octave_swig_type* robj=ovl.length()>=1?Swig::swig_value_deref(ovl(0)):0;
93 if (robj && !error_state)