summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
Diffstat (limited to 'Examples')
-rw-r--r--Examples/Makefile.in111
-rw-r--r--Examples/android/class/Makefile2
-rw-r--r--Examples/android/extend/Makefile2
-rw-r--r--Examples/chicken/class/Makefile4
-rw-r--r--Examples/chicken/constants/Makefile8
-rw-r--r--Examples/chicken/multimap/Makefile8
-rw-r--r--Examples/chicken/overload/Makefile6
-rw-r--r--Examples/chicken/simple/Makefile8
-rw-r--r--Examples/go/constants/Makefile2
-rw-r--r--Examples/go/template/Makefile2
-rw-r--r--Examples/guile/constants/Makefile2
-rw-r--r--Examples/java/constants/Makefile2
-rw-r--r--Examples/java/native/Makefile2
-rw-r--r--Examples/java/template/Makefile2
-rw-r--r--Examples/java/typemap/Makefile2
-rw-r--r--Examples/javascript/check.list13
-rwxr-xr-xExamples/javascript/class/Makefile3
-rw-r--r--Examples/javascript/class/binding.gyp8
-rwxr-xr-xExamples/javascript/class/example.cxx28
-rwxr-xr-xExamples/javascript/class/example.h34
-rwxr-xr-xExamples/javascript/class/example.i10
-rw-r--r--Examples/javascript/class/example.js1
-rwxr-xr-xExamples/javascript/class/runme.js46
-rwxr-xr-xExamples/javascript/constant/Makefile3
-rw-r--r--Examples/javascript/constant/binding.gyp8
-rw-r--r--Examples/javascript/constant/example.h8
-rwxr-xr-xExamples/javascript/constant/example.i24
-rw-r--r--Examples/javascript/constant/example.js1
-rwxr-xr-xExamples/javascript/constant/runme.js14
-rwxr-xr-xExamples/javascript/enum/Makefile3
-rw-r--r--Examples/javascript/enum/binding.gyp8
-rwxr-xr-xExamples/javascript/enum/example.cxx37
-rwxr-xr-xExamples/javascript/enum/example.h13
-rwxr-xr-xExamples/javascript/enum/example.i11
-rw-r--r--Examples/javascript/enum/example.js1
-rwxr-xr-xExamples/javascript/enum/runme.js34
-rw-r--r--Examples/javascript/example.mk27
-rwxr-xr-xExamples/javascript/exception/Makefile3
-rw-r--r--Examples/javascript/exception/binding.gyp29
-rw-r--r--Examples/javascript/exception/example.cxx1
-rw-r--r--Examples/javascript/exception/example.h53
-rw-r--r--Examples/javascript/exception/example.i12
-rw-r--r--Examples/javascript/exception/example.js1
-rw-r--r--Examples/javascript/exception/runme.js64
-rwxr-xr-xExamples/javascript/functor/Makefile3
-rw-r--r--Examples/javascript/functor/binding.gyp8
-rw-r--r--Examples/javascript/functor/example.cxx0
-rw-r--r--Examples/javascript/functor/example.i25
-rw-r--r--Examples/javascript/functor/example.js1
-rw-r--r--Examples/javascript/functor/runme.js15
-rwxr-xr-xExamples/javascript/nspace/Makefile3
-rw-r--r--Examples/javascript/nspace/binding.gyp8
-rw-r--r--Examples/javascript/nspace/example.h23
-rw-r--r--Examples/javascript/nspace/example.i10
-rw-r--r--Examples/javascript/nspace/example.js1
-rw-r--r--Examples/javascript/nspace/runme.js50
-rwxr-xr-xExamples/javascript/operator/Makefile3
-rw-r--r--Examples/javascript/operator/binding.gyp8
-rw-r--r--Examples/javascript/operator/example.h36
-rw-r--r--Examples/javascript/operator/example.i34
-rw-r--r--Examples/javascript/operator/example.js1
-rw-r--r--Examples/javascript/operator/runme.js25
-rwxr-xr-xExamples/javascript/overload/Makefile3
-rw-r--r--Examples/javascript/overload/binding.gyp8
-rw-r--r--Examples/javascript/overload/example.h28
-rw-r--r--Examples/javascript/overload/example.i16
-rw-r--r--Examples/javascript/overload/example.js1
-rw-r--r--Examples/javascript/overload/runme.js9
-rwxr-xr-xExamples/javascript/pointer/Makefile3
-rw-r--r--Examples/javascript/pointer/binding.gyp8
-rwxr-xr-xExamples/javascript/pointer/example.cxx16
-rwxr-xr-xExamples/javascript/pointer/example.i30
-rw-r--r--Examples/javascript/pointer/example.js1
-rwxr-xr-xExamples/javascript/pointer/runme.js35
-rw-r--r--Examples/javascript/pointer/typemaps.i0
-rwxr-xr-xExamples/javascript/reference/Makefile3
-rw-r--r--Examples/javascript/reference/binding.gyp8
-rwxr-xr-xExamples/javascript/reference/example.cxx46
-rwxr-xr-xExamples/javascript/reference/example.h26
-rwxr-xr-xExamples/javascript/reference/example.i42
-rw-r--r--Examples/javascript/reference/example.js1
-rwxr-xr-xExamples/javascript/reference/runme.js67
-rwxr-xr-xExamples/javascript/simple/Makefile3
-rw-r--r--Examples/javascript/simple/binding.gyp8
-rw-r--r--Examples/javascript/simple/example.cxx18
-rw-r--r--Examples/javascript/simple/example.i7
-rw-r--r--Examples/javascript/simple/example.js1
-rwxr-xr-xExamples/javascript/simple/runme.js26
-rwxr-xr-xExamples/javascript/template/Makefile3
-rw-r--r--Examples/javascript/template/binding.gyp8
-rw-r--r--Examples/javascript/template/example.h32
-rw-r--r--Examples/javascript/template/example.i17
-rw-r--r--Examples/javascript/template/example.js1
-rw-r--r--Examples/javascript/template/runme.js30
-rwxr-xr-xExamples/javascript/variables/Makefile3
-rw-r--r--Examples/javascript/variables/binding.gyp8
-rwxr-xr-xExamples/javascript/variables/example.cxx96
-rwxr-xr-xExamples/javascript/variables/example.h6
-rwxr-xr-xExamples/javascript/variables/example.i49
-rw-r--r--Examples/javascript/variables/example.js1
-rwxr-xr-xExamples/javascript/variables/runme.js68
-rw-r--r--Examples/lua/arrays/runme.lua2
-rw-r--r--Examples/lua/constants/Makefile4
-rw-r--r--Examples/lua/dual/dual.cpp6
-rw-r--r--Examples/lua/embed/embed.c18
-rw-r--r--Examples/lua/embed/runme.lua6
-rw-r--r--Examples/lua/embed2/embed2.c16
-rw-r--r--Examples/lua/embed2/runme.lua6
-rw-r--r--Examples/lua/embed3/embed3.cpp14
-rw-r--r--Examples/lua/embed3/example.h2
-rw-r--r--Examples/lua/embed3/runme.lua10
-rw-r--r--Examples/lua/exception/Makefile2
-rw-r--r--Examples/lua/exception/runme.lua4
-rw-r--r--Examples/lua/funcptr3/Makefile2
-rw-r--r--Examples/lua/functest/Makefile2
-rw-r--r--Examples/lua/functor/Makefile4
-rw-r--r--Examples/lua/import/Makefile2
-rw-r--r--Examples/lua/nspace/Makefile2
-rw-r--r--Examples/lua/owner/runme.lua14
-rw-r--r--Examples/lua/pointer/Makefile2
-rw-r--r--Examples/modula3/class/Makefile2
-rw-r--r--Examples/modula3/enum/Makefile2
-rw-r--r--Examples/modula3/reference/Makefile2
-rw-r--r--Examples/modula3/simple/Makefile2
-rw-r--r--Examples/modula3/typemap/Makefile2
-rw-r--r--Examples/mzscheme/multimap/Makefile2
-rw-r--r--Examples/mzscheme/simple/Makefile2
-rw-r--r--Examples/mzscheme/std_vector/Makefile8
-rw-r--r--Examples/ocaml/contract/Makefile4
-rw-r--r--Examples/ocaml/scoped_enum/Makefile4
-rw-r--r--Examples/ocaml/shapes/Makefile2
-rw-r--r--Examples/ocaml/std_string/Makefile2
-rw-r--r--Examples/ocaml/std_vector/Makefile2
-rw-r--r--Examples/ocaml/stl/Makefile2
-rw-r--r--Examples/ocaml/string_from_ptr/Makefile4
-rw-r--r--Examples/ocaml/strings_test/Makefile2
-rw-r--r--Examples/perl5/funcptr/Makefile2
-rw-r--r--Examples/perl5/java/Makefile4
-rw-r--r--Examples/perl5/multimap/Makefile2
-rw-r--r--Examples/perl5/multiple_inheritance/Makefile4
-rw-r--r--Examples/perl5/pointer/Makefile2
-rw-r--r--Examples/perl5/reference/Makefile2
-rw-r--r--Examples/perl5/simple/Makefile2
-rw-r--r--Examples/perl5/value/Makefile2
-rw-r--r--Examples/perl5/variables/Makefile2
-rw-r--r--Examples/php/callback/Makefile2
-rw-r--r--Examples/php/extend/Makefile2
-rw-r--r--Examples/pike/constants/Makefile2
-rw-r--r--Examples/pike/template/Makefile4
-rw-r--r--Examples/python/callback/Makefile2
-rw-r--r--Examples/python/constants/Makefile2
-rw-r--r--Examples/python/contract/Makefile2
-rw-r--r--Examples/python/exception/Makefile2
-rw-r--r--Examples/python/exceptproxy/Makefile4
-rw-r--r--Examples/python/extend/Makefile2
-rw-r--r--Examples/python/functor/Makefile4
-rw-r--r--Examples/python/java/Makefile3
-rw-r--r--Examples/python/libffi/Makefile2
-rw-r--r--Examples/python/operator/Makefile4
-rw-r--r--Examples/python/smartptr/Makefile2
-rw-r--r--Examples/python/std_map/Makefile4
-rw-r--r--Examples/python/std_vector/Makefile4
-rw-r--r--Examples/python/swigrun/Makefile2
-rw-r--r--Examples/python/template/Makefile4
-rw-r--r--Examples/python/varargs/Makefile2
-rw-r--r--Examples/ruby/constants/Makefile2
-rw-r--r--Examples/ruby/exception_class/Makefile2
-rw-r--r--Examples/ruby/hashargs/Makefile4
-rw-r--r--Examples/ruby/import/Makefile2
-rw-r--r--Examples/ruby/import_template/Makefile2
-rw-r--r--Examples/ruby/java/Makefile3
-rw-r--r--Examples/ruby/operator/Makefile4
-rw-r--r--Examples/ruby/std_vector/Makefile4
-rw-r--r--Examples/ruby/template/Makefile4
-rw-r--r--Examples/tcl/java/Makefile3
-rw-r--r--Examples/tcl/operator/Makefile2
-rw-r--r--Examples/tcl/std_vector/Makefile2
-rw-r--r--Examples/test-suite/c_delete.i4
-rw-r--r--Examples/test-suite/c_delete_function.i4
-rw-r--r--Examples/test-suite/common.mk3
-rw-r--r--Examples/test-suite/constructor_copy.i2
-rw-r--r--Examples/test-suite/cpp11_template_double_brackets.i14
-rw-r--r--Examples/test-suite/cpp_basic.i13
-rw-r--r--Examples/test-suite/d/operator_overload_runme.2.d2
-rw-r--r--Examples/test-suite/director_nspace.i2
-rw-r--r--Examples/test-suite/director_nspace_director_name_collision.i2
-rw-r--r--Examples/test-suite/enum_forward.i4
-rw-r--r--Examples/test-suite/enum_ignore.i20
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets.i6
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets.stderr1
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets2.i9
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets2.stderr1
-rw-r--r--Examples/test-suite/infinity.i47
-rwxr-xr-xExamples/test-suite/javascript/Makefile.in114
-rw-r--r--Examples/test-suite/javascript/abstract_access_runme.js6
-rw-r--r--Examples/test-suite/javascript/abstract_inherit_runme.js40
-rw-r--r--Examples/test-suite/javascript/abstract_typedef2_runme.js6
-rw-r--r--Examples/test-suite/javascript/abstract_typedef_runme.js8
-rw-r--r--Examples/test-suite/javascript/abstract_virtual_runme.js11
-rw-r--r--Examples/test-suite/javascript/array_member_runme.js22
-rw-r--r--Examples/test-suite/javascript/arrays_global_runme.js18
-rw-r--r--Examples/test-suite/javascript/callback_runme.js30
-rw-r--r--Examples/test-suite/javascript/char_binary_runme.js38
-rw-r--r--Examples/test-suite/javascript/char_strings_runme.js11
-rw-r--r--Examples/test-suite/javascript/class_ignore_runme.js6
-rw-r--r--Examples/test-suite/javascript/class_scope_weird_runme.js6
-rw-r--r--Examples/test-suite/javascript/complextest_runme.js22
-rw-r--r--Examples/test-suite/javascript/constover_runme.js33
-rw-r--r--Examples/test-suite/javascript/constructor_copy_runme.js42
-rw-r--r--Examples/test-suite/javascript/cpp_enum_runme.js28
-rw-r--r--Examples/test-suite/javascript/cpp_namespace_runme.js47
-rw-r--r--Examples/test-suite/javascript/cpp_static_runme.js9
-rw-r--r--Examples/test-suite/javascript/director_alternating_runme.js5
-rw-r--r--Examples/test-suite/javascript/disown_runme.js22
-rw-r--r--Examples/test-suite/javascript/dynamic_cast_runme.js12
-rw-r--r--Examples/test-suite/javascript/empty_runme.js1
-rw-r--r--Examples/test-suite/javascript/enum_template_runme.js8
-rw-r--r--Examples/test-suite/javascript/infinity_runme.js4
-rw-r--r--Examples/test-suite/javascript/namespace_virtual_method_runme.js3
-rw-r--r--Examples/test-suite/javascript/node_template/binding.gyp.in30
-rw-r--r--Examples/test-suite/javascript/node_template/index.js.in1
-rw-r--r--Examples/test-suite/javascript/nspace_extend_runme.js27
-rw-r--r--Examples/test-suite/javascript/nspace_runme.js76
-rw-r--r--Examples/test-suite/javascript/overload_copy_runme.js4
-rw-r--r--Examples/test-suite/javascript/preproc_include_runme.js23
-rw-r--r--Examples/test-suite/javascript/preproc_runme.js14
-rw-r--r--Examples/test-suite/javascript/rename1_runme.js68
-rw-r--r--Examples/test-suite/javascript/rename2_runme.js68
-rw-r--r--Examples/test-suite/javascript/rename3_runme.js68
-rw-r--r--Examples/test-suite/javascript/rename4_runme.js68
-rw-r--r--Examples/test-suite/javascript/rename_scope_runme.js17
-rw-r--r--Examples/test-suite/javascript/rename_simple_runme.js50
-rw-r--r--Examples/test-suite/javascript/ret_by_value_runme.js8
-rw-r--r--Examples/test-suite/javascript/setup_test.sh6
-rw-r--r--Examples/test-suite/javascript/string_simple_runme.js10
-rw-r--r--Examples/test-suite/javascript/struct_value_runme.js11
-rw-r--r--Examples/test-suite/javascript/template_static_runme.js3
-rw-r--r--Examples/test-suite/javascript/typedef_class_runme.js7
-rw-r--r--Examples/test-suite/javascript/typedef_inherit_runme.js23
-rw-r--r--Examples/test-suite/javascript/typedef_scope_runme.js12
-rw-r--r--Examples/test-suite/javascript/typemap_arrays_runme.js5
-rw-r--r--Examples/test-suite/javascript/typemap_delete_runme.js5
-rw-r--r--Examples/test-suite/javascript/typemap_namespace_runme.js7
-rw-r--r--Examples/test-suite/javascript/typemap_ns_using_runme.js4
-rw-r--r--Examples/test-suite/javascript/using1_runme.js4
-rw-r--r--Examples/test-suite/javascript/using2_runme.js4
-rw-r--r--Examples/test-suite/javascript/varargs_runme.js44
-rw-r--r--Examples/test-suite/lua/cpp_basic_runme.lua10
-rw-r--r--Examples/test-suite/lua/operator_overload_runme.lua32
-rw-r--r--Examples/test-suite/nspace.i2
-rw-r--r--Examples/test-suite/nspace_extend.i2
-rw-r--r--Examples/test-suite/operator_overload.i4
-rw-r--r--Examples/test-suite/php/arrays_runme.php1
-rw-r--r--Examples/test-suite/string_simple.i13
254 files changed, 3164 insertions, 177 deletions
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 218d8eca5..01febf575 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -590,6 +590,117 @@ java_clean:
rm -f *.@OBJEXT@ *@JAVASO@
##################################################################
+##### JAVASCRIPT ######
+##################################################################
+
+# Note: These targets are also from within Makefiles in the Example directories.
+# There is a common makefile, 'Examples/javascript/js_example.mk' to simplify
+# create a configuration for a new example.
+
+ROOT_DIR = @ROOT_DIR@
+JSINCLUDES = @JSCOREINC@ @JSV8INC@
+JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@ @JSV8DYNAMICLINKING@
+JSSO =@JSSO@
+JSLDSHARED = @JSLDSHARED@
+JSCXXSHARED = @JSCXXSHARED@
+NODEJS = @NODEJS@
+NODEGYP = @NODEGYP@
+
+# ----------------------------------------------------------------
+# Creating and building Javascript wrappers
+# ----------------------------------------------------------------
+
+javascript_wrapper:
+ $(SWIG) -javascript $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH)
+
+javascript_wrapper_cpp: $(SRCS)
+ $(SWIG) -javascript -c++ $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH)
+
+javascript_build: $(SRCS)
+ $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(JSINCLUDES)
+ $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+
+javascript_build_cpp: $(SRCS)
+ifeq (node,$(JSENGINE))
+ $(NODEGYP) --loglevel=silent configure build 1>>/dev/null
+else
+ $(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(JSINCLUDES)
+ $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+
+endif
+
+# These targets are used by the test-suite:
+
+javascript: $(SRCS) javascript_custom_interpreter
+ $(SWIG) -javascript $(SWIGOPT) $(INTERFACEPATH)
+ifeq (jsc, $(ENGINE))
+ $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(JSINCLUDES)
+ $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+else # (v8 | node) # v8 and node must be compiled as c++
+ $(CXX) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(JSINCLUDES)
+ $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+endif
+
+javascript_cpp: $(SRCS) javascript_custom_interpreter
+ $(SWIG) -javascript -c++ $(SWIGOPT) $(INTERFACEPATH)
+ $(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(JSINCLUDES)
+ $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+
+# -----------------------------------------------------------------
+# Running a Javascript example
+# -----------------------------------------------------------------
+
+javascript_custom_interpreter:
+ (cd $(ROOT_DIR)/Tools/javascript && $(MAKE) JSENGINE='$(JSENGINE)')
+
+ifeq (node,$(JSENGINE))
+javascript_run:
+ $(RUNTOOL) $(NODEJS) $(RUNME).js $(RUNPIPE)
+else
+javascript_run: javascript_custom_interpreter
+ $(RUNTOOL) $(ROOT_DIR)/Tools/javascript/javascript -$(JSENGINE) -L $(TARGET) $(RUNME).js $(RUNPIPE)
+endif
+
+# -----------------------------------------------------------------
+# Version display
+# -----------------------------------------------------------------
+
+javascript_version:
+ifeq (, $(ENGINE))
+ @if [ "$(NODEJS)" != "" ]; then \
+ echo "Node.js: `($(NODEJS) --version)`"; \
+ echo "node-gyp: `($(NODEGYP) --version)`"; \
+ else \
+ echo "Version depends on the interpreter"; \
+ fi
+endif
+ifeq (node, $(ENGINE))
+ echo "Node.js: `($(NODEJS) --version)`"
+ echo "node-gyp: `($(NODEGYP) --version)`"
+endif
+ifeq (jsc, $(ENGINE))
+ @if [ "@JSCOREVERSION@" != "" ]; then \
+ echo "@JSCOREVERSION@"; \
+ else \
+ echo "Unknown JavascriptCore version."; \
+ fi
+endif
+ifeq (v8, $(ENGINE))
+ echo "Unknown v8 version."
+endif
+
+# -----------------------------------------------------------------
+# Cleaning the Javascript examples
+# -----------------------------------------------------------------
+
+javascript_clean:
+ rm -rf build
+ rm -f *_wrap* $(RUNME)
+ rm -f core @EXTRA_CLEAN@
+ rm -f *.@OBJEXT@ *@JSSO@ *.$(SO)
+ (cd $(ROOT_DIR)/Tools/javascript && $(MAKE) -s clean)
+
+##################################################################
##### ANDROID ######
##################################################################
diff --git a/Examples/android/class/Makefile b/Examples/android/class/Makefile
index 6155d9494..cef405ece 100644
--- a/Examples/android/class/Makefile
+++ b/Examples/android/class/Makefile
@@ -5,7 +5,7 @@ INTERFACE = example.i
INTERFACEDIR = jni/
PACKAGEDIR = src/org/swig
PACKAGENAME= org.swig.classexample
-SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/classexample
+SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/classexample
PROJECTNAME= SwigClass
TARGETID = 1
#INSTALLOPTIONS = -s # To install on SD Card
diff --git a/Examples/android/extend/Makefile b/Examples/android/extend/Makefile
index ec53013af..9b796494a 100644
--- a/Examples/android/extend/Makefile
+++ b/Examples/android/extend/Makefile
@@ -5,7 +5,7 @@ INTERFACE = example.i
INTERFACEDIR = jni/
PACKAGEDIR = src/org/swig
PACKAGENAME= org.swig.extendexample
-SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/extendexample
+SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/extendexample
PROJECTNAME= SwigExtend
TARGETID = 1
#INSTALLOPTIONS = -s # To install on SD Card
diff --git a/Examples/chicken/class/Makefile b/Examples/chicken/class/Makefile
index 1436d836f..cd445c867 100644
--- a/Examples/chicken/class/Makefile
+++ b/Examples/chicken/class/Makefile
@@ -1,12 +1,12 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
-SRCS =
+SRCS =
CXXSRCS = example.cxx
TARGET = class
INCLUDE =
SWIGOPT =
-CFLAGS =
+CFLAGS =
VARIANT =
# uncomment the following lines to build a static exe (only pick one of the CHICKEN_MAIN lines)
diff --git a/Examples/chicken/constants/Makefile b/Examples/chicken/constants/Makefile
index 31e39d346..fe396733e 100644
--- a/Examples/chicken/constants/Makefile
+++ b/Examples/chicken/constants/Makefile
@@ -2,12 +2,12 @@ TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS =
-CXXSRCS =
+CXXSRCS =
TARGET = constants
INCLUDE =
-SWIGOPT =
-CFLAGS =
-VARIANT =
+SWIGOPT =
+CFLAGS =
+VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = runme.scm
diff --git a/Examples/chicken/multimap/Makefile b/Examples/chicken/multimap/Makefile
index eba36169d..d92cfede0 100644
--- a/Examples/chicken/multimap/Makefile
+++ b/Examples/chicken/multimap/Makefile
@@ -2,12 +2,12 @@ TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS = example.c
-CXXSRCS =
+CXXSRCS =
TARGET = multimap
INCLUDE =
-SWIGOPT =
-CFLAGS =
-VARIANT =
+SWIGOPT =
+CFLAGS =
+VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = runme.scm
diff --git a/Examples/chicken/overload/Makefile b/Examples/chicken/overload/Makefile
index e15352ec5..fb190e882 100644
--- a/Examples/chicken/overload/Makefile
+++ b/Examples/chicken/overload/Makefile
@@ -1,13 +1,13 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
-SRCS =
+SRCS =
CXXSRCS = example.cxx
TARGET = overload
INCLUDE =
SWIGOPT = -proxy -unhideprimitive
-CFLAGS =
-VARIANT =
+CFLAGS =
+VARIANT =
# uncomment the following lines to build a static exe
#CHICKEN_MAIN = runme.scm
diff --git a/Examples/chicken/simple/Makefile b/Examples/chicken/simple/Makefile
index f8fb006a4..d0d737484 100644
--- a/Examples/chicken/simple/Makefile
+++ b/Examples/chicken/simple/Makefile
@@ -2,12 +2,12 @@ TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS = example.c
-CXXSRCS =
+CXXSRCS =
TARGET = simple
INCLUDE =
-SWIGOPT =
-CFLAGS =
-VARIANT =
+SWIGOPT =
+CFLAGS =
+VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = runme.scm
diff --git a/Examples/go/constants/Makefile b/Examples/go/constants/Makefile
index c232e9ed1..9fa967366 100644
--- a/Examples/go/constants/Makefile
+++ b/Examples/go/constants/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
diff --git a/Examples/go/template/Makefile b/Examples/go/template/Makefile
index 6796348a9..51cd97a80 100644
--- a/Examples/go/template/Makefile
+++ b/Examples/go/template/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
diff --git a/Examples/guile/constants/Makefile b/Examples/guile/constants/Makefile
index d8a3cfebd..2b6965e9e 100644
--- a/Examples/guile/constants/Makefile
+++ b/Examples/guile/constants/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = my-guile
INTERFACE = example.i
diff --git a/Examples/java/constants/Makefile b/Examples/java/constants/Makefile
index 97c5b673c..4e21fc4cd 100644
--- a/Examples/java/constants/Makefile
+++ b/Examples/java/constants/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
diff --git a/Examples/java/native/Makefile b/Examples/java/native/Makefile
index 29d5a082a..e858cbe77 100644
--- a/Examples/java/native/Makefile
+++ b/Examples/java/native/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
diff --git a/Examples/java/template/Makefile b/Examples/java/template/Makefile
index 97c5b673c..4e21fc4cd 100644
--- a/Examples/java/template/Makefile
+++ b/Examples/java/template/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
diff --git a/Examples/java/typemap/Makefile b/Examples/java/typemap/Makefile
index 29d5a082a..e858cbe77 100644
--- a/Examples/java/typemap/Makefile
+++ b/Examples/java/typemap/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
diff --git a/Examples/javascript/check.list b/Examples/javascript/check.list
new file mode 100644
index 000000000..9707e77d4
--- /dev/null
+++ b/Examples/javascript/check.list
@@ -0,0 +1,13 @@
+class
+constant
+enum
+exception
+functor
+nspace
+operator
+overload
+pointer
+#reference
+simple
+template
+variables
diff --git a/Examples/javascript/class/Makefile b/Examples/javascript/class/Makefile
new file mode 100755
index 000000000..31846faae
--- /dev/null
+++ b/Examples/javascript/class/Makefile
@@ -0,0 +1,3 @@
+SRCS = example.cxx
+
+include ../example.mk
diff --git a/Examples/javascript/class/binding.gyp b/Examples/javascript/class/binding.gyp
new file mode 100644
index 000000000..54eebfaa0
--- /dev/null
+++ b/Examples/javascript/class/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example.cxx", "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/class/example.cxx b/Examples/javascript/class/example.cxx
new file mode 100755
index 000000000..e23fa6f73
--- /dev/null
+++ b/Examples/javascript/class/example.cxx
@@ -0,0 +1,28 @@
+/* File : example.c */
+#include <iostream>
+#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/javascript/class/example.h b/Examples/javascript/class/example.h
new file mode 100755
index 000000000..64b7684fa
--- /dev/null
+++ b/Examples/javascript/class/example.h
@@ -0,0 +1,34 @@
+/* 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/javascript/class/example.i b/Examples/javascript/class/example.i
new file mode 100755
index 000000000..75700b305
--- /dev/null
+++ b/Examples/javascript/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/javascript/class/example.js b/Examples/javascript/class/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/class/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/class/runme.js b/Examples/javascript/class/runme.js
new file mode 100755
index 000000000..e1d5d9797
--- /dev/null
+++ b/Examples/javascript/class/runme.js
@@ -0,0 +1,46 @@
+var example = require("./example");
+
+// ----- Object creation -----
+
+console.log("Creating some objects:");
+c = new example.Circle(10);
+console.log("Created circle " + c);
+s = new example.Square(10);
+console.log("Created square " + s);
+
+// ----- Access a static member -----
+console.log("\nA total of " + example.Shape.nshapes + " shapes were created"); // access static member as properties of the class object
+
+// ----- Member data access -----
+// Set the location of the object.
+// Note: methods in the base class Shape are used since
+// x and y are defined there.
+
+c.x = 20;
+c.y = 30;
+s.x = -10;
+s.y = 5;
+
+console.log("\nHere is their new position:");
+console.log("Circle = (" + c.x + "," + c.y + ")");
+console.log("Square = (" + s.x + "," + s.y + ")");
+
+// ----- Call some methods -----
+console.log("\nHere are some properties of the shapes:");
+console.log("Circle:");
+console.log("area = " + c.area() + "");
+console.log("perimeter = " + c.perimeter() + "");
+console.log("\n");
+console.log("Square:");
+console.log("area = " + s.area() + "");
+console.log("perimeter = " + s.perimeter() + "");
+
+// ----- Delete everything -----
+console.log("\nGuess I'll clean up now");
+// Note: this invokes the virtual destructor
+delete c;
+delete s;
+
+console.log(example.Shape.nshapes + " shapes remain");
+
+console.log("Goodbye");
diff --git a/Examples/javascript/constant/Makefile b/Examples/javascript/constant/Makefile
new file mode 100755
index 000000000..ea04c7df8
--- /dev/null
+++ b/Examples/javascript/constant/Makefile
@@ -0,0 +1,3 @@
+SRCS =
+
+include ../example.mk
diff --git a/Examples/javascript/constant/binding.gyp b/Examples/javascript/constant/binding.gyp
new file mode 100644
index 000000000..69af46b22
--- /dev/null
+++ b/Examples/javascript/constant/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/constant/example.h b/Examples/javascript/constant/example.h
new file mode 100644
index 000000000..2c88ebd1e
--- /dev/null
+++ b/Examples/javascript/constant/example.h
@@ -0,0 +1,8 @@
+#define ICONST 42
+#define FCONST 2.1828
+#define CCONST 'x'
+#define CCONST2 '\n'
+#define SCONST "Hello World"
+#define SCONST2 "\"Hello World\""
+#define EXTERN extern
+#define FOO (ICONST + BAR)
diff --git a/Examples/javascript/constant/example.i b/Examples/javascript/constant/example.i
new file mode 100755
index 000000000..a6d28e7c9
--- /dev/null
+++ b/Examples/javascript/constant/example.i
@@ -0,0 +1,24 @@
+/* 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/javascript/constant/example.js b/Examples/javascript/constant/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/constant/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/constant/runme.js b/Examples/javascript/constant/runme.js
new file mode 100755
index 000000000..f4b55881e
--- /dev/null
+++ b/Examples/javascript/constant/runme.js
@@ -0,0 +1,14 @@
+var example = require("./example");
+
+console.log("ICONST = " + example.ICONST + " (should be 42)");
+console.log("FCONST = " + example.FCONST + " (should be 2.1828)");
+console.log("CCONST = " + example.CCONST + " (should be 'x')");
+console.log("CCONST2 = " + example.CCONST2 + " (this should be on a new line)");
+console.log("SCONST = " + example.SCONST + " (should be 'Hello World')");
+console.log("SCONST2 = " + example.SCONST2 + " (should be '\"Hello World\"')");
+console.log("EXPR = " + example.EXPR + " (should be 48.5484)");
+console.log("iconst = " + example.iconst + " (should be 37)");
+console.log("fconst = " + example.fconst + " (should be 3.14)");
+
+console.log("EXTERN = " + example.EXTERN + " (should be undefined)");
+console.log("FOO = " + example.FOO + " (should be undefined)");
diff --git a/Examples/javascript/enum/Makefile b/Examples/javascript/enum/Makefile
new file mode 100755
index 000000000..31846faae
--- /dev/null
+++ b/Examples/javascript/enum/Makefile
@@ -0,0 +1,3 @@
+SRCS = example.cxx
+
+include ../example.mk
diff --git a/Examples/javascript/enum/binding.gyp b/Examples/javascript/enum/binding.gyp
new file mode 100644
index 000000000..54eebfaa0
--- /dev/null
+++ b/Examples/javascript/enum/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example.cxx", "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/enum/example.cxx b/Examples/javascript/enum/example.cxx
new file mode 100755
index 000000000..6785e57ac
--- /dev/null
+++ b/Examples/javascript/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/javascript/enum/example.h b/Examples/javascript/enum/example.h
new file mode 100755
index 000000000..9119cd9fc
--- /dev/null
+++ b/Examples/javascript/enum/example.h
@@ -0,0 +1,13 @@
+/* File : example.h */
+
+enum color { RED, BLUE, GREEN };
+
+class Foo {
+ public:
+ Foo() { }
+ enum speed { IMPULSE=10, WARP=20, LUDICROUS=30 };
+ void enum_test(speed s);
+};
+
+void enum_test(color c, Foo::speed s);
+
diff --git a/Examples/javascript/enum/example.i b/Examples/javascript/enum/example.i
new file mode 100755
index 000000000..23ee8a822
--- /dev/null
+++ b/Examples/javascript/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/javascript/enum/example.js b/Examples/javascript/enum/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/enum/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/enum/runme.js b/Examples/javascript/enum/runme.js
new file mode 100755
index 000000000..d4e89e8c8
--- /dev/null
+++ b/Examples/javascript/enum/runme.js
@@ -0,0 +1,34 @@
+var example = require("./example");
+
+// ----- Object creation -----
+
+// Print out the value of some enums
+console.log("*** color ***");
+console.log(" RED =" + example.RED);
+console.log(" BLUE =" + example.BLUE);
+console.log(" GREEN =" + example.GREEN);
+
+console.log("\n*** Foo::speed ***");
+console.log(" Foo_IMPULSE =" + example.Foo.IMPULSE);
+console.log(" Foo_WARP =" + example.Foo.WARP);
+console.log(" Foo_LUDICROUS =" + example.Foo.LUDICROUS);
+
+console.log("\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);
+
+console.log("\nTesting use of enum with class method");
+f = new example.Foo();
+
+f.enum_test(example.Foo.IMPULSE);
+f.enum_test(example.Foo.WARP);
+f.enum_test(example.Foo.LUDICROUS);
+
+// enum value BLUE of enum color is accessed as property of cconst
+console.log("example.BLUE= " + example.BLUE);
+
+// enum value LUDICROUS of enum Foo::speed is accessed as as property of cconst
+console.log("example.speed.LUDICROUS= " + example.Foo.LUDICROUS);
diff --git a/Examples/javascript/example.mk b/Examples/javascript/example.mk
new file mode 100644
index 000000000..274eff1a3
--- /dev/null
+++ b/Examples/javascript/example.mk
@@ -0,0 +1,27 @@
+# Note: as a convention an example must be in a child directory of this.
+# These paths are relative to such an example directory
+
+ifneq (, $(ENGINE))
+ JSENGINE=$(ENGINE)
+else
+ JSENGINE=node
+endif
+
+EXAMPLES_TOP=../..
+SWIG_TOP=../../..
+SWIG = $(SWIG_TOP)/preinst-swig
+TARGET = example
+INTERFACE = example.i
+SWIGOPT=-$(JSENGINE)
+
+check: build
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile JSENGINE='$(JSENGINE)' TARGET='$(TARGET)' javascript_run
+
+build:
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_wrapper_cpp
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' JSENGINE='$(JSENGINE)' javascript_build_cpp
+
+clean:
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile javascript_clean
diff --git a/Examples/javascript/exception/Makefile b/Examples/javascript/exception/Makefile
new file mode 100755
index 000000000..31846faae
--- /dev/null
+++ b/Examples/javascript/exception/Makefile
@@ -0,0 +1,3 @@
+SRCS = example.cxx
+
+include ../example.mk
diff --git a/Examples/javascript/exception/binding.gyp b/Examples/javascript/exception/binding.gyp
new file mode 100644
index 000000000..2be0a17a2
--- /dev/null
+++ b/Examples/javascript/exception/binding.gyp
@@ -0,0 +1,29 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example.cxx", "example_wrap.cxx" ],
+ 'defines': [
+ 'BUILDING_NODE_EXTENSION=1',
+ ],
+ 'conditions': [
+ ['OS=="mac"',
+ {
+ 'xcode_settings': {
+ 'GCC_ENABLE_CPP_RTTI': 'YES',
+ 'GCC_ENABLE_CPP_EXCEPTIONS' : 'YES'
+ }
+ }
+ ],
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"',
+ {
+ 'cflags': [ "-Wno-unused-variable", "-Wno-unused-but-set-variable", "-Wno-unused-but-set-parameter"],
+ 'cflags_cc': [ "-Wno-unused-variable", "-Wno-unused-but-set-variable", "-Wno-unused-but-set-parameter"],
+ 'cflags!': [ '-fno-exceptions' ],
+ 'cflags_cc!': [ '-fno-exceptions', '-fno-rtti' ]
+ }
+ ]
+ ]
+ }
+ ]
+}
diff --git a/Examples/javascript/exception/example.cxx b/Examples/javascript/exception/example.cxx
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/Examples/javascript/exception/example.cxx
@@ -0,0 +1 @@
+
diff --git a/Examples/javascript/exception/example.h b/Examples/javascript/exception/example.h
new file mode 100644
index 000000000..7cf917d01
--- /dev/null
+++ b/Examples/javascript/exception/example.h
@@ -0,0 +1,53 @@
+/* File : example.h */
+
+#include <string.h>
+#ifndef SWIG
+struct A {
+};
+#endif
+
+class Exc {
+public:
+ Exc(int c, const char *m) {
+ code = c;
+ strncpy(msg,m,256);
+ }
+ int code;
+ char msg[256];
+};
+
+#if defined(_MSC_VER)
+ #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+#endif
+
+class Test {
+public:
+ int simple() throw(int) {
+ throw(37);
+ return 1;
+ }
+ int message() throw(const char *) {
+ throw("I died.");
+ return 1;
+ }
+ int hosed() throw(Exc) {
+ throw(Exc(42,"Hosed"));
+ return 1;
+ }
+ int unknown() throw(A*) {
+ static A a;
+ throw &a;
+ return 1;
+ }
+ int multi(int x) throw(int, const char *, Exc) {
+ if (x == 1) throw(37);
+ if (x == 2) throw("Bleah!");
+ if (x == 3) throw(Exc(42,"No-go-diggy-die"));
+ return 1;
+ }
+};
+
+#if defined(_MSC_VER)
+ #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+#endif
+
diff --git a/Examples/javascript/exception/example.i b/Examples/javascript/exception/example.i
new file mode 100644
index 000000000..08672c3a8
--- /dev/null
+++ b/Examples/javascript/exception/example.i
@@ -0,0 +1,12 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+%include "std_string.i"
+
+/* Let's just grab the original header file here */
+%include "example.h"
+
diff --git a/Examples/javascript/exception/example.js b/Examples/javascript/exception/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/exception/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/exception/runme.js b/Examples/javascript/exception/runme.js
new file mode 100644
index 000000000..977f51ebc
--- /dev/null
+++ b/Examples/javascript/exception/runme.js
@@ -0,0 +1,64 @@
+var example = require("./example");
+
+console.log("Trying to catch some exceptions.");
+t = new example.Test();
+try{
+ t.unknown();
+ throw -1;
+} catch(error)
+{
+ if(error == -1) {
+ console.log("t.unknown() didn't throw");
+ } else {
+ console.log("successfully catched throw in Test::unknown().");
+ }
+}
+
+try{
+ t.simple();
+ throw -1;
+}
+catch(error){
+ if(error == -1) {
+ console.log("t.simple() did not throw");
+ } else {
+ console.log("successfully catched throw in Test::simple().");
+ }
+}
+
+try{
+ t.message();
+ throw -1;
+} catch(error){
+ if(error == -1) {
+ console.log("t.message() did not throw");
+ } else {
+ console.log("successfully catched throw in Test::message().");
+ }
+}
+
+try{
+ t.hosed();
+ throw -1;
+}
+catch(error){
+ if(error == -1) {
+ console.log("t.hosed() did not throw");
+ } else {
+ console.log("successfully catched throw in Test::hosed().");
+ }
+}
+
+for (var i=1; i<4; i++) {
+ try{
+ t.multi(i);
+ throw -1;
+ }
+ catch(error){
+ if(error == -1) {
+ console.log("t.multi(" + i + ") did not throw");
+ } else {
+ console.log("successfully catched throw in Test::multi().");
+ }
+ }
+}
diff --git a/Examples/javascript/functor/Makefile b/Examples/javascript/functor/Makefile
new file mode 100755
index 000000000..31846faae
--- /dev/null
+++ b/Examples/javascript/functor/Makefile
@@ -0,0 +1,3 @@
+SRCS = example.cxx
+
+include ../example.mk
diff --git a/Examples/javascript/functor/binding.gyp b/Examples/javascript/functor/binding.gyp
new file mode 100644
index 000000000..54eebfaa0
--- /dev/null
+++ b/Examples/javascript/functor/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example.cxx", "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/functor/example.cxx b/Examples/javascript/functor/example.cxx
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Examples/javascript/functor/example.cxx
diff --git a/Examples/javascript/functor/example.i b/Examples/javascript/functor/example.i
new file mode 100644
index 000000000..0450c2124
--- /dev/null
+++ b/Examples/javascript/functor/example.i
@@ -0,0 +1,25 @@
+/* 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(call) *::operator(); // the fn call operator
+
+// Instantiate a few versions
+%template(intSum) Sum<int>;
+%template(doubleSum) Sum<double>;
+
+
+
+
diff --git a/Examples/javascript/functor/example.js b/Examples/javascript/functor/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/functor/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/functor/runme.js b/Examples/javascript/functor/runme.js
new file mode 100644
index 000000000..dc12470f4
--- /dev/null
+++ b/Examples/javascript/functor/runme.js
@@ -0,0 +1,15 @@
+var example = require("./example");
+
+a = new example.intSum(0);
+b = new example.doubleSum(100.0);
+
+// Use the objects. They should be callable just like a normal
+// javascript function.
+
+for (i=1;i<=100;i++)
+ a.call(i); // Note: function call
+ b.call(Math.sqrt(i)); // Note: function call
+
+console.log(a.result());
+console.log(b.result());
+
diff --git a/Examples/javascript/nspace/Makefile b/Examples/javascript/nspace/Makefile
new file mode 100755
index 000000000..ea04c7df8
--- /dev/null
+++ b/Examples/javascript/nspace/Makefile
@@ -0,0 +1,3 @@
+SRCS =
+
+include ../example.mk
diff --git a/Examples/javascript/nspace/binding.gyp b/Examples/javascript/nspace/binding.gyp
new file mode 100644
index 000000000..69af46b22
--- /dev/null
+++ b/Examples/javascript/nspace/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/nspace/example.h b/Examples/javascript/nspace/example.h
new file mode 100644
index 000000000..53066980a
--- /dev/null
+++ b/Examples/javascript/nspace/example.h
@@ -0,0 +1,23 @@
+#ifndef _example_guardian_
+#define _example_guardian_
+
+int module_function() { return 7; }
+int module_variable = 9;
+
+namespace MyWorld {
+ class World {
+ public:
+ World() : world_max_count(9) {}
+ int create_world() { return 17; }
+ const int world_max_count; // = 9
+ };
+ namespace Nested {
+ class Dweller {
+ public:
+ enum Gender { MALE = 0, FEMALE = 1 };
+ static int count() { return 19; }
+ };
+ }
+}
+
+#endif
diff --git a/Examples/javascript/nspace/example.i b/Examples/javascript/nspace/example.i
new file mode 100644
index 000000000..c30f87fec
--- /dev/null
+++ b/Examples/javascript/nspace/example.i
@@ -0,0 +1,10 @@
+%module example
+
+%{
+#include "example.h"
+%}
+
+%nspace MyWorld::Nested::Dweller;
+%nspace MyWorld::World;
+
+%include "example.h"
diff --git a/Examples/javascript/nspace/example.js b/Examples/javascript/nspace/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/nspace/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/nspace/runme.js b/Examples/javascript/nspace/runme.js
new file mode 100644
index 000000000..d6a49d8d4
--- /dev/null
+++ b/Examples/javascript/nspace/runme.js
@@ -0,0 +1,50 @@
+// File: runme.js
+
+// This file illustrates class C++ interface generated
+// by SWIG.
+
+var example = require("./example");
+
+// Calling a module function ( aka global function )
+if (example.module_function() !== 7) {
+ throw new Error("example.module_function() should equal 7");
+}
+console.log("example.module_function(): " + example.module_function());
+
+// Accessing a module (aka global) variable
+if (example.module_variable !== 9) {
+ throw new Error("example.module_variable should equal 9");
+}
+console.log("example.module_variable: " + example.module_variable);
+
+// Creating an instance of the class
+var w1 = new example.MyWorld.World();
+console.log("Creating class instance: w1 = new example.MyWorld.World(): " + w1);
+
+// Accessing class members
+if (w1.create_world() !== 17) {
+ throw new Error("w1.create_world() should equal 17");
+}
+console.log("w1.create_world() = " + w1.create_world());
+
+if (w1.world_max_count !== 9) {
+ throw new Error("w1.world_max_count should equal 9");
+}
+console.log("w1.world_max_count = " + w1.world_max_count);
+
+// Accessing enums from class within namespace
+if (example.MyWorld.Nested.Dweller.MALE !== 0) {
+ throw new Error("example.MyWorld.Nested.Dweller.MALE should equal 0");
+}
+console.log("Accessing enums: ex.MyWorld.Nested.Dweller.MALE = " + example.MyWorld.Nested.Dweller.MALE);
+
+if (example.MyWorld.Nested.Dweller.FEMALE !== 1) {
+ throw new Error("example.MyWorld.Nested.Dweller.FEMALE should equal 1");
+}
+console.log("Accessing enums: ex.MyWorld.Nested.Dweller.FEMALE = " + example.MyWorld.Nested.Dweller.FEMALE);
+
+// Accessing static member function
+if (example.MyWorld.Nested.Dweller.count() !== 19) {
+ throw new Error("example.MyWorld.Nested.Dweller.count() should equal 19");
+}
+console.log("Accessing static member function: ex.MyWorld.Nested.Dweller.count() = " + example.MyWorld.Nested.Dweller.count());
diff --git a/Examples/javascript/operator/Makefile b/Examples/javascript/operator/Makefile
new file mode 100755
index 000000000..ea04c7df8
--- /dev/null
+++ b/Examples/javascript/operator/Makefile
@@ -0,0 +1,3 @@
+SRCS =
+
+include ../example.mk
diff --git a/Examples/javascript/operator/binding.gyp b/Examples/javascript/operator/binding.gyp
new file mode 100644
index 000000000..69af46b22
--- /dev/null
+++ b/Examples/javascript/operator/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/operator/example.h b/Examples/javascript/operator/example.h
new file mode 100644
index 000000000..4da6a2307
--- /dev/null
+++ b/Examples/javascript/operator/example.h
@@ -0,0 +1,36 @@
+/* File : example.h */
+#include <math.h>
+
+class Complex {
+private:
+ double rpart, ipart;
+public:
+ Complex(double r = 0, double i = 0) : rpart(r), ipart(i) { }
+ Complex(const Complex &c) : rpart(c.rpart), ipart(c.ipart) { }
+ Complex &operator=(const Complex &c) {
+ rpart = c.rpart;
+ ipart = c.ipart;
+ return *this;
+ }
+ Complex operator+(const Complex &c) const {
+ return Complex(rpart+c.rpart, ipart+c.ipart);
+ }
+ Complex operator-(const Complex &c) const {
+ return Complex(rpart-c.rpart, ipart-c.ipart);
+ }
+ Complex operator*(const Complex &c) const {
+ return Complex(rpart*c.rpart - ipart*c.ipart,
+ rpart*c.ipart + c.rpart*ipart);
+ }
+ Complex operator-() const {
+ return Complex(-rpart, -ipart);
+ }
+
+ double re() const { return rpart; }
+ double im() const { return ipart; }
+};
+
+
+
+
+
diff --git a/Examples/javascript/operator/example.i b/Examples/javascript/operator/example.i
new file mode 100644
index 000000000..7a1bd45e1
--- /dev/null
+++ b/Examples/javascript/operator/example.i
@@ -0,0 +1,34 @@
+/* File : example.i */
+%module example
+#pragma SWIG nowarn=SWIGWARN_IGNORE_OPERATOR_EQ
+%{
+#include "example.h"
+%}
+
+/* This header file is a little tough to handle because it has overloaded
+ operators and constructors. We're going to try and deal with that here */
+
+/* This turns the copy constructor in a function ComplexCopy() that can
+ be called */
+
+%rename(assign) Complex::operator=;
+%rename(plus) Complex::operator+;
+%rename(minus) Complex::operator-(const Complex &) const;
+%rename(uminus) Complex::operator-() const;
+%rename(times) Complex::operator*;
+
+/* Now grab the original header file */
+%include "example.h"
+
+/* An output method that turns a complex into a short string */
+%extend Complex {
+ char *toString() {
+ static char temp[512];
+ sprintf(temp,"(%g,%g)", $self->re(), $self->im());
+ return temp;
+ }
+ static Complex* copy(const Complex& c) {
+ return new Complex(c);
+ }
+};
+
diff --git a/Examples/javascript/operator/example.js b/Examples/javascript/operator/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/operator/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/operator/runme.js b/Examples/javascript/operator/runme.js
new file mode 100644
index 000000000..a700918d6
--- /dev/null
+++ b/Examples/javascript/operator/runme.js
@@ -0,0 +1,25 @@
+var example = require("./example");
+
+a = new example.Complex(2,3);
+b = new example.Complex(-5,10);
+
+console.log ("a =" + a);
+console.log ("b =" + b);
+
+c = a.plus(b);
+
+console.log("c =" + c);
+console.log("a*b =" + a.times(b));
+console.log("a-c =" + a.minus(c));
+
+e = example.Complex.copy(a.minus(c));
+console.log("e =" + e);
+
+// Big expression
+f = a.plus(b).times(c.plus(b.times(e))).plus(a.uminus());
+console.log("f =" + f);
+
+
+
+
+
diff --git a/Examples/javascript/overload/Makefile b/Examples/javascript/overload/Makefile
new file mode 100755
index 000000000..ea04c7df8
--- /dev/null
+++ b/Examples/javascript/overload/Makefile
@@ -0,0 +1,3 @@
+SRCS =
+
+include ../example.mk
diff --git a/Examples/javascript/overload/binding.gyp b/Examples/javascript/overload/binding.gyp
new file mode 100644
index 000000000..69af46b22
--- /dev/null
+++ b/Examples/javascript/overload/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/overload/example.h b/Examples/javascript/overload/example.h
new file mode 100644
index 000000000..2f112f1e1
--- /dev/null
+++ b/Examples/javascript/overload/example.h
@@ -0,0 +1,28 @@
+#include <iostream>
+
+void f() {
+ std::cout << "Called f()." << std::endl;
+}
+
+void f(int val) {
+ std::cout << "Called f(int)." << std::endl;
+}
+void f(int val1, int val2) {
+ std::cout << "Called f(int, int)." << std::endl;
+}
+
+void f(const char* s) {
+ std::cout << "Called f(const char*)." << std::endl;
+}
+
+void f(bool val) {
+ std::cout << "Called f(bool)." << std::endl;
+}
+
+void f(long val) {
+ std::cout << "Called f(long)." << std::endl;
+}
+
+void f(double val) {
+ std::cout << "Called f(double)." << std::endl;
+}
diff --git a/Examples/javascript/overload/example.i b/Examples/javascript/overload/example.i
new file mode 100644
index 000000000..b86689f8a
--- /dev/null
+++ b/Examples/javascript/overload/example.i
@@ -0,0 +1,16 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/*
+ Note: overloading is implemented in a sloppy way currently
+ i.e., only the number of arguments is taken into conideration
+ for dispatching.
+ To solve the problem one has to rename such conflicting methods.
+*/
+%rename(f_double) f(double val);
+
+%include "example.h"
diff --git a/Examples/javascript/overload/example.js b/Examples/javascript/overload/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/overload/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/overload/runme.js b/Examples/javascript/overload/runme.js
new file mode 100644
index 000000000..1e6c861a6
--- /dev/null
+++ b/Examples/javascript/overload/runme.js
@@ -0,0 +1,9 @@
+var example = require("./example");
+
+example.f();
+example.f(1);
+example.f(1, 2);
+example.f("bla");
+example.f(false);
+example.f(11111111111);
+example.f_double(1.0);
diff --git a/Examples/javascript/pointer/Makefile b/Examples/javascript/pointer/Makefile
new file mode 100755
index 000000000..31846faae
--- /dev/null
+++ b/Examples/javascript/pointer/Makefile
@@ -0,0 +1,3 @@
+SRCS = example.cxx
+
+include ../example.mk
diff --git a/Examples/javascript/pointer/binding.gyp b/Examples/javascript/pointer/binding.gyp
new file mode 100644
index 000000000..54eebfaa0
--- /dev/null
+++ b/Examples/javascript/pointer/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example.cxx", "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/pointer/example.cxx b/Examples/javascript/pointer/example.cxx
new file mode 100755
index 000000000..8762329fe
--- /dev/null
+++ b/Examples/javascript/pointer/example.cxx
@@ -0,0 +1,16 @@
+/* File : example.c */
+
+void add(int *x, int *y, int *result) {
+ *result = *x + *y;
+}
+
+void subtract(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/javascript/pointer/example.i b/Examples/javascript/pointer/example.i
new file mode 100755
index 000000000..38c67d7d2
--- /dev/null
+++ b/Examples/javascript/pointer/example.i
@@ -0,0 +1,30 @@
+/* File : example.i */
+%module example
+
+%{
+extern void add(int *, int *, int *);
+extern void subtract(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 subtract(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/javascript/pointer/example.js b/Examples/javascript/pointer/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/pointer/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/pointer/runme.js b/Examples/javascript/pointer/runme.js
new file mode 100755
index 000000000..fb8cf0c74
--- /dev/null
+++ b/Examples/javascript/pointer/runme.js
@@ -0,0 +1,35 @@
+var example = require("./example");
+
+// First create some objects using the pointer library.
+console.log("Testing the pointer library");
+a = example.new_intp();
+b = example.new_intp();
+c = example.new_intp();
+
+example.intp_assign(a,37);
+example.intp_assign(b,42);
+
+console.log(" a = " + example.intp_value(a));
+console.log(" b = " + example.intp_value(b));
+console.log(" c = " + example.intp_value(c));
+
+//// Call the add() function with some pointers
+example.add(a, b, c);
+
+//
+//// Now get the result
+r = example.intp_value(c);
+console.log(" 37 + 42 = " + 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.
+//"OUTPUT" Mapping is not supported
+//console.log("Trying the typemap library");
+//r = example.subtract(37,42);
+//console.log("37 - 42 =" + r);
diff --git a/Examples/javascript/pointer/typemaps.i b/Examples/javascript/pointer/typemaps.i
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Examples/javascript/pointer/typemaps.i
diff --git a/Examples/javascript/reference/Makefile b/Examples/javascript/reference/Makefile
new file mode 100755
index 000000000..31846faae
--- /dev/null
+++ b/Examples/javascript/reference/Makefile
@@ -0,0 +1,3 @@
+SRCS = example.cxx
+
+include ../example.mk
diff --git a/Examples/javascript/reference/binding.gyp b/Examples/javascript/reference/binding.gyp
new file mode 100644
index 000000000..54eebfaa0
--- /dev/null
+++ b/Examples/javascript/reference/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example.cxx", "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/reference/example.cxx b/Examples/javascript/reference/example.cxx
new file mode 100755
index 000000000..8a513bf49
--- /dev/null
+++ b/Examples/javascript/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/javascript/reference/example.h b/Examples/javascript/reference/example.h
new file mode 100755
index 000000000..4915adb1b
--- /dev/null
+++ b/Examples/javascript/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/javascript/reference/example.i b/Examples/javascript/reference/example.i
new file mode 100755
index 000000000..1cf19c82c
--- /dev/null
+++ b/Examples/javascript/reference/example.i
@@ -0,0 +1,42 @@
+/* File : example.i */
+
+/* This file has a few "typical" uses of C++ references. */
+
+%module example
+
+%{
+#include "example.h"
+%}
+
+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/javascript/reference/example.js b/Examples/javascript/reference/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/reference/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/reference/runme.js b/Examples/javascript/reference/runme.js
new file mode 100755
index 000000000..88c108314
--- /dev/null
+++ b/Examples/javascript/reference/runme.js
@@ -0,0 +1,67 @@
+// This file illustrates the manipulation of C++ references in Javascript.
+var example = require("./example");
+
+// ----- Object creation -----
+
+console.log("Creating some objects:");
+a = new example.Vector(3,4,5);
+b = new example.Vector(10,11,12);
+
+console.log(" created" + a.print());
+console.log(" created" + b.print());
+
+// ----- Call an overloaded operator -----
+
+// This calls the wrapper we placed around operator+(const Vector &a, const Vector &)
+// It returns a new allocated object.
+
+console.log("Adding a+b");
+c = example.addv(a, b);
+console.log("a+b = " + c.print());
+
+
+// TODO: Note: Unless we free the result, a memory leak will occur
+//delete_Vector(c);
+
+// ----- Create a vector array -----
+
+// Note: Using the high-level interface here
+console.log("Creating an array of vectors");
+va = new example.VectorArray(10);
+console.log("va = " + va);
+
+// ----- 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);
+
+// This will work, but it will cause a memory leak!
+va.set(2,example.addv(a,b));
+
+// The non-leaky way to do it
+//c = addv(a,b);
+//va.set(3,c);
+//delete_Vector(c);
+
+// Get some values from the array
+
+console.log("Getting some array values");
+for (i = 0; i < 5; i++) {
+ temp = va.get(i);
+ console.log(i,temp.print());
+}
+
+// Watch under resource meter to check on this
+console.log("Making sure we don't leak memory.");
+for (i = 0; i < 1000000; i++) {
+ c = va.get(i % 10);
+}
+//---------TODO---------
+//----- Clean up -----
+//console.log("Cleaning up");
+
+//example.delete_VectorArray(va);
+//example.delete_Vector(a);
+//example.delete_Vector(b);
+
diff --git a/Examples/javascript/simple/Makefile b/Examples/javascript/simple/Makefile
new file mode 100755
index 000000000..31846faae
--- /dev/null
+++ b/Examples/javascript/simple/Makefile
@@ -0,0 +1,3 @@
+SRCS = example.cxx
+
+include ../example.mk
diff --git a/Examples/javascript/simple/binding.gyp b/Examples/javascript/simple/binding.gyp
new file mode 100644
index 000000000..54eebfaa0
--- /dev/null
+++ b/Examples/javascript/simple/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example.cxx", "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/simple/example.cxx b/Examples/javascript/simple/example.cxx
new file mode 100644
index 000000000..1c2af789c
--- /dev/null
+++ b/Examples/javascript/simple/example.cxx
@@ -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/javascript/simple/example.i b/Examples/javascript/simple/example.i
new file mode 100644
index 000000000..24093b9bf
--- /dev/null
+++ b/Examples/javascript/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/javascript/simple/example.js b/Examples/javascript/simple/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/simple/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/simple/runme.js b/Examples/javascript/simple/runme.js
new file mode 100755
index 000000000..be2c18669
--- /dev/null
+++ b/Examples/javascript/simple/runme.js
@@ -0,0 +1,26 @@
+var example = require("./example");
+
+/* Call our gcd() function */
+
+x = 42;
+y = 105;
+g = example.gcd(x,y);
+console.log("GCD of x and y is=" + g);
+
+/* Manipulate the Foo global variable */
+
+/* Output its current value */
+console.log("Global variable Foo=" + example.Foo);
+
+/* Change its value */
+example.Foo = 3.1415926;
+
+/* See if the change took effect */
+console.log("Variable Foo changed to=" + example.Foo);
+
+
+
+
+
+
+
diff --git a/Examples/javascript/template/Makefile b/Examples/javascript/template/Makefile
new file mode 100755
index 000000000..ea04c7df8
--- /dev/null
+++ b/Examples/javascript/template/Makefile
@@ -0,0 +1,3 @@
+SRCS =
+
+include ../example.mk
diff --git a/Examples/javascript/template/binding.gyp b/Examples/javascript/template/binding.gyp
new file mode 100644
index 000000000..69af46b22
--- /dev/null
+++ b/Examples/javascript/template/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/template/example.h b/Examples/javascript/template/example.h
new file mode 100644
index 000000000..7401df650
--- /dev/null
+++ b/Examples/javascript/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/javascript/template/example.i b/Examples/javascript/template/example.i
new file mode 100644
index 000000000..8f94c4da1
--- /dev/null
+++ b/Examples/javascript/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/javascript/template/example.js b/Examples/javascript/template/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/template/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/template/runme.js b/Examples/javascript/template/runme.js
new file mode 100644
index 000000000..55894dfd5
--- /dev/null
+++ b/Examples/javascript/template/runme.js
@@ -0,0 +1,30 @@
+var example = require("./example");
+
+//Call some templated functions
+console.log(example.maxint(3,7));
+console.log(example.maxdouble(3.14,2.18));
+
+// Create some class
+
+iv = new example.vecint(100);
+dv = new example.vecdouble(1000);
+
+for(i=0;i<=100;i++)
+ iv.setitem(i,2*i);
+
+for(i=0;i<=1000;i++)
+ dv.setitem(i, 1.0/(i+1));
+
+sum = 0;
+for(i=0;i<=100;i++)
+ sum = sum + iv.getitem(i);
+
+console.log(sum);
+
+sum = 0.0;
+for(i=0;i<=1000;i++)
+ sum = sum + dv.getitem(i);
+console.log(sum);
+
+delete iv;
+delete dv;
diff --git a/Examples/javascript/variables/Makefile b/Examples/javascript/variables/Makefile
new file mode 100755
index 000000000..31846faae
--- /dev/null
+++ b/Examples/javascript/variables/Makefile
@@ -0,0 +1,3 @@
+SRCS = example.cxx
+
+include ../example.mk
diff --git a/Examples/javascript/variables/binding.gyp b/Examples/javascript/variables/binding.gyp
new file mode 100644
index 000000000..54eebfaa0
--- /dev/null
+++ b/Examples/javascript/variables/binding.gyp
@@ -0,0 +1,8 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example.cxx", "example_wrap.cxx" ]
+ }
+ ]
+}
diff --git a/Examples/javascript/variables/example.cxx b/Examples/javascript/variables/example.cxx
new file mode 100755
index 000000000..f10390a9e
--- /dev/null
+++ b/Examples/javascript/variables/example.cxx
@@ -0,0 +1,96 @@
+/* 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;
+#ifdef __cplusplus // Note: for v8 this must be linkable with g++, without extern cstrvar is mangled
+extern const char cstrvar[] = "Goodbye";
+#else
+const char cstrvar[] = "Goodbye";
+#endif
+const
+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);
+ 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/javascript/variables/example.h b/Examples/javascript/variables/example.h
new file mode 100755
index 000000000..0f7e89594
--- /dev/null
+++ b/Examples/javascript/variables/example.h
@@ -0,0 +1,6 @@
+/* File: example.h */
+
+typedef struct {
+ int x,y;
+} Point;
+
diff --git a/Examples/javascript/variables/example.i b/Examples/javascript/variables/example.i
new file mode 100755
index 000000000..591b871ed
--- /dev/null
+++ b/Examples/javascript/variables/example.i
@@ -0,0 +1,49 @@
+/* File : example.i */
+%module example
+%{
+#include "example.h"
+%}
+
+/* Some global variable declarations */
+%inline %{
+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/javascript/variables/example.js b/Examples/javascript/variables/example.js
new file mode 100644
index 000000000..79cd3913f
--- /dev/null
+++ b/Examples/javascript/variables/example.js
@@ -0,0 +1 @@
+module.exports = require("./build/Release/example");
diff --git a/Examples/javascript/variables/runme.js b/Examples/javascript/variables/runme.js
new file mode 100755
index 000000000..537e17296
--- /dev/null
+++ b/Examples/javascript/variables/runme.js
@@ -0,0 +1,68 @@
+var example = require("./example");
+
+// Try to set the values of some global variables
+example.ivar = 42;
+example.svar = -31000;
+example.lvar = 65537;
+example.uivar = 123456;
+example.usvar = 61000;
+example.ulvar = 654321;
+example.scvar = -13;
+example.ucvar = 251;
+example.cvar = "S";
+example.fvar = 3.14159;
+example.dvar = 2.1828;
+example.strvar = "Hello World";
+example.iptrvar= example.new_int(37);
+example.ptptr = example.new_Point(37,42);
+example.name = "Bill";
+
+// Now console.log out the values of the variables
+console.log("Variables (values printed from Javascript)");
+console.log("ivar = " + example.ivar);
+console.log("svar = " + example.svar);
+console.log("lvar = " + example.lvar);
+console.log("uivar = " + example.uivar);
+console.log("usvar = " + example.usvar);
+console.log("ulvar = " + example.ulvar);
+console.log("scvar = " + example.scvar);
+console.log("ucvar = " + example.ucvar);
+console.log("fvar = " + example.fvar);
+console.log("dvar = " + example.dvar);
+console.log("cvar = " + example.cvar);
+console.log("strvar = " + example.strvar);
+console.log("cstrvar = " + example.cstrvar);
+console.log("iptrvar = " + example.iptrvar);
+console.log("name = " + example.name);
+console.log("ptptr = " + example.ptptr + ": " + example.Point_print(example.ptptr));
+console.log("pt = " + example.pt + ": " + example.Point_print(example.pt));
+
+
+console.log("\nVariables (values printed from C)");
+
+example.print_vars();
+
+console.log("\nNow I'm going to try and modify some read only variables");
+
+console.log("Tring to set 'path'");
+try{
+ example.path = "Whoa!";
+ console.log("Hey, what's going on?!?! This shouldn't work");
+}
+catch(e){
+ console.log("Good.");
+}
+
+console.log("Trying to set 'status'");
+try{
+ example.status = 0;
+ console.log("Hey, what's going on?!?! This shouldn't work");
+} catch(e){
+ console.log("Good.");
+}
+
+console.log("\nI'm going to try and update a structure variable.");
+example.pt = example.ptptr;
+console.log("The new value is: ");
+example.pt_print();
+console.log("You should see the value: " + example.Point_print(example.ptptr));
diff --git a/Examples/lua/arrays/runme.lua b/Examples/lua/arrays/runme.lua
index 7ab6dc42b..d0aa99813 100644
--- a/Examples/lua/arrays/runme.lua
+++ b/Examples/lua/arrays/runme.lua
@@ -25,7 +25,7 @@ math.randomseed(0) -- init random
--[[ version 1: passing a C array to the code
-lets test call sort_int()
+let's test call sort_int()
this requires a C array, so is the hardest to use]]
ARRAY_SIZE=10
arr=example.new_int(ARRAY_SIZE)
diff --git a/Examples/lua/constants/Makefile b/Examples/lua/constants/Makefile
index 51b83be2e..7e36e15a1 100644
--- a/Examples/lua/constants/Makefile
+++ b/Examples/lua/constants/Makefile
@@ -1,9 +1,9 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
-LIBS =
+LIBS =
check: build
$(MAKE) -f $(TOP)/Makefile lua_run
diff --git a/Examples/lua/dual/dual.cpp b/Examples/lua/dual/dual.cpp
index ad7897953..b54e44de1 100644
--- a/Examples/lua/dual/dual.cpp
+++ b/Examples/lua/dual/dual.cpp
@@ -1,7 +1,7 @@
/*
-dual.cpp a test for multiple modules and multiple intrepreters staticly linked together.
+dual.cpp a test for multiple modules and multiple interpreters statically linked together.
-Earlier version of lua bindings for SWIG would fail if staticly linked.
+Earlier version of lua bindings for SWIG would fail if statically linked.
What is happening is as follows:
example.i declares a type Foo
@@ -28,7 +28,7 @@ both Foo and Bar.
#include <stdio.h>
#include <stdlib.h>
-// the 2 libraries which are wrappered via SWIG
+// the 2 libraries which are wrapped via SWIG
extern "C" int luaopen_example(lua_State*L);
extern "C" int luaopen_example2(lua_State*L);
diff --git a/Examples/lua/embed/embed.c b/Examples/lua/embed/embed.c
index f21c933a5..507567489 100644
--- a/Examples/lua/embed/embed.c
+++ b/Examples/lua/embed/embed.c
@@ -1,9 +1,9 @@
-/* embed.c a simple test for an embeded interpreter
+/* embed.c a simple test for an embedded interpreter
The idea is that we wrapper a few simple function (example.c)
and write our own app to call it.
-What it will do is load the wrappered lib, load runme.lua and then call some functions.
+What it will do is load the wrapped lib, load runme.lua and then call some functions.
To make life easier, all the printf's have either [C] or [Lua] at the start
so you can see where they are coming from.
@@ -28,8 +28,8 @@ extern int luaopen_example(lua_State*L);
/* a really simple way of calling lua from C
just give it a lua state & a string to execute
Unfortunately lua keeps changing its API's.
-In lua 5.0.X its lua_dostring()
-In lua 5.1.X its luaL_dostring()
+In lua 5.0.X it's lua_dostring()
+In lua 5.1.X it's luaL_dostring()
so we have a few extra compiles
*/
int dostring(lua_State *L, char* str) {
@@ -58,11 +58,11 @@ int main(int argc,char* argv[]) {
luaopen_base(L);
luaopen_string(L);
luaopen_math(L);
- printf("[C] now loading the SWIG wrappered library\n");
+ printf("[C] now loading the SWIG wrapped library\n");
luaopen_example(L);
printf("[C] all looks ok\n");
printf("\n");
- printf("[C] lets load the file 'runme.lua'\n");
+ printf("[C] let's load the file 'runme.lua'\n");
printf("[C] any lua code in this file will be executed\n");
if (luaL_loadfile(L, "runme.lua") || lua_pcall(L, 0, 0, 0)) {
printf("[C] ERROR: cannot run lua file: %s",lua_tostring(L, -1));
@@ -70,16 +70,16 @@ int main(int argc,char* argv[]) {
}
printf("[C] We are now back in C, all looks ok\n");
printf("\n");
- printf("[C] lets call the function 'do_tests()'\n");
+ printf("[C] let's call the function 'do_tests()'\n");
ok=dostring(L,"do_tests()");
printf("[C] We are back in C, the dostring() function returned %d\n",ok);
printf("\n");
- printf("[C] Lets call lua again, but create an error\n");
+ printf("[C] Let's call lua again, but create an error\n");
ok=dostring(L,"no_such_function()");
printf("[C] We are back in C, the dostring() function returned %d\n",ok);
printf("[C] it should also have returned 1 and printed an error message\n");
printf("\n");
- printf("[C] Lets call lua again, calling the greeting function\n");
+ printf("[C] Let's call lua again, calling the greeting function\n");
ok=dostring(L,"call_greeting()");
printf("[C] This was C=>Lua=>C (getting a bit complex)\n");
printf("\n");
diff --git a/Examples/lua/embed/runme.lua b/Examples/lua/embed/runme.lua
index e02fd1d55..a75f74000 100644
--- a/Examples/lua/embed/runme.lua
+++ b/Examples/lua/embed/runme.lua
@@ -1,7 +1,7 @@
print "[lua] This is runme.lua"
--- test program for embeded lua
--- we do not need to load the library, as it was already in the intrepreter
--- but lets check anyway
+-- test program for embedded lua
+-- we do not need to load the library, as it was already in the interpreter
+-- but let's check anyway
assert(type(example)=='table',"Don't appear to have loaded the example module")
-- a test function to run the tests
diff --git a/Examples/lua/embed2/embed2.c b/Examples/lua/embed2/embed2.c
index 3145d3b10..100a1fb33 100644
--- a/Examples/lua/embed2/embed2.c
+++ b/Examples/lua/embed2/embed2.c
@@ -1,9 +1,9 @@
-/* embed2.c some more test for an embeded interpreter
+/* embed2.c some more tests for an embedded interpreter
This will go a bit further as it will pass values to and from the lua code.
It uses less of the SWIG code, and more of the raw lua API's
-What it will do is load the wrappered lib, load runme.lua and then call some functions.
+What it will do is load the wrapped lib, load runme.lua and then call some functions.
To make life easier, all the printf's have either [C] or [Lua] at the start
so you can see where they are coming from.
@@ -35,12 +35,12 @@ We will be using the luaL_dostring()/lua_dostring() function to call into lua
#define lua_open luaL_newstate
#endif
-/* the SWIG wrappered library */
+/* the SWIG wrapped library */
extern int luaopen_example(lua_State*L);
/* This is an example of how to call the Lua function
int add(int,int)
- its very tedious, but gives you an idea of the issues involded.
+ its very tedious, but gives you an idea of the issues involved.
(look below for a better idea)
*/
int call_add(lua_State *L,int a,int b,int* res) {
@@ -78,7 +78,7 @@ int call_add(lua_State *L,int a,int b,int* res) {
Original Code from Programming in Lua (PIL) by Roberto Ierusalimschy
ISBN 85-903798-1-7
http://www.lua.org/pil/25.3.html
-This has been modified slightly to make it compile, and its still a bit rough.
+This has been modified slightly to make it compile, and it's still a bit rough.
But it gives the idea of how to make it work.
*/
int call_va (lua_State *L,const char *func, const char *sig, ...) {
@@ -189,7 +189,7 @@ int main(int argc,char* argv[]) {
luaopen_example(L);
printf("[C] all looks ok\n");
printf("\n");
- printf("[C] lets load the file 'runme.lua'\n");
+ printf("[C] let's load the file 'runme.lua'\n");
printf("[C] any lua code in this file will be executed\n");
if (luaL_loadfile(L, "runme.lua") || lua_pcall(L, 0, 0, 0)) {
printf("[C] ERROR: cannot run lua file: %s",lua_tostring(L, -1));
@@ -197,12 +197,12 @@ int main(int argc,char* argv[]) {
}
printf("[C] We are now back in C, all looks ok\n");
printf("\n");
- printf("[C] lets call the Lua function 'add(1,1)'\n");
+ printf("[C] let's call the Lua function 'add(1,1)'\n");
printf("[C] using the C function 'call_add'\n");
ok=call_add(L,1,1,&res);
printf("[C] the function returned %d with value %d\n",ok,res);
printf("\n");
- printf("[C] lets do this rather easier\n");
+ printf("[C] let's do this rather easier\n");
printf("[C] we will call the same Lua function using a generic C function 'call_va'\n");
ok=call_va(L,"add","ii>i",1,1,&res);
printf("[C] the function returned %d with value %d\n",ok,res);
diff --git a/Examples/lua/embed2/runme.lua b/Examples/lua/embed2/runme.lua
index 73af9c5f2..9e7ab616c 100644
--- a/Examples/lua/embed2/runme.lua
+++ b/Examples/lua/embed2/runme.lua
@@ -1,7 +1,7 @@
print "[lua] This is runme.lua"
--- test program for embeded lua
--- we do not need to load the library, as it was already in the intrepreter
--- but lets check anyway
+-- test program for embedded lua
+-- we do not need to load the library, as it was already in the interpreter
+-- but let's check anyway
assert(type(example)=='table',"Don't appear to have loaded the example module")
-- note: we will copy the functions from example table into global
diff --git a/Examples/lua/embed3/embed3.cpp b/Examples/lua/embed3/embed3.cpp
index cdf56268d..d559167d1 100644
--- a/Examples/lua/embed3/embed3.cpp
+++ b/Examples/lua/embed3/embed3.cpp
@@ -1,4 +1,4 @@
-/* embed3.cpp A C++ embeded interpreter
+/* embed3.cpp A C++ embedded interpreter
This will register a C++ class with Lua, and then call a Lua function
passing C++ objects to this function.
@@ -33,12 +33,12 @@ extern "C" {
/* The SWIG external runtime is generated by using.
swig -lua -externalruntime swigluarun.h
-It contains useful function used by SWIG in its wrappering
+It contains useful function used by SWIG in its wrapper
SWIG_TypeQuery() SWIG_NewPointerObj()
*/
#include "swigluarun.h" // the SWIG external runtime
-/* the SWIG wrappered library */
+/* the SWIG wrapped library */
extern "C" int luaopen_example(lua_State*L);
// the code itself
@@ -100,10 +100,10 @@ int main(int argc, char* argv[]) {
luaopen_example(L);
printf("[C++] all looks ok\n");
printf("\n");
- printf("[C++] lets create an Engine and pass a pointer to Lua\n");
+ printf("[C++] let's create an Engine and pass a pointer to Lua\n");
Engine engine;
/* this code will pass a pointer into lua, but C++ still owns the object
- this is a little tedious, to do, but lets do it
+ this is a little tedious, to do, but let's do it
we need to pass the pointer (obviously), the type name
and a flag which states if Lua should delete the pointer once its finished with it
The type name is a class name string which is registered with SWIG
@@ -113,7 +113,7 @@ int main(int argc, char* argv[]) {
push_pointer(L,&engine,"Engine *",0);
lua_setglobal(L, "pEngine"); // set as global variable
- printf("[C++] now lets load the file 'runme.lua'\n");
+ printf("[C++] now let's load the file 'runme.lua'\n");
printf("[C++] any lua code in this file will be executed\n");
if (luaL_loadfile(L, "runme.lua") || lua_pcall(L, 0, 0, 0)) {
printf("[C++] ERROR: cannot run lua file: %s", lua_tostring(L, -1));
@@ -122,7 +122,7 @@ int main(int argc, char* argv[]) {
printf("[C++] We are now back in C++, all looks ok\n");
printf("\n");
- printf("[C++] Lets call the Lua function onEvent(e)\n");
+ printf("[C++] Let's call the Lua function onEvent(e)\n");
printf("[C++] We will give it different events, as we wish\n");
printf("[C++] Starting with STARTUP\n");
Event ev;
diff --git a/Examples/lua/embed3/example.h b/Examples/lua/embed3/example.h
index 41c13e9c1..df189e34b 100644
--- a/Examples/lua/embed3/example.h
+++ b/Examples/lua/embed3/example.h
@@ -13,7 +13,7 @@ public:
};
-/* We also want to pass some events to Lua, so lets have a few classes
+/* We also want to pass some events to Lua, so let's have a few classes
to do this.
*/
class Event
diff --git a/Examples/lua/embed3/runme.lua b/Examples/lua/embed3/runme.lua
index 3a44bd2fc..8d5b1eada 100644
--- a/Examples/lua/embed3/runme.lua
+++ b/Examples/lua/embed3/runme.lua
@@ -1,7 +1,7 @@
print "[lua] This is runme.lua"
--- test program for embeded lua
--- we do not need to load the library, as it was already in the intrepreter
--- but lets check anyway
+-- test program for embedded lua
+-- we do not need to load the library, as it was already in the interpreter
+-- but let's check anyway
assert(type(example)=='table',"Don't appear to have loaded the example module. Do not run this file directly, run the embed3 executable")
@@ -13,12 +13,12 @@ else
end
--- the embed program expects a function void onEvent(Event)
+-- the embedded program expects a function void onEvent(Event)
-- this is it
function onEvent(e)
print("[Lua] onEvent with event",e.mType)
- -- lets do something with the Engine
+ -- let's do something with the Engine
-- nothing clever, but ...
if e.mType==example.Event_STARTUP then
pEngine:start()
diff --git a/Examples/lua/exception/Makefile b/Examples/lua/exception/Makefile
index 01bee5c6a..3dbebb4e5 100644
--- a/Examples/lua/exception/Makefile
+++ b/Examples/lua/exception/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
diff --git a/Examples/lua/exception/runme.lua b/Examples/lua/exception/runme.lua
index d8125caec..a798efca7 100644
--- a/Examples/lua/exception/runme.lua
+++ b/Examples/lua/exception/runme.lua
@@ -70,7 +70,7 @@ function b()
t:message()
end
print [[
-Now lets call function a()
+Now let's call function a()
which calls b()
which calls into C++
which will throw an exception!]]
@@ -80,7 +80,7 @@ if ok then
else
print(" call failed with error:",res)
end
-print "Now lets do the same using xpcall(a,debug.traceback)"
+print "Now let's do the same using xpcall(a,debug.traceback)"
ok,res=xpcall(a,debug.traceback)
if ok then
print " that worked! Funny"
diff --git a/Examples/lua/funcptr3/Makefile b/Examples/lua/funcptr3/Makefile
index 00bfe7992..8b51e73e8 100644
--- a/Examples/lua/funcptr3/Makefile
+++ b/Examples/lua/funcptr3/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-LIBS =
+LIBS =
check: build
$(MAKE) -f $(TOP)/Makefile lua_run
diff --git a/Examples/lua/functest/Makefile b/Examples/lua/functest/Makefile
index 00bfe7992..8b51e73e8 100644
--- a/Examples/lua/functest/Makefile
+++ b/Examples/lua/functest/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-LIBS =
+LIBS =
check: build
$(MAKE) -f $(TOP)/Makefile lua_run
diff --git a/Examples/lua/functor/Makefile b/Examples/lua/functor/Makefile
index 9220dfe51..4e4edbfa5 100644
--- a/Examples/lua/functor/Makefile
+++ b/Examples/lua/functor/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile lua_run
diff --git a/Examples/lua/import/Makefile b/Examples/lua/import/Makefile
index 0bf47c1a5..0a9aebd57 100644
--- a/Examples/lua/import/Makefile
+++ b/Examples/lua/import/Makefile
@@ -2,7 +2,7 @@ TOP = ../..
SWIG = $(TOP)/../preinst-swig
SWIGOPT =
LIBS =
-
+
check: build
$(MAKE) -f $(TOP)/Makefile lua_run
diff --git a/Examples/lua/nspace/Makefile b/Examples/lua/nspace/Makefile
index 72129b1d6..57875ec49 100644
--- a/Examples/lua/nspace/Makefile
+++ b/Examples/lua/nspace/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
diff --git a/Examples/lua/owner/runme.lua b/Examples/lua/owner/runme.lua
index ed745f7b2..847645448 100644
--- a/Examples/lua/owner/runme.lua
+++ b/Examples/lua/owner/runme.lua
@@ -9,15 +9,15 @@ else
require('example')
end
-print "ok, lets test Lua's ownership of C++ objects"
+print "ok, let's test Lua's ownership of C++ objects"
print("Currently there are",example.Shape_nshapes,"shapes (there should be 0)")
-print "\nLets make a couple"
+print "\nLet's make a couple"
a=example.Square(10)
b=example.Circle(1)
print("Currently there are",example.Shape_nshapes,"shapes (there should be 2)")
-print "\nNote lets use the createX functions"
+print "\nNote let's use the createX functions"
c=example.createCircle(5)
d=example.createSquare(3)
print("Currently there are",example.Shape_nshapes,"shapes (there should be 4)")
@@ -26,12 +26,12 @@ print "\nWe will run the garbage collector & see if they are till here"
collectgarbage()
print("Currently there are",example.Shape_nshapes,"shapes (there should be 4)")
-print "\nLets get rid of them all, collect garbage & see if they are till here"
+print "\nLet's get rid of them all, collect garbage & see if they are till here"
a,b,c,d=nil,nil,nil,nil
collectgarbage()
print("Currently there are",example.Shape_nshapes,"shapes (there should be 0)")
-print "\nLets start putting stuff into the ShapeOwner"
+print "\nLet's start putting stuff into the ShapeOwner"
print "The ShapeOwner now owns the shapes, but Lua still has pointers to them"
o=example.ShapeOwner()
a=example.Square(10)
@@ -41,7 +41,7 @@ o:add(b)
o:add(example.createSquare(5))
print("Currently there are",example.Shape_nshapes,"shapes (there should be 3)")
-print "\nWe will nil our references,run the garbage collector & see if they are till here"
+print "\nWe will nil our references,run the garbage collector & see if they are still here"
print "they should be, as the ShapeOwner owns them"
a,b=nil,nil
collectgarbage()
@@ -101,4 +101,4 @@ print "done"
o,sh=nil,nil
collectgarbage()
print("Currently there are",example.Shape_nshapes,"shapes (there should be 0)")
-print "thats all folks!"
+print "that's all folks!"
diff --git a/Examples/lua/pointer/Makefile b/Examples/lua/pointer/Makefile
index 00bfe7992..8b51e73e8 100644
--- a/Examples/lua/pointer/Makefile
+++ b/Examples/lua/pointer/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-LIBS =
+LIBS =
check: build
$(MAKE) -f $(TOP)/Makefile lua_run
diff --git a/Examples/modula3/class/Makefile b/Examples/modula3/class/Makefile
index 9976e6f80..af8e099cc 100644
--- a/Examples/modula3/class/Makefile
+++ b/Examples/modula3/class/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
PLATFORM = LINUXLIBC6
INTERFACE = example.i
diff --git a/Examples/modula3/enum/Makefile b/Examples/modula3/enum/Makefile
index a3b499823..a351cb1b9 100644
--- a/Examples/modula3/enum/Makefile
+++ b/Examples/modula3/enum/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
CONSTNUMERIC = example_const
diff --git a/Examples/modula3/reference/Makefile b/Examples/modula3/reference/Makefile
index 62183931e..1a5fdeb30 100644
--- a/Examples/modula3/reference/Makefile
+++ b/Examples/modula3/reference/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT = -c++
diff --git a/Examples/modula3/simple/Makefile b/Examples/modula3/simple/Makefile
index 6a0ca4f0e..6287dac20 100644
--- a/Examples/modula3/simple/Makefile
+++ b/Examples/modula3/simple/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
diff --git a/Examples/modula3/typemap/Makefile b/Examples/modula3/typemap/Makefile
index 6a0ca4f0e..6287dac20 100644
--- a/Examples/modula3/typemap/Makefile
+++ b/Examples/modula3/typemap/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
diff --git a/Examples/mzscheme/multimap/Makefile b/Examples/mzscheme/multimap/Makefile
index d1b4a3f39..f8eeb72c3 100644
--- a/Examples/mzscheme/multimap/Makefile
+++ b/Examples/mzscheme/multimap/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile mzscheme_run
diff --git a/Examples/mzscheme/simple/Makefile b/Examples/mzscheme/simple/Makefile
index d1b4a3f39..f8eeb72c3 100644
--- a/Examples/mzscheme/simple/Makefile
+++ b/Examples/mzscheme/simple/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile mzscheme_run
diff --git a/Examples/mzscheme/std_vector/Makefile b/Examples/mzscheme/std_vector/Makefile
index 28b91158a..d2bf0a013 100644
--- a/Examples/mzscheme/std_vector/Makefile
+++ b/Examples/mzscheme/std_vector/Makefile
@@ -1,9 +1,9 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
GPP = `which g++`
MZC = test -n "/usr/bin/mzc" && /usr/bin/mzc
@@ -14,7 +14,7 @@ check: build
build:
$(SWIG) -mzscheme -c++ $(SWIGOPT) $(INTERFACE)
$(MZC) --compiler $(GPP) ++ccf "-I." --cc example_wrap.cxx
- $(MZC) --linker $(GPP) --ld $(TARGET).so example_wrap.o
-
+ $(MZC) --linker $(GPP) --ld $(TARGET).so example_wrap.o
+
clean:
$(MAKE) -f $(TOP)/Makefile mzscheme_clean
diff --git a/Examples/ocaml/contract/Makefile b/Examples/ocaml/contract/Makefile
index 91d39247e..1db93e38a 100644
--- a/Examples/ocaml/contract/Makefile
+++ b/Examples/ocaml/contract/Makefile
@@ -1,11 +1,11 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
MLFILE = example.ml
PROGFILE = example_prog.ml
-OBJS =
+OBJS =
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run
diff --git a/Examples/ocaml/scoped_enum/Makefile b/Examples/ocaml/scoped_enum/Makefile
index 4920e3b3b..e5de57ac2 100644
--- a/Examples/ocaml/scoped_enum/Makefile
+++ b/Examples/ocaml/scoped_enum/Makefile
@@ -1,11 +1,11 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
MLFILE = example.ml
PROGFILE = example_prog.ml
-OBJS =
+OBJS =
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run
diff --git a/Examples/ocaml/shapes/Makefile b/Examples/ocaml/shapes/Makefile
index 38230eb69..c1ab6507c 100644
--- a/Examples/ocaml/shapes/Makefile
+++ b/Examples/ocaml/shapes/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SWIGOPT =
+SWIGOPT =
SRCS = example.c
TARGET = example
INTERFACE = example.i
diff --git a/Examples/ocaml/std_string/Makefile b/Examples/ocaml/std_string/Makefile
index 0250cfd2d..89f997090 100644
--- a/Examples/ocaml/std_string/Makefile
+++ b/Examples/ocaml/std_string/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
PROGFILE = runme.ml
diff --git a/Examples/ocaml/std_vector/Makefile b/Examples/ocaml/std_vector/Makefile
index 0250cfd2d..89f997090 100644
--- a/Examples/ocaml/std_vector/Makefile
+++ b/Examples/ocaml/std_vector/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
PROGFILE = runme.ml
diff --git a/Examples/ocaml/stl/Makefile b/Examples/ocaml/stl/Makefile
index 545f3229a..a913611fb 100644
--- a/Examples/ocaml/stl/Makefile
+++ b/Examples/ocaml/stl/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
PROGFILE = runme.ml
diff --git a/Examples/ocaml/string_from_ptr/Makefile b/Examples/ocaml/string_from_ptr/Makefile
index f7b808934..6d344854a 100644
--- a/Examples/ocaml/string_from_ptr/Makefile
+++ b/Examples/ocaml/string_from_ptr/Makefile
@@ -1,12 +1,12 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SWIGOPT = -c++
-SRCS =
+SRCS =
TARGET = example
INTERFACE = foolib.i
MLFILE = foolib.ml
PROGFILE = example_prog.ml
-OBJS =
+OBJS =
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run
diff --git a/Examples/ocaml/strings_test/Makefile b/Examples/ocaml/strings_test/Makefile
index 14f55e0d9..49cc544ed 100644
--- a/Examples/ocaml/strings_test/Makefile
+++ b/Examples/ocaml/strings_test/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
PROGFILE = runme.ml
diff --git a/Examples/perl5/funcptr/Makefile b/Examples/perl5/funcptr/Makefile
index c4d100020..366b5897c 100644
--- a/Examples/perl5/funcptr/Makefile
+++ b/Examples/perl5/funcptr/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile perl5_run
diff --git a/Examples/perl5/java/Makefile b/Examples/perl5/java/Makefile
index b007cfdbb..ff3aab0e7 100644
--- a/Examples/perl5/java/Makefile
+++ b/Examples/perl5/java/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
@@ -15,7 +15,7 @@ build: Example.class
clean:
$(MAKE) -f $(TOP)/Makefile perl5_clean
- rm -f *.class Example.h
+ rm -f *.class Example.h
Example.class: Example.java
gcj -fPIC -C -c -g Example.java
diff --git a/Examples/perl5/multimap/Makefile b/Examples/perl5/multimap/Makefile
index c4d100020..366b5897c 100644
--- a/Examples/perl5/multimap/Makefile
+++ b/Examples/perl5/multimap/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile perl5_run
diff --git a/Examples/perl5/multiple_inheritance/Makefile b/Examples/perl5/multiple_inheritance/Makefile
index 18c3058f9..62355a82c 100644
--- a/Examples/perl5/multiple_inheritance/Makefile
+++ b/Examples/perl5/multiple_inheritance/Makefile
@@ -1,9 +1,9 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
-LIBS =
+LIBS =
check: build
$(MAKE) -f $(TOP)/Makefile perl5_run
diff --git a/Examples/perl5/pointer/Makefile b/Examples/perl5/pointer/Makefile
index c4d100020..366b5897c 100644
--- a/Examples/perl5/pointer/Makefile
+++ b/Examples/perl5/pointer/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile perl5_run
diff --git a/Examples/perl5/reference/Makefile b/Examples/perl5/reference/Makefile
index d33dd89fe..986fab86a 100644
--- a/Examples/perl5/reference/Makefile
+++ b/Examples/perl5/reference/Makefile
@@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT = -noproxy
+SWIGOPT = -noproxy
check: build
$(MAKE) -f $(TOP)/Makefile perl5_run
diff --git a/Examples/perl5/simple/Makefile b/Examples/perl5/simple/Makefile
index c4d100020..366b5897c 100644
--- a/Examples/perl5/simple/Makefile
+++ b/Examples/perl5/simple/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile perl5_run
diff --git a/Examples/perl5/value/Makefile b/Examples/perl5/value/Makefile
index c4d100020..366b5897c 100644
--- a/Examples/perl5/value/Makefile
+++ b/Examples/perl5/value/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile perl5_run
diff --git a/Examples/perl5/variables/Makefile b/Examples/perl5/variables/Makefile
index c4d100020..366b5897c 100644
--- a/Examples/perl5/variables/Makefile
+++ b/Examples/perl5/variables/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile perl5_run
diff --git a/Examples/php/callback/Makefile b/Examples/php/callback/Makefile
index 08b2710b2..6f7e4ad27 100644
--- a/Examples/php/callback/Makefile
+++ b/Examples/php/callback/Makefile
@@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile php_run
diff --git a/Examples/php/extend/Makefile b/Examples/php/extend/Makefile
index 08b2710b2..6f7e4ad27 100644
--- a/Examples/php/extend/Makefile
+++ b/Examples/php/extend/Makefile
@@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile php_run
diff --git a/Examples/pike/constants/Makefile b/Examples/pike/constants/Makefile
index 9a882bd4d..c9385ce3b 100644
--- a/Examples/pike/constants/Makefile
+++ b/Examples/pike/constants/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
diff --git a/Examples/pike/template/Makefile b/Examples/pike/template/Makefile
index 73a31ee1a..e4fc945f7 100644
--- a/Examples/pike/template/Makefile
+++ b/Examples/pike/template/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile pike_run
diff --git a/Examples/python/callback/Makefile b/Examples/python/callback/Makefile
index 21e88adc5..684995801 100644
--- a/Examples/python/callback/Makefile
+++ b/Examples/python/callback/Makefile
@@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/constants/Makefile b/Examples/python/constants/Makefile
index 505f199de..15ffa24c9 100644
--- a/Examples/python/constants/Makefile
+++ b/Examples/python/constants/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
diff --git a/Examples/python/contract/Makefile b/Examples/python/contract/Makefile
index a44887736..999521ccc 100644
--- a/Examples/python/contract/Makefile
+++ b/Examples/python/contract/Makefile
@@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/exception/Makefile b/Examples/python/exception/Makefile
index b2b163e2e..fb200fbaf 100644
--- a/Examples/python/exception/Makefile
+++ b/Examples/python/exception/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
diff --git a/Examples/python/exceptproxy/Makefile b/Examples/python/exceptproxy/Makefile
index 06bce6543..86a643415 100644
--- a/Examples/python/exceptproxy/Makefile
+++ b/Examples/python/exceptproxy/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/extend/Makefile b/Examples/python/extend/Makefile
index 21e88adc5..684995801 100644
--- a/Examples/python/extend/Makefile
+++ b/Examples/python/extend/Makefile
@@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/functor/Makefile b/Examples/python/functor/Makefile
index 6ef158379..dde0d0910 100644
--- a/Examples/python/functor/Makefile
+++ b/Examples/python/functor/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/java/Makefile b/Examples/python/java/Makefile
index 47b865dd1..12a9b512a 100644
--- a/Examples/python/java/Makefile
+++ b/Examples/python/java/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
@@ -20,4 +20,3 @@ clean:
Example.class: Example.java
gcj -fPIC -C -c -g Example.java
gcjh Example
-
diff --git a/Examples/python/libffi/Makefile b/Examples/python/libffi/Makefile
index e0620f62d..ae51b0a60 100644
--- a/Examples/python/libffi/Makefile
+++ b/Examples/python/libffi/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
diff --git a/Examples/python/operator/Makefile b/Examples/python/operator/Makefile
index 6ef158379..dde0d0910 100644
--- a/Examples/python/operator/Makefile
+++ b/Examples/python/operator/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/smartptr/Makefile b/Examples/python/smartptr/Makefile
index 140d482c9..aaba9cbbc 100644
--- a/Examples/python/smartptr/Makefile
+++ b/Examples/python/smartptr/Makefile
@@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/std_map/Makefile b/Examples/python/std_map/Makefile
index 06bce6543..86a643415 100644
--- a/Examples/python/std_map/Makefile
+++ b/Examples/python/std_map/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/std_vector/Makefile b/Examples/python/std_vector/Makefile
index 06bce6543..86a643415 100644
--- a/Examples/python/std_vector/Makefile
+++ b/Examples/python/std_vector/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/swigrun/Makefile b/Examples/python/swigrun/Makefile
index fe9f64e94..c58f39caf 100644
--- a/Examples/python/swigrun/Makefile
+++ b/Examples/python/swigrun/Makefile
@@ -4,7 +4,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/template/Makefile b/Examples/python/template/Makefile
index 06bce6543..86a643415 100644
--- a/Examples/python/template/Makefile
+++ b/Examples/python/template/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile python_run
diff --git a/Examples/python/varargs/Makefile b/Examples/python/varargs/Makefile
index 505f199de..15ffa24c9 100644
--- a/Examples/python/varargs/Makefile
+++ b/Examples/python/varargs/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
diff --git a/Examples/ruby/constants/Makefile b/Examples/ruby/constants/Makefile
index e0f6a03ae..7af9ec89e 100644
--- a/Examples/ruby/constants/Makefile
+++ b/Examples/ruby/constants/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
diff --git a/Examples/ruby/exception_class/Makefile b/Examples/ruby/exception_class/Makefile
index 46bb7995d..f0ae7e573 100644
--- a/Examples/ruby/exception_class/Makefile
+++ b/Examples/ruby/exception_class/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
diff --git a/Examples/ruby/hashargs/Makefile b/Examples/ruby/hashargs/Makefile
index cee97f28e..3933cf279 100644
--- a/Examples/ruby/hashargs/Makefile
+++ b/Examples/ruby/hashargs/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-SRCS =
+SRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile ruby_run
diff --git a/Examples/ruby/import/Makefile b/Examples/ruby/import/Makefile
index fc6a9f10f..cd7719b5c 100644
--- a/Examples/ruby/import/Makefile
+++ b/Examples/ruby/import/Makefile
@@ -2,7 +2,7 @@ TOP = ../..
SWIG = $(TOP)/../preinst-swig
SWIGOPT =
LIBS =
-
+
check: build
$(MAKE) -f $(TOP)/Makefile ruby_run
diff --git a/Examples/ruby/import_template/Makefile b/Examples/ruby/import_template/Makefile
index fc6a9f10f..cd7719b5c 100644
--- a/Examples/ruby/import_template/Makefile
+++ b/Examples/ruby/import_template/Makefile
@@ -2,7 +2,7 @@ TOP = ../..
SWIG = $(TOP)/../preinst-swig
SWIGOPT =
LIBS =
-
+
check: build
$(MAKE) -f $(TOP)/Makefile ruby_run
diff --git a/Examples/ruby/java/Makefile b/Examples/ruby/java/Makefile
index c06bfb7bf..4d2493493 100644
--- a/Examples/ruby/java/Makefile
+++ b/Examples/ruby/java/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
@@ -20,4 +20,3 @@ clean:
Example.class: Example.java
gcj -fPIC -C -c -g Example.java
gcjh Example
-
diff --git a/Examples/ruby/operator/Makefile b/Examples/ruby/operator/Makefile
index c7a21d0a4..5fd4b077b 100644
--- a/Examples/ruby/operator/Makefile
+++ b/Examples/ruby/operator/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile ruby_run
diff --git a/Examples/ruby/std_vector/Makefile b/Examples/ruby/std_vector/Makefile
index f7b148062..208a64495 100644
--- a/Examples/ruby/std_vector/Makefile
+++ b/Examples/ruby/std_vector/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile ruby_run
diff --git a/Examples/ruby/template/Makefile b/Examples/ruby/template/Makefile
index f7b148062..208a64495 100644
--- a/Examples/ruby/template/Makefile
+++ b/Examples/ruby/template/Makefile
@@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
-SWIGOPT =
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile ruby_run
diff --git a/Examples/tcl/java/Makefile b/Examples/tcl/java/Makefile
index 1578dfd18..3a9212381 100644
--- a/Examples/tcl/java/Makefile
+++ b/Examples/tcl/java/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
@@ -23,4 +23,3 @@ run:
Example.class: Example.java
gcj -fPIC -C -c -g Example.java
gcjh Example
-
diff --git a/Examples/tcl/operator/Makefile b/Examples/tcl/operator/Makefile
index 6fa350bf0..6c91c3d21 100644
--- a/Examples/tcl/operator/Makefile
+++ b/Examples/tcl/operator/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
diff --git a/Examples/tcl/std_vector/Makefile b/Examples/tcl/std_vector/Makefile
index 9ff99e2f2..a150fc956 100644
--- a/Examples/tcl/std_vector/Makefile
+++ b/Examples/tcl/std_vector/Makefile
@@ -1,6 +1,6 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
+CXXSRCS =
TARGET = my_tclsh
DLTARGET = example
INTERFACE = example.i
diff --git a/Examples/test-suite/c_delete.i b/Examples/test-suite/c_delete.i
index 632340629..0c69f9f41 100644
--- a/Examples/test-suite/c_delete.i
+++ b/Examples/test-suite/c_delete.i
@@ -2,9 +2,9 @@
/* check C++ delete keyword is okay in C wrappers */
-#pragma SWIG nowarn=SWIGWARN_PARSE_KEYWORD
+%warnfilter(SWIGWARN_PARSE_KEYWORD) delete;
-#if !defined(SWIGOCTAVE) /* Octave compiles wrappers as C++ */
+#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8) /* Octave and Javascript/v8 compiles wrappers as C++ */
%inline %{
struct delete {
diff --git a/Examples/test-suite/c_delete_function.i b/Examples/test-suite/c_delete_function.i
index 3739ceadc..8164d066b 100644
--- a/Examples/test-suite/c_delete_function.i
+++ b/Examples/test-suite/c_delete_function.i
@@ -2,7 +2,9 @@
/* check C++ delete keyword is okay in C wrappers */
-#if !defined(SWIGOCTAVE) /* Octave compiles wrappers as C++ */
+%warnfilter(SWIGWARN_PARSE_KEYWORD) delete;
+
+#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8) /* Octave and Javascript/v8 compiles wrappers as C++ */
%inline %{
double delete(double d) { return d; }
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 67f99b0b1..2a4591524 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -197,6 +197,7 @@ CPP_TEST_CASES += \
disown \
dynamic_cast \
empty \
+ enum_ignore \
enum_plus \
enum_rename \
enum_scope_template \
@@ -587,6 +588,7 @@ C_TEST_CASES += \
global_functions \
immutable_values \
inctest \
+ infinity \
integers \
keyword_rename \
lextype \
@@ -613,6 +615,7 @@ C_TEST_CASES += \
simple_array \
sizeof_pointer \
sneaky1 \
+ string_simple \
struct_rename \
struct_initialization \
typedef_struct \
diff --git a/Examples/test-suite/constructor_copy.i b/Examples/test-suite/constructor_copy.i
index bfbd706f4..8e92e7840 100644
--- a/Examples/test-suite/constructor_copy.i
+++ b/Examples/test-suite/constructor_copy.i
@@ -73,7 +73,7 @@ public:
%include "std_vector.i"
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT)
#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/cpp11_template_double_brackets.i b/Examples/test-suite/cpp11_template_double_brackets.i
index 15fe4903b..ba5caa5c5 100644
--- a/Examples/test-suite/cpp11_template_double_brackets.i
+++ b/Examples/test-suite/cpp11_template_double_brackets.i
@@ -24,6 +24,14 @@ public:
int operator<<(ABC &) { return 0; }
};
+class DEF {
+public:
+ int a;
+ int operator<<(DEF &) { return 0; }
+ int operator>>(DEF &) { return 0; }
+};
+
+
template<class T>
class ABC2 {
public:
@@ -37,3 +45,9 @@ public:
};
%}
+// Test shifts are still working
+%inline %{
+int shift_init1 = 4 << 2 >> 1;
+int shift_init2 = 4 >> 2 << 1 << 1 >> 2;
+%}
+
diff --git a/Examples/test-suite/cpp_basic.i b/Examples/test-suite/cpp_basic.i
index bd1ec453a..a228af289 100644
--- a/Examples/test-suite/cpp_basic.i
+++ b/Examples/test-suite/cpp_basic.i
@@ -30,6 +30,19 @@ class Foo {
}
int (Foo::*func_ptr)(int);
+
+ const char* __str__() const { return "Foo"; }
+};
+
+class FooSub : public Foo {
+ public:
+ FooSub() :Foo(42) {}
+};
+
+class FooSubSub : public FooSub {
+ public:
+ FooSubSub() : FooSub() {}
+ const char* __str__() const { return "FooSubSub"; }
};
%}
diff --git a/Examples/test-suite/d/operator_overload_runme.2.d b/Examples/test-suite/d/operator_overload_runme.2.d
index 2ff61cd56..d05265e58 100644
--- a/Examples/test-suite/d/operator_overload_runme.2.d
+++ b/Examples/test-suite/d/operator_overload_runme.2.d
@@ -53,7 +53,7 @@ void main() {
assert(-a == a);
assert(-b == new Op(-5));
- // Unfortunaly, there is no way to override conversion to boolean for
+ // Unfortunately, there is no way to override conversion to boolean for
// classes in D, opCast!("bool") is only used for structs.
// test []
diff --git a/Examples/test-suite/director_nspace.i b/Examples/test-suite/director_nspace.i
index fdea75e2f..f24227c68 100644
--- a/Examples/test-suite/director_nspace.i
+++ b/Examples/test-suite/director_nspace.i
@@ -40,7 +40,7 @@ namespace TopLevel
%include <std_string.i>
// nspace feature only supported by these languages
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
%nspace TopLevel::Bar::Foo;
%nspace TopLevel::Bar::FooBar;
#else
diff --git a/Examples/test-suite/director_nspace_director_name_collision.i b/Examples/test-suite/director_nspace_director_name_collision.i
index 8fd27c968..190bdf4fa 100644
--- a/Examples/test-suite/director_nspace_director_name_collision.i
+++ b/Examples/test-suite/director_nspace_director_name_collision.i
@@ -34,7 +34,7 @@ namespace TopLevel
%include <std_string.i>
// nspace feature only supported by these languages
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
%nspace TopLevel::A::Foo;
%nspace TopLevel::B::Foo;
#else
diff --git a/Examples/test-suite/enum_forward.i b/Examples/test-suite/enum_forward.i
index 1609fa8e9..c82e17be7 100644
--- a/Examples/test-suite/enum_forward.i
+++ b/Examples/test-suite/enum_forward.i
@@ -1,7 +1,7 @@
%module enum_forward
-/* This contains C code that is not valid C++03 and Octave wrappers are always compiled as C++ */
-#if !defined(SWIGOCTAVE)
+/* This contains C code that is not valid C++03 and Octave, and Javascript(v8) wrappers are always compiled as C++ */
+#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8)
%{
enum ForwardEnum1 { AAA, BBB };
enum ForwardEnum2 { CCC, DDD };
diff --git a/Examples/test-suite/enum_ignore.i b/Examples/test-suite/enum_ignore.i
new file mode 100644
index 000000000..6d11f6a97
--- /dev/null
+++ b/Examples/test-suite/enum_ignore.i
@@ -0,0 +1,20 @@
+%module enum_ignore
+
+// Similar to enum_missing C test, but with namespaces and using %ignore
+
+%ignore N::C;
+
+%inline %{
+ namespace N {
+ enum C { Red, Green, Blue };
+
+ struct Draw {
+ void DrawBW() {}
+ void DrawC(C c) {}
+ void DrawC_Ptr(C* c) {}
+ void DrawC_ConstRef(C const& c) {}
+ };
+ }
+%}
+
+
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.i b/Examples/test-suite/errors/cpp_extra_brackets.i
new file mode 100644
index 000000000..32cf7f72d
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extra_brackets.i
@@ -0,0 +1,6 @@
+%module cpp_extra_brackets
+
+// Extra brackets was segfaulting in SWIG-3.0.0
+struct ABC {
+ int operator<<(ABC &))) { return 0; }
+};
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.stderr b/Examples/test-suite/errors/cpp_extra_brackets.stderr
new file mode 100644
index 000000000..12bb1f327
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extra_brackets.stderr
@@ -0,0 +1 @@
+cpp_extra_brackets.i:5: Error: Syntax error in input(3).
diff --git a/Examples/test-suite/errors/cpp_extra_brackets2.i b/Examples/test-suite/errors/cpp_extra_brackets2.i
new file mode 100644
index 000000000..17a5d5918
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extra_brackets2.i
@@ -0,0 +1,9 @@
+%module cpp_extra_brackets
+
+// Extra brackets was segfaulting in SWIG-3.0.0
+struct ABC {
+;
+)))
+int operator<<(ABC &) { return 0; }
+int operator>>(ABC &) { return 0; }
+};
diff --git a/Examples/test-suite/errors/cpp_extra_brackets2.stderr b/Examples/test-suite/errors/cpp_extra_brackets2.stderr
new file mode 100644
index 000000000..c2eaf741c
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extra_brackets2.stderr
@@ -0,0 +1 @@
+cpp_extra_brackets2.i:6: Error: Syntax error in input(3).
diff --git a/Examples/test-suite/infinity.i b/Examples/test-suite/infinity.i
new file mode 100644
index 000000000..726150f02
--- /dev/null
+++ b/Examples/test-suite/infinity.i
@@ -0,0 +1,47 @@
+%module infinity
+
+/* C99 defines INFINITY
+ Because INFINITY may be defined by compiler built-ins, we can't use #define.
+ Instead, expose the variable MYINFINITY and then use %rename to make it INFINITY in the scripting language.
+*/
+%rename(INFINITY) MYINFINITY;
+
+%{
+#include <math.h>
+
+/* C99 math.h defines INFINITY. If not available, this is the fallback. */
+#ifndef INFINITY
+ #ifdef _MSC_VER
+ union MSVC_EVIL_FLOAT_HACK
+ {
+ unsigned __int8 Bytes[4];
+ float Value;
+ };
+ static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
+ #define INFINITY (INFINITY_HACK.Value)
+ #endif
+
+ #ifdef __GNUC__
+ #define INFINITY (__builtin_inf())
+ #elif defined(__clang__)
+ #if __has_builtin(__builtin_inf)
+ #define INFINITY (__builtin_inf())
+ #endif
+ #endif
+
+ #ifndef INFINITY
+ #define INFINITY (1e1000)
+ #endif
+#endif
+%}
+
+%inline %{
+/* This will allow us to bind the real INFINITY value through SWIG via MYINFINITY. Use %rename to fix the name. */
+const double MYINFINITY = INFINITY;
+
+/* Use of float is intentional because the original bug was in the float conversion due to overflow checking. */
+float use_infinity(float inf_val)
+{
+ return inf_val;
+}
+%}
diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
new file mode 100755
index 000000000..7368ea9a3
--- /dev/null
+++ b/Examples/test-suite/javascript/Makefile.in
@@ -0,0 +1,114 @@
+#######################################################################
+# Makefile for javascript test-suite
+#######################################################################
+
+LANGUAGE = javascript
+NODEGYP = @NODEGYP@
+SCRIPTSUFFIX = _runme.js
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+SWIG = $(top_builddir)/preinst_swig
+
+ifneq (, $(ENGINE))
+ JSENGINE=$(ENGINE)
+else
+ JSENGINE=node
+endif
+
+include $(srcdir)/../common.mk
+
+_setup = \
+ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $* (with run test)" ; \
+ else \
+ echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $*" ; \
+ fi;
+
+ifneq (jsc,$(ENGINE))
+
+ # This test can not be run with v8 as it uses v8 API incompatible output typemaps
+ typemap_variables.cpptest:
+ echo "skipping $(LANGUAGE) ($(JSENGINE)) testcase typemap_variables" ;
+
+endif
+
+ifeq (node,$(JSENGINE))
+
+ SWIGOPT += -v8 -DBUILDING_NODE_EXTENSION=1
+
+ # shut up some warnings
+ # contract macro has an empty 'else' at the end...
+ aggregate.cpptest: GYP_CFLAGS = \"-Wno-empty-body\"
+ contract.cpptest: GYP_CFLAGS = \"-Wno-empty-body\"
+
+ # dunno... ignoring generously
+ apply_signed_char.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+ constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+ enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+
+ # Note: we need to use swig in C parse mode, but make node-gyp believe it is c++ (via file extension)
+ swig_and_compile_c = \
+ sh ./setup_test.sh $* $(GYP_CFLAGS); \
+ $(SWIG) -javascript $(SWIGOPT) -o $*_wrap.cxx ../$*.i; \
+ $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
+
+ swig_and_compile_cpp = \
+ sh ./setup_test.sh $* $(GYP_CFLAGS); \
+ $(SWIG) -c++ -javascript $(SWIGOPT) ../$*.i; \
+ $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
+
+ run_testcase = \
+ if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
+ node $(srcdir)/$*$(SCRIPTSUFFIX); \
+ fi
+
+
+ %.ctest:
+ $(_setup)
+ $(swig_and_compile_c)
+ $(run_testcase)
+
+ %.cpptest:
+ $(_setup)
+ $(swig_and_compile_cpp)
+ $(run_testcase)
+
+ %.multicpptest:
+ $(_setup)
+
+else
+
+ SWIGOPT += -$(JSENGINE)
+
+ run_testcase = \
+ if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
+ $(top_srcdir)/Tools/javascript/javascript -$(JSENGINE) $(srcdir)/$*$(SCRIPTSUFFIX); \
+ fi
+
+ %.ctest:
+ $(_setup)
+ +$(swig_and_compile_c)
+ $(run_testcase)
+
+ %.cpptest:
+ $(_setup)
+ +$(swig_and_compile_cpp)
+ $(run_testcase)
+
+ %.multicpptest:
+ $(_setup)
+ +$(swig_and_compile_multi_cpp)
+ $(run_testcase)
+
+endif
+
+
+%.clean:
+ rm -rf $*
+
+clean:
+ rm -f *_wrap.cxx
+ rm -f *_wrap.c
+ rm -f *.so
+ rm -f *.o
diff --git a/Examples/test-suite/javascript/abstract_access_runme.js b/Examples/test-suite/javascript/abstract_access_runme.js
new file mode 100644
index 000000000..8f87d2105
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_access_runme.js
@@ -0,0 +1,6 @@
+var abstract_access = require("./abstract_access");
+
+var d = new abstract_access.D()
+if (d.do_x() != 1) {
+ throw "Error";
+}
diff --git a/Examples/test-suite/javascript/abstract_inherit_runme.js b/Examples/test-suite/javascript/abstract_inherit_runme.js
new file mode 100644
index 000000000..3af2eae74
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_inherit_runme.js
@@ -0,0 +1,40 @@
+var abstract_inherit = require("./abstract_inherit");
+
+// Shouldn't be able to instantiate any of these classes
+// since none of them implements the pure virtual function
+// declared in the base class (Foo).
+var Foo = abstract_inherit.Foo;
+var Bar = abstract_inherit.Bar;
+var Spam = abstract_inherit.Spam;
+
+var caughtException = false;
+try {
+ new Foo();
+} catch (err) {
+ caughtException = true;
+}
+if (!caughtException) {
+ throw new Error("Foo should be instantiated as it is abstract");
+}
+
+caughtException = false;
+try {
+ new Bar();
+} catch (err) {
+ caughtException = true;
+}
+
+if (!caughtException) {
+ throw new Error("Bar should be instantiated as it is abstract");
+}
+
+caughtException = false;
+try {
+ new Spam();
+} catch (err) {
+ caughtException = true;
+}
+
+if (!caughtException) {
+ throw new Error("Spam should be instantiated as it is abstract");
+}
diff --git a/Examples/test-suite/javascript/abstract_typedef2_runme.js b/Examples/test-suite/javascript/abstract_typedef2_runme.js
new file mode 100644
index 000000000..c177e49c3
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_typedef2_runme.js
@@ -0,0 +1,6 @@
+var abstract_typedef2 = require("./abstract_typedef2");
+
+var a = new abstract_typedef2.A_UF();
+
+if (a == undefined)
+ throw "Error";
diff --git a/Examples/test-suite/javascript/abstract_typedef_runme.js b/Examples/test-suite/javascript/abstract_typedef_runme.js
new file mode 100644
index 000000000..abcfc581d
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_typedef_runme.js
@@ -0,0 +1,8 @@
+var abstract_typedef = require("./abstract_typedef");
+
+var e = new abstract_typedef.Engine();
+var a = new abstract_typedef.A()
+
+if (a.write(e) != 1) {
+ throw "Error";
+}
diff --git a/Examples/test-suite/javascript/abstract_virtual_runme.js b/Examples/test-suite/javascript/abstract_virtual_runme.js
new file mode 100644
index 000000000..9e2814e41
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_virtual_runme.js
@@ -0,0 +1,11 @@
+var abstract_virtual = require("./abstract_virtual");
+
+d = new abstract_virtual.D()
+
+if (d == undefined)
+ throw "Error";
+
+e = new abstract_virtual.E()
+
+if (e == undefined)
+ throw "Error";
diff --git a/Examples/test-suite/javascript/array_member_runme.js b/Examples/test-suite/javascript/array_member_runme.js
new file mode 100644
index 000000000..8c4ef1da5
--- /dev/null
+++ b/Examples/test-suite/javascript/array_member_runme.js
@@ -0,0 +1,22 @@
+var array_member = require("./array_member");
+
+var f = new array_member.Foo();
+f.data = array_member.global_data;
+
+for (var i=0; i<8; i++) {
+ if (array_member.get_value(f.data,i) != array_member.get_value(array_member.global_data,i)) {
+ throw "Bad array assignment (1)";
+ }
+}
+
+for (var i=0; i<8; i++) {
+ array_member.set_value(f.data,i,-i);
+}
+
+array_member.global_data = f.data;
+
+for (var i=0; i<8; i++){
+ if (array_member.get_value(f.data,i) != array_member.get_value(array_member.global_data,i)) {
+ throw "Bad array assignment (2)";
+ }
+}
diff --git a/Examples/test-suite/javascript/arrays_global_runme.js b/Examples/test-suite/javascript/arrays_global_runme.js
new file mode 100644
index 000000000..fdb365f83
--- /dev/null
+++ b/Examples/test-suite/javascript/arrays_global_runme.js
@@ -0,0 +1,18 @@
+var arrays_global = require("./arrays_global");
+
+arrays_global.array_i = arrays_global.array_const_i;
+
+arrays_global.BeginString_FIX44a;
+arrays_global.BeginString_FIX44b;
+arrays_global.BeginString_FIX44c;
+arrays_global.BeginString_FIX44d;
+arrays_global.BeginString_FIX44d;
+arrays_global.BeginString_FIX44b = "12"+'\0'+"45";
+arrays_global.BeginString_FIX44b;
+arrays_global.BeginString_FIX44d;
+arrays_global.BeginString_FIX44e;
+arrays_global.BeginString_FIX44f;
+
+arrays_global.test_a("hello","hi","chello","chi");
+
+arrays_global.test_b("1234567","hi");
diff --git a/Examples/test-suite/javascript/callback_runme.js b/Examples/test-suite/javascript/callback_runme.js
new file mode 100644
index 000000000..9b1ef01a3
--- /dev/null
+++ b/Examples/test-suite/javascript/callback_runme.js
@@ -0,0 +1,30 @@
+var callback = require("./callback");
+
+if (callback.foo(2) !== 2) {
+ throw new Error("Failed.");
+}
+if (callback.A_bar(2) !== 4) {
+ throw new Error("Failed.");
+}
+if (callback.foobar(3, callback.foo) != callback.foo(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar(3, foo) != callback.foo(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar(3, callback.A_bar) != callback.A_bar(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar(3, callback.foof) != callback.foof(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar_i(3, callback.foo_i) != callback.foo_i(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar_d(3.5, callback.foo_d) != callback.foo_d(3.5)) {
+ throw new Error("Failed.");
+}
+var a = new callback.A();
+if (callback.foobarm(3, a, callback.A.foom_cb_ptr) != a.foom(3)) {
+ throw new Error("Failed.");
+}
diff --git a/Examples/test-suite/javascript/char_binary_runme.js b/Examples/test-suite/javascript/char_binary_runme.js
new file mode 100644
index 000000000..42abe6060
--- /dev/null
+++ b/Examples/test-suite/javascript/char_binary_runme.js
@@ -0,0 +1,38 @@
+var char_binary = require("./char_binary");
+
+var t = new char_binary.Test();
+if (t.strlen('hile') != 4) {
+ print(t.strlen('hile'));
+ throw("bad multi-arg typemap 1");
+}
+
+if (t.strlen('hil\0') != 4) {
+ throw("bad multi-arg typemap 2");
+}
+
+/*
+ * creating a raw char*
+ */
+var pc = char_binary.new_pchar(5);
+char_binary.pchar_setitem(pc, 0, 'h');
+char_binary.pchar_setitem(pc, 1, 'o');
+char_binary.pchar_setitem(pc, 2, 'l');
+char_binary.pchar_setitem(pc, 3, 'a');
+char_binary.pchar_setitem(pc, 4, 0);
+
+
+if (t.strlen(pc) != 4) {
+ throw("bad multi-arg typemap (3)");
+}
+
+char_binary.var_pchar = pc;
+if (char_binary.var_pchar != "hola") {
+ print(char_binary.var_pchar);
+ throw("bad pointer case (1)");
+}
+
+char_binary.var_namet = pc;
+if (char_binary.var_namet != "hola") {
+ throw("bad pointer case (2)");
+}
+char_binary.delete_pchar(pc);
diff --git a/Examples/test-suite/javascript/char_strings_runme.js b/Examples/test-suite/javascript/char_strings_runme.js
new file mode 100644
index 000000000..cca50d851
--- /dev/null
+++ b/Examples/test-suite/javascript/char_strings_runme.js
@@ -0,0 +1,11 @@
+var char_strings = require("./char_strings");
+
+var assertIsEqual = function(expected, actual) {
+ if (expected !== actual) {
+ throw new Error("Expected "+expected+", was "+actual);
+ }
+};
+
+assertIsEqual("hi there", char_strings.CharPingPong("hi there"));
+assertIsEqual("hi there", char_strings.CharArrayPingPong("hi there"));
+assertIsEqual("hi there", char_strings.CharArrayDimsPingPong("hi there"));
diff --git a/Examples/test-suite/javascript/class_ignore_runme.js b/Examples/test-suite/javascript/class_ignore_runme.js
new file mode 100644
index 000000000..f0a32a1c4
--- /dev/null
+++ b/Examples/test-suite/javascript/class_ignore_runme.js
@@ -0,0 +1,6 @@
+var class_ignore = require("./class_ignore");
+
+a = new class_ignore.Bar();
+
+if (class_ignore.do_blah(a) != "Bar::blah")
+ throw "Error";
diff --git a/Examples/test-suite/javascript/class_scope_weird_runme.js b/Examples/test-suite/javascript/class_scope_weird_runme.js
new file mode 100644
index 000000000..ac745d023
--- /dev/null
+++ b/Examples/test-suite/javascript/class_scope_weird_runme.js
@@ -0,0 +1,6 @@
+var class_scope_weird = require("./class_scope_weird");
+
+f = new class_scope_weird.Foo();
+g = new class_scope_weird.Foo(3);
+if (f.bar(3) != 3)
+ throw RuntimeError;
diff --git a/Examples/test-suite/javascript/complextest_runme.js b/Examples/test-suite/javascript/complextest_runme.js
new file mode 100644
index 000000000..1fcc97648
--- /dev/null
+++ b/Examples/test-suite/javascript/complextest_runme.js
@@ -0,0 +1,22 @@
+var complextest = require("./complextest");
+
+a = [-1,2];
+
+expected = [-1, -2];
+
+a_c = complextest.Conj(a);
+if (a_c.toString() != expected.toString())
+ throw "Error in Conj(a)";
+
+a_c_f = complextest.Conjf(a);
+if (a_c_f.toString() != expected.toString())
+ throw "Error in Conjf(a)";
+
+v = new complextest.VectorStdCplx();
+v.add([1,2]);
+v.add([2,3]);
+v.add([4,3]);
+v.add(1);
+
+// TODO: how to check validity?
+complextest.Copy_h(v);
diff --git a/Examples/test-suite/javascript/constover_runme.js b/Examples/test-suite/javascript/constover_runme.js
new file mode 100644
index 000000000..764d8b328
--- /dev/null
+++ b/Examples/test-suite/javascript/constover_runme.js
@@ -0,0 +1,33 @@
+var constover = require("./constover");
+
+p = constover.test("test");
+if (p != "test") {
+ throw "test failed!";
+}
+
+p = constover.test_pconst("test");
+if (p != "test_pconst") {
+ throw "test_pconst failed!";
+}
+
+f = new constover.Foo();
+
+p = f.test("test");
+if (p != "test") {
+ throw "member-test failed!";
+}
+
+p = f.test_pconst("test");
+if (p != "test_pconst") {
+ throw "member-test_pconst failed!";
+}
+
+p = f.test_constm("test");
+if (p != "test_constmethod") {
+ throw "member-test_constm failed!";
+}
+
+p = f.test_pconstm("test");
+if (p != "test_pconstmethod") {
+ throw "member-test_pconstm failed!";
+}
diff --git a/Examples/test-suite/javascript/constructor_copy_runme.js b/Examples/test-suite/javascript/constructor_copy_runme.js
new file mode 100644
index 000000000..39dce52ce
--- /dev/null
+++ b/Examples/test-suite/javascript/constructor_copy_runme.js
@@ -0,0 +1,42 @@
+var constructor_copy = require("./constructor_copy");
+
+f1 = new constructor_copy.Foo1(3);
+f11 = new constructor_copy.Foo1(f1);
+
+if (f1.x != f11.x) {
+ throw "error in ctor copy for Foo1";
+}
+
+var good = 0;
+
+f8 = new constructor_copy.Foo8()
+try {
+ f81 = new constructor_copy.Foo8(f8);
+ good = 0;
+} catch (err) {
+ good = 1;
+}
+
+if (good == 0) {
+ throw "Error: should not allow calling copy ctor for Foo8";
+}
+
+
+bi = new constructor_copy.Bari(5);
+bc = new constructor_copy.Bari(bi);
+
+if (bi.x != bc.x) {
+ throw "Error in copy ctor of Bari";
+}
+
+bd = new constructor_copy.Bard(5);
+try {
+ bc = new constructor_copy.Bard(bd);
+ good = 0;
+} catch (err) {
+ good = 1;
+}
+
+if (good == 0) {
+ throw "Error: should not allow calling copy ctor for Bard";
+}
diff --git a/Examples/test-suite/javascript/cpp_enum_runme.js b/Examples/test-suite/javascript/cpp_enum_runme.js
new file mode 100644
index 000000000..35f7c60ac
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp_enum_runme.js
@@ -0,0 +1,28 @@
+var cpp_enum = require("./cpp_enum");
+
+var f = new cpp_enum.Foo()
+
+if(f.hola != cpp_enum.Hello){
+ print(f.hola);
+ throw "Error";
+}
+
+f.hola = cpp_enum.Foo.Hi
+if(f.hola != cpp_enum.Foo.Hi){
+ print(f.hola);
+ throw "Error";
+}
+
+f.hola = cpp_enum.Hello
+
+if(f.hola != cpp_enum.Hello){
+ print(f.hola);
+ throw "Error";
+}
+
+cpp_enum.Foo.hi = cpp_enum.Hello
+if(cpp_enum.Foo.hi != cpp_enum.Hello){
+ print(cpp_enum.Foo.hi);
+ throw "Error";
+}
+
diff --git a/Examples/test-suite/javascript/cpp_namespace_runme.js b/Examples/test-suite/javascript/cpp_namespace_runme.js
new file mode 100644
index 000000000..3bdfef3e9
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp_namespace_runme.js
@@ -0,0 +1,47 @@
+var cpp_namespace = require("./cpp_namespace");
+
+var n = cpp_namespace.fact(4);
+if (n != 24){
+ throw ("Bad return value error!");
+}
+if (cpp_namespace.Foo != 42){
+ throw ("Bad variable value error!");
+}
+
+t = new cpp_namespace.Test();
+if (t.method() != "Test::method"){
+ throw ("Bad method return value error!");
+}
+if (cpp_namespace.do_method(t) != "Test::method"){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method2(t) != "Test::method"){
+ throw ("Bad return value error!");
+}
+cpp_namespace.weird("hello", 4);
+delete t;
+
+t2 = new cpp_namespace.Test2();
+t3 = new cpp_namespace.Test3();
+t4 = new cpp_namespace.Test4();
+t5 = new cpp_namespace.Test5();
+if (cpp_namespace.foo3(42) != 42){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method3(t2,40) != "Test2::method"){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method3(t3,40) != "Test3::method"){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method3(t4,40) != "Test4::method"){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method3(t5,40) != "Test5::method"){
+ throw ("Bad return value error!");
+}
diff --git a/Examples/test-suite/javascript/cpp_static_runme.js b/Examples/test-suite/javascript/cpp_static_runme.js
new file mode 100644
index 000000000..2579aeafe
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp_static_runme.js
@@ -0,0 +1,9 @@
+var cpp_static = require("./cpp_static");
+
+cpp_static.StaticFunctionTest.static_func();
+cpp_static.StaticFunctionTest.static_func_2(1);
+cpp_static.StaticFunctionTest.static_func_3(1,2);
+cpp_static.StaticMemberTest.static_int = 10;
+if (cpp_static.StaticMemberTest.static_int != 10)
+throw "error";
+
diff --git a/Examples/test-suite/javascript/director_alternating_runme.js b/Examples/test-suite/javascript/director_alternating_runme.js
new file mode 100644
index 000000000..a0411eace
--- /dev/null
+++ b/Examples/test-suite/javascript/director_alternating_runme.js
@@ -0,0 +1,5 @@
+var director_alternating = require("./director_alternating");
+
+id = director_alternating.getBar().id();
+if (id != director_alternating.idFromGetBar())
+ throw ("Error, Got wrong id: " + str(id));
diff --git a/Examples/test-suite/javascript/disown_runme.js b/Examples/test-suite/javascript/disown_runme.js
new file mode 100644
index 000000000..a4a6fd880
--- /dev/null
+++ b/Examples/test-suite/javascript/disown_runme.js
@@ -0,0 +1,22 @@
+var disown = require("./disown");
+
+var a = new disown.A();
+var tmp = a.thisown;
+a.thisown = 0
+if (a.thisown) {
+ throw new Error("Failed.");
+}
+a.thisown = 1
+if (!a.thisown) {
+ throw new Error("Failed.");
+}
+a.thisown = tmp
+if (a.thisown != tmp) {
+ throw new Error("Failed.");
+}
+
+var b = new disown.B();
+b.acquire(a);
+if (a.thisown) {
+ throw new Error("Failed.");
+}
diff --git a/Examples/test-suite/javascript/dynamic_cast_runme.js b/Examples/test-suite/javascript/dynamic_cast_runme.js
new file mode 100644
index 000000000..0029cb0f8
--- /dev/null
+++ b/Examples/test-suite/javascript/dynamic_cast_runme.js
@@ -0,0 +1,12 @@
+var dynamic_cast = require("./dynamic_cast");
+
+var f = new dynamic_cast.Foo();
+var b = new dynamic_cast.Bar();
+
+var x = f.blah();
+var y = b.blah();
+
+var a = dynamic_cast.do_test(y);
+if (a != "Bar::test") {
+ throw new Error("Failed.");
+}
diff --git a/Examples/test-suite/javascript/empty_runme.js b/Examples/test-suite/javascript/empty_runme.js
new file mode 100644
index 000000000..db06b3902
--- /dev/null
+++ b/Examples/test-suite/javascript/empty_runme.js
@@ -0,0 +1 @@
+var empty = require("./empty"); \ No newline at end of file
diff --git a/Examples/test-suite/javascript/enum_template_runme.js b/Examples/test-suite/javascript/enum_template_runme.js
new file mode 100644
index 000000000..20f8c3482
--- /dev/null
+++ b/Examples/test-suite/javascript/enum_template_runme.js
@@ -0,0 +1,8 @@
+var enum_template = require("./enum_template");
+
+if (enum_template.MakeETest() != 1)
+ throw "RuntimeError";
+
+if (enum_template.TakeETest(0) != null)
+ throw "RuntimeError";
+
diff --git a/Examples/test-suite/javascript/infinity_runme.js b/Examples/test-suite/javascript/infinity_runme.js
new file mode 100644
index 000000000..7b5182ff6
--- /dev/null
+++ b/Examples/test-suite/javascript/infinity_runme.js
@@ -0,0 +1,4 @@
+var infinity = require("./infinity");
+
+var my_infinity = infinity.INFINITY;
+var ret_val = infinity.use_infinity(my_infinity);
diff --git a/Examples/test-suite/javascript/namespace_virtual_method_runme.js b/Examples/test-suite/javascript/namespace_virtual_method_runme.js
new file mode 100644
index 000000000..24d3bd487
--- /dev/null
+++ b/Examples/test-suite/javascript/namespace_virtual_method_runme.js
@@ -0,0 +1,3 @@
+var namespace_virtual_method = require("./namespace_virtual_method");
+
+x = new namespace_virtual_method.Spam();
diff --git a/Examples/test-suite/javascript/node_template/binding.gyp.in b/Examples/test-suite/javascript/node_template/binding.gyp.in
new file mode 100644
index 000000000..209774ae0
--- /dev/null
+++ b/Examples/test-suite/javascript/node_template/binding.gyp.in
@@ -0,0 +1,30 @@
+{
+ "targets": [
+ {
+ "target_name": "$testcase",
+ "sources":[ "../$testcase_wrap.cxx" ],
+ "include_dirs": ["../.."],
+ 'defines': [
+ 'BUILDING_NODE_EXTENSION=1',
+ ],
+ 'conditions': [
+ ['OS=="mac"',
+ {
+ 'xcode_settings': {
+ 'GCC_ENABLE_CPP_RTTI': 'YES',
+ 'GCC_ENABLE_CPP_EXCEPTIONS' : 'YES'
+ }
+ }
+ ],
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"',
+ {
+ 'cflags': [ "-Wno-unused-variable", "-Wno-unused-but-set-variable", "-Wno-unused-but-set-parameter", $cflags],
+ 'cflags_cc': [ "-Wno-unused-variable", "-Wno-unused-but-set-variable", "-Wno-unused-but-set-parameter", $cflags],
+ 'cflags!': [ '-fno-exceptions' ],
+ 'cflags_cc!': [ '-fno-exceptions', '-fno-rtti' ]
+ }
+ ]
+ ],
+ }
+ ],
+}
diff --git a/Examples/test-suite/javascript/node_template/index.js.in b/Examples/test-suite/javascript/node_template/index.js.in
new file mode 100644
index 000000000..72330499d
--- /dev/null
+++ b/Examples/test-suite/javascript/node_template/index.js.in
@@ -0,0 +1 @@
+module.exports = require('./build/Release/$testcase');
diff --git a/Examples/test-suite/javascript/nspace_extend_runme.js b/Examples/test-suite/javascript/nspace_extend_runme.js
new file mode 100644
index 000000000..ab81c19d3
--- /dev/null
+++ b/Examples/test-suite/javascript/nspace_extend_runme.js
@@ -0,0 +1,27 @@
+var nspace_extend = require("./nspace_extend");
+
+// constructors and destructors
+var color1 = new nspace_extend.Outer.Inner1.Color();
+var color = new nspace_extend.Outer.Inner1.Color(color1);
+delete color1;
+
+// class methods
+color.colorInstanceMethod(20.0);
+nspace_extend.Outer.Inner1.Color.colorStaticMethod(20.0);
+var created = nspace_extend.Outer.Inner1.Color.create();
+
+
+// constructors and destructors
+var color2 = new nspace_extend.Outer.Inner2.Color();
+color = new nspace_extend.Outer.Inner2.Color(color2);
+delete color2;
+
+// class methods
+color.colorInstanceMethod(20.0);
+nspace_extend.Outer.Inner2.Color.colorStaticMethod(20.0);
+created = nspace_extend.Outer.Inner2.Color.create();
+
+// Same class different namespaces
+var col1 = new nspace_extend.Outer.Inner1.Color();
+var col2 = nspace_extend.Outer.Inner2.Color.create();
+col2.colors(col1, col1, col2, col2, col2);
diff --git a/Examples/test-suite/javascript/nspace_runme.js b/Examples/test-suite/javascript/nspace_runme.js
new file mode 100644
index 000000000..f1afff428
--- /dev/null
+++ b/Examples/test-suite/javascript/nspace_runme.js
@@ -0,0 +1,76 @@
+var nspace = require("./nspace");
+
+var color1 = new nspace.Outer.Inner1.Color();
+var color = new nspace.Outer.Inner1.Color(color1);
+delete color1;
+
+// class methods
+color.colorInstanceMethod(20.0);
+nspace.Outer.Inner1.Color.colorStaticMethod(20.0);
+var created = nspace.Outer.Inner1.Color.create();
+
+// class enums
+var someClass = new nspace.Outer.SomeClass();
+var channel = someClass.GetInner1ColorChannel();
+if (channel != nspace.Outer.Inner1.Color.Transmission) {
+ throw new Error("Failed.");
+}
+
+// class anonymous enums
+var val1 = nspace.Outer.Inner1.Color.ColorEnumVal1;
+var val2 = nspace.Outer.Inner1.Color.ColorEnumVal2;
+if (val1 !== 0 || val2 !== 0x22) {
+ throw new Error("Failed.");
+}
+
+// instance member variables
+color.instanceMemberVariable = 123;
+if (color.instanceMemberVariable !== 123) {
+ throw new Error("Failed.");
+}
+
+// static member variables
+nspace.Outer.Inner1.Color.staticMemberVariable = 789;
+if (nspace.Outer.Inner1.Color.staticMemberVariable !== 789) {
+ throw new Error("Failed.");
+}
+
+if (nspace.Outer.Inner1.Color.staticConstMemberVariable !== 222) {
+ throw new Error("Failed.");
+}
+
+if (nspace.Outer.Inner1.Color.staticConstEnumMemberVariable !== nspace.Outer.Inner1.Color.Transmission) {
+ throw new Error("Failed.");
+}
+
+// Same class different namespaces
+var col1 = new nspace.Outer.Inner1.Color();
+var col2 = nspace.Outer.Inner2.Color.create();
+col2.colors(col1, col1, col2, col2, col2);
+
+nspace.Outer.Inner1.namespaceFunction(color);
+nspace.Outer.Inner1.namespaceVar = 111;
+if (nspace.Outer.Inner1.namespaceVar !== 111) {
+ throw new Error("Failed.");
+}
+
+// global enums
+var outerChannel1 = someClass.GetInner1Channel();
+if (outerChannel1 != nspace.Outer.Inner1.Transmission1) {
+ throw new Error("Failed.");
+}
+
+var outerChannel2 = someClass.GetInner2Channel();
+if (outerChannel2 !== nspace.Outer.Inner2.Transmission2) {
+ throw new Error("Failed.");
+}
+
+// turn feature off / ignoring
+var ns = new nspace.Outer.namespce();
+var nons = new nspace.NoNSpacePlease();
+
+// Derived class
+var blue3 = new nspace.Outer.Inner3.Blue();
+blue3.blueInstanceMethod();
+var blue4 = new nspace.Outer.Inner4.Blue();
+blue4.blueInstanceMethod();
diff --git a/Examples/test-suite/javascript/overload_copy_runme.js b/Examples/test-suite/javascript/overload_copy_runme.js
new file mode 100644
index 000000000..1039ffda1
--- /dev/null
+++ b/Examples/test-suite/javascript/overload_copy_runme.js
@@ -0,0 +1,4 @@
+var overload_copy = require("./overload_copy");
+
+f = new overload_copy.Foo();
+g = new overload_copy.Foo(f);
diff --git a/Examples/test-suite/javascript/preproc_include_runme.js b/Examples/test-suite/javascript/preproc_include_runme.js
new file mode 100644
index 000000000..4b827fbcc
--- /dev/null
+++ b/Examples/test-suite/javascript/preproc_include_runme.js
@@ -0,0 +1,23 @@
+var preproc_include = require("./preproc_include");
+
+if (preproc_include.multiply10(10) != 100)
+ throw "RuntimeError";
+
+if (preproc_include.multiply20(10) != 200)
+ throw "RuntimeError";
+
+if (preproc_include.multiply30(10) != 300)
+ throw "RuntimeError";
+
+if (preproc_include.multiply40(10) != 400)
+ throw "RuntimeError";
+
+if (preproc_include.multiply50(10) != 500)
+ throw "RuntimeError";
+
+if (preproc_include.multiply60(10) != 600)
+ throw "RuntimeError";
+
+if (preproc_include.multiply70(10) != 700)
+ throw "RuntimeError";
+
diff --git a/Examples/test-suite/javascript/preproc_runme.js b/Examples/test-suite/javascript/preproc_runme.js
new file mode 100644
index 000000000..669f9d1f0
--- /dev/null
+++ b/Examples/test-suite/javascript/preproc_runme.js
@@ -0,0 +1,14 @@
+var preproc = require("./preproc");
+
+if (preproc.endif != 1)
+ throw "RuntimeError";
+
+if (preproc.define != 1)
+ throw "RuntimeError";
+
+if (preproc.defined != 1)
+ throw "RuntimeError";
+
+if (2*preproc.one != preproc.two)
+ throw "RuntimeError";
+
diff --git a/Examples/test-suite/javascript/rename1_runme.js b/Examples/test-suite/javascript/rename1_runme.js
new file mode 100644
index 000000000..8374e6a89
--- /dev/null
+++ b/Examples/test-suite/javascript/rename1_runme.js
@@ -0,0 +1,68 @@
+var rename = require("./rename1");
+
+function part1() {
+ var xyz = new rename.XYZInt();
+ notxyz = new rename.NotXYZInt();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother2();
+ xyz.opT2();
+ xyz.tMethod2(0);
+ xyz.tMethodNotXYZ2(notxyz);
+ xyz.opNotXYZ2();
+ xyz.opXYZ2();
+}
+
+function part2() {
+ var xyz = new rename.XYZDouble();
+ var notxyz = new rename.NotXYZDouble();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother1();
+ xyz.opT1();
+ xyz.tMethod1(0);
+ xyz.tMethodNotXYZ1(notxyz);
+ xyz.opNotXYZ1();
+ xyz.opXYZ1();
+}
+
+function part3(){
+ var xyz = new rename.XYZKlass();
+ var notxyz = new rename.NotXYZKlass();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother3();
+ xyz.opT3();
+ xyz.tMethod3(new rename.Klass());
+ xyz.tMethodNotXYZ3(notxyz);
+ xyz.opNotXYZ3();
+ xyz.opXYZ3();
+}
+
+function part4() {
+ var xyz = new rename.XYZEnu();
+ var notxyz = new rename.NotXYZEnu();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother4();
+ xyz.opT4();
+ xyz.tMethod4(rename.En1);
+ xyz.tMethodNotXYZ4(notxyz);
+ xyz.opNotXYZ4();
+ xyz.opXYZ4();
+}
+
+function part5() {
+ var abc = new rename.ABC();
+ abc.methodABC(abc);
+ var k = new rename.Klass();
+ abc.methodKlass(k);
+ var a = abc.opABC();
+ k = abc.opKlass();
+}
+
+part1();
+part2();
+part3();
+part4();
+part5();
diff --git a/Examples/test-suite/javascript/rename2_runme.js b/Examples/test-suite/javascript/rename2_runme.js
new file mode 100644
index 000000000..bc6a95a59
--- /dev/null
+++ b/Examples/test-suite/javascript/rename2_runme.js
@@ -0,0 +1,68 @@
+var rename = require("./rename2");
+
+function part1() {
+ var xyz = new rename.XYZInt();
+ notxyz = new rename.NotXYZInt();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother2();
+ xyz.opT2();
+ xyz.tMethod2(0);
+ xyz.tMethodNotXYZ2(notxyz);
+ xyz.opNotXYZ2();
+ xyz.opXYZ2();
+}
+
+function part2() {
+ var xyz = new rename.XYZDouble();
+ var notxyz = new rename.NotXYZDouble();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother1();
+ xyz.opT1();
+ xyz.tMethod1(0);
+ xyz.tMethodNotXYZ1(notxyz);
+ xyz.opNotXYZ1();
+ xyz.opXYZ1();
+}
+
+function part3(){
+ var xyz = new rename.XYZKlass();
+ var notxyz = new rename.NotXYZKlass();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother3();
+ xyz.opT3();
+ xyz.tMethod3(new rename.Klass());
+ xyz.tMethodNotXYZ3(notxyz);
+ xyz.opNotXYZ3();
+ xyz.opXYZ3();
+}
+
+function part4() {
+ var xyz = new rename.XYZEnu();
+ var notxyz = new rename.NotXYZEnu();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother4();
+ xyz.opT4();
+ xyz.tMethod4(rename.En1);
+ xyz.tMethodNotXYZ4(notxyz);
+ xyz.opNotXYZ4();
+ xyz.opXYZ4();
+}
+
+function part5() {
+ var abc = new rename.ABC();
+ abc.methodABC(abc);
+ var k = new rename.Klass();
+ abc.methodKlass(k);
+ var a = abc.opABC();
+ k = abc.opKlass();
+}
+
+part1();
+part2();
+part3();
+part4();
+part5();
diff --git a/Examples/test-suite/javascript/rename3_runme.js b/Examples/test-suite/javascript/rename3_runme.js
new file mode 100644
index 000000000..9e57e80ea
--- /dev/null
+++ b/Examples/test-suite/javascript/rename3_runme.js
@@ -0,0 +1,68 @@
+var rename = require("./rename3");
+
+function part1() {
+ var xyz = new rename.XYZInt();
+ notxyz = new rename.NotXYZInt();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother2();
+ xyz.opT2();
+ xyz.tMethod2(0);
+ xyz.tMethodNotXYZ2(notxyz);
+ xyz.opNotXYZ2();
+ xyz.opXYZ2();
+}
+
+function part2() {
+ var xyz = new rename.XYZDouble();
+ var notxyz = new rename.NotXYZDouble();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother1();
+ xyz.opT1();
+ xyz.tMethod1(0);
+ xyz.tMethodNotXYZ1(notxyz);
+ xyz.opNotXYZ1();
+ xyz.opXYZ1();
+}
+
+function part3(){
+ var xyz = new rename.XYZKlass();
+ var notxyz = new rename.NotXYZKlass();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother3();
+ xyz.opT3();
+ xyz.tMethod3(new rename.Klass());
+ xyz.tMethodNotXYZ3(notxyz);
+ xyz.opNotXYZ3();
+ xyz.opXYZ3();
+}
+
+function part4() {
+ var xyz = new rename.XYZEnu();
+ var notxyz = new rename.NotXYZEnu();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother4();
+ xyz.opT4();
+ xyz.tMethod4(rename.En1);
+ xyz.tMethodNotXYZ4(notxyz);
+ xyz.opNotXYZ4();
+ xyz.opXYZ4();
+}
+
+function part5() {
+ var abc = new rename.ABC();
+ abc.methodABC(abc);
+ var k = new rename.Klass();
+ abc.methodKlass(k);
+ var a = abc.opABC();
+ k = abc.opKlass();
+}
+
+part1();
+part2();
+part3();
+part4();
+part5();
diff --git a/Examples/test-suite/javascript/rename4_runme.js b/Examples/test-suite/javascript/rename4_runme.js
new file mode 100644
index 000000000..d651fc7a1
--- /dev/null
+++ b/Examples/test-suite/javascript/rename4_runme.js
@@ -0,0 +1,68 @@
+var rename = require("./rename4");
+
+function part1() {
+ var xyz = new rename.XYZInt();
+ notxyz = new rename.NotXYZInt();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother2();
+ xyz.opT2();
+ xyz.tMethod2(0);
+ xyz.tMethodNotXYZ2(notxyz);
+ xyz.opNotXYZ2();
+ xyz.opXYZ2();
+}
+
+function part2() {
+ var xyz = new rename.XYZDouble();
+ var notxyz = new rename.NotXYZDouble();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother1();
+ xyz.opT1();
+ xyz.tMethod1(0);
+ xyz.tMethodNotXYZ1(notxyz);
+ xyz.opNotXYZ1();
+ xyz.opXYZ1();
+}
+
+function part3(){
+ var xyz = new rename.XYZKlass();
+ var notxyz = new rename.NotXYZKlass();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother3();
+ xyz.opT3();
+ xyz.tMethod3(new rename.Klass());
+ xyz.tMethodNotXYZ3(notxyz);
+ xyz.opNotXYZ3();
+ xyz.opXYZ3();
+}
+
+function part4() {
+ var xyz = new rename.XYZEnu();
+ var notxyz = new rename.NotXYZEnu();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother4();
+ xyz.opT4();
+ xyz.tMethod4(rename.En1);
+ xyz.tMethodNotXYZ4(notxyz);
+ xyz.opNotXYZ4();
+ xyz.opXYZ4();
+}
+
+function part5() {
+ var abc = new rename.ABC();
+ abc.methodABC(abc);
+ var k = new rename.Klass();
+ abc.methodKlass(k);
+ var a = abc.opABC();
+ k = abc.opKlass();
+}
+
+part1();
+part2();
+part3();
+part4();
+part5();
diff --git a/Examples/test-suite/javascript/rename_scope_runme.js b/Examples/test-suite/javascript/rename_scope_runme.js
new file mode 100644
index 000000000..c0226df69
--- /dev/null
+++ b/Examples/test-suite/javascript/rename_scope_runme.js
@@ -0,0 +1,17 @@
+var rename_scope = require("./rename_scope");
+
+var a = new rename_scope.Natural_UP();
+var b = new rename_scope.Natural_BP();
+
+if (a.rtest() !== 1) {
+ throw new Error("a.rtest(): Expected 1, was " + a.rtest());
+}
+
+if (b.rtest() !== 1) {
+ throw new Error("b.rtest(): Expected 1, was " + b.rtest());
+}
+
+var f = rename_scope.equals;
+if (f === undefined) {
+ throw new Error("Equality operator has not been renamed.");
+}
diff --git a/Examples/test-suite/javascript/rename_simple_runme.js b/Examples/test-suite/javascript/rename_simple_runme.js
new file mode 100644
index 000000000..918dd68a5
--- /dev/null
+++ b/Examples/test-suite/javascript/rename_simple_runme.js
@@ -0,0 +1,50 @@
+var rename_simple = require("./rename_simple");
+var NewStruct = rename_simple.NewStruct;
+
+var s = new NewStruct();
+
+// renamed instance variable
+if (s.NewInstanceVariable !== 111) {
+ throw new Error("NewInstanceVariable: Expected 111, was " + s.NewInstanceVariable);
+}
+
+// renamed instance method
+if (s.NewInstanceMethod() !== 222) {
+ throw new Error("NewInstanceMethod(): Expected 222, was " + s.NewInstanceMethod());
+}
+
+// renamed static method
+if (NewStruct.NewStaticMethod() !== 333) {
+ throw new Error("NewInstanceMethod(): Expected 333, was " + NewStruct.NewStaticMethod());
+}
+
+// renamed static variable
+if (NewStruct.NewStaticVariable !== 444) {
+ throw new Error("NewInstanceMethod(): Expected 444, was " + NewStruct.NewStaticVariable);
+}
+
+// renamed global function
+if (rename_simple.NewFunction() !== 555) {
+ throw new Error("rename_simple.NewFunction(): Expected 555, was " + rename_simple.NewFunction());
+}
+
+// renamed global variable
+if (rename_simple.NewGlobalVariable !== 666) {
+ throw new Error("rename_simple.NewGlobalVariable: Expected 666, was " + rename_simple.NewGlobalVariable);
+}
+
+// setting renamed variables
+s.NewInstanceVariable = 1111;
+if (s.NewInstanceVariable !== 1111) {
+ throw new Error("NewInstanceVariable: Expected 1111, was " + s.NewInstanceVariable);
+}
+
+NewStruct.NewStaticVariable = 4444;
+if (NewStruct.NewStaticVariable !== 4444) {
+ throw new Error("NewInstanceMethod(): Expected 4444, was " + NewStruct.NewStaticVariable);
+}
+
+rename_simple.NewGlobalVariable = 6666;
+if (rename_simple.NewGlobalVariable !== 6666) {
+ throw new Error("rename_simple.NewGlobalVariable: Expected 6666, was " + rename_simple.NewGlobalVariable);
+}
diff --git a/Examples/test-suite/javascript/ret_by_value_runme.js b/Examples/test-suite/javascript/ret_by_value_runme.js
new file mode 100644
index 000000000..d9a77a20b
--- /dev/null
+++ b/Examples/test-suite/javascript/ret_by_value_runme.js
@@ -0,0 +1,8 @@
+var ret_by_value = require("./ret_by_value");
+
+a = ret_by_value.get_test();
+if (a.myInt != 100)
+ throw "RuntimeError";
+
+if (a.myShort != 200)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/setup_test.sh b/Examples/test-suite/javascript/setup_test.sh
new file mode 100644
index 000000000..913a74c4b
--- /dev/null
+++ b/Examples/test-suite/javascript/setup_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+if [ ! -d $1 ]; then
+ mkdir $1;
+fi
+sed -e "s/\$testcase/$1/" -e "s/\$cflags/$2/" < node_template/binding.gyp.in > $1/binding.gyp
+sed s/\$testcase/$1/ node_template/index.js.in > $1/index.js
diff --git a/Examples/test-suite/javascript/string_simple_runme.js b/Examples/test-suite/javascript/string_simple_runme.js
new file mode 100644
index 000000000..dbdd4136d
--- /dev/null
+++ b/Examples/test-suite/javascript/string_simple_runme.js
@@ -0,0 +1,10 @@
+var string_simple = require("./string_simple");
+
+// Test unicode string
+var str = "olé";
+
+var copy = string_simple.copy_string(str);
+
+if (str !== copy) {
+ throw "Error: copy is not equal: original="+str+", copy="+copy;
+}
diff --git a/Examples/test-suite/javascript/struct_value_runme.js b/Examples/test-suite/javascript/struct_value_runme.js
new file mode 100644
index 000000000..d6b26f726
--- /dev/null
+++ b/Examples/test-suite/javascript/struct_value_runme.js
@@ -0,0 +1,11 @@
+var struct_value = require("./struct_value");
+
+b = new struct_value.Bar();
+
+b.a.x = 3;
+if (b.a.x != 3)
+throw "RuntimeError";
+
+b.b.x = 3;
+if (b.b.x != 3)
+throw "RuntimeError"
diff --git a/Examples/test-suite/javascript/template_static_runme.js b/Examples/test-suite/javascript/template_static_runme.js
new file mode 100644
index 000000000..477d97249
--- /dev/null
+++ b/Examples/test-suite/javascript/template_static_runme.js
@@ -0,0 +1,3 @@
+var template_static = require("./template_static");
+
+template_static.Foo.bar_double(1);
diff --git a/Examples/test-suite/javascript/typedef_class_runme.js b/Examples/test-suite/javascript/typedef_class_runme.js
new file mode 100644
index 000000000..3e4dc9093
--- /dev/null
+++ b/Examples/test-suite/javascript/typedef_class_runme.js
@@ -0,0 +1,7 @@
+var typedef_class = require("./typedef_class");
+
+a = new typedef_class.RealA();
+a.a = 3;
+
+b = new typedef_class.B();
+b.testA(a);
diff --git a/Examples/test-suite/javascript/typedef_inherit_runme.js b/Examples/test-suite/javascript/typedef_inherit_runme.js
new file mode 100644
index 000000000..4abcc2536
--- /dev/null
+++ b/Examples/test-suite/javascript/typedef_inherit_runme.js
@@ -0,0 +1,23 @@
+var typedef_inherit = require("./typedef_inherit");
+
+a = new typedef_inherit.Foo();
+b = new typedef_inherit.Bar();
+
+x = typedef_inherit.do_blah(a);
+if (x != "Foo::blah")
+ print("Whoa! Bad return" + x);
+
+x = typedef_inherit.do_blah(b);
+if (x != "Bar::blah")
+ print("Whoa! Bad return" + x);
+
+c = new typedef_inherit.Spam();
+d = new typedef_inherit.Grok();
+
+x = typedef_inherit.do_blah2(c);
+if (x != "Spam::blah")
+ print("Whoa! Bad return" + x);
+
+x = typedef_inherit.do_blah2(d);
+if (x != "Grok::blah")
+ print ("Whoa! Bad return" + x);
diff --git a/Examples/test-suite/javascript/typedef_scope_runme.js b/Examples/test-suite/javascript/typedef_scope_runme.js
new file mode 100644
index 000000000..0ac56884c
--- /dev/null
+++ b/Examples/test-suite/javascript/typedef_scope_runme.js
@@ -0,0 +1,12 @@
+var typedef_scope = require("./typedef_scope");
+
+b = new typedef_scope.Bar();
+x = b.test1(42,"hello");
+if (x != 42)
+ print("Failed!!");
+
+x = b.test2(42,"hello");
+if (x != "hello")
+ print("Failed!!");
+
+
diff --git a/Examples/test-suite/javascript/typemap_arrays_runme.js b/Examples/test-suite/javascript/typemap_arrays_runme.js
new file mode 100644
index 000000000..cd6827ac9
--- /dev/null
+++ b/Examples/test-suite/javascript/typemap_arrays_runme.js
@@ -0,0 +1,5 @@
+var typemap_arrays = require("./typemap_arrays");
+
+if (typemap_arrays.sumA(null) != 60)
+ throw "RuntimeError, Sum is wrong";
+
diff --git a/Examples/test-suite/javascript/typemap_delete_runme.js b/Examples/test-suite/javascript/typemap_delete_runme.js
new file mode 100644
index 000000000..4b3174956
--- /dev/null
+++ b/Examples/test-suite/javascript/typemap_delete_runme.js
@@ -0,0 +1,5 @@
+var typemap_delete = require("./typemap_delete");
+
+r = new typemap_delete.Rect(123);
+if (r.val != 123)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/typemap_namespace_runme.js b/Examples/test-suite/javascript/typemap_namespace_runme.js
new file mode 100644
index 000000000..614e0ffeb
--- /dev/null
+++ b/Examples/test-suite/javascript/typemap_namespace_runme.js
@@ -0,0 +1,7 @@
+var typemap_namespace = require("./typemap_namespace");
+
+if (typemap_namespace.test1("hello") != "hello")
+ throw "RuntimeError";
+
+if (typemap_namespace.test2("hello") != "hello")
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/typemap_ns_using_runme.js b/Examples/test-suite/javascript/typemap_ns_using_runme.js
new file mode 100644
index 000000000..9115c16ae
--- /dev/null
+++ b/Examples/test-suite/javascript/typemap_ns_using_runme.js
@@ -0,0 +1,4 @@
+var typemap_ns_using = require("./typemap_ns_using");
+
+if (typemap_ns_using.spam(37) != 37)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/using1_runme.js b/Examples/test-suite/javascript/using1_runme.js
new file mode 100644
index 000000000..a2e37fcb6
--- /dev/null
+++ b/Examples/test-suite/javascript/using1_runme.js
@@ -0,0 +1,4 @@
+var using1 = require("./using1");
+
+if (using1.spam(37) != 37)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/using2_runme.js b/Examples/test-suite/javascript/using2_runme.js
new file mode 100644
index 000000000..aa5e9b15f
--- /dev/null
+++ b/Examples/test-suite/javascript/using2_runme.js
@@ -0,0 +1,4 @@
+var using2 = require("./using2");
+
+if (using2.spam(37) != 37)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/varargs_runme.js b/Examples/test-suite/javascript/varargs_runme.js
new file mode 100644
index 000000000..69d761e63
--- /dev/null
+++ b/Examples/test-suite/javascript/varargs_runme.js
@@ -0,0 +1,44 @@
+var varargs = require("./varargs");
+
+if (varargs.test("Hello") != "Hello") {
+ throw new Error("Failed");
+}
+
+var f = new varargs.Foo("Greetings")
+if (f.str != "Greetings") {
+ throw new Error("Failed");
+}
+
+if (f.test("Hello") != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_def("Hello",1) != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_def("Hello") != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_plenty("Hello") != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_plenty("Hello", 1) != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_plenty("Hello", 1, 2) != "Hello") {
+ throw new Error("Failed");
+}
+
+var thrown = false;
+try {
+ varargs.test_plenty("Hello", 1, 2, 3);
+} catch (err) {
+ thrown = true;
+}
+if (!thrown) {
+ throw new Error("Failed");
+}
diff --git a/Examples/test-suite/lua/cpp_basic_runme.lua b/Examples/test-suite/lua/cpp_basic_runme.lua
index 8a72f1bad..c7e0325c5 100644
--- a/Examples/test-suite/lua/cpp_basic_runme.lua
+++ b/Examples/test-suite/lua/cpp_basic_runme.lua
@@ -76,3 +76,13 @@ assert(cb.test_func_ptr(f,2)==-8)
-- Test that __tostring metamethod produce no internal asserts
f2_name = tostring(f2)
+
+f3 = cb.FooSub()
+f3_name = tostring(f3)
+
+f4 = cb.FooSubSub()
+f4_name = tostring(f4)
+
+assert( f2_name == "Foo" )
+assert( f3_name == "Foo" )
+assert( f4_name == "FooSubSub" )
diff --git a/Examples/test-suite/lua/operator_overload_runme.lua b/Examples/test-suite/lua/operator_overload_runme.lua
index 983daa1e5..5ba06ff08 100644
--- a/Examples/test-suite/lua/operator_overload_runme.lua
+++ b/Examples/test-suite/lua/operator_overload_runme.lua
@@ -78,6 +78,38 @@ assert(i(1,2)==6)
assert(tostring(Op(1))=="Op(1)")
assert(tostring(Op(-3))=="Op(-3)")
+
+-- check that operator overloads are correctly propogated down inheritance hierarchy
+
+a_d=OpDerived()
+b_d=OpDerived(5)
+c_d=OpDerived(5)
+d_d=OpDerived(2)
+-- test equality
+assert(a_d~=b_d)
+assert(b_d==c_d)
+assert(a_d~=d_d)
+
+-- test <
+assert(a_d<b_d)
+assert(a_d<=b_d)
+assert(b_d<=c_d)
+assert(b_d>=c_d)
+assert(b_d>d_d)
+assert(b_d>=d_d)
+--
+-- test + inheritance
+f_d=OpDerived(1)
+g_d=OpDerived(1)
+assert(f_d+g_d==Op(2))
+assert(f_d-g_d==Op(0))
+assert(f_d*g_d==Op(1))
+assert(f_d/g_d==Op(1))
+--
+-- plus add some code to check the __str__ fn inheritance
+assert(tostring(OpDerived(1))=="Op(1)")
+assert(tostring(OpDerived(-3))=="Op(-3)")
+
--[[
/* Sample test code in C++
diff --git a/Examples/test-suite/nspace.i b/Examples/test-suite/nspace.i
index 1520b3652..25e7104b2 100644
--- a/Examples/test-suite/nspace.i
+++ b/Examples/test-suite/nspace.i
@@ -2,7 +2,7 @@
%module nspace
// nspace feature only supported by these languages
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
#if defined(SWIGJAVA)
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
diff --git a/Examples/test-suite/nspace_extend.i b/Examples/test-suite/nspace_extend.i
index e92ff8c1d..2f7c6fbe1 100644
--- a/Examples/test-suite/nspace_extend.i
+++ b/Examples/test-suite/nspace_extend.i
@@ -2,7 +2,7 @@
%module nspace_extend
// nspace feature only supported by these languages
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
#if defined(SWIGJAVA)
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
diff --git a/Examples/test-suite/operator_overload.i b/Examples/test-suite/operator_overload.i
index 006662109..061e7024c 100644
--- a/Examples/test-suite/operator_overload.i
+++ b/Examples/test-suite/operator_overload.i
@@ -230,10 +230,10 @@ __rshift__,__lshift__ >>,<<
__getitem__,__setitem__ for operator[]
-Operators overloaded without C++ equivilents
+Operators overloaded without C++ equivalents
__pow__ for power operator
__str__ converts object to a string (should return a const char*)
-__concat__ for contatenation (if language supports)
+__concat__ for concatenation (if language supports)
*/
diff --git a/Examples/test-suite/php/arrays_runme.php b/Examples/test-suite/php/arrays_runme.php
index 23490e61e..ae17d05e7 100644
--- a/Examples/test-suite/php/arrays_runme.php
+++ b/Examples/test-suite/php/arrays_runme.php
@@ -12,6 +12,7 @@ check::classname(simplestruct,$ss);
$as=new arraystruct();
$as->array_c="abc";
check::equal($as->array_c,"a",'$as->array_c=="a"');
+check::equal(isset($as->array_const_i),TRUE,'isset($as->array_const_i)');
check::done();
?>
diff --git a/Examples/test-suite/string_simple.i b/Examples/test-suite/string_simple.i
new file mode 100644
index 000000000..c319aa1ef
--- /dev/null
+++ b/Examples/test-suite/string_simple.i
@@ -0,0 +1,13 @@
+%module string_simple
+
+%newobject copy_string;
+
+%inline %{
+#include <string.h>
+const char* copy_string(const char* str) {
+ size_t len = strlen(str);
+ char* newstring = (char*) malloc(len + 1);
+ strcpy(newstring, str);
+ return newstring;
+}
+%}