Merge remote-tracking branch 'upstream/master' into OCaml-INPUT-OUTPUT-INOUT-primitives

This commit is contained in:
Zackery Spytz 2019-05-08 14:05:02 -06:00
commit 2f48bec666
363 changed files with 5825 additions and 2936 deletions

View file

@ -858,31 +858,33 @@ mzscheme_clean:
##################################################################
OCC=$(COMPILETOOL) @OCAMLC@
OCC_WITH_PP=env TMPDIR=./localtmp $(OCC)
# TMPDIR above is a workaround for some ocamlc versions, such as 4.05.0, which always create a temp file of the same name breaking parallel make (seemingly only when -pp is used)
OCAMLDLGEN=$(COMPILETOOL) @OCAMLDLGEN@
OCAMLFIND=$(COMPILETOOL) @OCAMLFIND@
OCAMLMKTOP=$(COMPILETOOL) @OCAMLMKTOP@
NOLINK ?= false
OCAMLPP= -pp "camlp4o ./swigp4.cmo"
OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where`
OCAMLCORE=\
(test -f swig.mli || $(SWIG) -ocaml -co swig.mli 2>/dev/null) && \
(test -f swig.ml || $(SWIG) -ocaml -co swig.ml 2>/dev/null) && \
(test -f swigp4.ml || $(SWIG) -ocaml -co swigp4.ml 2>/dev/null) && \
(test -f swig.cmi || $(OCC) -c swig.mli) && \
(test -f swig.cmo || $(OCC) -c swig.ml) && \
(test -f swigp4.cmi || $(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml)
ocaml_core:
mkdir -p ./localtmp
$(SWIG) -ocaml -co swig.mli 2>/dev/null
$(SWIG) -ocaml -co swig.ml 2>/dev/null
$(SWIG) -ocaml -co swigp4.ml 2>/dev/null
$(OCC) -c swig.mli
$(OCC) -c swig.ml
$(OCC_WITH_PP) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
ocaml_static: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
$(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)"
ocaml_dynamic: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
$(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(CCSHARED) -o $(INTERFACE:%.i=%@SO@) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(LIBS)
@ -890,40 +892,36 @@ ocaml_dynamic: $(SRCDIR_SRCS)
mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml)
rm $(INTERFACE:%.i=%.mli)
$(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCAMLFIND) $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo)
ocaml_static_toplevel: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
$(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCAMLMKTOP) swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -cclib "$(LIBS)" -g -ccopt -g -cclib -g -custom -o $(RUNME)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS)
ocaml_static_cpp: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
$(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
$(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" -cc '$(CXX)'
ocaml_static_cpp_toplevel: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
$(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
$(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCAMLMKTOP) -cc '$(CXX) $(CPPFLAGS)' swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -cclib "$(LIBS)" -g -ccopt -g -cclib -g -custom -o $(RUNME)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS)
ocaml_dynamic_cpp: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
$(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) -ccopt -fPIC
@ -932,7 +930,7 @@ ocaml_dynamic_cpp: $(SRCDIR_SRCS)
mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml)
rm $(INTERFACE:%.i=%.mli)
$(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCAMLFIND) swig.cmo $(OCC) -cclib -export-dynamic -g -ccopt -g -cclib -g -custom -o $(RUNME) -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) -cc '$(CXX)'
# -----------------------------------------------------------------
@ -957,6 +955,7 @@ ocaml_clean:
rm -f *_wrap* *~ .~* *.cmo *.cmi *.mli $(TARGET).ml $(RUNME) $(RUNME)_top swig.ml swigp4.ml
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@
rm -rf ./localtmp
##################################################################
##### RUBY ######
@ -1095,7 +1094,7 @@ CSHARPCFLAGS = @CSHARPCFLAGS@
CSHARPFLAGS =
CSHARPOPTIONS =
CSHARPSO = @CSHARPSO@
CSHARP_RUNME = $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$(RUNME).exe
CSHARP_RUNME = ./$(RUNME).exe
# ----------------------------------------------------------------
# Build a CSharp dynamically loadable module (C)
@ -1133,7 +1132,7 @@ csharp_compile: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
csharp_run:
env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARP_RUNME) $(RUNPIPE)
env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) $(CSHARP_RUNME) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@ -1458,7 +1457,8 @@ GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
GOPATHDIR = gopath/src/$(INTERFACE:.i=)
GOPATHPARENTDIR = gopath/$(GOMOD)/src
GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
@ -1468,8 +1468,18 @@ GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
# Build a Go module (C)
# ----------------------------------------------------------------
$(GOPATHPARENTDIR)/go.mod:
@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
echo "module swigtests" > $(GOPATHDIR)/go.mod
echo "" >> $(GOPATHDIR)/go.mod
echo "go 1.12" >> $(GOPATHDIR)/go.mod
mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod
go_nocgo: $(SRCDIR_SRCS)
$(SWIG) -go $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(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 \
@ -1504,11 +1514,12 @@ go_nocgo: $(SRCDIR_SRCS)
fi; \
fi
go: $(SRCDIR_SRCS)
$(SWIG) -go -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
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/src 2>/dev/null || true
@mkdir gopath/src/$(INTERFACE:.i=) 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)/*
cp $(ISRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
@ -1518,7 +1529,7 @@ go: $(SRCDIR_SRCS)
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
GOPATH=`pwd`/gopath; \
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
export CGO_CPPFLAGS; \
@ -1527,17 +1538,16 @@ go: $(SRCDIR_SRCS)
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
if $(GOGCC); then \
cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE); \
$(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) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
$(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); \
@ -1549,7 +1559,7 @@ go: $(SRCDIR_SRCS)
# ----------------------------------------------------------------
go_cpp_nocgo: $(SRCDIR_SRCS)
$(SWIG) -go -c++ $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
$(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); \
@ -1596,11 +1606,12 @@ go_cpp_nocgo: $(SRCDIR_SRCS)
fi; \
fi
go_cpp: $(SRCDIR_SRCS)
$(SWIG) -go -c++ -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
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/src 2>/dev/null || true
@mkdir gopath/src/$(INTERFACE:.i=) 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)/*
cp $(ICXXSRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
@ -1613,7 +1624,7 @@ go_cpp: $(SRCDIR_SRCS)
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
GOPATH=`pwd`/gopath; \
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
export CGO_CPPFLAGS; \
@ -1624,17 +1635,16 @@ go_cpp: $(SRCDIR_SRCS)
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
if $(GOGCC); then \
cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE) -lstdc++; \
$(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) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
$(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); \

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
"./example"
"fmt"
"example"
)
func main() {

View file

@ -1,9 +1,10 @@
package main
import (
"./example"
"fmt"
"os"
"example"
)
func Compare(name string, got string, exp string) error {

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
"./example"
"fmt"
"example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
"./example"
"fmt"
"example"
)
func main() {

View file

@ -76,7 +76,7 @@ public class runme {
System.out.println( " Trying to set 'status'" );
try {
Method m = example.class.getDeclaredMethod("setStatus", new Class[] {Integer.class});
m.invoke(example.class, new Object[] {new Integer(0)} );
m.invoke(example.class, new Object[] {Integer.valueOf(0)} );
System.out.println( "Hey, what's going on?!?! This shouldn't work" );
}
catch (NoSuchMethodException e) {

View file

@ -13,6 +13,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -14,6 +14,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -14,6 +14,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -20,6 +20,10 @@ dynamic:
ocaml_dynamic
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -20,6 +20,10 @@ dynamic:
ocaml_dynamic_cpp
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -14,13 +14,17 @@ check: build
build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
toplevel:
toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -20,6 +20,10 @@ dynamic:
ocaml_dynamic
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -12,6 +12,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -12,6 +12,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -12,6 +12,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
@ -21,7 +25,7 @@ dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
ocaml_dynamic_cpp
toplevel:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \

View file

@ -13,13 +13,17 @@ check: build
build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static
toplevel:
toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -12,6 +12,10 @@ check: build
build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
@ -21,9 +25,9 @@ dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
ocaml_dynamic_cpp
toplevel:
toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -21,7 +21,7 @@
zend_printf("This was %%rshutdown\n");
}
%pragma(php) include="include.php";
%pragma(php) include="./include.php";
%pragma(php) code="
# This code is inserted into example.php

View file

@ -79,5 +79,9 @@ protected:
};
int ProtectedBase::staticMemberVariable = 10;
class ProtectedDerived : public ProtectedBase {
public:
ProtectedDerived(const char *s) : ProtectedBase(s) {}
};
%}

View file

@ -407,6 +407,7 @@ CPP_TEST_CASES += \
static_array_member \
static_const_member \
static_const_member_2 \
stl_no_default_constructor \
string_constants \
struct_initialization_cpp \
struct_value \
@ -571,6 +572,7 @@ CPP11_TEST_CASES += \
cpp11_director_enums \
cpp11_directors \
cpp11_explicit_conversion_operators \
cpp11_final_directors \
cpp11_final_override \
cpp11_function_objects \
cpp11_inheriting_constructors \
@ -707,6 +709,7 @@ C_TEST_CASES += \
preproc \
preproc_constants_c \
preproc_defined \
preproc_gcc_output \
preproc_include \
preproc_line_file \
register_par \

View file

@ -19,17 +19,17 @@ template<typename T> struct Y {
typedef T2 another_type;
};
value_type create1() const { return T(); }
Y::value_type create2() const { return T(); }
Y<T>::value_type create3() const { return T(); }
YY::value_type create4() const { return T(); }
Y<T>::YY::value_type create5() const { return T(); }
typename Y::value_type create2() const { return T(); }
typename Y<T>::value_type create3() const { return T(); }
typename YY::value_type create4() const { return T(); }
typename Y<T>::YY::value_type create5() const { return T(); }
Y<T>::YYY<T>::value_type create6() const { return T(); }
typename Y<T>::template ZZZ<T>::another_type create7() const { return T(); }
// With global scope prefix
::Y<T>::value_type create13() const { return T(); }
typename ::Y<T>::value_type create13() const { return T(); }
::Y<T>::YY::value_type create15() const { return T(); }
typename ::Y<T>::YY::value_type create15() const { return T(); }
::Y<T>::YYY<T>::value_type create16() const { return T(); }
typename ::Y<T>::template ZZZ<T>::another_type create17() const { return T(); }
};

View file

@ -4,7 +4,8 @@
struct A {
int member;
};
const int align1 = alignof(A::member);
const int align1 = alignof(int);
const int align2 = alignof(int *);
%}
%{

View file

@ -0,0 +1,33 @@
%module(directors="1") cpp11_final_directors
%director Derived;
// Check SWIG will not wrap these classes as directors where the destructors are final
%director BaseFinalDestructor;
%director BaseFinalDestructor2;
%warnfilter(SWIGWARN_LANG_DIRECTOR_FINAL) BaseFinalDestructor::~BaseFinalDestructor;
%warnfilter(SWIGWARN_LANG_DIRECTOR_FINAL) BaseFinalDestructor2::~BaseFinalDestructor2;
%inline %{
struct Base {
virtual void basemeth() final {}
virtual ~Base() {}
};
struct Derived : Base {
virtual int derivedmeth() final { return 1; }
virtual int meth() { return 2; }
virtual ~Derived() {}
};
struct BaseFinalDestructor {
virtual void basefinalmeth() final {}
virtual ~BaseFinalDestructor() final {}
};
struct BaseFinalDestructor2 {
virtual void basefinalmeth() {}
virtual ~BaseFinalDestructor2() final {}
};
%}

View file

@ -43,14 +43,17 @@ auto lambda1 = [](int x, int y) -> int { return x+y; };
single statement "return expr;". */
auto lambda2 = [](int x, int y) { return x+y; };
auto lambda3 = [&](int x, int y) { return x+y; };
auto lambda4 = [=](int x, int y) { return x+y; };
int thing = 0;
#ifdef SWIG
// Not strictly correct as captured variables should have non-automatic storage duration, ie shouldn't capture globals. gcc-4.7 warns about this, but we check that SWIG can parse this anyway.
// This is not strictly legal: non-local lambda expression cannot have a capture-default
// gcc-4.7 warns about this and gcc-9 gives an error, but we check that SWIG can parse this anyway.
auto lambda3 = [&](int x, int y) { return x+y; };
auto lambda4 = [=](int x, int y) { return x+y; };
auto lambda5 = [=,&thing]() { return thing; };
#else
auto lambda5 = [=]() { return thing; };
auto lambda3 = [](int x, int y) { return x+y; };
auto lambda4 = [](int x, int y) { return x+y; };
auto lambda5 = []() { return thing; };
#endif
void fn() {
@ -115,6 +118,6 @@ int runLambdaInline() {
// TODO
int(*lambda101notauto)(int, int) = [] (int a, int b) { return a + b; };
int lambda102 = [] (int a, int b) mutable { return a + b; }(1, 2);
void lambda_init(int = ([=]{ return 0; })());
void lambda_init(int = ([]{ return 0; })());
%}

View file

@ -5,3 +5,7 @@
%template(UnorderedMapIntInt) std::unordered_map<int, int>;
%template(UnorderedMapStringInt) std::unordered_map<std::string, int>;
%inline %{
std::unordered_map<std::string, int, std::hash< std::string >,std::equal_to< std::string >,std::allocator< std::pair< std::string const,int > > > inout(std::unordered_map<std::string, int> m) { return m; }
%}

View file

@ -8,7 +8,8 @@
%inline %{
template<typename T> struct Temper {
template<typename T> class Temper {
public:
T val;
};
@ -18,14 +19,20 @@ public:
int memberFunction() { return 100; }
};
class B {
public:
short member;
short memberFunction() { return 100; }
};
template class Temper<A>;
extern template class Temper<A>;
extern template class Temper<B>;
template class Temper<A*>;
extern template class Temper<A*>;
extern template class Temper<B*>;
template class Temper<int>;
extern template class Temper<int>;
extern template class Temper<short>;
%}
%template(TemperInt) Temper<int>;

View file

@ -20,8 +20,10 @@ extern "C++" thread_local int ecpptval;
thread_local int ThreadLocals::stval = 11;
thread_local int ThreadLocals::tsval = 22;
#if !defined(_MSC_VER)
thread_local const int ThreadLocals::stcval88;
thread_local const int ThreadLocals::tscval99;
#endif
%}
%{

View file

@ -10,6 +10,7 @@ Tests Sourceforge bug #444748.
class StaticMemberTest {
public:
static int static_int;
static int grab_int() { return static_int; }
};
class StaticFunctionTest {
@ -28,10 +29,12 @@ int StaticMemberTest::static_int = 99;
%inline %{
struct StaticBase {
static int statty;
static int grab_statty_base() { return statty; }
virtual ~StaticBase() {}
};
struct StaticDerived : StaticBase {
static int statty;
static int grab_statty_derived() { return statty; }
};
%}

View file

@ -26,7 +26,8 @@ CPP_TEST_CASES = \
enum_thorough_typesafe \
exception_partial_info \
intermediary_classname \
li_boost_intrusive_ptr
li_boost_intrusive_ptr \
li_std_list \
CPP11_TEST_CASES = \
cpp11_shared_ptr_const \

View file

@ -13,6 +13,20 @@ public class runme
{
MyProtectedBase mpb = new MyProtectedBase("MyProtectedBase");
mpb.accessProtected();
try {
// C++ destructor is protected
mpb.Dispose();
throw new Exception("failed to catch MethodAccessException");
} catch (MethodAccessException) {
// Exception message: C++ destructor does not have public access
}
ProtectedDerived pd = new ProtectedDerived("ProtectedDerived");
// Destroying via the ProtectedDerived's destructor should work
pd.Dispose();
ProtectedBase pb = new ProtectedDerived("ProtectedDerived");
// ProtectedDerived's destructor should be called via the Dispose(disposing) virtual call
pb.Dispose();
}
}

View file

@ -19,6 +19,13 @@ public class li_std_auto_ptr_runme {
if (Klass.getTotal_count() != 2)
throw new Exception("number of objects should be 2");
using (Klass k3 = li_std_auto_ptr.makeKlassAutoPtr("second")) {
if (Klass.getTotal_count() != 3)
throw new Exception("number of objects should be 3");
}
if (Klass.getTotal_count() != 2)
throw new Exception("number of objects should be 2");
k1 = null;
{
int countdown = 500;

View file

@ -0,0 +1,402 @@
using System;
using li_std_listNamespace;
public class li_std_list_runme {
private static readonly int collectionSize = 20;
public static void Main() {
// Setup a list of int
IntList list = new IntList();
IntList.IntListNode node;
for (int i = 0; i < 20; i++) {
int nb = i * 10;
list.Add(nb);
}
// Count property test
if (list.Count != collectionSize)
throw new Exception("Count test failed");
// IsReadOnly property test
if (list.IsReadOnly)
throw new Exception("IsReadOnly test failed");
// Contains method test
if (!list.Contains(0))
throw new Exception("Contains method test 1 failed");
if (!list.Contains(2 * 10))
throw new Exception("Contains method test 2 failed");
if (!list.Contains(19 * 10))
throw new Exception("Contains method test 3 failed");
if (list.Contains(20 * 10))
throw new Exception("Contains method test 4 failed");
// Nodes comparison method overload
{
IntList.IntListNode temp = new IntList.IntListNode(3);
if (list.First == temp)
throw new Exception("== overload method test (1) failed");
temp = new IntList.IntListNode(0);
if (list.First == temp)
throw new Exception("== overload method test (2) failed");
IntList.IntListNode temp2 = new IntList.IntListNode(0);
if (temp == temp2)
throw new Exception("== overload method test (3) failed");
if (!(list.First == list.First))
throw new Exception("== overload method test (4) failed");
if (list.First != list.First)
throw new Exception("!= overload method test (1) failed");
if (!(temp != temp2))
throw new Exception("!= overload method test (2) failed");
if (list.First.Equals(temp))
throw new Exception("Equals method test failed");
if (list.First.GetHashCode() == temp.GetHashCode())
throw new Exception("GetHashCode method test (1) failed");
if (list.First.GetHashCode() == list.First.GetHashCode())
throw new Exception("GetHashCode method test (2) failed");
}
// Getter test
{
if (list.First == null)
throw new Exception("First getter test (1) failed");
if (list.Last == null)
throw new Exception("Last getter test (1) failed");
if (list.Last.Next != null)
throw new Exception("Next getter test (1) failed");
if (list.First.Next == null)
throw new Exception("Next getter test (2) failed");
if (list.First.Previous != null)
throw new Exception("Previous getter test (1) failed");
if (list.Last.Previous == null)
throw new Exception("Previous getter test (2) failed");
}
// AddFirst method test
node = list.AddFirst(34);
if (list.First.Value != 34 || node.Value != 34 || node != list.First)
throw new Exception("AddFirst method test failed");
try {
list.AddFirst(null);
} catch (ArgumentNullException) {
try {
list.AddFirst(list.First);
} catch (InvalidOperationException) {
}
}
// RemoveFirst method test
int tmp = list.First.Value;
list.RemoveFirst();
if (list.First.Value == tmp || list.First.Value != 0 * 10)
throw new Exception("RemoveFirst method test failed");
// AddLast method test
node = list.AddLast(8);
if (list.Last.Value != 8 || node.Value != 8 || node != list.Last)
throw new Exception("AddLast method test failed");
try {
list.AddLast(null);
} catch (ArgumentNullException) {
try {
list.AddLast(list.First);
} catch (InvalidOperationException) {
}
}
// RemoveLast method test
int tmp2 = list.Last.Value;
list.RemoveLast();
if (list.Last.Value == tmp2 || list.Last.Value != (list.Count - 1) * 10)
throw new Exception("RemoveLast method test failed");
// AddBefore method test
node = list.AddBefore(list.Last, 17);
if (list.Last.Previous.Value != 17 || node.Value != 17 || node != list.Last.Previous)
throw new Exception("AddBefore method test (1) failed");
try {
node = null;
list.AddBefore(list.Last, node);
throw new Exception("AddBefore method test (2) failed");
} catch (ArgumentNullException) {
try {
node = new IntList.IntListNode(1);
list.AddBefore(null, node);
throw new Exception("AddBefore method test (3) failed");
} catch (ArgumentNullException) {
try {
list.AddBefore(list.Last, list.First);
} catch (InvalidOperationException) {
}
}
}
// AddAfter method test
node = list.AddAfter(list.First, 47);
if (list.First.Next.Value != 47 || node.Value != 47 || node != list.First.Next)
throw new Exception("AddAfter method test (1) failed");
try {
node = null;
list.AddAfter(list.First.Next, node);
throw new Exception("AddAfter method test (2) failed");
} catch (ArgumentNullException) {
try {
list.AddAfter(list.First, list.Last);
} catch (InvalidOperationException) {
}
}
// Find method test
node = list.Find(0);
if (node == null || node.Value != 0)
throw new Exception("Find method test (1) failed");
node = list.Find(47);
if (node == null || node.Value != 47)
throw new Exception("Find method test (2) failed");
node = list.Find(190);
if (node == null || node.Value != 190)
throw new Exception("Find method test (3) failed");
node = list.Find(-3);
if (node != null)
throw new Exception("Find method test (4) failed");
// Remove method test
if (!list.Remove(17) || list.Contains(17) || list.Last.Previous.Value == 17)
throw new Exception("Remove method test (1) failed");
if (!list.Remove(47) || list.Contains(47) || list.First.Next.Value == 47)
throw new Exception("Remove method test (2) failed");
if (!list.Remove(0) || list.Contains(0) || list.First.Value == 0)
throw new Exception("Remove method test (3) failed");
if (!list.Remove(190) || list.Contains(190) || list.Last.Value == 190)
throw new Exception("Remove method test (4) failed");
try {
node = null;
list.Remove(node);
throw new Exception("Remove method test (5) failed");
} catch (ArgumentNullException) {
try {
node = new IntList.IntListNode(4);
list.Remove(node);
throw new Exception("Remove method test (5) failed");
} catch (InvalidOperationException) {
}
}
// ICollection constructor test
{
int[] intArray = new int[] { 0, 11, 22, 33, 44, 55, 33 };
IntList il = new IntList(intArray);
if (intArray.Length != il.Count)
throw new Exception("ICollection constructor length check failed: " + intArray.Length + "-" + il.Count);
node = il.First;
for (int i = 0; i < intArray.Length; i++) {
if (intArray[i] != node.Value)
throw new Exception("ICollection constructor failed, index:" + i);
node = node.Next;
}
try {
new IntList((System.Collections.ICollection)null);
throw new Exception("ICollection constructor null test failed");
} catch (ArgumentNullException) {
}
}
// Enumerator test
{
node = list.First;
System.Collections.IEnumerator myEnumerator = list.GetEnumerator();
while (myEnumerator.MoveNext()) {
if ((int)myEnumerator.Current != node.Value)
throw new Exception("Enumerator (1) test failed");
node = node.Next;
}
}
{
node = list.First;
System.Collections.Generic.IEnumerator<int> myEnumerator = list.GetEnumerator();
while (myEnumerator.MoveNext()) {
if (myEnumerator.Current != node.Value)
throw new Exception("Enumerator (2) test failed");
node = node.Next;
}
}
{
node = list.First;
IntList.IntListEnumerator myEnumerator = list.GetEnumerator();
while (myEnumerator.MoveNext()) {
if (myEnumerator.Current != node.Value)
throw new Exception("Enumerator (3) test failed");
node = node.Next;
}
}
{
node = list.First;
foreach (var elem in list) {
if (elem != node.Value)
throw new Exception("Enumerator (4) test failed");
node = node.Next;
}
}
// CopyTo method test
{
int[] outputarray = new int[collectionSize - 2];
list.CopyTo(outputarray, 0);
int index = 0;
IntList.IntListNode temp = list.First;
foreach (int val in outputarray) {
if (temp.Value != val) {
throw new Exception("CopyTo method test (1) failed, index:" + index);
}
index++;
temp = temp.Next;
}
}
{
DoubleList inputlist = new DoubleList();
int arrayLen = 10;
for (int i = 0; i < arrayLen; i++) {
double num = i * 10.1;
inputlist.Add(num);
}
double[] outputarray = new double[arrayLen];
inputlist.CopyTo(outputarray, 0);
DoubleList.DoubleListNode temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i] != temp.Value)
throw new Exception("CopyTo method test (2) failed, index:" + i);
temp = temp.Next;
}
}
{
StructList inputlist = new StructList();
int arrayLen = 10;
for (int i = 0; i < arrayLen; i++)
inputlist.Add(new Struct(i / 10.0));
Struct[] outputarray = new Struct[arrayLen];
inputlist.CopyTo(outputarray, 0);
StructList.StructListNode temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != temp.Value.num)
throw new Exception("CopyTo method test (3) failed, index:" + i);
temp = temp.Next;
}
foreach (Struct s in inputlist) {
s.num += 20.0;
}
temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != temp.Value.num)
throw new Exception("CopyTo method test (4) failed, index:" + i);
temp = temp.Next;
}
}
try {
list.CopyTo(null, 0);
throw new Exception("CopyTo method test (5) failed");
} catch (ArgumentNullException) {
}
// Clear() test
list.Clear();
if (list.Count != 0)
throw new Exception("Clear method failed");
// Finally test the methods being wrapped
{
IntList il = new IntList();
for (int i = 0; i < 4; i++) {
il.Add(i);
}
double x = li_std_list.average(il);
x += li_std_list.average(new IntList(new int[] { 1, 2, 3, 4 }));
DoubleList dlist = new DoubleList();
for (int i = 0; i < 10; i++) {
dlist.Add(i / 2.0);
}
li_std_list.halve_in_place(dlist);
}
// Dispose()
{
using (StructList ls = new StructList(new Struct[] { new Struct(0.0), new Struct(11.1) }))
using (DoubleList ld = new DoubleList(new double[] { 0.0, 11.1 })) { }
}
// More wrapped methods
{
FloatList l0 = li_std_list.listreal(new FloatList());
float flo = 123.456f;
l0.Add(flo);
flo = l0.First.Value;
IntList l1 = li_std_list.listint(new IntList());
IntPtrList l2 = li_std_list.listintptr(new IntPtrList());
IntConstPtrList l3 = li_std_list.listintconstptr(new IntConstPtrList());
l1.Add(123);
l2.Clear();
l3.Clear();
StructList l4 = li_std_list.liststruct(new StructList());
StructPtrList l5 = li_std_list.liststructptr(new StructPtrList());
StructConstPtrList l6 = li_std_list.liststructconstptr(new StructConstPtrList());
l4.Add(new Struct(123));
l5.Add(new Struct(123));
l6.Add(new Struct(123));
}
// Test lists of pointers
{
StructPtrList inputlist = new StructPtrList();
int arrayLen = 10;
for (int i = 0; i < arrayLen; i++) {
inputlist.Add(new Struct(i / 10.0));
}
Struct[] outputarray = new Struct[arrayLen];
inputlist.CopyTo(outputarray, 0);
StructPtrList.StructPtrListNode temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != temp.Value.num)
throw new Exception("StructPtrList test (1) failed, i:" + i);
temp = temp.Next;
}
foreach (Struct s in inputlist) {
s.num += 20.0;
}
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != 20.0 + i / 10.0)
throw new Exception("StructPtrList test (2) failed (a deep copy was incorrectly made), i:" + i);
}
}
// Test lists of const pointers
{
StructConstPtrList inputlist = new StructConstPtrList();
int arrayLen = 10;
for (int i = 0; i < arrayLen; i++) {
inputlist.Add(new Struct(i / 10.0));
}
Struct[] outputarray = new Struct[arrayLen];
inputlist.CopyTo(outputarray, 0);
StructConstPtrList.StructConstPtrListNode temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != temp.Value.num)
throw new Exception("StructConstPtrList test (1) failed, i:" + i);
temp = temp.Next;
}
foreach (Struct s in inputlist) {
s.num += 20.0;
}
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != 20.0 + i / 10.0)
throw new Exception("StructConstPtrList test (2) failed (a deep copy was incorrectly made), i:" + i);
}
}
}
}

View file

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using li_std_setNamespace;
public class runme
{
static void checkThat(bool mustBeTrue, string message)
{
if (!mustBeTrue)
throw new Exception("Test that the set " + message + " failed");
}
static void Main()
{
StringSet ss = new StringSet();
// Check the interface methods first.
ISet<string> s = ss;
checkThat(s.Count == 0, "is initially empty");
checkThat(!s.Contains("key"), "doesn't contain inexistent element");
checkThat(!s.Remove("key"), "returns false when removing inexistent element");
checkThat(s.Add("key"), "returns true when adding a new element");
checkThat(!s.Add("key"), "returns false when adding an existing element");
checkThat(s.Contains("key"), "contains the just added element");
checkThat(s.Remove("key"), "returns true when removing an existing element");
checkThat(s.Count == 0, "is empty again");
checkThat(s.Add("key1"), "Add(key1) returns true");
checkThat(s.Add("key2"), "Add(key2) returns true");
checkThat(s.Add("key3"), "Add(key3) returns true");
// Also check a different interface, providing a different Add() (sic!).
ICollection<string> coll = ss;
coll.Add("key");
checkThat(ss.Count == 4, "contains 4 elements");
// Now use object-specific methods, mimicking HashSet<>.
string val;
checkThat(ss.TryGetValue("key1", out val), "could retrieve existing item");
checkThat(val.Equals("key1"), "value was returned correctly by TryGetValue()");
checkThat(!ss.TryGetValue("no-such-key", out val), "couldn't retrieve inexistent item");
checkThat(val == null, "value was reset after failed TryGetValue()");
IList<string> list = new List<string>();
foreach (string str in ss) {
list.Add(str);
}
checkThat(list.Count == 4, "copy contains 4 elements");
ss.Clear();
checkThat(ss.Count == 0, "is empty after Clear()");
// Check set-theoretic methods.
checkThat(new StringSet().SetEquals(new StringSet()), "SetEquals() works for empty sets");
checkThat(new StringSet{"foo"}.SetEquals(new StringSet{"foo"}), "SetEquals() works for non-empty sets");
checkThat(!new StringSet{"foo"}.SetEquals(new[] {"bar"}), "SetEquals() doesn't always return true");
ss = new StringSet{"foo", "bar", "baz"};
ss.ExceptWith(new[] {"baz", "quux"});
checkThat(ss.SetEquals(new[] {"foo", "bar"}), "ExceptWith works");
ss = new StringSet{"foo", "bar", "baz"};
ss.IntersectWith(new[] {"baz", "quux"});
checkThat(ss.SetEquals(new[] {"baz"}), "IntersectWith works");
checkThat(ss.IsProperSubsetOf(new[] {"bar", "baz"}), "IsProperSubsetOf works");
checkThat(!ss.IsProperSubsetOf(new[] {"baz"}), "!IsProperSubsetOf works");
checkThat(ss.IsSubsetOf(new[] {"bar", "baz"}), "IsSubsetOf works");
checkThat(!ss.IsSubsetOf(new[] {"bar"}), "!IsSubsetOf works");
ss = new StringSet{"foo", "bar", "baz"};
checkThat(ss.IsProperSupersetOf(new[] {"bar"}), "IsProperSupersetOf works");
checkThat(!ss.IsProperSupersetOf(new[] {"quux"}), "IsProperSupersetOf works");
checkThat(ss.IsSupersetOf(new[] {"foo", "bar", "baz"}), "IsProperSupersetOf works");
checkThat(!ss.IsSupersetOf(new[] {"foo", "bar", "baz", "quux"}), "IsProperSupersetOf works");
checkThat(ss.Overlaps(new[] {"foo"}), "Overlaps works");
checkThat(!ss.Overlaps(new[] {"moo"}), "!Overlaps works");
ss.SymmetricExceptWith(new[] {"baz", "quux"});
checkThat(ss.SetEquals(new[] {"foo", "bar", "quux"}), "SymmetricExceptWith works");
ss = new StringSet{"foo", "bar", "baz"};
ss.UnionWith(new[] {"baz", "quux"});
checkThat(ss.SetEquals(new[] {"foo", "bar", "baz", "quux"}), "UnionWith works");
}
}

View file

@ -104,6 +104,9 @@
};
/// @return This is a bad place for this tag, but it should be ignored.
struct StructWithReturnComment {};
/**
An example of a list in a documentation comment.

View file

@ -32,4 +32,9 @@
SOME_ITEM_30 ///< Post comment for the third item
};
enum SomeEnumWithTrailingComma
{
SOME_ITEM_100, ///< Post comment after comma.
SOME_ITEM_200, ///< Post comment after last comma.
};
%}

View file

@ -1,5 +1,9 @@
%module doxygen_translate
#if defined(SWIGJAVA)
%javamethodmodifiers function "@Deprecated\npublic"
#endif
%inline %{
/**

View file

@ -1,5 +1,9 @@
%module doxygen_translate_all_tags
#if defined(SWIGJAVA)
%javamethodmodifiers func02 "@Deprecated\npublic"
#endif
%inline %{
/**

View file

@ -24,11 +24,11 @@ SWIG_LIB_SET = @SWIG_LIB_SET@
SWIGINVOKE = $(SWIG_LIB_SET) $(SWIGTOOL) $(SWIGEXE)
# All .i files with prefix 'cpp_' will be treated as C++ input and remaining .i files as C input
ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i)))
CPP_ERROR_TEST_CASES := $(filter cpp_%, $(ALL_ERROR_TEST_CASES))
C_ERROR_TEST_CASES := $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES))
DOXYGEN_ERROR_TEST_CASES := $(filter doxygen_%, $(C_ERROR_TEST_CASES))
C_ERROR_TEST_CASES := $(filter-out $(DOXYGEN_ERROR_TEST_CASES), $(C_ERROR_TEST_CASES))
ALL_ERROR_TEST_CASES := $(sort $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i))))
CPP_ERROR_TEST_CASES := $(sort $(filter cpp_%, $(ALL_ERROR_TEST_CASES)))
C_ERROR_TEST_CASES := $(sort $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES)))
DOXYGEN_ERROR_TEST_CASES := $(sort $(filter doxygen_%, $(C_ERROR_TEST_CASES)))
C_ERROR_TEST_CASES := $(sort $(filter-out $(DOXYGEN_ERROR_TEST_CASES), $(C_ERROR_TEST_CASES)))
# Always use C++ for Doxygen tests, there doesn't seem to be any need to
# distinguish between C and C++ Doxygen tests.

View file

@ -0,0 +1 @@
cpp_final_destructor.i:7: Warning 525: Destructor BaseFinal::~BaseFinal() is final, BaseFinal cannot be a director class.

View file

@ -0,0 +1,14 @@
%module xxx
// Testing is_digits detecting gcc linemarkers
// These are valid
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 123 "header1.h"
// These are invalid
#a1 'a.h'
#1b 'b.h'
#1c1 'c.h'
#d1d 'd.h'

View file

@ -0,0 +1,4 @@
pp_unknowndirective3.i:10: Error: Unknown SWIG preprocessor directive: a1 (if this is a block of target language code, delimit it with %{ and %})
pp_unknowndirective3.i:11: Error: Unknown SWIG preprocessor directive: 1b (if this is a block of target language code, delimit it with %{ and %})
pp_unknowndirective3.i:12: Error: Unknown SWIG preprocessor directive: 1c1 (if this is a block of target language code, delimit it with %{ and %})
pp_unknowndirective3.i:13: Error: Unknown SWIG preprocessor directive: d1d (if this is a block of target language code, delimit it with %{ and %})

View file

@ -73,7 +73,18 @@ INCLUDES = -I$(abs_top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
mkdir -p gopath/$*/src 2>/dev/null || true
if ! test -d gopath/$*/src/swigtests; then \
(cd gopath/$*/src && ln -s . swigtests); \
fi
+for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
GOMOD="$*" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
$(run_multi_testcase)
li_windows.cpptest:
@ -82,50 +93,55 @@ li_windows.cpptest:
multi_import.multicpptest:
$(setup)
mkdir -p gopath/multi_import/src 2>/dev/null || true
if ! test -d gopath/multi_import/src/swigtests; then \
(cd gopath/multi_import/src && ln -s . swigtests); \
fi
for f in multi_import_b multi_import_a; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
GOMOD="multi_import" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
$(run_multi_testcase)
go_subdir_import.multicpptest:
$(setup)
mkdir -p testdir/go_subdir_import/
mkdir -p gopath/src/testdir/go_subdir_import/
mkdir -p gopath/go_subdir_import/src 2>/dev/null || true
if ! test -d gopath/go_subdir_import/src/swigtests; then \
(cd gopath/go_subdir_import/src && ln -s . swigtests); \
fi
mkdir -p testdir/go_subdir_import 2>/dev/null || true
mkdir -p gopath/go_subdir_import/src/testdir/go_subdir_import 2>/dev/null || true
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INTERFACEPATH='$(SRCDIR)$(INTERFACEDIR)go_subdir_import_b.i' \
INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT) -outdir .' NOLINK=true \
TARGET='$(TARGETPREFIX)go_subdir_import_b$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' \
INTERFACE='testdir/go_subdir_import/go_subdir_import_b.i' \
GOMOD="go_subdir_import" \
$(LANGUAGE)$(VARIANT)_cpp;
for f in testdir/go_subdir_import/go_subdir_import_c go_subdir_import_a ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
GOMOD="go_subdir_import" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
if $(GOGCC); then \
cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a gopath/src/testdir/go_subdir_import/go_subdir_import_b.gox; \
cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a .; \
cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a gopath/src/testdir/go_subdir_import/go_subdir_import_c.gox; \
cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a testdir/go_subdir_import/; \
fi
$(run_multi_testcase)
# Runs the testcase.
run_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a; \
$(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 . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
$(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); \
@ -136,11 +152,11 @@ run_testcase = \
run_testcase_cpp = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a -lstdc++; \
$(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 . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
$(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); \
@ -150,18 +166,24 @@ run_testcase_cpp = \
run_multi_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I . -I gopath/src $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
if $(GO15) || $(GOGCC); then \
files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.a; done` -lstdc++; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -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 && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
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; \
fi
%.clean:

View file

@ -1,6 +1,6 @@
package main
import "./abstract_access"
import "abstract_access"
func main() {
d := abstract_access.NewD()

View file

@ -1,6 +1,6 @@
package main
import "./abstract_typedef2"
import "abstract_typedef2"
func main() {
abstract_typedef2.NewA_UF()

View file

@ -1,6 +1,6 @@
package main
import "./abstract_typedef"
import "abstract_typedef"
func main() {
e := abstract_typedef.NewEngine()

View file

@ -1,6 +1,6 @@
package main
import "./abstract_virtual"
import "abstract_virtual"
func main() {
abstract_virtual.NewD()

View file

@ -1,6 +1,6 @@
package main
import wrap "./argout"
import wrap "argout"
func main() {
ip := wrap.New_intp()

View file

@ -1,6 +1,6 @@
package main
import . "./array_member"
import . "array_member"
func main() {
f := NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "./arrays_global"
import . "arrays_global"
func main() {
SetArray_i(GetArray_const_i())

View file

@ -1,6 +1,6 @@
package main
import . "./char_binary"
import . "char_binary"
func main() {
t := NewTest()

View file

@ -1,6 +1,6 @@
package main
import "./class_ignore"
import "class_ignore"
func main() {
a := class_ignore.NewBar()

View file

@ -1,6 +1,6 @@
package main
import "./class_scope_weird"
import "class_scope_weird"
func main() {
f := class_scope_weird.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "./compactdefaultargs"
import . "compactdefaultargs"
func main() {
defaults1 := NewDefaults1(1000)

View file

@ -1,9 +1,10 @@
package main
import (
"./constover"
"fmt"
"os"
"constover"
)
func main() {

View file

@ -1,6 +1,6 @@
package main
import . "./constructor_copy"
import . "constructor_copy"
func main() {
f1 := NewFoo1(3)

View file

@ -1,6 +1,6 @@
package main
import "./contract"
import "contract"
func main() {
contract.Test_preassert(1, 2)

View file

@ -1,7 +1,7 @@
package main
import "fmt"
import . "./cpp11_strongly_typed_enumerations"
import . "cpp11_strongly_typed_enumerations"
func enumCheck(actual int, expected int) int {
if actual != expected {

View file

@ -1,6 +1,6 @@
package main
import "./cpp_enum"
import "cpp_enum"
func main() {
f := cpp_enum.NewFoo()

View file

@ -1,7 +1,7 @@
// Note: This example assumes that namespaces are flattened
package main
import "./cpp_namespace"
import "cpp_namespace"
func main() {
n := cpp_namespace.Fact(4)

View file

@ -1,6 +1,6 @@
package main
import . "./cpp_static"
import . "cpp_static"
func main() {
StaticFunctionTestStatic_func()

View file

@ -1,6 +1,6 @@
package main
import "./default_args"
import "default_args"
func main() {
if default_args.StaticsStaticmethod() != 60 {

View file

@ -1,6 +1,6 @@
package main
import dc "./default_constructor"
import dc "default_constructor"
func main() {
a := dc.NewA()

View file

@ -1,6 +1,6 @@
package main
import . "./director_alternating"
import . "director_alternating"
func main() {
id := GetBar().Id()

View file

@ -1,6 +1,6 @@
package main
import "./director_basic"
import "director_basic"
type GoFoo struct{}

View file

@ -1,7 +1,7 @@
package main
import "fmt"
import . "./director_classic"
import . "director_classic"
type TargetLangPerson struct{} // From Person
func (p *TargetLangPerson) Id() string {

View file

@ -1,6 +1,6 @@
package main
import . "./director_default"
import . "director_default"
func main() {
NewFoo()

View file

@ -1,6 +1,6 @@
package main
import "./director_detect"
import "director_detect"
type MyBar struct {
val int

View file

@ -1,6 +1,6 @@
package main
import "./director_enum"
import "director_enum"
type MyFoo struct{} // From director_enum.Foo
func (p *MyFoo) Say_hi(val director_enum.EnumDirectorHello) director_enum.EnumDirectorHello {

View file

@ -1,6 +1,6 @@
package main
import . "./director_exception"
import . "director_exception"
type Exception struct {
msg string

View file

@ -5,7 +5,7 @@
package main
import . "./director_extend"
import . "director_extend"
func main() {
m := NewSpObject()

View file

@ -1,6 +1,6 @@
package main
import . "./director_finalizer"
import . "director_finalizer"
type MyFoo struct{} // From Foo
func DeleteMyFoo(p Foo) {

View file

@ -1,6 +1,6 @@
package main
import . "./director_frob"
import . "director_frob"
func main() {
foo := NewBravo()

View file

@ -1,6 +1,6 @@
package main
import . "./director_nested"
import . "director_nested"
type A struct{} // From FooBar_int
func (p *A) Do_step() string {

View file

@ -1,7 +1,7 @@
package main
import "fmt"
import "./director_profile"
import "director_profile"
type MyB struct{} // From director_profile.B
func (p *MyB) Vfi(a int) int {

View file

@ -1,6 +1,6 @@
package main
import . "./director_protected"
import . "director_protected"
type FooBar struct{} // From Bar
func (p *FooBar) Ping() string {

View file

@ -1,6 +1,6 @@
package main
import . "./director_string"
import . "director_string"
type B struct { // From A
abi A

View file

@ -1,6 +1,6 @@
package main
import "./director_unroll"
import "director_unroll"
type MyFoo struct{} // From director_unroll.Foo
func (p *MyFoo) Ping() string {

View file

@ -1,6 +1,6 @@
package main
import . "./disown"
import . "disown"
func main() {
a := NewA()

View file

@ -1,6 +1,6 @@
package main
import "./dynamic_cast"
import "dynamic_cast"
func main() {
f := dynamic_cast.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import _ "./empty_c"
import _ "empty_c"
func main() {
}

View file

@ -1,6 +1,6 @@
package main
import _ "./empty"
import _ "empty"
func main() {
}

View file

@ -1,6 +1,6 @@
package main
import "./enum_template"
import "enum_template"
func main() {
if enum_template.MakeETest() != 1 {

View file

@ -1,6 +1,6 @@
package main
import "./enums"
import "enums"
func main() {
enums.Bar2(1)

View file

@ -1,7 +1,7 @@
package main
import "strings"
import . "./exception_order"
import . "exception_order"
func main() {
a := NewA()

View file

@ -1,6 +1,6 @@
package main
import "./extend_placement"
import "extend_placement"
func main() {
foo := extend_placement.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "./extend_template_ns"
import . "extend_template_ns"
func main() {
f := NewFoo_One()

View file

@ -1,6 +1,6 @@
package main
import "./extend_template"
import "extend_template"
func main() {
f := extend_template.NewFoo_0()

View file

@ -1,6 +1,6 @@
package main
import . "./extend_variable"
import . "extend_variable"
func main() {
if FooBar != 42 {

View file

@ -1,6 +1,6 @@
package main
import "./extern_c"
import "extern_c"
func main() {
extern_c.RealFunction(2)

View file

@ -1,6 +1,6 @@
package main
import "./friends"
import "friends"
func main() {
a := friends.NewA(2)

Some files were not shown because too many files have changed in this diff Show more