Merge branch 'sjml-patch-1-lua-print'
* sjml-patch-1-lua-print:
removing unnecessary bits
closer match to Python's output
typo
actually seeing both is useful
matching code conventions
Lua userdata print pointing to wrapped memory
diff --git a/CHANGES.current b/CHANGES.current
index dca51c3..53c4097 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,6 +7,72 @@
Version 4.0.1 (in progress)
===========================
+2019-08-08: rokups
+ [C#, Java] #1601 Fix invalid code generated for "%constant enum EnumType.
+
+2019-08-07: wsfulton
+ [Python] Fix method overloading of methods that take STL containers of different
+ types. The following usage (using std::vector) would fail when using -builtin:
+
+ %include <std_string.i>
+ %include <std_vector.i>
+
+ %inline %{
+ struct X {};
+ %}
+
+ %template(VectorX) std::vector<X>;
+ %template(VectorInt) std::vector<int>;
+
+ %inline %{
+ using namespace std;
+ string VectorOverload(vector<X> v);
+ string VectorOverload(vector<int> v);
+ %}
+
+ The following would incorrectly fail:
+
+ s = VectorOverload([1, 2, 3])
+
+ With:
+
+ Traceback (most recent call last):
+ File "runme3.py", line 20, in <module>
+ ret = VectorOverload([1, 2, 3])
+ TypeError: Wrong number or type of arguments for overloaded function 'VectorOverload'.
+ Possible C/C++ prototypes are:
+ VectorOverload(std::vector< Number,std::allocator< Number > >)
+ VectorOverload(std::vector< int,std::allocator< int > >)
+
+ The problem was due to some error handling that was not cleared during typehecking.
+ In this case an error was not cleared when the elements in the list failed the
+ typecheck for converting to X. Only occurs in Python 3+.
+
+ In some combinations of overloaded methods, the following type of error message would
+ occur:
+
+ RuntimeError: in sequence element 0
+
+ The above exception was the direct cause of the following exception:
+
+ Traceback (most recent call last):
+ File "runme3.py", line 23, in <module>
+ check(VectorOverload(v), "vector<X>")
+ SystemError: <built-in function VectorOverload> returned a result with an error set
+
+2019-08-01: wsfulton
+ #1602 Fix regression in 4.0.0 where a template function containing a parameter
+ with the same name as the function name led to the parameter name used in the
+ target language being incorrectly modified.
+
+2019-07-29: wsfulton
+ Remove all generated files on error. Previously generated files were not removed,
+ potentially breaking Makefiles using file dependencies, especially when -Werror
+ (warnings as errors) was used.
+
+2019-07-23: smithx
+ [C#] #1530 #1532 Fix marshalling of std::wstring to C#.
+
2019-07-18: gicmo
[Python] #1587 Python 3.8 support - remove use of deprecated PyObject_GC_UnTrack.
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index d1492d3..aec48ef 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -3438,6 +3438,18 @@
%}
</pre></div>
+<p>
+Please note that some language backends (e.g. C# or Java) don't have any
+initialization function, hence you should define a global object performing
+the necessary initialization for them instead:
+</p>
+
+<div class="code"><pre>
+%init %{
+ static struct MyInit { MyInit() { init_variables(); } } myInit;
+%}
+</pre></div>
+
<H2><a name="SWIG_nn45">5.7 An Interface Building Strategy</a></H2>
diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html
index 8a31dbf..0bacd39 100644
--- a/Doc/Manual/Typemaps.html
+++ b/Doc/Manual/Typemaps.html
@@ -4630,37 +4630,69 @@
<pre>
Symbolic Name Precedence Value
------------------------------ ------------------
-SWIG_TYPECHECK_POINTER 0
-SWIG_TYPECHECK_VOIDPTR 10
-SWIG_TYPECHECK_BOOL 15
-SWIG_TYPECHECK_UINT8 20
-SWIG_TYPECHECK_INT8 25
-SWIG_TYPECHECK_UINT16 30
-SWIG_TYPECHECK_INT16 35
-SWIG_TYPECHECK_UINT32 40
-SWIG_TYPECHECK_INT32 45
-SWIG_TYPECHECK_UINT64 50
-SWIG_TYPECHECK_INT64 55
-SWIG_TYPECHECK_UINT128 60
-SWIG_TYPECHECK_INT128 65
-SWIG_TYPECHECK_INTEGER 70
-SWIG_TYPECHECK_FLOAT 80
-SWIG_TYPECHECK_DOUBLE 90
-SWIG_TYPECHECK_COMPLEX 100
-SWIG_TYPECHECK_UNICHAR 110
-SWIG_TYPECHECK_UNISTRING 120
-SWIG_TYPECHECK_CHAR 130
-SWIG_TYPECHECK_STRING 140
-SWIG_TYPECHECK_BOOL_ARRAY 1015
-SWIG_TYPECHECK_INT8_ARRAY 1025
-SWIG_TYPECHECK_INT16_ARRAY 1035
-SWIG_TYPECHECK_INT32_ARRAY 1045
-SWIG_TYPECHECK_INT64_ARRAY 1055
-SWIG_TYPECHECK_INT128_ARRAY 1065
-SWIG_TYPECHECK_FLOAT_ARRAY 1080
-SWIG_TYPECHECK_DOUBLE_ARRAY 1090
-SWIG_TYPECHECK_CHAR_ARRAY 1130
-SWIG_TYPECHECK_STRING_ARRAY 1140
+SWIG_TYPECHECK_POINTER 0
+SWIG_TYPECHECK_ITERATOR 5
+SWIG_TYPECHECK_VOIDPTR 10
+SWIG_TYPECHECK_BOOL 15
+SWIG_TYPECHECK_UINT8 20
+SWIG_TYPECHECK_INT8 25
+SWIG_TYPECHECK_UINT16 30
+SWIG_TYPECHECK_INT16 35
+SWIG_TYPECHECK_UINT32 40
+SWIG_TYPECHECK_INT32 45
+SWIG_TYPECHECK_SIZE 47
+SWIG_TYPECHECK_PTRDIFF 48
+SWIG_TYPECHECK_UINT64 50
+SWIG_TYPECHECK_INT64 55
+SWIG_TYPECHECK_UINT128 60
+SWIG_TYPECHECK_INT128 65
+SWIG_TYPECHECK_INTEGER 70
+SWIG_TYPECHECK_FLOAT 80
+SWIG_TYPECHECK_DOUBLE 90
+SWIG_TYPECHECK_CPLXFLT 95
+SWIG_TYPECHECK_CPLXDBL 100
+SWIG_TYPECHECK_COMPLEX 105
+SWIG_TYPECHECK_UNICHAR 110
+SWIG_TYPECHECK_STDUNISTRING 115
+SWIG_TYPECHECK_UNISTRING 120
+SWIG_TYPECHECK_CHAR 130
+SWIG_TYPECHECK_STDSTRING 135
+SWIG_TYPECHECK_STRING 140
+SWIG_TYPECHECK_PAIR 150
+SWIG_TYPECHECK_STDARRAY 155
+SWIG_TYPECHECK_VECTOR 160
+SWIG_TYPECHECK_DEQUE 170
+SWIG_TYPECHECK_LIST 180
+SWIG_TYPECHECK_SET 190
+SWIG_TYPECHECK_MULTISET 200
+SWIG_TYPECHECK_MAP 210
+SWIG_TYPECHECK_MULTIMAP 220
+SWIG_TYPECHECK_STACK 230
+SWIG_TYPECHECK_QUEUE 240
+SWIG_TYPECHECK_BOOL_ARRAY 1015
+SWIG_TYPECHECK_INT8_ARRAY 1025
+SWIG_TYPECHECK_INT16_ARRAY 1035
+SWIG_TYPECHECK_INT32_ARRAY 1045
+SWIG_TYPECHECK_INT64_ARRAY 1055
+SWIG_TYPECHECK_INT128_ARRAY 1065
+SWIG_TYPECHECK_FLOAT_ARRAY 1080
+SWIG_TYPECHECK_DOUBLE_ARRAY 1090
+SWIG_TYPECHECK_CHAR_ARRAY 1130
+SWIG_TYPECHECK_STRING_ARRAY 1140
+SWIG_TYPECHECK_OBJECT_ARRAY 1150
+SWIG_TYPECHECK_BOOL_PTR 2015
+SWIG_TYPECHECK_UINT8_PTR 2020
+SWIG_TYPECHECK_INT8_PTR 2025
+SWIG_TYPECHECK_UINT16_PTR 2030
+SWIG_TYPECHECK_INT16_PTR 2035
+SWIG_TYPECHECK_UINT32_PTR 2040
+SWIG_TYPECHECK_INT32_PTR 2045
+SWIG_TYPECHECK_UINT64_PTR 2050
+SWIG_TYPECHECK_INT64_PTR 2055
+SWIG_TYPECHECK_FLOAT_PTR 2080
+SWIG_TYPECHECK_DOUBLE_PTR 2090
+SWIG_TYPECHECK_CHAR_PTR 2130
+SWIG_TYPECHECK_SWIGOBJECT 5000
</pre>
</div>
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 98be787..6fbca29 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -1436,34 +1436,20 @@
GO = @GO@
GOGCC = @GOGCC@
GCCGO = @GCCGO@
-GO1 = @GO1@
-GO12 = @GO12@
-GO13 = @GO13@
-GO15 = @GO15@
-GOC = @GOC@
GOOPT = @GOOPT@
GCCGOOPT = @GCCGOOPT@
GOVERSIONOPTION = @GOVERSIONOPTION@
GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
-GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) || $(GO15); then echo -pack ; fi`
GOSRCS = $(INTERFACE:.i=.go)
GOCSRCS = $(INTERFACE:.i=_gc.c)
-GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
-GOTOOL = `if $(GO1) ; then echo go tool; fi`
-GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-
GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
GOPATHPARENTDIR = gopath/$(GOMOD)/src
GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
-GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
-GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
-GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
-
# ----------------------------------------------------------------
# Build a Go module (C)
# ----------------------------------------------------------------
@@ -1478,49 +1464,13 @@
echo "go 1.12" >> $(GOPATHDIR)/go.mod
mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod
-go_nocgo: $(SRCDIR_SRCS)
- $(SWIG) -go -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
- $(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
- else \
- $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
- fi
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c -I . $(GOSRCS); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS); \
- $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} $(GOCSRCS); \
- rm -f $(GOPACKAGE); \
- if $(GO13) || $(GO15); then \
- cp $(GOGCOBJS) $(GOPACKAGE); \
- $(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- elif $(GO12); then \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- else \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
- fi; \
- fi
- if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
- fi
-
go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
$(SWIG) -go -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
@mkdir gopath 2>/dev/null || true
@mkdir gopath/$(GOMOD) 2>/dev/null || true
@mkdir gopath/$(GOMOD)/src 2>/dev/null || true
@mkdir $(GOPATHDIR) 2>/dev/null || true
- rm -f $(GOPATHDIR)/*
+ rm -rf $(GOPATHDIR)/*
cp $(ISRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@@ -1529,6 +1479,13 @@
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
+ @if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+ rm -f gopath/$(GOMOD)/src/runme/*; \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+ fi
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
@@ -1537,82 +1494,29 @@
export CGO_CFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
- (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
+ (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
if $(GOGCC); then \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
- fi
+ fi; \
if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE); \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
+ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
# ----------------------------------------------------------------
# Build a Go module (C++)
# ----------------------------------------------------------------
-go_cpp_nocgo: $(SRCDIR_SRCS)
- $(SWIG) -go -c++ -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
- if test -n "$(SRCDIR_CXXSRCS)$(SRCDIR_SRCS)"; then \
- $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_CXXSRCS) $(SRCDIR_SRCS) $(INCLUDES); \
- fi; \
- $(foreach f,$(ICXXSRCS), \
- $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) -o $(addsuffix .@OBJEXT@,$(basename $f)) $f $(INCLUDES); \
- ) \
- else \
- $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
- fi
- if ! $(GOGCC) ; then \
- $(foreach f,$(GOSRCS), \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f \
- ); \
- $(foreach f,$(GOCSRCS), \
- $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} \
- -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f; \
- ) \
- rm -f $(GOPACKAGE); \
- if $(GO13) || $(GO15); then \
- cp $(GOGCOBJS) $(GOPACKAGE); \
- $(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- elif $(GO12); then \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- else \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
- fi; \
- else \
- $(foreach f,$(GOSRCS), \
- $(COMPILETOOL) $(GCCGO) -g -c -I . -o $(addsuffix .@OBJEXT@,$(basename $f)) $f \
- ); \
- fi
- if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
- fi
-
go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
$(SWIG) -go -c++ -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
@mkdir gopath 2>/dev/null || true
@mkdir gopath/$(GOMOD) 2>/dev/null || true
@mkdir gopath/$(GOMOD)/src 2>/dev/null || true
@mkdir $(GOPATHDIR) 2>/dev/null || true
- rm -f $(GOPATHDIR)/*
+ rm -rf $(GOPATHDIR)/*
cp $(ICXXSRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@@ -1624,6 +1528,13 @@
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
+ @if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+ rm -f gopath/$(GOMOD)/src/runme/*; \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+ fi
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
@@ -1634,21 +1545,16 @@
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
- (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
+ (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
if $(GOGCC); then \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
- fi
+ fi; \
if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE) -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
+ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
# -----------------------------------------------------------------
diff --git a/Examples/go/callback/runme.go b/Examples/go/callback/runme.go
index 2c1d813..7c9ffd6 100644
--- a/Examples/go/callback/runme.go
+++ b/Examples/go/callback/runme.go
@@ -3,7 +3,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/class/runme.go b/Examples/go/class/runme.go
index d2f292e..a09a182 100644
--- a/Examples/go/class/runme.go
+++ b/Examples/go/class/runme.go
@@ -5,7 +5,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/constants/runme.go b/Examples/go/constants/runme.go
index d56fd62..57ef21a 100644
--- a/Examples/go/constants/runme.go
+++ b/Examples/go/constants/runme.go
@@ -3,7 +3,7 @@
import (
"fmt"
- "example"
+ "swigtests/example"
)
func main() {
diff --git a/Examples/go/director/runme.go b/Examples/go/director/runme.go
index 0e0da07..e28eccb 100644
--- a/Examples/go/director/runme.go
+++ b/Examples/go/director/runme.go
@@ -4,7 +4,7 @@
"fmt"
"os"
- "example"
+ "swigtests/example"
)
func Compare(name string, got string, exp string) error {
diff --git a/Examples/go/enum/runme.go b/Examples/go/enum/runme.go
index 5088705..c0642e0 100644
--- a/Examples/go/enum/runme.go
+++ b/Examples/go/enum/runme.go
@@ -3,7 +3,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/extend/runme.go b/Examples/go/extend/runme.go
index af64a6e..716af52 100644
--- a/Examples/go/extend/runme.go
+++ b/Examples/go/extend/runme.go
@@ -5,7 +5,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/funcptr/runme.go b/Examples/go/funcptr/runme.go
index 4b20db4..87ec7d4 100644
--- a/Examples/go/funcptr/runme.go
+++ b/Examples/go/funcptr/runme.go
@@ -3,7 +3,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/multimap/runme.go b/Examples/go/multimap/runme.go
index 571fac7..2f8b205 100644
--- a/Examples/go/multimap/runme.go
+++ b/Examples/go/multimap/runme.go
@@ -3,7 +3,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/pointer/runme.go b/Examples/go/pointer/runme.go
index 0cf340f..73c6b2b 100644
--- a/Examples/go/pointer/runme.go
+++ b/Examples/go/pointer/runme.go
@@ -3,7 +3,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/reference/runme.go b/Examples/go/reference/runme.go
index 9999733..7391d9c 100644
--- a/Examples/go/reference/runme.go
+++ b/Examples/go/reference/runme.go
@@ -5,7 +5,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/simple/runme.go b/Examples/go/simple/runme.go
index 0bd4657..5bc055f 100644
--- a/Examples/go/simple/runme.go
+++ b/Examples/go/simple/runme.go
@@ -3,7 +3,7 @@
import (
"fmt"
- "example"
+ "swigtests/example"
)
func main() {
diff --git a/Examples/go/template/runme.go b/Examples/go/template/runme.go
index 3477953..e000b15 100644
--- a/Examples/go/template/runme.go
+++ b/Examples/go/template/runme.go
@@ -5,7 +5,7 @@
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/variables/runme.go b/Examples/go/variables/runme.go
index e2dd0c6..85ca8c6 100644
--- a/Examples/go/variables/runme.go
+++ b/Examples/go/variables/runme.go
@@ -5,7 +5,7 @@
import (
"fmt"
- "example"
+ "swigtests/example"
)
func main() {
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 7425362..5f77928 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -643,6 +643,7 @@
director_string \
ignore_template_constructor \
li_std_combinations \
+ li_std_containers_overload \
li_std_deque \
li_std_except \
li_std_except_as_class \
@@ -655,6 +656,7 @@
li_std_vector_enum \
li_std_vector_member_var\
li_std_vector_ptr \
+ li_std_wstring \
smart_pointer_inherit \
template_typedef_fnc \
template_type_namespace \
diff --git a/Examples/test-suite/constant_directive.i b/Examples/test-suite/constant_directive.i
index b102ffe..3e4775d 100644
--- a/Examples/test-suite/constant_directive.i
+++ b/Examples/test-suite/constant_directive.i
@@ -14,6 +14,11 @@
Type1(int val = 0) : val(val) {}
int val;
};
+enum EnumType
+{
+ EnumValue
+};
+EnumType enumValue = EnumValue;
/* Typedefs for const Type and its pointer */
typedef const Type1 Type1Const;
typedef const Type1* Type1Cptr;
@@ -46,3 +51,4 @@
%constant Type1Cfptr TYPE1CFPTR1DEF_CONSTANT1 = getType1Instance;
/* Regular constant */
%constant int TYPE_INT = 0;
+%constant enum EnumType newValue = enumValue;
diff --git a/Examples/test-suite/csharp/li_std_wstring_runme.cs b/Examples/test-suite/csharp/li_std_wstring_runme.cs
index fe663a3..8b7ba1b 100644
--- a/Examples/test-suite/csharp/li_std_wstring_runme.cs
+++ b/Examples/test-suite/csharp/li_std_wstring_runme.cs
@@ -3,74 +3,116 @@
public class runme
{
+ static private void check_equal(char a, char b)
+ {
+ if (a != b)
+ throw new Exception("char failed '" + a + "' != '" + b + "'");
+ }
+
+ static private void check_equal(string a, string b)
+ {
+ if (a != b)
+ throw new Exception("string failed '" + a + "' != '" + b + "'");
+ }
+
static void Main()
{
- char y='h';
+ char h = 'h';
+ check_equal(li_std_wstring.test_wcvalue(h), h);
- if (li_std_wstring.test_wcvalue(y) != y)
- throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue(y));
+ string x = "abc";
+ check_equal(li_std_wstring.test_ccvalue(x), x);
+ check_equal(li_std_wstring.test_cvalue(x), x);
- if (li_std_wstring.test_wcvalue_w() != 'W')
- throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue_w());
+ check_equal(li_std_wstring.test_wchar_overload(x), x);
+ check_equal(li_std_wstring.test_wchar_overload(), null);
- string x="hello";
+ li_std_wstring.test_pointer(null);
+ li_std_wstring.test_const_pointer(null);
- if (li_std_wstring.test_ccvalue(x) != x)
- throw new Exception("bad string mapping");
+ try {
+ li_std_wstring.test_value(null);
+ throw new Exception("NULL check failed");
+ } catch (ArgumentNullException) {
+ }
- if (li_std_wstring.test_cvalue(x) != x)
- throw new Exception("bad string mapping");
+ try {
+ li_std_wstring.test_reference(null);
+ throw new Exception("NULL check failed");
+ } catch (ArgumentNullException e) {
+ if (!e.Message.Contains("type is null"))
+ throw new Exception("Missing text " + e);
+ }
+ try {
+ li_std_wstring.test_const_reference(null);
+ throw new Exception("NULL check failed");
+ } catch (ArgumentNullException e) {
+ if (!e.Message.Contains("null wstring"))
+ throw new Exception("Missing text " + e);
+ }
+ x = "hello";
+ check_equal(li_std_wstring.test_const_reference(x), x);
- if (li_std_wstring.test_value(x) != x)
- throw new Exception("bad string mapping: " + x + li_std_wstring.test_value(x));
+ /* Postpone, tricky, std::wstring portability problem.
+ * std::wstring is 2 bytes on Windows, 4 bytes on Linux, LPWSTR is 2 bytes.
+ * .NET marshalling should work on Windows but not Linux.
+ string s = "abc";
+ if (!li_std_wstring.test_equal_abc(s))
+ throw new Exception("Not equal " + s);
+ */
- if (li_std_wstring.test_const_reference(x) != x)
- throw new Exception("bad string mapping");
+ try {
+ li_std_wstring.test_throw();
+ } catch (Exception e) {
+ check_equal(e.Message, "throwing test_throw");
+ }
+ x = "abc\0def";
+ // Unlike other languages, embedded NULL in std::string not supported
+ // check_equal(li_std_wstring.test_value(x), x);
+ check_equal(li_std_wstring.test_value(x), "abc");
+ check_equal(li_std_wstring.test_ccvalue(x), "abc");
+ check_equal(li_std_wstring.test_wchar_overload(x), "abc");
- string s = "he";
- s = s + "llo";
+ {
+ // Unicode strings
+ string[] test_strings = {
+ "JP: 日本語", "DE: Kröpeliner Straße" , "RU: Война и мир", "EN: War and Peace"
+ };
- if (s != x)
- throw new Exception("bad string mapping: " + s + x);
+ foreach (string expected in test_strings)
+ {
+ string received = li_std_wstring.test_value(expected);
+ check_equal(received, expected);
+ }
- if (li_std_wstring.test_value(s) != x)
- throw new Exception("bad string mapping");
+ foreach (string expected in test_strings)
+ {
+ string received = li_std_wstring.test_const_reference(expected);
+ check_equal(received, expected);
+ }
- if (li_std_wstring.test_const_reference(s) != x)
- throw new Exception("bad string mapping");
+ foreach (string expected in test_strings)
+ {
+ string received = li_std_wstring.test_ccvalue(expected);
+ check_equal(received, expected);
+ }
- string a = s;
-
- if (li_std_wstring.test_value(a) != x)
- throw new Exception("bad string mapping");
-
- if (li_std_wstring.test_const_reference(a) != x)
- throw new Exception("bad string mapping");
-
- string b = " world";
-
- if (a + b != "hello world")
- throw new Exception("bad string mapping");
-
- if (a + " world" != "hello world")
- throw new Exception("bad string mapping");
-
- if ("hello" + b != "hello world")
- throw new Exception("bad string mapping");
-
- s = "hello world";
-
- B myB = new B("hi");
-
- myB.name = "hello";
- if (myB.name != "hello")
- throw new Exception("bad string mapping");
-
- myB.a = "hello";
- if (myB.a != "hello")
- throw new Exception("bad string mapping");
+ /* Not working for Japanese and Russian characters on Windows, okay on Linux
+ * Is fixed by adding CharSet=CharSet.Unicode to the DllImport, so change to:
+ * [global::System.Runtime.InteropServices.DllImport("li_std_wstring", CharSet=global::System.Runtime.InteropServices.CharSet.Unicode, EntryPoint="CSharp_li_std_wstringNamespace_test_wcvalue")]
+ * Needs a SWIG code change to support this
+ foreach (string test_string in test_strings)
+ {
+ foreach (char expected in test_string)
+ {
+ char received = li_std_wstring.test_wcvalue(expected);
+ check_equal(received, expected);
+ }
+ }
+ */
+ }
}
}
diff --git a/Examples/test-suite/errors/Makefile.in b/Examples/test-suite/errors/Makefile.in
index 10e5bdd..7137a68 100644
--- a/Examples/test-suite/errors/Makefile.in
+++ b/Examples/test-suite/errors/Makefile.in
@@ -45,6 +45,11 @@
# whatever we do here.
$(DOXYGEN_ERROR_TEST_CASES): SWIGOPT += -doxygen
+# Unique module names are obtained from the .i file name (required for parallel make).
+# Note: -module overrides %module in the .i file.
+MODULE_OPTION=-module $*
+nomodule.ctest: MODULE_OPTION =
+
# Portable dos2unix / todos for stripping CR
TODOS = tr -d '\r'
#TODOS = sed -e 's/\r$$//' # On Mac OS X behaves as if written 's/r$$//'
@@ -55,12 +60,12 @@
# Rules for the different types of tests
%.cpptest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ -$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.ctest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIGINVOKE) -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ -$(SWIGINVOKE) -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.clean:
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.i b/Examples/test-suite/errors/cpp_extra_brackets.i
index 32cf7f7..81fdb29 100644
--- a/Examples/test-suite/errors/cpp_extra_brackets.i
+++ b/Examples/test-suite/errors/cpp_extra_brackets.i
@@ -1,4 +1,4 @@
-%module cpp_extra_brackets
+%module xxx
// Extra brackets was segfaulting in SWIG-3.0.0
struct ABC {
diff --git a/Examples/test-suite/errors/cpp_extra_brackets2.i b/Examples/test-suite/errors/cpp_extra_brackets2.i
index 17a5d59..194dea4 100644
--- a/Examples/test-suite/errors/cpp_extra_brackets2.i
+++ b/Examples/test-suite/errors/cpp_extra_brackets2.i
@@ -1,4 +1,4 @@
-%module cpp_extra_brackets
+%module xxx
// Extra brackets was segfaulting in SWIG-3.0.0
struct ABC {
diff --git a/Examples/test-suite/errors/cpp_invalid_qualifiers.i b/Examples/test-suite/errors/cpp_invalid_qualifiers.i
index fd3b363..d0723df 100644
--- a/Examples/test-suite/errors/cpp_invalid_qualifiers.i
+++ b/Examples/test-suite/errors/cpp_invalid_qualifiers.i
@@ -1,4 +1,4 @@
-%module cpp_invalid_qualifiers
+%module xxx
// Constructors, destructors and static methods cannot have qualifiers
struct A {
diff --git a/Examples/test-suite/errors/cpp_invalid_template.i b/Examples/test-suite/errors/cpp_invalid_template.i
index ea0d7be..45ad739 100644
--- a/Examples/test-suite/errors/cpp_invalid_template.i
+++ b/Examples/test-suite/errors/cpp_invalid_template.i
@@ -1,4 +1,4 @@
-%module cpp_invalid_scope
+%module xxx
%template(abc) SSS::AAA<int>;
diff --git a/Examples/test-suite/errors/cpp_namespace_template_bad.i b/Examples/test-suite/errors/cpp_namespace_template_bad.i
index 5c42d6d..f41918f 100644
--- a/Examples/test-suite/errors/cpp_namespace_template_bad.i
+++ b/Examples/test-suite/errors/cpp_namespace_template_bad.i
@@ -1,4 +1,4 @@
-%module namespace_template
+%module xxx
namespace test {
template<typename T> T max(T a, T b) { return (a > b) ? a : b; }
diff --git a/Examples/test-suite/errors/cpp_nested_namespace_alias.i b/Examples/test-suite/errors/cpp_nested_namespace_alias.i
index b7cbceb..058d344 100644
--- a/Examples/test-suite/errors/cpp_nested_namespace_alias.i
+++ b/Examples/test-suite/errors/cpp_nested_namespace_alias.i
@@ -1,4 +1,4 @@
-%module cpp_nested_namespace_alias
+%module xxx
// C++17 nested namespaces
diff --git a/Examples/test-suite/errors/cpp_recursive_typedef.i b/Examples/test-suite/errors/cpp_recursive_typedef.i
index 3d65a88..82d9f7a 100644
--- a/Examples/test-suite/errors/cpp_recursive_typedef.i
+++ b/Examples/test-suite/errors/cpp_recursive_typedef.i
@@ -1,4 +1,4 @@
-%module cpp_recursive_typedef
+%module xxx
typedef std::set<pds> pds;
diff --git a/Examples/test-suite/errors/cpp_refqualifier.i b/Examples/test-suite/errors/cpp_refqualifier.i
index afd6632..3980a81 100644
--- a/Examples/test-suite/errors/cpp_refqualifier.i
+++ b/Examples/test-suite/errors/cpp_refqualifier.i
@@ -1,4 +1,4 @@
-%module cpp_refqualifier
+%module xxx
%ignore Host::h_ignored;
%ignore Host::i_ignored() &&;
diff --git a/Examples/test-suite/errors/cpp_shared_ptr.i b/Examples/test-suite/errors/cpp_shared_ptr.i
index edbd0cf..bdcd30f 100644
--- a/Examples/test-suite/errors/cpp_shared_ptr.i
+++ b/Examples/test-suite/errors/cpp_shared_ptr.i
@@ -1,4 +1,4 @@
-%module cpp_shared_ptr
+%module xxx
%include <boost_shared_ptr.i>
diff --git a/Examples/test-suite/errors/cpp_template_duplicate_names.i b/Examples/test-suite/errors/cpp_template_duplicate_names.i
index 67f21d7..9607696 100644
--- a/Examples/test-suite/errors/cpp_template_duplicate_names.i
+++ b/Examples/test-suite/errors/cpp_template_duplicate_names.i
@@ -1,4 +1,4 @@
-%module cpp_template_duplicate_names
+%module xxx
// From test-suite/template_class_reuse.i test
diff --git a/Examples/test-suite/errors/cpp_template_friend.i b/Examples/test-suite/errors/cpp_template_friend.i
index c9d1c9d..3b8d85e 100644
--- a/Examples/test-suite/errors/cpp_template_friend.i
+++ b/Examples/test-suite/errors/cpp_template_friend.i
@@ -1,4 +1,4 @@
-%module cpp_template_friend
+%module xxx
template<typename T> T template_friend1(T);
template<typename T> T template_friend1(T);
diff --git a/Examples/test-suite/errors/pp_missing_file.i b/Examples/test-suite/errors/pp_missing_file.i
index 5e3f0ea..366f159 100644
--- a/Examples/test-suite/errors/pp_missing_file.i
+++ b/Examples/test-suite/errors/pp_missing_file.i
@@ -1,3 +1,3 @@
-%module test
+%module xxx
%include "missing_filename.i"
diff --git a/Examples/test-suite/go/Makefile.in b/Examples/test-suite/go/Makefile.in
index d07a56b..8283327 100644
--- a/Examples/test-suite/go/Makefile.in
+++ b/Examples/test-suite/go/Makefile.in
@@ -6,24 +6,10 @@
GO = @GO@
GOGCC = @GOGCC@
GCCGO = @GCCGO@
-GO1 = @GO1@
-GO12 = @GO12@
-GO13 = @GO13@
-GO15 = @GO15@
-GOC = @GOC@
GOVERSIONOPTION = @GOVERSIONOPTION@
host = @host@
SCRIPTSUFFIX = _runme.go
-GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1); then echo tool $(GOC:c=g); fi`
-GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
-GOTOOL = `if $(GO1) ; then echo go tool; fi`
-GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-
-GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
-
-OSXOLDGOLINKFLAGS = `if [ -n "\`$(GO) $(GOVERSIONOPTION) | grep -E 'go1($|.0|.1|.2|.3)'\`" ] && [ -n "\`echo $(host) | grep darwin\`" ]; then echo "-Wl,-U,__cgo_topofstack"; fi`
-
SO = @SO@
srcdir = @srcdir@
@@ -49,27 +35,11 @@
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase_cpp)
- if ! $(GO15); then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
- TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
- $(LANGUAGE)$(VARIANT)_cpp_nocgo && \
- $(run_testcase_cpp); \
- fi
%.ctest:
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
- if ! $(GO15); then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CSRCS='$(CSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
- TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
- $(LANGUAGE)$(VARIANT)_nocgo && \
- $(run_testcase); \
- fi
%.multicpptest:
$(setup)
@@ -136,54 +106,66 @@
# Runs the testcase.
run_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- fi && \
+ GOPATH=`pwd`/gopath/; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ mkdir gopath/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
+ cp gopath/src/$*/* gopath/src/swigtests/$*/; \
+ mkdir gopath/src/$*/runme 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
+ (cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
+ cp gopath/src/$*/runme/runme $*_runme; \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
run_testcase_cpp = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- fi && \
+ GOPATH=`pwd`/gopath/; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ mkdir gopath/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
+ cp gopath/src/$*/* gopath/src/swigtests/$*/; \
+ mkdir gopath/src/$*/runme 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
+ (cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
+ cp gopath/src/$*/runme/runme $*_runme; \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
run_multi_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GO15) || $(GOGCC); then \
- files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
- mkdir gopath/$*/src/$* 2>/dev/null || true; \
- cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
- GOPATH="`pwd`/gopath/$*"; \
- export GOPATH; \
- CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
- export CGO_CPPFLAGS; \
- CGO_CFLAGS="$(CFLAGS)"; \
- export CGO_CFLAGS; \
- CGO_CXXFLAGS="$(CXXFLAGS)"; \
- export CGO_CXXFLAGS; \
- CGO_LDFLAGS="$(LDFLAGS) -lm"; \
- export CGO_LDFLAGS; \
- (cd gopath/$*/src/$* && \
- $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
- fi; \
+ files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
+ mkdir gopath/$*/src/$* 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
+ GOPATH="`pwd`/gopath/$*"; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ (cd gopath/$*/src/$* && \
+ $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
%.clean:
diff --git a/Examples/test-suite/go/abstract_access_runme.go b/Examples/test-suite/go/abstract_access_runme.go
index 5102236..0a0e56f 100644
--- a/Examples/test-suite/go/abstract_access_runme.go
+++ b/Examples/test-suite/go/abstract_access_runme.go
@@ -1,6 +1,6 @@
package main
-import "abstract_access"
+import "swigtests/abstract_access"
func main() {
d := abstract_access.NewD()
diff --git a/Examples/test-suite/go/abstract_typedef2_runme.go b/Examples/test-suite/go/abstract_typedef2_runme.go
index 76a5fc8..5e2ed1e 100644
--- a/Examples/test-suite/go/abstract_typedef2_runme.go
+++ b/Examples/test-suite/go/abstract_typedef2_runme.go
@@ -1,6 +1,6 @@
package main
-import "abstract_typedef2"
+import "swigtests/abstract_typedef2"
func main() {
abstract_typedef2.NewA_UF()
diff --git a/Examples/test-suite/go/abstract_typedef_runme.go b/Examples/test-suite/go/abstract_typedef_runme.go
index 56aaa61..1ad49f5 100644
--- a/Examples/test-suite/go/abstract_typedef_runme.go
+++ b/Examples/test-suite/go/abstract_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import "abstract_typedef"
+import "swigtests/abstract_typedef"
func main() {
e := abstract_typedef.NewEngine()
diff --git a/Examples/test-suite/go/abstract_virtual_runme.go b/Examples/test-suite/go/abstract_virtual_runme.go
index e19eac2..d333d50 100644
--- a/Examples/test-suite/go/abstract_virtual_runme.go
+++ b/Examples/test-suite/go/abstract_virtual_runme.go
@@ -1,6 +1,6 @@
package main
-import "abstract_virtual"
+import "swigtests/abstract_virtual"
func main() {
abstract_virtual.NewD()
diff --git a/Examples/test-suite/go/argout_runme.go b/Examples/test-suite/go/argout_runme.go
index bb8ab9e..b2edf54 100644
--- a/Examples/test-suite/go/argout_runme.go
+++ b/Examples/test-suite/go/argout_runme.go
@@ -1,6 +1,6 @@
package main
-import wrap "argout"
+import wrap "swigtests/argout"
func main() {
ip := wrap.New_intp()
diff --git a/Examples/test-suite/go/array_member_runme.go b/Examples/test-suite/go/array_member_runme.go
index 4f029db..d8c3896 100644
--- a/Examples/test-suite/go/array_member_runme.go
+++ b/Examples/test-suite/go/array_member_runme.go
@@ -1,6 +1,6 @@
package main
-import . "array_member"
+import . "swigtests/array_member"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/arrays_global_runme.go b/Examples/test-suite/go/arrays_global_runme.go
index 35b049d..9c4a9e5 100644
--- a/Examples/test-suite/go/arrays_global_runme.go
+++ b/Examples/test-suite/go/arrays_global_runme.go
@@ -1,6 +1,6 @@
package main
-import . "arrays_global"
+import . "swigtests/arrays_global"
func main() {
SetArray_i(GetArray_const_i())
diff --git a/Examples/test-suite/go/char_binary_runme.go b/Examples/test-suite/go/char_binary_runme.go
index d47d616..3c8c2d7 100644
--- a/Examples/test-suite/go/char_binary_runme.go
+++ b/Examples/test-suite/go/char_binary_runme.go
@@ -1,6 +1,6 @@
package main
-import . "char_binary"
+import . "swigtests/char_binary"
func main() {
t := NewTest()
diff --git a/Examples/test-suite/go/class_ignore_runme.go b/Examples/test-suite/go/class_ignore_runme.go
index 24261c6..11cf81d 100644
--- a/Examples/test-suite/go/class_ignore_runme.go
+++ b/Examples/test-suite/go/class_ignore_runme.go
@@ -1,6 +1,6 @@
package main
-import "class_ignore"
+import "swigtests/class_ignore"
func main() {
a := class_ignore.NewBar()
diff --git a/Examples/test-suite/go/class_scope_weird_runme.go b/Examples/test-suite/go/class_scope_weird_runme.go
index a42bdad..4776990 100644
--- a/Examples/test-suite/go/class_scope_weird_runme.go
+++ b/Examples/test-suite/go/class_scope_weird_runme.go
@@ -1,6 +1,6 @@
package main
-import "class_scope_weird"
+import "swigtests/class_scope_weird"
func main() {
f := class_scope_weird.NewFoo()
diff --git a/Examples/test-suite/go/compactdefaultargs_runme.go b/Examples/test-suite/go/compactdefaultargs_runme.go
index fe6224c..c9e9008 100644
--- a/Examples/test-suite/go/compactdefaultargs_runme.go
+++ b/Examples/test-suite/go/compactdefaultargs_runme.go
@@ -1,6 +1,6 @@
package main
-import . "compactdefaultargs"
+import . "swigtests/compactdefaultargs"
func main() {
defaults1 := NewDefaults1(1000)
diff --git a/Examples/test-suite/go/constover_runme.go b/Examples/test-suite/go/constover_runme.go
index 6c83709..51d965e 100644
--- a/Examples/test-suite/go/constover_runme.go
+++ b/Examples/test-suite/go/constover_runme.go
@@ -4,7 +4,7 @@
"fmt"
"os"
- "constover"
+ "swigtests/constover"
)
func main() {
diff --git a/Examples/test-suite/go/constructor_copy_runme.go b/Examples/test-suite/go/constructor_copy_runme.go
index 68c4288..ca47255 100644
--- a/Examples/test-suite/go/constructor_copy_runme.go
+++ b/Examples/test-suite/go/constructor_copy_runme.go
@@ -1,6 +1,6 @@
package main
-import . "constructor_copy"
+import . "swigtests/constructor_copy"
func main() {
f1 := NewFoo1(3)
diff --git a/Examples/test-suite/go/contract_runme.go b/Examples/test-suite/go/contract_runme.go
index b028855..7c9d097 100644
--- a/Examples/test-suite/go/contract_runme.go
+++ b/Examples/test-suite/go/contract_runme.go
@@ -1,6 +1,6 @@
package main
-import "contract"
+import "swigtests/contract"
func main() {
contract.Test_preassert(1, 2)
diff --git a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
index f9ca74a..926b6f7 100644
--- a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
+++ b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "cpp11_strongly_typed_enumerations"
+import . "swigtests/cpp11_strongly_typed_enumerations"
func enumCheck(actual int, expected int) int {
if actual != expected {
diff --git a/Examples/test-suite/go/cpp_enum_runme.go b/Examples/test-suite/go/cpp_enum_runme.go
index 8906dd4..9b8930a 100644
--- a/Examples/test-suite/go/cpp_enum_runme.go
+++ b/Examples/test-suite/go/cpp_enum_runme.go
@@ -1,6 +1,6 @@
package main
-import "cpp_enum"
+import "swigtests/cpp_enum"
func main() {
f := cpp_enum.NewFoo()
diff --git a/Examples/test-suite/go/cpp_namespace_runme.go b/Examples/test-suite/go/cpp_namespace_runme.go
index aecdd95..71affc5 100644
--- a/Examples/test-suite/go/cpp_namespace_runme.go
+++ b/Examples/test-suite/go/cpp_namespace_runme.go
@@ -1,7 +1,7 @@
// Note: This example assumes that namespaces are flattened
package main
-import "cpp_namespace"
+import "swigtests/cpp_namespace"
func main() {
n := cpp_namespace.Fact(4)
diff --git a/Examples/test-suite/go/cpp_static_runme.go b/Examples/test-suite/go/cpp_static_runme.go
index 1ad981a6..d482298 100644
--- a/Examples/test-suite/go/cpp_static_runme.go
+++ b/Examples/test-suite/go/cpp_static_runme.go
@@ -1,6 +1,6 @@
package main
-import . "cpp_static"
+import . "swigtests/cpp_static"
func main() {
StaticFunctionTestStatic_func()
diff --git a/Examples/test-suite/go/default_args_runme.go b/Examples/test-suite/go/default_args_runme.go
index a39f957..5b6f404 100644
--- a/Examples/test-suite/go/default_args_runme.go
+++ b/Examples/test-suite/go/default_args_runme.go
@@ -1,6 +1,6 @@
package main
-import "default_args"
+import "swigtests/default_args"
func main() {
if default_args.StaticsStaticmethod() != 60 {
diff --git a/Examples/test-suite/go/default_constructor_runme.go b/Examples/test-suite/go/default_constructor_runme.go
index eeac7ea..90d9601 100644
--- a/Examples/test-suite/go/default_constructor_runme.go
+++ b/Examples/test-suite/go/default_constructor_runme.go
@@ -1,6 +1,6 @@
package main
-import dc "default_constructor"
+import dc "swigtests/default_constructor"
func main() {
a := dc.NewA()
diff --git a/Examples/test-suite/go/director_alternating_runme.go b/Examples/test-suite/go/director_alternating_runme.go
index b4793aa..2df31db 100644
--- a/Examples/test-suite/go/director_alternating_runme.go
+++ b/Examples/test-suite/go/director_alternating_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_alternating"
+import . "swigtests/director_alternating"
func main() {
id := GetBar().Id()
diff --git a/Examples/test-suite/go/director_basic_runme.go b/Examples/test-suite/go/director_basic_runme.go
index 360424d..c308f25 100644
--- a/Examples/test-suite/go/director_basic_runme.go
+++ b/Examples/test-suite/go/director_basic_runme.go
@@ -1,6 +1,6 @@
package main
-import "director_basic"
+import "swigtests/director_basic"
type GoFoo struct{}
diff --git a/Examples/test-suite/go/director_classic_runme.go b/Examples/test-suite/go/director_classic_runme.go
index 230c963..d8acc13 100644
--- a/Examples/test-suite/go/director_classic_runme.go
+++ b/Examples/test-suite/go/director_classic_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "director_classic"
+import . "swigtests/director_classic"
type TargetLangPerson struct{} // From Person
func (p *TargetLangPerson) Id() string {
diff --git a/Examples/test-suite/go/director_default_runme.go b/Examples/test-suite/go/director_default_runme.go
index ac2aace..557d5c5 100644
--- a/Examples/test-suite/go/director_default_runme.go
+++ b/Examples/test-suite/go/director_default_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_default"
+import . "swigtests/director_default"
func main() {
NewFoo()
diff --git a/Examples/test-suite/go/director_detect_runme.go b/Examples/test-suite/go/director_detect_runme.go
index 0c3c95f..f82a0c0 100644
--- a/Examples/test-suite/go/director_detect_runme.go
+++ b/Examples/test-suite/go/director_detect_runme.go
@@ -1,6 +1,6 @@
package main
-import "director_detect"
+import "swigtests/director_detect"
type MyBar struct {
val int
diff --git a/Examples/test-suite/go/director_enum_runme.go b/Examples/test-suite/go/director_enum_runme.go
index 002d425..3e67417 100644
--- a/Examples/test-suite/go/director_enum_runme.go
+++ b/Examples/test-suite/go/director_enum_runme.go
@@ -1,6 +1,6 @@
package main
-import "director_enum"
+import "swigtests/director_enum"
type MyFoo struct{} // From director_enum.Foo
func (p *MyFoo) Say_hi(val director_enum.EnumDirectorHello) director_enum.EnumDirectorHello {
diff --git a/Examples/test-suite/go/director_exception_runme.go b/Examples/test-suite/go/director_exception_runme.go
index 55231ff..167d751 100644
--- a/Examples/test-suite/go/director_exception_runme.go
+++ b/Examples/test-suite/go/director_exception_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_exception"
+import . "swigtests/director_exception"
type Exception struct {
msg string
diff --git a/Examples/test-suite/go/director_extend_runme.go b/Examples/test-suite/go/director_extend_runme.go
index 27e55b9..adfb6dd 100644
--- a/Examples/test-suite/go/director_extend_runme.go
+++ b/Examples/test-suite/go/director_extend_runme.go
@@ -5,7 +5,7 @@
package main
-import . "director_extend"
+import . "swigtests/director_extend"
func main() {
m := NewSpObject()
diff --git a/Examples/test-suite/go/director_finalizer_runme.go b/Examples/test-suite/go/director_finalizer_runme.go
index d36a4ba..5cd9d95 100644
--- a/Examples/test-suite/go/director_finalizer_runme.go
+++ b/Examples/test-suite/go/director_finalizer_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_finalizer"
+import . "swigtests/director_finalizer"
type MyFoo struct{} // From Foo
func DeleteMyFoo(p Foo) {
diff --git a/Examples/test-suite/go/director_frob_runme.go b/Examples/test-suite/go/director_frob_runme.go
index 3985eb1..7354fa7 100644
--- a/Examples/test-suite/go/director_frob_runme.go
+++ b/Examples/test-suite/go/director_frob_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_frob"
+import . "swigtests/director_frob"
func main() {
foo := NewBravo()
diff --git a/Examples/test-suite/go/director_nested_runme.go b/Examples/test-suite/go/director_nested_runme.go
index a1193ad..b048935 100644
--- a/Examples/test-suite/go/director_nested_runme.go
+++ b/Examples/test-suite/go/director_nested_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_nested"
+import . "swigtests/director_nested"
type A struct{} // From FooBar_int
func (p *A) Do_step() string {
diff --git a/Examples/test-suite/go/director_profile_runme.go b/Examples/test-suite/go/director_profile_runme.go
index a9bc793..da0ea21 100644
--- a/Examples/test-suite/go/director_profile_runme.go
+++ b/Examples/test-suite/go/director_profile_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "director_profile"
+import "swigtests/director_profile"
type MyB struct{} // From director_profile.B
func (p *MyB) Vfi(a int) int {
diff --git a/Examples/test-suite/go/director_protected_runme.go b/Examples/test-suite/go/director_protected_runme.go
index bfd50c6..0012ccd 100644
--- a/Examples/test-suite/go/director_protected_runme.go
+++ b/Examples/test-suite/go/director_protected_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_protected"
+import . "swigtests/director_protected"
type FooBar struct{} // From Bar
func (p *FooBar) Ping() string {
diff --git a/Examples/test-suite/go/director_string_runme.go b/Examples/test-suite/go/director_string_runme.go
index f4f9cc1..0c73b6a 100644
--- a/Examples/test-suite/go/director_string_runme.go
+++ b/Examples/test-suite/go/director_string_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_string"
+import . "swigtests/director_string"
type B struct { // From A
abi A
diff --git a/Examples/test-suite/go/director_unroll_runme.go b/Examples/test-suite/go/director_unroll_runme.go
index 6a919f6..560034c 100644
--- a/Examples/test-suite/go/director_unroll_runme.go
+++ b/Examples/test-suite/go/director_unroll_runme.go
@@ -1,6 +1,6 @@
package main
-import "director_unroll"
+import "swigtests/director_unroll"
type MyFoo struct{} // From director_unroll.Foo
func (p *MyFoo) Ping() string {
diff --git a/Examples/test-suite/go/disown_runme.go b/Examples/test-suite/go/disown_runme.go
index 4484515..ba072a8 100644
--- a/Examples/test-suite/go/disown_runme.go
+++ b/Examples/test-suite/go/disown_runme.go
@@ -1,6 +1,6 @@
package main
-import . "disown"
+import . "swigtests/disown"
func main() {
a := NewA()
diff --git a/Examples/test-suite/go/dynamic_cast_runme.go b/Examples/test-suite/go/dynamic_cast_runme.go
index 46ba236..213bc0c 100644
--- a/Examples/test-suite/go/dynamic_cast_runme.go
+++ b/Examples/test-suite/go/dynamic_cast_runme.go
@@ -1,6 +1,6 @@
package main
-import "dynamic_cast"
+import "swigtests/dynamic_cast"
func main() {
f := dynamic_cast.NewFoo()
diff --git a/Examples/test-suite/go/empty_c_runme.go b/Examples/test-suite/go/empty_c_runme.go
index 1a1bd9c..f093103 100644
--- a/Examples/test-suite/go/empty_c_runme.go
+++ b/Examples/test-suite/go/empty_c_runme.go
@@ -1,6 +1,6 @@
package main
-import _ "empty_c"
+import _ "swigtests/empty_c"
func main() {
}
diff --git a/Examples/test-suite/go/empty_runme.go b/Examples/test-suite/go/empty_runme.go
index 681a6f3..03f423b 100644
--- a/Examples/test-suite/go/empty_runme.go
+++ b/Examples/test-suite/go/empty_runme.go
@@ -1,6 +1,6 @@
package main
-import _ "empty"
+import _ "swigtests/empty"
func main() {
}
diff --git a/Examples/test-suite/go/enum_template_runme.go b/Examples/test-suite/go/enum_template_runme.go
index c60a452..7f43eab 100644
--- a/Examples/test-suite/go/enum_template_runme.go
+++ b/Examples/test-suite/go/enum_template_runme.go
@@ -1,6 +1,6 @@
package main
-import "enum_template"
+import "swigtests/enum_template"
func main() {
if enum_template.MakeETest() != 1 {
diff --git a/Examples/test-suite/go/enums_runme.go b/Examples/test-suite/go/enums_runme.go
index 7a528b3..4a879a0 100644
--- a/Examples/test-suite/go/enums_runme.go
+++ b/Examples/test-suite/go/enums_runme.go
@@ -1,6 +1,6 @@
package main
-import "enums"
+import "swigtests/enums"
func main() {
enums.Bar2(1)
diff --git a/Examples/test-suite/go/exception_order_runme.go b/Examples/test-suite/go/exception_order_runme.go
index 21dcff3..ee67712 100644
--- a/Examples/test-suite/go/exception_order_runme.go
+++ b/Examples/test-suite/go/exception_order_runme.go
@@ -1,7 +1,7 @@
package main
import "strings"
-import . "exception_order"
+import . "swigtests/exception_order"
func main() {
a := NewA()
diff --git a/Examples/test-suite/go/extend_placement_runme.go b/Examples/test-suite/go/extend_placement_runme.go
index 253ec66..8795896 100644
--- a/Examples/test-suite/go/extend_placement_runme.go
+++ b/Examples/test-suite/go/extend_placement_runme.go
@@ -1,6 +1,6 @@
package main
-import "extend_placement"
+import "swigtests/extend_placement"
func main() {
foo := extend_placement.NewFoo()
diff --git a/Examples/test-suite/go/extend_template_ns_runme.go b/Examples/test-suite/go/extend_template_ns_runme.go
index d005172..b1dd43a 100644
--- a/Examples/test-suite/go/extend_template_ns_runme.go
+++ b/Examples/test-suite/go/extend_template_ns_runme.go
@@ -1,6 +1,6 @@
package main
-import . "extend_template_ns"
+import . "swigtests/extend_template_ns"
func main() {
f := NewFoo_One()
diff --git a/Examples/test-suite/go/extend_template_runme.go b/Examples/test-suite/go/extend_template_runme.go
index a5c4da4..4a6b709 100644
--- a/Examples/test-suite/go/extend_template_runme.go
+++ b/Examples/test-suite/go/extend_template_runme.go
@@ -1,6 +1,6 @@
package main
-import "extend_template"
+import "swigtests/extend_template"
func main() {
f := extend_template.NewFoo_0()
diff --git a/Examples/test-suite/go/extend_variable_runme.go b/Examples/test-suite/go/extend_variable_runme.go
index 9425aee..278bffe 100644
--- a/Examples/test-suite/go/extend_variable_runme.go
+++ b/Examples/test-suite/go/extend_variable_runme.go
@@ -1,6 +1,6 @@
package main
-import . "extend_variable"
+import . "swigtests/extend_variable"
func main() {
if FooBar != 42 {
diff --git a/Examples/test-suite/go/extern_c_runme.go b/Examples/test-suite/go/extern_c_runme.go
index 9bc2cd0..1cbfd9d 100644
--- a/Examples/test-suite/go/extern_c_runme.go
+++ b/Examples/test-suite/go/extern_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "extern_c"
+import "swigtests/extern_c"
func main() {
extern_c.RealFunction(2)
diff --git a/Examples/test-suite/go/friends_runme.go b/Examples/test-suite/go/friends_runme.go
index 2e34a4d..b6b9e93 100644
--- a/Examples/test-suite/go/friends_runme.go
+++ b/Examples/test-suite/go/friends_runme.go
@@ -1,6 +1,6 @@
package main
-import "friends"
+import "swigtests/friends"
func main() {
a := friends.NewA(2)
diff --git a/Examples/test-suite/go/fvirtual_runme.go b/Examples/test-suite/go/fvirtual_runme.go
index 86ef90f..01b94f4 100644
--- a/Examples/test-suite/go/fvirtual_runme.go
+++ b/Examples/test-suite/go/fvirtual_runme.go
@@ -1,6 +1,6 @@
package main
-import . "fvirtual"
+import . "swigtests/fvirtual"
func main() {
sw := NewNodeSwitch()
diff --git a/Examples/test-suite/go/global_ns_arg_runme.go b/Examples/test-suite/go/global_ns_arg_runme.go
index e86aa67..aeacd91 100644
--- a/Examples/test-suite/go/global_ns_arg_runme.go
+++ b/Examples/test-suite/go/global_ns_arg_runme.go
@@ -1,6 +1,6 @@
package main
-import . "global_ns_arg"
+import . "swigtests/global_ns_arg"
func main() {
Foo(1)
diff --git a/Examples/test-suite/go/go_director_inout_runme.go b/Examples/test-suite/go/go_director_inout_runme.go
index e6768a4..171b3c2 100644
--- a/Examples/test-suite/go/go_director_inout_runme.go
+++ b/Examples/test-suite/go/go_director_inout_runme.go
@@ -1,7 +1,7 @@
package main
import (
- wrap "go_director_inout"
+ wrap "swigtests/go_director_inout"
)
type GoMyClass struct {}
diff --git a/Examples/test-suite/go/go_inout_runme.go b/Examples/test-suite/go/go_inout_runme.go
index 4599aa1..2dc5b99 100644
--- a/Examples/test-suite/go/go_inout_runme.go
+++ b/Examples/test-suite/go/go_inout_runme.go
@@ -5,7 +5,7 @@
"fmt"
"reflect"
- "go_inout"
+ "swigtests/go_inout"
)
type S struct {
diff --git a/Examples/test-suite/go/grouping_runme.go b/Examples/test-suite/go/grouping_runme.go
index f808e12..d5f3475 100644
--- a/Examples/test-suite/go/grouping_runme.go
+++ b/Examples/test-suite/go/grouping_runme.go
@@ -1,6 +1,6 @@
package main
-import "grouping"
+import "swigtests/grouping"
func main() {
x := grouping.Test1(42)
diff --git a/Examples/test-suite/go/import_nomodule_runme.go b/Examples/test-suite/go/import_nomodule_runme.go
index 48592df..2368015 100644
--- a/Examples/test-suite/go/import_nomodule_runme.go
+++ b/Examples/test-suite/go/import_nomodule_runme.go
@@ -1,6 +1,6 @@
package main
-import . "import_nomodule"
+import . "swigtests/import_nomodule"
func main() {
f := Create_Foo()
diff --git a/Examples/test-suite/go/inctest_runme.go b/Examples/test-suite/go/inctest_runme.go
index 3148abc..490721e 100644
--- a/Examples/test-suite/go/inctest_runme.go
+++ b/Examples/test-suite/go/inctest_runme.go
@@ -1,6 +1,6 @@
package main
-import "inctest"
+import "swigtests/inctest"
func main() {
inctest.NewA()
diff --git a/Examples/test-suite/go/inherit_member_runme.go b/Examples/test-suite/go/inherit_member_runme.go
index 6fd70cf..10dabad 100644
--- a/Examples/test-suite/go/inherit_member_runme.go
+++ b/Examples/test-suite/go/inherit_member_runme.go
@@ -1,6 +1,6 @@
package main
-import wrap "inherit_member"
+import wrap "swigtests/inherit_member"
func main() {
s := wrap.NewChild()
diff --git a/Examples/test-suite/go/inherit_missing_runme.go b/Examples/test-suite/go/inherit_missing_runme.go
index c70c483..b4706e9 100644
--- a/Examples/test-suite/go/inherit_missing_runme.go
+++ b/Examples/test-suite/go/inherit_missing_runme.go
@@ -1,6 +1,6 @@
package main
-import "inherit_missing"
+import "swigtests/inherit_missing"
func main() {
a := inherit_missing.New_Foo()
diff --git a/Examples/test-suite/go/input_runme.go b/Examples/test-suite/go/input_runme.go
index ddc2992..c5eb9e4 100644
--- a/Examples/test-suite/go/input_runme.go
+++ b/Examples/test-suite/go/input_runme.go
@@ -1,6 +1,6 @@
package main
-import . "input"
+import . "swigtests/input"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/keyword_rename_c_runme.go b/Examples/test-suite/go/keyword_rename_c_runme.go
index 26f2ea4..28f6ddd 100644
--- a/Examples/test-suite/go/keyword_rename_c_runme.go
+++ b/Examples/test-suite/go/keyword_rename_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "keyword_rename_c"
+import "swigtests/keyword_rename_c"
func main() {
keyword_rename_c.Xgo(1)
diff --git a/Examples/test-suite/go/keyword_rename_runme.go b/Examples/test-suite/go/keyword_rename_runme.go
index 7a40ff8..f93c7ab 100644
--- a/Examples/test-suite/go/keyword_rename_runme.go
+++ b/Examples/test-suite/go/keyword_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "keyword_rename"
+import "swigtests/keyword_rename"
func main() {
keyword_rename.Xgo(1)
diff --git a/Examples/test-suite/go/li_attribute_runme.go b/Examples/test-suite/go/li_attribute_runme.go
index b502b8c..0702b89 100644
--- a/Examples/test-suite/go/li_attribute_runme.go
+++ b/Examples/test-suite/go/li_attribute_runme.go
@@ -1,6 +1,6 @@
package main
-import "li_attribute"
+import "swigtests/li_attribute"
func main() {
aa := li_attribute.NewA(1, 2, 3)
diff --git a/Examples/test-suite/go/li_carrays_cpp_runme.go b/Examples/test-suite/go/li_carrays_cpp_runme.go
index cfc1712..a96291c 100644
--- a/Examples/test-suite/go/li_carrays_cpp_runme.go
+++ b/Examples/test-suite/go/li_carrays_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_carrays_cpp"
+import . "swigtests/li_carrays_cpp"
func main() {
d := NewDoubleArray(10)
diff --git a/Examples/test-suite/go/li_carrays_runme.go b/Examples/test-suite/go/li_carrays_runme.go
index 9128bbf..eefc6ad 100644
--- a/Examples/test-suite/go/li_carrays_runme.go
+++ b/Examples/test-suite/go/li_carrays_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_carrays"
+import . "swigtests/li_carrays"
func main() {
d := NewDoubleArray(10)
diff --git a/Examples/test-suite/go/li_cdata_cpp_runme.go b/Examples/test-suite/go/li_cdata_cpp_runme.go
index daa5384..5849c50 100644
--- a/Examples/test-suite/go/li_cdata_cpp_runme.go
+++ b/Examples/test-suite/go/li_cdata_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cdata_cpp"
+import . "swigtests/li_cdata_cpp"
func main() {
s := "ABC abc"
diff --git a/Examples/test-suite/go/li_cdata_runme.go b/Examples/test-suite/go/li_cdata_runme.go
index 9458dab..0c3e591 100644
--- a/Examples/test-suite/go/li_cdata_runme.go
+++ b/Examples/test-suite/go/li_cdata_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cdata"
+import . "swigtests/li_cdata"
func main() {
s := "ABC abc"
diff --git a/Examples/test-suite/go/li_cmalloc_runme.go b/Examples/test-suite/go/li_cmalloc_runme.go
index 5b9f970..fb1b009 100644
--- a/Examples/test-suite/go/li_cmalloc_runme.go
+++ b/Examples/test-suite/go/li_cmalloc_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cmalloc"
+import . "swigtests/li_cmalloc"
func main() {
p := Malloc_int()
diff --git a/Examples/test-suite/go/li_cpointer_cpp_runme.go b/Examples/test-suite/go/li_cpointer_cpp_runme.go
index 0de57c6..f422b23 100644
--- a/Examples/test-suite/go/li_cpointer_cpp_runme.go
+++ b/Examples/test-suite/go/li_cpointer_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cpointer_cpp"
+import . "swigtests/li_cpointer_cpp"
func main() {
p := New_intp()
diff --git a/Examples/test-suite/go/li_cpointer_runme.go b/Examples/test-suite/go/li_cpointer_runme.go
index 0fe29e7..1a83bc6 100644
--- a/Examples/test-suite/go/li_cpointer_runme.go
+++ b/Examples/test-suite/go/li_cpointer_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cpointer"
+import . "swigtests/li_cpointer"
func main() {
p := New_intp()
diff --git a/Examples/test-suite/go/li_std_map_runme.go b/Examples/test-suite/go/li_std_map_runme.go
index 5c5cc2e..019ac6e 100644
--- a/Examples/test-suite/go/li_std_map_runme.go
+++ b/Examples/test-suite/go/li_std_map_runme.go
@@ -1,6 +1,6 @@
package main
-import "li_std_map"
+import "swigtests/li_std_map"
func main() {
a1 := li_std_map.NewA(3)
diff --git a/Examples/test-suite/go/li_std_vector_ptr_runme.go b/Examples/test-suite/go/li_std_vector_ptr_runme.go
index d66ff19..9a62d37 100644
--- a/Examples/test-suite/go/li_std_vector_ptr_runme.go
+++ b/Examples/test-suite/go/li_std_vector_ptr_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_std_vector_ptr"
+import . "swigtests/li_std_vector_ptr"
import "fmt"
func check(val1 int, val2 int) {
diff --git a/Examples/test-suite/go/member_pointer_runme.go b/Examples/test-suite/go/member_pointer_runme.go
index 731526b..0278938 100644
--- a/Examples/test-suite/go/member_pointer_runme.go
+++ b/Examples/test-suite/go/member_pointer_runme.go
@@ -3,7 +3,7 @@
package main
import "fmt"
-import . "member_pointer"
+import . "swigtests/member_pointer"
func check(what string, expected float64, actual float64) {
if expected != actual {
diff --git a/Examples/test-suite/go/memberin_extend_c_runme.go b/Examples/test-suite/go/memberin_extend_c_runme.go
index 0551acc..696f08a 100644
--- a/Examples/test-suite/go/memberin_extend_c_runme.go
+++ b/Examples/test-suite/go/memberin_extend_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "memberin_extend_c"
+import "swigtests/memberin_extend_c"
func main() {
t := memberin_extend_c.NewPerson()
diff --git a/Examples/test-suite/go/minherit_runme.go b/Examples/test-suite/go/minherit_runme.go
index 9b7873c..f1504af 100644
--- a/Examples/test-suite/go/minherit_runme.go
+++ b/Examples/test-suite/go/minherit_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "minherit"
+import "swigtests/minherit"
func main() {
a := minherit.NewFoo()
diff --git a/Examples/test-suite/go/namespace_class_runme.go b/Examples/test-suite/go/namespace_class_runme.go
index 4c240b6..435ee86 100644
--- a/Examples/test-suite/go/namespace_class_runme.go
+++ b/Examples/test-suite/go/namespace_class_runme.go
@@ -1,6 +1,6 @@
package main
-import . "namespace_class"
+import . "swigtests/namespace_class"
func main() {
EulerT3DToFrame(1, 1, 1)
diff --git a/Examples/test-suite/go/namespace_typemap_runme.go b/Examples/test-suite/go/namespace_typemap_runme.go
index 47e2b64..6da4333 100644
--- a/Examples/test-suite/go/namespace_typemap_runme.go
+++ b/Examples/test-suite/go/namespace_typemap_runme.go
@@ -1,6 +1,6 @@
package main
-import . "namespace_typemap"
+import . "swigtests/namespace_typemap"
func main() {
if Stest1("hello") != "hello" {
diff --git a/Examples/test-suite/go/namespace_virtual_method_runme.go b/Examples/test-suite/go/namespace_virtual_method_runme.go
index a8cb38b..7ac4d33 100644
--- a/Examples/test-suite/go/namespace_virtual_method_runme.go
+++ b/Examples/test-suite/go/namespace_virtual_method_runme.go
@@ -1,6 +1,6 @@
package main
-import "namespace_virtual_method"
+import "swigtests/namespace_virtual_method"
func main() {
_ = namespace_virtual_method.NewSpam()
diff --git a/Examples/test-suite/go/naturalvar_runme.go b/Examples/test-suite/go/naturalvar_runme.go
index ed47e9d..458745e 100644
--- a/Examples/test-suite/go/naturalvar_runme.go
+++ b/Examples/test-suite/go/naturalvar_runme.go
@@ -1,6 +1,6 @@
package main
-import . "naturalvar"
+import . "swigtests/naturalvar"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/nested_workaround_runme.go b/Examples/test-suite/go/nested_workaround_runme.go
index 8b31a7f..f42b487 100644
--- a/Examples/test-suite/go/nested_workaround_runme.go
+++ b/Examples/test-suite/go/nested_workaround_runme.go
@@ -1,6 +1,6 @@
package main
-import . "nested_workaround"
+import . "swigtests/nested_workaround"
func main() {
inner := NewInner(5)
diff --git a/Examples/test-suite/go/overload_complicated_runme.go b/Examples/test-suite/go/overload_complicated_runme.go
index ce9d124..c238d97 100644
--- a/Examples/test-suite/go/overload_complicated_runme.go
+++ b/Examples/test-suite/go/overload_complicated_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_complicated"
+import . "swigtests/overload_complicated"
func main() {
var pInt *int
diff --git a/Examples/test-suite/go/overload_copy_runme.go b/Examples/test-suite/go/overload_copy_runme.go
index 55ec4a3..9815d76 100644
--- a/Examples/test-suite/go/overload_copy_runme.go
+++ b/Examples/test-suite/go/overload_copy_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_copy"
+import . "swigtests/overload_copy"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/overload_extend2_runme.go b/Examples/test-suite/go/overload_extend2_runme.go
index db79098..d549098 100644
--- a/Examples/test-suite/go/overload_extend2_runme.go
+++ b/Examples/test-suite/go/overload_extend2_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_extend2"
+import "swigtests/overload_extend2"
func main() {
f := overload_extend2.NewFoo()
diff --git a/Examples/test-suite/go/overload_extend_c_runme.go b/Examples/test-suite/go/overload_extend_c_runme.go
index 4d3b2b6..93b91d9 100644
--- a/Examples/test-suite/go/overload_extend_c_runme.go
+++ b/Examples/test-suite/go/overload_extend_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_extend_c"
+import "swigtests/overload_extend_c"
func main() {
f := overload_extend_c.NewFoo()
diff --git a/Examples/test-suite/go/overload_extend_runme.go b/Examples/test-suite/go/overload_extend_runme.go
index d73d6cf..c1435f3 100644
--- a/Examples/test-suite/go/overload_extend_runme.go
+++ b/Examples/test-suite/go/overload_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_extend"
+import "swigtests/overload_extend"
func main() {
f := overload_extend.NewFoo()
diff --git a/Examples/test-suite/go/overload_polymorphic_runme.go b/Examples/test-suite/go/overload_polymorphic_runme.go
index 12b9777..6a4301f 100644
--- a/Examples/test-suite/go/overload_polymorphic_runme.go
+++ b/Examples/test-suite/go/overload_polymorphic_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_polymorphic"
+import "swigtests/overload_polymorphic"
func main(){
t := overload_polymorphic.NewDerived()
diff --git a/Examples/test-suite/go/overload_rename_runme.go b/Examples/test-suite/go/overload_rename_runme.go
index 3bd4a69..982b178 100644
--- a/Examples/test-suite/go/overload_rename_runme.go
+++ b/Examples/test-suite/go/overload_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_rename"
+import "swigtests/overload_rename"
func main() {
_ = overload_rename.NewFoo(float32(1))
diff --git a/Examples/test-suite/go/overload_simple_runme.go b/Examples/test-suite/go/overload_simple_runme.go
index 3eb859b..23a80bf 100644
--- a/Examples/test-suite/go/overload_simple_runme.go
+++ b/Examples/test-suite/go/overload_simple_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_simple"
+import . "swigtests/overload_simple"
func main() {
if Foo(3) != "foo:int" {
diff --git a/Examples/test-suite/go/overload_subtype_runme.go b/Examples/test-suite/go/overload_subtype_runme.go
index 45d5a02..09f7a83 100644
--- a/Examples/test-suite/go/overload_subtype_runme.go
+++ b/Examples/test-suite/go/overload_subtype_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_subtype"
+import . "swigtests/overload_subtype"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/overload_template_fast_runme.go b/Examples/test-suite/go/overload_template_fast_runme.go
index 63809c0..3b348f3 100644
--- a/Examples/test-suite/go/overload_template_fast_runme.go
+++ b/Examples/test-suite/go/overload_template_fast_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_template_fast"
+import . "swigtests/overload_template_fast"
func main() {
_ = Foo()
diff --git a/Examples/test-suite/go/overload_template_runme.go b/Examples/test-suite/go/overload_template_runme.go
index f3a08ec..b85afb4 100644
--- a/Examples/test-suite/go/overload_template_runme.go
+++ b/Examples/test-suite/go/overload_template_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_template"
+import . "swigtests/overload_template"
func main() {
_ = Foo()
diff --git a/Examples/test-suite/go/preproc_runme.go b/Examples/test-suite/go/preproc_runme.go
index 3c55aae..8783054 100644
--- a/Examples/test-suite/go/preproc_runme.go
+++ b/Examples/test-suite/go/preproc_runme.go
@@ -1,6 +1,6 @@
package main
-import "preproc"
+import "swigtests/preproc"
func main() {
if preproc.GetEndif() != 1 {
diff --git a/Examples/test-suite/go/primitive_ref_runme.go b/Examples/test-suite/go/primitive_ref_runme.go
index a1de2f8..8dcf9f5 100644
--- a/Examples/test-suite/go/primitive_ref_runme.go
+++ b/Examples/test-suite/go/primitive_ref_runme.go
@@ -1,6 +1,6 @@
package main
-import . "primitive_ref"
+import . "swigtests/primitive_ref"
func main() {
if Ref_int(3) != 3 {
diff --git a/Examples/test-suite/go/profiletest_runme.go b/Examples/test-suite/go/profiletest_runme.go
index c2b922b..68509f5 100644
--- a/Examples/test-suite/go/profiletest_runme.go
+++ b/Examples/test-suite/go/profiletest_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "profiletest"
+import "swigtests/profiletest"
func main() {
a := profiletest.NewA()
diff --git a/Examples/test-suite/go/refcount_runme.go b/Examples/test-suite/go/refcount_runme.go
index 07d4072..76e30dd 100644
--- a/Examples/test-suite/go/refcount_runme.go
+++ b/Examples/test-suite/go/refcount_runme.go
@@ -1,6 +1,6 @@
package main
-import . "refcount"
+import . "swigtests/refcount"
// very innocent example
diff --git a/Examples/test-suite/go/reference_global_vars_runme.go b/Examples/test-suite/go/reference_global_vars_runme.go
index 908358f..f8c1258 100644
--- a/Examples/test-suite/go/reference_global_vars_runme.go
+++ b/Examples/test-suite/go/reference_global_vars_runme.go
@@ -1,6 +1,6 @@
package main
-import . "reference_global_vars"
+import . "swigtests/reference_global_vars"
func main() {
// const class reference variable
diff --git a/Examples/test-suite/go/rename_scope_runme.go b/Examples/test-suite/go/rename_scope_runme.go
index 13bd3f1..4ad7549 100644
--- a/Examples/test-suite/go/rename_scope_runme.go
+++ b/Examples/test-suite/go/rename_scope_runme.go
@@ -1,6 +1,6 @@
package main
-import . "rename_scope"
+import . "swigtests/rename_scope"
func main() {
a := NewNatural_UP()
diff --git a/Examples/test-suite/go/rename_simple_runme.go b/Examples/test-suite/go/rename_simple_runme.go
index bd559ef..efe1edc 100644
--- a/Examples/test-suite/go/rename_simple_runme.go
+++ b/Examples/test-suite/go/rename_simple_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "rename_simple"
+import . "swigtests/rename_simple"
func main() {
s := NewNewStruct()
diff --git a/Examples/test-suite/go/rename_strip_encoder_runme.go b/Examples/test-suite/go/rename_strip_encoder_runme.go
index ae67060..74a0dba 100644
--- a/Examples/test-suite/go/rename_strip_encoder_runme.go
+++ b/Examples/test-suite/go/rename_strip_encoder_runme.go
@@ -1,6 +1,6 @@
package main
-import . "rename_strip_encoder"
+import . "swigtests/rename_strip_encoder"
func main() {
_ = NewSomeWidget()
diff --git a/Examples/test-suite/go/ret_by_value_runme.go b/Examples/test-suite/go/ret_by_value_runme.go
index 9659d21..345868d 100644
--- a/Examples/test-suite/go/ret_by_value_runme.go
+++ b/Examples/test-suite/go/ret_by_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "ret_by_value"
+import "swigtests/ret_by_value"
func main() {
a := ret_by_value.Get_test()
diff --git a/Examples/test-suite/go/return_const_value_runme.go b/Examples/test-suite/go/return_const_value_runme.go
index aadb126..fc6baa2 100644
--- a/Examples/test-suite/go/return_const_value_runme.go
+++ b/Examples/test-suite/go/return_const_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "return_const_value"
+import "swigtests/return_const_value"
func main() {
p := return_const_value.Foo_ptrGetPtr()
diff --git a/Examples/test-suite/go/smart_pointer_extend_runme.go b/Examples/test-suite/go/smart_pointer_extend_runme.go
index a851e26..f91c9ac 100644
--- a/Examples/test-suite/go/smart_pointer_extend_runme.go
+++ b/Examples/test-suite/go/smart_pointer_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_extend"
+import . "swigtests/smart_pointer_extend"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_member_runme.go b/Examples/test-suite/go/smart_pointer_member_runme.go
index e7fe7c4..ca2ac2c 100644
--- a/Examples/test-suite/go/smart_pointer_member_runme.go
+++ b/Examples/test-suite/go/smart_pointer_member_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "smart_pointer_member"
+import . "swigtests/smart_pointer_member"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_multi_runme.go b/Examples/test-suite/go/smart_pointer_multi_runme.go
index 7c76061..a8ec39f 100644
--- a/Examples/test-suite/go/smart_pointer_multi_runme.go
+++ b/Examples/test-suite/go/smart_pointer_multi_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_multi"
+import . "swigtests/smart_pointer_multi"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go b/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
index e584cf7..6bfd21e 100644
--- a/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
+++ b/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_multi_typedef"
+import . "swigtests/smart_pointer_multi_typedef"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_overload_runme.go b/Examples/test-suite/go/smart_pointer_overload_runme.go
index 9481554..c28ce61 100644
--- a/Examples/test-suite/go/smart_pointer_overload_runme.go
+++ b/Examples/test-suite/go/smart_pointer_overload_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_overload"
+import . "swigtests/smart_pointer_overload"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_rename_runme.go b/Examples/test-suite/go/smart_pointer_rename_runme.go
index 44841f5..22c0eb1 100644
--- a/Examples/test-suite/go/smart_pointer_rename_runme.go
+++ b/Examples/test-suite/go/smart_pointer_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_rename"
+import . "swigtests/smart_pointer_rename"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_simple_runme.go b/Examples/test-suite/go/smart_pointer_simple_runme.go
index b468bd2..8a14dcf 100644
--- a/Examples/test-suite/go/smart_pointer_simple_runme.go
+++ b/Examples/test-suite/go/smart_pointer_simple_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_simple"
+import . "swigtests/smart_pointer_simple"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_templatevariables_runme.go b/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
index 6d4ea91..8f7102d 100644
--- a/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
+++ b/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_templatevariables"
+import . "swigtests/smart_pointer_templatevariables"
func main() {
d := NewDiffImContainerPtr_D(Create(1234, 5678))
diff --git a/Examples/test-suite/go/smart_pointer_typedef_runme.go b/Examples/test-suite/go/smart_pointer_typedef_runme.go
index e89a8b1..5468a29 100644
--- a/Examples/test-suite/go/smart_pointer_typedef_runme.go
+++ b/Examples/test-suite/go/smart_pointer_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_typedef"
+import . "swigtests/smart_pointer_typedef"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/sneaky1_runme.go b/Examples/test-suite/go/sneaky1_runme.go
index 57c7797..c17f0ff 100644
--- a/Examples/test-suite/go/sneaky1_runme.go
+++ b/Examples/test-suite/go/sneaky1_runme.go
@@ -1,6 +1,6 @@
package main
-import "sneaky1"
+import "swigtests/sneaky1"
func main() {
_ = sneaky1.Add(3, 4)
diff --git a/Examples/test-suite/go/special_variable_macros_runme.go b/Examples/test-suite/go/special_variable_macros_runme.go
index 9338e65..597c487 100644
--- a/Examples/test-suite/go/special_variable_macros_runme.go
+++ b/Examples/test-suite/go/special_variable_macros_runme.go
@@ -1,6 +1,6 @@
package main
-import "special_variable_macros"
+import "swigtests/special_variable_macros"
func main() {
name := special_variable_macros.NewName()
diff --git a/Examples/test-suite/go/static_const_member_2_runme.go b/Examples/test-suite/go/static_const_member_2_runme.go
index ff8cbbb..7586eb4 100644
--- a/Examples/test-suite/go/static_const_member_2_runme.go
+++ b/Examples/test-suite/go/static_const_member_2_runme.go
@@ -1,6 +1,6 @@
package main
-import . "static_const_member_2"
+import . "swigtests/static_const_member_2"
func main() {
_ = NewTest_int()
diff --git a/Examples/test-suite/go/struct_initialization_runme.go b/Examples/test-suite/go/struct_initialization_runme.go
index a815bd3..d5eb4e9 100644
--- a/Examples/test-suite/go/struct_initialization_runme.go
+++ b/Examples/test-suite/go/struct_initialization_runme.go
@@ -1,6 +1,6 @@
package main
-import . "struct_initialization"
+import . "swigtests/struct_initialization"
func main() {
if GetInstanceC1().GetX() != 10 {
diff --git a/Examples/test-suite/go/struct_rename_runme.go b/Examples/test-suite/go/struct_rename_runme.go
index de99fc3..6d619e0 100644
--- a/Examples/test-suite/go/struct_rename_runme.go
+++ b/Examples/test-suite/go/struct_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "struct_rename"
+import "swigtests/struct_rename"
func main() {
_ = struct_rename.NewBar()
diff --git a/Examples/test-suite/go/struct_value_runme.go b/Examples/test-suite/go/struct_value_runme.go
index 3b5e5c1..c43a67a 100644
--- a/Examples/test-suite/go/struct_value_runme.go
+++ b/Examples/test-suite/go/struct_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "struct_value"
+import "swigtests/struct_value"
func main() {
b := struct_value.NewBar()
diff --git a/Examples/test-suite/go/template_default_arg_runme.go b/Examples/test-suite/go/template_default_arg_runme.go
index d67e63f..9558c74 100644
--- a/Examples/test-suite/go/template_default_arg_runme.go
+++ b/Examples/test-suite/go/template_default_arg_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_default_arg"
+import "swigtests/template_default_arg"
func main() {
helloInt := template_default_arg.NewHello_int()
diff --git a/Examples/test-suite/go/template_extend1_runme.go b/Examples/test-suite/go/template_extend1_runme.go
index 0912fa6..f2469ab 100644
--- a/Examples/test-suite/go/template_extend1_runme.go
+++ b/Examples/test-suite/go/template_extend1_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_extend1"
+import "swigtests/template_extend1"
func main() {
a := template_extend1.NewLBaz()
diff --git a/Examples/test-suite/go/template_extend2_runme.go b/Examples/test-suite/go/template_extend2_runme.go
index ced3d93..c3669bc 100644
--- a/Examples/test-suite/go/template_extend2_runme.go
+++ b/Examples/test-suite/go/template_extend2_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_extend2"
+import "swigtests/template_extend2"
func main() {
a := template_extend2.NewLBaz()
diff --git a/Examples/test-suite/go/template_inherit_runme.go b/Examples/test-suite/go/template_inherit_runme.go
index a8d5126..10071b1 100644
--- a/Examples/test-suite/go/template_inherit_runme.go
+++ b/Examples/test-suite/go/template_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_inherit"
+import . "swigtests/template_inherit"
func main() {
a := NewFooInt()
diff --git a/Examples/test-suite/go/template_ns4_runme.go b/Examples/test-suite/go/template_ns4_runme.go
index 6c658ec..c1b356b 100644
--- a/Examples/test-suite/go/template_ns4_runme.go
+++ b/Examples/test-suite/go/template_ns4_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_ns4"
+import . "swigtests/template_ns4"
func main() {
d := Make_Class_DD()
diff --git a/Examples/test-suite/go/template_ns_runme.go b/Examples/test-suite/go/template_ns_runme.go
index cfc56fa..e77c17b 100644
--- a/Examples/test-suite/go/template_ns_runme.go
+++ b/Examples/test-suite/go/template_ns_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_ns"
+import . "swigtests/template_ns"
func main() {
p1 := NewPairii(2, 3)
diff --git a/Examples/test-suite/go/template_opaque_runme.go b/Examples/test-suite/go/template_opaque_runme.go
index 71701df..b3bf610 100644
--- a/Examples/test-suite/go/template_opaque_runme.go
+++ b/Examples/test-suite/go/template_opaque_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_opaque"
+import "swigtests/template_opaque"
func main() {
v := template_opaque.NewOpaqueVectorType(int64(10))
diff --git a/Examples/test-suite/go/template_ref_type_runme.go b/Examples/test-suite/go/template_ref_type_runme.go
index a01ce3d..516b6c7 100644
--- a/Examples/test-suite/go/template_ref_type_runme.go
+++ b/Examples/test-suite/go/template_ref_type_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_ref_type"
+import "swigtests/template_ref_type"
func main() {
xr := template_ref_type.NewXC()
diff --git a/Examples/test-suite/go/template_rename_runme.go b/Examples/test-suite/go/template_rename_runme.go
index 6e04f88..08cf3fb 100644
--- a/Examples/test-suite/go/template_rename_runme.go
+++ b/Examples/test-suite/go/template_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_rename"
+import "swigtests/template_rename"
func main() {
i := template_rename.NewIFoo()
diff --git a/Examples/test-suite/go/template_static_runme.go b/Examples/test-suite/go/template_static_runme.go
index f10ea78..205813d 100644
--- a/Examples/test-suite/go/template_static_runme.go
+++ b/Examples/test-suite/go/template_static_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_static"
+import . "swigtests/template_static"
func main() {
FooBar_double(1)
diff --git a/Examples/test-suite/go/template_tbase_template_runme.go b/Examples/test-suite/go/template_tbase_template_runme.go
index e1c46aa..a483243 100644
--- a/Examples/test-suite/go/template_tbase_template_runme.go
+++ b/Examples/test-suite/go/template_tbase_template_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_tbase_template"
+import . "swigtests/template_tbase_template"
func main() {
a := Make_Class_dd()
diff --git a/Examples/test-suite/go/template_type_namespace_runme.go b/Examples/test-suite/go/template_type_namespace_runme.go
index 1356f9b..562fae7 100644
--- a/Examples/test-suite/go/template_type_namespace_runme.go
+++ b/Examples/test-suite/go/template_type_namespace_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_type_namespace"
+import . "swigtests/template_type_namespace"
func main() {
if Foo().Get(0) == "" {
diff --git a/Examples/test-suite/go/template_typedef_cplx3_runme.go b/Examples/test-suite/go/template_typedef_cplx3_runme.go
index 0a2b313..52a9bc7 100644
--- a/Examples/test-suite/go/template_typedef_cplx3_runme.go
+++ b/Examples/test-suite/go/template_typedef_cplx3_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_typedef_cplx3"
+import . "swigtests/template_typedef_cplx3"
func main() {
// this is OK
diff --git a/Examples/test-suite/go/template_typedef_cplx4_runme.go b/Examples/test-suite/go/template_typedef_cplx4_runme.go
index d8952cf..84347e4 100644
--- a/Examples/test-suite/go/template_typedef_cplx4_runme.go
+++ b/Examples/test-suite/go/template_typedef_cplx4_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_typedef_cplx4"
+import . "swigtests/template_typedef_cplx4"
func main() {
// this is OK
diff --git a/Examples/test-suite/go/threads_exception_runme.go b/Examples/test-suite/go/threads_exception_runme.go
index e3da1dc..b554f0e 100644
--- a/Examples/test-suite/go/threads_exception_runme.go
+++ b/Examples/test-suite/go/threads_exception_runme.go
@@ -1,7 +1,7 @@
package main
import "strings"
-import "threads_exception"
+import "swigtests/threads_exception"
func main() {
t := threads_exception.NewTest()
diff --git a/Examples/test-suite/go/typedef_class_runme.go b/Examples/test-suite/go/typedef_class_runme.go
index d94126d..157a917 100644
--- a/Examples/test-suite/go/typedef_class_runme.go
+++ b/Examples/test-suite/go/typedef_class_runme.go
@@ -1,6 +1,6 @@
package main
-import "typedef_class"
+import "swigtests/typedef_class"
func main() {
a := typedef_class.NewRealA()
diff --git a/Examples/test-suite/go/typedef_funcptr_runme.go b/Examples/test-suite/go/typedef_funcptr_runme.go
index 9d55f3f..f76f088 100644
--- a/Examples/test-suite/go/typedef_funcptr_runme.go
+++ b/Examples/test-suite/go/typedef_funcptr_runme.go
@@ -1,6 +1,6 @@
package main
-import . "typedef_funcptr"
+import . "swigtests/typedef_funcptr"
func main() {
a := 100
diff --git a/Examples/test-suite/go/typedef_inherit_runme.go b/Examples/test-suite/go/typedef_inherit_runme.go
index 7a65569..f2dbb32 100644
--- a/Examples/test-suite/go/typedef_inherit_runme.go
+++ b/Examples/test-suite/go/typedef_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import "typedef_inherit"
+import "swigtests/typedef_inherit"
func main() {
a := typedef_inherit.NewFoo()
diff --git a/Examples/test-suite/go/typedef_scope_runme.go b/Examples/test-suite/go/typedef_scope_runme.go
index af282b1..9c845bb 100644
--- a/Examples/test-suite/go/typedef_scope_runme.go
+++ b/Examples/test-suite/go/typedef_scope_runme.go
@@ -1,6 +1,6 @@
package main
-import "typedef_scope"
+import "swigtests/typedef_scope"
func main() {
b := typedef_scope.NewBar()
diff --git a/Examples/test-suite/go/typemap_namespace_runme.go b/Examples/test-suite/go/typemap_namespace_runme.go
index a2880d4..f086080 100644
--- a/Examples/test-suite/go/typemap_namespace_runme.go
+++ b/Examples/test-suite/go/typemap_namespace_runme.go
@@ -1,6 +1,6 @@
package main
-import . "typemap_namespace"
+import . "swigtests/typemap_namespace"
func main() {
if Test1("hello") != "hello" {
diff --git a/Examples/test-suite/go/typemap_ns_using_runme.go b/Examples/test-suite/go/typemap_ns_using_runme.go
index c4c21cf..00e1131 100644
--- a/Examples/test-suite/go/typemap_ns_using_runme.go
+++ b/Examples/test-suite/go/typemap_ns_using_runme.go
@@ -1,6 +1,6 @@
package main
-import "typemap_ns_using"
+import "swigtests/typemap_ns_using"
func main() {
if typemap_ns_using.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/typemap_out_optimal_runme.go b/Examples/test-suite/go/typemap_out_optimal_runme.go
index 7cc3b38..0cccd97 100644
--- a/Examples/test-suite/go/typemap_out_optimal_runme.go
+++ b/Examples/test-suite/go/typemap_out_optimal_runme.go
@@ -1,6 +1,6 @@
package main
-import . "typemap_out_optimal"
+import . "swigtests/typemap_out_optimal"
func main() {
SetXXDebug(false)
diff --git a/Examples/test-suite/go/typename_runme.go b/Examples/test-suite/go/typename_runme.go
index d166509..1e1696d 100644
--- a/Examples/test-suite/go/typename_runme.go
+++ b/Examples/test-suite/go/typename_runme.go
@@ -1,6 +1,6 @@
package main
-import "typename"
+import "swigtests/typename"
func main() {
f := typename.NewFoo()
diff --git a/Examples/test-suite/go/unions_runme.go b/Examples/test-suite/go/unions_runme.go
index b76ca5c..6e29811 100644
--- a/Examples/test-suite/go/unions_runme.go
+++ b/Examples/test-suite/go/unions_runme.go
@@ -3,7 +3,7 @@
package main
-import "unions"
+import "swigtests/unions"
func main() {
// Create new instances of SmallStruct and BigStruct for later use
diff --git a/Examples/test-suite/go/using1_runme.go b/Examples/test-suite/go/using1_runme.go
index a6a6fa7..09cc381 100644
--- a/Examples/test-suite/go/using1_runme.go
+++ b/Examples/test-suite/go/using1_runme.go
@@ -1,6 +1,6 @@
package main
-import "using1"
+import "swigtests/using1"
func main() {
if using1.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/using2_runme.go b/Examples/test-suite/go/using2_runme.go
index f6b8d49..8109037 100644
--- a/Examples/test-suite/go/using2_runme.go
+++ b/Examples/test-suite/go/using2_runme.go
@@ -1,6 +1,6 @@
package main
-import "using2"
+import "swigtests/using2"
func main() {
if using2.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/using_composition_runme.go b/Examples/test-suite/go/using_composition_runme.go
index 712d1fa..7ef09fe 100644
--- a/Examples/test-suite/go/using_composition_runme.go
+++ b/Examples/test-suite/go/using_composition_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_composition"
+import . "swigtests/using_composition"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_extend_runme.go b/Examples/test-suite/go/using_extend_runme.go
index 27d1ccc..dac300b 100644
--- a/Examples/test-suite/go/using_extend_runme.go
+++ b/Examples/test-suite/go/using_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_extend"
+import . "swigtests/using_extend"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_inherit_runme.go b/Examples/test-suite/go/using_inherit_runme.go
index a881718..c875590 100644
--- a/Examples/test-suite/go/using_inherit_runme.go
+++ b/Examples/test-suite/go/using_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_inherit"
+import . "swigtests/using_inherit"
func main() {
b := NewBar()
diff --git a/Examples/test-suite/go/using_private_runme.go b/Examples/test-suite/go/using_private_runme.go
index 2da62dc..4c86ef5 100644
--- a/Examples/test-suite/go/using_private_runme.go
+++ b/Examples/test-suite/go/using_private_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_private"
+import . "swigtests/using_private"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_protected_runme.go b/Examples/test-suite/go/using_protected_runme.go
index 3fd5029..4310818 100644
--- a/Examples/test-suite/go/using_protected_runme.go
+++ b/Examples/test-suite/go/using_protected_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_protected"
+import . "swigtests/using_protected"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/varargs_overload_runme.go b/Examples/test-suite/go/varargs_overload_runme.go
index 8ce580d..50a4308 100644
--- a/Examples/test-suite/go/varargs_overload_runme.go
+++ b/Examples/test-suite/go/varargs_overload_runme.go
@@ -1,6 +1,6 @@
package main
-import "varargs_overload"
+import "swigtests/varargs_overload"
func main() {
if varargs_overload.Vararg_over1("Hello") != "Hello" {
diff --git a/Examples/test-suite/go/varargs_runme.go b/Examples/test-suite/go/varargs_runme.go
index 60bd882..eb2fa94 100644
--- a/Examples/test-suite/go/varargs_runme.go
+++ b/Examples/test-suite/go/varargs_runme.go
@@ -1,6 +1,6 @@
package main
-import "varargs"
+import "swigtests/varargs"
func main() {
if varargs.Test("Hello") != "Hello" {
diff --git a/Examples/test-suite/go/virtual_derivation_runme.go b/Examples/test-suite/go/virtual_derivation_runme.go
index 4e2c6e5..2113530 100644
--- a/Examples/test-suite/go/virtual_derivation_runme.go
+++ b/Examples/test-suite/go/virtual_derivation_runme.go
@@ -1,6 +1,6 @@
package main
-import . "virtual_derivation"
+import . "swigtests/virtual_derivation"
// very innocent example
diff --git a/Examples/test-suite/go/virtual_poly_runme.go b/Examples/test-suite/go/virtual_poly_runme.go
index 32906b3..9973f24 100644
--- a/Examples/test-suite/go/virtual_poly_runme.go
+++ b/Examples/test-suite/go/virtual_poly_runme.go
@@ -1,6 +1,6 @@
package main
-import "virtual_poly"
+import "swigtests/virtual_poly"
func main() {
d := virtual_poly.NewNDouble(3.5)
diff --git a/Examples/test-suite/go/voidtest_runme.go b/Examples/test-suite/go/voidtest_runme.go
index 133545c..35c5289 100644
--- a/Examples/test-suite/go/voidtest_runme.go
+++ b/Examples/test-suite/go/voidtest_runme.go
@@ -1,6 +1,6 @@
package main
-import "voidtest"
+import "swigtests/voidtest"
func main() {
voidtest.Globalfunc()
diff --git a/Examples/test-suite/go/wrapmacro_runme.go b/Examples/test-suite/go/wrapmacro_runme.go
index a251a05..d792d4f 100644
--- a/Examples/test-suite/go/wrapmacro_runme.go
+++ b/Examples/test-suite/go/wrapmacro_runme.go
@@ -1,6 +1,6 @@
package main
-import "wrapmacro"
+import "swigtests/wrapmacro"
func main() {
a := 2
diff --git a/Examples/test-suite/li_std_containers_overload.i b/Examples/test-suite/li_std_containers_overload.i
new file mode 100644
index 0000000..5e7c28e
--- /dev/null
+++ b/Examples/test-suite/li_std_containers_overload.i
@@ -0,0 +1,33 @@
+%module li_std_containers_overload
+
+// Suppress warning that ought not to appear, but there is no easy fix
+%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) VectorOverload;
+
+%include <std_string.i>
+%include <std_vector.i>
+
+%inline %{
+struct X {};
+struct Y {};
+%}
+
+%template(VectorX) std::vector<X>;
+%template(VectorY) std::vector<Y>;
+%template(VectorString) std::vector<std::string>;
+%template(VectorInt) std::vector<int>;
+
+%inline %{
+using namespace std;
+string VectorOverload(vector<X> v) {
+ return "vector<X>";
+}
+string VectorOverload(vector<Y> v) {
+ return "vector<Y>";
+}
+string VectorOverload(vector<string> v) {
+ return "vector<string>";
+}
+string VectorOverload(vector<int> v) {
+ return "vector<int>";
+}
+%}
diff --git a/Examples/test-suite/li_std_wstring.i b/Examples/test-suite/li_std_wstring.i
index b2b7305..55d4538 100644
--- a/Examples/test-suite/li_std_wstring.i
+++ b/Examples/test-suite/li_std_wstring.i
@@ -1,7 +1,9 @@
%module li_std_wstring
-%include <std_basic_string.i>
-%include <std_wstring.i>
+// The languages below are yet to provide std_wstring.i
+#if !(defined(SWIGD) || defined(SWIGGO) || defined(SWIGGUILE) || defined(SWIGJAVASCRIPT) || defined(SWIGLUA) || defined(SWIGMZSCHEME) || defined(SWIGOCAML) || defined(SWIGOCTAVE) || defined(SWIGPERL) || defined(SWIGPHP) || defined(SWIGR) || defined(SWIGSCILAB))
+
+%include <std_wstring.i>
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
@@ -10,26 +12,7 @@
%}
%inline %{
-
-struct A : std::wstring
-{
- A(const std::wstring& s) : std::wstring(s)
- {
- }
-};
-
-struct B
-{
- B(const std::wstring& s) : cname(0), name(s), a(s)
- {
- }
-
- char *cname;
- std::wstring name;
- A a;
-
-};
-
+#include <string>
wchar_t test_wcvalue(wchar_t x) {
return x;
@@ -63,33 +46,18 @@
void test_pointer(std::wstring *x) {
}
-std::wstring *test_pointer_out() {
- static std::wstring x = L"x";
- return &x;
-}
-
void test_const_pointer(const std::wstring *x) {
}
-const std::wstring *test_const_pointer_out() {
- static std::wstring x = L"x";
- return &x;
-}
-
void test_reference(std::wstring &x) {
}
-std::wstring& test_reference_out() {
- static std::wstring x = L"x";
- return x;
-}
-
bool test_equal_abc(const std::wstring &s) {
return L"abc" == s;
}
void test_throw() TESTCASE_THROW1(std::wstring){
- static std::wstring x = L"x";
+ static std::wstring x = L"throwing test_throw";
throw x;
}
@@ -102,12 +70,7 @@
return s.size();
}
-#ifdef SWIGPYTHON_BUILTIN
-bool is_python_builtin() { return true; }
-#else
-bool is_python_builtin() { return false; }
-#endif
-
%}
+#endif
diff --git a/Examples/test-suite/li_std_wstring_inherit.i b/Examples/test-suite/li_std_wstring_inherit.i
new file mode 100644
index 0000000..54c6bd8
--- /dev/null
+++ b/Examples/test-suite/li_std_wstring_inherit.i
@@ -0,0 +1,39 @@
+%module li_std_wstring_inherit
+%include <std_basic_string.i>
+%include <std_wstring.i>
+
+
+%inline %{
+
+struct A : std::wstring
+{
+ A(const std::wstring& s) : std::wstring(s)
+ {
+ }
+};
+
+struct B
+{
+ B(const std::wstring& s) : cname(0), name(s), a(s)
+ {
+ }
+
+ char *cname;
+ std::wstring name;
+ A a;
+
+};
+
+std::wstring test_value(std::wstring x) {
+ return x;
+}
+
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+
+%}
+
+
diff --git a/Examples/test-suite/octave/li_std_containers_overload_runme.m b/Examples/test-suite/octave/li_std_containers_overload_runme.m
new file mode 100644
index 0000000..786d634
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_containers_overload_runme.m
@@ -0,0 +1,37 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+li_std_containers_overload
+
+function check(got, expected)
+ if (!strcmp(got, expected))
+ error("Failed check. '%s' != '%s'", got, expected)
+ endif
+end
+
+v = VectorX();
+check(VectorOverload(v), "vector<X>");
+
+v = VectorY();
+check(VectorOverload(v), "vector<Y>");
+
+v = VectorInt();
+check(VectorOverload(v), "vector<int>");
+
+v = VectorString();
+check(VectorOverload(v), "vector<string>");
+
+# TODO: Conversion from an Octave sequence not implemented yet
+# v = {X()};
+# check(VectorOverload(v), "vector<X>");
+
+# v = {Y()};
+# check(VectorOverload(v), "vector<Y>");
+
+# v = {1, 2, 3};
+# check(VectorOverload(v), "vector<int>");
+
+# v = {"aaa", "bbb", "ccc"};
+# check(VectorOverload(v), "vector<string>");
diff --git a/Examples/test-suite/octave/li_std_wstring_runme.m b/Examples/test-suite/octave/li_std_wstring_runme.m
deleted file mode 100644
index cbccc0c..0000000
--- a/Examples/test-suite/octave/li_std_wstring_runme.m
+++ /dev/null
@@ -1,95 +0,0 @@
-# do not dump Octave core
-if exist("crash_dumps_octave_core", "builtin")
- crash_dumps_octave_core(0);
-endif
-
-li_std_wstring
-
-x="h";
-
-if (li_std_wstring.test_wcvalue(x) != x)
- error("bad string mapping")
-endif
-
-x="hello";
-if (li_std_wstring.test_ccvalue(x) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_cvalue(x) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_value(x) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_const_reference(x) != x)
- error("bad string mapping")
-endif
-
-
-s = li_std_wstring.wstring("he");
-s = s + "llo";
-
-if (s != x)
- error("bad string mapping")
-endif
-
-if (s(1:4) != x(1:4))
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_value(s) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_const_reference(s) != x)
- error("bad string mapping")
-endif
-
-a = li_std_wstring.A(s);
-
-if (li_std_wstring.test_value(a) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_const_reference(a) != x)
- error("bad string mapping")
-endif
-
-b = li_std_wstring.wstring(" world");
-
-if (a + b != "hello world")
- error("bad string mapping")
-endif
-
-if (a + " world" != "hello world")
- error("bad string mapping")
-endif
-
-if ("hello" + b != "hello world")
- error("bad string mapping")
-endif
-
-c = "hello" + b;
-if (c.find_last_of("l") != 9)
- error("bad string mapping")
-endif
-
-s = "hello world";
-
-b = li_std_wstring.B("hi");
-
-b.name = li_std_wstring.wstring("hello");
-if (b.name != "hello")
- error("bad string mapping")
-endif
-
-
-b.a = li_std_wstring.A("hello");
-if (b.a != "hello")
- error("bad string mapping")
-endif
-
-
diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in
index 0151f59..be06f7e 100644
--- a/Examples/test-suite/python/Makefile.in
+++ b/Examples/test-suite/python/Makefile.in
@@ -55,7 +55,7 @@
li_std_vectora \
li_std_vector_extra \
li_std_wstream \
- li_std_wstring \
+ li_std_wstring_inherit \
primitive_types \
python_abstractbase \
python_append \
diff --git a/Examples/test-suite/python/li_std_containers_overload_runme.py b/Examples/test-suite/python/li_std_containers_overload_runme.py
new file mode 100644
index 0000000..dcb3835
--- /dev/null
+++ b/Examples/test-suite/python/li_std_containers_overload_runme.py
@@ -0,0 +1,29 @@
+from li_std_containers_overload import *
+
+def check(got, expected):
+ if got != expected:
+ raise RuntimeError("Failed check. '{}' != '{}'".format(got, expected))
+
+v = VectorX()
+check(VectorOverload(v), "vector<X>")
+
+v = VectorY()
+check(VectorOverload(v), "vector<Y>")
+
+v = VectorInt()
+check(VectorOverload(v), "vector<int>")
+
+v = VectorString()
+check(VectorOverload(v), "vector<string>")
+
+v = [X()]
+check(VectorOverload(v), "vector<X>")
+
+v = [Y()]
+check(VectorOverload(v), "vector<Y>")
+
+v = [1, 2, 3]
+check(VectorOverload(v), "vector<int>")
+
+v = ["aaa", "bbb", "ccc"]
+check(VectorOverload(v), "vector<string>")
diff --git a/Examples/test-suite/python/li_std_wstring_inherit_runme.py b/Examples/test-suite/python/li_std_wstring_inherit_runme.py
new file mode 100644
index 0000000..558914e
--- /dev/null
+++ b/Examples/test-suite/python/li_std_wstring_inherit_runme.py
@@ -0,0 +1,45 @@
+import li_std_wstring_inherit
+import sys
+
+x = u"hello"
+
+s = li_std_wstring_inherit.wstring(u"he")
+s = s + u"llo"
+
+if s != x:
+ print s, x
+ raise RuntimeError("bad string mapping")
+
+if s[1:4] != x[1:4]:
+ raise RuntimeError("bad string mapping")
+
+a = li_std_wstring_inherit.A(s)
+b = li_std_wstring_inherit.wstring(" world")
+
+if a + b != "hello world":
+ raise RuntimeError("bad string mapping")
+
+if a + " world" != "hello world":
+ raise RuntimeError("bad string mapping")
+
+# This is expected to fail if -builtin is used
+# Reverse operators not supported in builtin types
+if not li_std_wstring_inherit.is_python_builtin():
+ if "hello" + b != "hello world":
+ raise RuntimeError("bad string mapping")
+
+ c = "hello" + b
+ if c.find_last_of("l") != 9:
+ raise RuntimeError("bad string mapping")
+
+b = li_std_wstring_inherit.B("hi")
+
+b.name = li_std_wstring_inherit.wstring(u"hello")
+if b.name != "hello":
+ raise RuntimeError("bad string mapping")
+
+
+b.a = li_std_wstring_inherit.A("hello")
+if b.a != u"hello":
+ raise RuntimeError("bad string mapping")
+
diff --git a/Examples/test-suite/python/li_std_wstring_runme.py b/Examples/test-suite/python/li_std_wstring_runme.py
index bd49a43..c6210e2 100644
--- a/Examples/test-suite/python/li_std_wstring_runme.py
+++ b/Examples/test-suite/python/li_std_wstring_runme.py
@@ -1,87 +1,60 @@
import li_std_wstring
import sys
-x = u"h"
+def check_equal(a, b):
+ if a != b:
+ raise RuntimeError("failed {} {}".format(a, b))
-if li_std_wstring.test_wcvalue(x) != x:
- print li_std_wstring.test_wcvalue(x)
- raise RuntimeError("bad string mapping")
+h = u"h"
+check_equal(li_std_wstring.test_wcvalue(h), h)
-x = u"hello"
-if li_std_wstring.test_ccvalue(x) != x:
- raise RuntimeError("bad string mapping")
+x = u"abc"
+check_equal(li_std_wstring.test_ccvalue(x), x)
+check_equal(li_std_wstring.test_cvalue(x), x)
-if li_std_wstring.test_cvalue(x) != x:
- raise RuntimeError("bad string mapping")
+check_equal(li_std_wstring.test_wchar_overload(x), x)
+check_equal(li_std_wstring.test_wchar_overload(), None)
-if li_std_wstring.test_wchar_overload(x) != x:
- raise RuntimeError("bad string mapping")
+li_std_wstring.test_pointer(None)
+li_std_wstring.test_const_pointer(None)
-if li_std_wstring.test_wchar_overload("not unicode") != "not unicode":
- raise RuntimeError("bad string mapping")
+try:
+ li_std_wstring.test_value(None)
+ raise RuntimeError("NULL check failed")
+except TypeError as e:
+ pass
-if li_std_wstring.test_value(x) != x:
- print x, li_std_wstring.test_value(x)
- raise RuntimeError("bad string mapping")
+try:
+ li_std_wstring.test_reference(None)
+ raise RuntimeError("NULL check failed")
+except ValueError as e:
+ if "invalid null reference" not in str(e):
+ raise RuntimeError("Missing text {}".format(e))
+try:
+ li_std_wstring.test_const_reference(None)
+ raise RuntimeError("NULL check failed")
+except ValueError as e:
+ if "invalid null reference" not in str(e):
+ raise RuntimeError("Missing text {}".format(e))
-if li_std_wstring.test_const_reference(x) != x:
- raise RuntimeError("bad string mapping")
+x = "hello"
+check_equal(li_std_wstring.test_const_reference(x), x)
+s = "abc"
+if not li_std_wstring.test_equal_abc(s):
+ raise RuntimeError("Not equal {}".format(s))
-s = li_std_wstring.wstring(u"he")
-s = s + u"llo"
+try:
+ li_std_wstring.test_throw
+except RuntimeError as e:
+ check_equal(e.message, "throwing test_throw")
-if s != x:
- print s, x
- raise RuntimeError("bad string mapping")
+x = "abc\0def"
+check_equal(li_std_wstring.test_value(x), x)
+check_equal(li_std_wstring.test_ccvalue(x), "abc")
+check_equal(li_std_wstring.test_wchar_overload(x), "abc")
-if s[1:4] != x[1:4]:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_value(s) != x:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_const_reference(s) != x:
- raise RuntimeError("bad string mapping")
-
-a = li_std_wstring.A(s)
-
-if li_std_wstring.test_value(a) != x:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_const_reference(a) != x:
- raise RuntimeError("bad string mapping")
-
-b = li_std_wstring.wstring(" world")
-
-if a + b != "hello world":
- raise RuntimeError("bad string mapping")
-
-if a + " world" != "hello world":
- raise RuntimeError("bad string mapping")
-
-# This is expected to fail if -builtin is used
-# Reverse operators not supported in builtin types
-if not li_std_wstring.is_python_builtin():
- if "hello" + b != "hello world":
- raise RuntimeError("bad string mapping")
-
- c = "hello" + b
- if c.find_last_of("l") != 9:
- raise RuntimeError("bad string mapping")
-
-s = "hello world"
-
-b = li_std_wstring.B("hi")
-
-b.name = li_std_wstring.wstring(u"hello")
-if b.name != "hello":
- raise RuntimeError("bad string mapping")
-
-
-b.a = li_std_wstring.A("hello")
-if b.a != u"hello":
- raise RuntimeError("bad string mapping")
+################### Python specific
# Byte strings only converted in Python 2
if sys.version_info[0:2] < (3, 0):
diff --git a/Examples/test-suite/ruby/Makefile.in b/Examples/test-suite/ruby/Makefile.in
index 6393026..d75cdb0 100644
--- a/Examples/test-suite/ruby/Makefile.in
+++ b/Examples/test-suite/ruby/Makefile.in
@@ -20,7 +20,7 @@
li_std_queue \
li_std_set \
li_std_stack \
- li_std_wstring \
+ li_std_wstring_inherit \
primitive_types \
ruby_alias_method \
ruby_keywords \
diff --git a/Examples/test-suite/ruby/li_std_containers_overload_runme.rb b/Examples/test-suite/ruby/li_std_containers_overload_runme.rb
new file mode 100644
index 0000000..913b611
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_containers_overload_runme.rb
@@ -0,0 +1,44 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_containers_overload'
+
+include Li_std_containers_overload
+
+def check(got, expected)
+ if (got != expected)
+ raise RuntimeError, "Failed check. '#{got}' != '#{expected}'"
+ end
+end
+
+v = VectorX.new()
+check(VectorOverload(v), "vector<X>")
+
+v = VectorY.new()
+check(VectorOverload(v), "vector<Y>")
+
+v = VectorInt.new()
+check(VectorOverload(v), "vector<int>")
+
+v = VectorString.new()
+check(VectorOverload(v), "vector<string>")
+
+v = [X.new()]
+check(VectorOverload(v), "vector<X>")
+
+v = [Y.new()]
+check(VectorOverload(v), "vector<Y>")
+
+v = [1, 2, 3]
+check(VectorOverload(v), "vector<int>")
+
+v = ["aaa", "bbb", "ccc"]
+check(VectorOverload(v), "vector<string>")
diff --git a/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb b/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb
new file mode 100644
index 0000000..b5a90d8
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+require 'swig_assert'
+require 'li_std_wstring_inherit'
+x = "abc"
+swig_assert_equal("Li_std_wstring_inherit.test_value(Li_std_wstring_inherit::Wstring.new(x))", "x", binding)
+
+
+x = "y"
+swig_assert_equal("Li_std_wstring_inherit.test_value(x)", "x", binding)
+a = Li_std_wstring_inherit::A.new(x)
+swig_assert_equal("Li_std_wstring_inherit.test_value(a)", "x", binding)
+
diff --git a/Examples/test-suite/ruby/li_std_wstring_runme.rb b/Examples/test-suite/ruby/li_std_wstring_runme.rb
index 0cf38ae..4922d8d 100644
--- a/Examples/test-suite/ruby/li_std_wstring_runme.rb
+++ b/Examples/test-suite/ruby/li_std_wstring_runme.rb
@@ -2,38 +2,48 @@
require 'swig_assert'
require 'li_std_wstring'
-x = "abc"
-swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", "x", binding)
-swig_assert_equal("Li_std_wstring.test_ccvalue(x)", "x", binding)
-swig_assert_equal("Li_std_wstring.test_value(Li_std_wstring::Wstring.new(x))", "x", binding)
+h = "h"
+swig_assert_equal("Li_std_wstring.test_wcvalue(h)", "h", binding)
+x = "abc"
+swig_assert_equal("Li_std_wstring.test_ccvalue(x)", "x", binding)
+swig_assert_equal("Li_std_wstring.test_cvalue(x)", "x", binding)
+
+swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", "x", binding)
swig_assert_equal("Li_std_wstring.test_wchar_overload()", "nil", binding)
-swig_assert_equal("Li_std_wstring.test_pointer(Li_std_wstring::Wstring.new(x))", "nil", binding)
-swig_assert_equal("Li_std_wstring.test_const_pointer(Li_std_wstring::Wstring.new(x))", "nil", binding)
-swig_assert_equal("Li_std_wstring.test_const_pointer(Li_std_wstring::Wstring.new(x))", "nil", binding)
-swig_assert_equal("Li_std_wstring.test_reference(Li_std_wstring::Wstring.new(x))", "nil", binding)
+Li_std_wstring.test_pointer(nil)
+Li_std_wstring.test_const_pointer(nil)
-x = "y"
-swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding)
-a = Li_std_wstring::A.new(x)
-swig_assert_equal("Li_std_wstring.test_value(a)", "x", binding)
+begin
+ Li_std_wstring.test_value(nil)
+ raise RuntimeError, "NULL check failed"
+rescue TypeError => e
+end
+
+begin
+ Li_std_wstring.test_reference(nil)
+ raise RuntimeError, "NULL check failed"
+rescue ArgumentError => e
+ swig_assert_simple(e.message.include? "invalid null reference")
+end
+begin
+ Li_std_wstring.test_const_reference(nil)
+ raise RuntimeError, "NULL check failed"
+rescue ArgumentError => e
+ swig_assert_simple(e.message.include? "invalid null reference")
+end
x = "hello"
swig_assert_equal("Li_std_wstring.test_const_reference(x)", "x", binding)
-
-swig_assert_equal("Li_std_wstring.test_pointer_out", "'x'", binding)
-swig_assert_equal("Li_std_wstring.test_const_pointer_out", "'x'", binding)
-swig_assert_equal("Li_std_wstring.test_reference_out()", "'x'", binding)
-
s = "abc"
swig_assert("Li_std_wstring.test_equal_abc(s)", binding)
begin
Li_std_wstring.test_throw
rescue RuntimeError => e
- swig_assert_equal("e.message", "'x'", binding)
+ swig_assert_equal("e.message", "'throwing test_throw'", binding)
end
x = "abc\0def"
diff --git a/Examples/test-suite/typemap_template_parms.i b/Examples/test-suite/typemap_template_parms.i
index fd0f7f5..90231e8 100644
--- a/Examples/test-suite/typemap_template_parms.i
+++ b/Examples/test-suite/typemap_template_parms.i
@@ -26,3 +26,16 @@
%}
%template(Xint) X<int>;
+
+
+// The function name and parameter name are both 'labels'
+%inline %{
+template <typename T>
+void labels(T labels) {}
+void voido(int vooo) {}
+%}
+
+// TODO: R has a problem with parameter names clashing with the function name
+#if !defined(SWIGR)
+%template(ShortLabels) labels<short>;
+#endif
diff --git a/Lib/csharp/std_wstring.i b/Lib/csharp/std_wstring.i
index 09bdaaa..162b90e 100644
--- a/Lib/csharp/std_wstring.i
+++ b/Lib/csharp/std_wstring.i
@@ -23,7 +23,10 @@
// wstring
%typemap(ctype, out="void *") wstring "wchar_t *"
-%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") wstring "string"
+%typemap(imtype,
+ inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]"
+ ) wstring "string"
%typemap(cstype) wstring "string"
%typemap(csdirectorin) wstring "$iminput"
%typemap(csdirectorout) wstring "$cscall"
@@ -60,7 +63,10 @@
// const wstring &
%typemap(ctype, out="void *") const wstring & "wchar_t *"
-%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") const wstring & "string"
+%typemap(imtype,
+ inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]"
+ ) const wstring & "string"
%typemap(cstype) const wstring & "string"
%typemap(csdirectorin) const wstring & "$iminput"
diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i
index 9361edf..7981941 100644
--- a/Lib/csharp/wchar.i
+++ b/Lib/csharp/wchar.i
@@ -20,6 +20,7 @@
%pragma(csharp) imclasscode=%{
protected class SWIGWStringHelper {
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]
public delegate string SWIGWStringDelegate(global::System.IntPtr message);
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
@@ -52,7 +53,7 @@
// wchar_t
%typemap(ctype) wchar_t "wchar_t"
-%typemap(imtype) wchar_t "char"
+%typemap(imtype) wchar_t "char" // Requires adding CharSet=CharSet.Unicode to the DllImport to correctly marshal Unicode characters
%typemap(cstype) wchar_t "char"
%typemap(csin) wchar_t "$csinput"
diff --git a/Lib/octave/octcontainer.swg b/Lib/octave/octcontainer.swg
index 269ff75..310a849 100644
--- a/Lib/octave/octcontainer.swg
+++ b/Lib/octave/octcontainer.swg
@@ -401,20 +401,14 @@
return const_reference(_seq, n);
}
- bool check(bool set_err = true) const
+ bool check() const
{
int s = size();
for (int i = 0; i < s; ++i) {
// swig::SwigVar_PyObject item = OctSequence_GetItem(_seq, i);
octave_value item; // * todo
- if (!swig::check<value_type>(item)) {
- if (set_err) {
- char msg[1024];
- sprintf(msg, "in sequence element %d", i);
- SWIG_Error(SWIG_RuntimeError, msg);
- }
+ if (!swig::check<value_type>(item))
return false;
- }
}
return true;
}
diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg
index ef2f725..fef4e9b 100644
--- a/Lib/python/pycontainer.swg
+++ b/Lib/python/pycontainer.swg
@@ -672,19 +672,13 @@
return const_reference(_seq, n);
}
- bool check(bool set_err = true) const
+ bool check() const
{
Py_ssize_t s = size();
for (Py_ssize_t i = 0; i < s; ++i) {
swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i);
- if (!swig::check<value_type>(item)) {
- if (set_err) {
- char msg[1024];
- sprintf(msg, "in sequence element %d", (int)i);
- SWIG_Error(SWIG_RuntimeError, msg);
- }
+ if (!swig::check<value_type>(item))
return false;
- }
}
return true;
}
diff --git a/Lib/ruby/rubycontainer.swg b/Lib/ruby/rubycontainer.swg
index e8830a7..9fa205b 100644
--- a/Lib/ruby/rubycontainer.swg
+++ b/Lib/ruby/rubycontainer.swg
@@ -395,19 +395,13 @@
return const_reference(_seq, n);
}
- bool check(bool set_err = false) const
+ bool check() const
{
int s = (int) size();
for (int i = 0; i < s; ++i) {
VALUE item = rb_ary_entry(_seq, i );
- if (!swig::check<value_type>(item)) {
- if (set_err) {
- char msg[1024];
- sprintf(msg, "in sequence element %d", i);
- SWIG_Error(SWIG_RuntimeError, msg);
- }
+ if (!swig::check<value_type>(item))
return false;
- }
}
return true;
}
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index 08c92b9..470b7d0 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -1779,7 +1779,7 @@
} else {
Swig_error(cparse_file, cparse_line, "Syntax error in input(1).\n");
}
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
/* Out of class constructor/destructor declarations */
| c_constructor_decl {
@@ -3359,7 +3359,7 @@
} else {
Swig_error(cparse_file, cparse_line, "Syntax error - possibly a missing semicolon.\n");
}
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
;
@@ -3649,7 +3649,7 @@
}
if (err) {
Swig_error(cparse_file,cparse_line,"Syntax error in input(2).\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
;
@@ -4632,7 +4632,7 @@
int start_line = cparse_line;
skip_decl();
Swig_error(cparse_file,start_line,"Syntax error in input(3).\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
} cpp_members {
$$ = $3;
}
diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c
index 6b1a270..22d49fa 100644
--- a/Source/CParse/templ.c
+++ b/Source/CParse/templ.c
@@ -26,14 +26,19 @@
}
-static void add_parms(ParmList *p, List *patchlist, List *typelist) {
+static void add_parms(ParmList *p, List *patchlist, List *typelist, int is_pattern) {
while (p) {
SwigType *ty = Getattr(p, "type");
SwigType *val = Getattr(p, "value");
- SwigType *name = Getattr(p, "name");
Append(typelist, ty);
Append(typelist, val);
- Append(typelist, name);
+ if (is_pattern) {
+ /* Typemap patterns are not simple parameter lists.
+ * Output style ("out", "ret" etc) typemap names can be
+ * qualified names and so may need template expansion */
+ SwigType *name = Getattr(p, "name");
+ Append(typelist, name);
+ }
Append(patchlist, val);
p = nextSibling(p);
}
@@ -108,8 +113,8 @@
Append(typelist, Getattr(n, "name"));
}
- add_parms(Getattr(n, "parms"), cpatchlist, typelist);
- add_parms(Getattr(n, "throws"), cpatchlist, typelist);
+ add_parms(Getattr(n, "parms"), cpatchlist, typelist, 0);
+ add_parms(Getattr(n, "throws"), cpatchlist, typelist, 0);
} else if (Equal(nodeType, "class")) {
/* Patch base classes */
@@ -175,8 +180,8 @@
}
Append(cpatchlist, Getattr(n, "code"));
Append(typelist, Getattr(n, "decl"));
- add_parms(Getattr(n, "parms"), cpatchlist, typelist);
- add_parms(Getattr(n, "throws"), cpatchlist, typelist);
+ add_parms(Getattr(n, "parms"), cpatchlist, typelist, 0);
+ add_parms(Getattr(n, "throws"), cpatchlist, typelist, 0);
} else if (Equal(nodeType, "destructor")) {
/* We only need to patch the dtor of the template itself, not the destructors of any nested classes, so check that the parent of this node is the root
* template node, with the special exception for %extend which adds its methods under an intermediate node. */
@@ -217,10 +222,10 @@
Append(cpatchlist, Getattr(n, "code"));
Append(typelist, Getattr(n, "type"));
Append(typelist, Getattr(n, "decl"));
- add_parms(Getattr(n, "parms"), cpatchlist, typelist);
- add_parms(Getattr(n, "kwargs"), cpatchlist, typelist);
- add_parms(Getattr(n, "pattern"), cpatchlist, typelist);
- add_parms(Getattr(n, "throws"), cpatchlist, typelist);
+ add_parms(Getattr(n, "parms"), cpatchlist, typelist, 0);
+ add_parms(Getattr(n, "kwargs"), cpatchlist, typelist, 0);
+ add_parms(Getattr(n, "pattern"), cpatchlist, typelist, 1);
+ add_parms(Getattr(n, "throws"), cpatchlist, typelist, 0);
cn = firstChild(n);
while (cn) {
cparse_template_expand(templnode, cn, tname, rname, templateargs, patchlist, typelist, cpatchlist);
diff --git a/Source/DOH/base.c b/Source/DOH/base.c
index 12351dd..f5e4188 100644
--- a/Source/DOH/base.c
+++ b/Source/DOH/base.c
@@ -756,25 +756,6 @@
}
/* -----------------------------------------------------------------------------
- * DohClose()
- * ----------------------------------------------------------------------------- */
-
-/*
-int DohClose(DOH *obj) {
- DohBase *b = (DohBase *) obj;
- DohObjInfo *objinfo;
- if (DohCheck(obj)) {
- objinfo = b->type;
- if (objinfo->doh_file->doh_close) {
- return (objinfo->doh_file->doh_close) (b);
- }
- return 0;
- }
- return fclose((FILE *) obj);
-}
-*/
-
-/* -----------------------------------------------------------------------------
* DohIsString()
* ----------------------------------------------------------------------------- */
diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h
index 5a9bae2..7fb64c0 100644
--- a/Source/DOH/doh.h
+++ b/Source/DOH/doh.h
@@ -103,7 +103,6 @@
#define DohNewFileFromFile DOH_NAMESPACE(NewFileFromFile)
#define DohNewFileFromFd DOH_NAMESPACE(NewFileFromFd)
#define DohFileErrorDisplay DOH_NAMESPACE(FileErrorDisplay)
-#define DohClose DOH_NAMESPACE(Close)
#define DohCopyto DOH_NAMESPACE(Copyto)
#define DohNewList DOH_NAMESPACE(NewList)
#define DohNewHash DOH_NAMESPACE(NewHash)
@@ -303,15 +302,12 @@
* Files
* ----------------------------------------------------------------------------- */
-extern DOHFile *DohNewFile(DOH *filename, const char *mode, DOHList *outfiles);
+extern DOHFile *DohNewFile(DOHString *filename, const char *mode, DOHList *outfiles);
extern DOHFile *DohNewFileFromFile(FILE *f);
extern DOHFile *DohNewFileFromFd(int fd);
extern void DohFileErrorDisplay(DOHString * filename);
-/*
- Deprecated, just use DohDelete
-extern int DohClose(DOH *file);
-*/
extern int DohCopyto(DOHFile * input, DOHFile * output);
+extern void DohCloseAllOpenFiles(void);
/* -----------------------------------------------------------------------------
@@ -392,7 +388,6 @@
/* #define StringChar DohStringChar */
/* #define StringEqual DohStringEqual */
-#define Close DohClose
#define vPrintf DohvPrintf
#define GetInt DohGetInt
#define GetDouble DohGetDouble
@@ -424,7 +419,6 @@
#define NewFileFromFile DohNewFileFromFile
#define NewFileFromFd DohNewFileFromFd
#define FileErrorDisplay DohFileErrorDisplay
-#define Close DohClose
#define NewVoid DohNewVoid
#define Keys DohKeys
#define Strcmp DohStrcmp
@@ -432,6 +426,7 @@
#define Strstr DohStrstr
#define Strchr DohStrchr
#define Copyto DohCopyto
+#define CloseAllOpenFiles DohCloseAllOpenFiles
#define Split DohSplit
#define SplitLines DohSplitLines
#define Setmark DohSetmark
diff --git a/Source/DOH/dohint.h b/Source/DOH/dohint.h
index c073bd9..87def9d 100644
--- a/Source/DOH/dohint.h
+++ b/Source/DOH/dohint.h
@@ -49,7 +49,6 @@
int (*doh_ungetc) (DOH *obj, int ch); /* Unget character */
int (*doh_seek) (DOH *obj, long offset, int whence); /* Seek */
long (*doh_tell) (DOH *obj); /* Tell */
- int (*doh_close) (DOH *obj); /* Close */
} DohFileMethods;
/* String methods */
diff --git a/Source/DOH/file.c b/Source/DOH/file.c
index 5c56771..570f84e 100644
--- a/Source/DOH/file.c
+++ b/Source/DOH/file.c
@@ -26,6 +26,73 @@
} DohFile;
/* -----------------------------------------------------------------------------
+ * open_files_list_instance
+ * open_files_list_add
+ * open_files_list_remove
+ *
+ * Singleton list containing all the files that have been opened by DohNewFile.
+ * Open file pointers are held in the list as strings so as to not affect the
+ * reference count of the underlying DOH objects.
+ * ----------------------------------------------------------------------------- */
+
+static DOHList *open_files_list_instance() {
+ static DOHList *all_open_files = 0;
+ if (!all_open_files)
+ all_open_files = DohNewList();
+ return all_open_files;
+}
+
+static void open_files_list_add(DohFile *f) {
+ DOHList *all_open_files = open_files_list_instance();
+ DOHString *sf = NewStringf("%p", f);
+ Append(all_open_files, sf);
+ Delete(sf);
+}
+
+static void open_files_list_remove(DohFile *f) {
+ int i;
+ int removed = 0;
+ DOHList *all_open_files = open_files_list_instance();
+ DOHString *sf = NewStringf("%p", f);
+ for (i = 0; i < DohLen(all_open_files); i++) {
+ DOHString *sf_i = Getitem(all_open_files, i);
+ if (Strcmp(sf, sf_i) == 0) {
+ DohDelitem(all_open_files, i);
+ removed = 1;
+ break;
+ }
+ }
+ Delete(sf);
+ assert(removed);
+}
+
+/* -----------------------------------------------------------------------------
+ * DohCloseAllOpenFiles()
+ *
+ * Close all opened files, to be called on program termination
+ * ----------------------------------------------------------------------------- */
+
+void DohCloseAllOpenFiles() {
+ int i;
+ DOHList *all_open_files = open_files_list_instance();
+ for (i = 0; i < DohLen(all_open_files); i++) {
+ DohFile *f = 0;
+ DOHString *sf = Getitem(all_open_files, i);
+ int check = sscanf(Char(sf), "%p", (void **)&f);
+ assert(check == 1);
+ if (f->closeondel) {
+ if (f->filep) {
+ check = fclose(f->filep);
+ assert(check == 0);
+ }
+ f->closeondel = 0;
+ f->filep = 0;
+ }
+ }
+ DohClear(all_open_files);
+}
+
+/* -----------------------------------------------------------------------------
* DelFile()
* ----------------------------------------------------------------------------- */
@@ -40,6 +107,7 @@
close(f->fd);
}
#endif
+ open_files_list_remove(f);
}
DohFree(f);
}
@@ -166,27 +234,6 @@
return -1;
}
-/* -----------------------------------------------------------------------------
- * File_close()
- *
- * Close the file
- * ----------------------------------------------------------------------------- */
-
-static int File_close(DOH *fo) {
- int ret = 0;
- DohFile *f = (DohFile *) ObjData(fo);
- if (f->filep) {
- ret = fclose(f->filep);
- f->filep = 0;
- } else if (f->fd) {
-#ifdef DOH_INTFILE
- ret = close(f->fd);
- f->fd = 0;
-#endif
- }
- return ret;
-}
-
static DohFileMethods FileFileMethods = {
File_read,
File_write,
@@ -195,7 +242,6 @@
File_ungetc,
File_seek,
File_tell,
- File_close, /* close */
};
static DohObjInfo DohFileType = {
@@ -231,8 +277,9 @@
* If newfiles is non-zero, the filename is added to the list of new files.
* ----------------------------------------------------------------------------- */
-DOH *DohNewFile(DOH *filename, const char *mode, DOHList *newfiles) {
+DOH *DohNewFile(DOHString *filename, const char *mode, DOHList *newfiles) {
DohFile *f;
+ DOH *obj;
FILE *file;
char *filen;
@@ -251,7 +298,9 @@
f->filep = file;
f->fd = 0;
f->closeondel = 1;
- return DohObjMalloc(&DohFileType, f);
+ obj = DohObjMalloc(&DohFileType, f);
+ open_files_list_add(f);
+ return obj;
}
/* -----------------------------------------------------------------------------
diff --git a/Source/DOH/string.c b/Source/DOH/string.c
index 94d2737..6c67285 100644
--- a/Source/DOH/string.c
+++ b/Source/DOH/string.c
@@ -987,7 +987,6 @@
String_ungetc,
String_seek,
String_tell,
- 0, /* close */
};
static DohStringMethods StringStringMethods = {
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index 76ec6a4..17100b3 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -1533,7 +1533,7 @@
if (classname_substituted_flag) {
if (SwigType_isenum(t)) {
// This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on)
- Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname));
+ Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
} else {
// This handles function pointers using the %constant directive
Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx
index 7b42ff9..461c69e 100644
--- a/Source/Modules/guile.cxx
+++ b/Source/Modules/guile.cxx
@@ -255,7 +255,7 @@
if (goops) {
if (linkage != GUILE_LSTYLE_PASSIVE && linkage != GUILE_LSTYLE_MODULE) {
Printf(stderr, "guile: GOOPS support requires passive or module linkage\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 259f23f..fcc8381 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -1633,7 +1633,7 @@
if (classname_substituted_flag) {
if (SwigType_isenum(t)) {
// This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on)
- Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname));
+ Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
} else {
// This handles function pointers using the %constant directive
Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
index c6bd148..72b765b 100644
--- a/Source/Modules/main.cxx
+++ b/Source/Modules/main.cxx
@@ -23,6 +23,7 @@
#include "swigwarn.h"
#include "cparse.h"
#include <ctype.h>
+#include <errno.h>
#include <limits.h> // for INT_MAX
// Global variables
@@ -1376,13 +1377,15 @@
while (freeze) {
}
- if ((werror) && (Swig_warn_count())) {
- return Swig_warn_count();
- }
-
delete lang;
- return Swig_error_count();
+ int error_count = werror ? Swig_warn_count() : 0;
+ error_count += Swig_error_count();
+
+ if (error_count != 0)
+ SWIG_exit(error_count);
+
+ return 0;
}
/* -----------------------------------------------------------------------------
@@ -1394,5 +1397,20 @@
void SWIG_exit(int exit_code) {
while (freeze) {
}
+
+ if (exit_code > 0) {
+ CloseAllOpenFiles();
+
+ /* Remove all generated files */
+ if (all_output_files) {
+ for (int i = 0; i < Len(all_output_files); i++) {
+ String *filename = Getitem(all_output_files, i);
+ int removed = remove(Char(filename));
+ if (removed == -1)
+ fprintf(stderr, "On exit, could not delete file %s: %s\n", Char(filename), strerror(errno));
+ }
+ }
+ }
+
exit(exit_code);
}
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx
index b192d6f..1edbd87 100644
--- a/Source/Modules/php.cxx
+++ b/Source/Modules/php.cxx
@@ -1223,7 +1223,7 @@
/* FIXME: How should this be handled? The rest of SWIG just seems
* to not bother checking for malloc failing! */
fprintf(stderr, "Malloc failed!\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
for (i = 0; i < max_num_of_arguments; ++i) {
arg_names[i] = NULL;
@@ -1235,7 +1235,7 @@
/* FIXME: How should this be handled? The rest of SWIG just seems
* to not bother checking for malloc failing! */
fprintf(stderr, "Malloc failed!\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
for (i = 0; i < max_num_of_arguments; ++i) {
arg_values[i] = NULL;
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
old mode 100755
new mode 100644
index 39308d4..ea31af0
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -16,7 +16,6 @@
#include "cparse.h"
#include <ctype.h>
#include <errno.h>
-#include <stdlib.h>
#include "pydoc.h"
#include <stdint.h>
diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h
index 583cb13..bfb93d1 100644
--- a/Source/Modules/swigmod.h
+++ b/Source/Modules/swigmod.h
@@ -371,7 +371,6 @@
int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm);
void emit_parameter_variables(ParmList *l, Wrapper *f);
void emit_return_variable(Node *n, SwigType *rt, Wrapper *f);
-void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */
void SWIG_config_file(const_String_or_char_ptr );
const String *SWIG_output_directory();
void SWIG_config_cppext(const char *ext);
diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx
index 57125fc..8dbf086 100644
--- a/Source/Modules/typepass.cxx
+++ b/Source/Modules/typepass.cxx
@@ -961,7 +961,7 @@
if (Getattr(c, "sym:overloaded") != checkoverloaded) {
Printf(stdout, "sym:overloaded error c:%p checkoverloaded:%p\n", c, checkoverloaded);
Swig_print_node(c);
- exit (1);
+ SWIG_exit(EXIT_FAILURE);
}
String *decl = Strcmp(nodeType(c), "using") == 0 ? NewString("------") : Getattr(c, "decl");
@@ -969,7 +969,7 @@
if (!Getattr(c, "sym:overloaded")) {
Printf(stdout, "sym:overloaded error.....%p\n", c);
Swig_print_node(c);
- exit (1);
+ SWIG_exit(EXIT_FAILURE);
}
c = Getattr(c, "sym:nextSibling");
}
diff --git a/Source/Swig/getopt.c b/Source/Swig/getopt.c
index 74076a5..6970dc1 100644
--- a/Source/Swig/getopt.c
+++ b/Source/Swig/getopt.c
@@ -16,7 +16,6 @@
* sure there are no unmarked options.
*
* TODO:
- * - This module needs to be modified so that it doesn't call exit().
* Should have cleaner error handling in general.
* ----------------------------------------------------------------------------- */
@@ -88,11 +87,11 @@
}
if (error) {
Printf(stderr, "Use 'swig -help' for available options.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
if (check_input && marked[numargs - 1]) {
Printf(stderr, "Must specify an input file. Use -help for available options.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
@@ -105,5 +104,5 @@
void Swig_arg_error(void) {
Printf(stderr, "SWIG : Unable to parse command line options.\n");
Printf(stderr, "Use 'swig -help' for available options.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c
index 6b07118..7b81847 100644
--- a/Source/Swig/misc.c
+++ b/Source/Swig/misc.c
@@ -1177,7 +1177,7 @@
pclose(fp);
} else {
Swig_error("SWIG", Getline(s), "Command encoder fails attempting '%s'.\n", s);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
#endif
@@ -1327,7 +1327,8 @@
err_out:
Swig_error("SWIG", Getline(s), "Invalid regex substitution: '%s'.\n", s);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
+ return 0;
}
/* This function copies len characters from src to dst, possibly applying case conversions to them: if convertCase is 1, to upper case and if it is -1, to lower
@@ -1449,7 +1450,7 @@
if (!compiled_pat) {
Swig_error("SWIG", Getline(s), "PCRE compilation failed: '%s' in '%s':%i.\n",
pcre_error, Char(pattern), pcre_errorpos);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
rc = pcre_exec(compiled_pat, NULL, input, (int)strlen(input), 0, 0, captures, 30);
if (rc >= 0) {
@@ -1457,7 +1458,7 @@
} else if (rc != PCRE_ERROR_NOMATCH) {
Swig_error("SWIG", Getline(s), "PCRE execution failed: error %d while matching \"%s\" using \"%s\".\n",
rc, Char(pattern), input);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
@@ -1475,7 +1476,8 @@
String *Swig_string_regex(String *s) {
Swig_error("SWIG", Getline(s), "PCRE regex support not enabled in this SWIG build.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
+ return 0;
}
String *Swig_pcre_version(void) {
diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c
index 1b6c963..6689ceb 100644
--- a/Source/Swig/naming.c
+++ b/Source/Swig/naming.c
@@ -1105,7 +1105,7 @@
Swig_error("SWIG", Getline(n),
"Invalid regex \"%s\": compilation failed at %d: %s\n",
Char(pattern), errpos, err);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
rc = pcre_exec(compiled_pat, NULL, Char(s), Len(s), 0, 0, NULL, 0);
@@ -1118,7 +1118,7 @@
Swig_error("SWIG", Getline(n),
"Matching \"%s\" against regex \"%s\" failed: %d\n",
Char(s), Char(pattern), rc);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
return 1;
@@ -1131,7 +1131,7 @@
(void)s;
Swig_error("SWIG", Getline(n),
"PCRE regex matching is not available in this SWIG build.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
#endif /* HAVE_PCRE/!HAVE_PCRE */
diff --git a/Source/Swig/scanner.c b/Source/Swig/scanner.c
index 908bc74..e5a267a 100644
--- a/Source/Swig/scanner.c
+++ b/Source/Swig/scanner.c
@@ -833,7 +833,7 @@
return SWIG_TOKEN_MODEQUAL;
} else if (c == '}') {
Swig_error(cparse_file, cparse_line, "Syntax error. Extraneous '%%}'\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
} else {
retract(s, 1);
return SWIG_TOKEN_PERCENT;
diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h
index 1acd32d..e0783da 100644
--- a/Source/Swig/swig.h
+++ b/Source/Swig/swig.h
@@ -438,6 +438,7 @@
extern void Language_replace_special_variables(String *method, String *tm, Parm *parm);
extern void Swig_print(DOH *object, int count);
extern void Swig_print_with_location(DOH *object, int count);
+ extern void SWIG_exit(int exit_code);
/* -- template init -- */
diff --git a/configure.ac b/configure.ac
index 5432743..63509cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2370,11 +2370,6 @@
if test x"${GOBIN}" = xno; then
AC_MSG_NOTICE([Disabling Go])
GO=
- GOC=
- GO1=false
- GO12=false
- GO13=false
- GO15=false
GOGCC=false
GCCGO=
GOOPT=
@@ -2390,30 +2385,17 @@
GOGCC=false
GCCGO=
- GO1=false
- GO12=false
- GO13=false
- GO15=false
GOOPT=
GCCGOOPT=
GOVERSIONOPTION=
if test -n "$GO" ; then
- GO1=true
GOVERSIONOPTION=version
go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version //')
- case "$go_version" in
- go1 | go1.[[01234]] | go1.[[01234]].*)
- GOC=$(sh -c "$(go env) && echo \$GOCHAR")c
- ;;
- *)
- GOC=compile
- ;;
- esac
AC_MSG_CHECKING([whether go version is too old])
case $go_version in
- go1.1.* | go1.1 | go1.0 | go1.0.* | go1 )
- AC_MSG_RESULT([yes - minimum version is 1.2])
+ go1.[012]*)
+ AC_MSG_RESULT([yes - minimum version is 1.3])
GO=
GOOPT="-intgosize 32"
;;
@@ -2429,20 +2411,6 @@
esac
;;
esac
- case $go_version in
- go1.0 | go1.0.* | go1 | go1.1 | go1.1.*)
- GOOPT="$GOOPT -use-shlib"
- ;;
- go1.2 | go1.2.*)
- GO12=true
- ;;
- go1.3 | go1.3.* | go1.4 | go1.4.*)
- GO13=true
- ;;
- *)
- GO15=true
- ;;
- esac
fi
AC_CHECK_PROGS(GCCGO, gccgo)