summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
Diffstat (limited to 'Examples')
-rw-r--r--Examples/Makefile.in30
-rw-r--r--Examples/octave/callback/Makefile21
-rw-r--r--Examples/octave/callback/example.cxx4
-rw-r--r--Examples/octave/callback/example.h23
-rw-r--r--Examples/octave/callback/example.i13
-rw-r--r--Examples/octave/callback/runme.m63
-rw-r--r--Examples/octave/check.list16
-rw-r--r--Examples/octave/class/Makefile21
-rw-r--r--Examples/octave/class/example.cxx28
-rw-r--r--Examples/octave/class/example.h39
-rw-r--r--Examples/octave/class/example.i10
-rw-r--r--Examples/octave/class/runme.m52
-rw-r--r--Examples/octave/constants/Makefile21
-rw-r--r--Examples/octave/constants/example.i27
-rw-r--r--Examples/octave/constants/runme.m29
-rw-r--r--Examples/octave/contract/Makefile21
-rw-r--r--Examples/octave/contract/example.c23
-rw-r--r--Examples/octave/contract/example.i21
-rw-r--r--Examples/octave/contract/runme.m22
-rw-r--r--Examples/octave/enum/Makefile21
-rw-r--r--Examples/octave/enum/example.cxx37
-rw-r--r--Examples/octave/enum/example.h13
-rw-r--r--Examples/octave/enum/example.i11
-rw-r--r--Examples/octave/enum/runme.m32
-rw-r--r--Examples/octave/extend/Makefile21
-rw-r--r--Examples/octave/extend/example.cxx4
-rw-r--r--Examples/octave/extend/example.h56
-rw-r--r--Examples/octave/extend/example.i15
-rw-r--r--Examples/octave/extend/runme.m74
-rw-r--r--Examples/octave/funcptr/Makefile21
-rw-r--r--Examples/octave/funcptr/example.c19
-rw-r--r--Examples/octave/funcptr/example.h9
-rw-r--r--Examples/octave/funcptr/example.i16
-rw-r--r--Examples/octave/funcptr/runme.m21
-rw-r--r--Examples/octave/funcptr2/Makefile21
-rw-r--r--Examples/octave/funcptr2/example.c19
-rw-r--r--Examples/octave/funcptr2/example.h9
-rw-r--r--Examples/octave/funcptr2/example.i18
-rw-r--r--Examples/octave/funcptr2/runme.m24
-rw-r--r--Examples/octave/functor/Makefile21
-rw-r--r--Examples/octave/functor/example.i29
-rw-r--r--Examples/octave/functor/runme.m18
-rw-r--r--Examples/octave/operator/Makefile21
-rw-r--r--Examples/octave/operator/example.h36
-rw-r--r--Examples/octave/operator/example.i24
-rw-r--r--Examples/octave/operator/runme.m24
-rw-r--r--Examples/octave/pointer/Makefile21
-rw-r--r--Examples/octave/pointer/example.c16
-rw-r--r--Examples/octave/pointer/example.i30
-rw-r--r--Examples/octave/pointer/runme.m42
-rw-r--r--Examples/octave/reference/Makefile21
-rw-r--r--Examples/octave/reference/example.cxx46
-rw-r--r--Examples/octave/reference/example.h26
-rw-r--r--Examples/octave/reference/example.i48
-rw-r--r--Examples/octave/reference/runme.m63
-rw-r--r--Examples/octave/simple/Makefile21
-rw-r--r--Examples/octave/simple/example.c18
-rw-r--r--Examples/octave/simple/example.i7
-rw-r--r--Examples/octave/simple/runme.m22
-rw-r--r--Examples/octave/template/Makefile21
-rw-r--r--Examples/octave/template/example.h32
-rw-r--r--Examples/octave/template/example.i17
-rw-r--r--Examples/octave/template/runme.m37
-rw-r--r--Examples/octave/variables/Makefile21
-rw-r--r--Examples/octave/variables/example.c91
-rw-r--r--Examples/octave/variables/example.h6
-rw-r--r--Examples/octave/variables/example.i53
-rw-r--r--Examples/octave/variables/runme.m75
-rw-r--r--Examples/test-suite/constructor_copy.i2
-rw-r--r--Examples/test-suite/minherit.i2
-rw-r--r--Examples/test-suite/octave/Makefile.in82
-rw-r--r--Examples/test-suite/octave/abstract_access_runme.m7
-rw-r--r--Examples/test-suite/octave/abstract_typedef2_runme.m8
-rw-r--r--Examples/test-suite/octave/abstract_typedef_runme.m12
-rw-r--r--Examples/test-suite/octave/abstract_virtual_runme.m7
-rw-r--r--Examples/test-suite/octave/argcargvtest_runme.m29
-rw-r--r--Examples/test-suite/octave/array_member_runme.m25
-rw-r--r--Examples/test-suite/octave/arrays_global_runme.m18
-rw-r--r--Examples/test-suite/octave/callback_runme.m40
-rw-r--r--Examples/test-suite/octave/class_ignore_runme.m7
-rw-r--r--Examples/test-suite/octave/class_scope_weird_runme.m7
-rw-r--r--Examples/test-suite/octave/compactdefaultargs_runme.m24
-rw-r--r--Examples/test-suite/octave/complextest_runme.m19
-rw-r--r--Examples/test-suite/octave/constover_runme.m34
-rw-r--r--Examples/test-suite/octave/constructor_copy_runme.m44
-rw-r--r--Examples/test-suite/octave/contract_runme.m135
-rw-r--r--Examples/test-suite/octave/cpp_enum_runme.m27
-rw-r--r--Examples/test-suite/octave/cpp_namespace_runme.m55
-rw-r--r--Examples/test-suite/octave/default_args_runme.m86
-rw-r--r--Examples/test-suite/octave/default_constructor_runme.m111
-rw-r--r--Examples/test-suite/octave/director_abstract_runme.m44
-rw-r--r--Examples/test-suite/octave/director_basic_runme.m110
-rw-r--r--Examples/test-suite/octave/director_classic_runme.m98
-rw-r--r--Examples/test-suite/octave/director_default_runme.m10
-rw-r--r--Examples/test-suite/octave/director_detect_runme.m36
-rw-r--r--Examples/test-suite/octave/director_enum_runme.m10
-rw-r--r--Examples/test-suite/octave/director_exception_runme.m57
-rw-r--r--Examples/test-suite/octave/director_extend_runme.m12
-rw-r--r--Examples/test-suite/octave/director_finalizer_runme.m56
-rw-r--r--Examples/test-suite/octave/director_frob_runme.m9
-rw-r--r--Examples/test-suite/octave/director_nested_runme.m39
-rw-r--r--Examples/test-suite/octave/director_stl_runme.m31
-rw-r--r--Examples/test-suite/octave/director_string_runme.m27
-rw-r--r--Examples/test-suite/octave/director_unroll_runme.m16
-rw-r--r--Examples/test-suite/octave/director_wstring_runme.m21
-rw-r--r--Examples/test-suite/octave/dynamic_cast_runme.m14
-rw-r--r--Examples/test-suite/octave/empty_runme.m1
-rw-r--r--Examples/test-suite/octave/enum_template_runme.m13
-rw-r--r--Examples/test-suite/octave/enums_runme.m7
-rw-r--r--Examples/test-suite/octave/exception_order_runme.m45
-rw-r--r--Examples/test-suite/octave/extend_placement_runme.m46
-rw-r--r--Examples/test-suite/octave/extend_template_ns_runme.m10
-rw-r--r--Examples/test-suite/octave/extend_template_runme.m10
-rw-r--r--Examples/test-suite/octave/extend_variable_runme.m6
-rw-r--r--Examples/test-suite/octave/file_test_runme.m9
-rw-r--r--Examples/test-suite/octave/friends_runme.m46
-rw-r--r--Examples/test-suite/octave/fvirtual_runme.m10
-rw-r--r--Examples/test-suite/octave/global_ns_arg_runme.m5
-rw-r--r--Examples/test-suite/octave/grouping_runme.m15
-rwxr-xr-xExamples/test-suite/octave/iadd_runme.m10
-rw-r--r--Examples/test-suite/octave/import_nomodule_runme.m8
-rw-r--r--Examples/test-suite/octave/imports_runme.m19
-rw-r--r--Examples/test-suite/octave/inctest_runme.m24
-rw-r--r--Examples/test-suite/octave/inherit_missing_runme.m22
-rw-r--r--Examples/test-suite/octave/inout_runme.m27
-rw-r--r--Examples/test-suite/octave/inplaceadd_runme.m24
-rw-r--r--Examples/test-suite/octave/input_runme.m22
-rw-r--r--Examples/test-suite/octave/langobj_runme.m12
-rw-r--r--Examples/test-suite/octave/li_attribute_runme.m57
-rw-r--r--Examples/test-suite/octave/li_boost_shared_ptr_runme.m478
-rw-r--r--Examples/test-suite/octave/li_carrays_runme.m10
-rw-r--r--Examples/test-suite/octave/li_cmalloc_runme.m17
-rw-r--r--Examples/test-suite/octave/li_cpointer_runme.m12
-rw-r--r--Examples/test-suite/octave/li_cstring_runme.m39
-rw-r--r--Examples/test-suite/octave/li_cwstring_runme.m38
-rw-r--r--Examples/test-suite/octave/li_factory_runme.m13
-rw-r--r--Examples/test-suite/octave/li_implicit_runme.m20
-rw-r--r--Examples/test-suite/octave/li_std_carray_runme.m52
-rw-r--r--Examples/test-suite/octave/li_std_map_runme.m61
-rw-r--r--Examples/test-suite/octave/li_std_pair.i210
-rw-r--r--Examples/test-suite/octave/li_std_pair_runme.m69
-rw-r--r--Examples/test-suite/octave/li_std_set_runme.m96
-rw-r--r--Examples/test-suite/octave/li_std_stream_runme.m13
-rw-r--r--Examples/test-suite/octave/li_std_string_runme.m162
-rw-r--r--Examples/test-suite/octave/li_std_vector_runme.m160
-rw-r--r--Examples/test-suite/octave/li_std_wstream_runme.m14
-rw-r--r--Examples/test-suite/octave/li_std_wstring_runme.m90
-rw-r--r--Examples/test-suite/octave/member_pointer_runme.m45
-rw-r--r--Examples/test-suite/octave/minherit_runme.m86
-rw-r--r--Examples/test-suite/octave/mod_runme.m7
-rw-r--r--Examples/test-suite/octave/multi_import_runme.m24
-rw-r--r--Examples/test-suite/octave/namespace_class_runme.m39
-rw-r--r--Examples/test-suite/octave/namespace_typemap_runme.m106
-rw-r--r--Examples/test-suite/octave/namespace_virtual_method_runme.m4
-rw-r--r--Examples/test-suite/octave/naturalvar_runme.m14
-rw-r--r--Examples/test-suite/octave/nondynamic_runme.m36
-rwxr-xr-xExamples/test-suite/octave/overload_complicated_runme.m58
-rw-r--r--Examples/test-suite/octave/overload_copy_runme.m3
-rw-r--r--Examples/test-suite/octave/overload_extend_runme.m19
-rw-r--r--Examples/test-suite/octave/overload_extendc_runme.m30
-rw-r--r--Examples/test-suite/octave/overload_rename_runme.m8
-rw-r--r--Examples/test-suite/octave/overload_simple_cast_runme.m229
-rw-r--r--Examples/test-suite/octave/overload_simple_runme.m125
-rw-r--r--Examples/test-suite/octave/overload_subtype_runme.m13
-rw-r--r--Examples/test-suite/octave/overload_template_fast_runme.m188
-rw-r--r--Examples/test-suite/octave/overload_template_runme.m184
-rw-r--r--Examples/test-suite/octave/preproc_runme.m18
-rw-r--r--Examples/test-suite/octave/primitive_ref_runme.m53
-rw-r--r--Examples/test-suite/octave/primitive_types_runme.m402
-rw-r--r--Examples/test-suite/octave/profiletest_runme.m32
-rw-r--r--Examples/test-suite/octave/refcount_runme.m34
-rw-r--r--Examples/test-suite/octave/reference_global_vars_runme.m91
-rw-r--r--Examples/test-suite/octave/rename_scope_runme.m15
-rw-r--r--Examples/test-suite/octave/ret_by_value_runme.m10
-rw-r--r--Examples/test-suite/octave/return_const_value_runme.m11
-rw-r--r--Examples/test-suite/octave/smart_pointer_extend_runme.m41
-rw-r--r--Examples/test-suite/octave/smart_pointer_member_runme.m39
-rw-r--r--Examples/test-suite/octave/smart_pointer_multi_runme.m17
-rw-r--r--Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m18
-rw-r--r--Examples/test-suite/octave/smart_pointer_not_runme.m42
-rw-r--r--Examples/test-suite/octave/smart_pointer_overload_runme.m27
-rw-r--r--Examples/test-suite/octave/smart_pointer_rename_runme.m17
-rw-r--r--Examples/test-suite/octave/smart_pointer_simple_runme.m15
-rw-r--r--Examples/test-suite/octave/smart_pointer_templatevariables_runme.m19
-rw-r--r--Examples/test-suite/octave/smart_pointer_typedef_runme.m15
-rw-r--r--Examples/test-suite/octave/sneaky1_runme.m5
-rw-r--r--Examples/test-suite/octave/static_const_member_2_runme.m18
-rw-r--r--Examples/test-suite/octave/std_containers_runme.m135
-rw-r--r--Examples/test-suite/octave/struct_rename_runme.m4
-rw-r--r--Examples/test-suite/octave/struct_value_runme.m13
-rw-r--r--Examples/test-suite/octave/swigobject_runme.m28
-rw-r--r--Examples/test-suite/octave/template_construct_runme.m1
-rw-r--r--Examples/test-suite/octave/template_default_arg_runme.m117
-rw-r--r--Examples/test-suite/octave/template_extend1_runme.m12
-rw-r--r--Examples/test-suite/octave/template_extend2_runme.m12
-rw-r--r--Examples/test-suite/octave/template_inherit_runme.m68
-rw-r--r--Examples/test-suite/octave/template_matrix_runme.m6
-rw-r--r--Examples/test-suite/octave/template_ns4_runme.m6
-rw-r--r--Examples/test-suite/octave/template_ns_runme.m21
-rw-r--r--Examples/test-suite/octave/template_opaque_runme.m7
-rw-r--r--Examples/test-suite/octave/template_ref_type_runme.m5
-rw-r--r--Examples/test-suite/octave/template_rename_runme.m12
-rw-r--r--Examples/test-suite/octave/template_static_runme.m3
-rw-r--r--Examples/test-suite/octave/template_tbase_template_runme.m6
-rw-r--r--Examples/test-suite/octave/template_type_namespace_runme.m7
-rw-r--r--Examples/test-suite/octave/template_typedef_cplx2_runme.m103
-rw-r--r--Examples/test-suite/octave/template_typedef_cplx3_runme.m34
-rw-r--r--Examples/test-suite/octave/template_typedef_cplx4_runme.m33
-rw-r--r--Examples/test-suite/octave/template_typedef_cplx_runme.m92
-rw-r--r--Examples/test-suite/octave/template_typedef_import_runme.m34
-rw-r--r--Examples/test-suite/octave/template_typedef_runme.m51
-rw-r--r--Examples/test-suite/octave/typedef_class_runme.m7
-rw-r--r--Examples/test-suite/octave/typedef_inherit_runme.m27
-rw-r--r--Examples/test-suite/octave/typedef_scope_runme.m14
-rw-r--r--Examples/test-suite/octave/typemap_namespace_runme.m10
-rw-r--r--Examples/test-suite/octave/typemap_ns_using_runme.m5
-rw-r--r--Examples/test-suite/octave/typename_runme.m13
-rw-r--r--Examples/test-suite/octave/types_directive_runme.m15
-rw-r--r--Examples/test-suite/octave/unions_runme.m49
-rw-r--r--Examples/test-suite/octave/using1_runme.m5
-rw-r--r--Examples/test-suite/octave/using2_runme.m5
-rw-r--r--Examples/test-suite/octave/using_composition_runme.m43
-rw-r--r--Examples/test-suite/octave/using_extend_runme.m27
-rw-r--r--Examples/test-suite/octave/using_inherit_runme.m61
-rw-r--r--Examples/test-suite/octave/using_private_runme.m16
-rw-r--r--Examples/test-suite/octave/using_protected_runme.m8
-rw-r--r--Examples/test-suite/octave/varargs_runme.m23
-rw-r--r--Examples/test-suite/octave/virtual_derivation_runme.m9
-rw-r--r--Examples/test-suite/octave/virtual_poly_runme.m44
-rw-r--r--Examples/test-suite/octave/voidtest_runme.m38
-rw-r--r--Examples/test-suite/octave/wrapmacro_runme.m8
231 files changed, 8617 insertions, 2 deletions
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index ee1f46f76..006d24525 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -274,6 +274,36 @@ python_clean:
rm -f *.@OBJEXT@ *@SO@ *@PYTHON_SO@
##################################################################
+##### OCTAVE ######
+##################################################################
+
+# Make sure these locate your Octave installation
+OCTAVE_INCLUDE= $(DEFS) @OCTAVEEXT@
+OCTAVE_LIB =
+
+# Extra Octave specific dynamic linking options
+OCTAVE_DLNK = @OCTAVEDYNAMICLINKING@
+OCTAVE_SO = @OCTAVE_SO@
+
+# -----------------------------------------------------------------
+# Build a C++ dynamically loadable module
+# -----------------------------------------------------------------
+
+octave_cpp: $(SRCS)
+ $(SWIG) -c++ -octave $(SWIGOPT) $(INTERFACE)
+ $(CXX) -g -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) -I$(OCTAVE_INCLUDE)
+ $(CXXSHARED) -g $(CFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
+
+# -----------------------------------------------------------------
+# Cleaning the octave examples
+# -----------------------------------------------------------------
+
+octave_clean:
+ rm -f *_wrap* *~ .~* myoctave@EXEEXT@ *.pyc
+ rm -f core @EXTRA_CLEAN@
+ rm -f *.@OBJEXT@ *@SO@ *@OCTAVE_SO@
+
+##################################################################
##### GUILE ######
##################################################################
diff --git a/Examples/octave/callback/Makefile b/Examples/octave/callback/Makefile
new file mode 100644
index 000000000..2bce9df5d
--- /dev/null
+++ b/Examples/octave/callback/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.cxx
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/callback/example.cxx b/Examples/octave/callback/example.cxx
new file mode 100644
index 000000000..450d75608
--- /dev/null
+++ b/Examples/octave/callback/example.cxx
@@ -0,0 +1,4 @@
+/* File : example.cxx */
+
+#include "example.h"
+
diff --git a/Examples/octave/callback/example.h b/Examples/octave/callback/example.h
new file mode 100644
index 000000000..1a0e8c432
--- /dev/null
+++ b/Examples/octave/callback/example.h
@@ -0,0 +1,23 @@
+/* File : example.h */
+
+#include <cstdio>
+#include <iostream>
+
+class Callback {
+public:
+ virtual ~Callback() { std::cout << "Callback::~Callback()" << std:: endl; }
+ virtual void run() { std::cout << "Callback::run()" << std::endl; }
+};
+
+
+class Caller {
+private:
+ Callback *_callback;
+public:
+ Caller(): _callback(0) {}
+ ~Caller() { delCallback(); }
+ void delCallback() { delete _callback; _callback = 0; }
+ void setCallback(Callback *cb) { delCallback(); _callback = cb; }
+ void call() { if (_callback) _callback->run(); }
+};
+
diff --git a/Examples/octave/callback/example.i b/Examples/octave/callback/example.i
new file mode 100644
index 000000000..90beda01a
--- /dev/null
+++ b/Examples/octave/callback/example.i
@@ -0,0 +1,13 @@
+/* File : example.i */
+%module(directors="1") example
+%{
+#include "example.h"
+%}
+
+%include "std_string.i"
+
+/* turn on director wrapping Callback */
+%feature("director") Callback;
+
+%include "example.h"
+
diff --git a/Examples/octave/callback/runme.m b/Examples/octave/callback/runme.m
new file mode 100644
index 000000000..b87925e3d
--- /dev/null
+++ b/Examples/octave/callback/runme.m
@@ -0,0 +1,63 @@
+# file: runme.m
+
+# This file illustrates the cross language polymorphism using directors.
+
+example
+
+OctCallback=@() subclass(example.Callback(), \
+ 'run',@(self) printf("OctCallback.run()\n"));
+
+# Create an Caller instance
+
+caller = example.Caller();
+
+# Add a simple C++ callback (caller owns the callback, so
+# we disown it first)
+
+printf("Adding and calling a normal C++ callback\n");
+printf("----------------------------------------\n");
+
+callback = example.Callback().__disown();
+caller.setCallback(callback);
+caller.call();
+caller.delCallback();
+
+printf("Adding and calling a Octave callback\n");
+printf("------------------------------------\n");
+
+# Add a Octave callback (caller owns the callback, so we
+# disown it first by calling __disown).
+
+caller.setCallback(OctCallback().__disown())
+caller.call();
+caller.delCallback();
+
+printf("Adding and calling another Octave callback\n");
+printf("------------------------------------------\n");
+
+# Let's do the same but use the weak reference this time.
+
+callback = OctCallback().__disown();
+caller.setCallback(callback);
+caller.call();
+caller.delCallback();
+
+# careful-- using callback here may cause problems; octave_swig_type still
+# exists, but is holding a destroyed object (the C++ example.Callback).
+# to manually drop the octave-side reference, you can use
+clear callback;
+
+# Let's call them directly now
+
+printf("Calling Octave and C++ callbacks directly\n");
+printf("------------------------------------------\n");
+
+a = OctCallback();
+a.run();
+a.Callback.run();
+
+
+# All done.
+
+printf("octave exit\n");
+
diff --git a/Examples/octave/check.list b/Examples/octave/check.list
new file mode 100644
index 000000000..1e6608151
--- /dev/null
+++ b/Examples/octave/check.list
@@ -0,0 +1,16 @@
+# see top-level Makefile.in
+callback
+class
+constants
+contract
+enum
+extend
+funcptr
+funcptr2
+functor
+operator
+pointer
+reference
+simple
+template
+variables
diff --git a/Examples/octave/class/Makefile b/Examples/octave/class/Makefile
new file mode 100644
index 000000000..2bce9df5d
--- /dev/null
+++ b/Examples/octave/class/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.cxx
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/class/example.cxx b/Examples/octave/class/example.cxx
new file mode 100644
index 000000000..1e8e203dd
--- /dev/null
+++ b/Examples/octave/class/example.cxx
@@ -0,0 +1,28 @@
+/* File : example.c */
+
+#include "example.h"
+#define M_PI 3.14159265358979323846
+
+/* Move the shape to a new location */
+void Shape::move(double dx, double dy) {
+ x += dx;
+ y += dy;
+}
+
+int Shape::nshapes = 0;
+
+double Circle::area(void) {
+ return M_PI*radius*radius;
+}
+
+double Circle::perimeter(void) {
+ return 2*M_PI*radius;
+}
+
+double Square::area(void) {
+ return width*width;
+}
+
+double Square::perimeter(void) {
+ return 4*width;
+}
diff --git a/Examples/octave/class/example.h b/Examples/octave/class/example.h
new file mode 100644
index 000000000..46d901361
--- /dev/null
+++ b/Examples/octave/class/example.h
@@ -0,0 +1,39 @@
+/* File : example.h */
+
+class Shape {
+public:
+ Shape() {
+ nshapes++;
+ }
+ virtual ~Shape() {
+ nshapes--;
+ };
+ double x, y;
+ void move(double dx, double dy);
+ virtual double area(void) = 0;
+ virtual double perimeter(void) = 0;
+ static int nshapes;
+};
+
+class Circle : public Shape {
+private:
+ double radius;
+public:
+ Circle(double r) : radius(r) { };
+ virtual double area(void);
+ virtual double perimeter(void);
+};
+
+class Square : public Shape {
+private:
+ double width;
+public:
+ Square(double w) : width(w) { };
+ virtual double area(void);
+ virtual double perimeter(void);
+};
+
+
+
+
+
diff --git a/Examples/octave/class/example.i b/Examples/octave/class/example.i
new file mode 100644
index 000000000..75700b305
--- /dev/null
+++ b/Examples/octave/class/example.i
@@ -0,0 +1,10 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
+
diff --git a/Examples/octave/class/runme.m b/Examples/octave/class/runme.m
new file mode 100644
index 000000000..e3c6c0dca
--- /dev/null
+++ b/Examples/octave/class/runme.m
@@ -0,0 +1,52 @@
+# file: runme.m
+
+# This file illustrates the shadow-class C++ interface generated
+# by SWIG.
+
+example
+
+# ----- Object creation -----
+
+printf("Creating some objects:\n");
+c = example.Circle(10)
+s = example.Square(10)
+
+# ----- Access a static member -----
+
+printf("\nA total of %i shapes were created\n", example.Shape.nshapes);
+
+# ----- Member data access -----
+
+# Set the location of the object
+
+c.x = 20
+c.y = 30
+
+s.x = -10
+s.y = 5
+
+printf("\nHere is their current position:\n");
+printf(" Circle = (%f, %f)\n",c.x,c.y);
+printf(" Square = (%f, %f)\n",s.x,s.y);
+
+# ----- Call some methods -----
+
+printf("\nHere are some properties of the shapes:\n");
+function print_shape(o)
+ o
+ printf(" area = %f\n", o.area());
+ printf(" perimeter = %f\n", o.perimeter());
+end;
+print_shape(c);
+print_shape(s);
+
+printf("\nGuess I'll clean up now\n");
+
+# Note: this invokes the virtual destructor
+clear c
+clear s
+
+printf("%i shapes remain\n", example.Shape.nshapes);
+printf("Goodbye\n");
+
+
diff --git a/Examples/octave/constants/Makefile b/Examples/octave/constants/Makefile
new file mode 100644
index 000000000..4d80c6f19
--- /dev/null
+++ b/Examples/octave/constants/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS =
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/constants/example.i b/Examples/octave/constants/example.i
new file mode 100644
index 000000000..4f7b1a4d7
--- /dev/null
+++ b/Examples/octave/constants/example.i
@@ -0,0 +1,27 @@
+/* File : example.i */
+%module example
+
+/* A few preprocessor macros */
+
+#define ICONST 42
+#define FCONST 2.1828
+#define CCONST 'x'
+#define CCONST2 '\n'
+#define SCONST "Hello World"
+#define SCONST2 "\"Hello World\""
+
+/* This should work just fine */
+#define EXPR ICONST + 3*(FCONST)
+
+/* This shouldn't do anything */
+#define EXTERN extern
+
+/* Neither should this (BAR isn't defined) */
+#define FOO (ICONST + BAR)
+
+/* The following directives also produce constants */
+
+%constant int iconst = 37;
+%constant double fconst = 3.14;
+
+
diff --git a/Examples/octave/constants/runme.m b/Examples/octave/constants/runme.m
new file mode 100644
index 000000000..322858734
--- /dev/null
+++ b/Examples/octave/constants/runme.m
@@ -0,0 +1,29 @@
+# file: runme.m
+
+example
+
+printf("ICONST = %i (should be 42)\n", example.ICONST);
+printf("FCONST = %f (should be 2.1828)\n", example.FCONST);
+printf("CCONST = %s (should be 'x')\n", example.CCONST);
+printf("CCONST2 = %s (this should be on a new line)\n", example.CCONST2);
+printf("SCONST = %s (should be 'Hello World')\n", example.SCONST);
+printf("SCONST2 = %s (should be '\"Hello World\"')\n", example.SCONST2);
+printf("EXPR = %f (should be 48.5484)\n", example.EXPR);
+printf("iconst = %i (should be 37)\n", example.iconst);
+printf("fconst = %f (should be 3.14)\n", example.fconst);
+
+try
+ printf("EXTERN = %s (Arg! This shouldn't printf(anything)\n", example.EXTERN);
+catch
+ printf("EXTERN isn't defined (good)\n");
+end_try_catch
+
+try
+ printf("FOO = %i (Arg! This shouldn't printf(anything)\n", example.FOO);
+catch
+ printf("FOO isn't defined (good)\n");
+end_try_catch
+
+
+
+
diff --git a/Examples/octave/contract/Makefile b/Examples/octave/contract/Makefile
new file mode 100644
index 000000000..bc73e43e7
--- /dev/null
+++ b/Examples/octave/contract/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.c
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/contract/example.c b/Examples/octave/contract/example.c
new file mode 100644
index 000000000..1a644543f
--- /dev/null
+++ b/Examples/octave/contract/example.c
@@ -0,0 +1,23 @@
+/* File : example.c */
+
+/* A global variable */
+double Foo = 3.0;
+
+/* Compute the greatest common divisor of positive integers */
+int gcd(int x, int y) {
+ int g;
+ g = y;
+ while (x > 0) {
+ g = x;
+ x = y % x;
+ y = g;
+ }
+ return g;
+}
+
+int fact(int n) {
+ if (n <= 0) return 1;
+ return n*fact(n-1);
+}
+
+
diff --git a/Examples/octave/contract/example.i b/Examples/octave/contract/example.i
new file mode 100644
index 000000000..8fd1a80af
--- /dev/null
+++ b/Examples/octave/contract/example.i
@@ -0,0 +1,21 @@
+/* File : example.i */
+%module example
+
+%contract gcd(int x, int y) {
+require:
+ x >= 0;
+ y >= 0;
+}
+
+%contract fact(int n) {
+require:
+ n >= 0;
+ensure:
+ fact >= 1;
+}
+
+%inline %{
+extern int gcd(int x, int y);
+extern int fact(int n);
+extern double Foo;
+%}
diff --git a/Examples/octave/contract/runme.m b/Examples/octave/contract/runme.m
new file mode 100644
index 000000000..62b72320b
--- /dev/null
+++ b/Examples/octave/contract/runme.m
@@ -0,0 +1,22 @@
+# file: runme.m
+
+example
+
+# Call our gcd() function
+
+x = 42;
+y = 105;
+g = example.gcd(x,y);
+printf("The gcd of %d and %d is %d\n",x,y,g);
+
+# Manipulate the Foo global variable
+
+# Output its current value
+printf("Foo = %f\n", example.cvar.Foo);
+
+# Change its value
+example.cvar.Foo = 3.1415926;
+
+# See if the change took effect
+printf("Foo = %f\n", example.cvar.Foo);
+
diff --git a/Examples/octave/enum/Makefile b/Examples/octave/enum/Makefile
new file mode 100644
index 000000000..2bce9df5d
--- /dev/null
+++ b/Examples/octave/enum/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.cxx
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/enum/example.cxx b/Examples/octave/enum/example.cxx
new file mode 100644
index 000000000..6785e57ac
--- /dev/null
+++ b/Examples/octave/enum/example.cxx
@@ -0,0 +1,37 @@
+/* File : example.c */
+
+#include "example.h"
+#include <stdio.h>
+
+void Foo::enum_test(speed s) {
+ if (s == IMPULSE) {
+ printf("IMPULSE speed\n");
+ } else if (s == WARP) {
+ printf("WARP speed\n");
+ } else if (s == LUDICROUS) {
+ printf("LUDICROUS speed\n");
+ } else {
+ printf("Unknown speed\n");
+ }
+}
+
+void enum_test(color c, Foo::speed s) {
+ if (c == RED) {
+ printf("color = RED, ");
+ } else if (c == BLUE) {
+ printf("color = BLUE, ");
+ } else if (c == GREEN) {
+ printf("color = GREEN, ");
+ } else {
+ printf("color = Unknown color!, ");
+ }
+ if (s == Foo::IMPULSE) {
+ printf("speed = IMPULSE speed\n");
+ } else if (s == Foo::WARP) {
+ printf("speed = WARP speed\n");
+ } else if (s == Foo::LUDICROUS) {
+ printf("speed = LUDICROUS speed\n");
+ } else {
+ printf("speed = Unknown speed!\n");
+ }
+}
diff --git a/Examples/octave/enum/example.h b/Examples/octave/enum/example.h
new file mode 100644
index 000000000..525d62afc
--- /dev/null
+++ b/Examples/octave/enum/example.h
@@ -0,0 +1,13 @@
+/* File : example.h */
+
+enum color { RED, BLUE, GREEN };
+
+class Foo {
+ public:
+ Foo() { }
+ enum speed { IMPULSE, WARP, LUDICROUS };
+ void enum_test(speed s);
+};
+
+void enum_test(color c, Foo::speed s);
+
diff --git a/Examples/octave/enum/example.i b/Examples/octave/enum/example.i
new file mode 100644
index 000000000..23ee8a822
--- /dev/null
+++ b/Examples/octave/enum/example.i
@@ -0,0 +1,11 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+
+%include "example.h"
+
diff --git a/Examples/octave/enum/runme.m b/Examples/octave/enum/runme.m
new file mode 100644
index 000000000..a749e81db
--- /dev/null
+++ b/Examples/octave/enum/runme.m
@@ -0,0 +1,32 @@
+# file: runme.m
+
+example
+
+# ----- Object creation -----
+
+# Print out the value of some enums
+printf("*** color ***\n");
+printf(" RED = %i\n", example.RED);
+printf(" BLUE = %i\n", example.BLUE);
+printf(" GREEN = %i\n", example.GREEN);
+
+printf("\n*** Foo::speed ***\n");
+printf(" Foo_IMPULSE = %i\n", example.Foo_IMPULSE);
+printf(" Foo_WARP = %i\n", example.Foo_WARP);
+printf(" Foo_LUDICROUS = %i\n", example.Foo_LUDICROUS);
+
+printf("\nTesting use of enums with functions\n");
+
+example.enum_test(example.RED, example.Foo_IMPULSE);
+example.enum_test(example.BLUE, example.Foo_WARP);
+example.enum_test(example.GREEN, example.Foo_LUDICROUS);
+example.enum_test(1234,5678)
+
+printf("\nTesting use of enum with class method\n");
+f = example.Foo();
+
+f.enum_test(example.Foo_IMPULSE);
+f.enum_test(example.Foo_WARP);
+f.enum_test(example.Foo_LUDICROUS);
+
+
diff --git a/Examples/octave/extend/Makefile b/Examples/octave/extend/Makefile
new file mode 100644
index 000000000..2bce9df5d
--- /dev/null
+++ b/Examples/octave/extend/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.cxx
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/extend/example.cxx b/Examples/octave/extend/example.cxx
new file mode 100644
index 000000000..450d75608
--- /dev/null
+++ b/Examples/octave/extend/example.cxx
@@ -0,0 +1,4 @@
+/* File : example.cxx */
+
+#include "example.h"
+
diff --git a/Examples/octave/extend/example.h b/Examples/octave/extend/example.h
new file mode 100644
index 000000000..b27ab9711
--- /dev/null
+++ b/Examples/octave/extend/example.h
@@ -0,0 +1,56 @@
+/* File : example.h */
+
+#include <cstdio>
+#include <iostream>
+#include <vector>
+#include <string>
+#include <cmath>
+
+class Employee {
+private:
+ std::string name;
+public:
+ Employee(const char* n): name(n) {}
+ virtual std::string getTitle() { return getPosition() + " " + getName(); }
+ virtual std::string getName() { return name; }
+ virtual std::string getPosition() const { return "Employee"; }
+ virtual ~Employee() { printf("~Employee() @ %p\n", this); }
+};
+
+
+class Manager: public Employee {
+public:
+ Manager(const char* n): Employee(n) {}
+ virtual std::string getPosition() const { return "Manager"; }
+};
+
+
+class EmployeeList {
+ std::vector<Employee*> list;
+public:
+ EmployeeList() {
+ list.push_back(new Employee("Bob"));
+ list.push_back(new Employee("Jane"));
+ list.push_back(new Manager("Ted"));
+ }
+ void addEmployee(Employee *p) {
+ list.push_back(p);
+ std::cout << "New employee added. Current employees are:" << std::endl;
+ std::vector<Employee*>::iterator i;
+ for (i=list.begin(); i!=list.end(); i++) {
+ std::cout << " " << (*i)->getTitle() << std::endl;
+ }
+ }
+ const Employee *get_item(int i) {
+ return list[i];
+ }
+ ~EmployeeList() {
+ std::vector<Employee*>::iterator i;
+ std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl;
+ for (i=list.begin(); i!=list.end(); i++) {
+ delete *i;
+ }
+ std::cout << "~EmployeeList empty." << std::endl;
+ }
+};
+
diff --git a/Examples/octave/extend/example.i b/Examples/octave/extend/example.i
new file mode 100644
index 000000000..c8ec32e09
--- /dev/null
+++ b/Examples/octave/extend/example.i
@@ -0,0 +1,15 @@
+/* File : example.i */
+%module(directors="1") example
+%{
+#include "example.h"
+%}
+
+%include "std_vector.i"
+%include "std_string.i"
+
+/* turn on director wrapping for Manager */
+%feature("director") Employee;
+%feature("director") Manager;
+
+%include "example.h"
+
diff --git a/Examples/octave/extend/runme.m b/Examples/octave/extend/runme.m
new file mode 100644
index 000000000..8301c2282
--- /dev/null
+++ b/Examples/octave/extend/runme.m
@@ -0,0 +1,74 @@
+# file: runme.m
+
+# This file illustrates the cross language polymorphism using directors.
+
+example
+
+
+# CEO class, which overrides Employee::getPosition().
+
+CEO=@(name) subclass(example.Manager(name),'getPosition',@(self) "CEO");
+
+# Create an instance of our employee extension class, CEO. The calls to
+# getName() and getPosition() are standard, the call to getTitle() uses
+# the director wrappers to call CEO.getPosition. e = CEO("Alice")
+
+e = CEO("Alice");
+printf("%s is a %s\n",e.getName(),e.getPosition());
+printf("Just call her \"%s\"\n",e.getTitle());
+printf("----------------------\n");
+
+
+# Create a new EmployeeList instance. This class does not have a C++
+# director wrapper, but can be used freely with other classes that do.
+
+list = example.EmployeeList();
+
+# EmployeeList owns its items, so we must surrender ownership of objects
+# we add. This involves first calling the __disown__ method to tell the
+# C++ director to start reference counting. We reassign the resulting
+# weakref.proxy to e so that no hard references remain. This can also be
+# done when the object is constructed, as in: e =
+# CEO("Alice").__disown()
+
+e = e.__disown();
+list.addEmployee(e);
+printf("----------------------\n");
+
+# Now we access the first four items in list (three are C++ objects that
+# EmployeeList's constructor adds, the last is our CEO). The virtual
+# methods of all these instances are treated the same. For items 0, 1, and
+# 2, both all methods resolve in C++. For item 3, our CEO, getTitle calls
+# getPosition which resolves in Octave. The call to getPosition is
+# slightly different, however, from the e.getPosition() call above, since
+# now the object reference has been "laundered" by passing through
+# EmployeeList as an Employee*. Previously, Octave resolved the call
+# immediately in CEO, but now Octave thinks the object is an instance of
+# class Employee (actually EmployeePtr). So the call passes through the
+# Employee shadow class and on to the C wrappers and C++ director,
+# eventually ending up back at the CEO implementation of getPosition().
+# The call to getTitle() for item 3 runs the C++ Employee::getTitle()
+# method, which in turn calls getPosition(). This virtual method call
+# passes down through the C++ director class to the Octave implementation
+# in CEO. All this routing takes place transparently.
+
+printf("(position, title) for items 0-3:\n");
+for i=0:3,
+ printf(" %s, \"%s\"\n",list.get_item(i).getPosition(), list.get_item(i).getTitle());
+endfor
+printf("----------------------\n");
+
+# Time to delete the EmployeeList, which will delete all the Employee*
+# items it contains. The last item is our CEO, which gets destroyed as its
+# reference count goes to zero. The Octave destructor runs, and is still
+# able to call self.getName() since the underlying C++ object still
+# exists. After this destructor runs the remaining C++ destructors run as
+# usual to destroy the object.
+
+clear list;
+printf("----------------------\n");
+
+# All done.
+
+printf("octave exit\n");
+
diff --git a/Examples/octave/funcptr/Makefile b/Examples/octave/funcptr/Makefile
new file mode 100644
index 000000000..bc73e43e7
--- /dev/null
+++ b/Examples/octave/funcptr/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.c
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/funcptr/example.c b/Examples/octave/funcptr/example.c
new file mode 100644
index 000000000..5c4a3dabf
--- /dev/null
+++ b/Examples/octave/funcptr/example.c
@@ -0,0 +1,19 @@
+/* File : example.c */
+
+int do_op(int a, int b, int (*op)(int,int)) {
+ return (*op)(a,b);
+}
+
+int add(int a, int b) {
+ return a+b;
+}
+
+int sub(int a, int b) {
+ return a-b;
+}
+
+int mul(int a, int b) {
+ return a*b;
+}
+
+int (*funcvar)(int,int) = add;
diff --git a/Examples/octave/funcptr/example.h b/Examples/octave/funcptr/example.h
new file mode 100644
index 000000000..9936e24fc
--- /dev/null
+++ b/Examples/octave/funcptr/example.h
@@ -0,0 +1,9 @@
+/* file: example.h */
+
+extern int do_op(int,int, int (*op)(int,int));
+extern int add(int,int);
+extern int sub(int,int);
+extern int mul(int,int);
+
+extern int (*funcvar)(int,int);
+
diff --git a/Examples/octave/funcptr/example.i b/Examples/octave/funcptr/example.i
new file mode 100644
index 000000000..8b3bef678
--- /dev/null
+++ b/Examples/octave/funcptr/example.i
@@ -0,0 +1,16 @@
+/* File : example.i */
+%module example
+%{
+#include "example.h"
+%}
+
+/* Wrap a function taking a pointer to a function */
+extern int do_op(int a, int b, int (*op)(int, int));
+
+/* Now install a bunch of "ops" as constants */
+%constant int (*ADD)(int,int) = add;
+%constant int (*SUB)(int,int) = sub;
+%constant int (*MUL)(int,int) = mul;
+
+extern int (*funcvar)(int,int);
+
diff --git a/Examples/octave/funcptr/runme.m b/Examples/octave/funcptr/runme.m
new file mode 100644
index 000000000..455311c16
--- /dev/null
+++ b/Examples/octave/funcptr/runme.m
@@ -0,0 +1,21 @@
+# file: runme.m
+
+example
+
+a = 37
+b = 42
+
+# Now call our C function with a bunch of callbacks
+
+printf("Trying some C callback functions\n");
+printf(" a = %i\n", a);
+printf(" b = %i\n", b);
+printf(" ADD(a,b) = %i\n", example.do_op(a,b,example.ADD));
+printf(" SUB(a,b) = %i\n", example.do_op(a,b,example.SUB));
+printf(" MUL(a,b) = %i\n", example.do_op(a,b,example.MUL));
+
+printf("Here is what the C callback function objects look like in Octave\n");
+example.ADD
+example.SUB
+example.MUL
+
diff --git a/Examples/octave/funcptr2/Makefile b/Examples/octave/funcptr2/Makefile
new file mode 100644
index 000000000..bc73e43e7
--- /dev/null
+++ b/Examples/octave/funcptr2/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.c
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/funcptr2/example.c b/Examples/octave/funcptr2/example.c
new file mode 100644
index 000000000..5c4a3dabf
--- /dev/null
+++ b/Examples/octave/funcptr2/example.c
@@ -0,0 +1,19 @@
+/* File : example.c */
+
+int do_op(int a, int b, int (*op)(int,int)) {
+ return (*op)(a,b);
+}
+
+int add(int a, int b) {
+ return a+b;
+}
+
+int sub(int a, int b) {
+ return a-b;
+}
+
+int mul(int a, int b) {
+ return a*b;
+}
+
+int (*funcvar)(int,int) = add;
diff --git a/Examples/octave/funcptr2/example.h b/Examples/octave/funcptr2/example.h
new file mode 100644
index 000000000..9936e24fc
--- /dev/null
+++ b/Examples/octave/funcptr2/example.h
@@ -0,0 +1,9 @@
+/* file: example.h */
+
+extern int do_op(int,int, int (*op)(int,int));
+extern int add(int,int);
+extern int sub(int,int);
+extern int mul(int,int);
+
+extern int (*funcvar)(int,int);
+
diff --git a/Examples/octave/funcptr2/example.i b/Examples/octave/funcptr2/example.i
new file mode 100644
index 000000000..681775a3e
--- /dev/null
+++ b/Examples/octave/funcptr2/example.i
@@ -0,0 +1,18 @@
+/* File : example.i */
+%module example
+%{
+#include "example.h"
+%}
+
+/* Wrap a function taking a pointer to a function */
+extern int do_op(int a, int b, int (*op)(int, int));
+
+/* Now install a bunch of "ops" as constants */
+%callback("%(upper)s");
+int add(int, int);
+int sub(int, int);
+int mul(int, int);
+%nocallback;
+
+extern int (*funcvar)(int,int);
+
diff --git a/Examples/octave/funcptr2/runme.m b/Examples/octave/funcptr2/runme.m
new file mode 100644
index 000000000..1d3d8f73a
--- /dev/null
+++ b/Examples/octave/funcptr2/runme.m
@@ -0,0 +1,24 @@
+# file: runme.m
+
+example
+
+a = 37
+b = 42
+
+# Now call our C function with a bunch of callbacks
+
+printf("Trying some C callback functions\n");
+printf(" a = %i\n", a);
+printf(" b = %i\n", b);
+printf(" ADD(a,b) = %i\n", example.do_op(a,b,example.ADD));
+printf(" SUB(a,b) = %i\n", example.do_op(a,b,example.SUB));
+printf(" MUL(a,b) = %i\n", example.do_op(a,b,example.MUL));
+
+printf("Here is what the C callback function objects look like in Octave\n");
+example.ADD
+example.SUB
+example.MUL
+
+printf("Call the functions directly...\n");
+printf(" add(a,b) = %i\n", example.add(a,b));
+printf(" sub(a,b) = %i\n", example.sub(a,b));
diff --git a/Examples/octave/functor/Makefile b/Examples/octave/functor/Makefile
new file mode 100644
index 000000000..d910de530
--- /dev/null
+++ b/Examples/octave/functor/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS =
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/functor/example.i b/Examples/octave/functor/example.i
new file mode 100644
index 000000000..2fd38176f
--- /dev/null
+++ b/Examples/octave/functor/example.i
@@ -0,0 +1,29 @@
+/* File : example.i */
+%module example
+
+
+%inline %{
+// From B. Strousjoup, "The C++ Programming Language, Third Edition", p. 514
+template<class T> class Sum {
+ T res;
+public:
+ Sum(T i = 0) : res(i) { }
+ void operator() (T x) { res += x; }
+ T result() const { return res; }
+};
+
+%}
+
+// Rename the application operator to __call__ for python.
+// Note: this is normally automatic, but if you had to do it yourself
+// you would use this directive:
+//
+// %rename(__call__) *::operator();
+
+// Instantiate a few versions
+%template(intSum) Sum<int>;
+%template(doubleSum) Sum<double>;
+
+
+
+
diff --git a/Examples/octave/functor/runme.m b/Examples/octave/functor/runme.m
new file mode 100644
index 000000000..65dabcc91
--- /dev/null
+++ b/Examples/octave/functor/runme.m
@@ -0,0 +1,18 @@
+# Operator overloading example
+example
+
+a = example.intSum(0);
+b = example.doubleSum(100.0);
+
+# Use the objects. They should be callable just like a normal
+# python function.
+
+for i=0:100-1,
+ a(i); # Note: function call
+ b(sqrt(i)); # Note: function call
+endfor
+
+a.result()
+b.result()
+
+
diff --git a/Examples/octave/operator/Makefile b/Examples/octave/operator/Makefile
new file mode 100644
index 000000000..6e625d538
--- /dev/null
+++ b/Examples/octave/operator/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS =
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).m
+
+check: all
diff --git a/Examples/octave/operator/example.h b/Examples/octave/operator/example.h
new file mode 100644
index 000000000..526f262b9
--- /dev/null
+++ b/Examples/octave/operator/example.h
@@ -0,0 +1,36 @@
+/* File : example.h */
+#include <math.h>
+
+class ComplexVal {
+private:
+ double rpart, ipart;
+public:
+ ComplexVal(double r = 0, double i = 0) : rpart(r), ipart(i) { }
+ ComplexVal(const ComplexVal &c) : rpart(c.rpart), ipart(c.ipart) { }
+ ComplexVal &operator=(const ComplexVal &c) {
+ rpart = c.rpart;
+ ipart = c.ipart;
+ return *this;
+ }
+ ComplexVal operator+(const ComplexVal &c) const {
+ return ComplexVal(rpart+c.rpart, ipart+c.ipart);
+ }
+ ComplexVal operator-(const ComplexVal &c) const {
+ return ComplexVal(rpart-c.rpart, ipart-c.ipart);
+ }
+ ComplexVal operator*(const ComplexVal &c) const {
+ return ComplexVal(rpart*c.rpart - ipart*c.ipart,
+ rpart*c.ipart + c.rpart*ipart);
+ }
+ ComplexVal operator-() const {
+ return ComplexVal(-rpart, -ipart);
+ }
+
+ double re() const { return rpart; }
+ double im() const { return ipart; }
+};
+
+
+
+
+
diff --git a/Examples/octave/operator/example.i b/Examples/octave/operator/example.i
new file mode 100644
index 000000000..d4bba5c53
--- /dev/null
+++ b/Examples/octave/operator/example.i
@@ -0,0 +1,24 @@
+/* File : example.i */
+%module example
+#pragma SWIG nowarn=SWIGWARN_IGNORE_OPERATOR_EQ
+%{
+#include "example.h"
+%}
+
+/* Now grab the original header file */
+%include "example.h"
+
+/* An output method that turns a complex into a short string */
+%extend ComplexVal {
+ char *__str() {
+ static char temp[512];
+ sprintf(temp,"(%g,%g)", $self->re(), $self->im());
+ return temp;
+ }
+
+ ComplexVal __paren(int j) {
+ return ComplexVal($self->re()*j,$self->im()*j);
+ }
+};
+
+
diff --git a/Examples/octave/operator/runme.m b/Examples/octave/operator/runme.m
new file mode 100644
index 000000000..e0f590694
--- /dev/null
+++ b/Examples/octave/operator/runme.m
@@ -0,0 +1,24 @@
+# Operator overloading example
+example
+
+a = example.ComplexVal(2,3);
+b = example.ComplexVal(-5,10);
+
+printf("a = %s\n",a);
+printf("b = %s\n",b);
+
+c = a + b;
+printf("c = %s\n",c);
+printf("a*b = %s\n",a*b);
+printf("a-c = %s\n",a-c);
+
+e = example.ComplexVal(a-c);
+printf("e = %s\n",e);
+
+# Big expression
+f = ((a+b)*(c+b*e)) + (-a);
+printf("f = %s\n",f);
+
+# paren overloading
+printf("a(3)= %s\n",a(3));
+
diff --git a/Examples/octave/pointer/Makefile b/Examples/octave/pointer/Makefile
new file mode 100644
index 000000000..bc73e43e7
--- /dev/null
+++ b/Examples/octave/pointer/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.c
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/pointer/example.c b/Examples/octave/pointer/example.c
new file mode 100644
index 000000000..b877d9a5b
--- /dev/null
+++ b/Examples/octave/pointer/example.c
@@ -0,0 +1,16 @@
+/* File : example.c */
+
+void add(int *x, int *y, int *result) {
+ *result = *x + *y;
+}
+
+void sub(int *x, int *y, int *result) {
+ *result = *x - *y;
+}
+
+int divide(int n, int d, int *r) {
+ int q;
+ q = n/d;
+ *r = n - q*d;
+ return q;
+}
diff --git a/Examples/octave/pointer/example.i b/Examples/octave/pointer/example.i
new file mode 100644
index 000000000..a8ac79499
--- /dev/null
+++ b/Examples/octave/pointer/example.i
@@ -0,0 +1,30 @@
+/* File : example.i */
+%module example
+
+%{
+extern void add(int *, int *, int *);
+extern void sub(int *, int *, int *);
+extern int divide(int, int, int *);
+%}
+
+/* This example illustrates a couple of different techniques
+ for manipulating C pointers */
+
+/* First we'll use the pointer library */
+extern void add(int *x, int *y, int *result);
+%include cpointer.i
+%pointer_functions(int, intp);
+
+/* Next we'll use some typemaps */
+
+%include typemaps.i
+extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
+
+/* Next we'll use typemaps and the %apply directive */
+
+%apply int *OUTPUT { int *r };
+extern int divide(int n, int d, int *r);
+
+
+
+
diff --git a/Examples/octave/pointer/runme.m b/Examples/octave/pointer/runme.m
new file mode 100644
index 000000000..c36df7270
--- /dev/null
+++ b/Examples/octave/pointer/runme.m
@@ -0,0 +1,42 @@
+# file: runme.m
+
+example;
+
+# First create some objects using the pointer library.
+printf("Testing the pointer library\n");
+a = example.new_intp();
+b = example.new_intp();
+c = example.new_intp();
+example.intp_assign(a,37);
+example.intp_assign(b,42);
+
+a,b,c
+
+# Call the add() function with some pointers
+example.add(a,b,c);
+
+# Now get the result
+r = example.intp_value(c);
+printf(" 37 + 42 = %i\n",r);
+
+# Clean up the pointers
+example.delete_intp(a);
+example.delete_intp(b);
+example.delete_intp(c);
+
+# Now try the typemap library
+# This should be much easier. Now how it is no longer
+# necessary to manufacture pointers.
+
+printf("Trying the typemap library\n");
+r = example.sub(37,42);
+printf(" 37 - 42 = %i\n",r);
+
+# Now try the version with multiple return values
+
+printf("Testing multiple return values\n");
+[q,r] = example.divide(42,37);
+printf(" 42/37 = %d remainder %d\n",q,r);
+
+
+
diff --git a/Examples/octave/reference/Makefile b/Examples/octave/reference/Makefile
new file mode 100644
index 000000000..2bce9df5d
--- /dev/null
+++ b/Examples/octave/reference/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.cxx
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/reference/example.cxx b/Examples/octave/reference/example.cxx
new file mode 100644
index 000000000..8a513bf49
--- /dev/null
+++ b/Examples/octave/reference/example.cxx
@@ -0,0 +1,46 @@
+/* File : example.cxx */
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+#include "example.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+Vector operator+(const Vector &a, const Vector &b) {
+ Vector r;
+ r.x = a.x + b.x;
+ r.y = a.y + b.y;
+ r.z = a.z + b.z;
+ return r;
+}
+
+char *Vector::print() {
+ static char temp[512];
+ sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z);
+ return temp;
+}
+
+VectorArray::VectorArray(int size) {
+ items = new Vector[size];
+ maxsize = size;
+}
+
+VectorArray::~VectorArray() {
+ delete [] items;
+}
+
+Vector &VectorArray::operator[](int index) {
+ if ((index < 0) || (index >= maxsize)) {
+ printf("Panic! Array index out of bounds.\n");
+ exit(1);
+ }
+ return items[index];
+}
+
+int VectorArray::size() {
+ return maxsize;
+}
+
diff --git a/Examples/octave/reference/example.h b/Examples/octave/reference/example.h
new file mode 100644
index 000000000..4915adb1b
--- /dev/null
+++ b/Examples/octave/reference/example.h
@@ -0,0 +1,26 @@
+/* File : example.h */
+
+class Vector {
+private:
+ double x,y,z;
+public:
+ Vector() : x(0), y(0), z(0) { };
+ Vector(double x, double y, double z) : x(x), y(y), z(z) { };
+ friend Vector operator+(const Vector &a, const Vector &b);
+ char *print();
+};
+
+class VectorArray {
+private:
+ Vector *items;
+ int maxsize;
+public:
+ VectorArray(int maxsize);
+ ~VectorArray();
+ Vector &operator[](int);
+ int size();
+};
+
+
+
+
diff --git a/Examples/octave/reference/example.i b/Examples/octave/reference/example.i
new file mode 100644
index 000000000..8c95b3213
--- /dev/null
+++ b/Examples/octave/reference/example.i
@@ -0,0 +1,48 @@
+/* File : example.i */
+
+/* This file has a few "typical" uses of C++ references. */
+
+%module example
+
+%{
+#include "example.h"
+%}
+
+%rename(cprint) print;
+
+class Vector {
+public:
+ Vector(double x, double y, double z);
+ ~Vector();
+ char *print();
+};
+
+/* This helper function calls an overloaded operator */
+%inline %{
+Vector addv(Vector &a, Vector &b) {
+ return a+b;
+}
+%}
+
+/* Wrapper around an array of vectors class */
+
+class VectorArray {
+public:
+ VectorArray(int maxsize);
+ ~VectorArray();
+ int size();
+
+ /* This wrapper provides an alternative to the [] operator */
+ %extend {
+ Vector &get(int index) {
+ return (*$self)[index];
+ }
+ void set(int index, Vector &a) {
+ (*$self)[index] = a;
+ }
+ }
+};
+
+
+
+
diff --git a/Examples/octave/reference/runme.m b/Examples/octave/reference/runme.m
new file mode 100644
index 000000000..f59c8eb7d
--- /dev/null
+++ b/Examples/octave/reference/runme.m
@@ -0,0 +1,63 @@
+# file: runme.m
+
+# This file illustrates the manipulation of C++ references in Octave
+
+example
+
+# ----- Object creation -----
+
+printf("Creating some objects:\n");
+a = example.Vector(3,4,5)
+b = example.Vector(10,11,12)
+
+printf(" Created %s\n",a.cprint());
+printf(" Created %s\n",b.cprint());
+
+# ----- Call an overloaded operator -----
+
+# This calls the wrapper we placed around
+#
+# operator+(const Vector &a, const Vector &)
+#
+# It returns a new allocated object.
+
+printf("Adding a+b\n");
+c = example.addv(a,b);
+printf(" a+b = %s\n", c.cprint());
+
+clear c
+
+# ----- Create a vector array -----
+
+# Note: Using the high-level interface here
+printf("Creating an array of vectors\n");
+va = example.VectorArray(10)
+
+# ----- Set some values in the array -----
+
+# These operators copy the value of $a and $b to the vector array
+va.set(0,a);
+va.set(1,b);
+
+va.set(2,example.addv(a,b))
+
+# Get some values from the array
+
+printf("Getting some array values\n");
+for i=0:4,
+ printf(" va(%d) = %s\n",i,va.get(i).cprint());
+end;
+
+# Watch under resource meter to check on this
+printf("Making sure we don't leak memory.\n");
+for i=0:1000000-1,
+ c = va.get(mod(i,10));
+end
+
+# ----- Clean up -----
+printf("Cleaning up\n");
+
+clear va
+clear a
+clear b
+
diff --git a/Examples/octave/simple/Makefile b/Examples/octave/simple/Makefile
new file mode 100644
index 000000000..bc73e43e7
--- /dev/null
+++ b/Examples/octave/simple/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.c
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/simple/example.c b/Examples/octave/simple/example.c
new file mode 100644
index 000000000..1c2af789c
--- /dev/null
+++ b/Examples/octave/simple/example.c
@@ -0,0 +1,18 @@
+/* File : example.c */
+
+/* A global variable */
+double Foo = 3.0;
+
+/* Compute the greatest common divisor of positive integers */
+int gcd(int x, int y) {
+ int g;
+ g = y;
+ while (x > 0) {
+ g = x;
+ x = y % x;
+ y = g;
+ }
+ return g;
+}
+
+
diff --git a/Examples/octave/simple/example.i b/Examples/octave/simple/example.i
new file mode 100644
index 000000000..24093b9bf
--- /dev/null
+++ b/Examples/octave/simple/example.i
@@ -0,0 +1,7 @@
+/* File : example.i */
+%module example
+
+%inline %{
+extern int gcd(int x, int y);
+extern double Foo;
+%}
diff --git a/Examples/octave/simple/runme.m b/Examples/octave/simple/runme.m
new file mode 100644
index 000000000..8dc5eaa58
--- /dev/null
+++ b/Examples/octave/simple/runme.m
@@ -0,0 +1,22 @@
+# file: runme.m
+
+example
+
+# Call our gcd() function
+
+x = 42
+y = 105
+g = example.gcd(x,y)
+printf("The gcd of %d and %d is %d\n",x,y,g);
+
+# Manipulate the Foo global variable
+
+# Output its current value
+example.cvar.Foo
+
+# Change its value
+example.cvar.Foo = 3.1415926
+
+# See if the change took effect
+printf("Foo = %f\n", example.cvar.Foo);
+
diff --git a/Examples/octave/template/Makefile b/Examples/octave/template/Makefile
new file mode 100644
index 000000000..3d7445a66
--- /dev/null
+++ b/Examples/octave/template/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS =
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).py
+
+check: all
diff --git a/Examples/octave/template/example.h b/Examples/octave/template/example.h
new file mode 100644
index 000000000..7401df650
--- /dev/null
+++ b/Examples/octave/template/example.h
@@ -0,0 +1,32 @@
+/* File : example.h */
+
+// Some template definitions
+
+template<class T> T max(T a, T b) { return a>b ? a : b; }
+
+template<class T> class vector {
+ T *v;
+ int sz;
+ public:
+ vector(int _sz) {
+ v = new T[_sz];
+ sz = _sz;
+ }
+ T &get(int index) {
+ return v[index];
+ }
+ void set(int index, T &val) {
+ v[index] = val;
+ }
+#ifdef SWIG
+ %extend {
+ T getitem(int index) {
+ return $self->get(index);
+ }
+ void setitem(int index, T val) {
+ $self->set(index,val);
+ }
+ }
+#endif
+};
+
diff --git a/Examples/octave/template/example.i b/Examples/octave/template/example.i
new file mode 100644
index 000000000..8f94c4da1
--- /dev/null
+++ b/Examples/octave/template/example.i
@@ -0,0 +1,17 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
+
+/* Now instantiate some specific template declarations */
+
+%template(maxint) max<int>;
+%template(maxdouble) max<double>;
+%template(vecint) vector<int>;
+%template(vecdouble) vector<double>;
+
diff --git a/Examples/octave/template/runme.m b/Examples/octave/template/runme.m
new file mode 100644
index 000000000..a9891d459
--- /dev/null
+++ b/Examples/octave/template/runme.m
@@ -0,0 +1,37 @@
+# file: runme.m
+
+example
+
+# Call some templated functions
+example.maxint(3,7)
+example.maxdouble(3.14,2.18)
+
+# Create some class
+
+iv = example.vecint(100)
+dv = example.vecdouble(1000)
+
+for i=0:99,
+ iv.setitem(i,2*i);
+end
+
+for i=0:999,
+ dv.setitem(i, 1.0/(i+1));
+end;
+
+sum = 0;
+for i=0:99
+ sum = sum + iv.getitem(i);
+end
+sum
+
+sum = 0.0;
+for i=0:999,
+ sum = sum + dv.getitem(i);
+end
+sum
+
+clear iv
+clear dv
+
+
diff --git a/Examples/octave/variables/Makefile b/Examples/octave/variables/Makefile
new file mode 100644
index 000000000..9164a1ca5
--- /dev/null
+++ b/Examples/octave/variables/Makefile
@@ -0,0 +1,21 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+CXXSRCS = example.c
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+
+static::
+ $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile octave_clean
+ rm -f $(TARGET).m
+
+check: all
diff --git a/Examples/octave/variables/example.c b/Examples/octave/variables/example.c
new file mode 100644
index 000000000..aa4ffe9b3
--- /dev/null
+++ b/Examples/octave/variables/example.c
@@ -0,0 +1,91 @@
+/* File : example.c */
+
+/* I'm a file containing some C global variables */
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "example.h"
+
+int ivar = 0;
+short svar = 0;
+long lvar = 0;
+unsigned int uivar = 0;
+unsigned short usvar = 0;
+unsigned long ulvar = 0;
+signed char scvar = 0;
+unsigned char ucvar = 0;
+char cvar = 0;
+float fvar = 0;
+double dvar = 0;
+char *strvar = 0;
+const char cstrvar[] = "Goodbye";
+int *iptrvar = 0;
+char name[256] = "Dave";
+char path[256] = "/home/beazley";
+
+
+/* Global variables involving a structure */
+Point *ptptr = 0;
+Point pt = { 10, 20 };
+
+/* A variable that we will make read-only in the interface */
+int status = 1;
+
+/* A debugging function to print out their values */
+
+void print_vars() {
+ printf("ivar = %d\n", ivar);
+ printf("svar = %d\n", svar);
+ printf("lvar = %ld\n", lvar);
+ printf("uivar = %u\n", uivar);
+ printf("usvar = %u\n", usvar);
+ printf("ulvar = %lu\n", ulvar);
+ printf("scvar = %d\n", scvar);
+ printf("ucvar = %u\n", ucvar);
+ printf("fvar = %g\n", fvar);
+ printf("dvar = %g\n", dvar);
+ printf("cvar = %c\n", cvar);
+ printf("strvar = %s\n", strvar ? strvar : "(null)");
+ printf("cstrvar = %s\n", cstrvar ? cstrvar : "(null)");
+ printf("iptrvar = %p\n", iptrvar);
+ printf("name = %s\n", name);
+ printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
+ printf("pt = (%d, %d)\n", pt.x, pt.y);
+ printf("status = %d\n", status);
+}
+
+/* A function to create an integer (to test iptrvar) */
+
+int *new_int(int value) {
+ int *ip = (int *) malloc(sizeof(int));
+ *ip = value;
+ return ip;
+}
+
+/* A function to create a point */
+
+Point *new_Point(int x, int y) {
+ Point *p = (Point *) malloc(sizeof(Point));
+ p->x = x;
+ p->y = y;
+ return p;
+}
+
+char * Point_print(Point *p) {
+ static char buffer[256];
+ if (p) {
+ sprintf(buffer,"(%d,%d)", p->x,p->y);
+ } else {
+ sprintf(buffer,"null");
+ }
+ return buffer;
+}
+
+void pt_print() {
+ printf("(%d, %d)\n", pt.x, pt.y);
+}
diff --git a/Examples/octave/variables/example.h b/Examples/octave/variables/example.h
new file mode 100644
index 000000000..0f7e89594
--- /dev/null
+++ b/Examples/octave/variables/example.h
@@ -0,0 +1,6 @@
+/* File: example.h */
+
+typedef struct {
+ int x,y;
+} Point;
+
diff --git a/Examples/octave/variables/example.i b/Examples/octave/variables/example.i
new file mode 100644
index 000000000..639b6c704
--- /dev/null
+++ b/Examples/octave/variables/example.i
@@ -0,0 +1,53 @@
+/* File : example.i */
+%module example
+%{
+#include "example.h"
+%}
+
+#pragma SWIG nowarn=SWIGWARN_TYPEMAP_SWIGTYPELEAK
+
+/* Some global variable declarations */
+%inline %{
+ extern "C" {
+ extern int ivar;
+ extern short svar;
+ extern long lvar;
+ extern unsigned int uivar;
+ extern unsigned short usvar;
+ extern unsigned long ulvar;
+ extern signed char scvar;
+ extern unsigned char ucvar;
+ extern char cvar;
+ extern float fvar;
+ extern double dvar;
+ extern char *strvar;
+ // extern const char cstrvar[];
+ extern int *iptrvar;
+ extern char name[256];
+
+ extern Point *ptptr;
+ extern Point pt;
+ }
+%}
+
+
+/* Some read-only variables */
+
+%immutable;
+
+%inline %{
+extern int status;
+extern char path[256];
+%}
+
+%mutable;
+
+/* Some helper functions to make it easier to test */
+%inline %{
+extern void print_vars();
+extern int *new_int(int value);
+extern Point *new_Point(int x, int y);
+extern char *Point_print(Point *p);
+extern void pt_print();
+%}
+
diff --git a/Examples/octave/variables/runme.m b/Examples/octave/variables/runme.m
new file mode 100644
index 000000000..db88b18b0
--- /dev/null
+++ b/Examples/octave/variables/runme.m
@@ -0,0 +1,75 @@
+# file: runme.m
+
+example
+
+# Try to set the values of some global variables
+
+example.cvar.ivar = 42;
+example.cvar.svar = -31000;
+example.cvar.lvar = 65537;
+example.cvar.uivar = 123456;
+example.cvar.usvar = 61000;
+example.cvar.ulvar = 654321;
+example.cvar.scvar = -13;
+example.cvar.ucvar = 251;
+example.cvar.cvar = "S";
+example.cvar.fvar = 3.14159;
+example.cvar.dvar = 2.1828;
+example.cvar.strvar = "Hello World";
+example.cvar.iptrvar= example.new_int(37);
+example.cvar.ptptr = example.new_Point(37,42);
+example.cvar.name = "Bill";
+
+# Now print out the values of the variables
+
+printf("Variables (values printed from Octave)\n");
+
+printf("ivar = %i\n", example.cvar.ivar);
+printf("svar = %i\n", example.cvar.svar);
+printf("lvar = %i\n", example.cvar.lvar);
+printf("uivar = %i\n", example.cvar.uivar);
+printf("usvar = %i\n", example.cvar.usvar);
+printf("ulvar = %i\n", example.cvar.ulvar);
+printf("scvar = %i\n", example.cvar.scvar);
+printf("ucvar = %i\n", example.cvar.ucvar);
+printf("fvar = %i\n", example.cvar.fvar);
+printf("dvar = %i\n", example.cvar.dvar);
+printf("cvar = %s\n", example.cvar.cvar);
+printf("strvar = %s\n", example.cvar.strvar);
+#printf("cstrvar = %s\n", example.cvar.cstrvar);
+example.cvar.iptrvar
+printf("name = %i\n", example.cvar.name);
+printf("ptptr = %s\n", example.Point_print(example.cvar.ptptr));
+#printf("pt = %s\n", example.cvar.Point_print(example.cvar.pt));
+
+printf("\nVariables (values printed from C)\n");
+
+example.print_vars();
+
+printf("\nNow I'm going to try and modify some read only variables\n");
+
+printf(" Tring to set 'path'\n");
+try
+ example.cvar.path = "Whoa!";
+ printf("Hey, what's going on?!?! This shouldn't work\n");
+catch
+ printf("Good.\n");
+end_try_catch
+
+printf(" Trying to set 'status'\n");
+try
+ example.cvar.status = 0;
+ printf("Hey, what's going on?!?! This shouldn't work\n");
+catch
+ printf("Good.\n");
+end_try_catch
+
+
+printf("\nI'm going to try and update a structure variable.\n");
+
+example.cvar.pt = example.cvar.ptptr;
+
+printf("The new value is %s\n", example.Point_print(example.cvar.pt));
+
+
+
diff --git a/Examples/test-suite/constructor_copy.i b/Examples/test-suite/constructor_copy.i
index 668369161..c74268a68 100644
--- a/Examples/test-suite/constructor_copy.i
+++ b/Examples/test-suite/constructor_copy.i
@@ -77,7 +77,7 @@ public:
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(Flow, Space::Flow)
#endif
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON)||defined(SWIGR) || defined(SWIGRUBY)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#define SWIG_GOOD_VECTOR
%ignore std::vector<Space::Flow>::vector(size_type);
%ignore std::vector<Space::Flow>::resize(size_type);
diff --git a/Examples/test-suite/minherit.i b/Examples/test-suite/minherit.i
index f4772d8b9..aba299387 100644
--- a/Examples/test-suite/minherit.i
+++ b/Examples/test-suite/minherit.i
@@ -6,7 +6,7 @@
%module(ruby_minherit="1") minherit
-#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGOCAML)
+#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGOCAML) || defined(SWIGOCTAVE)
%inline %{
diff --git a/Examples/test-suite/octave/Makefile.in b/Examples/test-suite/octave/Makefile.in
new file mode 100644
index 000000000..4feca8cd6
--- /dev/null
+++ b/Examples/test-suite/octave/Makefile.in
@@ -0,0 +1,82 @@
+#######################################################################
+# Makefile for octave test-suite
+#######################################################################
+
+LANGUAGE = octave
+ifneq (,$(USE_VALGRIND))
+OCTAVE = valgrind --leak-check=full --suppressions=pyswig.supp @OCTAVE@
+else
+OCTAVE = @OCTAVE@ -q
+endif
+SCRIPTSUFFIX = _runme.m
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+#CPP_TEST_CASES +=
+
+
+#C_TEST_CASES +=
+
+#
+# This test only works with modern C compilers
+#
+#C_TEST_CASES += \
+# complextest
+
+include $(srcdir)/../common.mk
+
+# Overridden variables here
+LIBS = -L.
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup)
+ +$(swig_and_compile_cpp)
+ $(run_testcase)
+
+%.ctest:
+ $(setup)
+ +$(swig_and_compile_cpp)
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup)
+ +$(swig_and_compile_multi_cpp)
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.m appended after the testcase name.
+run_testcase = \
+ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVEPATH=$(srcdir):OCTAVEPATH $(OCTAVE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
+ fi;
+
+# Clean: remove the generated .m file
+%.clean:
+ @rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.m hugemod_b.m hugemod_runme.m
+ @rm -f $*.m;
+
+clean:
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile octave_clean
+
+cvsignore:
+ @echo '*wrap* *.mc *.so *.dll *.exp *.lib'
+ @echo Makefile
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.m; done
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.m CVS/Entries ; then echo $${i}_runme.m; fi; done
+ @echo clientdata_prop_a.m
+ @echo clientdata_prop_b.m
+ @echo imports_a.m
+ @echo imports_b.m
+ @echo mod_a.m mod_b.m
+ @echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.m hugemod_b.m hugemod_runme.m
+ @echo template_typedef_import.m
+
+
+hugemod:
+ perl hugemod.pl
+ $(MAKE) hugemod_a.cpptest
+ $(MAKE) hugemod_b.cpptest
+ time $(OCTAVE) hugemod_runme.m
+ time $(OCTAVE) hugemod_runme.m
diff --git a/Examples/test-suite/octave/abstract_access_runme.m b/Examples/test-suite/octave/abstract_access_runme.m
new file mode 100644
index 000000000..e49343a92
--- /dev/null
+++ b/Examples/test-suite/octave/abstract_access_runme.m
@@ -0,0 +1,7 @@
+abstract_access
+
+d = abstract_access.D();
+if (d.do_x() != 1)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/abstract_typedef2_runme.m b/Examples/test-suite/octave/abstract_typedef2_runme.m
new file mode 100644
index 000000000..7f364db4e
--- /dev/null
+++ b/Examples/test-suite/octave/abstract_typedef2_runme.m
@@ -0,0 +1,8 @@
+abstract_typedef2
+
+a = A_UF();
+
+
+
+
+
diff --git a/Examples/test-suite/octave/abstract_typedef_runme.m b/Examples/test-suite/octave/abstract_typedef_runme.m
new file mode 100644
index 000000000..f28cf3c8b
--- /dev/null
+++ b/Examples/test-suite/octave/abstract_typedef_runme.m
@@ -0,0 +1,12 @@
+abstract_typedef
+e = Engine();
+
+a = A();
+
+
+if (a.write(e) != 1)
+ error
+endif
+
+
+
diff --git a/Examples/test-suite/octave/abstract_virtual_runme.m b/Examples/test-suite/octave/abstract_virtual_runme.m
new file mode 100644
index 000000000..9845a5885
--- /dev/null
+++ b/Examples/test-suite/octave/abstract_virtual_runme.m
@@ -0,0 +1,7 @@
+abstract_virtual
+
+
+d = D();
+
+e = E();
+
diff --git a/Examples/test-suite/octave/argcargvtest_runme.m b/Examples/test-suite/octave/argcargvtest_runme.m
new file mode 100644
index 000000000..f246dd9db
--- /dev/null
+++ b/Examples/test-suite/octave/argcargvtest_runme.m
@@ -0,0 +1,29 @@
+argcargvtest
+
+largs={'hi','hola','hello'};
+if (mainc(largs) != 3)
+ error("bad main typemap");
+endif
+
+targs={'hi','hola'};
+if (mainv(targs,1) != 'hola')
+ error("bad main typemap");
+endif
+
+targs={'hi', 'hola'};
+if (mainv(targs,1) != 'hola')
+ error("bad main typemap");
+endif
+
+try
+ error_flag = 0;
+ mainv('hello',1);
+ error_flag = 1;
+catch
+end_try_catch
+if (error_flag)
+ error("bad main typemap")
+endif
+
+
+initializeApp(largs);
diff --git a/Examples/test-suite/octave/array_member_runme.m b/Examples/test-suite/octave/array_member_runme.m
new file mode 100644
index 000000000..56b7968c5
--- /dev/null
+++ b/Examples/test-suite/octave/array_member_runme.m
@@ -0,0 +1,25 @@
+array_member
+
+f = Foo();
+f.data = cvar.global_data;
+
+for i=0:7,
+ if (get_value(f.data,i) != get_value(cvar.global_data,i))
+ error("Bad array assignment");
+ endif
+endfor
+
+for i=0:7,
+ set_value(f.data,i,-i);
+endfor
+
+cvar.global_data = f.data;
+
+for i=0:7,
+ if (get_value(f.data,i) != get_value(cvar.global_data,i))
+ error("Bad array assignment")
+ endif
+endfor
+
+
+
diff --git a/Examples/test-suite/octave/arrays_global_runme.m b/Examples/test-suite/octave/arrays_global_runme.m
new file mode 100644
index 000000000..95a49088c
--- /dev/null
+++ b/Examples/test-suite/octave/arrays_global_runme.m
@@ -0,0 +1,18 @@
+arrays_global
+
+arrays_global.array_i = arrays_global.array_const_i;
+
+BeginString_FIX44a;
+BeginString_FIX44b;
+BeginString_FIX44c;
+BeginString_FIX44d;
+BeginString_FIX44d;
+BeginString_FIX44b ="12"'\0'"45";
+BeginString_FIX44b;
+BeginString_FIX44d;
+BeginString_FIX44e;
+BeginString_FIX44f;
+
+test_a("hello","hi","chello","chi");
+
+test_b("1234567","hi");
diff --git a/Examples/test-suite/octave/callback_runme.m b/Examples/test-suite/octave/callback_runme.m
new file mode 100644
index 000000000..db9f7888d
--- /dev/null
+++ b/Examples/test-suite/octave/callback_runme.m
@@ -0,0 +1,40 @@
+_callback
+callback
+
+if (foo(2) != 2)
+ error
+endif
+
+if (A_bar(2) != 4)
+ error
+endif
+
+if (foobar(3, _callback.foo) != foo(3))
+ error
+endif
+
+if (foobar(3, foo) != foo(3))
+ error
+endif
+
+if (foobar(3, A_bar) != A_bar(3))
+ error
+endif
+
+if (foobar(3, foof) != foof(3))
+ error
+endif
+
+if (foobar_i(3, foo_i) != foo_i(3))
+ error
+endif
+
+
+if (foobar_d(3.5, foo_d) != foo_d(3.5))
+ error
+endif
+
+a = A();
+if (foobarm(3, a, A.foom_cb_ptr) != a.foom(3))
+ error
+endif
diff --git a/Examples/test-suite/octave/class_ignore_runme.m b/Examples/test-suite/octave/class_ignore_runme.m
new file mode 100644
index 000000000..76bbcd3f0
--- /dev/null
+++ b/Examples/test-suite/octave/class_ignore_runme.m
@@ -0,0 +1,7 @@
+class_ignore
+
+a = class_ignore.Bar();
+
+if (!strcmp(class_ignore.do_blah(a),"Bar::blah"))
+ error
+endif
diff --git a/Examples/test-suite/octave/class_scope_weird_runme.m b/Examples/test-suite/octave/class_scope_weird_runme.m
new file mode 100644
index 000000000..2fc857808
--- /dev/null
+++ b/Examples/test-suite/octave/class_scope_weird_runme.m
@@ -0,0 +1,7 @@
+class_scope_weird
+
+f = class_scope_weird.Foo();
+g = class_scope_weird.Foo(3);
+if (f.bar(3) != 3)
+ error
+endif
diff --git a/Examples/test-suite/octave/compactdefaultargs_runme.m b/Examples/test-suite/octave/compactdefaultargs_runme.m
new file mode 100644
index 000000000..08e872724
--- /dev/null
+++ b/Examples/test-suite/octave/compactdefaultargs_runme.m
@@ -0,0 +1,24 @@
+compactdefaultargs
+
+defaults1 = Defaults1(1000);
+defaults1 = Defaults1();
+
+if (defaults1.ret(10.0) != 10.0)
+ error
+endif
+
+if (defaults1.ret() != -1.0)
+ error
+endif
+
+defaults2 = Defaults2(1000);
+defaults2 = Defaults2();
+
+if (defaults2.ret(10.0) != 10.0)
+ error
+endif
+
+if (defaults2.ret() != -1.0)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/complextest_runme.m b/Examples/test-suite/octave/complextest_runme.m
new file mode 100644
index 000000000..cd0f9f4e2
--- /dev/null
+++ b/Examples/test-suite/octave/complextest_runme.m
@@ -0,0 +1,19 @@
+complextest
+
+a = complex(-1,2);
+
+if (complextest.Conj(a) != a.conjugate())
+ error("bad complex mapping")
+endif
+
+if (complextest.Conjf(a) != a.conjugate())
+ error("bad complex mapping")
+endif
+
+
+v = (complex(1,2), complex(2,3), complex(4,3), 1);
+
+try
+ complextest.Copy_h(v);
+catch
+end_try_catch
diff --git a/Examples/test-suite/octave/constover_runme.m b/Examples/test-suite/octave/constover_runme.m
new file mode 100644
index 000000000..b6822fc84
--- /dev/null
+++ b/Examples/test-suite/octave/constover_runme.m
@@ -0,0 +1,34 @@
+constover
+
+p = constover.test("test");
+if (!strcmp(p,"test"))
+ error("test failed!")
+endif
+
+p = constover.test_pconst("test")
+if (!strcmp(p,"test_pconst"))
+ error("test_pconst failed!")
+endif
+
+f = constover.Foo()
+p = f.test("test")
+if (!strcmp(p,"test"))
+ error("member-test failed!")
+endif
+
+p = f.test_pconst("test")
+if (!strcmp(p,"test_pconst"))
+ error("member-test_pconst failed!")
+endif
+
+p = f.test_constm("test")
+if (!strcmp(p,"test_constmethod"))
+ error("member-test_constm failed!")
+endif
+
+p = f.test_pconstm("test")
+if (!strcmp(p,"test_pconstmethod"))
+ error("member-test_pconstm failed!")
+endif
+
+
diff --git a/Examples/test-suite/octave/constructor_copy_runme.m b/Examples/test-suite/octave/constructor_copy_runme.m
new file mode 100644
index 000000000..5d52ab525
--- /dev/null
+++ b/Examples/test-suite/octave/constructor_copy_runme.m
@@ -0,0 +1,44 @@
+constructor_copy
+
+f1 = Foo1(3);
+f11 = Foo1(f1);
+
+
+if (f1.x != f11.x)
+ error
+endif
+
+
+f8 = Foo8();
+try
+ f81 = Foo8(f8);
+ good = 0;
+catch
+ good = 1;
+end_try_catch
+
+if (!good)
+ error
+endif
+
+
+bi = Bari(5);
+bc = Bari(bi);
+
+if (bi.x != bc.x)
+ error
+endif
+
+
+bd = Bard(5);
+try
+ bc = Bard(bd);
+ good = 0;
+catch
+ good = 1;
+end_try_catch
+
+if (!good)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/contract_runme.m b/Examples/test-suite/octave/contract_runme.m
new file mode 100644
index 000000000..9170e77f2
--- /dev/null
+++ b/Examples/test-suite/octave/contract_runme.m
@@ -0,0 +1,135 @@
+contract
+
+contract.test_preassert(1,2);
+try
+ contract.test_preassert(-1,0)
+ error("Failed! Preassertions are broken")
+catch
+end_try_catch
+
+contract.test_postassert(3);
+try
+ contract.test_postassert(-3);
+ error("Failed! Postassertions are broken")
+catch
+end_try_catch
+
+contract.test_prepost(2,3);
+contract.test_prepost(5,-4);
+try
+ contract.test_prepost(-3,4);
+ error("Failed! Preassertions are broken")
+catch
+end_try_catch
+
+try
+ contract.test_prepost(4,-10);
+ error("Failed! Postassertions are broken")
+
+catch
+end_try_catch
+
+f = contract.Foo();
+f.test_preassert(4,5);
+try
+ f.test_preassert(-2,3);
+ error("Failed! Method preassertion.")
+catch
+end_try_catch
+
+f.test_postassert(4);
+try
+ f.test_postassert(-4);
+ error("Failed! Method postassertion")
+catch
+end_try_catch
+
+f.test_prepost(3,4);
+f.test_prepost(4,-3);
+try
+ f.test_prepost(-4,2);
+ error("Failed! Method preassertion.")
+catch
+end_try_catch
+
+try
+ f.test_prepost(4,-10);
+ error("Failed! Method postassertion.")
+catch
+end_try_catch
+
+contract.Foo_stest_prepost(4,0);
+try
+ contract.Foo_stest_prepost(-4,2);
+ error("Failed! Static method preassertion")
+catch
+end_try_catch
+
+try
+ contract.Foo_stest_prepost(4,-10);
+ error("Failed! Static method posteassertion")
+catch
+end_try_catch
+
+b = contract.Bar();
+try
+ b.test_prepost(2,-4);
+ error("Failed! Inherited preassertion.")
+catch
+end_try_catch
+
+
+d = contract.D();
+try
+ d.foo(-1,1,1,1,1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+try
+ d.foo(1,-1,1,1,1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+try
+ d.foo(1,1,-1,1,1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+try
+ d.foo(1,1,1,-1,1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+try
+ d.foo(1,1,1,1,-1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+
+
+try
+ d.bar(-1,1,1,1,1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+try
+ d.bar(1,-1,1,1,1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+try
+ d.bar(1,1,-1,1,1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+try
+ d.bar(1,1,1,-1,1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+try
+ d.bar(1,1,1,1,-1);
+ error("Failed! Inherited preassertion (D).")
+catch
+end_try_catch
+
diff --git a/Examples/test-suite/octave/cpp_enum_runme.m b/Examples/test-suite/octave/cpp_enum_runme.m
new file mode 100644
index 000000000..fe5f3b183
--- /dev/null
+++ b/Examples/test-suite/octave/cpp_enum_runme.m
@@ -0,0 +1,27 @@
+cpp_enum
+
+f = cpp_enum.Foo();
+
+if (f.hola != cpp_enum.Foo_Hello)
+ error(f.hola);
+ error;
+endif
+
+f.hola = cpp_enum.Foo_Hi;
+if (f.hola != cpp_enum.Foo_Hi)
+ error(f.hola);
+ error;
+endif
+
+f.hola = cpp_enum.Foo_Hello;
+
+if (f.hola != cpp_enum.Foo_Hello)
+ error(f.hola);
+ error;
+endif
+
+cpp_enum.hi = cpp_enum.Hello;
+if (cpp_enum.hi != cpp_enum.Hello)
+ error(cpp_enum.hi);
+ error;
+endif
diff --git a/Examples/test-suite/octave/cpp_namespace_runme.m b/Examples/test-suite/octave/cpp_namespace_runme.m
new file mode 100644
index 000000000..ac6c663fa
--- /dev/null
+++ b/Examples/test-suite/octave/cpp_namespace_runme.m
@@ -0,0 +1,55 @@
+# Note: This example assumes that namespaces are flattened
+cpp_namespace
+
+n = cpp_namespace.fact(4);
+if (n != 24)
+ error("Bad return value!")
+endif
+
+if (cpp_namespace.cvar.Foo != 42)
+ error("Bad variable value!")
+endif
+
+t = cpp_namespace.Test();
+if (!strcmp(t.method(),"Test::method"))
+ error("Bad method return value!")
+endif
+
+if (!strcmp(cpp_namespace.do_method(t),"Test::method"))
+ error("Bad return value!")
+endif
+
+if (!strcmp(cpp_namespace.do_method2(t),"Test::method"))
+ error("Bad return value!")
+endif
+
+cpp_namespace.weird("hello", 4);
+
+clear t;
+
+t2 = cpp_namespace.Test2();
+t3 = cpp_namespace.Test3();
+t4 = cpp_namespace.Test4();
+t5 = cpp_namespace.Test5();
+
+if (cpp_namespace.foo3(42) != 42)
+ error("Bad return value!")
+endif
+
+if (!strcmp(cpp_namespace.do_method3(t2,40),"Test2::method"))
+ error("Bad return value!")
+endif
+
+if (!strcmp(cpp_namespace.do_method3(t3,40),"Test3::method"))
+ error("Bad return value!")
+endif
+
+if (!strcmp(cpp_namespace.do_method3(t4,40),"Test4::method"))
+ error("Bad return value!")
+endif
+
+if (!strcmp(cpp_namespace.do_method3(t5,40),"Test5::method"))
+ error("Bad return value!")
+endif
+
+
diff --git a/Examples/test-suite/octave/default_args_runme.m b/Examples/test-suite/octave/default_args_runme.m
new file mode 100644
index 000000000..f8a656003
--- /dev/null
+++ b/Examples/test-suite/octave/default_args_runme.m
@@ -0,0 +1,86 @@
+default_args
+
+
+if (default_args.Statics.staticmethod() != 60)
+ error
+endif
+
+if (default_args.cfunc1(1) != 2)
+ error
+endif
+
+if (default_args.cfunc2(1) != 3)
+ error
+endif
+
+if (default_args.cfunc3(1) != 4)
+ error
+endif
+
+
+f = default_args.Foo();
+
+f.newname();
+f.newname(1);
+
+
+try
+ f = default_args.Foo(1);
+ ok = 1;
+catch
+ ok = 0;
+end_try_catch
+if (ok)
+ error("Foo::Foo ignore is not working")
+endif
+
+try
+ f = default_args.Foo(1,2);
+ ok = 1;
+catch
+ ok = 0;
+end_try_catch
+if (ok)
+ error("Foo::Foo ignore is not working")
+endif
+
+try
+ f = default_args.Foo(1,2,3);
+ ok = 1;
+catch
+ ok = 0;
+end_try_catch
+if (ok)
+ error("Foo::Foo ignore is not working")
+endif
+
+try
+ m = f.meth(1);
+ ok = 1;
+catch
+ ok = 0;
+end_try_catch
+if (ok)
+ error("Foo::meth ignore is not working")
+endif
+
+try
+ m = f.meth(1,2);
+ ok = 1;
+catch
+ ok = 0;
+end_try_catch
+if (ok)
+ error("Foo::meth ignore is not working")
+endif
+
+try
+ m = f.meth(1,2,3);
+ ok = 1;
+catch
+ ok = 0;
+end_try_catch
+if (ok)
+ error("Foo::meth ignore is not working")
+endif
+
diff --git a/Examples/test-suite/octave/default_constructor_runme.m b/Examples/test-suite/octave/default_constructor_runme.m
new file mode 100644
index 000000000..41d0f3f1e
--- /dev/null
+++ b/Examples/test-suite/octave/default_constructor_runme.m
@@ -0,0 +1,111 @@
+default_constructor
+
+dc = default_constructor;
+
+a = dc.new_A();
+dc.delete_A(a);
+
+aa = dc.new_AA();
+dc.delete_AA(aa);
+
+try
+ b = dc.new_B();
+ error("Whoa. new_BB created.")
+catch
+end_try_catch
+
+del_b = dc.delete_B;
+
+try
+ bb = dc.new_BB();
+ error("Whoa. new_BB created.")
+catch
+end_try_catch
+
+del_bb = dc.delete_BB;
+
+try
+ c = dc.new_C();
+ error("Whoa. new_C created.")
+catch
+end_try_catch
+
+del_c = dc.delete_C;
+
+cc = dc.new_CC();
+dc.delete_CC(cc);
+
+try
+ d = dc.new_D();
+ error("Whoa. new_D created")
+catch
+end_try_catch
+
+del_d = dc.delete_D;
+
+try
+ dd = dc.new_DD();
+ error("Whoa. new_DD created")
+catch
+end_try_catch
+
+dd = dc.delete_DD;
+
+try
+ ad = dc.new_AD();
+ error("Whoa. new_AD created")
+catch
+end_try_catch
+
+del_ad = dc.delete_AD;
+
+e = dc.new_E();
+dc.delete_E(e);
+
+ee = dc.new_EE();
+dc.delete_EE(ee);
+
+try
+ eb = dc.new_EB();
+ error("Whoa. new_EB created")
+catch
+end_try_catch
+
+del_eb = dc.delete_EB;
+
+f = dc.new_F();
+
+try
+ del_f = dc.delete_F;
+ error("Whoa. delete_F created")
+catch
+end_try_catch
+
+dc.F_destroy(f);
+
+ff = dc.new_FFF();
+try
+ del_ff = dc.delete_FFF;
+ error("Whoa. delete_FFF created")
+catch
+end_try_catch
+
+dc.F_destroy(ff);
+
+g = dc.new_G();
+
+try
+ del_g = dc.delete_G;
+ error("Whoa. delete_G created")
+catch
+end_try_catch
+
+dc.G_destroy(g);
+
+gg = dc.new_GG();
+dc.delete_GG(gg);
+
+
+hh = default_constructor.HH(1,1);
+
+
diff --git a/Examples/test-suite/octave/director_abstract_runme.m b/Examples/test-suite/octave/director_abstract_runme.m
new file mode 100644
index 000000000..00fb676f5
--- /dev/null
+++ b/Examples/test-suite/octave/director_abstract_runme.m
@@ -0,0 +1,44 @@
+director_abstract
+
+MyFoo=@() subclass(director_abstract.Foo(),@ping);
+function out=ping(self)
+ out="MyFoo::ping()";
+end
+
+
+a = MyFoo();
+
+if (!strcmp(a.ping(),"MyFoo::ping()"))
+ error(a.ping())
+endif
+
+if (!strcmp(a.pong(),"Foo::pong();MyFoo::ping()"))
+ error(a.pong())
+endif
+
+
+MyExample1=@() subclass(director_abstract.Example1(),'Color',@(self,r,g,b) r);
+MyExample2=@(a,b) subclass(director_abstract.Example2(a,b),'Color',@(self,r,g,b) g);
+MyExample3=@() subclass(director_abstract.Example3_i(),'Color',@(self,r,g,b) b);
+
+me1 = MyExample1();
+if (director_abstract.Example1.get_color(me1, 1,2,3) != 1)
+ error
+endif
+
+me2 = MyExample2(1,2);
+if (me2.get_color(me2, 1,2,3) != 2)
+ error
+endif
+
+me3 = MyExample3();
+if (me3.get_color(me3, 1,2,3) != 3)
+ error
+endif
+
+
+# don't check that we cannot construct abstract bases, since we have no
+# way of disambiguating that with the normal construction case using
+# subclass. furthermore, calling a pure virtual method will still generate
+# an error.
+
diff --git a/Examples/test-suite/octave/director_basic_runme.m b/Examples/test-suite/octave/director_basic_runme.m
new file mode 100644
index 000000000..9de54a385
--- /dev/null
+++ b/Examples/test-suite/octave/director_basic_runme.m
@@ -0,0 +1,110 @@
+director_basic
+
+
+function self=OctFoo()
+ global director_basic;
+ self=subclass(director_basic.Foo());
+ self.ping=@OctFoo_ping;
+end
+function string=OctFoo_ping(self)
+ string="OctFoo::ping()";
+end
+
+a = OctFoo();
+
+if (!strcmp(a.ping(),"OctFoo::ping()"))
+ error(a.ping())
+endif
+
+if (!strcmp(a.pong(),"Foo::pong();OctFoo::ping()"))
+ error(a.pong())
+endif
+
+b = director_basic.Foo();
+
+if (!strcmp(b.ping(),"Foo::ping()"))
+ error(b.ping())
+endif
+
+if (!strcmp(b.pong(),"Foo::pong();Foo::ping()"))
+ error(b.pong())
+endif
+
+a = director_basic.A1(1);
+
+if (a.rg(2) != 2)
+ error
+endif
+
+function self=OctClass()
+ global director_basic;
+ self=subclass(director_basic.MyClass());
+ self.method=@OctClass_method;
+ self.vmethod=@OctClass_vmethod;
+end
+function OctClass_method(self,vptr)
+ self.cmethod = 7;
+end
+function out=OctClass_vmethod(self,b)
+ b.x = b.x + 31;
+ out=b;
+end
+
+b = director_basic.Bar(3);
+d = director_basic.MyClass();
+c = OctClass();
+
+cc = director_basic.MyClass_get_self(c);
+dd = director_basic.MyClass_get_self(d);
+
+bc = cc.cmethod(b);
+bd = dd.cmethod(b);
+
+cc.method(b);
+if (c.cmethod != 7)
+ error
+endif
+
+if (bc.x != 34)
+ error
+endif
+
+
+if (bd.x != 16)
+ error
+endif
+
+
+function self=OctMulti()
+ global director_basic;
+ self=subclass(director_basic.Foo(),director_basic.MyClass());
+ self.vmethod=@OctMulti_vmethod;
+ self.ping=@OctMulti_ping;
+end
+function out=OctMulti_vmethod(self,b)
+ b.x = b.x + 31;
+ out=b;
+end
+function out=OctMulti_ping(self)
+ out="OctFoo::ping()";
+end
+
+a = 0;
+for i=0:100,
+ octmult = OctMulti();
+ octmult.pong();
+ clear octmult
+endfor
+
+
+octmult = OctMulti();
+
+
+p1 = director_basic.Foo_get_self(octmult);
+p2 = director_basic.MyClass_get_self(octmult);
+
+p1.ping();
+p2.vmethod(bc);
+
+
+
diff --git a/Examples/test-suite/octave/director_classic_runme.m b/Examples/test-suite/octave/director_classic_runme.m
new file mode 100644
index 000000000..c1f8e95d4
--- /dev/null
+++ b/Examples/test-suite/octave/director_classic_runme.m
@@ -0,0 +1,98 @@
+director_classic
+
+TargetLangPerson=@() subclass(Person(),'id',@(self) "TargetLangPerson");
+TargetLangChild=@() subclass(Child(),'id',@(self) "TargetLangChild");
+TargetLangGrandChild=@() subclass(GrandChild(),'id',@(self) "TargetLangGrandChild");
+
+# Semis - don't override id() in target language
+TargetLangSemiPerson=@() subclass(Person());
+TargetLangSemiChild=@() subclass(Child());
+TargetLangSemiGrandChild=@() subclass(GrandChild());
+
+# Orphans - don't override id() in C++
+TargetLangOrphanPerson=@() subclass(OrphanPerson(),'id',@(self) "TargetLangOrphanPerson");
+TargetLangOrphanChild=@() subclass(OrphanChild(),'id',@(self) "TargetLangOrphanChild");
+
+
+function check(person,expected)
+ global Caller;
+
+ # Normal target language polymorphic call
+ ret = person.id();
+ if (ret != expected)
+ raise ("Failed. Received: " + ret + " Expected: " + expected);
+ endif
+
+ # Polymorphic call from C++
+ caller = Caller();
+ caller.setCallback(person);
+ ret = caller.call();
+ if (ret != expected)
+ error ("Failed. Received: " + ret + " Expected: " + expected);
+ endif
+
+ # Polymorphic call of object created in target language and passed to C++ and back again
+ baseclass = caller.baseClass();
+ ret = baseclass.id();
+ if (ret != expected)
+ error ("Failed. Received: " + ret + " Expected: " + expected);
+ endif
+
+ caller.resetCallback();
+end
+
+
+person = Person();
+check(person, "Person");
+clear person;
+
+person = Child();
+check(person, "Child");
+clear person;
+
+person = GrandChild();
+check(person, "GrandChild");
+clear person;
+
+person = TargetLangPerson();
+check(person, "TargetLangPerson");
+clear person;
+
+person = TargetLangChild();
+check(person, "TargetLangChild");
+clear person;
+
+person = TargetLangGrandChild();
+check(person, "TargetLangGrandChild");
+clear person;
+
+# Semis - don't override id() in target language
+person = TargetLangSemiPerson();
+check(person, "Person");
+clear person;
+
+person = TargetLangSemiChild();
+check(person, "Child");
+clear person;
+
+person = TargetLangSemiGrandChild();
+check(person, "GrandChild");
+clear person;
+
+# Orphans - don't override id() in C++
+person = OrphanPerson();
+check(person, "Person");
+clear person;
+
+person = OrphanChild();
+check(person, "Child");
+clear person;
+
+person = TargetLangOrphanPerson();
+check(person, "TargetLangOrphanPerson");
+clear person;
+
+person = TargetLangOrphanChild();
+check(person, "TargetLangOrphanChild");
+clear person;
+
diff --git a/Examples/test-suite/octave/director_default_runme.m b/Examples/test-suite/octave/director_default_runme.m
new file mode 100644
index 000000000..c0b479d2a
--- /dev/null
+++ b/Examples/test-suite/octave/director_default_runme.m
@@ -0,0 +1,10 @@
+director_default
+
+
+f = Foo();
+f = Foo(1);
+
+
+f = Bar();
+f = Bar(1);
+
diff --git a/Examples/test-suite/octave/director_detect_runme.m b/Examples/test-suite/octave/director_detect_runme.m
new file mode 100644
index 000000000..f2d8c8dd2
--- /dev/null
+++ b/Examples/test-suite/octave/director_detect_runme.m
@@ -0,0 +1,36 @@
+director_detect
+
+global MyBar=@(val=2) \
+ subclass(director_detect.Bar(),'val',val,@get_value,@get_class,@just_do_it,@clone);
+function val=get_value(self)
+ self.val = self.val + 1;
+ val = self.val;
+end
+function ptr=get_class(self)
+ global director_detect;
+ self.val = self.val + 1;
+ ptr=director_detect.A();
+end
+function just_do_it(self)
+ self.val = self.val + 1;
+end
+function ptr=clone(self)
+ global MyBar;
+ ptr=MyBar(self.val);
+end
+
+b = MyBar();
+
+f = b.baseclass();
+
+v = f.get_value();
+a = f.get_class();
+f.just_do_it();
+
+c = b.clone();
+vc = c.get_value();
+
+if ((v != 3) || (b.val != 5) || (vc != 6))
+ error("Bad virtual detection")
+endif
+
diff --git a/Examples/test-suite/octave/director_enum_runme.m b/Examples/test-suite/octave/director_enum_runme.m
new file mode 100644
index 000000000..96f158d39
--- /dev/null
+++ b/Examples/test-suite/octave/director_enum_runme.m
@@ -0,0 +1,10 @@
+director_enum
+
+MyFoo=@() subclass(director_enum.Foo(),'say_hi',@(self,val) val);
+
+b = director_enum.Foo();
+a = MyFoo();
+
+if (a.say_hi(director_enum.hello) != b.say_hello(director_enum.hi))
+ error
+endif
diff --git a/Examples/test-suite/octave/director_exception_runme.m b/Examples/test-suite/octave/director_exception_runme.m
new file mode 100644
index 000000000..3e0b23064
--- /dev/null
+++ b/Examples/test-suite/octave/director_exception_runme.m
@@ -0,0 +1,57 @@
+director_exception
+
+MyFoo=@() subclass(Foo(),
+ 'ping',@(self) raise(NotImplementedError("MyFoo::ping() EXCEPTION")));
+
+MyFoo2=@() subclass(Foo(),
+ 'ping',@(self) true);
+
+ok = 0;
+
+a = MyFoo();
+b = launder(a);
+
+try
+ b.pong();
+catch
+ [etype,e]=raised();
+ if (etype=="NotImplementedError")
+ ok=1;
+ endif
+end_try_catch
+
+if (!ok)
+ error
+endif
+
+ok = 0;
+
+a = MyFoo2();
+b = launder(a);
+
+try
+ b.pong();
+catch
+ ok = 1;
+end_try_catch
+
+if (!ok)
+ error
+endif
+
+
+try
+ raise(Exception2());
+catch
+ if (!strcmp(raised,"Exception2"))
+ rethrow(lasterr);
+ endif
+end_try_catch
+
+try
+ raise(Exception1());
+catch
+ if (!strcmp(raised,"Exception1"))
+ rethrow(lasterr);
+ endif
+end_try_catch
diff --git a/Examples/test-suite/octave/director_extend_runme.m b/Examples/test-suite/octave/director_extend_runme.m
new file mode 100644
index 000000000..1cbeac8e2
--- /dev/null
+++ b/Examples/test-suite/octave/director_extend_runme.m
@@ -0,0 +1,12 @@
+director_extend
+
+MyObject=@() subclass(SpObject(),'getFoo',@(self) 123);
+
+m = MyObject();
+if (m.dummy() != 666)
+ error("1st call")
+endif
+if (m.dummy() != 666)
+ error("2nd call")
+endif
+
diff --git a/Examples/test-suite/octave/director_finalizer_runme.m b/Examples/test-suite/octave/director_finalizer_runme.m
new file mode 100644
index 000000000..3781a0f77
--- /dev/null
+++ b/Examples/test-suite/octave/director_finalizer_runme.m
@@ -0,0 +1,56 @@
+director_finalizer
+
+MyFoo=@() subclass(Foo(),'__del__',@delete_MyFoo);
+function delete_MyFoo(self)
+ self.orStatus(2);
+ try
+ Foo.__del__(self);
+ catch
+ end_try_catch
+endfunction
+
+resetStatus();
+
+a = MyFoo();
+clear a;
+
+if (getStatus() != 3)
+ error
+endif
+
+resetStatus();
+
+a = MyFoo();
+launder(a);
+
+if (getStatus() != 0)
+ error
+endif
+
+clear a;
+
+if (getStatus() != 3)
+ error
+endif
+
+resetStatus();
+
+a = MyFoo().__disown__();
+deleteFoo(a);
+
+if (getStatus() != 3)
+ error
+endif
+
+resetStatus();
+
+a = MyFoo().__disown__();
+deleteFoo(launder(a));
+
+if (getStatus() != 3)
+ error
+endif
+
+resetStatus();
+
+
diff --git a/Examples/test-suite/octave/director_frob_runme.m b/Examples/test-suite/octave/director_frob_runme.m
new file mode 100644
index 000000000..16585cc9e
--- /dev/null
+++ b/Examples/test-suite/octave/director_frob_runme.m
@@ -0,0 +1,9 @@
+director_frob
+
+foo = Bravo();
+s = foo.abs_method();
+
+if (!strcmp(s,"Bravo::abs_method()"))
+ error(s)
+endif
+
diff --git a/Examples/test-suite/octave/director_nested_runme.m b/Examples/test-suite/octave/director_nested_runme.m
new file mode 100644
index 000000000..6e1d0ded9
--- /dev/null
+++ b/Examples/test-suite/octave/director_nested_runme.m
@@ -0,0 +1,39 @@
+director_nested
+
+A=@() subclass(FooBar_int(),
+ 'do_step',@(self) "A::do_step;",
+ 'get_value',@(self) "A::get_value");
+
+a = A();
+if (!strcmp(a.step(),"Bar::step;Foo::advance;Bar::do_advance;A::do_step;"))
+ error("Bad A virtual resolution")
+endif
+
+B=@() subclass(FooBar_int(),
+ 'do_advance',@(self) strcat("B::do_advance;",self.do_step()),
+ 'do_step',@(self) "B::do_step;",
+ 'get_value',@(self) 1);
+
+b = B();
+
+if (!strcmp(b.step(),"Bar::step;Foo::advance;B::do_advance;B::do_step;"))
+ error("Bad B virtual resolution")
+endif
+
+C=@() subclass(FooBar_int(),
+ 'do_advance',@(self) strcat("C::do_advance;",self.FooBar_int.do_advance()),
+ 'do_step',@(self) "C::do_step;",
+ 'get_value',@(self) 2,
+ 'get_name',@(self) strcat(self.FooBar_int.get_name()," hello"));
+
+cc = C();
+c = FooBar_int_get_self(cc);
+c.advance();
+
+if (!strcmp(c.get_name(),"FooBar::get_name hello"))
+ error
+endif
+
+if (!strcmp(c.name(),"FooBar::get_name hello"))
+ error
+endif
diff --git a/Examples/test-suite/octave/director_stl_runme.m b/Examples/test-suite/octave/director_stl_runme.m
new file mode 100644
index 000000000..e8f4c5e34
--- /dev/null
+++ b/Examples/test-suite/octave/director_stl_runme.m
@@ -0,0 +1,31 @@
+director_stl
+
+MyFoo=@() subclass(director_stl.Foo(),\
+ 'ping',@(self,s) "MyFoo::ping():" + s,\
+ 'pident',@(self,arg) arg,\
+ 'vident',@(self,v) v,\
+ 'vidents',@(self,v) v,\
+ 'vsecond',@(self,v1,v2) v2,\
+);
+
+a = MyFoo();
+
+a.tping("hello");
+a.tpong("hello");
+
+p = {1,2}
+a.pident(p);
+v = {3,4}
+a.vident(v);
+
+a.tpident(p);
+a.tvident(v);
+
+v1 = {3,4};
+v2 = {5,6};
+a.tvsecond(v1,v2);
+
+vs=("hi", "hello");
+vs;
+a.tvidents(vs);
+
diff --git a/Examples/test-suite/octave/director_string_runme.m b/Examples/test-suite/octave/director_string_runme.m
new file mode 100644
index 000000000..c2d4e9ce7
--- /dev/null
+++ b/Examples/test-suite/octave/director_string_runme.m
@@ -0,0 +1,27 @@
+director_string
+
+
+function out=get_first(self)
+ out = strcat(self.A.get_first()," world!");
+end
+function process_text(self,string)
+ self.A.process_text(string);
+ self.smem = "hello";
+end
+B=@(string) subclass(A(string),'get_first',@get_first,'process_text',@process_text);
+
+
+b = B("hello");
+
+b.get(0);
+if (!strcmp(b.get_first(),"hello world!"))
+ error(b.get_first())
+endif
+
+b.call_process_func();
+
+if (!strcmp(b.smem,"hello"))
+ error(b.smem)
+endif
+
+
diff --git a/Examples/test-suite/octave/director_unroll_runme.m b/Examples/test-suite/octave/director_unroll_runme.m
new file mode 100644
index 000000000..6ca213c4c
--- /dev/null
+++ b/Examples/test-suite/octave/director_unroll_runme.m
@@ -0,0 +1,16 @@
+director_unroll
+
+MyFoo=@() subclass(director_unroll.Foo(),'ping',@(self) "MyFoo::ping()");
+
+a = MyFoo();
+
+b = director_unroll.Bar();
+
+b.set(a);
+c = b.get();
+
+if (swig_this(a) != swig_this(c))
+ a,c
+ error
+endif
+
diff --git a/Examples/test-suite/octave/director_wstring_runme.m b/Examples/test-suite/octave/director_wstring_runme.m
new file mode 100644
index 000000000..b59ff6efa
--- /dev/null
+++ b/Examples/test-suite/octave/director_wstring_runme.m
@@ -0,0 +1,21 @@
+director_wstring
+
+
+B=@(string) subclass(A(string),\
+ 'get_first',A.get_first(self) + " world!",\
+ 'process_text',@(self) self.smem = u"hello"\
+ );
+
+b = B("hello");
+
+b.get(0);
+if (!strcmp(b.get_first(),"hello world!"))
+ error(b.get_first())
+endif
+
+b.call_process_func();
+
+if (!strcmp(b.smem,"hello"))
+ error(smem)
+endif
+
diff --git a/Examples/test-suite/octave/dynamic_cast_runme.m b/Examples/test-suite/octave/dynamic_cast_runme.m
new file mode 100644
index 000000000..dad0ba25c
--- /dev/null
+++ b/Examples/test-suite/octave/dynamic_cast_runme.m
@@ -0,0 +1,14 @@
+dynamic_cast
+
+f = dynamic_cast.Foo();
+b = dynamic_cast.Bar();
+
+x = f.blah();
+y = b.blah();
+
+a = dynamic_cast.do_test(y);
+if (!strcmp(a,"Bar::test"))
+ error("Failed!!")
+endif
+
+
diff --git a/Examples/test-suite/octave/empty_runme.m b/Examples/test-suite/octave/empty_runme.m
new file mode 100644
index 000000000..c6cac6926
--- /dev/null
+++ b/Examples/test-suite/octave/empty_runme.m
@@ -0,0 +1 @@
+empty
diff --git a/Examples/test-suite/octave/enum_template_runme.m b/Examples/test-suite/octave/enum_template_runme.m
new file mode 100644
index 000000000..ca10f1f37
--- /dev/null
+++ b/Examples/test-suite/octave/enum_template_runme.m
@@ -0,0 +1,13 @@
+enum_template
+
+if (enum_template.MakeETest() != 1)
+ error
+endif
+
+enum_template.TakeETest(0);
+try
+ a=enum_template.TakeETest(0);
+ error
+catch
+end_try_catch
+
diff --git a/Examples/test-suite/octave/enums_runme.m b/Examples/test-suite/octave/enums_runme.m
new file mode 100644
index 000000000..91f2ce2bf
--- /dev/null
+++ b/Examples/test-suite/octave/enums_runme.m
@@ -0,0 +1,7 @@
+
+enums
+
+enums.bar2(1)
+enums.bar3(1)
+enums.bar1(1)
+
diff --git a/Examples/test-suite/octave/exception_order_runme.m b/Examples/test-suite/octave/exception_order_runme.m
new file mode 100644
index 000000000..a5914f822
--- /dev/null
+++ b/Examples/test-suite/octave/exception_order_runme.m
@@ -0,0 +1,45 @@
+exception_order
+
+
+a = A();
+
+try
+ a.foo()
+catch
+ if (!strcmp(raised(),"E1"))
+ error, "bad exception order"
+ endif
+end_try_catch
+
+try
+ a.bar()
+catch
+ if (!strcmp(raised(),"E2"))
+ error, "bad exception order"
+ endif
+end_try_catch
+
+try
+ a.foobar()
+catch
+ [t,e]=raised();
+ if (!strcmp(e.args(0),"postcatch unknown"))
+ error
+ endif
+end_try_catch
+
+try
+ a.barfoo(1)
+catch
+ if (!strcmp(raised(),"E1"))
+ error, "bad exception order"
+ endif
+end_try_catch
+
+try
+ a.barfoo(2)
+catch
+ if (!strcmp(raised(),"E2"))
+ error, "bad exception order"
+ endif
+end_try_catch
diff --git a/Examples/test-suite/octave/extend_placement_runme.m b/Examples/test-suite/octave/extend_placement_runme.m
new file mode 100644
index 000000000..b7a8e783d
--- /dev/null
+++ b/Examples/test-suite/octave/extend_placement_runme.m
@@ -0,0 +1,46 @@
+extend_placement
+
+foo = extend_placement.Foo();
+foo = extend_placement.Foo(1);
+foo = extend_placement.Foo(1,1);
+foo.spam();
+foo.spam("hello");
+foo.spam(1);
+foo.spam(1,1);
+foo.spam(1,1,1);
+foo.spam(extend_placement.Foo());
+foo.spam(extend_placement.Foo(), 1.0);
+
+
+bar = extend_placement.Bar();
+bar = extend_placement.Bar(1);
+bar.spam();
+bar.spam("hello");
+bar.spam(1);
+bar.spam(1,1);
+bar.spam(1,1,1);
+bar.spam(extend_placement.Bar());
+bar.spam(extend_placement.Bar(), 1.0);
+
+
+foo = extend_placement.FooTi();
+foo = extend_placement.FooTi(1);
+foo = extend_placement.FooTi(1,1);
+foo.spam();
+foo.spam("hello");
+foo.spam(1);
+foo.spam(1,1);
+foo.spam(1,1,1);
+foo.spam(extend_placement.Foo());
+foo.spam(extend_placement.Foo(), 1.0);
+
+
+bar = extend_placement.BarTi();
+bar = extend_placement.BarTi(1);
+bar.spam();
+bar.spam("hello");
+bar.spam(1);
+bar.spam(1,1);
+bar.spam(1,1,1);
+bar.spam(extend_placement.Bar());
+bar.spam(extend_placement.Bar(), 1.0);
diff --git a/Examples/test-suite/octave/extend_template_ns_runme.m b/Examples/test-suite/octave/extend_template_ns_runme.m
new file mode 100644
index 000000000..401ea6327
--- /dev/null
+++ b/Examples/test-suite/octave/extend_template_ns_runme.m
@@ -0,0 +1,10 @@
+extend_template_ns
+
+f = Foo_One();
+if (f.test1(37) != 37)
+ error
+endif
+
+if (f.test2(42) != 42)
+ error
+endif
diff --git a/Examples/test-suite/octave/extend_template_runme.m b/Examples/test-suite/octave/extend_template_runme.m
new file mode 100644
index 000000000..1cad7bfc9
--- /dev/null
+++ b/Examples/test-suite/octave/extend_template_runme.m
@@ -0,0 +1,10 @@
+extend_template
+
+f = extend_template.Foo_0();
+if (f.test1(37) != 37)
+ error
+endif
+
+if (f.test2(42) != 42)
+ error
+endif
diff --git a/Examples/test-suite/octave/extend_variable_runme.m b/Examples/test-suite/octave/extend_variable_runme.m
new file mode 100644
index 000000000..c55b6c55c
--- /dev/null
+++ b/Examples/test-suite/octave/extend_variable_runme.m
@@ -0,0 +1,6 @@
+extend_variable
+
+if (Foo.Bar != 42)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/file_test_runme.m b/Examples/test-suite/octave/file_test_runme.m
new file mode 100644
index 000000000..4c22a307c
--- /dev/null
+++ b/Examples/test-suite/octave/file_test_runme.m
@@ -0,0 +1,9 @@
+file_test
+
+file_test.nfile("stdout");
+
+cstdout = file_test.GetStdOut();
+
+file_test.nfile(cstdout);
+file_test.nfile_name("test.dat");
+
diff --git a/Examples/test-suite/octave/friends_runme.m b/Examples/test-suite/octave/friends_runme.m
new file mode 100644
index 000000000..e18f47a24
--- /dev/null
+++ b/Examples/test-suite/octave/friends_runme.m
@@ -0,0 +1,46 @@
+friends
+
+a = friends.A(2);
+
+if (friends.get_val1(a) != 2)
+ error
+endif
+if (friends.get_val2(a) != 4)
+ error
+endif
+if (friends.get_val3(a) != 6)
+ error
+endif
+
+ # nice overload working fine
+if (friends.get_val1(1,2,3) != 1)
+ error
+endif
+
+b = friends.B(3);
+
+ # David's case
+if (friends.mix(a,b) != 5)
+ error
+endif
+
+di = friends.D_d(2);
+dd = friends.D_d(3.3);
+
+ # incredible template overloading working just fine
+if (friends.get_val1(di) != 2)
+ error
+endif
+if (friends.get_val1(dd) != 3.3)
+ error
+endif
+
+friends.set(di, 4);
+friends.set(dd, 1.3);
+
+if (friends.get_val1(di) != 4)
+ error
+endif
+if (friends.get_val1(dd) != 1.3)
+ error
+endif
diff --git a/Examples/test-suite/octave/fvirtual_runme.m b/Examples/test-suite/octave/fvirtual_runme.m
new file mode 100644
index 000000000..06c6e7ccb
--- /dev/null
+++ b/Examples/test-suite/octave/fvirtual_runme.m
@@ -0,0 +1,10 @@
+fvirtual
+
+sw = Switch();
+n = Node();
+i = sw.addChild(n);
+
+if (i != 2)
+ error("addChild")
+endif
+
diff --git a/Examples/test-suite/octave/global_ns_arg_runme.m b/Examples/test-suite/octave/global_ns_arg_runme.m
new file mode 100644
index 000000000..fa3625ef1
--- /dev/null
+++ b/Examples/test-suite/octave/global_ns_arg_runme.m
@@ -0,0 +1,5 @@
+global_ns_arg
+
+a = foo(1);
+b = bar();
+
diff --git a/Examples/test-suite/octave/grouping_runme.m b/Examples/test-suite/octave/grouping_runme.m
new file mode 100644
index 000000000..26b896c2b
--- /dev/null
+++ b/Examples/test-suite/octave/grouping_runme.m
@@ -0,0 +1,15 @@
+grouping
+
+x = grouping.test1(42);
+if (x != 42)
+ error
+endif
+
+grouping.test2(42);
+
+x = (grouping.do_unary(37, grouping.NEGATE));
+if (x != -37)
+ error
+endif
+
+grouping.cvar.test3 = 42;
diff --git a/Examples/test-suite/octave/iadd_runme.m b/Examples/test-suite/octave/iadd_runme.m
new file mode 100755
index 000000000..c386c669e
--- /dev/null
+++ b/Examples/test-suite/octave/iadd_runme.m
@@ -0,0 +1,10 @@
+iadd
+
+f = iadd.Foo();
+
+f.AsA.x = 3;
+f.AsA += f.AsA;
+
+if (f.AsA.x != 6)
+ error
+endif
diff --git a/Examples/test-suite/octave/import_nomodule_runme.m b/Examples/test-suite/octave/import_nomodule_runme.m
new file mode 100644
index 000000000..a70b46885
--- /dev/null
+++ b/Examples/test-suite/octave/import_nomodule_runme.m
@@ -0,0 +1,8 @@
+import_nomodule
+
+f = create_Foo();
+test1(f,42);
+delete_Foo(f);
+
+b = Bar();
+test1(b,37);
diff --git a/Examples/test-suite/octave/imports_runme.m b/Examples/test-suite/octave/imports_runme.m
new file mode 100644
index 000000000..3964552ab
--- /dev/null
+++ b/Examples/test-suite/octave/imports_runme.m
@@ -0,0 +1,19 @@
+# This is the import runtime testcase.
+
+imports_b
+imports_a
+
+x = imports_b.B();
+x.hello();
+
+a = imports_a.A();
+
+c = imports_b.C();
+a1 = c.get_a(c);
+a2 = c.get_a_type(c);
+
+a1.hello();
+a2.hello();
+assert(swig_this(a1)==swig_this(a2));
+assert(strcmp(swig_type(a1),swig_type(a2)));
+
diff --git a/Examples/test-suite/octave/inctest_runme.m b/Examples/test-suite/octave/inctest_runme.m
new file mode 100644
index 000000000..ab0cb64ef
--- /dev/null
+++ b/Examples/test-suite/octave/inctest_runme.m
@@ -0,0 +1,24 @@
+inctest
+
+try
+ a = inctest.A();
+catch
+ error("didn't find A\ntherefore, I didn't include \
+ 'testdir/subdir1/hello.i'")
+end_try_catch
+
+try
+ b = inctest.B();
+catch
+ error("didn't find B\ntherefore, I didn't include 'testdir/subdir2/hello.i'")
+end_try_catch
+
+# Check the import in subdirectory worked
+if (inctest.importtest1(5) != 15)
+ error("import test 1 failed")
+endif
+
+if (!strcmp(inctest.importtest2("black"),"white"))
+ error("import test 2 failed")
+endif
+
diff --git a/Examples/test-suite/octave/inherit_missing_runme.m b/Examples/test-suite/octave/inherit_missing_runme.m
new file mode 100644
index 000000000..8517e2d89
--- /dev/null
+++ b/Examples/test-suite/octave/inherit_missing_runme.m
@@ -0,0 +1,22 @@
+inherit_missing
+
+a = inherit_missing.new_Foo();
+b = inherit_missing.Bar();
+c = inherit_missing.Spam();
+
+x = inherit_missing.do_blah(a);
+if (!strcmp(x, "Foo::blah"))
+ error("Whoa! Bad return %s", x)
+endif
+
+x = inherit_missing.do_blah(b);
+if (!strcmp(x, "Bar::blah"))
+ error("Whoa! Bad return %s", x)
+endif
+
+x = inherit_missing.do_blah(c);
+if (!strcmp(x, "Spam::blah"))
+ error("Whoa! Bad return %s", x)
+endif
+
+inherit_missing.delete_Foo(a);
diff --git a/Examples/test-suite/octave/inout_runme.m b/Examples/test-suite/octave/inout_runme.m
new file mode 100644
index 000000000..74caaff46
--- /dev/null
+++ b/Examples/test-suite/octave/inout_runme.m
@@ -0,0 +1,27 @@
+inout
+
+a = inout.AddOne1(1);
+if (a != 2)
+ error
+endif
+
+a = inout.AddOne3(1,1,1);
+if (a != [2,2,2])
+ error
+endif
+
+a = inout.AddOne1p((1,1));
+if (a != (2,2))
+ error
+endif
+
+a = inout.AddOne2p((1,1),1);
+if (a != [(2,2),2])
+ error
+endif
+
+a = inout.AddOne3p(1,(1,1),1);
+if (a != [2,(2,2),2])
+ error
+endif
+
diff --git a/Examples/test-suite/octave/inplaceadd_runme.m b/Examples/test-suite/octave/inplaceadd_runme.m
new file mode 100644
index 000000000..2bc193793
--- /dev/null
+++ b/Examples/test-suite/octave/inplaceadd_runme.m
@@ -0,0 +1,24 @@
+inplaceadd
+a = inplaceadd.A(7);
+
+a += 5;
+if (a.val != 12)
+ error
+endif
+
+a -= 5;
+if a.val != 7:
+ error
+endif
+
+a *= 2;
+
+if (a.val != 14)
+ error
+endif
+
+a += a;
+if (a.val != 28)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/input_runme.m b/Examples/test-suite/octave/input_runme.m
new file mode 100644
index 000000000..757862179
--- /dev/null
+++ b/Examples/test-suite/octave/input_runme.m
@@ -0,0 +1,22 @@
+input
+
+f = Foo();
+if (f.foo(2) != 4)
+ error
+endif
+
+try
+ a=f.foo();
+ error
+catch
+end_try_catch
+
+if (!strcmp(sfoo("Hello"),"Hello world"))
+ error
+endif
+
+try
+ a=sfoo();
+ error
+catch
+end_try_catch
diff --git a/Examples/test-suite/octave/langobj_runme.m b/Examples/test-suite/octave/langobj_runme.m
new file mode 100644
index 000000000..a18905ec0
--- /dev/null
+++ b/Examples/test-suite/octave/langobj_runme.m
@@ -0,0 +1,12 @@
+langobj
+
+
+x ="hello"
+rx = sys.getrefcount(x)
+v = identity(x)
+rv = sys.getrefcount(v)
+if v != x:
+ error
+
+if rv - rx != 1:
+ error
diff --git a/Examples/test-suite/octave/li_attribute_runme.m b/Examples/test-suite/octave/li_attribute_runme.m
new file mode 100644
index 000000000..49d488b0a
--- /dev/null
+++ b/Examples/test-suite/octave/li_attribute_runme.m
@@ -0,0 +1,57 @@
+li_attribute
+
+aa = li_attribute.A(1,2,3);
+
+if (aa.a != 1)
+ error
+endif
+aa.a = 3;
+if (aa.a != 3)
+ error("aa.a = %i",aa.a)
+endif
+
+
+if (aa.b != 2)
+ error(aa.b)
+endif
+aa.b = 5;
+if (aa.b != 5)
+ error
+endif
+
+
+
+if (aa.d != aa.b)
+ error
+endif
+
+if (aa.c != 3)
+ error
+endif
+
+pi = li_attribute.Param_i(7);
+if (pi.value != 7)
+ error
+endif
+
+pi.value=3;
+if (pi.value != 3)
+ error
+endif
+
+
+b = li_attribute.B(aa);
+
+if (b.a.c != 3)
+ error
+endif
+
+
+myFoo = li_attribute.MyFoo;
+myFoo.x = 8;
+myClass = li_attribute.MyClass;
+myClass.Foo = myFoo;
+if (myClass.Foo.x != 8)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/li_boost_shared_ptr_runme.m b/Examples/test-suite/octave/li_boost_shared_ptr_runme.m
new file mode 100644
index 000000000..358b55d0a
--- /dev/null
+++ b/Examples/test-suite/octave/li_boost_shared_ptr_runme.m
@@ -0,0 +1,478 @@
+li_boost_shared_ptr
+
+debug = false;
+
+function main()
+ if (debug)
+ printf("Started\n")
+ endif
+
+ li_boost_shared_ptr.cvar.debug_shared = debug;
+
+ # Change loop count to run for a long time to monitor memory
+ loopCount = 1 #5000
+ for i=0:loopCount,
+ self.runtest();
+ endif
+
+ if (li_boost_shared_ptr.Klass.getTotal_count() != 0)
+ error("Klass.total_count=", li_boost_shared_ptr.Klass.getTotal_count())
+ endif
+
+ wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count();
+ if (wrapper_count != li_boost_shared_ptr.NOT_COUNTING)
+ if (wrapper_count != 0)
+ error("shared_ptr wrapper count not zero: %i", wrapper_count)
+ endif
+ endif
+
+ if (debug)
+ error("Finished")
+ endif
+endfunction
+
+function runtest()
+ # simple shared_ptr usage - created in C++
+ k = li_boost_shared_ptr.Klass("me oh my");
+ val = k.getValue();
+ self.verifyValue("me oh my", val);
+ self.verifyCount(1, k);
+
+ # simple shared_ptr usage - not created in C++
+ k = li_boost_shared_ptr.factorycreate();
+ val = k.getValue();
+ self.verifyValue("factorycreate", val);
+ self.verifyCount(1, k);
+
+ # pass by shared_ptr
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.smartpointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my smartpointertest", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # pass by shared_ptr pointer
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.smartpointerpointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my smartpointerpointertest", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # pass by shared_ptr reference
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.smartpointerreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my smartpointerreftest", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # pass by shared_ptr pointer reference
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.smartpointerpointerreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my smartpointerpointerreftest", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # const pass by shared_ptr
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.constsmartpointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # const pass by shared_ptr pointer
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.constsmartpointerpointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # const pass by shared_ptr reference
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.constsmartpointerreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # pass by value
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.valuetest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my valuetest", val);
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # pass by pointer
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.pointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my pointertest", val);
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # pass by reference
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.reftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my reftest", val);
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # pass by pointer reference
+ k = li_boost_shared_ptr.Klass("me oh my");
+ kret = li_boost_shared_ptr.pointerreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my pointerreftest", val);
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # null tests
+ k = None;
+
+ if (li_boost_shared_ptr.smartpointertest(k) != None)
+ error("return was not null")
+ endif
+
+ if (li_boost_shared_ptr.smartpointerpointertest(k) != None)
+ error("return was not null")
+ endif
+
+ if (li_boost_shared_ptr.smartpointerreftest(k) != None)
+ error("return was not null")
+ endif
+
+ if (li_boost_shared_ptr.smartpointerpointerreftest(k) != None)
+ error("return was not null")
+ endif
+
+ if (li_boost_shared_ptr.nullsmartpointerpointertest(None) != "null pointer")
+ error("not null smartpointer pointer")
+ endif
+
+ try
+ li_boost_shared_ptr.valuetest(k)
+ error("Failed to catch null pointer")
+ catch
+ end_try_catch
+
+ if (li_boost_shared_ptr.pointertest(k) != None)
+ error("return was not null")
+ endif
+
+ try
+ li_boost_shared_ptr.reftest(k)
+ error("Failed to catch null pointer")
+ catch
+ end_try_catch
+
+ # $owner
+ k = li_boost_shared_ptr.pointerownertest();
+ val = k.getValue();
+ self.verifyValue("pointerownertest", val);
+ self.verifyCount(1, k);
+ k = li_boost_shared_ptr.smartpointerpointerownertest();
+ val = k.getValue();
+ self.verifyValue("smartpointerpointerownertest", val);
+ self.verifyCount(1, k);
+
+ # //////////////////////////////// Derived class ////////////////////////////////////////
+ # derived pass by shared_ptr
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.derivedsmartptrtest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my derivedsmartptrtest-Derived", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # derived pass by shared_ptr pointer
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.derivedsmartptrpointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my derivedsmartptrpointertest-Derived", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # derived pass by shared_ptr ref
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.derivedsmartptrreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my derivedsmartptrreftest-Derived", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # derived pass by shared_ptr pointer ref
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.derivedsmartptrpointerreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my derivedsmartptrpointerreftest-Derived", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # derived pass by pointer
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.derivedpointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my derivedpointertest-Derived", val);
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # derived pass by ref
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.derivedreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my derivedreftest-Derived", val);
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # //////////////////////////////// Derived and base class mixed ////////////////////////////////////////
+ # pass by shared_ptr (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.smartpointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my smartpointertest-Derived", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # pass by shared_ptr pointer (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.smartpointerpointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my smartpointerpointertest-Derived", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # pass by shared_ptr reference (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.smartpointerreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my smartpointerreftest-Derived", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # pass by shared_ptr pointer reference (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.smartpointerpointerreftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my smartpointerpointerreftest-Derived", val);
+ self.verifyCount(2, k);
+ self.verifyCount(2, kret);
+
+ # pass by value (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.valuetest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my valuetest", val); # note slicing
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # pass by pointer (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.pointertest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my pointertest-Derived", val);
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # pass by ref (mixed)
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ kret = li_boost_shared_ptr.reftest(k);
+ val = kret.getValue();
+ self.verifyValue("me oh my reftest-Derived", val);
+ self.verifyCount(1, k);
+ self.verifyCount(1, kret);
+
+ # //////////////////////////////// Overloading tests ////////////////////////////////////////
+ # Base class
+ k = li_boost_shared_ptr.Klass("me oh my");
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyval(k), "rawbyval");
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyref(k), "rawbyref");
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyptr(k), "rawbyptr");
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyptrref(k), "rawbyptrref");
+
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyval(k), "smartbyval");
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyref(k), "smartbyref");
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyptr(k), "smartbyptr");
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyptrref(k), "smartbyptrref");
+
+ # Derived class
+ k = li_boost_shared_ptr.KlassDerived("me oh my");
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyval(k), "rawbyval");
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyref(k), "rawbyref");
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyptr(k), "rawbyptr");
+ self.verifyValue(li_boost_shared_ptr.overload_rawbyptrref(k), "rawbyptrref");
+
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyval(k), "smartbyval");
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyref(k), "smartbyref");
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyptr(k), "smartbyptr");
+ self.verifyValue(li_boost_shared_ptr.overload_smartbyptrref(k), "smartbyptrref");
+
+ # //////////////////////////////// Member variables ////////////////////////////////////////
+ # smart pointer by value
+ m = li_boost_shared_ptr.MemberVariables();
+ k = li_boost_shared_ptr.Klass("smart member value");
+ m.SmartMemberValue = k;
+ val = k.getValue();
+ self.verifyValue("smart member value", val);
+ self.verifyCount(2, k);
+
+ kmember = m.SmartMemberValue;
+ val = kmember.getValue();
+ self.verifyValue("smart member value", val);
+ self.verifyCount(3, kmember);
+ self.verifyCount(3, k);
+
+ clear m;
+ self.verifyCount(2, kmember);
+ self.verifyCount(2, k);
+
+ # smart pointer by pointer
+ m = li_boost_shared_ptr.MemberVariables();
+ k = li_boost_shared_ptr.Klass("smart member pointer");
+ m.SmartMemberPointer = k;
+ val = k.getValue();
+ self.verifyValue("smart member pointer", val);
+ self.verifyCount(1, k);
+
+ kmember = m.SmartMemberPointer;
+ val = kmember.getValue();
+ self.verifyValue("smart member pointer", val);
+ self.verifyCount(2, kmember);
+ self.verifyCount(2, k);
+
+ clear m;
+ self.verifyCount(2, kmember);
+ self.verifyCount(2, k);
+
+ # smart pointer by reference
+ m = li_boost_shared_ptr.MemberVariables();
+ k = li_boost_shared_ptr.Klass("smart member reference");
+ m.SmartMemberReference = k;
+ val = k.getValue();
+ self.verifyValue("smart member reference", val);
+ self.verifyCount(2, k);
+
+ kmember = m.SmartMemberReference;
+ val = kmember.getValue();
+ self.verifyValue("smart member reference", val);
+ self.verifyCount(3, kmember);
+ self.verifyCount(3, k);
+
+ # The C++ reference refers to SmartMemberValue...
+ kmemberVal = m.SmartMemberValue;
+ val = kmember.getValue();
+ self.verifyValue("smart member reference", val);
+ self.verifyCount(4, kmemberVal);
+ self.verifyCount(4, kmember);
+ self.verifyCount(4, k);
+
+ clear m;
+ self.verifyCount(3, kmemberVal);
+ self.verifyCount(3, kmember);
+ self.verifyCount(3, k);
+
+ # plain by value
+ m = li_boost_shared_ptr.MemberVariables();
+ k = li_boost_shared_ptr.Klass("plain member value");
+ m.MemberValue = k;
+ val = k.getValue();
+ self.verifyValue("plain member value", val);
+ self.verifyCount(1, k);
+
+ kmember = m.MemberValue;
+ val = kmember.getValue();
+ self.verifyValue("plain member value", val);
+ self.verifyCount(1, kmember);
+ self.verifyCount(1, k);
+
+ clear m;
+ self.verifyCount(1, kmember);
+ self.verifyCount(1, k);
+
+ # plain by pointer
+ m = li_boost_shared_ptr.MemberVariables();
+ k = li_boost_shared_ptr.Klass("plain member pointer");
+ m.MemberPointer = k;
+ val = k.getValue();
+ self.verifyValue("plain member pointer", val);
+ self.verifyCount(1, k);
+
+ kmember = m.MemberPointer;
+ val = kmember.getValue();
+ self.verifyValue("plain member pointer", val);
+ self.verifyCount(1, kmember);
+ self.verifyCount(1, k);
+
+ clear m;
+ self.verifyCount(1, kmember);
+ self.verifyCount(1, k);
+
+ # plain by reference
+ m = li_boost_shared_ptr.MemberVariables();
+ k = li_boost_shared_ptr.Klass("plain member reference");
+ m.MemberReference = k;
+ val = k.getValue();
+ self.verifyValue("plain member reference", val);
+ self.verifyCount(1, k);
+
+ kmember = m.MemberReference;
+ val = kmember.getValue();
+ self.verifyValue("plain member reference", val);
+ self.verifyCount(1, kmember);
+ self.verifyCount(1, k);
+
+ clear m;
+ self.verifyCount(1, kmember);
+ self.verifyCount(1, k);
+
+ # null member variables
+ m = li_boost_shared_ptr.MemberVariables();
+
+ # shared_ptr by value
+ k = m.SmartMemberValue;
+ if (k != None)
+ error("expected null")
+ endif
+ m.SmartMemberValue = None;
+ k = m.SmartMemberValue;
+ if (k != None)
+ error("expected null")
+ endif
+ self.verifyCount(0, k);
+
+ # plain by value
+ try
+ m.MemberValue = None;
+ error("Failed to catch null pointer");
+ catch
+ end_try_catch
+
+ # templates
+ pid = li_boost_shared_ptr.PairIntDouble(10, 20.2)
+ if (pid.baseVal1 != 20 or pid.baseVal2 != 40.4)
+ error("Base values wrong")
+ endif
+ if (pid.val1 != 10 or pid.val2 != 20.2)
+ error("Derived Values wrong")
+ endif
+endfunction
+
+function verifyValue(expected,got)
+ if (expected != got)
+ error("verify value failed. Expected: %i, Got %i\n",expected,got)
+ endif
+endfunction
+
+function verifyCount(expected,k)
+ got = li_boost_shared_ptr.use_count(k);
+ if (expected != got)
+ error("verify value failed. Expected: %i, Got %i\n",expected,got)
+ endif
+endfunction
+
+
diff --git a/Examples/test-suite/octave/li_carrays_runme.m b/Examples/test-suite/octave/li_carrays_runme.m
new file mode 100644
index 000000000..8ec7e5911
--- /dev/null
+++ b/Examples/test-suite/octave/li_carrays_runme.m
@@ -0,0 +1,10 @@
+li_carrays
+
+d = doubleArray(10);
+
+d(0) = 7;
+d(5) = d(0) + 3;
+
+if (d(5) + d(0) != 17)
+ error
+endif
diff --git a/Examples/test-suite/octave/li_cmalloc_runme.m b/Examples/test-suite/octave/li_cmalloc_runme.m
new file mode 100644
index 000000000..45faf7381
--- /dev/null
+++ b/Examples/test-suite/octave/li_cmalloc_runme.m
@@ -0,0 +1,17 @@
+li_cmalloc
+
+p = malloc_int();
+free_int(p);
+
+ok = 0;
+try
+ p = calloc_int(-1);
+ free_int(p);
+catch
+ ok = 1;
+end_try_catch
+
+if (ok != 1)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/li_cpointer_runme.m b/Examples/test-suite/octave/li_cpointer_runme.m
new file mode 100644
index 000000000..bf660a647
--- /dev/null
+++ b/Examples/test-suite/octave/li_cpointer_runme.m
@@ -0,0 +1,12 @@
+li_cpointer
+
+
+p = new_intp();
+intp_assign(p,3);
+
+if (intp_value(p) != 3)
+ error
+endif
+
+delete_intp(p);
+
diff --git a/Examples/test-suite/octave/li_cstring_runme.m b/Examples/test-suite/octave/li_cstring_runme.m
new file mode 100644
index 000000000..0d2bdb73d
--- /dev/null
+++ b/Examples/test-suite/octave/li_cstring_runme.m
@@ -0,0 +1,39 @@
+li_cstring
+
+
+if (count("ab\0ab\0ab\0", 0) != 3)
+ error
+endif
+
+if (!strcmp(test1(),"Hello World"))
+ error
+endif
+
+if (!strcmp(test2()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
+ error
+endif
+
+if (!strcmp(test3("hello"),"hello-suffix"))
+ error(test3("hello"))
+endif
+
+if (!strcmp(test4("hello"),"hello-suffix"))
+ error(test4("hello"))
+endif
+
+if (!strcmp(test5(4),'xxxx'))
+ error
+endif
+
+if (!strcmp(test6(10),'xxxxx'))
+ error
+endif
+
+if (!strcmp(test7(),"Hello world!"))
+ error
+endif
+
+if (!strcmp(test8()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
+ error
+endif
+
diff --git a/Examples/test-suite/octave/li_cwstring_runme.m b/Examples/test-suite/octave/li_cwstring_runme.m
new file mode 100644
index 000000000..4cfef7fb5
--- /dev/null
+++ b/Examples/test-suite/octave/li_cwstring_runme.m
@@ -0,0 +1,38 @@
+li_cwstring
+
+if (count("ab\0ab\0ab\0", 0) != 3)
+ error
+endif
+
+if (!strcmp(test1(),"Hello World"))
+ error
+endif
+
+if (!strcmp(test2()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
+ error
+endif
+
+if (!strcmp(test3("hello"),"hello-suffix"))
+ error
+endif
+
+if (!strcmp(test4("hello"),"hello-suffix"))
+ error
+endif
+
+if (!strcmp(test5(4),'xxxx'))
+ error
+endif
+
+if (!strcmp(test6(10),'xxxxx'))
+ error
+endif
+
+if (!strcmp(test7(),"Hello world!"))
+ error
+endif
+
+if (!strcmp(test8()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
+ error
+endif
+
diff --git a/Examples/test-suite/octave/li_factory_runme.m b/Examples/test-suite/octave/li_factory_runme.m
new file mode 100644
index 000000000..d87920da6
--- /dev/null
+++ b/Examples/test-suite/octave/li_factory_runme.m
@@ -0,0 +1,13 @@
+li_factory
+
+circle = Geometry_create(Geometry.CIRCLE);
+r = circle.radius();
+if (r != 1.5)
+ error
+endif
+
+point = Geometry_create(Geometry.POINT);
+w = point.width();
+if (w != 1.0)
+ error
+endif
diff --git a/Examples/test-suite/octave/li_implicit_runme.m b/Examples/test-suite/octave/li_implicit_runme.m
new file mode 100644
index 000000000..2ca8b59bf
--- /dev/null
+++ b/Examples/test-suite/octave/li_implicit_runme.m
@@ -0,0 +1,20 @@
+li_implicit
+b = B();
+ai = A(1);
+ad = A(2.0);
+ab = A(b);
+
+ai, get(ai);
+ad, get(ad);
+ab, get(ab);
+
+if (get(ai) != get(1))
+ error("bad implicit type")
+endif
+if (get(ad) != get(2.0))
+ error("bad implicit type")
+endif
+if (get(ab) != get(b))
+ error("bad implicit type")
+endif
+
diff --git a/Examples/test-suite/octave/li_std_carray_runme.m b/Examples/test-suite/octave/li_std_carray_runme.m
new file mode 100644
index 000000000..4943fa8a2
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_carray_runme.m
@@ -0,0 +1,52 @@
+li_std_carray
+
+
+v3 = Vector3();
+for i=0:len(v3),
+ v3(i) = i;
+endfor
+
+i = 0;
+for d in v3,
+ if (d != i)
+ error
+ endif
+ i = i + 1;
+endfor
+
+
+m3 = Matrix3();
+
+for i=0:len(m3),
+ v3 = m3(i);
+ for j=0:len(v3),
+ v3(j) = i + j;
+ endfor
+endfor
+
+i = 0;
+for v3 in m3,
+ j = 0;
+ for d in v3,
+ if (d != i + j)
+ error
+ endif
+ j = j + 1;
+ endfor
+ i = i + 1
+endfor
+
+for i=0:len(m3),
+ for j=0:len(m3),
+ if (m3(i,j) != i + j)
+ error
+ endif
+ endfor
+endfor
+
+da = Vector3([1,2,3]);
+ma = Matrix3({[1,2,3],[4,5,6],[7,8,9]});
+
+
+
+
diff --git a/Examples/test-suite/octave/li_std_map_runme.m b/Examples/test-suite/octave/li_std_map_runme.m
new file mode 100644
index 000000000..e74fc79fc
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_map_runme.m
@@ -0,0 +1,61 @@
+li_std_map
+
+a1 = li_std_map.A(3);
+a2 = li_std_map.A(7);
+
+
+p0 = li_std_map.pairii(1,2);
+p1 = li_std_map.pairA(1,a1.this);
+m = {};
+m{1} = a1;
+m{2} = a2;
+
+pp1 = li_std_map.p_identa(p1);
+mm = li_std_map.m_identa(m);
+
+
+
+m = li_std_map.mapA();
+m{1} = a1;
+m{2} = a2;
+
+
+pm ={};
+for k in m,
+ pm{k} = m{k};
+endfor
+
+for k in m,
+ if (swig_this(pm{k}) != swig_this(m{k}))
+ error
+ endif
+endfor
+
+
+
+m = {};
+m{1} = [1,2];
+m["foo"] = "hello";
+
+pm = li_std_map.pymap();
+
+for k in m,
+ pm{k} = m{k};
+endfor
+
+for k in pm,
+ if (pm{k} != m{k})
+ error
+ endif
+endfor
+
+mii = li_std_map.mapii();
+
+mii{1} = 1;
+mii{1} = 2;
+
+if (mii[1] != 2)
+ error
+endif
+
+
diff --git a/Examples/test-suite/octave/li_std_pair.i b/Examples/test-suite/octave/li_std_pair.i
new file mode 100644
index 000000000..886bf1a4b
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_pair.i
@@ -0,0 +1,210 @@
+%module li_std_pair
+
+//
+// activate the automatic comparison methods generation (==,!=,...)
+//
+
+%{
+#include <algorithm> // for std::swap
+%}
+
+
+%include std_pair.i
+%include std_string.i
+%include std_complex.i
+
+%inline
+%{
+ struct A
+ {
+ int val;
+
+ A(int v = 0): val(v)
+ {
+ }
+
+ };
+ struct B
+ {
+ };
+%}
+
+%std_comp_methods(std::pair<std::string, int>);
+
+namespace std {
+ %template(CIntPair) pair<const int, const int>;
+ %template() pair<double, double>;
+ %template(ShortPair) pair<short, short>;
+
+ %template(IntPair) pair<int, int>;
+ %extend pair<int, int>
+ {
+ %template(pair) pair<short,short>;
+ }
+
+
+
+ %template(SIPair) pair<std::string, int>;
+ %template(CIPair) pair<std::complex<double>, int>;
+ %template(SIIPair) pair<std::pair<std::string, int>, int>;
+ %template(AIntPair) pair<A, int>;
+
+ %template(CCIntPair) pair<const A, const pair<int, int> >;
+
+ %template(ABPair) pair<A, B>;
+ %template(IntAPair) pair<int, A>;
+
+ %template(pairP1) pair<int, A*>;
+ %template(pairP2) pair<A*, int>;
+ %template(pairP3) pair<A*, A*>;
+ %template(pairP4) pair<int, int*>;
+ %template(pairP5) pair<int*, int>;
+ %template(pairP6) pair<int*, int*>;
+
+}
+%std_comp_methods(std::pair<std::pair<std::string, int>, int>);
+
+%apply std::pair<int,int> *INOUT {std::pair<int,int> *INOUT2};
+
+%inline %{
+
+/* Test the "out" typemap for pair<T, U> */
+std::pair<int, int> makeIntPair(int a, int b) {
+ return std::make_pair(a, b);
+}
+
+/**
+ * There is no "out" typemap for a pointer to a pair, so
+ * this should return a wrapped instance of a std::pair
+ * instead of the native "array" type for the target language.
+ */
+std::pair<int, int> * makeIntPairPtr(int a, int b) {
+ static std::pair<int, int> p = std::make_pair(a, b);
+ return &p;
+}
+
+/**
+ * There is no "out" typemap for a non-const reference to a pair, so
+ * this should return a wrapped instance of a std::pair instead of
+ * the native "array" type for the target language.
+ */
+std::pair<int, int>& makeIntPairRef(int a, int b) {
+ static std::pair<int, int> p = std::make_pair(a, b);
+ return p;
+}
+
+/**
+ * There is no "out" typemap for a const reference to a pair, so
+ * this should return a wrapped instance of a std::pair
+ * instead of the native "array" type for the target language.
+ */
+const std::pair<int, int> & makeIntPairConstRef(int a, int b) {
+ static std::pair<int, int> p = std::make_pair(a, b);
+ return p;
+}
+
+/* Test the "in" typemap for pair<T, U> */
+int product1(std::pair<int, int> p) {
+ return p.first*p.second;
+}
+
+/* Test the "in" typemap for const pair<T, U>& */
+int product2(const std::pair<int, int>& p) {
+ return p.first*p.second;
+}
+
+std::pair<int, int>
+ p_ident(std::pair<int, int> p, const std::pair<int, int>& q) {
+ return p;
+}
+
+
+std::pair<int, A*>
+p_identa(const std::pair<int, A*>& p) {
+ return p;
+}
+
+void
+d_inout(double *INOUT) {
+ *INOUT += *INOUT;
+}
+
+void
+d_inout(int *INOUT) {
+ *INOUT += *INOUT;
+}
+
+int
+d_inout2(double *INOUT) {
+ *INOUT += *INOUT;
+ return 1;
+}
+
+void
+p_inout(std::pair<int, int> *INOUT) {
+ std::swap(INOUT->first, INOUT->second);
+}
+
+int
+p_inout2(std::pair<int, int> *INOUT) {
+ std::swap(INOUT->first, INOUT->second);
+ return 1;
+}
+
+void
+ p_inout3(std::pair<int,int> *INOUT, std::pair<int,int> *INOUT2) {
+ std::swap(*INOUT, *INOUT2);
+}
+
+void
+p_inoutd(std::pair<double, double> *INOUT) {
+ std::swap(INOUT->first, INOUT->second);
+}
+
+std::string
+ s_ident(const std::string& s) {
+ return s;
+}
+
+#if 0
+std::pair<char, char>
+ p_ident(std::pair<char, char> p, const std::pair<char, char>& q) {
+ return p;
+}
+
+/* Test the "in" typemap for const pair<T, U>* */
+std::pair<A, B>
+ p_ident(std::pair<A, B> p, const std::pair<A, B>& q) {
+ return q;
+}
+
+/* Test the "in" typemap for const pair<T, U>* */
+std::pair<int, A>
+ p_ident(std::pair<int, A> p, const std::pair<int, A>& q) {
+ return p;
+}
+
+
+std::pair<int, int>
+ p_ident(std::pair<int, int> p, const std::pair<A, int>& q) {
+ return p;
+}
+
+std::pair<int, int>
+ p_ident(std::pair<int, int> p, const std::pair<A, B>& q) {
+ return p;
+}
+
+
+
+#endif
+%}
+
+
+namespace std
+{
+ %template(paircA1) pair<const int, A*>;
+ %template(paircA2) pair<const int, const A*>;
+ %template(pairiiA) pair<int,pair<int, A*> >;
+}
+
diff --git a/Examples/test-suite/octave/li_std_pair_runme.m b/Examples/test-suite/octave/li_std_pair_runme.m
new file mode 100644
index 000000000..83e9fe5b5
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_pair_runme.m
@@ -0,0 +1,69 @@
+li_std_pair
+
+p = {1,2};
+p1 = li_std_pair.p_inout(p);
+assert(all(cell2mat(p1)==[2,1]));
+p2 = li_std_pair.p_inoutd(p1);
+assert(all(cell2mat(p2)==[1,2]));
+
+d1 = li_std_pair.d_inout(2);
+assert(d1==4);
+
+[i,d2] = li_std_pair.d_inout2(2);
+assert(all([i,d2]==[1,4]));
+
+[i,p] = li_std_pair.p_inout2(p);
+assert(i==1&&all([cell2mat(p)]==[2,1]));
+[p3,p4] = li_std_pair.p_inout3(p1,p1);
+assert(all(cell2mat(p3)==[2,1]));
+assert(all(cell2mat(p4)==[2,1]));
+
+psi = li_std_pair.SIPair("hello",1);
+assert(psi=={"hello",1});
+pci = li_std_pair.CIPair(complex(1,2),1);
+assert(pci.first==complex(1,2)&&pci.second==1);
+
+
+psi = li_std_pair.SIPair("hi",1);
+assert(psi.first=="hi"&&psi.second==1);
+
+psii = li_std_pair.SIIPair(psi,1);
+assert(psii.first.first=="hi");
+assert(psii.first.second==1);
+assert(psii.second==1);
+
+a = li_std_pair.A();
+b = li_std_pair.B();
+
+pab = li_std_pair.ABPair(a,b);
+
+pab.first = a;
+pab.first.val = 2;
+
+assert(pab.first.val == 2);
+
+pci = li_std_pair.CIntPair(1,0);
+assert(pci.first==1&&pci.second==0);
+
+a = li_std_pair.A(5);
+p1 = li_std_pair.pairP1(1,a);
+p2 = li_std_pair.pairP2(a,1);
+p3 = li_std_pair.pairP3(a,a);
+
+assert(a.val == li_std_pair.p_identa(p1){2}.val);
+
+p = li_std_pair.IntPair(1,10);
+assert(p.first==1&&p.second==10);
+p.first = 1;
+assert(p.first==1);
+
+p = li_std_pair.paircA1(1,a);
+assert(p.first==1);
+assert(swig_this(p.second)==swig_this(a));
+
+p = li_std_pair.paircA2(1,a);
+assert(p.first==1);
+assert(swig_this(p.second)==swig_this(a));
+#pp = li_std_pair.pairiiA(1,p); # conversion pb re const of pairA1/A2
+pp = li_std_pair.pairiiA(1,{1,A()});
+
diff --git a/Examples/test-suite/octave/li_std_set_runme.m b/Examples/test-suite/octave/li_std_set_runme.m
new file mode 100644
index 000000000..9bd4f152c
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_set_runme.m
@@ -0,0 +1,96 @@
+li_std_set
+
+s = set_string()
+
+s.append("a")
+s.append("b")
+s.append("c")
+
+sum = ""
+for i in s:
+ sum = sum + i
+
+if (sum != "abc")
+ error
+
+i = s.__iter__()
+if i.next() != "a":
+ error
+if i.next() != "b":
+ error
+if i.next() != "c":
+ error
+
+
+b = s.begin()
+e = s.end()
+sum = ""
+while (b != e):
+ sum = sum + b.next()
+if sum != "abc":
+ error
+
+b = s.rbegin()
+e = s.rend()
+sum = ""
+while (b != e):
+ sum = sum + b.next()
+
+if sum != "cba":
+ error
+
+
+
+si = set_int()
+
+si.append(1)
+si.append(2)
+si.append(3)
+i = si.__iter__()
+
+if i.next() != 1:
+ error
+if i.next() != 2:
+ error
+if i.next() != 3:
+ error
+
+
+
+
+i = s.begin()
+i.next()
+s.erase(i)
+
+b = s.begin()
+e = s.end()
+sum = ""
+while (b != e):
+ sum = sum + b.next()
+if sum != "ac":
+ error
+
+
+b = s.begin()
+e = s.end()
+if e - b != 2:
+ error
+
+m = b + 1
+if m.value() != "c":
+ error
+
+
+
+s = pyset()
+s.insert((1,2))
+s.insert(1)
+s.insert("hello")
+
+
+sum = ()
+for i in s:
+ sum = sum + (i,)
+
+if sum != (1, 'hello', (1, 2)):
+ error
diff --git a/Examples/test-suite/octave/li_std_stream_runme.m b/Examples/test-suite/octave/li_std_stream_runme.m
new file mode 100644
index 000000000..bf9402e16
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_stream_runme.m
@@ -0,0 +1,13 @@
+li_std_stream
+
+a = A();
+
+o = ostringstream();
+
+o << a << " " << 2345 << " " << 1.435;
+
+
+if (o.str() != "A class 2345 1.435")
+ error
+endif
+
diff --git a/Examples/test-suite/octave/li_std_string_runme.m b/Examples/test-suite/octave/li_std_string_runme.m
new file mode 100644
index 000000000..1c24ac344
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_string_runme.m
@@ -0,0 +1,162 @@
+li_std_string
+
+x="hello";
+
+
+
+if (li_std_string.test_ccvalue(x) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_string.test_cvalue(x) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_string.test_value(x) != x)
+ error("bad string mapping: %s, %s", x, li_std_string.test_value(x))
+endif
+
+if (li_std_string.test_const_reference(x) != x)
+ error("bad string mapping")
+endif
+
+
+s = li_std_string.string("he");
+#s += "ll"
+#s.append('o')
+s = s + "llo";
+
+if (s != x)
+ error("bad string mapping: %s, %s", s, x);
+endif
+
+if (s[1:4] != x[1:4])
+ error("bad string mapping")
+endif
+
+if (li_std_string.test_value(s) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_string.test_const_reference(s) != x)
+ error("bad string mapping")
+endif
+
+a = li_std_string.A(s);
+
+if (li_std_string.test_value(a) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_string.test_const_reference(a) != x)
+ error("bad string mapping")
+endif
+
+b = li_std_string.string(" world");
+
+s = a + b;
+if (a + b != "hello world")
+ error("bad string mapping: %s", a + b)
+endif
+
+if (a + " world" != "hello world")
+ error("bad string mapping")
+endif
+
+if ("hello" + b != "hello world")
+ error("bad string mapping")
+endif
+
+c = ("hello" + b)
+if (c.find_last_of("l") != 9)
+ error("bad string mapping")
+endif
+
+s = "hello world";
+
+b = li_std_string.B("hi");
+
+b.name = li_std_string.string("hello");
+if (b.name != "hello")
+ error("bad string mapping")
+endif
+
+
+b.a = li_std_string.A("hello");
+if (b.a != "hello")
+ error("bad string mapping")
+endif
+
+
+if (li_std_string.test_value_basic1(x) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_string.test_value_basic2(x) != x)
+ error("bad string mapping")
+endif
+
+
+if (li_std_string.test_value_basic3(x) != x)
+ error("bad string mapping")
+endif
+
+# Global variables
+s = "initial string";
+if (li_std_string.cvar.GlobalString2 != "global string 2")
+ error("GlobalString2 test 1")
+endif
+li_std_string.cvar.GlobalString2 = s;
+if (li_std_string.cvar.GlobalString2 != s)
+ error("GlobalString2 test 2")
+endif
+if (li_std_string.cvar.ConstGlobalString != "const global string")
+ error("ConstGlobalString test")
+endif
+
+# Member variables
+myStructure = li_std_string.Structure();
+if (myStructure.MemberString2 != "member string 2")
+ error("MemberString2 test 1")
+endif
+myStructure.MemberString2 = s;
+if (myStructure.MemberString2 != s)
+ error("MemberString2 test 2")
+endif
+if (myStructure.ConstMemberString != "const member string")
+ error("ConstMemberString test")
+endif
+
+if (li_std_string.cvar.Structure_StaticMemberString2 != "static member string 2")
+ error("StaticMemberString2 test 1")
+endif
+li_std_string.cvar.Structure_StaticMemberString2 = s;
+if (li_std_string.cvar.Structure_StaticMemberString2 != s)
+ error("StaticMemberString2 test 2")
+endif
+if (li_std_string.cvar.Structure_ConstStaticMemberString != "const static member string")
+ error("ConstStaticMemberString test")
+endif
+
+
+if (li_std_string.test_reference_input("hello") != "hello")
+ error
+endif
+s = li_std_string.test_reference_inout("hello");
+if (s != "hellohello")
+ error
+endif
+
+
+if (li_std_string.empty() != "")
+ error
+endif
+
+
+if (li_std_string.c_empty() != "")
+ error
+endif
+
+if (li_std_string.c_null() != None)
+ error
+endif
diff --git a/Examples/test-suite/octave/li_std_vector_runme.m b/Examples/test-suite/octave/li_std_vector_runme.m
new file mode 100644
index 000000000..b9f33ee02
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_vector_runme.m
@@ -0,0 +1,160 @@
+li_std_vector
+
+iv = IntVector(4);
+for i=0:4,
+ iv(i) = i;
+endfor
+
+x = average(iv);
+y = average([1,2,3,4]);
+
+a = half([10,10.5,11,11.5]);
+
+dv = DoubleVector(10);
+for i=0:10,
+ dv(i) = i/2.0;
+endfor
+
+halve_in_place(dv);
+
+
+bv = BoolVector(4);
+bv(0)= 1;
+bv(1)= 0;
+bv(2)= 4;
+bv(3)= 0;
+
+if (bv(0) != bv(2))
+ error("bad std::vector<bool> mapping")
+endif
+
+b = B(5);
+va = VecA([b,None,b,b]);
+
+if (va(0).f(1) != 6)
+ error("bad std::vector<A*> mapping")
+endif
+
+if (vecAptr(va) != 6)
+ error("bad std::vector<A*> mapping")
+endif
+
+b.val = 7;
+if (va(3).f(1) != 8)
+ error("bad std::vector<A*> mapping")
+endif
+
+
+ip = PtrInt();
+ap = new_ArrInt(10);
+
+ArrInt_setitem(ip,0,123);
+ArrInt_setitem(ap,2,123);
+
+vi = IntPtrVector((ip,ap,None));
+if (ArrInt_getitem(vi[0],0) != ArrInt_getitem(vi[1],2))
+ error("bad std::vector<int*> mapping")
+endif
+
+delete_ArrInt(ap);
+
+
+a = halfs([10,8,4,3]);
+
+v = IntVector();
+v(0:2) = [1,2];
+if (v(0) != 1 || v[1] != 2)
+ error("bad setslice")
+endif
+
+if (v(0:-1)(0) != 1)
+ error("bad getslice")
+endif
+
+if (v(0:-2).size() != 0)
+ error("bad getslice")
+
+v(0:1) = [2];
+if (v(0) != 2)
+ error("bad setslice")
+endif
+
+v(1:) = [3];
+if (v(1) != 3)
+ error("bad setslice")
+endif
+
+v(2:) = [3]
+if (v(2) != 3)
+ error("bad setslice")
+endif
+
+if (v(0:)(0) != v(0))
+ error("bad getslice")
+endif
+
+
+v.erase(:)
+if (v.size() != 0)
+ error("bad getslice")
+endif
+
+v.erase(:)
+if (v.size() != 0)
+ error("bad getslice")
+endif
+
+
+
+v = vecStr({"hello ", "world"});
+if (v(0) != 'hello world')
+ error,"bad std::string+std::vector"
+endif
+
+
+pv = pyvector({1, "hello", (1,2)});
+
+if (pv(1) != "hello")
+ error
+endif
+
+
+iv = IntVector(5);
+for i=0:5,
+ iv(i) = i
+endif
+
+iv(1:3) = [];
+if (iv(1) != 3)
+ error
+endif
+
+# Overloading checks
+if (overloaded1(iv) != "vector<int>")
+ error
+endif
+
+if (overloaded1(dv) != "vector<double>")
+ error
+endif
+
+if (overloaded2(iv) != "vector<int>")
+ error
+endif
+
+if (overloaded2(dv) != "vector<double>")
+ error
+endif
+
+if (overloaded3(iv) != "vector<int> *")
+ error
+endif
+
+if (overloaded3(None) != "vector<int> *")
+ error
+endif
+
+if (overloaded3(100) != "int")
+ error
+endif
+
diff --git a/Examples/test-suite/octave/li_std_wstream_runme.m b/Examples/test-suite/octave/li_std_wstream_runme.m
new file mode 100644
index 000000000..a017e8acd
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_wstream_runme.m
@@ -0,0 +1,14 @@
+li_std_wstream
+
+
+
+a = A();
+
+o = wostringstream();
+
+o << a << u" " << 2345 << u" " << 1.435 << wends;
+
+if (o.str() != "A class 2345 1.435\0")
+ error
+endif
+
diff --git a/Examples/test-suite/octave/li_std_wstring_runme.m b/Examples/test-suite/octave/li_std_wstring_runme.m
new file mode 100644
index 000000000..e46c1f219
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_wstring_runme.m
@@ -0,0 +1,90 @@
+li_std_wstring
+
+x="h";
+
+if (li_std_wstring.test_wcvalue(x) != x)
+ error("bad string mapping")
+endif
+
+x="hello";
+if (li_std_wstring.test_ccvalue(x) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_wstring.test_cvalue(x) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_wstring.test_value(x) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_wstring.test_const_reference(x) != x)
+ error("bad string mapping")
+endif
+
+
+s = li_std_wstring.wstring("he");
+s = s + "llo";
+
+if (s != x)
+ error("bad string mapping")
+endif
+
+if (s(1:4) != x(1:4))
+ error("bad string mapping")
+endif
+
+if (li_std_wstring.test_value(s) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_wstring.test_const_reference(s) != x)
+ error("bad string mapping")
+endif
+
+a = li_std_wstring.A(s);
+
+if (li_std_wstring.test_value(a) != x)
+ error("bad string mapping")
+endif
+
+if (li_std_wstring.test_const_reference(a) != x)
+ error("bad string mapping")
+endif
+
+b = li_std_wstring.wstring(" world");
+
+if (a + b != "hello world")
+ error("bad string mapping")
+endif
+
+if (a + " world" != "hello world")
+ error("bad string mapping")
+endif
+
+if ("hello" + b != "hello world")
+ error("bad string mapping")
+endif
+
+c = "hello" + b;
+if (c.find_last_of("l") != 9)
+ error("bad string mapping")
+endif
+
+s = "hello world";
+
+b = li_std_wstring.B("hi");
+
+b.name = li_std_wstring.wstring("hello");
+if (b.name != "hello")
+ error("bad string mapping")
+endif
+
+
+b.a = li_std_wstring.A("hello");
+if (b.a != "hello")
+ error("bad string mapping")
+endif
+
+
diff --git a/Examples/test-suite/octave/member_pointer_runme.m b/Examples/test-suite/octave/member_pointer_runme.m
new file mode 100644
index 000000000..c13350bd0
--- /dev/null
+++ b/Examples/test-suite/octave/member_pointer_runme.m
@@ -0,0 +1,45 @@
+# Example using pointers to member functions
+
+member_pointer
+
+function check(what,expected,actual)
+ if (expected != actual)
+ error ("Failed: %s, Expected: %f, Actual: %f",what,expected,actual);
+ endif
+end
+
+# Get the pointers
+
+area_pt = areapt;
+perim_pt = perimeterpt;
+
+# Create some objects
+
+s = Square(10);
+
+# Do some calculations
+
+check ("Square area ", 100.0, do_op(s,area_pt));
+check ("Square perim", 40.0, do_op(s,perim_pt));
+
+memberPtr = cvar.areavar;
+memberPtr = cvar.perimetervar;
+
+# Try the variables
+check ("Square area ", 100.0, do_op(s,cvar.areavar));
+check ("Square perim", 40.0, do_op(s,cvar.perimetervar));
+
+# Modify one of the variables
+cvar.areavar = perim_pt;
+
+check ("Square perimeter", 40.0, do_op(s,cvar.areavar));
+
+# Try the constants
+
+memberPtr = AREAPT;
+memberPtr = PERIMPT;
+memberPtr = NULLPT;
+
+check ("Square area ", 100.0, do_op(s,AREAPT));
+check ("Square perim", 40.0, do_op(s,PERIMPT));
+
diff --git a/Examples/test-suite/octave/minherit_runme.m b/Examples/test-suite/octave/minherit_runme.m
new file mode 100644
index 000000000..24d2091be
--- /dev/null
+++ b/Examples/test-suite/octave/minherit_runme.m
@@ -0,0 +1,86 @@
+minherit
+
+a = minherit.Foo();
+b = minherit.Bar();
+c = minherit.FooBar();
+d = minherit.Spam();
+
+if (a.xget() != 1)
+ error("Bad attribute value")
+endif
+
+if (b.yget() != 2)
+ error("Bad attribute value")
+endif
+
+if (c.xget() != 1 || c.yget() != 2 || c.zget() != 3)
+ error("Bad attribute value")
+endif
+
+if (d.xget() != 1 || d.yget() != 2 || d.zget() != 3 || d.wget() != 4)
+ error("Bad attribute value")
+endif
+
+
+if (minherit.xget(a) != 1)
+ error("Bad attribute value %d",minherit.xget(a))
+endif
+
+if (minherit.yget(b) != 2)
+ error("Bad attribute value %d",minherit.yget(b))
+endif
+
+if (minherit.xget(c) != 1 || minherit.yget(c) != 2 || minherit.zget(c) != 3)
+ error("Bad attribute value %d %d %d",minherit.xget(c),minherit.yget(c),minherit.zget(c))
+endif
+
+if (minherit.xget(d) != 1 || minherit.yget(d) != 2 || minherit.zget(d) != 3 || minherit.wget(d) != 4)
+ error("Bad attribute value %d %d %d %d",minherit.xget(d),minherit.yget(d),minherit.zget(d),minherit.wget(d))
+endif
+
+# Cleanse all of the pointers and see what happens
+
+aa = minherit.toFooPtr(a);
+bb = minherit.toBarPtr(b);
+cc = minherit.toFooBarPtr(c);
+dd = minherit.toSpamPtr(d);
+
+if (aa.xget() != 1)
+ error("Bad attribute value");
+endif
+
+if (bb.yget() != 2)
+ error("Bad attribute value");
+endif
+
+if (cc.xget() != 1 || cc.yget() != 2 || cc.zget() != 3)
+ error("Bad attribute value")
+endif
+
+if (dd.xget() != 1 || dd.yget() != 2 || dd.zget() != 3 || dd.wget() != 4)
+ error("Bad attribute value")
+endif
+
+if (minherit.xget(aa) != 1)
+ error("Bad attribute value %d",minherit.xget(aa));
+endif
+
+if (minherit.yget(bb) != 2)
+ error("Bad attribute value %d",minherit.yget(bb));
+endif
+
+if (minherit.xget(cc) != 1 || minherit.yget(cc) != 2 || minherit.zget(cc) != 3)
+ error("Bad attribute value %d %d %d",minherit.xget(cc),minherit.yget(cc),minherit.zget(cc));
+endif
+
+if (minherit.xget(dd) != 1 || minherit.yget(dd) != 2 || minherit.zget(dd) != 3 || minherit.wget(dd) != 4)
+ error("Bad attribute value %d %d %d %d",minherit.xget(dd),minherit.yget(dd),minherit.zget(dd),minherit.wget(dd))
+endif
+
+
+
+
+
+
+
+
diff --git a/Examples/test-suite/octave/mod_runme.m b/Examples/test-suite/octave/mod_runme.m
new file mode 100644
index 000000000..faebf70e3
--- /dev/null
+++ b/Examples/test-suite/octave/mod_runme.m
@@ -0,0 +1,7 @@
+mod_a
+mod_b
+
+c = mod_b.C();
+d = mod_b.D();
+d.DoSomething(c);
+
diff --git a/Examples/test-suite/octave/multi_import_runme.m b/Examples/test-suite/octave/multi_import_runme.m
new file mode 100644
index 000000000..a6138736c
--- /dev/null
+++ b/Examples/test-suite/octave/multi_import_runme.m
@@ -0,0 +1,24 @@
+multi_import_a
+multi_import_b
+
+x = multi_import_b.XXX();
+if (x.testx() != 0)
+ error
+endif
+
+y = multi_import_b.YYY();
+if (y.testx() != 0)
+ error
+endif
+if (y.testy() != 1)
+ error
+endif
+
+z = multi_import_a.ZZZ();
+if (z.testx() != 0)
+ error
+endif
+if (z.testz() != 2)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/namespace_class_runme.m b/Examples/test-suite/octave/namespace_class_runme.m
new file mode 100644
index 000000000..564cf87da
--- /dev/null
+++ b/Examples/test-suite/octave/namespace_class_runme.m
@@ -0,0 +1,39 @@
+namespace_class
+
+try
+ p = Private1();
+ ok = 1;
+catch
+ ok = 0;
+end_try_catch
+
+if (ok)
+ error("Private1 is private")
+endif
+
+try
+ p = Private2();
+ ok = 1;
+catch
+ ok = 0;
+end_try_catch
+
+if (ok)
+ error("Private2 is private")
+endif
+
+EulerT3D.toFrame(1,1,1);
+
+b = BooT_i();
+b = BooT_H();
+
+
+f = FooT_i();
+f.quack(1);
+
+f = FooT_d();
+f.moo(1);
+
+f = FooT_H();
+f.foo(Hi);
+
diff --git a/Examples/test-suite/octave/namespace_typemap_runme.m b/Examples/test-suite/octave/namespace_typemap_runme.m
new file mode 100644
index 000000000..2e4990fb9
--- /dev/null
+++ b/Examples/test-suite/octave/namespace_typemap_runme.m
@@ -0,0 +1,106 @@
+namespace_typemap
+
+if (!strcmp(stest1("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest2("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest3("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest4("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest5("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest6("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest7("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest8("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest9("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest10("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest11("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(stest12("hello"),"hello"))
+ error
+endif
+
+c = complex(2,3)
+r = c.real
+
+if (ctest1(c) != r)
+ error
+endif
+
+if (ctest2(c) != r)
+ error
+endif
+
+if (ctest3(c) != r)
+ error
+endif
+
+if (ctest4(c) != r)
+ error
+endif
+
+if (ctest5(c) != r)
+ error
+endif
+
+if (ctest6(c) != r)
+ error
+endif
+
+if (ctest7(c) != r)
+ error
+endif
+
+if (ctest8(c) != r)
+ error
+endif
+
+if (ctest9(c) != r)
+ error
+endif
+
+if (ctest10(c) != r)
+ error
+endif
+
+if (ctest11(c) != r)
+ error
+endif
+
+if (ctest12(c) != r)
+ error
+endif
+
+try
+ ttest1(-14)
+ error
+catch
+end_try_catch
diff --git a/Examples/test-suite/octave/namespace_virtual_method_runme.m b/Examples/test-suite/octave/namespace_virtual_method_runme.m
new file mode 100644
index 000000000..b78e9128c
--- /dev/null
+++ b/Examples/test-suite/octave/namespace_virtual_method_runme.m
@@ -0,0 +1,4 @@
+namespace_virtual_method
+
+x = namespace_virtual_method.Spam();
+
diff --git a/Examples/test-suite/octave/naturalvar_runme.m b/Examples/test-suite/octave/naturalvar_runme.m
new file mode 100644
index 000000000..889563f35
--- /dev/null
+++ b/Examples/test-suite/octave/naturalvar_runme.m
@@ -0,0 +1,14 @@
+naturalvar
+
+f = Foo();
+b = Bar();
+
+b.f = f;
+
+cvar.s = "hello";
+b.s = "hello";
+
+if (b.s != cvar.s)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/nondynamic_runme.m b/Examples/test-suite/octave/nondynamic_runme.m
new file mode 100644
index 000000000..7b3b44125
--- /dev/null
+++ b/Examples/test-suite/octave/nondynamic_runme.m
@@ -0,0 +1,36 @@
+nondynamic
+
+aa = nondynamic.A();
+
+aa.a = 1;
+aa.b = 2;
+try
+ aa.c = 2;
+ err = 0;
+catch
+ err = 1;
+end_try_catch
+
+if (!err)
+ error("A is not static")
+endif
+
+
+B=@() subclass(nondynamic.A(),'c',4);
+
+bb = B();
+bb.c = 3;
+try
+ bb.d = 2
+ err = 0
+catch
+ err = 1
+end_try_catch
+
+if (!err)
+ error("B is not static")
+endif
+
+cc = nondynamic.C();
+cc.d = 3;
+
diff --git a/Examples/test-suite/octave/overload_complicated_runme.m b/Examples/test-suite/octave/overload_complicated_runme.m
new file mode 100755
index 000000000..0313be954
--- /dev/null
+++ b/Examples/test-suite/octave/overload_complicated_runme.m
@@ -0,0 +1,58 @@
+overload_complicated
+
+pInt = None;
+
+# Check the correct constructors are available
+p = Pop(pInt);
+
+p = Pop(pInt, 0);
+
+# Check overloaded in const only and pointers/references which target languages cannot disambiguate
+if (p.hip(0) != 701)
+ error("Test 1 failed")
+endif
+
+if (p.hip(pInt) != 702)
+ error("Test 2 failed")
+endif
+
+# Reverse the order for the above
+if (p.hop(pInt) != 805)
+ error("Test 3 failed")
+endif
+
+if (p.hop(0) != 801)
+ error("Test 4 failed")
+endif
+
+# Few more variations and order shuffled
+if (p.pop(0) != 901)
+ error("Test 5 failed")
+endif
+
+if (p.pop(pInt) != 902)
+ error("Test 6 failed")
+endif
+
+if (p.pop() != 905)
+ error("Test 7 failed")
+endif
+
+# Overload on const only
+if (p.bop(pInt) != 1001)
+ error("Test 8 failed")
+endif
+
+if (p.bip(pInt) != 2001)
+ error("Test 9 failed")
+endif
+
+# Globals
+if (muzak(0) != 3001)
+ error("Test 10 failed")
+endif
+
+if (muzak(pInt) != 3002)
+ error("Test 11 failed")
+endif
+
diff --git a/Examples/test-suite/octave/overload_copy_runme.m b/Examples/test-suite/octave/overload_copy_runme.m
new file mode 100644
index 000000000..b303ba618
--- /dev/null
+++ b/Examples/test-suite/octave/overload_copy_runme.m
@@ -0,0 +1,3 @@
+overload_copy
+f = Foo();
+g = Foo(f);
diff --git a/Examples/test-suite/octave/overload_extend_runme.m b/Examples/test-suite/octave/overload_extend_runme.m
new file mode 100644
index 000000000..42c79388f
--- /dev/null
+++ b/Examples/test-suite/octave/overload_extend_runme.m
@@ -0,0 +1,19 @@
+overload_extend
+
+f = overload_extend.Foo();
+if (f.test() != 0)
+ error
+endif
+if (f.test(3) != 1)
+ error
+endif
+if (f.test("hello") != 2)
+ error
+endif
+if (f.test(3,2) != 5)
+ error
+endif
+if (f.test(3.1)-.1 != 1003) # :)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/overload_extendc_runme.m b/Examples/test-suite/octave/overload_extendc_runme.m
new file mode 100644
index 000000000..fec586d4f
--- /dev/null
+++ b/Examples/test-suite/octave/overload_extendc_runme.m
@@ -0,0 +1,30 @@
+overload_extendc
+
+f = overload_extendc.Foo();
+if (f.test(3) != 1)
+ error
+endif
+if (f.test("hello") != 2)
+ error
+endif
+if (f.test(3.5,2.5) != 3)
+ error
+endif
+if (f.test("hello",20) != 1020)
+ error
+endif
+if (f.test("hello",20,100) != 120)
+ error
+endif
+
+# C default args
+if (f.test(f) != 30)
+ error
+endif
+if (f.test(f,100) != 120)
+ error
+endif
+if (f.test(f,100,200) != 300)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/overload_rename_runme.m b/Examples/test-suite/octave/overload_rename_runme.m
new file mode 100644
index 000000000..c266988c2
--- /dev/null
+++ b/Examples/test-suite/octave/overload_rename_runme.m
@@ -0,0 +1,8 @@
+overload_rename
+
+
+f = overload_rename.Foo(1);
+f = overload_rename.Foo(1,1);
+f = overload_rename.Foo_int(1,1);
+f = overload_rename.Foo_int(1,1,1);
+
diff --git a/Examples/test-suite/octave/overload_simple_cast_runme.m b/Examples/test-suite/octave/overload_simple_cast_runme.m
new file mode 100644
index 000000000..65bc4229a
--- /dev/null
+++ b/Examples/test-suite/octave/overload_simple_cast_runme.m
@@ -0,0 +1,229 @@
+overload_simple_cast
+
+Ai=@(x) subclass('x',x,'__int',@(self) self.x);
+Ad=@(x) subclass('x',x,'__float',@(self) self.x);
+
+ai = Ai(4);
+
+ad = Ad(5.0);
+add = Ad(5.5);
+
+try
+ fint(add);
+ good = 0;
+catch
+ good = 1;
+end_try_catch
+
+if (!good)
+ error("fint(int)")
+endif
+
+
+if (!strcmp(fint(ad),"fint:int"))
+ error("fint(int)")
+endif
+
+if (!strcmp(fdouble(ad),"fdouble:double"))
+ error("fdouble(double)")
+endif
+
+if (!strcmp(fint(ai),"fint:int"))
+ error("fint(int)")
+endif
+
+if (!strcmp(fint(5.0),"fint:int"))
+ error("fint(int)")
+endif
+
+if (!strcmp(fint(3),"fint:int"))
+ error("fint(int)")
+endif
+if (!strcmp(fint(3.0),"fint:int"))
+ error("fint(int)")
+endif
+
+if (!strcmp(fdouble(ad),"fdouble:double"))
+ error("fdouble(double)")
+endif
+if (!strcmp(fdouble(3),f"fdouble:double"))
+ error("fdouble(double)")
+endif
+if (!strcmp(fdouble(3.0),"fdouble:double"))
+ error("fdouble(double)")
+endif
+
+if (!strcmp(fid(3,3.0),"fid:intdouble"))
+ error("fid:intdouble")
+endif
+
+if (!strcmp(fid(3.0,3),"fid:doubleint"))
+ error("fid:doubleint")
+endif
+
+if (!strcmp(fid(ad,ai),"fid:doubleint"))
+ error("fid:doubleint")
+endif
+
+if (!strcmp(fid(ai,ad),"fid:intdouble"))
+ error("fid:intdouble")
+endif
+
+
+
+if (!strcmp(foo(3),"foo:int"))
+ error("foo(int)")
+endif
+
+if (!strcmp(foo(3.0),"foo:double"))
+ error("foo(double)")
+endif
+
+if (!strcmp(foo("hello"),"foo:char *"))
+ error("foo(char *)")
+endif
+
+f = Foo();
+b = Bar();
+
+if (!strcmp(foo(f),"foo:Foo *"))
+ error("foo(Foo *)")
+endif
+
+if (!strcmp(foo(b),"foo:Bar *"))
+ error("foo(Bar *)")
+endif
+
+v = malloc_void(32);
+
+if (!strcmp(foo(v),"foo:void *"))
+ error("foo(void *)")
+endif
+
+s = Spam();
+
+if (!strcmp(s.foo(3),"foo:int"))
+ error("Spam::foo(int)")
+endif
+
+if (!strcmp(s.foo(3.0),"foo:double"))
+ error("Spam::foo(double)")
+endif
+
+if (!strcmp(s.foo("hello"),"foo:char *"))
+ error("Spam::foo(char *)")
+endif
+
+if (!strcmp(s.foo(f),"foo:Foo *"))
+ error("Spam::foo(Foo *)")
+endif
+
+if (!strcmp(s.foo(b),"foo:Bar *"))
+ error("Spam::foo(Bar *)")
+endif
+
+if (!strcmp(s.foo(v),"foo:void *"))
+ error("Spam::foo(void *)")
+endif
+
+if (!strcmp(Spam_bar(3),"bar:int"))
+ error("Spam::bar(int)")
+endif
+
+if (!strcmp(Spam_bar(3.0),"bar:double"))
+ error("Spam::bar(double)")
+endif
+
+if (!strcmp(Spam_bar("hello"),"bar:char *"))
+ error("Spam::bar(char *)")
+endif
+
+if (!strcmp(Spam_bar(f),"bar:Foo *"))
+ error("Spam::bar(Foo *)")
+endif
+
+if (!strcmp(Spam_bar(b),"bar:Bar *"))
+ error("Spam::bar(Bar *)")
+endif
+
+if (!strcmp(Spam_bar(v),"bar:void *"))
+ error("Spam::bar(void *)")
+endif
+
+# Test constructors
+
+s = Spam();
+if (!strcmp(s.type,"none"))
+ error("Spam()")
+endif
+
+s = Spam(3);
+if (!strcmp(s.type,"int"))
+ error("Spam(int)")
+endif
+
+s = Spam(3.4);
+if (!strcmp(s.type,"double"))
+ error("Spam(double)")
+endif
+
+s = Spam("hello");
+if (!strcmp(s.type,"char *"))
+ error("Spam(char *)")
+endif
+
+s = Spam(f);
+if (!strcmp(s.type,"Foo *"))
+ error("Spam(Foo *)")
+endif
+
+s = Spam(b);
+if (!strcmp(s.type,"Bar *"))
+ error("Spam(Bar *)")
+endif
+
+s = Spam(v);
+if (!strcmp(s.type,"void *"))
+ error("Spam(void *)")
+endif
+
+
+# unsigned long long
+ullmax = 9223372036854775807; #0xffffffffffffffff
+ullmaxd = 9007199254740992.0;
+ullmin = 0;
+ullmind = 0.0;
+if (ull(ullmin) != ullmin)
+ error("ull(ullmin)")
+endif
+if (ull(ullmax) != ullmax)
+ error("ull(ullmax)")
+endif
+if (ull(ullmind) != ullmind)
+ error("ull(ullmind)")
+endif
+if (ull(ullmaxd) != ullmaxd)
+ error("ull(ullmaxd)")
+endif
+
+# long long
+llmax = 9223372036854775807; #0x7fffffffffffffff
+llmin = -9223372036854775808;
+# these are near the largest floats we can still convert into long long
+llmaxd = 9007199254740992.0;
+llmind = -9007199254740992.0;
+if (ll(llmin) != llmin)
+ error("ll(llmin)")
+endif
+if (ll(llmax) != llmax)
+ error("ll(llmax)")
+endif
+if (ll(llmind) != llmind)
+ error("ll(llmind)")
+endif
+if (ll(llmaxd) != llmaxd)
+ error("ll(llmaxd)")
+endif
+
+free_void(v);
+
diff --git a/Examples/test-suite/octave/overload_simple_runme.m b/Examples/test-suite/octave/overload_simple_runme.m
new file mode 100644
index 000000000..e980610da
--- /dev/null
+++ b/Examples/test-suite/octave/overload_simple_runme.m
@@ -0,0 +1,125 @@
+overload_simple
+
+# unless explicitly casted via {{u}int{8,16,32,64},double,single},
+# octave will take numeric literals as doubles.
+
+if (!strcmp(foo(3),"foo:int"))
+ error("foo(int)")
+endif
+
+if (!strcmp(foo(3.1),"foo:double"))
+ error("foo(double)")
+endif
+
+if (!strcmp(foo("hello"),"foo:char *"))
+ error("foo(char *)")
+endif
+
+f = Foo();
+b = Bar();
+
+if (!strcmp(foo(f),"foo:Foo *"))
+ error("foo(Foo *)")
+endif
+
+if (!strcmp(foo(b),"foo:Bar *"))
+ error("foo(Bar *)")
+endif
+
+v = malloc_void(32);
+
+if (!strcmp(foo(v),"foo:void *"))
+ error("foo(void *)")
+endif
+
+s = Spam();
+
+if (!strcmp(s.foo(3),"foo:int"))
+ error("Spam::foo(int)")
+endif
+
+if (!strcmp(s.foo(3.1),"foo:double"))
+ error("Spam::foo(double)")
+endif
+
+if (!strcmp(s.foo("hello"),"foo:char *"))
+ error("Spam::foo(char *)")
+endif
+
+if (!strcmp(s.foo(f),"foo:Foo *"))
+ error("Spam::foo(Foo *)")
+endif
+
+if (!strcmp(s.foo(b),"foo:Bar *"))
+ error("Spam::foo(Bar *)")
+endif
+
+if (!strcmp(s.foo(v),"foo:void *"))
+ error("Spam::foo(void *)")
+endif
+
+if (!strcmp(Spam_bar(3),"bar:int"))
+ error("Spam::bar(int)")
+endif
+
+if (!strcmp(Spam_bar(3.1),"bar:double"))
+ error("Spam::bar(double)")
+endif
+
+if (!strcmp(Spam_bar("hello"),"bar:char *"))
+ error("Spam::bar(char *)")
+endif
+
+if (!strcmp(Spam_bar(f),"bar:Foo *"))
+ error("Spam::bar(Foo *)")
+endif
+
+if (!strcmp(Spam_bar(b),"bar:Bar *"))
+ error("Spam::bar(Bar *)")
+endif
+
+if (!strcmp(Spam_bar(v),"bar:void *"))
+ error("Spam::bar(void *)")
+endif
+
+# Test constructors
+
+s = Spam();
+if (!strcmp(s.type,"none"))
+ error("Spam()")
+endif
+
+s = Spam(3);
+if (!strcmp(s.type,"int"))
+ error("Spam(int)")
+endif
+
+s = Spam(3.4);
+if (!strcmp(s.type,"double"))
+ error("Spam(double)")
+endif
+
+s = Spam("hello");
+if (!strcmp(s.type,"char *"))
+ error("Spam(char *)")
+endif
+
+s = Spam(f);
+if (!strcmp(s.type,"Foo *"))
+ error("Spam(Foo *)")
+endif
+
+s = Spam(b);
+if (!strcmp(s.type,"Bar *"))
+ error("Spam(Bar *)")
+endif
+
+s = Spam(v);
+if (!strcmp(s.type,"void *"))
+ error("Spam(void *)")
+endif
+
+free_void(v);
+
+a = ClassA();
+b = a.method1(1);
diff --git a/Examples/test-suite/octave/overload_subtype_runme.m b/Examples/test-suite/octave/overload_subtype_runme.m
new file mode 100644
index 000000000..b34be9734
--- /dev/null
+++ b/Examples/test-suite/octave/overload_subtype_runme.m
@@ -0,0 +1,13 @@
+overload_subtype
+
+f = Foo();
+b = Bar();
+
+if (spam(f) != 1)
+ error("foo")
+endif
+
+if (spam(b) != 2)
+ error("bar")
+endif
+
diff --git a/Examples/test-suite/octave/overload_template_fast_runme.m b/Examples/test-suite/octave/overload_template_fast_runme.m
new file mode 100644
index 000000000..346af7242
--- /dev/null
+++ b/Examples/test-suite/octave/overload_template_fast_runme.m
@@ -0,0 +1,188 @@
+overload_template_fast
+
+# unless explicitly casted via {{u}int{8,16,32,64},double,single},
+# octave will take numeric literals as doubles.
+
+f = foo();
+
+a = max(3,4);
+b = max(3.4,5.2);
+
+# mix 1
+if (mix1("hi") != 101)
+ error("mix1(const char*)")
+endif
+
+if (mix1(1.1, 1.1) != 102)
+ error("mix1(double, const double &)")
+endif
+
+if (mix1(1.1) != 103)
+ error("mix1(double)")
+endif
+
+# mix 2
+if (mix2("hi") != 101)
+ error("mix2(const char*)")
+endif
+
+if (mix2(1.1, 1.1) != 102)
+ error("mix2(double, const double &)")
+endif
+
+if (mix2(1.1) != 103)
+ error("mix2(double)")
+endif
+
+# mix 3
+if (mix3("hi") != 101)
+ error("mix3(const char*)")
+endif
+
+if (mix3(1.1, 1.1) != 102)
+ error("mix3(double, const double &)")
+endif
+
+if (mix3(1.1) != 103)
+ error("mix3(double)")
+endif
+
+# Combination 1
+if (overtparams1(100) != 10)
+ error("overtparams1(int)")
+endif
+
+if (overtparams1(100.1, 100) != 20)
+ error("overtparams1(double, int)")
+endif
+
+# Combination 2
+if (overtparams2(100.1, 100) != 40)
+ error("overtparams2(double, int)")
+endif
+
+# Combination 3
+if (overloaded() != 60)
+ error("overloaded()")
+endif
+
+if (overloaded(100.1, 100) != 70)
+ error("overloaded(double, int)")
+endif
+
+# Combination 4
+if (overloadedagain("hello") != 80)
+ error("overloadedagain(const char *)")
+endif
+
+if (overloadedagain() != 90)
+ error("overloadedagain(double)")
+endif
+
+# specializations
+if (specialization(10) != 202)
+ error("specialization(int)")
+endif
+
+if (specialization(10.1) != 203)
+ error("specialization(double)")
+endif
+
+if (specialization(10, 10) != 204)
+ error("specialization(int, int)")
+endif
+
+if (specialization(10.1, 10.1) != 205)
+ error("specialization(double, double)")
+endif
+
+if (specialization("hi", "hi") != 201)
+ error("specialization(const char *, const char *)")
+endif
+
+
+# simple specialization
+xyz();
+xyz_int();
+xyz_double();
+
+# a bit of everything
+if (overload("hi") != 0)
+ error("overload()")
+endif
+
+if (overload(1) != 10)
+ error("overload(int t)")
+endif
+
+if (overload(1, 1) != 20)
+ error("overload(int t, const int &)")
+endif
+
+if (overload(1, "hello") != 30)
+ error("overload(int t, const char *)")
+endif
+
+k = Klass();
+if (overload(k) != 10)
+ error("overload(Klass t)")
+endif
+
+if (overload(k, k) != 20)
+ error("overload(Klass t, const Klass &)")
+endif
+
+if (overload(k, "hello") != 30)
+ error("overload(Klass t, const char *)")
+endif
+
+if (overload(10.1, "hi") != 40)
+ error("overload(double t, const char *)")
+endif
+
+if (overload() != 50)
+ error("overload(const char *)")
+endif
+
+
+# everything put in a namespace
+if (nsoverload("hi") != 1000)
+ error("nsoverload()")
+endif
+
+if (nsoverload(1) != 1010)
+ error("nsoverload(int t)")
+endif
+
+if (nsoverload(1, 1) != 1020)
+ error("nsoverload(int t, const int &)")
+endif
+
+if (nsoverload(1, "hello") != 1030)
+ error("nsoverload(int t, const char *)")
+endif
+
+if (nsoverload(k) != 1010)
+ error("nsoverload(Klass t)")
+endif
+
+if (nsoverload(k, k) != 1020)
+ error("nsoverload(Klass t, const Klass &)")
+endif
+
+if (nsoverload(k, "hello") != 1030)
+ error("nsoverload(Klass t, const char *)")
+endif
+
+if (nsoverload(10.1, "hi") != 1040)
+ error("nsoverload(double t, const char *)")
+endif
+
+if (nsoverload() != 1050)
+ error("nsoverload(const char *)")
+endif
+
+
+A.foo(1);
+b = B();
+b.foo(1);
diff --git a/Examples/test-suite/octave/overload_template_runme.m b/Examples/test-suite/octave/overload_template_runme.m
new file mode 100644
index 000000000..b38dc73e1
--- /dev/null
+++ b/Examples/test-suite/octave/overload_template_runme.m
@@ -0,0 +1,184 @@
+overload_template
+f = foo();
+
+a = max(3,4);
+b = max(3.4,5.2);
+
+# mix 1
+if (mix1("hi") != 101)
+ error("mix1(const char*)")
+endif
+
+if (mix1(1.0, 1.0) != 102)
+ error("mix1(double, const double &)")
+endif
+
+if (mix1(1.0) != 103)
+ error("mix1(double)")
+endif
+
+# mix 2
+if (mix2("hi") != 101)
+ error("mix2(const char*)")
+endif
+
+if (mix2(1.0, 1.0) != 102)
+ error("mix2(double, const double &)")
+endif
+
+if (mix2(1.0) != 103)
+ error("mix2(double)")
+endif
+
+# mix 3
+if (mix3("hi") != 101)
+ error("mix3(const char*)")
+endif
+
+if (mix3(1.0, 1.0) != 102)
+ error("mix3(double, const double &)")
+endif
+
+if (mix3(1.0) != 103)
+ error("mix3(double)")
+endif
+
+# Combination 1
+if (overtparams1(100) != 10)
+ error("overtparams1(int)")
+endif
+
+if (overtparams1(100.0, 100) != 20)
+ error("overtparams1(double, int)")
+endif
+
+# Combination 2
+if (overtparams2(100.0, 100) != 40)
+ error("overtparams2(double, int)")
+endif
+
+# Combination 3
+if (overloaded() != 60)
+ error("overloaded()")
+endif
+
+if (overloaded(100.0, 100) != 70)
+ error("overloaded(double, int)")
+endif
+
+# Combination 4
+if (overloadedagain("hello") != 80)
+ error("overloadedagain(const char *)")
+endif
+
+if (overloadedagain() != 90)
+ error("overloadedagain(double)")
+endif
+
+# specializations
+if (specialization(10) != 202)
+ error("specialization(int)")
+endif
+
+if (specialization(10.1) != 203)
+ error("specialization(double)")
+endif
+
+if (specialization(10, 10) != 204)
+ error("specialization(int, int)")
+endif
+
+if (specialization(10.0, 10.1) != 205)
+ error("specialization(double, double)")
+endif
+
+if (specialization("hi", "hi") != 201)
+ error("specialization(const char *, const char *)")
+endif
+
+
+# simple specialization
+xyz();
+xyz_int();
+xyz_double();
+
+# a bit of everything
+if (overload("hi") != 0)
+ error("overload()")
+endif
+
+if (overload(1) != 10)
+ error("overload(int t)")
+endif
+
+if (overload(1, 1) != 20)
+ error("overload(int t, const int &)")
+endif
+
+if (overload(1, "hello") != 30)
+ error("overload(int t, const char *)")
+endif
+
+k = Klass();
+if (overload(k) != 10)
+ error("overload(Klass t)")
+endif
+
+if (overload(k, k) != 20)
+ error("overload(Klass t, const Klass &)")
+endif
+
+if (overload(k, "hello") != 30)
+ error("overload(Klass t, const char *)")
+endif
+
+if (overload(10.1, "hi") != 40)
+ error("overload(double t, const char *)")
+endif
+
+if (overload() != 50)
+ error("overload(const char *)")
+endif
+
+
+# everything put in a namespace
+if (nsoverload("hi") != 1000)
+ error("nsoverload()")
+endif
+
+if (nsoverload(1) != 1010)
+ error("nsoverload(int t)")
+endif
+
+if (nsoverload(1, 1) != 1020)
+ error("nsoverload(int t, const int &)")
+endif
+
+if (nsoverload(1, "hello") != 1030)
+ error("nsoverload(int t, const char *)")
+endif
+
+if (nsoverload(k) != 1010)
+ error("nsoverload(Klass t)")
+endif
+
+if (nsoverload(k, k) != 1020)
+ error("nsoverload(Klass t, const Klass &)")
+endif
+
+if (nsoverload(k, "hello") != 1030)
+ error("nsoverload(Klass t, const char *)")
+endif
+
+if (nsoverload(10.1, "hi") != 1040)
+ error("nsoverload(double t, const char *)")
+endif
+
+if (nsoverload() != 1050)
+ error("nsoverload(const char *)")
+endif
+
+
+A_foo(1);
+b = B();
+b.foo(1);
diff --git a/Examples/test-suite/octave/preproc_runme.m b/Examples/test-suite/octave/preproc_runme.m
new file mode 100644
index 000000000..791b38bf4
--- /dev/null
+++ b/Examples/test-suite/octave/preproc_runme.m
@@ -0,0 +1,18 @@
+preproc
+
+if (preproc.cvar.endif != 1)
+ error
+endif
+
+if (preproc.cvar.define != 1)
+ error
+endif
+
+if (preproc.cvar.defined != 1)
+ error
+endif
+
+if (2*preproc.one != preproc.two)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/primitive_ref_runme.m b/Examples/test-suite/octave/primitive_ref_runme.m
new file mode 100644
index 000000000..68a5750c3
--- /dev/null
+++ b/Examples/test-suite/octave/primitive_ref_runme.m
@@ -0,0 +1,53 @@
+primitive_ref
+
+if (ref_int(3) != 3)
+ error
+endif
+
+if (ref_uint(3) != 3)
+ error
+endif
+
+if (ref_short(3) != 3)
+ error
+endif
+
+if (ref_ushort(3) != 3)
+ error
+endif
+
+if (ref_long(3) != 3)
+ error
+endif
+
+if (ref_ulong(3) != 3)
+ error
+endif
+
+if (ref_schar(3) != 3)
+ error
+endif
+
+if (ref_uchar(3) != 3)
+ error
+endif
+
+if (ref_float(3.5) != 3.5)
+ error
+endif
+
+if (ref_double(3.5) != 3.5)
+ error
+endif
+
+if (ref_bool(true) != true)
+ error
+endif
+
+if (!strcmp(ref_char('x'),'x'))
+ error
+endif
+
+if (ref_over(0) != 0)
+ error
+endif
diff --git a/Examples/test-suite/octave/primitive_types_runme.m b/Examples/test-suite/octave/primitive_types_runme.m
new file mode 100644
index 000000000..568e3511e
--- /dev/null
+++ b/Examples/test-suite/octave/primitive_types_runme.m
@@ -0,0 +1,402 @@
+primitive_types
+
+var_init();
+
+# assigning globals calls
+cvar.var_bool = sct_bool;
+cvar.var_schar = sct_schar;
+cvar.var_uchar = sct_uchar;
+cvar.var_int = sct_int;
+cvar.var_uint = sct_uint;
+cvar.var_short = sct_short;
+cvar.var_ushort = sct_ushort;
+cvar.var_long = sct_long;
+cvar.var_ulong = sct_ulong;
+cvar.var_llong = sct_llong;
+cvar.var_ullong = sct_ullong;
+cvar.var_char = sct_char;
+cvar.var_pchar = sct_pchar;
+cvar.var_pcharc = sct_pcharc;
+cvar.var_pint = sct_pint;
+cvar.var_sizet = sct_sizet;
+cvar.var_hello = sct_hello;
+cvar.var_myint = sct_myint;
+cvar.var_namet = def_namet;
+cvar.var_parami = sct_parami;
+cvar.var_paramd = sct_paramd;
+cvar.var_paramc = sct_paramc;
+
+v_check();
+
+function octerror(name, val, cte)
+ name, val, cte
+ error
+endfunction
+
+if cvar.var_bool != cct_bool:
+octerror("bool", cvar.var_bool, cct_bool)
+endif
+if cvar.var_schar != cct_schar:
+octerror("schar", cvar.var_schar, cct_schar)
+endif
+if cvar.var_uchar != cct_uchar:
+ octerror("uchar", cvar.var_uchar, cct_uchar)
+endif
+if cvar.var_int != cct_int:
+ octerror("int", cvar.var_int, cct_int)
+endif
+if cvar.var_uint != cct_uint:
+ octerror("uint", cvar.var_uint, cct_uint)
+endif
+if cvar.var_short != cct_short:
+ octerror("short", cvar.var_short, cct_short)
+endif
+if cvar.var_ushort != cct_ushort:
+ octerror("ushort", cvar.var_ushort, cct_ushort)
+endif
+if cvar.var_long != cct_long:
+ octerror("long", cvar.var_long, cct_long)
+endif
+if cvar.var_ulong != cct_ulong:
+ octerror("ulong", cvar.var_ulong, cct_ulong)
+endif
+if cvar.var_llong != cct_llong:
+ octerror("llong", cvar.var_llong, cct_llong)
+endif
+if cvar.var_ullong != cct_ullong:
+ octerror("ullong", cvar.var_ullong, cct_ullong)
+endif
+if cvar.var_char != cct_char:
+ octerror("char", cvar.var_char, cct_char)
+endif
+if cvar.var_pchar != cct_pchar:
+ octerror("pchar", cvar.var_pchar, cct_pchar)
+endif
+if cvar.var_pcharc != cct_pcharc:
+ octerror("pchar", cvar.var_pcharc, cct_pcharc)
+endif
+if cvar.var_pint != cct_pint:
+ octerror("pint", cvar.var_pint, cct_pint)
+endif
+if cvar.var_sizet != cct_sizet:
+ octerror("sizet", cvar.var_sizet, cct_sizet)
+endif
+if cvar.var_hello != cct_hello:
+ octerror("hello", cvar.var_hello, cct_hello)
+endif
+if cvar.var_myint != cct_myint:
+ octerror("myint", cvar.var_myint, cct_myint)
+endif
+if cvar.var_namet != def_namet:
+ octerror("name", cvar.var_namet, def_namet)
+endif
+
+
+function OctTest()
+ self=subclass(TestDirector);
+ self.ident=@(self,x) x;
+
+ self.vval_bool=@(self, x) self.ident(x);
+ self.vval_schar=@(self, x) self.ident(x);
+ self.vval_uchar=@(self, x) self.ident(x);
+ self.vval_int=@(self, x) self.ident(x);
+ self.vval_uint=@(self, x) self.ident(x);
+ self.vval_short=@(self, x) self.ident(x);
+ self.vval_ushort=@(self, x) self.ident(x);
+ self.vval_long=@(self, x) self.ident(x);
+ self.vval_ulong=@(self, x) self.ident(x);
+ self.vval_llong=@(self, x) self.ident(x);
+ self.vval_ullong=@(self, x) self.ident(x);
+ self.vval_float=@(self, x) self.ident(x);
+ self.vval_double=@(self, x) self.ident(x);
+ self.vval_char=@(self, x) self.ident(x);
+ self.vval_pchar=@(self, x) self.ident(x);
+ self.vval_pcharc=@(self, x) self.ident(x);
+ self.vval_pint=@(self, x) self.ident(x);
+ self.vval_sizet=@(self, x) self.ident(x);
+ self.vval_hello=@(self, x) self.ident(x);
+ self.vval_myint=@(self, x) self.ident(x);
+
+ self.vref_bool=@(self, x) self.ident(x);
+ self.vref_schar=@(self, x) self.ident(x);
+ self.vref_uchar=@(self, x) self.ident(x);
+ self.vref_int=@(self, x) self.ident(x);
+ self.vref_uint=@(self, x) self.ident(x);
+ self.vref_short=@(self, x) self.ident(x);
+ self.vref_ushort=@(self, x) self.ident(x);
+ self.vref_long=@(self, x) self.ident(x);
+ self.vref_ulong=@(self, x) self.ident(x);
+ self.vref_llong=@(self, x) self.ident(x);
+ self.vref_ullong=@(self, x) self.ident(x);
+ self.vref_float=@(self, x) self.ident(x);
+ self.vref_double=@(self, x) self.ident(x);
+ self.vref_char=@(self, x) self.ident(x);
+ self.vref_pchar=@(self, x) self.ident(x);
+ self.vref_pcharc=@(self, x) self.ident(x);
+ self.vref_pint=@(self, x) self.ident(x);
+ self.vref_sizet=@(self, x) self.ident(x);
+ self.vref_hello=@(self, x) self.ident(x);
+ self.vref_myint=@(self, x) self.ident(x);
+endfunction
+
+
+t = Test();
+p = OctTest();
+
+
+# internal call check
+if (t.c_check() != p.c_check())
+ error, "bad director"
+endif
+
+p.var_bool = p.stc_bool;
+p.var_schar = p.stc_schar;
+p.var_uchar = p.stc_uchar;
+p.var_int = p.stc_int;
+p.var_uint = p.stc_uint;
+p.var_short = p.stc_short;
+p.var_ushort = p.stc_ushort;
+p.var_long = p.stc_long;
+p.var_ulong = p.stc_ulong;
+p.var_llong = p.stc_llong;
+p.var_ullong = p.stc_ullong;
+p.var_char = p.stc_char;
+p.var_pchar = sct_pchar;
+p.var_pcharc = sct_pcharc;
+p.var_pint = sct_pint;
+p.var_sizet = sct_sizet;
+p.var_hello = sct_hello;
+p.var_myint = sct_myint;
+p.var_namet = def_namet;
+p.var_parami = sct_parami;
+p.var_paramd = sct_paramd;
+p.var_paramc = sct_paramc;
+
+p.v_check();
+
+t.var_bool = t.stc_bool;
+t.var_schar = t.stc_schar;
+t.var_uchar = t.stc_uchar;
+t.var_int = t.stc_int;
+t.var_uint = t.stc_uint;
+t.var_short = t.stc_short;
+t.var_ushort = t.stc_ushort;
+t.var_long = t.stc_long;
+t.var_ulong = t.stc_ulong;
+t.var_llong = t.stc_llong;
+t.var_ullong = t.stc_ullong;
+t.var_char = t.stc_char;
+t.var_pchar = sct_pchar;
+t.var_pcharc = sct_pcharc;
+t.var_pint = sct_pint;
+t.var_sizet = sct_sizet;
+t.var_hello = sct_hello;
+t.var_myint = sct_myint;
+t.var_namet = def_namet;
+t.var_parami = sct_parami;
+t.var_paramd = sct_paramd;
+t.var_paramc = sct_paramc;
+
+t.v_check();
+
+# this value contains a '0' char!
+if (def_namet != 'ho\0la')
+ error
+endif
+
+t.var_namet = def_namet;
+if (t.var_namet != def_namet)
+ error
+endif
+
+t.var_namet = 'holac';
+
+if (t.var_namet != 'holac')
+ error
+endif
+
+t.var_namet = 'hol';
+
+if (t.var_namet != 'hol')
+ error
+endif
+
+if (t.strlen('hile') != 4)
+ error
+endif
+
+if (t.strlen('hil\0') != 4)
+ error
+endif
+
+cvar.var_char = '\0';
+if (cvar.var_char != '\0')
+ error
+endif
+
+cvar.var_char = 0;
+if (cvar.var_char != '\0')
+ error
+endif
+
+cvar.var_namet = '\0';
+if (cvar.var_namet != '')
+ error
+endif
+
+cvar.var_namet = '';
+if (cvar.var_namet != '')
+ error, "bad char empty case"
+endif
+
+cvar.var_pchar = None;
+if (cvar.var_pchar != None)
+ error, "bad None case"
+endif
+
+cvar.var_pchar = '';
+if (cvar.var_pchar != '')
+ error
+endif
+
+cvar.var_pcharc = None;
+if (cvar.var_pcharc != None)
+ error
+endif
+
+cvar.var_pcharc = '';
+if (cvar.var_pcharc != '')
+ error
+endif
+
+#
+# creating a raw char*
+#
+pc = new_pchar(5);
+pchar_setitem(pc, 0, 'h');
+pchar_setitem(pc, 1, 'o');
+pchar_setitem(pc, 2, 'l');
+pchar_setitem(pc, 3, 'a');
+pchar_setitem(pc, 4, 0);
+
+
+if (t.strlen(pc) != 4)
+ error
+endif
+
+cvar.var_pchar = pc;
+if (cvar.var_pchar != "hola")
+ error
+endif
+
+cvar.var_namet = pc;
+if (cvar.var_namet != "hola")
+ error
+endif
+
+delete_pchar(pc);
+
+#
+# Now when things should fail
+#
+
+try
+ error = 0;
+ a = t.var_uchar;
+ t.var_uchar = 10000;
+ err = 1;
+catch
+ if (a != t.var_uchar)
+ err = 1;
+ endif
+end_try_catch
+
+if (err)
+ error
+endif
+
+try
+ err = 0;
+ a = t.var_char;
+ t.var_char = '23';
+ err = 1;
+catch
+ if (a != t.var_char)
+ error = 1
+ endif
+end_try_catch
+if (err)
+ error
+endif
+
+try
+ err = 0
+ a = t.var_uint
+ t.var_uint = -1
+ err = 1;
+catch
+ if a != t.var_uint:
+ err = 1;
+ endif
+end_try_catch
+if (err)
+ error
+endif
+
+#
+#
+try
+ err = 0;
+ a = t.var_namet;
+ t.var_namet = '123456';
+ err = 1;
+catch
+ if (a != t.var_namet)
+ err = 1;
+ endif
+end_try_catch
+if (err)
+ error
+endif
+
+#
+#
+#
+t2 = p.vtest(t);
+if (t.var_namet != t2.var_namet)
+ error
+endif
+
+
+if (cvar.fixsize != 'ho\0la\0\0\0')
+ error
+endif
+
+cvar.fixsize = 'ho';
+if (cvar.fixsize != 'ho\0\0\0\0\0\0')
+ error
+endif
+
+
+f = Foo(3);
+f1 = fptr_val(f);
+f2 = fptr_ref(f);
+if (f1._a != f2._a)
+ error
+endif
+
+v = char_foo(1,3);
+if (v !=3)
+ error
+endif
+
+s = char_foo(1,"hello");
+if (s !="hello")
+ error
+endif
+
+
+v = SetPos(1,3);
+if (v !=4)
+ error
+endif
diff --git a/Examples/test-suite/octave/profiletest_runme.m b/Examples/test-suite/octave/profiletest_runme.m
new file mode 100644
index 000000000..d4f07dc11
--- /dev/null
+++ b/Examples/test-suite/octave/profiletest_runme.m
@@ -0,0 +1,32 @@
+import _profiletest
+import profiletest
+
+a = profiletest.A()
+print a
+print a.this
+
+b = profiletest.B()
+fn = b.fn
+i = 50000
+while i:
+ a = fn(a) #1
+ a = fn(a) #2
+ a = fn(a) #3
+ a = fn(a) #4
+ a = fn(a) #5
+ a = fn(a) #6
+ a = fn(a) #7
+ a = fn(a) #8
+ a = fn(a) #9
+ a = fn(a) #10
+ a = fn(a) #1
+ a = fn(a) #2
+ a = fn(a) #3
+ a = fn(a) #4
+ a = fn(a) #5
+ a = fn(a) #6
+ a = fn(a) #7
+ a = fn(a) #8
+ a = fn(a) #9
+ a = fn(a) #20
+ i -= 1
diff --git a/Examples/test-suite/octave/refcount_runme.m b/Examples/test-suite/octave/refcount_runme.m
new file mode 100644
index 000000000..2eb8eeed0
--- /dev/null
+++ b/Examples/test-suite/octave/refcount_runme.m
@@ -0,0 +1,34 @@
+refcount
+#
+# very innocent example
+#
+
+a = A3();
+b1 = B(a);
+b2 = B.create(a);
+
+
+if (a.ref_count() != 3)
+ error("This program will crash... now")
+endif
+
+
+rca = b2.get_rca();
+b3 = B.create(rca);
+
+if (a.ref_count() != 5)
+ error("This program will crash... now")
+endif
+
+
+v = vector_A(2);
+v(0) = a;
+v(1) = a;
+
+x = v(0);
+clear v;
+
+
+
+
+
diff --git a/Examples/test-suite/octave/reference_global_vars_runme.m b/Examples/test-suite/octave/reference_global_vars_runme.m
new file mode 100644
index 000000000..67ad9c514
--- /dev/null
+++ b/Examples/test-suite/octave/reference_global_vars_runme.m
@@ -0,0 +1,91 @@
+reference_global_vars
+
+# const class reference variable
+if (getconstTC().num != 33)
+ error
+endif
+
+# primitive reference variables
+cvar.var_bool = createref_bool(false);
+if (value_bool(cvar.var_bool) != 0)
+ error
+endif
+
+cvar.var_bool = createref_bool(true);
+if (value_bool(cvar.var_bool) != 1)
+ error
+endif
+
+cvar.var_char = createref_char('w');
+if (!strcmp(value_char(cvar.var_char),'w'))
+ error
+endif
+
+cvar.var_unsigned_char = createref_unsigned_char(10);
+if (value_unsigned_char(cvar.var_unsigned_char) != 10)
+ error
+endif
+
+cvar.var_signed_char = createref_signed_char(10);
+if (value_signed_char(cvar.var_signed_char) != 10)
+ error
+endif
+
+cvar.var_short = createref_short(10);
+if (value_short(cvar.var_short) != 10)
+ error
+endif
+
+cvar.var_unsigned_short = createref_unsigned_short(10);
+if (value_unsigned_short(cvar.var_unsigned_short) != 10)
+ error
+endif
+
+cvar.var_int = createref_int(10);
+if (value_int(cvar.var_int) != 10)
+ error
+endif
+
+cvar.var_unsigned_int = createref_unsigned_int(10);
+if (value_unsigned_int(cvar.var_unsigned_int) != 10)
+ error
+endif
+
+cvar.var_long = createref_long(10);
+if (value_long(cvar.var_long) != 10)
+ error
+endif
+
+cvar.var_unsigned_long = createref_unsigned_long(10);
+if (value_unsigned_long(cvar.var_unsigned_long) != 10)
+ error
+endif
+
+cvar.var_long_long = createref_long_long(int64(0x6FFFFFFFFFFFFFF8));
+if (value_long_long(cvar.var_long_long) != int64(0x6FFFFFFFFFFFFFF8))
+ error
+endif
+
+#ull = abs(0xFFFFFFF2FFFFFFF0)
+ull = uint64(55834574864);
+cvar.var_unsigned_long_long = createref_unsigned_long_long(ull);
+if (value_unsigned_long_long(cvar.var_unsigned_long_long) != ull)
+ error
+endif
+
+cvar.var_float = createref_float(10.5);
+if (value_float(cvar.var_float) != 10.5)
+ error
+endif
+
+cvar.var_double = createref_double(10.5);
+if (value_double(cvar.var_double) != 10.5)
+ error
+endif
+
+# class reference variable
+cvar.var_TestClass = createref_TestClass(TestClass(20));
+if (value_TestClass(cvar.var_TestClass).num != 20)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/rename_scope_runme.m b/Examples/test-suite/octave/rename_scope_runme.m
new file mode 100644
index 000000000..154f99dfe
--- /dev/null
+++ b/Examples/test-suite/octave/rename_scope_runme.m
@@ -0,0 +1,15 @@
+rename_scope
+
+a = Natural_UP();
+b = Natural_BP();
+
+if (a.rtest() != 1)
+ error
+endif
+
+if (b.rtest() != 1)
+ error
+endif
+
+f = @equals;
+
diff --git a/Examples/test-suite/octave/ret_by_value_runme.m b/Examples/test-suite/octave/ret_by_value_runme.m
new file mode 100644
index 000000000..d17c9f233
--- /dev/null
+++ b/Examples/test-suite/octave/ret_by_value_runme.m
@@ -0,0 +1,10 @@
+ret_by_value
+
+a = ret_by_value.get_test();
+if (a.myInt != 100)
+ error
+endif
+
+if (a.myShort != 200)
+ error
+endif
diff --git a/Examples/test-suite/octave/return_const_value_runme.m b/Examples/test-suite/octave/return_const_value_runme.m
new file mode 100644
index 000000000..1219c9293
--- /dev/null
+++ b/Examples/test-suite/octave/return_const_value_runme.m
@@ -0,0 +1,11 @@
+return_const_value
+
+p = return_const_value.Foo_ptr.getPtr();
+if (p.getVal() != 17)
+ error("Runtime test1 faild. p.getVal()=", p.getVal())
+endif
+
+p = return_const_value.Foo_ptr.getConstPtr();
+if (p.getVal() != 17)
+ error("Runtime test2 faild. p.getVal()=", p.getVal())
+endif
diff --git a/Examples/test-suite/octave/smart_pointer_extend_runme.m b/Examples/test-suite/octave/smart_pointer_extend_runme.m
new file mode 100644
index 000000000..c30cd9ff8
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_extend_runme.m
@@ -0,0 +1,41 @@
+smart_pointer_extend
+
+f = Foo();
+b = Bar(f);
+
+if (b.extension() != f.extension())
+ error
+endif
+
+
+b = CBase();
+d = CDerived();
+p = CPtr();
+
+if (b.bar() != p.bar())
+ error
+endif
+
+if (d.foo() != p.foo())
+ error
+endif
+
+if (b.hello() != p.hello())
+ error
+endif
+
+
+
+d = DFoo();
+
+dp = DPtrFoo(d);
+
+if (d.SExt(1) != dp.SExt(1))
+ error
+endif
+
+if (d.Ext(1) != dp.Ext(1))
+ error
+endif
+
+
diff --git a/Examples/test-suite/octave/smart_pointer_member_runme.m b/Examples/test-suite/octave/smart_pointer_member_runme.m
new file mode 100644
index 000000000..30251c3a8
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_member_runme.m
@@ -0,0 +1,39 @@
+smart_pointer_member
+
+f = Foo();
+f.y = 1;
+
+if (f.y != 1)
+ error
+endif
+
+b = Bar(f);
+b.y = 2;
+
+if (f.y != 2)
+ error("f.y = %i, b.y = %i",f.y,b.y)
+endif
+
+if (swig_this(b.x) != swig_this(f.x))
+ error
+endif
+
+if (b.z != f.z)
+ error
+endif
+
+try
+ if (Foo.z == Bar.z)
+ error
+ endif
+ error
+catch
+end_try_catch
+
+
+
+
+
+
+
+
diff --git a/Examples/test-suite/octave/smart_pointer_multi_runme.m b/Examples/test-suite/octave/smart_pointer_multi_runme.m
new file mode 100644
index 000000000..71ef9109a
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_multi_runme.m
@@ -0,0 +1,17 @@
+smart_pointer_multi
+
+f = Foo();
+b = Bar(f);
+s = Spam(b);
+g = Grok(b);
+
+s.x = 3;
+if (s.getx() != 3)
+ error
+endif
+
+g.x = 4;
+if (g.getx() != 4)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m b/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
new file mode 100644
index 000000000..4b77e0eea
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
@@ -0,0 +1,18 @@
+smart_pointer_multi_typedef
+
+f = Foo();
+b = Bar(f);
+s = Spam(b);
+g = Grok(b);
+
+s.x = 3;
+if (s.getx() != 3)
+ error
+endif
+
+g.x = 4;
+if (g.getx() != 4)
+ error
+endif
+
+
diff --git a/Examples/test-suite/octave/smart_pointer_not_runme.m b/Examples/test-suite/octave/smart_pointer_not_runme.m
new file mode 100644
index 000000000..8b3fea8c7
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_not_runme.m
@@ -0,0 +1,42 @@
+smart_pointer_not
+
+f = Foo();
+b = Bar(f);
+s = Spam(f);
+g = Grok(f);
+
+try
+ x = b.x;
+ error("Error! b.x")
+catch
+end_try_catch
+
+try
+ x = s.x;
+ error("Error! s.x")
+catch
+end_try_catch
+
+try
+ x = g.x;
+ error("Error! g.x")
+catch
+end_try_catch
+
+try
+ x = b.getx();
+ error("Error! b.getx()")
+catch
+end_try_catch
+
+try
+ x = s.getx();
+ error("Error! s.getx()")
+catch
+end_try_catch
+
+try
+ x = g.getx();
+ error("Error! g.getx()")
+catch
+end_try_catch
diff --git a/Examples/test-suite/octave/smart_pointer_overload_runme.m b/Examples/test-suite/octave/smart_pointer_overload_runme.m
new file mode 100644
index 000000000..214437d66
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_overload_runme.m
@@ -0,0 +1,27 @@
+smart_pointer_overload
+
+f = Foo();
+b = Bar(f);
+
+
+if (f.test(3) != 1)
+ error
+endif
+if (f.test(3.5) != 2)
+ error
+endif
+if (f.test("hello") != 3)
+ error
+endif
+
+if (b.test(3) != 1)
+ error
+endif
+if (b.test(3.5) != 2)
+ error
+endif
+if (b.test("hello") != 3)
+ error
+endif
+
+
diff --git a/Examples/test-suite/octave/smart_pointer_rename_runme.m b/Examples/test-suite/octave/smart_pointer_rename_runme.m
new file mode 100644
index 000000000..260ee3e4c
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_rename_runme.m
@@ -0,0 +1,17 @@
+smart_pointer_rename
+
+f = Foo();
+b = Bar(f);
+
+if (b.test() != 3)
+ error
+endif
+
+if (b.ftest1(1) != 1)
+ error
+endif
+
+if (b.ftest2(2,3) != 2)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/smart_pointer_simple_runme.m b/Examples/test-suite/octave/smart_pointer_simple_runme.m
new file mode 100644
index 000000000..26f32e04f
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_simple_runme.m
@@ -0,0 +1,15 @@
+smart_pointer_simple
+
+f = Foo();
+b = Bar(f);
+
+b.x = 3;
+if (b.getx() != 3)
+ error
+endif
+
+fp = b.__deref__();
+fp.x = 4;
+if (fp.getx() != 4)
+ error
+endif
diff --git a/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m b/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
new file mode 100644
index 000000000..4884fa24b
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
@@ -0,0 +1,19 @@
+smart_pointer_templatevariables
+
+d = DiffImContainerPtr_D(create(1234, 5678));
+
+if (d.id != 1234)
+ error
+endif
+#if (d.xyz != 5678):
+# error
+
+d.id = 4321;
+#d.xyz = 8765
+
+if (d.id != 4321)
+ error
+endif
+#if (d.xyz != 8765):
+# error
+
diff --git a/Examples/test-suite/octave/smart_pointer_typedef_runme.m b/Examples/test-suite/octave/smart_pointer_typedef_runme.m
new file mode 100644
index 000000000..8fa6ca26a
--- /dev/null
+++ b/Examples/test-suite/octave/smart_pointer_typedef_runme.m
@@ -0,0 +1,15 @@
+smart_pointer_typedef
+
+f = Foo();
+b = Bar(f);
+
+b.x = 3;
+if (b.getx() != 3)
+ error
+endif
+
+fp = b.__deref__();
+fp.x = 4;
+if (fp.getx() != 4)
+ error
+endif
diff --git a/Examples/test-suite/octave/sneaky1_runme.m b/Examples/test-suite/octave/sneaky1_runme.m
new file mode 100644
index 000000000..e044370ea
--- /dev/null
+++ b/Examples/test-suite/octave/sneaky1_runme.m
@@ -0,0 +1,5 @@
+sneaky1
+x = sneaky1.add(3,4);
+y = sneaky1.subtract(3,4);
+z = sneaky1.mul(3,4);
+w = sneaky1.divide(3,4);
diff --git a/Examples/test-suite/octave/static_const_member_2_runme.m b/Examples/test-suite/octave/static_const_member_2_runme.m
new file mode 100644
index 000000000..b242bfcd1
--- /dev/null
+++ b/Examples/test-suite/octave/static_const_member_2_runme.m
@@ -0,0 +1,18 @@
+static_const_member_2
+
+c = Test_int();
+try
+ a = c.forward_field;
+ a = c.current_profile;
+ a = c.RightIndex;
+ a = Test_int.backward_field;
+ a = Test_int.LeftIndex;
+ a = Test_int.cavity_flags;
+catch
+end_try_catch
+
+
+if (Foo.BAZ.val != 2*Foo.BAR.val)
+ error
+endif
+
diff --git a/Examples/test-suite/octave/std_containers_runme.m b/Examples/test-suite/octave/std_containers_runme.m
new file mode 100644
index 000000000..074f0fd58
--- /dev/null
+++ b/Examples/test-suite/octave/std_containers_runme.m
@@ -0,0 +1,135 @@
+std_containers
+
+
+cube = {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}};
+
+icube = std_containers.cident(cube);
+for i=len(cube),
+ if (cube{i} != icube{i})
+ error("bad cident")
+ endif
+endfor
+
+
+p = {1,2};
+if (p != std_containers.pident(p))
+ error("bad pident")
+endif
+
+v = {1,2,3,4,5,6};
+iv = std_containers.vident(v);
+for i=0:len(v),
+ if (v{i} != iv{i})
+ error("bad vident")
+ endif
+endfor
+
+
+iv = std_containers.videntu(v);
+for i=0:len(v),
+ if (v{i} != iv{i})
+ error("bad videntu")
+ endif
+endfor
+
+
+vu = std_containers.vector_ui(v);
+if (vu{2} != std_containers.videntu(vu){2})
+ error("bad videntu")
+endif
+
+
+if (v(0:3)(1) != vu(0:3)(1))
+ error("bad getslice")
+endif
+
+
+m = {[1,2,3],[2,3],[3,4]};
+im = std_containers.midenti(m);
+
+for i=0:len(m),
+ for j=0:len(m(i)),
+ if (m(i)(j) != im(i)(j))
+ error("bad getslice")
+ endif
+ endfor
+endfor
+
+m = {[1,0,1],[1,1],[1,1]};
+im = std_containers.midentb(m);
+for i=0:len(m),
+ for j in range(0,len(m[i])):
+ if (m(i)(j) != im(i)(j))
+ error("bad getslice")
+ endif
+ endfor
+endfor
+
+
+mi = std_containers.imatrix(m);
+mc = std_containers.cmatrix(m);
+if (mi(0)(1) != mc(0)(1))
+ error("bad matrix")
+endif
+
+
+map ={};
+map{'hello'} = 1;
+map{'hi'} = 2;
+map{'3'} = 2;
+
+imap = std_containers.mapident(map);
+for k in map,
+ if (map(k) != imap(k))
+ error("bad map")
+ endif
+endfor
+
+
+mapc ={};
+c1 = std_containers.C();
+c2 = std_containers.C();
+mapc(1) = swig_this(c1);
+mapc(2) = c2;
+
+std_containers.mapidentc(mapc);
+
+
+vi = std_containers.vector_i([2,2,3,4]);
+
+
+v = [1,2];
+v1 = std_containers.v_inout(vi);
+vi(1), v1(1);
+
+[v1,v2] = std_containers.v_inout2(v1,v2);
+
+a1 = std_containers.A(1);
+a2 = std_containers.A(2);
+
+p1 = {1,a1};
+p2 = {2,a2};
+v = (p1,p2);
+v2= std_containers.pia_vident(v);
+
+v2(0)(1).a;
+v2(1)(1).a;
+
+v3 = std_containers.vector_piA(v2);
+
+v3(0)(1).a;
+v3(1)(1).a;
+
+s = std_containers.set_i();
+s.append(1);
+s.append(2);
+s.append(3);
+j=1;
+for i in s,
+ if (i != j)
+ error
+ endif
+ j = j + 1;
+endfor
+
+
diff --git a/Examples/test-suite/octave/struct_rename_runme.m b/Examples/test-suite/octave/struct_rename_runme.m
new file mode 100644
index 000000000..1b57d8f66
--- /dev/null
+++ b/Examples/test-suite/octave/struct_rename_runme.m
@@ -0,0 +1,4 @@
+struct_rename
+
+b = struct_rename.Bar();
+
diff --git a/Examples/test-suite/octave/struct_value_runme.m b/Examples/test-suite/octave/struct_value_runme.m
new file mode 100644
index 000000000..7340a36ec
--- /dev/null
+++ b/Examples/test-suite/octave/struct_value_runme.m
@@ -0,0 +1,13 @@
+struct_value
+
+b = struct_value.Bar();
+
+b.a.x = 3;
+if (b.a.x != 3)
+ error
+endif
+
+b.b.x = 3;
+if (b.b.x != 3)
+ error
+endif
diff --git a/Examples/test-suite/octave/swigobject_runme.m b/Examples/test-suite/octave/swigobject_runme.m
new file mode 100644
index 000000000..614e2a44a
--- /dev/null
+++ b/Examples/test-suite/octave/swigobject_runme.m
@@ -0,0 +1,28 @@
+swigobject
+
+a = A();
+
+a1 = a_ptr(a);
+a2 = a_ptr(a);
+
+if (swig_this(a1) != swig_this(a2))
+ error
+endif
+
+
+lthis = uint64(swig_this(a.this));
+xstr1 = printf("0x%x",lthis);
+xstr2 = pointer_str(a);
+
+if (xstr1 != xstr2)
+ error
+endif
+
+s = str(a.this);
+r = repr(a.this);
+
+v1 = v_ptr(a);
+v2 = v_ptr(a);
+if (uint64(v1) != uint64(v2))
+ error
+endif
diff --git a/Examples/test-suite/octave/template_construct_runme.m b/Examples/test-suite/octave/template_construct_runme.m
new file mode 100644
index 000000000..2ed066409
--- /dev/null
+++ b/Examples/test-suite/octave/template_construct_runme.m
@@ -0,0 +1 @@
+template_construct
diff --git a/Examples/test-suite/octave/template_default_arg_runme.m b/Examples/test-suite/octave/template_default_arg_runme.m
new file mode 100644
index 000000000..62219dc77
--- /dev/null
+++ b/Examples/test-suite/octave/template_default_arg_runme.m
@@ -0,0 +1,117 @@
+template_default_arg
+
+
+helloInt = template_default_arg.Hello_int();
+helloInt.foo(template_default_arg.Hello_int.hi);
+
+
+x = template_default_arg.X_int();
+if (x.meth(20.0, 200) != 200)
+ error("X_int test 1 failed")
+endif
+if (x.meth(20) != 20)
+ error("X_int test 2 failed")
+endif
+if (x.meth() != 0)
+ error("X_int test 3 failed")
+endif
+
+
+
+y = template_default_arg.Y_unsigned()
+if (y.meth(20.0, 200) != 200)
+ error("Y_unsigned test 1 failed")
+endif
+if (y.meth(20) != 20)
+ error("Y_unsigned test 2 failed")
+endif
+if (y.meth() != 0)
+ error("Y_unsigned test 3 failed")
+endif
+
+
+
+x = template_default_arg.X_longlong();
+x = template_default_arg.X_longlong(20.0);
+x = template_default_arg.X_longlong(20.0, 200L);
+
+
+x = template_default_arg.X_int();
+x = template_default_arg.X_int(20.0);
+x = template_default_arg.X_int(20.0, 200);
+
+
+x = template_default_arg.X_hello_unsigned();
+x = template_default_arg.X_hello_unsigned(20.0);
+x = template_default_arg.X_hello_unsigned(20.0, template_default_arg.Hello_int());
+
+
+y = template_default_arg.Y_hello_unsigned();
+y.meth(20.0, template_default_arg.Hello_int());
+y.meth(template_default_arg.Hello_int());
+y.meth()
+
+
+
+fz = template_default_arg.Foo_Z_8();
+x = template_default_arg.X_Foo_Z_8();
+fzc = x.meth(fz);
+
+
+# Templated functions
+
+# plain function: int ott(Foo<int>)
+if (template_default_arg.ott(template_default_arg.Foo_int()) != 30)
+ error("ott test 1 failed")
+endif
+
+# %template(ott) ott<int, int>
+if (template_default_arg.ott() != 10)
+ error("ott test 2 failed")
+endif
+if (template_default_arg.ott(1) != 10)
+ error("ott test 3 failed")
+endif
+if (template_default_arg.ott(1, 1) != 10)
+ error("ott test 4 failed")
+endif
+
+if (template_default_arg.ott("hi") != 20)
+ error("ott test 5 failed")
+endif
+if (template_default_arg.ott("hi", 1) != 20)
+ error("ott test 6 failed")
+endif
+if (template_default_arg.ott("hi", 1, 1) != 20)
+ error("ott test 7 failed")
+endif
+
+# %template(ott) ott<const char *>
+if (template_default_arg.ottstring(template_default_arg.Hello_int(), "hi") != 40)
+ error("ott test 8 failed")
+endif
+
+if (template_default_arg.ottstring(template_default_arg.Hello_int()) != 40)
+ error("ott test 9 failed")
+endif
+
+# %template(ott) ott<int>
+if (template_default_arg.ottint(template_default_arg.Hello_int(), 1) != 50)
+ error("ott test 10 failed")
+endif
+
+if (template_default_arg.ottint(template_default_arg.Hello_int()) != 50)
+ error("ott test 11 failed")
+endif
+
+# %template(ott) ott<double>
+if (template_default_arg.ott(template_default_arg.Hello_int(), 1.0) != 60)
+ error("ott test 12 failed")
+endif
+
+if (template_default_arg.ott(template_default_arg.Hello_int()) != 60)
+ error("ott test 13 failed")
+endif
+
+
+
diff --git a/Examples/test-suite/octave/template_extend1_runme.m b/Examples/test-suite/octave/template_extend1_runme.m
new file mode 100644
index 000000000..e672da783
--- /dev/null
+++ b/Examples/test-suite/octave/template_extend1_runme.m
@@ -0,0 +1,12 @@
+template_extend1
+
+a = template_extend1.lBaz();
+b = template_extend1.dBaz();
+
+if (!strcmp(a.foo(),"lBaz::foo"))
+ error
+endif
+
+if (!strcmp(b.foo(),"dBaz::foo"))
+ error
+endif
diff --git a/Examples/test-suite/octave/template_extend2_runme.m b/Examples/test-suite/octave/template_extend2_runme.m
new file mode 100644
index 000000000..93c44d7de
--- /dev/null
+++ b/Examples/test-suite/octave/template_extend2_runme.m
@@ -0,0 +1,12 @@
+template_extend2
+
+a = template_extend2.lBaz();
+b = template_extend2.dBaz();
+
+if (!strcmp(a.foo(),"lBaz::foo"))
+ error
+endif
+
+if (!strcmp(b.foo(),"dBaz::foo"))
+ error
+endif
diff --git a/Examples/test-suite/octave/template_inherit_runme.m b/Examples/test-suite/octave/template_inherit_runme.m
new file mode 100644
index 000000000..ce7931e1c
--- /dev/null
+++ b/Examples/test-suite/octave/template_inherit_runme.m
@@ -0,0 +1,68 @@
+template_inherit
+a = FooInt();
+b = FooDouble();
+c = BarInt();
+d = BarDouble();
+e = FooUInt();
+f = BarUInt();
+
+if (!strcmp(a.blah(),"Foo"))
+ error
+endif
+
+if (!strcmp(b.blah(),"Foo"))
+ error
+endif
+
+if (!strcmp(e.blah(),"Foo"))
+ error
+endif
+
+if (!strcmp(c.blah(),"Bar"))
+ error
+endif
+
+if (!strcmp(d.blah(),"Bar"))
+ error
+endif
+
+if (!strcmp(f.blah(),"Bar"))
+ error
+endif
+
+if (!strcmp(c.foomethod(),"foomethod"))
+ error
+endif
+
+if (!strcmp(d.foomethod(),"foomethod"))
+ error
+endif
+
+if (!strcmp(f.foomethod(),"foomethod"))
+ error
+endif
+
+if (!strcmp(invoke_blah_int(a),"Foo"))
+ error
+endif
+
+if (!strcmp(invoke_blah_int(c),"Bar"))
+ error
+endif
+
+if (!strcmp(invoke_blah_double(b),"Foo"))
+ error
+endif
+
+if (!strcmp(invoke_blah_double(d),"Bar"))
+ error
+endif
+
+if (!strcmp(invoke_blah_uint(e),"Foo"))
+ error
+endif
+
+if (!strcmp(invoke_blah_uint(f),"Bar"))
+ error
+endif
+
diff --git a/Examples/test-suite/octave/template_matrix_runme.m b/Examples/test-suite/octave/template_matrix_runme.m
new file mode 100644
index 000000000..b8fb3d3dc
--- /dev/null
+++ b/Examples/test-suite/octave/template_matrix_runme.m
@@ -0,0 +1,6 @@
+template_matrix
+passVector([1,2,3]);
+passMatrix({[1,2],[1,2,3]});
+passCube({{[1,2],[1,2,3]},{[1,2],[1,2,3]}});
+
+
diff --git a/Examples/test-suite/octave/template_ns4_runme.m b/Examples/test-suite/octave/template_ns4_runme.m
new file mode 100644
index 000000000..58ced7ca4
--- /dev/null
+++ b/Examples/test-suite/octave/template_ns4_runme.m
@@ -0,0 +1,6 @@
+template_ns4
+
+d = make_Class_DD();
+if (!strcmp(d.test(),"test"))
+ error
+endif
diff --git a/Examples/test-suite/octave/template_ns_runme.m b/Examples/test-suite/octave/template_ns_runme.m
new file mode 100644
index 000000000..29a2f53f6
--- /dev/null
+++ b/Examples/test-suite/octave/template_ns_runme.m
@@ -0,0 +1,21 @@
+template_ns
+p1 = pairii(2,3);
+p2 = pairii(p1);
+
+if (p2.first != 2)
+ error
+endif
+if (p2.second != 3)
+ error
+endif
+
+p3 = pairdd(3.5,2.5);
+p4 = pairdd(p3);
+
+if (p4.first != 3.5)
+ error
+endif
+
+if (p4.second != 2.5)
+ error
+endif
diff --git a/Examples/test-suite/octave/template_opaque_runme.m b/Examples/test-suite/octave/template_opaque_runme.m
new file mode 100644
index 000000000..1c123b334
--- /dev/null
+++ b/Examples/test-suite/octave/template_opaque_runme.m
@@ -0,0 +1,7 @@
+template_opaque
+
+v = template_opaque.OpaqueVectorType(10);
+
+template_opaque.FillVector(v);
+
+
diff --git a/Examples/test-suite/octave/template_ref_type_runme.m b/Examples/test-suite/octave/template_ref_type_runme.m
new file mode 100644
index 000000000..ef77e06d9
--- /dev/null
+++ b/Examples/test-suite/octave/template_ref_type_runme.m
@@ -0,0 +1,5 @@
+template_ref_type
+
+xr = template_ref_type.XC();
+y = template_ref_type.Y();
+y.find(xr);
diff --git a/Examples/test-suite/octave/template_rename_runme.m b/Examples/test-suite/octave/template_rename_runme.m
new file mode 100644
index 000000000..7cb54938c
--- /dev/null
+++ b/Examples/test-suite/octave/template_rename_runme.m
@@ -0,0 +1,12 @@
+template_rename
+
+i = template_rename.iFoo();
+d = template_rename.dFoo();
+
+a = i.blah_test(4);
+b = i.spam_test(5);
+c = i.groki_test(6);
+
+x = d.blah_test(7);
+y = d.spam(8);
+z = d.grok_test(9);
diff --git a/Examples/test-suite/octave/template_static_runme.m b/Examples/test-suite/octave/template_static_runme.m
new file mode 100644
index 000000000..c54139ae5
--- /dev/null
+++ b/Examples/test-suite/octave/template_static_runme.m
@@ -0,0 +1,3 @@
+template_static
+
+Foo_bar_double(1);
diff --git a/Examples/test-suite/octave/template_tbase_template_runme.m b/Examples/test-suite/octave/template_tbase_template_runme.m
new file mode 100644
index 000000000..da8ec4c69
--- /dev/null
+++ b/Examples/test-suite/octave/template_tbase_template_runme.m
@@ -0,0 +1,6 @@
+template_tbase_template
+
+a = make_Class_dd();
+if (!strcmp(a.test(),"test"))
+ error
+endif
diff --git a/Examples/test-suite/octave/template_type_namespace_runme.m b/Examples/test-suite/octave/template_type_namespace_runme.m
new file mode 100644
index 000000000..1974a3be7
--- /dev/null
+++ b/Examples/test-suite/octave/template_type_namespace_runme.m
@@ -0,0 +1,7 @@
+template_type_namespace
+
+if (!strcmp(typeinfo(foo()(0)),typeinfo("")))
+ error
+endif
+
+
diff --git a/Examples/test-suite/octave/template_typedef_cplx2_runme.m b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
new file mode 100644
index 000000000..94d3beb79
--- /dev/null
+++ b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
@@ -0,0 +1,103 @@
+template_typedef_cplx2
+
+#
+# double case
+#
+
+try
+ d = make_Identity_double();
+ a = swig_this(d);
+catch
+ d
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(d)) != 1)
+ d
+ error("is not an ArithUnaryFunction")
+ error
+endif
+
+try
+ e = make_Multiplies_double_double_double_double(d, d);
+ a = swig_this(e);
+catch
+ e
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(e)) != 1)
+ e
+ error("is not an ArithUnaryFunction")
+endif
+
+
+#
+# complex case
+#
+
+try
+ c = make_Identity_complex();
+ a = swig_this(c);
+catch
+ c
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(c)) != 1)
+ c
+ error("is not an ArithUnaryFunction")
+endif
+
+try
+ f = make_Multiplies_complex_complex_complex_complex(c, c);
+ a = swig_this(f);
+catch
+ f
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(f)) != 1)
+ f
+ error("is not an ArithUnaryFunction")
+endif
+
+#
+# Mix case
+#
+
+try
+ g = make_Multiplies_double_double_complex_complex(d, c);
+ a = swig_this(g);
+catch
+ g
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(g)) != 1)
+ g
+ error("is not an ArithUnaryFunction")
+ error
+endif
+
+
+try
+ h = make_Multiplies_complex_complex_double_double(c, d);
+ a = swig_this(h);
+catch
+ h
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(h)) == -1)
+ h
+ error("is not an ArithUnaryFunction")
+endif
+
+try
+ a = g.get_value();
+catch
+ error(g, "has not get_value() method")
+ error
+end_try_catch
+
diff --git a/Examples/test-suite/octave/template_typedef_cplx3_runme.m b/Examples/test-suite/octave/template_typedef_cplx3_runme.m
new file mode 100644
index 000000000..d21f27990
--- /dev/null
+++ b/Examples/test-suite/octave/template_typedef_cplx3_runme.m
@@ -0,0 +1,34 @@
+template_typedef_cplx3
+
+#
+# this is OK
+#
+
+
+s = Sin();
+s.get_base_value();
+s.get_value();
+s.get_arith_value();
+my_func_r(s);
+make_Multiplies_double_double_double_double(s,s);
+
+z = CSin();
+z.get_base_value();
+z.get_value();
+z.get_arith_value();
+my_func_c(z);
+make_Multiplies_complex_complex_complex_complex(z,z);
+
+#
+# Here we fail
+#
+d = make_Identity_double();
+my_func_r(d);
+
+c = make_Identity_complex();
+my_func_c(c);
+
+
+
+
+
diff --git a/Examples/test-suite/octave/template_typedef_cplx4_runme.m b/Examples/test-suite/octave/template_typedef_cplx4_runme.m
new file mode 100644
index 000000000..4db276de4
--- /dev/null
+++ b/Examples/test-suite/octave/template_typedef_cplx4_runme.m
@@ -0,0 +1,33 @@
+template_typedef_cplx4
+
+#
+# this is OK
+#
+
+
+s = Sin();
+s.get_base_value();
+s.get_value();
+s.get_arith_value();
+my_func_r(s);
+make_Multiplies_double_double_double_double(s,s);
+
+z = CSin();
+z.get_base_value();
+z.get_value();
+z.get_arith_value();
+my_func_c(z);
+make_Multiplies_complex_complex_complex_complex(z,z);
+
+#
+# Here we fail
+#
+d = make_Identity_double();
+my_func_r(d);
+
+c = make_Identity_complex();
+my_func_c(c);
+
+
+
+
diff --git a/Examples/test-suite/octave/template_typedef_cplx_runme.m b/Examples/test-suite/octave/template_typedef_cplx_runme.m
new file mode 100644
index 000000000..d00981cec
--- /dev/null
+++ b/Examples/test-suite/octave/template_typedef_cplx_runme.m
@@ -0,0 +1,92 @@
+template_typedef_cplx
+
+#
+# double case
+#
+
+try
+ d = make_Identity_double();
+ a = swig_this(d);
+catch
+ d
+ error("is not an instance")
+end_try_catch
+
+if (findstr("ArithUnaryFunction",swig_type(d)) != 1)
+ d
+ error("is not an ArithUnaryFunction")
+endif
+
+try
+ e = make_Multiplies_double_double_double_double(d, d);
+ a = swig_this(e);
+catch
+ error(e, "is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(e)) != 1);
+ c
+ error("is not an ArithUnaryFunction")
+endif
+
+
+#
+# complex case
+#
+
+try
+ c = make_Identity_complex();
+ a = swig_this(c);
+catch
+ c
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(c)) != 1)
+ c
+ error("is not an ArithUnaryFunction")
+endif
+
+try
+ f = make_Multiplies_complex_complex_complex_complex(c, c);
+ a = swig_this(f);
+catch
+ f
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(f)) != 1)
+ f
+ error("is not an ArithUnaryFunction")
+endif
+
+#
+# Mix case
+#
+
+try
+ g = make_Multiplies_double_double_complex_complex(d, c);
+ a = swig_this(g);
+catch
+ g
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(g)) != 1)
+ g
+ error("is not an ArithUnaryFunction")
+endif
+
+
+try
+ h = make_Multiplies_complex_complex_double_double(c, d);
+ a = swig_this(h);
+catch
+ h
+ error("is not an instance")
+end_try_catch
+
+if (findstr('ArithUnaryFunction',swig_type(h)) != 1)
+ h
+ error("is not an ArithUnaryFunction")
+endif
diff --git a/Examples/test-suite/octave/template_typedef_import_runme.m b/Examples/test-suite/octave/template_typedef_import_runme.m
new file mode 100644
index 000000000..0574ab1fc
--- /dev/null
+++ b/Examples/test-suite/octave/template_typedef_import_runme.m
@@ -0,0 +1,34 @@
+template_typedef_cplx2
+template_typedef_import
+
+#
+# this is OK
+#
+
+
+s = Sin();
+s.get_base_value();
+s.get_value();
+s.get_arith_value();
+my_func_r(s);
+make_Multiplies_double_double_double_double(s,s);
+
+z = CSin();
+z.get_base_value();
+z.get_value();
+z.get_arith_value();
+my_func_c(z);
+make_Multiplies_complex_complex_complex_complex(z,z);
+
+#
+# Here we fail
+#
+d = make_Identity_double();
+my_func_r(d);
+
+c = make_Identity_complex();
+my_func_c(c);
+
+
+
+
diff --git a/Examples/test-suite/octave/template_typedef_runme.m b/Examples/test-suite/octave/template_typedef_runme.m
new file mode 100644
index 000000000..8d8af795b
--- /dev/null
+++ b/Examples/test-suite/octave/template_typedef_runme.m
@@ -0,0 +1,51 @@
+template_typedef
+
+d = make_Identity_float();
+c = make_Identity_reald();
+
+
+try
+ a = swig_this(d);
+ a = swig_this(c);
+catch
+ error
+end_try_catch
+
+try
+ e = make_Multiplies_float_float_float_float(d, d);
+ a = swig_this(e);
+catch
+ e
+ error("is not an instance")
+end_try_catch
+
+try
+ f = make_Multiplies_reald_reald_reald_reald(c, c);
+ a = swig_this(f);
+catch
+ f
+ error("is not an instance");
+end_try_catch
+
+try
+ g = make_Multiplies_float_float_reald_reald(d, c);
+ a = swig_this(g);
+catch
+ error(g, "is not an instance")
+end_try_catch
+
+
+# the old large format
+if (strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<vfncs::arith_traits<float,double>::argument_type,vfncs::arith_traits<float,double >::result_type > *")))
+ error
+endif
+
+# the reduced format
+if (strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<double,double> *")))
+ error
+endif
+
+# this is a bad name
+if (!strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<double,doublex> *")))
+ error
+endif
diff --git a/Examples/test-suite/octave/typedef_class_runme.m b/Examples/test-suite/octave/typedef_class_runme.m
new file mode 100644
index 000000000..97d2aed6a
--- /dev/null
+++ b/Examples/test-suite/octave/typedef_class_runme.m
@@ -0,0 +1,7 @@
+typedef_class
+
+a = typedef_class.RealA();
+a.a = 3;
+
+b = typedef_class.B();
+b.testA(a);
diff --git a/Examples/test-suite/octave/typedef_inherit_runme.m b/Examples/test-suite/octave/typedef_inherit_runme.m
new file mode 100644
index 000000000..6c4c47a43
--- /dev/null
+++ b/Examples/test-suite/octave/typedef_inherit_runme.m
@@ -0,0 +1,27 @@
+typedef_inherit
+
+a = typedef_inherit.Foo();
+b = typedef_inherit.Bar();
+
+x = typedef_inherit.do_blah(a);
+if (!strcmp(x,"Foo::blah"))
+ error("Whoa! Bad return", x)
+endif
+
+x = typedef_inherit.do_blah(b);
+if (!strcmp(x,"Bar::blah"))
+ error("Whoa! Bad return", x)
+endif
+
+c = typedef_inherit.Spam();
+d = typedef_inherit.Grok();
+
+x = typedef_inherit.do_blah2(c);
+if (!strcmp(x,"Spam::blah"))
+ error("Whoa! Bad return", x)
+endif
+
+x = typedef_inherit.do_blah2(d);
+if (!strcmp(x,"Grok::blah"))
+ error("Whoa! Bad return", x)
+endif
diff --git a/Examples/test-suite/octave/typedef_scope_runme.m b/Examples/test-suite/octave/typedef_scope_runme.m
new file mode 100644
index 000000000..9e6d1013c
--- /dev/null
+++ b/Examples/test-suite/octave/typedef_scope_runme.m
@@ -0,0 +1,14 @@
+typedef_scope
+
+b = typedef_scope.Bar();
+x = b.test1(42,"hello");
+if (x != 42)
+ error("Failed!!")
+endif
+
+x = b.test2(42,"hello");
+if (!strcmp(x,"hello"))
+ error("Failed!!")
+endif
+
+
diff --git a/Examples/test-suite/octave/typemap_namespace_runme.m b/Examples/test-suite/octave/typemap_namespace_runme.m
new file mode 100644
index 000000000..ec62a3910
--- /dev/null
+++ b/Examples/test-suite/octave/typemap_namespace_runme.m
@@ -0,0 +1,10 @@
+typemap_namespace
+
+if (!strcmp(test1("hello"),"hello"))
+ error
+endif
+
+if (!strcmp(test2("hello"),"hello"))
+ error
+endif
+
diff --git a/Examples/test-suite/octave/typemap_ns_using_runme.m b/Examples/test-suite/octave/typemap_ns_using_runme.m
new file mode 100644
index 000000000..dd3f657f0
--- /dev/null
+++ b/Examples/test-suite/octave/typemap_ns_using_runme.m
@@ -0,0 +1,5 @@
+typemap_ns_using
+
+if (typemap_ns_using.spam(37) != 37)
+ error
+endif
diff --git a/Examples/test-suite/octave/typename_runme.m b/Examples/test-suite/octave/typename_runme.m
new file mode 100644
index 000000000..c47f817a7
--- /dev/null
+++ b/Examples/test-suite/octave/typename_runme.m
@@ -0,0 +1,13 @@
+typename
+f = typename.Foo();
+b = typename.Bar();
+
+x = typename.twoFoo(f);
+if (x == floor(x))
+ error("Wrong return type!")
+endif
+y = typename.twoBar(b);
+if (y != floor(y))
+ error("Wrong return type!")
+endif
+
diff --git a/Examples/test-suite/octave/types_directive_runme.m b/Examples/test-suite/octave/types_directive_runme.m
new file mode 100644
index 000000000..0757c6c39
--- /dev/null
+++ b/Examples/test-suite/octave/types_directive_runme.m
@@ -0,0 +1,15 @@
+types_directive
+
+d1 = Time1(2001, 2, 3, 60);
+newDate = add(d1, 7); # check that a Time1 instance is accepted where Date is expected
+if (newDate.day != 10)
+ error
+endif
+
+d2 = Time2(1999, 8, 7, 60);
+newDate = add(d2, 7); # check that a Time2 instance is accepted where Date is expected
+if (newDate.day != 14)
+ error
+endif
+
+
diff --git a/Examples/test-suite/octave/unions_runme.m b/Examples/test-suite/octave/unions_runme.m
new file mode 100644
index 000000000..05ac25240
--- /dev/null
+++ b/Examples/test-suite/octave/unions_runme.m
@@ -0,0 +1,49 @@
+
+# This is the union runtime testcase. It ensures that values within a
+# union embedded within a struct can be set and read correctly.
+
+unions
+
+# Create new instances of SmallStruct and BigStruct for later use
+small = unions.SmallStruct();
+small.jill = 200;
+
+big = unions.BigStruct();
+big.smallstruct = small;
+big.jack = 300;
+
+# Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+# Ensure values in EmbeddedUnionTest are set correctly for each.
+eut = unions.EmbeddedUnionTest();
+
+# First check the SmallStruct in EmbeddedUnionTest
+eut.number = 1;
+eut.uni.small = small;
+Jill1 = eut.uni.small.jill;
+if (Jill1 != 200)
+ error("Runtime test1 failed. eut.uni.small.jill=%i" , Jill1)
+endif
+
+Num1 = eut.number;
+if (Num1 != 1)
+ error("Runtime test2 failed. eut.number=%i" , Num1)
+endif
+
+# Secondly check the BigStruct in EmbeddedUnionTest
+eut.number = 2;
+eut.uni.big = big;
+Jack1 = eut.uni.big.jack;
+if (Jack1 != 300)
+ error("Runtime test3 failed. eut.uni.big.jack=%i" , Jack1)
+endif
+
+Jill2 = eut.uni.big.smallstruct.jill;
+if (Jill2 != 200)
+ error("Runtime test4 failed. eut.uni.big.smallstruct.jill=%i" , Jill2)
+endif
+
+Num2 = eut.number;
+if (Num2 != 2)
+ error("Runtime test5 failed. eut.number=%i" , Num2)
+endif
+
diff --git a/Examples/test-suite/octave/using1_runme.m b/Examples/test-suite/octave/using1_runme.m
new file mode 100644
index 000000000..0c37daf7f
--- /dev/null
+++ b/Examples/test-suite/octave/using1_runme.m
@@ -0,0 +1,5 @@
+using1
+
+if (using1.spam(37) != 37)
+ error
+endif
diff --git a/Examples/test-suite/octave/using2_runme.m b/Examples/test-suite/octave/using2_runme.m
new file mode 100644
index 000000000..205c6d7ad
--- /dev/null
+++ b/Examples/test-suite/octave/using2_runme.m
@@ -0,0 +1,5 @@
+using2
+
+if (using2.spam(37) != 37)
+ error
+endif
diff --git a/Examples/test-suite/octave/using_composition_runme.m b/Examples/test-suite/octave/using_composition_runme.m
new file mode 100644
index 000000000..9b58d6d54
--- /dev/null
+++ b/Examples/test-suite/octave/using_composition_runme.m
@@ -0,0 +1,43 @@
+using_composition
+
+f = FooBar();
+if (f.blah(3) != 3)
+ error("FooBar::blah(int)")
+endif
+
+if (f.blah(3.5) != 3.5)
+ error("FooBar::blah(double)")
+endif
+
+if (!strcmp(f.blah("hello"),"hello"))
+ error("FooBar::blah(char *)")
+endif
+
+
+f = FooBar2();
+if (f.blah(3) != 3)
+ error("FooBar2::blah(int)")
+endif
+
+if (f.blah(3.5) != 3.5)
+ error("FooBar2::blah(double)")
+endif
+
+if (!strcmp(f.blah("hello"),"hello"))
+ error("FooBar2::blah(char *)")
+endif
+
+
+f = FooBar3();
+if (f.blah(3) != 3)
+ error("FooBar3::blah(int)")
+endif
+
+if (f.blah(3.5) != 3.5)
+ error("FooBar3::blah(double)")
+endif
+
+if (!strcmp(f.blah("hello"),"hello"))
+ error("FooBar3::blah(char *)")
+endif
+
diff --git a/Examples/test-suite/octave/using_extend_runme.m b/Examples/test-suite/octave/using_extend_runme.m
new file mode 100644
index 000000000..b9c13fa68
--- /dev/null
+++ b/Examples/test-suite/octave/using_extend_runme.m
@@ -0,0 +1,27 @@
+using_extend
+
+f = FooBar();
+if (f.blah(3) != 3)
+ error("blah(int)")
+endif
+
+if (f.blah(3.5) != 3.5)
+ error("blah(double)")
+endif
+
+if (!strcmp(f.blah("hello"),"hello"))
+ error("blah(char *)")
+endif
+
+if (f.blah(3,4) != 7)
+ error("blah(int,int)")
+endif
+
+if (f.blah(3.5,7.5) != (3.5+7.5))
+ error("blah(double,double)")
+endif
+
+
+if (f.duh(3) != 3)
+ error("duh(int)")
+endif
diff --git a/Examples/test-suite/octave/using_inherit_runme.m b/Examples/test-suite/octave/using_inherit_runme.m
new file mode 100644
index 000000000..effd0e2a0
--- /dev/null
+++ b/Examples/test-suite/octave/using_inherit_runme.m
@@ -0,0 +1,61 @@
+using_inherit
+
+b = Bar();
+if (b.test(3) != 3)
+ error("Bar::test(int)")
+endif
+
+if (b.test(3.5) != 3.5)
+ error("Bar::test(double)")
+endif
+
+
+b = Bar2();
+if (b.test(3) != 6)
+ error("Bar2::test(int)")
+endif
+
+if (b.test(3.5) != 7.0)
+ error("Bar2::test(double)")
+endif
+
+
+b = Bar3();
+if (b.test(3) != 6)
+ error("Bar3::test(int)")
+endif
+
+if (b.test(3.5) != 7.0)
+ error("Bar3::test(double)")
+endif
+
+
+b = Bar4();
+if (b.test(3) != 6)
+ error("Bar4::test(int)")
+endif
+
+if (b.test(3.5) != 7.0)
+ error("Bar4::test(double)")
+endif
+
+
+b = Fred1();
+if (b.test(3) != 3)
+ error("Fred1::test(int)")
+endif
+
+if (b.test(3.5) != 7.0)
+ error("Fred1::test(double)")
+endif
+
+
+b = Fred2();
+if (b.test(3) != 3)
+ error("Fred2::test(int)")
+endif
+
+if (b.test(3.5) != 7.0)
+ error("Fred2::test(double)")
+endif
+
diff --git a/Examples/test-suite/octave/using_private_runme.m b/Examples/test-suite/octave/using_private_runme.m
new file mode 100644
index 000000000..3ac71dbf9
--- /dev/null
+++ b/Examples/test-suite/octave/using_private_runme.m
@@ -0,0 +1,16 @@
+using_private
+
+f = FooBar();
+f.x = 3;
+
+if (f.blah(4) != 4)
+ error, "blah(int)"
+endif
+
+if (f.defaulted() != -1)
+ error, "defaulted()"
+endif
+
+if (f.defaulted(222) != 222)
+ error, "defaulted(222)"
+endif
diff --git a/Examples/test-suite/octave/using_protected_runme.m b/Examples/test-suite/octave/using_protected_runme.m
new file mode 100644
index 000000000..ed4b1c32b
--- /dev/null
+++ b/Examples/test-suite/octave/using_protected_runme.m
@@ -0,0 +1,8 @@
+using_protected
+
+f = FooBar();
+f.x = 3;
+
+if (f.blah(4) != 4)
+ error("blah(int)")
+endif
diff --git a/Examples/test-suite/octave/varargs_runme.m b/Examples/test-suite/octave/varargs_runme.m
new file mode 100644
index 000000000..dcdcb2491
--- /dev/null
+++ b/Examples/test-suite/octave/varargs_runme.m
@@ -0,0 +1,23 @@
+varargs
+
+if (!strcmp(varargs.test("Hello"),"Hello"))
+ error("Failed")
+endif
+
+f = varargs.Foo("Greetings");
+if (!strcmp(f.str,"Greetings"))
+ error("Failed")
+endif
+
+if (!strcmp(f.test("Hello"),"Hello"))
+ error("Failed")
+endif
+
+
+if (!strcmp(varargs.test_def("Hello",1),"Hello"))
+ error("Failed")
+endif
+
+if (!strcmp(varargs.test_def("Hello"),"Hello"))
+ error("Failed")
+endif
diff --git a/Examples/test-suite/octave/virtual_derivation_runme.m b/Examples/test-suite/octave/virtual_derivation_runme.m
new file mode 100644
index 000000000..8ce8503ad
--- /dev/null
+++ b/Examples/test-suite/octave/virtual_derivation_runme.m
@@ -0,0 +1,9 @@
+virtual_derivation
+#
+# very innocent example
+#
+b = B(3);
+if (b.get_a() != b.get_b())
+ error("something is really wrong")
+endif
+
diff --git a/Examples/test-suite/octave/virtual_poly_runme.m b/Examples/test-suite/octave/virtual_poly_runme.m
new file mode 100644
index 000000000..0c7c95153
--- /dev/null
+++ b/Examples/test-suite/octave/virtual_poly_runme.m
@@ -0,0 +1,44 @@
+virtual_poly
+
+d = virtual_poly.NDouble(3.5);
+i = virtual_poly.NInt(2);
+
+#
+# the copy methods return the right polymorphic types
+#
+dc = d.copy();
+ic = i.copy();
+
+if (d.get() != dc.get())
+ error
+endif
+
+if (i.get() != ic.get())
+ error
+endif
+
+virtual_poly.incr(ic);
+
+if ((i.get() + 1) != ic.get())
+ error
+endif
+
+
+dr = d.ref_this();
+if (d.get() != dr.get())
+ error
+endif
+
+
+#
+# 'narrowing' also works
+#
+ddc = virtual_poly.NDouble_narrow(d.nnumber());
+if (d.get() != ddc.get())
+ error
+endif
+
+dic = virtual_poly.NInt_narrow(i.nnumber());
+if (i.get() != dic.get())
+ error
+endif
diff --git a/Examples/test-suite/octave/voidtest_runme.m b/Examples/test-suite/octave/voidtest_runme.m
new file mode 100644
index 000000000..e62f8a57f
--- /dev/null
+++ b/Examples/test-suite/octave/voidtest_runme.m
@@ -0,0 +1,38 @@
+voidtest
+
+voidtest.globalfunc();
+f = voidtest.Foo();
+f.memberfunc();
+
+voidtest.Foo_staticmemberfunc();
+
+function fvoid()
+end
+
+try
+ a = f.memberfunc();
+catch
+end_try_catch
+try
+ a = fvoid();
+catch
+end_try_catch
+
+
+v1 = voidtest.vfunc1(f);
+v2 = voidtest.vfunc2(f);
+if (swig_this(v1) != swig_this(v2))
+ error
+endif
+
+v3 = voidtest.vfunc3(v1);
+if (swig_this(v3) != swig_this(f))
+ error
+endif
+v4 = voidtest.vfunc1(f);
+if (swig_this(v4) != swig_this(v1))
+ error
+endif
+
+
+v3.memberfunc();
diff --git a/Examples/test-suite/octave/wrapmacro_runme.m b/Examples/test-suite/octave/wrapmacro_runme.m
new file mode 100644
index 000000000..4f42883d8
--- /dev/null
+++ b/Examples/test-suite/octave/wrapmacro_runme.m
@@ -0,0 +1,8 @@
+wrapmacro
+
+a = 2;
+b = -1;
+wrapmacro.max(a,b);
+wrapmacro.max(a/7.0, -b*256);
+wrapmacro.GUINT16_SWAP_LE_BE_CONSTANT(1);
+