Merge branch 'master' into doxygen
Fix the usual conflicts in autodoc unit test due to fixing the divergences in autodoc generation between builtin and default cases in this branch.
This commit is contained in:
commit
db65ae5aea
371 changed files with 9815 additions and 3191 deletions
|
|
@ -282,7 +282,7 @@ perl5_static_cpp: $(SRCDIR_SRCS)
|
|||
# -----------------------------------------------------------------
|
||||
|
||||
perl5_run:
|
||||
$(RUNTOOL) $(PERL) $(PERL5_SCRIPT) $(RUNPIPE)
|
||||
$(RUNTOOL) $(PERL) -I. $(PERL5_SCRIPT) $(RUNPIPE)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Version display
|
||||
|
|
@ -897,10 +897,10 @@ mzscheme_clean:
|
|||
##### Ocaml #####
|
||||
##################################################################
|
||||
|
||||
OCC=@OCAMLC@
|
||||
OCAMLDLGEN=@OCAMLDLGEN@
|
||||
OCAMLFIND=@OCAMLFIND@
|
||||
OCAMLMKTOP=@OCAMLMKTOP@ $(SWIGWHERE)
|
||||
OCC=$(COMPILETOOL) @OCAMLC@
|
||||
OCAMLDLGEN=$(COMPILETOOL) @OCAMLDLGEN@
|
||||
OCAMLFIND=$(COMPILETOOL) @OCAMLFIND@
|
||||
OCAMLMKTOP=$(COMPILETOOL) @OCAMLMKTOP@ $(SWIGWHERE)
|
||||
NOLINK ?= false
|
||||
OCAMLPP= -pp "camlp4o ./swigp4.cmo"
|
||||
OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where`
|
||||
|
|
@ -911,8 +911,7 @@ OCAMLCORE=\
|
|||
$(SWIG) -ocaml -co swigp4.ml 2>/dev/null && \
|
||||
$(OCC) -c swig.mli && \
|
||||
$(OCC) -c swig.ml && \
|
||||
$(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" \
|
||||
-c swigp4.ml
|
||||
$(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
|
||||
|
||||
ocaml_static: $(SRCDIR_SRCS)
|
||||
$(OCAMLCORE)
|
||||
|
|
@ -920,32 +919,20 @@ ocaml_static: $(SRCDIR_SRCS)
|
|||
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
|
||||
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
|
||||
$(OCC) -g -c $(INTERFACE:%.i=%.ml)
|
||||
test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
|
||||
$(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) \
|
||||
swig.cmo \
|
||||
$(INTERFACE:%.i=%.cmo) \
|
||||
$(PROGFILE:%.ml=%.cmo) \
|
||||
$(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)"
|
||||
test -z "$(PROGFILE)" || $(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) 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)
|
||||
$(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > \
|
||||
$(INTERFACE:%.i=%_dynamic.ml)
|
||||
$(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(CCSHARED) -o $(INTERFACE:%.i=%@SO@) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(LIBS)
|
||||
$(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > $(INTERFACE:%.i=%_dynamic.ml)
|
||||
mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml)
|
||||
rm $(INTERFACE:%.i=%.mli)
|
||||
$(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml)
|
||||
test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
|
||||
$(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCAMLFIND) \
|
||||
$(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) \
|
||||
swig.cmo \
|
||||
-package dl -linkpkg \
|
||||
$(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo)
|
||||
test -z "$(PROGFILE)" || $(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCAMLFIND) $(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) swig.cmo -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo)
|
||||
|
||||
ocaml_static_toplevel: $(SRCDIR_SRCS)
|
||||
$(OCAMLCORE)
|
||||
|
|
@ -953,72 +940,41 @@ ocaml_static_toplevel: $(SRCDIR_SRCS)
|
|||
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
|
||||
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
|
||||
$(OCC) -g -c $(INTERFACE:%.i=%.ml)
|
||||
test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
|
||||
$(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCAMLMKTOP) \
|
||||
swig.cmo \
|
||||
-I $(OCAMLP4WHERE) camlp4o.cma swigp4.cmo \
|
||||
-g -ccopt -g -cclib -g -custom -o $(TARGET)_top \
|
||||
$(INTERFACE:%.i=%.cmo) \
|
||||
$(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)"
|
||||
test -z "$(PROGFILE)" || $(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCAMLMKTOP) swig.cmo -I $(OCAMLP4WHERE) camlp4o.cma swigp4.cmo -g -ccopt -g -cclib -g -custom -o $(TARGET)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)"
|
||||
|
||||
ocaml_static_cpp: $(SRCDIR_SRCS)
|
||||
$(OCAMLCORE)
|
||||
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
|
||||
$(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \
|
||||
$(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
|
||||
$(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
|
||||
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
|
||||
$(OCC) -g -c $(INTERFACE:%.i=%.ml)
|
||||
test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
|
||||
$(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) \
|
||||
swig.cmo \
|
||||
$(INTERFACE:%.i=%.cmo) \
|
||||
$(PROGFILE:%.ml=%.cmo) \
|
||||
$(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \
|
||||
-cclib "$(LIBS)" -cc '$(CXX) -Wno-write-strings'
|
||||
test -z "$(PROGFILE)" || $(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" -cc '$(CXX) -Wno-write-strings'
|
||||
|
||||
ocaml_static_cpp_toplevel: $(SRCDIR_SRCS)
|
||||
$(OCAMLCORE)
|
||||
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
|
||||
$(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \
|
||||
$(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
|
||||
$(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
|
||||
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
|
||||
$(OCC) -g -c $(INTERFACE:%.i=%.ml)
|
||||
test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
|
||||
$(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCAMLMKTOP) \
|
||||
swig.cmo \
|
||||
-I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo \
|
||||
-g -ccopt -g -cclib -g -custom -o $(TARGET)_top \
|
||||
$(INTERFACE:%.i=%.cmo) \
|
||||
$(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \
|
||||
-cclib "$(LIBS)" -cc '$(CXX) -Wno-write-strings'
|
||||
test -z "$(PROGFILE)" || $(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCAMLMKTOP) swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -g -ccopt -g -cclib -g -custom -o $(TARGET)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" -cc '$(CXX) -Wno-write-strings'
|
||||
|
||||
ocaml_dynamic_cpp: $(SRCDIR_SRCS)
|
||||
$(OCAMLCORE)
|
||||
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
|
||||
$(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \
|
||||
$(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) -ccopt -fPIC
|
||||
$(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(INTERFACE:%.i=%@SO@) \
|
||||
$(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \
|
||||
$(CPP_DLLIBS) $(LIBS)
|
||||
$(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > \
|
||||
$(INTERFACE:%.i=%_dynamic.ml)
|
||||
$(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) -ccopt -fPIC
|
||||
$(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(INTERFACE:%.i=%@SO@) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(CPP_DLLIBS) $(LIBS)
|
||||
$(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > $(INTERFACE:%.i=%_dynamic.ml)
|
||||
mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml)
|
||||
rm $(INTERFACE:%.i=%.mli)
|
||||
$(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml)
|
||||
test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
|
||||
$(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCAMLFIND) \
|
||||
swig.cmo \
|
||||
$(OCC) -cclib -export-dynamic -g -ccopt -g -cclib -g -custom \
|
||||
-o $(TARGET) \
|
||||
-package dl -linkpkg \
|
||||
$(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) -cc '$(CXX) -Wno-write-strings'
|
||||
test -z "$(PROGFILE)" || $(OCC) $(OCAMLPP) -c $(PROGFILE)
|
||||
$(NOLINK) || $(OCAMLFIND) swig.cmo $(OCC) -cclib -export-dynamic -g -ccopt -g -cclib -g -custom -o $(TARGET) -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) -cc '$(CXX) -Wno-write-strings'
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Run ocaml example
|
||||
|
|
@ -1738,7 +1694,7 @@ r: $(SRCDIR_SRCS)
|
|||
ifneq ($(SRCDIR_SRCS),)
|
||||
$(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(R_CFLAGS) $(SRCDIR_SRCS) $(INCLUDES)
|
||||
endif
|
||||
+( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) $(OBJS) > /dev/null )
|
||||
+( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" PKG_CFLAGS="$(CFLAGS)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) $(OBJS) > /dev/null )
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Build a R dynamically loadable module (C++)
|
||||
|
|
@ -1748,7 +1704,7 @@ r_cpp: $(SRCDIR_CXXSRCS)
|
|||
ifneq ($(SRCDIR_CXXSRCS),)
|
||||
$(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(R_CFLAGS) $(SRCDIR_CXXSRCS) $(INCLUDES)
|
||||
endif
|
||||
+( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) $(OBJS) > /dev/null )
|
||||
+( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" PKG_CXXFLAGS="$(CXXFLAGS)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) $(OBJS) > /dev/null )
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Run R example
|
||||
|
|
|
|||
|
|
@ -36,6 +36,6 @@ func DeleteGoCallback(p GoCallback) {
|
|||
p.deleteCallback()
|
||||
}
|
||||
|
||||
func (p *goCallback) Run() {
|
||||
func (p *overwrittenMethodsOnCallback) Run() {
|
||||
fmt.Println("GoCallback.Run")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,5 +30,5 @@ f.enum_test(example.Foo.LUDICROUS);
|
|||
// enum value BLUE of enum color is accessed as property of cconst
|
||||
console.log("example.BLUE= " + example.BLUE);
|
||||
|
||||
// enum value LUDICROUS of enum Foo::speed is accessed as as property of cconst
|
||||
// enum value LUDICROUS of enum Foo::speed is accessed as property of cconst
|
||||
console.log("example.speed.LUDICROUS= " + example.Foo.LUDICROUS);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ public:
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
|
||||
class Test {
|
||||
public:
|
||||
|
|
@ -50,4 +54,7 @@ public:
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,14 @@ public:
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
|
||||
class Test {
|
||||
public:
|
||||
int simple() throw(int&) {
|
||||
int simple() throw(int) {
|
||||
throw(37);
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -50,4 +54,7 @@ public:
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ CEO=@(name) subclass(swigexample.Manager(name),'getPosition',@(self) "CEO");
|
|||
|
||||
# Create an instance of our employee extension class, CEO. The calls to
|
||||
# getName() and getPosition() are standard, the call to getTitle() uses
|
||||
# the director wrappers to call CEO.getPosition. e = CEO("Alice")
|
||||
# the director wrappers to call CEO.getPosition.
|
||||
|
||||
e = CEO("Alice");
|
||||
printf("%s is a %s\n",e.getName(),e.getPosition());
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ CXXSRCS = example.cxx
|
|||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
LIBS =
|
||||
SWIGOPT = -noproxy
|
||||
SWIGOPT =
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
|
||||
|
|
|
|||
|
|
@ -11,22 +11,22 @@ print " BLUE =" . BLUE;
|
|||
print " GREEN =" . GREEN;
|
||||
|
||||
print "\n*** Foo::speed ***";
|
||||
print " Foo_IMPULSE =" . Foo_IMPULSE;
|
||||
print " Foo_WARP =" . Foo_WARP;
|
||||
print " Foo_LUDICROUS =" . Foo_LUDICROUS;
|
||||
print " Foo::IMPULSE =" . Foo::IMPULSE;
|
||||
print " Foo::WARP =" . Foo::WARP;
|
||||
print " Foo::LUDICROUS =" . Foo::LUDICROUS;
|
||||
|
||||
print "\nTesting use of enums with functions\n";
|
||||
|
||||
enum_test(RED, Foo_IMPULSE);
|
||||
enum_test(BLUE, Foo_WARP);
|
||||
enum_test(GREEN, Foo_LUDICROUS);
|
||||
enum_test(RED, Foo::IMPULSE);
|
||||
enum_test(BLUE, Foo::WARP);
|
||||
enum_test(GREEN, Foo::LUDICROUS);
|
||||
enum_test(1234,5678);
|
||||
|
||||
print "\nTesting use of enum with class method\n";
|
||||
$f = new_Foo();
|
||||
$f = new Foo();
|
||||
|
||||
Foo_enum_test($f,Foo_IMPULSE);
|
||||
Foo_enum_test($f,Foo_WARP);
|
||||
Foo_enum_test($f,Foo_LUDICROUS);
|
||||
$f->enum_test(Foo::IMPULSE);
|
||||
$f->enum_test(Foo::WARP);
|
||||
$f->enum_test(Foo::LUDICROUS);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -27,5 +27,6 @@
|
|||
# This code is inserted into example.php
|
||||
echo \"this was php code\\n\";
|
||||
"
|
||||
%pragma(php) version="1.5"
|
||||
|
||||
%pragma(php) phpinfo="php_info_print_table_start();"
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
require "example.php";
|
||||
|
||||
echo "Version - " . ((new ReflectionExtension('example'))->getVersion());
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ SRCS = example.c
|
|||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
LIBS =
|
||||
SWIGOPT = -noproxy
|
||||
SWIGOPT =
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
require "example.php";
|
||||
|
||||
|
||||
$v = new_vector();
|
||||
vector_x_set($v,1.0);
|
||||
vector_y_set($v,2.0);
|
||||
vector_z_set($v,3.0);
|
||||
$v = new Vector();
|
||||
$v->x = 1.0;
|
||||
$v->y = 2.0;
|
||||
$v->z = 3.0;
|
||||
|
||||
$w = new_vector();
|
||||
vector_x_set($w,10.0);
|
||||
vector_y_set($w,11.0);
|
||||
vector_z_set($w,12.0);
|
||||
$w = new Vector();
|
||||
$w->x = 10.0;
|
||||
$w->y = 11.0;
|
||||
$w->z = 12.0;
|
||||
|
||||
echo "I just created the following vector\n";
|
||||
vector_print($v);
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
echo "\nNow I'm going to add the vectors together\n";
|
||||
|
||||
$r = new_vector();
|
||||
$r = new Vector();
|
||||
vector_add($v, $w, $r);
|
||||
|
||||
vector_print($r);
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
echo "pt = ".pt_get(), point_print(pt_get()) , "\n";
|
||||
|
||||
/* Try to set the values of some global variables */
|
||||
$a = "42.14";
|
||||
$a = "42.14";
|
||||
|
||||
ivar_set($a);
|
||||
echo "a = $a\n";
|
||||
echo "a = $a\n";
|
||||
svar_set(-31000);
|
||||
lvar_set(65537);
|
||||
uivar_set(123456);
|
||||
|
|
|
|||
|
|
@ -27,5 +27,6 @@
|
|||
# This code is inserted into example.php
|
||||
echo \"this was php code\\n\";
|
||||
"
|
||||
%pragma(php) version="1.5"
|
||||
|
||||
%pragma(php) phpinfo="php_info_print_table_start();"
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
require "example.php";
|
||||
|
||||
echo "Version - " . ((new ReflectionExtension('example'))->getVersion());
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
echo "pt = ".pt_get(), point_print(pt_get()) , "\n";
|
||||
|
||||
/* Try to set the values of some global variables */
|
||||
$a = "42.14";
|
||||
$a = "42.14";
|
||||
|
||||
ivar_set($a);
|
||||
echo "a = $a\n";
|
||||
echo "a = $a\n";
|
||||
svar_set(-31000);
|
||||
lvar_set(65537);
|
||||
uivar_set(123456);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ public:
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
|
||||
class Test {
|
||||
public:
|
||||
|
|
@ -50,4 +54,7 @@ public:
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ class FullError {
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
|
||||
template<typename T> class Queue {
|
||||
int maxsize;
|
||||
|
|
@ -51,4 +55,7 @@ template<typename T> class Queue {
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class CEO(example.Manager):
|
|||
|
||||
# Create an instance of our employee extension class, CEO. The calls to
|
||||
# getName() and getPosition() are standard, the call to getTitle() uses
|
||||
# the director wrappers to call CEO.getPosition. e = CEO("Alice")
|
||||
# the director wrappers to call CEO.getPosition.
|
||||
|
||||
e = CEO("Alice")
|
||||
print e.getName(), "is a", e.getPosition()
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
import robin
|
||||
|
||||
assert(robin.run() == "AWAY!")
|
||||
if not(robin.run() == "AWAY!"):
|
||||
raise RuntimeError("test failed")
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ sys.path.insert(0, 'path1')
|
|||
|
||||
from brave import robin
|
||||
|
||||
assert(robin.run() == "AWAY!")
|
||||
if not(robin.run() == "AWAY!"):
|
||||
raise RuntimeError("test failed")
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ sys.path.insert(0, 'path3')
|
|||
|
||||
from brave import robin
|
||||
|
||||
assert(robin.run() == "AWAY!")
|
||||
if not(robin.run() == "AWAY!"):
|
||||
raise RuntimeError("test failed")
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ sys.path.insert(0, 'path3')
|
|||
|
||||
from brave import robin
|
||||
|
||||
assert(robin.run() == "AWAY!")
|
||||
if not(robin.run() == "AWAY!"):
|
||||
raise RuntimeError("test failed")
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ import pkg1.foo
|
|||
|
||||
print " Finished importing pkg1.foo"
|
||||
|
||||
assert(pkg1.foo.count() == 3)
|
||||
if not(pkg1.foo.count() == 3):
|
||||
raise RuntimeError("test failed")
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ import pkg1.foo
|
|||
|
||||
print " Finished importing pkg1.foo"
|
||||
|
||||
assert(pkg1.foo.count() == 3)
|
||||
if not(pkg1.foo.count() == 3):
|
||||
raise RuntimeError("test failed")
|
||||
|
|
|
|||
|
|
@ -8,6 +8,14 @@ class FullError {
|
|||
FullError(int m) : maxsize(m) { }
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
|
||||
template<typename T> class Queue {
|
||||
int maxsize;
|
||||
T *items;
|
||||
|
|
@ -44,6 +52,12 @@ template<typename T> class Queue {
|
|||
};
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
@ -47,6 +47,6 @@ testdir/README file.
|
|||
Further Documentation
|
||||
---------------------
|
||||
|
||||
There is documentation about the test-suite and how to use use it in
|
||||
There is documentation about the test-suite and how to use it in
|
||||
the SWIG documentation - Doc/Manual/Extending.html#Extending_test_suite.
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,14 @@ typedef int Integer;
|
|||
void banana(S *a, const struct tagS *b, int c, Integer d) {}
|
||||
%}
|
||||
|
||||
// Check docs for a template type
|
||||
%inline %{
|
||||
template<typename X> struct T {
|
||||
T inout(T t) { return t; }
|
||||
};
|
||||
%}
|
||||
%template(TInteger) T<int>;
|
||||
|
||||
%inline %{
|
||||
#ifdef SWIGPYTHON_BUILTIN
|
||||
bool is_python_builtin() { return true; }
|
||||
|
|
@ -140,4 +148,3 @@ bool is_python_builtin() { return true; }
|
|||
bool is_python_builtin() { return false; }
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
%}
|
||||
|
||||
%include <exception.i> // for throws(...) typemap
|
||||
|
|
@ -31,3 +35,11 @@ void test_catches_all(int i) {
|
|||
}
|
||||
%}
|
||||
|
||||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
160
Examples/test-suite/class_scope_namespace.i
Normal file
160
Examples/test-suite/class_scope_namespace.i
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
// Test a mix of forward class declarations, class definitions, using declarations and using directives.
|
||||
|
||||
%module class_scope_namespace
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) H::HH;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Space8::I::II;
|
||||
|
||||
%inline %{
|
||||
struct A;
|
||||
namespace Space1 {
|
||||
namespace SubSpace1 {
|
||||
struct A {
|
||||
void aa(Space1::SubSpace1::A, SubSpace1::A, A) {}
|
||||
};
|
||||
void aaa(Space1::SubSpace1::A, SubSpace1::A, A) {}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Space2 {
|
||||
struct B;
|
||||
}
|
||||
using Space2::B;
|
||||
#ifdef __clang__
|
||||
namespace Space2 {
|
||||
struct B {
|
||||
void bb(Space2::B, B) {}
|
||||
};
|
||||
}
|
||||
#else
|
||||
struct B {
|
||||
void bb(Space2::B, B) {}
|
||||
};
|
||||
#endif
|
||||
void bbb(Space2::B, B) {}
|
||||
|
||||
namespace Space3 {
|
||||
namespace SubSpace3 {
|
||||
struct C;
|
||||
struct D;
|
||||
}
|
||||
}
|
||||
struct C;
|
||||
struct D;
|
||||
namespace Space3 {
|
||||
struct C;
|
||||
struct SubSpace3::C {
|
||||
void cc(Space3::SubSpace3::C, SubSpace3::C) {}
|
||||
};
|
||||
using SubSpace3::D;
|
||||
struct SubSpace3::D {
|
||||
void dd(Space3::SubSpace3::D, SubSpace3::D, D) {}
|
||||
};
|
||||
void ccc(Space3::SubSpace3::C, SubSpace3::C) {}
|
||||
void ddd(Space3::SubSpace3::D, SubSpace3::D, D) {}
|
||||
}
|
||||
|
||||
namespace Space4 {
|
||||
namespace SubSpace4 {
|
||||
struct E;
|
||||
}
|
||||
}
|
||||
using namespace Space4;
|
||||
using SubSpace4::E;
|
||||
// Was added to incorrect namespace in swig-3.0.12
|
||||
struct SubSpace4::E {
|
||||
void ee(Space4::SubSpace4::E, SubSpace4::E, E) {}
|
||||
};
|
||||
void eee(Space4::SubSpace4::E, SubSpace4::E, E) {}
|
||||
|
||||
namespace Space5 {
|
||||
namespace SubSpace5 {
|
||||
namespace SubSubSpace5 {
|
||||
struct F;
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Space5 {
|
||||
using namespace SubSpace5;
|
||||
using SubSubSpace5::F;
|
||||
// Was added to incorrect namespace in swig-3.0.12
|
||||
struct SubSubSpace5::F {
|
||||
void ff(Space5::SubSpace5::SubSubSpace5::F, SubSpace5::SubSubSpace5::F, SubSubSpace5::F, F) {}
|
||||
};
|
||||
void fff(Space5::SubSpace5::SubSubSpace5::F, SubSpace5::SubSubSpace5::F, SubSubSpace5::F, F) {}
|
||||
}
|
||||
|
||||
namespace Space6 {
|
||||
struct G;
|
||||
namespace SubSpace6 {
|
||||
struct G;
|
||||
}
|
||||
}
|
||||
namespace Space6 {
|
||||
struct SubSpace6::G {
|
||||
void gg(Space6::SubSpace6::G, SubSpace6::G) {}
|
||||
};
|
||||
void ggg(Space6::SubSpace6::G, SubSpace6::G) {}
|
||||
}
|
||||
|
||||
struct HH;
|
||||
struct H {
|
||||
struct HH {
|
||||
void hh(H::HH) {}
|
||||
};
|
||||
};
|
||||
void hhh(H::HH) {}
|
||||
|
||||
namespace Space8 {
|
||||
struct II;
|
||||
struct I {
|
||||
struct II {
|
||||
void ii(Space8::I::II, I::II) {}
|
||||
};
|
||||
};
|
||||
void iii(Space8::I::II, I::II) {}
|
||||
}
|
||||
|
||||
struct J;
|
||||
namespace Space9 {
|
||||
namespace SubSpace9 {
|
||||
struct J {
|
||||
void jj(Space9::SubSpace9::J, SubSpace9::J, J) {}
|
||||
};
|
||||
void jjj(Space9::SubSpace9::J, SubSpace9::J, J) {}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Space10 {
|
||||
struct K;
|
||||
}
|
||||
namespace Space10 {
|
||||
namespace SubSpace10 {
|
||||
struct K {
|
||||
void kk(Space10::SubSpace10::K, SubSpace10::K, K) {}
|
||||
};
|
||||
void kkk(Space10::SubSpace10::K, SubSpace10::K, K) {}
|
||||
}
|
||||
}
|
||||
|
||||
namespace OtherSpace {
|
||||
struct L;
|
||||
struct M;
|
||||
}
|
||||
using OtherSpace::L;
|
||||
namespace Space11 {
|
||||
using OtherSpace::M;
|
||||
namespace SubSpace11 {
|
||||
struct L {
|
||||
void ll(Space11::SubSpace11::L, SubSpace11::L, L) {}
|
||||
};
|
||||
void lll(Space11::SubSpace11::L, SubSpace11::L, L) {}
|
||||
struct M {
|
||||
void mm(Space11::SubSpace11::M, SubSpace11::M, M) {}
|
||||
};
|
||||
void mmm(Space11::SubSpace11::M, SubSpace11::M, M) {}
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ CPP_TEST_BROKEN += \
|
|||
|
||||
# Broken C test cases. (Can be run individually using: make testcase.ctest)
|
||||
C_TEST_BROKEN += \
|
||||
tag_no_clash_with_variable
|
||||
tag_no_clash_with_variable \
|
||||
|
||||
# C++ test cases. (Can be run individually using: make testcase.cpptest)
|
||||
CPP_TEST_CASES += \
|
||||
|
|
@ -136,6 +136,7 @@ CPP_TEST_CASES += \
|
|||
char_binary \
|
||||
char_strings \
|
||||
chartest \
|
||||
class_scope_namespace \
|
||||
class_forward \
|
||||
class_ignore \
|
||||
class_scope_weird \
|
||||
|
|
@ -246,6 +247,7 @@ CPP_TEST_CASES += \
|
|||
global_vars \
|
||||
grouping \
|
||||
ignore_parameter \
|
||||
import_fragments \
|
||||
import_nomodule \
|
||||
inherit \
|
||||
inherit_member \
|
||||
|
|
@ -278,6 +280,7 @@ CPP_TEST_CASES += \
|
|||
memberin_extend \
|
||||
member_funcptr_galore \
|
||||
member_pointer \
|
||||
member_pointer_const \
|
||||
member_template \
|
||||
minherit \
|
||||
minherit2 \
|
||||
|
|
@ -289,6 +292,7 @@ CPP_TEST_CASES += \
|
|||
multiple_inheritance_shared_ptr \
|
||||
name_cxx \
|
||||
name_warnings \
|
||||
namespace_chase \
|
||||
namespace_class \
|
||||
namespace_enum \
|
||||
namespace_extend \
|
||||
|
|
@ -416,6 +420,7 @@ CPP_TEST_CASES += \
|
|||
template_default_inherit \
|
||||
template_default_qualify \
|
||||
template_default_vw \
|
||||
template_empty_inherit \
|
||||
template_enum \
|
||||
template_enum_ns_inherit \
|
||||
template_enum_typedef \
|
||||
|
|
@ -432,6 +437,7 @@ CPP_TEST_CASES += \
|
|||
template_methods \
|
||||
template_namespace_forward_declaration \
|
||||
template_using_directive_and_declaration_forward \
|
||||
template_using_directive_typedef \
|
||||
template_nested \
|
||||
template_nested_typemaps \
|
||||
template_ns \
|
||||
|
|
@ -442,6 +448,7 @@ CPP_TEST_CASES += \
|
|||
template_ns_enum2 \
|
||||
template_ns_inherit \
|
||||
template_ns_scope \
|
||||
template_parameters_global_scope \
|
||||
template_partial_arg \
|
||||
template_partial_specialization \
|
||||
template_partial_specialization_typedef \
|
||||
|
|
@ -531,10 +538,10 @@ CPP_TEST_CASES += \
|
|||
virtual_vs_nonvirtual_base \
|
||||
voidtest \
|
||||
wallkw \
|
||||
wrapmacro
|
||||
wrapmacro \
|
||||
|
||||
# C++11 test cases.
|
||||
CPP11_TEST_CASES = \
|
||||
CPP11_TEST_CASES += \
|
||||
cpp11_alignment \
|
||||
cpp11_alternate_function_syntax \
|
||||
cpp11_constexpr \
|
||||
|
|
@ -542,6 +549,7 @@ CPP11_TEST_CASES = \
|
|||
cpp11_default_delete \
|
||||
cpp11_delegating_constructors \
|
||||
cpp11_director_enums \
|
||||
cpp11_directors \
|
||||
cpp11_explicit_conversion_operators \
|
||||
cpp11_final_override \
|
||||
cpp11_function_objects \
|
||||
|
|
@ -553,6 +561,9 @@ CPP11_TEST_CASES = \
|
|||
cpp11_noexcept \
|
||||
cpp11_null_pointer_constant \
|
||||
cpp11_raw_string_literals \
|
||||
cpp11_ref_qualifiers \
|
||||
cpp11_ref_qualifiers_rvalue_unignore \
|
||||
cpp11_ref_qualifiers_typemaps \
|
||||
cpp11_result_of \
|
||||
cpp11_rvalue_reference \
|
||||
cpp11_rvalue_reference2 \
|
||||
|
|
@ -572,7 +583,6 @@ CPP11_TEST_CASES = \
|
|||
|
||||
# Broken C++11 test cases.
|
||||
CPP11_TEST_BROKEN = \
|
||||
# cpp11_hash_tables \ # not fully implemented yet
|
||||
# cpp11_variadic_templates \ # Broken for some languages (such as Java)
|
||||
# cpp11_reference_wrapper \ # No typemaps
|
||||
|
||||
|
|
@ -621,9 +631,7 @@ CPP_STD_TEST_CASES += \
|
|||
smart_pointer_inherit \
|
||||
template_typedef_fnc \
|
||||
template_type_namespace \
|
||||
template_opaque
|
||||
# li_std_list
|
||||
|
||||
template_opaque \
|
||||
|
||||
ifndef SKIP_CPP_STD_CASES
|
||||
CPP_TEST_CASES += ${CPP_STD_TEST_CASES}
|
||||
|
|
@ -687,7 +695,7 @@ C_TEST_CASES += \
|
|||
typedef_struct \
|
||||
typemap_subst \
|
||||
union_parameter \
|
||||
unions
|
||||
unions \
|
||||
|
||||
|
||||
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest)
|
||||
|
|
@ -698,7 +706,7 @@ MULTI_CPP_TEST_CASES += \
|
|||
packageoption \
|
||||
mod \
|
||||
template_typedef_import \
|
||||
multi_import
|
||||
multi_import \
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
wallkw.cpptest: SWIGOPT += -Wallkw
|
||||
|
|
@ -791,7 +799,7 @@ swig_and_compile_external = \
|
|||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
TARGET='$*_wrap_hdr.h' \
|
||||
$(LANGUAGE)$(VARIANT)_externalhdr; \
|
||||
$(LANGUAGE)$(VARIANT)_externalhdr && \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS) $*_external.cxx' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
|
||||
|
|
@ -805,7 +813,7 @@ setup = \
|
|||
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
fi;
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@
|
|||
return b;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ComplexPair
|
||||
{
|
||||
std::complex<double> z1, z2;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -73,12 +73,18 @@ public:
|
|||
|
||||
%include "std_vector.i"
|
||||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT) || defined(SWIGSCILAB)
|
||||
#if defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT) || defined(SWIGSCILAB)
|
||||
#define SWIG_GOOD_VECTOR
|
||||
%ignore std::vector<Space::Flow>::vector(size_type);
|
||||
%ignore std::vector<Space::Flow>::resize(size_type);
|
||||
#endif
|
||||
|
||||
#if defined(SWIGJAVA)
|
||||
#define SWIG_GOOD_VECTOR
|
||||
%ignore std::vector<Space::Flow>::vector(jint);
|
||||
%ignore std::vector<Space::Flow>::resize(jint);
|
||||
#endif
|
||||
|
||||
#if defined(SWIGTCL) || defined(SWIGPERL)
|
||||
#define SWIG_GOOD_VECTOR
|
||||
/* here, for languages with bad declaration */
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
%}
|
||||
|
||||
%nodefaultctor;
|
||||
|
|
@ -26,3 +30,11 @@ public:
|
|||
|
||||
%}
|
||||
|
||||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,26 @@
|
|||
struct SomeStruct {
|
||||
int addNormal(int x, int y);
|
||||
auto addAlternate(int x, int y) -> int;
|
||||
auto addAlternateConst(int x, int y) const -> int;
|
||||
auto addAlternateNoExcept(int x, int y) noexcept -> int;
|
||||
auto addAlternateConstNoExcept(int x, int y) const noexcept -> int;
|
||||
auto addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int)) -> int;
|
||||
auto addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int;
|
||||
|
||||
virtual auto addFinal(int x, int y) const noexcept -> int final { return x + y; }
|
||||
virtual ~SomeStruct() = default;
|
||||
};
|
||||
|
||||
auto SomeStruct::addAlternate(int x, int y) -> int {
|
||||
return x + y;
|
||||
int SomeStruct::addNormal(int x, int y) { return x + y; }
|
||||
auto SomeStruct::addAlternate(int x, int y) -> int { return x + y; }
|
||||
auto SomeStruct::addAlternateConst(int x, int y) const -> int { return x + y; }
|
||||
auto SomeStruct::addAlternateNoExcept(int x, int y) noexcept -> int { return x + y; }
|
||||
auto SomeStruct::addAlternateConstNoExcept(int x, int y) const noexcept -> int { return x + y; }
|
||||
auto SomeStruct::addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int)) -> int {
|
||||
return 100*x + (this->*mp)(x, x);
|
||||
}
|
||||
auto SomeStruct::addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int {
|
||||
return 1000*x + (this->*mp)(x, x);
|
||||
}
|
||||
|
||||
int SomeStruct::addNormal(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,17 @@
|
|||
*/
|
||||
%module cpp11_constexpr
|
||||
|
||||
|
||||
%inline %{
|
||||
#ifdef SWIG
|
||||
#define SWIGTESTCONST const
|
||||
#else
|
||||
#define SWIGTESTCONST
|
||||
#endif
|
||||
constexpr int AAA = 10;
|
||||
constexpr const int BBB = 20;
|
||||
constexpr int CCC() { return 30; }
|
||||
constexpr const int DDD() { return 40; }
|
||||
constexpr SWIGTESTCONST int DDD() { return 40; }
|
||||
|
||||
constexpr int XXX() { return 10; }
|
||||
constexpr int YYY = XXX() + 100;
|
||||
|
|
@ -17,7 +23,7 @@ struct ConstExpressions {
|
|||
static constexpr int KKK = 200;
|
||||
static const int LLL = 300;
|
||||
constexpr int MMM() { return 400; }
|
||||
constexpr const int NNN() { return 500; }
|
||||
constexpr SWIGTESTCONST int NNN() { return 500; }
|
||||
// Regression tests for support added in SWIG 3.0.4:
|
||||
static constexpr const int JJJ1 = 101;
|
||||
constexpr static int KKK1 = 201;
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@ public:
|
|||
};
|
||||
|
||||
struct A1 {
|
||||
void func(int i) {}
|
||||
void funk(int i) {}
|
||||
A1() = default;
|
||||
~A1() = default;
|
||||
void func(double i) = delete; /* Don't cast double to int. Compiler returns an error */
|
||||
void funk(double i) = delete; /* Don't cast double to int. Compiler returns an error */
|
||||
private:
|
||||
A1(const A1&);
|
||||
};
|
||||
A1::A1(const A1&) = default;
|
||||
|
||||
struct A2 {
|
||||
void func(int i) {}
|
||||
void funk(int i) {}
|
||||
virtual void fff(int) = delete;
|
||||
virtual ~A2() = default;
|
||||
template<class T> void func(T) = delete;
|
||||
template<class T> void funk(T) = delete;
|
||||
};
|
||||
|
||||
struct trivial {
|
||||
|
|
|
|||
20
Examples/test-suite/cpp11_directors.i
Normal file
20
Examples/test-suite/cpp11_directors.i
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
%module(directors="1") cpp11_directors
|
||||
%feature("director");
|
||||
|
||||
%{
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
virtual ~Foo() noexcept {}
|
||||
virtual int ping() noexcept = 0;
|
||||
virtual int pong() noexcept = 0;
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
virtual ~Foo() noexcept {}
|
||||
virtual int ping() noexcept = 0;
|
||||
virtual int pong() noexcept = 0;
|
||||
};
|
||||
|
|
@ -16,6 +16,8 @@ struct Base {
|
|||
virtual void finaloverride2() {}
|
||||
virtual void finaloverride3() {}
|
||||
virtual void finaloverride4() const {}
|
||||
virtual void finaloverride5() {}
|
||||
virtual void finaloverride6() const {}
|
||||
virtual ~Base() {}
|
||||
};
|
||||
|
||||
|
|
@ -31,6 +33,8 @@ struct Derived /*final*/ : Base {
|
|||
virtual void finaloverride2() override final {}
|
||||
virtual void finaloverride3() noexcept override final {}
|
||||
virtual void finaloverride4() const noexcept override final {}
|
||||
virtual void finaloverride5() throw(int) override final {}
|
||||
virtual void finaloverride6() const throw(int) override final {}
|
||||
virtual ~Derived() override final {}
|
||||
};
|
||||
void Derived::override2() const noexcept {}
|
||||
|
|
@ -78,6 +82,7 @@ struct Destructors4 : Base {
|
|||
struct FinalOverrideMethods {
|
||||
virtual void final() {}
|
||||
virtual void override(int) {}
|
||||
virtual ~FinalOverrideMethods() = default;
|
||||
};
|
||||
struct FinalOverrideVariables {
|
||||
int final;
|
||||
|
|
|
|||
|
|
@ -4,19 +4,27 @@
|
|||
|
||||
%inline %{
|
||||
#include <set>
|
||||
//#include <map>
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
//#include <unordered_map>
|
||||
#include <unordered_map>
|
||||
%}
|
||||
|
||||
%include "std_set.i"
|
||||
//%include "std_map.i"
|
||||
%include "std_multiset.i"
|
||||
%include "std_map.i"
|
||||
%include "std_multimap.i"
|
||||
%include "std_unordered_set.i"
|
||||
//%include "std_unordered_map.i"
|
||||
%include "std_unordered_multiset.i"
|
||||
%include "std_unordered_map.i"
|
||||
%include "std_unordered_multimap.i"
|
||||
%template (SetInt) std::set<int>;
|
||||
//%template (MapIntInt) std::map<int, int>;
|
||||
%template (MultiSetInt) std::multiset<int>;
|
||||
%template (MapIntInt) std::map<int, int>;
|
||||
%template (MultiMapIntInt) std::multimap<int, int>;
|
||||
%template (UnorderedSetInt) std::unordered_set<int>;
|
||||
//%template (UnorderedMapIntInt) std::unordered_map<int, int>;
|
||||
%template (UnorderedMultiSetInt) std::unordered_multiset<int>;
|
||||
%template (UnorderedMapIntInt) std::unordered_map<int, int>;
|
||||
%template (UnorderedMultiMapIntInt) std::unordered_multimap<int, int>;
|
||||
|
||||
%inline %{
|
||||
using namespace std;
|
||||
|
|
@ -25,19 +33,19 @@ class MyClass {
|
|||
public:
|
||||
set<int> getSet() { return _set; }
|
||||
void addSet(int elt) { _set.insert(_set.begin(), elt); }
|
||||
// map<int, int> getMap() { return _map; }
|
||||
// void addMap(int elt1, int elt2) { _map.insert(make_pair(elt1, elt2)); }
|
||||
map<int, int> getMap() { return _map; }
|
||||
void addMap(int elt1, int elt2) { _map.insert(make_pair(elt1, elt2)); }
|
||||
|
||||
unordered_set<int> getUnorderedSet() { return _unordered_set; }
|
||||
void addUnorderedSet(int elt) { _unordered_set.insert(_unordered_set.begin(), elt); }
|
||||
// unordered_map<int, int> getUnorderedMap() { return _unordered_map; }
|
||||
// void addUnorderedMap(int elt1, int elt2) { _unordered_map.insert(make_pair(elt1, elt2)); }
|
||||
unordered_map<int, int> getUnorderedMap() { return _unordered_map; }
|
||||
void addUnorderedMap(int elt1, int elt2) { _unordered_map.insert(make_pair(elt1, elt2)); }
|
||||
private:
|
||||
set<int> _set;
|
||||
// map<int, int> _map;
|
||||
map<int, int> _map;
|
||||
|
||||
unordered_set<int> _unordered_set;
|
||||
// unordered_map<int, int> _unordered_map;
|
||||
unordered_map<int, int> _unordered_map;
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,13 @@
|
|||
%ignore NoExceptClass(NoExceptClass&&);
|
||||
%rename(Assignment) NoExceptClass::operator=;
|
||||
|
||||
%{
|
||||
extern "C" void global_noexcept(int, bool) noexcept {}
|
||||
%}
|
||||
%inline %{
|
||||
|
||||
extern "C" void global_noexcept(int, bool) noexcept;
|
||||
extern "C" void global_noexcept2(int, bool) noexcept {}
|
||||
|
||||
struct NoExceptClass {
|
||||
static const bool VeryTrue = true;
|
||||
|
|
@ -14,7 +18,7 @@ struct NoExceptClass {
|
|||
NoExceptClass(const NoExceptClass&) noexcept {}
|
||||
NoExceptClass(NoExceptClass&&) noexcept {}
|
||||
NoExceptClass& operator=(const NoExceptClass&) noexcept { return *this; }
|
||||
~NoExceptClass() noexcept {}
|
||||
virtual ~NoExceptClass() noexcept {}
|
||||
|
||||
void noex0() noexcept {}
|
||||
void noex1() noexcept(sizeof(int) == 4) {}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@
|
|||
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) hh;
|
||||
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ii;
|
||||
|
||||
#if defined(SWIGTCL) || defined(SWIGCSHARP) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGPYTHON) || defined(SWIGJAVA)
|
||||
%include <std_wstring.i>
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
#include <iostream>
|
||||
|
|
|
|||
226
Examples/test-suite/cpp11_ref_qualifiers.i
Normal file
226
Examples/test-suite/cpp11_ref_qualifiers.i
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
%module cpp11_ref_qualifiers
|
||||
|
||||
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ccextra2;
|
||||
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ccextra3;
|
||||
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc2;
|
||||
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc3;
|
||||
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc5;
|
||||
|
||||
%include <std_string.i>
|
||||
|
||||
%ignore Host::h() const &;
|
||||
|
||||
// Basic testing
|
||||
%inline %{
|
||||
using std::string;
|
||||
class Host {
|
||||
string s;
|
||||
public:
|
||||
string h1() & { return string(); }
|
||||
string h2() const & { return string(); }
|
||||
string h3() && { return std::move(string()); }
|
||||
string h4() const && { return std::move(string()); }
|
||||
string h5() const { return string(); }
|
||||
string h6() volatile const & { return string(); }
|
||||
string h7() const volatile & { return string(); }
|
||||
string h8() volatile const && { return std::move(string()); }
|
||||
string h9() const volatile && { return std::move(string()); }
|
||||
|
||||
string h() & { return string(); }
|
||||
string h() const & { return string(); }
|
||||
string h() && { return std::move(string()); }
|
||||
string h() const && { return std::move(string()); }
|
||||
};
|
||||
%}
|
||||
|
||||
// %feature testing
|
||||
%feature("except") F1() & %{ result = "F1"; %}
|
||||
%feature("except") F2 %{ result = "F2"; %}
|
||||
%feature("except") F3 %{ result = "F3"; %}
|
||||
%feature("except") F3() %{ _should_not_be_used_ %}
|
||||
|
||||
%feature("except") C1(int i) const & %{ result = "C1"; %}
|
||||
%feature("except") C2 %{ result = "C2"; %}
|
||||
%feature("except") C3 %{ result = "C3"; %}
|
||||
%feature("except") C3(int i) %{ _should_not_be_used_ %}
|
||||
|
||||
%inline %{
|
||||
struct Features {
|
||||
string F1() & { return string(); }
|
||||
string F2() & { return string(); }
|
||||
string F3() & { return string(); }
|
||||
|
||||
string C1(int i) const & { return string(); }
|
||||
string C2(int i) const & { return string(); }
|
||||
string C3(int i) const & { return string(); }
|
||||
};
|
||||
%}
|
||||
|
||||
// %rename testing
|
||||
%rename(RR1) R1;
|
||||
%rename(RR2) R2() &;
|
||||
%rename(RR3) R3;
|
||||
%rename(RR3Bad) R3();
|
||||
|
||||
%rename(SS1) S1;
|
||||
%rename(SS2) S2(int i) const &;
|
||||
%rename(SS3) S3;
|
||||
%rename(SS3Bad) S3(int i);
|
||||
%rename(SS3BadConst) S3(int i) const;
|
||||
%rename(SS3BadLValue) S3(int i) &;
|
||||
|
||||
%inline %{
|
||||
struct Renames {
|
||||
string R1() & { return string(); }
|
||||
string R2() & { return string(); }
|
||||
string R3() & { return string(); }
|
||||
|
||||
string S1(int i) const & { return string(); }
|
||||
string S2(int i) const & { return string(); }
|
||||
string S3(int i) const & { return string(); }
|
||||
};
|
||||
%}
|
||||
|
||||
// Conversion operators
|
||||
%rename(StringConvertCopy) operator string() &;
|
||||
%rename(StringConvertMove) operator string() &&;
|
||||
%feature("ignore", "0") operator string() &&; // unignore as it is ignored by default
|
||||
|
||||
%inline %{
|
||||
struct ConversionOperators {
|
||||
virtual operator string() & { return string(); }
|
||||
virtual operator string() && { return std::move(string()); }
|
||||
virtual ~ConversionOperators() {}
|
||||
};
|
||||
struct ConversionOperators2 {
|
||||
virtual operator string() && { return std::move(string()); }
|
||||
virtual ~ConversionOperators2() {}
|
||||
};
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
struct Funcs {
|
||||
short FF(bool) { return 0; }
|
||||
short CC(bool) const & { return 0; }
|
||||
};
|
||||
|
||||
class MemberFuncPtrs
|
||||
{
|
||||
public:
|
||||
// member ref-qualified function pointers, unnamed parameters
|
||||
int aaa1(short (Funcs::*)(bool) &) const;
|
||||
int aaa2(short (Funcs::* const *&)(bool) &) const;
|
||||
int aaa3(short (Funcs::* *&)(bool) &) const;
|
||||
int aaa4(short (Funcs::* *const&)(bool) &) const;
|
||||
int aaa5(short (Funcs::* &)(bool) &) const;
|
||||
int aaa6(short (Funcs::* const)(bool) &) const;
|
||||
int aaa7(short (Funcs::* const&)(bool) &) const;
|
||||
|
||||
int aaa8(short (Funcs::* const&)(bool) &&) const;
|
||||
|
||||
// member cv-qualified and ref-qualified function pointers, unnamed parameters
|
||||
int bbb1(short (Funcs::*)(bool) const &) const;
|
||||
int bbb2(short (Funcs::* const *&)(bool) const &) const;
|
||||
int bbb3(short (Funcs::* *&)(bool) const &) const;
|
||||
int bbb4(short (Funcs::* *const&)(bool) const &) const;
|
||||
int bbb5(short (Funcs::* &)(bool) const &) const;
|
||||
int bbb6(short (Funcs::* const)(bool) const &) const;
|
||||
int bbb7(short (Funcs::* const&)(bool) const &) const;
|
||||
|
||||
int bbb8(short (Funcs::*)(bool) const &&) const;
|
||||
|
||||
// member ref-qualified function pointers, named parameters
|
||||
int qqq1(short (Funcs::* qq1)(bool) &) const;
|
||||
int qqq2(short (Funcs::* const *& qq2)(bool) &) const;
|
||||
int qqq3(short (Funcs::* *& qq3)(bool) &) const;
|
||||
int qqq4(short (Funcs::* *const& qq4)(bool) &) const;
|
||||
int qqq5(short (Funcs::* & qq5)(bool) &) const;
|
||||
int qqq6(short (Funcs::* const qq6)(bool) &) const;
|
||||
int qqq7(short (Funcs::* const& qq7)(bool) &) const;
|
||||
|
||||
int qqq8(short (Funcs::* const& qq8)(bool) &&) const;
|
||||
|
||||
// member cv-qualified and ref-qualified function pointers, named parameters
|
||||
int rrr1(short (Funcs::* rr1)(bool) const &) const;
|
||||
int rrr2(short (Funcs::* const *& rr2)(bool) const &) const;
|
||||
int rrr3(short (Funcs::* *& rr3)(bool) const &) const;
|
||||
int rrr4(short (Funcs::* *const& rr4)(bool) const &) const;
|
||||
int rrr5(short (Funcs::* & rr5)(bool) const &) const;
|
||||
int rrr6(short (Funcs::* const rr6)(bool) const &) const;
|
||||
int rrr7(short (Funcs::* const& rr7)(bool) const &) const;
|
||||
|
||||
int rrr8(short (Funcs::* rr1)(bool) const &&) const;
|
||||
};
|
||||
|
||||
// member ref-qualified function pointers, unnamed parameters
|
||||
int MemberFuncPtrs::aaa1(short (Funcs::*)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::aaa2(short (Funcs::* const *&)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::aaa3(short (Funcs::* *&)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::aaa4(short (Funcs::* *const&)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::aaa5(short (Funcs::* &)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::aaa6(short (Funcs::* const)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::aaa7(short (Funcs::* const&)(bool) &) const { return 0; }
|
||||
|
||||
int MemberFuncPtrs::aaa8(short (Funcs::* const&)(bool) &&) const { return 0; }
|
||||
|
||||
// member cv-qualified and ref-qualified function pointers, unnamed parameters
|
||||
int MemberFuncPtrs::bbb1(short (Funcs::*)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::bbb2(short (Funcs::* const *&)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::bbb3(short (Funcs::* *&)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::bbb4(short (Funcs::* *const&)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::bbb5(short (Funcs::* &)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::bbb6(short (Funcs::* const)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::bbb7(short (Funcs::* const&)(bool) const &) const { return 0; }
|
||||
|
||||
int MemberFuncPtrs::bbb8(short (Funcs::*)(bool) const &&) const { return 0; }
|
||||
|
||||
// member ref-qualified function pointers, named parameters
|
||||
int MemberFuncPtrs::qqq1(short (Funcs::* qq1)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::qqq2(short (Funcs::* const *& qq2)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::qqq3(short (Funcs::* *& qq3)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::qqq4(short (Funcs::* *const& qq4)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::qqq5(short (Funcs::* & qq5)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::qqq6(short (Funcs::* const qq6)(bool) &) const { return 0; }
|
||||
int MemberFuncPtrs::qqq7(short (Funcs::* const& qq7)(bool) &) const { return 0; }
|
||||
|
||||
int MemberFuncPtrs::qqq8(short (Funcs::* const& qq8)(bool) &&) const { return 0; }
|
||||
|
||||
// member cv-qualified and ref-qualified function pointers, named parameters
|
||||
int MemberFuncPtrs::rrr1(short (Funcs::* rr1)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::rrr2(short (Funcs::* const *& rr2)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::rrr3(short (Funcs::* *& rr3)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::rrr4(short (Funcs::* *const& rr4)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::rrr5(short (Funcs::* & rr5)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::rrr6(short (Funcs::* const rr6)(bool) const &) const { return 0; }
|
||||
int MemberFuncPtrs::rrr7(short (Funcs::* const& rr7)(bool) const &) const { return 0; }
|
||||
|
||||
int MemberFuncPtrs::rrr8(short (Funcs::* rr1)(bool) const &&) const { return 0; }
|
||||
|
||||
// member cv-qualified and ref-qualified pointer variables
|
||||
short (Funcs::* cc1)(bool) const & = &Funcs::CC;
|
||||
|
||||
short (Funcs::* const * ccextra2)(bool) const & = &cc1;
|
||||
short (Funcs::* * ccextra3)(bool) const & = &cc1;
|
||||
short (Funcs::* *const ccextra4)(bool) const & = &cc1;
|
||||
|
||||
short (Funcs::* const *& cc2)(bool) const & = ccextra2;
|
||||
short (Funcs::* *& cc3)(bool) const & = ccextra3;
|
||||
short (Funcs::* *const& cc4)(bool) const & = ccextra4;
|
||||
short (Funcs::* & cc5)(bool) const & = cc1;
|
||||
short (Funcs::* const cc6)(bool) const & = &Funcs::CC;
|
||||
short (Funcs::* const& cc7)(bool) const & = cc1;
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
|
||||
struct Funktions {
|
||||
int addByValue(const int &a, int b) const & { return a+b; }
|
||||
int * addByPointer(const int &a, int b) const & { static int val; val = a+b; return &val; }
|
||||
int & addByReference(const int &a, int b) const & { static int val; val = a+b; return val; }
|
||||
};
|
||||
|
||||
int call1(int (Funktions::*d)(const int &, int) const &, int a, int b) { Funktions f; return (f.*d)(a, b); }
|
||||
//int call2(int * (Funktions::*d)(const int &, int) const &, int a, int b) { Funktions f; return *(f.*d)(a, b); }
|
||||
//int call3(int & (Funktions::*d)(const int &, int) const &, int a, int b) { Funktions f; return (f.*d)(a, b); }
|
||||
%}
|
||||
%constant int (Funktions::*ADD_BY_VALUE)(const int &, int) const & = &Funktions::addByValue;
|
||||
15
Examples/test-suite/cpp11_ref_qualifiers_rvalue_unignore.i
Normal file
15
Examples/test-suite/cpp11_ref_qualifiers_rvalue_unignore.i
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
%module cpp11_ref_qualifiers_rvalue_unignore
|
||||
|
||||
// This is a minimal test that does not include any C++ headers to make sure the required
|
||||
// <memory> header is generated from a fragment for the generated std::move call
|
||||
|
||||
// m1 and m2 are ignored by default, unignore them
|
||||
%feature("ignore", "0") RefQualifier::m1() &&;
|
||||
%feature("ignore", "0") RefQualifier::m2() const &&;
|
||||
|
||||
%inline %{
|
||||
struct RefQualifier {
|
||||
void m1() && {}
|
||||
void m2() const && {}
|
||||
};
|
||||
%}
|
||||
74
Examples/test-suite/cpp11_ref_qualifiers_typemaps.i
Normal file
74
Examples/test-suite/cpp11_ref_qualifiers_typemaps.i
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
%module cpp11_ref_qualifiers_typemaps
|
||||
|
||||
%typemap(in) SWIGTYPE (CLASS::*) %{
|
||||
_this_will_fail_to_compile_if_used_
|
||||
%}
|
||||
|
||||
// typemaps to completely ignore the input parm and override it
|
||||
%typemap(in) short (Funcs::*ff)(bool) const %{ $1 = &Funcs::FFF2; %}
|
||||
%typemap(in) short (Funcs::*cc)(bool) & %{ $1 = &Funcs::CCC5; %}
|
||||
%typemap(in) short (Funcs::*gg)(bool) const & %{ $1 = &Funcs::GGG8; %}
|
||||
%typemap(in) short (Funcs::*hh)(bool) && %{ $1 = &Funcs::HHH11; %}
|
||||
|
||||
%typemap(in) short (Funcs::*)(bool) const %{ $1 = &Funcs::FFF3; %}
|
||||
%typemap(in) short (Funcs::*)(bool) & %{ $1 = &Funcs::CCC6; %}
|
||||
%typemap(in) short (Funcs::*)(bool) const & %{ $1 = &Funcs::GGG9; %}
|
||||
%typemap(in) short (Funcs::*)(bool) && %{ $1 = &Funcs::HHH12; %}
|
||||
|
||||
%inline %{
|
||||
struct Funcs {
|
||||
short FFF1(bool) const { return 1; }
|
||||
short FFF2(bool) const { return 2; }
|
||||
short FFF3(bool) const { return 3; }
|
||||
short CCC4(bool) & { return 4; }
|
||||
short CCC5(bool) & { return 5; }
|
||||
short CCC6(bool) & { return 6; }
|
||||
short GGG7(bool) const & { return 7; }
|
||||
short GGG8(bool) const & { return 8; }
|
||||
short GGG9(bool) const & { return 9; }
|
||||
short HHH10(bool) && { return 10; }
|
||||
short HHH11(bool) && { return 11; }
|
||||
short HHH12(bool) && { return 12; }
|
||||
};
|
||||
struct TypemapsNamedParms
|
||||
{
|
||||
short fff(short (Funcs::*ff)(bool) const) {
|
||||
Funcs funcs;
|
||||
return (funcs.*ff)(true);
|
||||
}
|
||||
short ccc(short (Funcs::*cc)(bool) &) {
|
||||
Funcs funcs;
|
||||
return (funcs.*cc)(true);
|
||||
}
|
||||
short ggg(short (Funcs::*gg)(bool) const &) {
|
||||
Funcs funcs;
|
||||
return (funcs.*gg)(true);
|
||||
}
|
||||
short hhh(short (Funcs::*hh)(bool) &&) {
|
||||
return (Funcs().*hh)(true);
|
||||
}
|
||||
};
|
||||
struct TypemapsUnnamedParms
|
||||
{
|
||||
short fff(short (Funcs::*f)(bool) const) {
|
||||
Funcs funcs;
|
||||
return (funcs.*f)(true);
|
||||
}
|
||||
short ccc(short (Funcs::*c)(bool) &) {
|
||||
Funcs funcs;
|
||||
return (funcs.*c)(true);
|
||||
}
|
||||
short ggg(short (Funcs::*g)(bool) const &) {
|
||||
Funcs funcs;
|
||||
return (funcs.*g)(true);
|
||||
}
|
||||
short hhh(short (Funcs::*h)(bool) &&) {
|
||||
return (Funcs().*h)(true);
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
||||
%constant short (Funcs::*FF1_MFP)(bool) const = &Funcs::FFF1;
|
||||
%constant short (Funcs::*CC4_MFP)(bool) & = &Funcs::CCC4;
|
||||
%constant short (Funcs::*GG7_MFP)(bool) const & = &Funcs::GGG7;
|
||||
%constant short (Funcs::*HH10_MFP)(bool) && = &Funcs::HHH10;
|
||||
|
|
@ -23,7 +23,7 @@ struct Thingy {
|
|||
int val;
|
||||
int &lvalref;
|
||||
int &&rvalref;
|
||||
Thingy(int v) : val(v), lvalref(val), rvalref(22) {}
|
||||
Thingy(int v, int &&rvalv) : val(v), lvalref(val), rvalref(std::move(rvalv)) {}
|
||||
void refIn(long &i) {}
|
||||
void rvalueIn(long &&i) {}
|
||||
short && rvalueInOut(short &&i) { return std::move(i); }
|
||||
|
|
@ -32,7 +32,7 @@ struct Thingy {
|
|||
void compactDefaultArgs(const bool &&b = (const bool &&)PublicGlobalTrue, const UserDef &&u = (const UserDef &&)PublicUserDef) {}
|
||||
void privateDefaultArgs(const bool &&b = (const bool &&)PrivateTrue) {}
|
||||
operator int &&() { return std::move(0); }
|
||||
Thingy(const Thingy& rhs) : val(rhs.val), lvalref(rhs.lvalref), rvalref(copy_int(rhs.rvalref)) {}
|
||||
Thingy(const Thingy& rhs) : val(rhs.val), lvalref(rhs.lvalref), rvalref(std::move(rhs.rvalref)) {}
|
||||
Thingy& operator=(const Thingy& rhs) {
|
||||
val = rhs.val;
|
||||
lvalref = rhs.lvalref;
|
||||
|
|
@ -41,23 +41,25 @@ struct Thingy {
|
|||
}
|
||||
private:
|
||||
static const bool PrivateTrue;
|
||||
int copy_int(int& i) { return i; }
|
||||
Thingy();
|
||||
};
|
||||
const bool Thingy::PrivateTrue = true;
|
||||
|
||||
short && globalRvalueInOut(short &&i) { return std::move(i); }
|
||||
|
||||
Thingy &&globalrrval = Thingy(55);
|
||||
int glob = 123;
|
||||
|
||||
short && func(short &&i) { return std::move(i); }
|
||||
Thingy getit() { return Thingy(22); }
|
||||
Thingy &&globalrrval = Thingy(55, std::move(glob));
|
||||
|
||||
short && funk(short &&i) { return std::move(i); }
|
||||
Thingy getit() { return Thingy(22, std::move(glob)); }
|
||||
|
||||
void rvalrefFunction1(int &&v = (int &&)5) {}
|
||||
void rvalrefFunctionBYVAL(short (Thingy::*memFunc)(short)) {}
|
||||
void rvalrefFunctionLVALUE(short &(Thingy::*memFunc)(short &)) {}
|
||||
void rvalrefFunction2(short && (Thingy::*memFunc)(short &&)) {}
|
||||
void rvalrefFunction3(short && (*memFunc)(short &&)) {}
|
||||
void rvalrefFunctionBYVAL(short (Thingy::*fptr)(short)) {}
|
||||
void rvalrefFunctionPTR(short * (*fptr)(short *)) {}
|
||||
void rvalrefFunctionLVALUE(short & (Thingy::*fptr)(short &)) {}
|
||||
void rvalrefFunction2(short && (Thingy::*fptr)(short &&)) {}
|
||||
void rvalrefFunction3(short && (*fptr)(short &&)) {}
|
||||
|
||||
template <typename T> struct RemoveReference {
|
||||
typedef T type;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,13 @@ struct Containing {
|
|||
Thing *const&& member_rvalue_ref_ptr3 = 0;
|
||||
Thing const*const &&member_rvalue_ref_ptr4 = 0;
|
||||
|
||||
Containing() : member_rvalue_ref(Thing()) {}
|
||||
Containing(Thing&&r, Thing*&& r1, Thing const*&& r2, Thing *const&& r3, Thing const*const && r4) :
|
||||
member_rvalue_ref(std::move(r)),
|
||||
member_rvalue_ref_ptr1(std::move(r1)),
|
||||
member_rvalue_ref_ptr2(std::move(r2)),
|
||||
member_rvalue_ref_ptr3(std::move(r3)),
|
||||
member_rvalue_ref_ptr4(std::move(r4))
|
||||
{}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
@ -62,6 +68,12 @@ struct IntContaining {
|
|||
int *const&& member_rvalue_ref_ptr3 = 0;
|
||||
int const*const &&member_rvalue_ref_ptr4 = 0;
|
||||
|
||||
IntContaining() : member_rvalue_ref(55) {}
|
||||
IntContaining(int&& r, int*&& r1, int const*&& r2, int *const&& r3, int const*const && r4) :
|
||||
member_rvalue_ref(std::move(r)),
|
||||
member_rvalue_ref_ptr1(std::move(r1)),
|
||||
member_rvalue_ref_ptr2(std::move(r2)),
|
||||
member_rvalue_ref_ptr3(std::move(r3)),
|
||||
member_rvalue_ref_ptr4(std::move(r4))
|
||||
{}
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
57
Examples/test-suite/cpp11_shared_ptr_const.i
Normal file
57
Examples/test-suite/cpp11_shared_ptr_const.i
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
%module cpp11_shared_ptr_const
|
||||
|
||||
%{
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class Foo
|
||||
{
|
||||
public:
|
||||
Foo(int i) : m(i) {}
|
||||
int get_m() { return m;}
|
||||
int m;
|
||||
};
|
||||
|
||||
std::shared_ptr<Foo> foo(Foo v) {
|
||||
return std::shared_ptr<Foo>(new Foo(v));
|
||||
}
|
||||
|
||||
std::shared_ptr<const Foo> const_foo(Foo v) {
|
||||
return std::shared_ptr<const Foo>(new Foo(v));
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Foo> > foo_vec(Foo v) {
|
||||
std::vector<std::shared_ptr<Foo> > result;
|
||||
result.push_back( std::shared_ptr<Foo>(new Foo(v)) );
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<const Foo> > const_foo_vec(Foo v) {
|
||||
std::vector<std::shared_ptr<const Foo> > result;
|
||||
result.push_back( std::shared_ptr<Foo>(new Foo(v)) );
|
||||
return result;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%include <std_shared_ptr.i>
|
||||
%include <std_vector.i>
|
||||
|
||||
%shared_ptr(Foo);
|
||||
|
||||
%template (FooVector) std::vector<std::shared_ptr<Foo> >;
|
||||
%template (FooConstVector) std::vector<std::shared_ptr<Foo const> >;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public:
|
||||
Foo(int i);
|
||||
int get_m();
|
||||
int m;
|
||||
};
|
||||
std::shared_ptr<Foo> foo(Foo v);
|
||||
std::shared_ptr<const Foo> const_foo(Foo v);
|
||||
std::vector<std::shared_ptr<Foo> > foo_vec(Foo v) const;
|
||||
std::vector<std::shared_ptr<const Foo> > const_foo_vec(Foo v) const;
|
||||
|
||||
50
Examples/test-suite/cpp11_shared_ptr_nullptr_in_containers.i
Normal file
50
Examples/test-suite/cpp11_shared_ptr_nullptr_in_containers.i
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
%module cpp11_shared_ptr_nullptr_in_containers
|
||||
|
||||
%{
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class C;
|
||||
%}
|
||||
|
||||
%include <std_shared_ptr.i>
|
||||
%include <std_vector.i>
|
||||
|
||||
%shared_ptr(C)
|
||||
|
||||
%inline %{
|
||||
|
||||
class C {
|
||||
public:
|
||||
C() : m(-1) {}
|
||||
C(int i) : m(i) {}
|
||||
int get_m() { return m; }
|
||||
int m;
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
%template() std::vector<std::shared_ptr<C> >;
|
||||
|
||||
%inline %{
|
||||
|
||||
std::vector<std::shared_ptr<C> > ret_vec_c_shared_ptr() {
|
||||
std::vector<std::shared_ptr<C> > ret(3);
|
||||
ret[0] = std::shared_ptr<C>(new C(0));
|
||||
ret[2] = std::shared_ptr<C>(new C(2));
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<C> > ret_arg_vec(const std::vector<std::shared_ptr<C> >& v) {
|
||||
return v;
|
||||
}
|
||||
|
||||
bool is_last_null(const std::vector<std::shared_ptr<C> >& v) {
|
||||
if( v.back() ) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
188
Examples/test-suite/cpp11_shared_ptr_upcast.i
Normal file
188
Examples/test-suite/cpp11_shared_ptr_upcast.i
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
%module cpp11_shared_ptr_upcast
|
||||
|
||||
%{
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
%}
|
||||
|
||||
%include <std_vector.i>
|
||||
%include <std_map.i>
|
||||
%include <std_shared_ptr.i>
|
||||
|
||||
%{
|
||||
|
||||
class Base {
|
||||
public:
|
||||
Base() : m(-1) {}
|
||||
Base(int i) : m(i) {}
|
||||
int get_m() { return m; }
|
||||
int m;
|
||||
};
|
||||
|
||||
class Derived : public Base {
|
||||
public:
|
||||
Derived() : n(-2) {}
|
||||
Derived(int i) : n(i) {}
|
||||
int get_n() { return n; }
|
||||
int n;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Base> BasePtr;
|
||||
typedef std::shared_ptr<Derived> DerivedPtr;
|
||||
|
||||
// non-overloaded
|
||||
int derived_num1(DerivedPtr v) {
|
||||
return v == nullptr ? 999 : (*v).get_n();
|
||||
}
|
||||
|
||||
int derived_num2(std::vector<DerivedPtr> v) {
|
||||
return v[0] == nullptr ? 999 : (*v[0]).get_n();
|
||||
}
|
||||
|
||||
int derived_num3(std::map<int, DerivedPtr> v) {
|
||||
return v[0] == nullptr ? 999 : (*v[0]).get_n();
|
||||
}
|
||||
|
||||
int base_num1(BasePtr v) {
|
||||
return v == nullptr ? 999 : (*v).get_m();
|
||||
}
|
||||
|
||||
int base_num2(std::vector<BasePtr > v) {
|
||||
return v[0] == nullptr ? 999 : (*v[0]).get_m();
|
||||
}
|
||||
|
||||
int base_num3(std::map<int, BasePtr > v) {
|
||||
return v[0] == nullptr ? 999 : (*v[0]).get_m();
|
||||
}
|
||||
|
||||
// overloaded
|
||||
int derived_num(DerivedPtr v) {
|
||||
return derived_num1(v);
|
||||
}
|
||||
|
||||
int derived_num(std::vector<DerivedPtr> v) {
|
||||
return derived_num2(v);
|
||||
}
|
||||
|
||||
int derived_num(std::map<int, DerivedPtr> v) {
|
||||
return derived_num3(v);
|
||||
}
|
||||
|
||||
int base_num(BasePtr v) {
|
||||
return base_num1(v);
|
||||
}
|
||||
|
||||
int base_num(std::vector<BasePtr > v) {
|
||||
return base_num2(v);
|
||||
}
|
||||
|
||||
int base_num(std::map<int, BasePtr > v) {
|
||||
return base_num3(v);
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
%shared_ptr(Base);
|
||||
%shared_ptr(Derived);
|
||||
|
||||
%template(BaseList) std::vector<std::shared_ptr<Base> >;
|
||||
%template(DerivedList) std::vector<std::shared_ptr<Derived> >;
|
||||
|
||||
%template(BaseMap) std::map<int, std::shared_ptr<Base> >;
|
||||
%template(DerivedMap) std::map<int, std::shared_ptr<Derived> >;
|
||||
|
||||
class Base {
|
||||
public:
|
||||
Base();
|
||||
int get_m();
|
||||
int m;
|
||||
};
|
||||
|
||||
class Derived : public Base {
|
||||
public:
|
||||
Derived();
|
||||
Derived(int i);
|
||||
int get_n();
|
||||
int n;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Base> BasePtr;
|
||||
typedef std::shared_ptr<Derived> DerivedPtr;
|
||||
|
||||
// non-overloaded
|
||||
int derived_num1(DerivedPtr);
|
||||
int derived_num2(std::vector<std::shared_ptr<Derived> > v);
|
||||
int derived_num3(std::map<int, DerivedPtr> v);
|
||||
int base_num1(BasePtr);
|
||||
int base_num2(std::vector<std::shared_ptr<Base> > v);
|
||||
int base_num3(std::map<int, BasePtr > v);
|
||||
|
||||
// overloaded
|
||||
int derived_num(DerivedPtr);
|
||||
int derived_num(std::vector<std::shared_ptr<Derived> > v);
|
||||
int derived_num(std::map<int, DerivedPtr> v);
|
||||
int base_num(BasePtr);
|
||||
int base_num(std::vector<std::shared_ptr<Base> > v);
|
||||
int base_num(std::map<int, BasePtr > v);
|
||||
|
||||
// ptr to shared_ptr
|
||||
%shared_ptr(Base2);
|
||||
%shared_ptr(Derived2)
|
||||
|
||||
%inline %{
|
||||
class Base2 {
|
||||
public:
|
||||
Base2() : m(-1) {}
|
||||
Base2(int i) : m(i) {}
|
||||
int get_m() { return m; }
|
||||
int m;
|
||||
};
|
||||
|
||||
|
||||
class Derived2 : public Base2 {
|
||||
public:
|
||||
Derived2() : n(0) {}
|
||||
Derived2(int i) : n(i) {}
|
||||
int get_n_2() { return n; }
|
||||
int n;
|
||||
};
|
||||
%}
|
||||
|
||||
%template(Base2List) std::vector<std::shared_ptr<Base2> * >;
|
||||
%template(Base2Map) std::map<int, std::shared_ptr<Base2> * >;
|
||||
|
||||
%template(Derived2List) std::vector<std::shared_ptr<Derived2> * >;
|
||||
%template(Derived2Map) std::map<int, std::shared_ptr<Derived2> * >;
|
||||
|
||||
%inline %{
|
||||
typedef std::shared_ptr<Derived2> * Derived2Ptr;
|
||||
typedef std::shared_ptr<Base2> * Base2Ptr;
|
||||
|
||||
int base2_num1(Base2Ptr v) {
|
||||
return v == nullptr ? 999 : *v == nullptr ? 888 : (*v)->get_m();
|
||||
}
|
||||
|
||||
int base2_num2(std::vector<Base2Ptr> v) {
|
||||
return v[0] == nullptr ? 999 : *v[0] == nullptr ? 888 : (*v[0])->get_m();
|
||||
}
|
||||
|
||||
int base2_num3(std::map<int, Base2Ptr> v) {
|
||||
return v[0] == nullptr ? 999 : *v[0] == nullptr ? 888 : (*v[0])->get_m();
|
||||
}
|
||||
|
||||
int derived2_num1(Derived2Ptr v) {
|
||||
return v == nullptr ? 999 : *v == nullptr ? 888 : (*v)->get_n_2();
|
||||
}
|
||||
|
||||
int derived2_num2(std::vector<Derived2Ptr> v) {
|
||||
return v[0] == nullptr ? 999 : *v[0] == nullptr ? 888 : (*v[0])->get_n_2();
|
||||
}
|
||||
|
||||
int derived2_num3(std::map<int, Derived2Ptr> v) {
|
||||
return v[0] == nullptr ? 999 : *v[0] == nullptr ? 888 : (*v[0])->get_n_2();
|
||||
}
|
||||
%}
|
||||
|
|
@ -1,12 +1,32 @@
|
|||
/* This test case checks whether SWIG correctly parses and ignores the
|
||||
keywords "static_assert()" inside the class or struct.
|
||||
/* This test case checks whether SWIG correctly parses and ignores
|
||||
"static_assert()" in various places.
|
||||
*/
|
||||
%module cpp11_static_assert
|
||||
|
||||
%inline %{
|
||||
static_assert(sizeof(int) >= 2, "What? int size is invalid!");
|
||||
|
||||
namespace dummy {
|
||||
// C++17 allows the message to be omitted, so check that works too.
|
||||
// But only show the C++17 version to SWIG, as the compiler may
|
||||
// lack C++17 support.
|
||||
#ifdef SWIG
|
||||
static_assert(sizeof(int) >= sizeof(short));
|
||||
#else
|
||||
static_assert(sizeof(int) >= sizeof(short), "blah");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct Check1 {
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
Check1() {
|
||||
#ifdef SWIG
|
||||
static_assert(true);
|
||||
#else
|
||||
static_assert(true, "true");
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
|||
5
Examples/test-suite/cpp11_std_unordered_map.i
Normal file
5
Examples/test-suite/cpp11_std_unordered_map.i
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
%module cpp11_std_unordered_map
|
||||
|
||||
%include <std_unordered_map.i>
|
||||
|
||||
%template(UnorderedMapIntInt) std::unordered_map<int, int>;
|
||||
7
Examples/test-suite/cpp11_std_unordered_multimap.i
Normal file
7
Examples/test-suite/cpp11_std_unordered_multimap.i
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
%module cpp11_std_unordered_multimap
|
||||
|
||||
%include <std_pair.i>
|
||||
%include <std_unordered_multimap.i>
|
||||
|
||||
%template(PairIntInt) std::pair<int,int>;
|
||||
%template(UnorderedMultiMapIntInt) std::unordered_multimap<int, int>;
|
||||
5
Examples/test-suite/cpp11_std_unordered_multiset.i
Normal file
5
Examples/test-suite/cpp11_std_unordered_multiset.i
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
%module cpp11_std_unordered_multiset
|
||||
|
||||
%include <std_unordered_multiset.i>
|
||||
|
||||
%template(UnorderedMultiSetInt) std::unordered_multiset<int>;
|
||||
5
Examples/test-suite/cpp11_std_unordered_set.i
Normal file
5
Examples/test-suite/cpp11_std_unordered_set.i
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
%module cpp11_std_unordered_set
|
||||
|
||||
%include <std_unordered_set.i>
|
||||
|
||||
%template(UnorderedSetInt) std::unordered_set<int>;
|
||||
|
|
@ -108,5 +108,5 @@ PairSubclass::data_t plus1(PairSubclass::const_ref_data_t x) { return x + 1; }
|
|||
using callback_t = int(*)(int);
|
||||
|
||||
callback_t get_callback() { return mult2; }
|
||||
int call(callback_t func, int param) { return func(param); }
|
||||
int call(callback_t funk, int param) { return funk(param); }
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ top_srcdir = ../@top_srcdir@
|
|||
top_builddir = ../@top_builddir@
|
||||
|
||||
CPP_TEST_CASES = \
|
||||
complextest \
|
||||
csharp_attributes \
|
||||
csharp_swig2_compatibility \
|
||||
csharp_exceptions \
|
||||
|
|
@ -40,6 +41,7 @@ CSHARPFLAGSSPECIAL =
|
|||
|
||||
# Custom tests - tests with additional commandline options
|
||||
intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname
|
||||
complextest.cpptest: CSHARPFLAGSSPECIAL = -r:System.Numerics.dll
|
||||
csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
|
||||
csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP
|
||||
|
||||
|
|
|
|||
34
Examples/test-suite/csharp/complextest_runme.cs
Normal file
34
Examples/test-suite/csharp/complextest_runme.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// This is the complex runtime testcase. It checks that the C++ std::complex type works.
|
||||
// It requires .NET 4.0 as the previous versions didn't have System.Numerics.Complex type.
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
using complextestNamespace;
|
||||
|
||||
public class complextest_runme {
|
||||
|
||||
public static void Main() {
|
||||
var a = new Complex(-1, 2);
|
||||
if ( complextest.Conj(a) != Complex.Conjugate(a) )
|
||||
throw new Exception("std::complex<double> test failed");
|
||||
|
||||
if ( complextest.Conjf(a) != Complex.Conjugate(a) )
|
||||
throw new Exception("std::complex<float> test failed");
|
||||
|
||||
var vec = new VectorStdCplx();
|
||||
vec.Add(new Complex(1, 2));
|
||||
vec.Add(new Complex(2, 3));
|
||||
vec.Add(new Complex(4, 3));
|
||||
vec.Add(new Complex(1, 0));
|
||||
|
||||
if ( complextest.Copy_h(vec).Count != 2 )
|
||||
throw new Exception("vector<complex> test failed");
|
||||
|
||||
var p = new ComplexPair();
|
||||
p.z1 = new Complex(0, 1);
|
||||
p.z2 = new Complex(0, -1);
|
||||
if ( Complex.Conjugate(p.z2) != p.z1 )
|
||||
throw new Exception("vector<complex> test failed");
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,29 @@ public class runme
|
|||
}
|
||||
}
|
||||
|
||||
private class director_smartptr_MyBarFooDerived : FooDerived
|
||||
{
|
||||
public override string ping()
|
||||
{
|
||||
return "director_smartptr_MyBarFooDerived.ping()";
|
||||
}
|
||||
|
||||
public override string pong()
|
||||
{
|
||||
return "director_smartptr_MyBarFooDerived.pong();" + ping();
|
||||
}
|
||||
|
||||
public override string upcall(FooBar fooBarPtr)
|
||||
{
|
||||
return "overrideDerived;" + fooBarPtr.FooBarDo();
|
||||
}
|
||||
|
||||
public override Foo makeFoo()
|
||||
{
|
||||
return new Foo();
|
||||
}
|
||||
}
|
||||
|
||||
private static void check(string got, string expected)
|
||||
{
|
||||
if (got != expected)
|
||||
|
|
@ -49,5 +72,11 @@ public class runme
|
|||
Foo myFoo2 = new Foo().makeFoo();
|
||||
check(myFoo2.pong(), "Foo::pong();Foo::ping()");
|
||||
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
|
||||
|
||||
FooDerived myBarFooDerived = new director_smartptr_MyBarFooDerived();
|
||||
check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()");
|
||||
check(FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()");
|
||||
check(FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class li_std_map_runme {
|
|||
|
||||
public static void Main()
|
||||
{
|
||||
// Set up an int int map
|
||||
// Set up an string to int map
|
||||
StringIntMap simap = new StringIntMap();
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class li_std_vector_runme {
|
|||
throw new Exception("Contains test 4 failed");
|
||||
|
||||
{
|
||||
// ICollection constructor
|
||||
// IEnumerable constructor
|
||||
double[] doubleArray = new double[] { 0.0, 11.1, 22.2, 33.3, 44.4, 55.5, 33.3 };
|
||||
DoubleVector dv = new DoubleVector(doubleArray);
|
||||
if (doubleArray.Length != dv.Count)
|
||||
|
|
@ -619,6 +619,55 @@ public class li_std_vector_runme {
|
|||
}
|
||||
}
|
||||
|
||||
// Test construction
|
||||
{
|
||||
string[] one_two_three = new string[] { "one", "two", "three" };
|
||||
|
||||
// Test construction from array
|
||||
{
|
||||
string[] collection = one_two_three;
|
||||
check123(new StringVector(collection));
|
||||
}
|
||||
|
||||
// Test construction from IEnumerable
|
||||
{
|
||||
global::System.Collections.IEnumerable collection = one_two_three;
|
||||
check123(new StringVector(collection));
|
||||
}
|
||||
|
||||
// Test construction from IEnumerable<>
|
||||
{
|
||||
global::System.Collections.Generic.IEnumerable<string> collection = one_two_three;
|
||||
check123(new StringVector(collection));
|
||||
}
|
||||
|
||||
// Test construction from IList<>
|
||||
{
|
||||
global::System.Collections.Generic.IList<string> collection = one_two_three;
|
||||
check123(new StringVector(collection));
|
||||
}
|
||||
|
||||
// Test construction from ICollection
|
||||
{
|
||||
global::System.Collections.ICollection collection = one_two_three;
|
||||
check123(new StringVector(collection));
|
||||
}
|
||||
|
||||
// Test construction from ICollection<>
|
||||
{
|
||||
global::System.Collections.Generic.ICollection<string> collection = new global::System.Collections.Generic.List<string>(one_two_three);
|
||||
check123(new StringVector(collection));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void check123(StringVector stringv) {
|
||||
string concatenated = "";
|
||||
foreach (string s in stringv)
|
||||
concatenated = concatenated + s;
|
||||
if (concatenated != "onetwothree")
|
||||
throw new Exception("concatenated string failed: " + concatenated);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class runme {
|
|||
assert( typeof(string) == preproc_constants_c.CONST_STRING2.GetType() );
|
||||
|
||||
assert( typeof(int) == preproc_constants_c.INT_AND_BOOL.GetType() );
|
||||
// assert( typeof(int) == preproc_constants_c.INT_AND_CHAR.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.INT_AND_CHAR.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.INT_AND_INT.GetType() );
|
||||
assert( typeof(uint) == preproc_constants_c.INT_AND_UINT.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.INT_AND_LONG.GetType() );
|
||||
|
|
@ -61,7 +61,9 @@ public class runme {
|
|||
assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() );
|
||||
assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() );
|
||||
|
||||
assert( typeof(double) == preproc_constants_c.EXPR_MIXED1.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MAX.GetType() );
|
||||
assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MIN.GetType() );
|
||||
}
|
||||
static void assert(bool assertion) {
|
||||
if (!assertion)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class runme {
|
|||
assert( typeof(string) == preproc_constants.CONST_STRING2.GetType() );
|
||||
|
||||
assert( typeof(int) == preproc_constants.INT_AND_BOOL.GetType() );
|
||||
// assert( typeof(int) == preproc_constants.INT_AND_CHAR.GetType() );
|
||||
assert( typeof(int) == preproc_constants.INT_AND_CHAR.GetType() );
|
||||
assert( typeof(int) == preproc_constants.INT_AND_INT.GetType() );
|
||||
assert( typeof(uint) == preproc_constants.INT_AND_UINT.GetType() );
|
||||
assert( typeof(int) == preproc_constants.INT_AND_LONG.GetType() );
|
||||
|
|
@ -60,6 +60,9 @@ public class runme {
|
|||
assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() );
|
||||
assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() );
|
||||
assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() );
|
||||
assert( typeof(double) == preproc_constants.EXPR_MIXED1.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_WCHAR_MAX.GetType() );
|
||||
assert( typeof(int) == preproc_constants.EXPR_WCHAR_MIN.GetType() );
|
||||
|
||||
}
|
||||
static void assert(bool assertion) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
|
||||
// %exception tests
|
||||
void ThrowByValue() { throw Ex("ThrowByValue"); }
|
||||
|
|
@ -239,3 +243,12 @@ struct ThrowsClass {
|
|||
%inline %{
|
||||
void InnerExceptionTest() { throw Ex("My InnerException message"); }
|
||||
%}
|
||||
|
||||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void main() {
|
|||
static assert(is(char[] == typeof(CONST_STRING2())));
|
||||
|
||||
static assert(is(int == typeof(INT_AND_BOOL())));
|
||||
// static assert(is(int == typeof(INT_AND_CHAR())));
|
||||
static assert(is(int == typeof(INT_AND_CHAR())));
|
||||
static assert(is(int == typeof(INT_AND_INT())));
|
||||
static assert(is(uint == typeof(INT_AND_UINT())));
|
||||
static assert(is(c_long == typeof(INT_AND_LONG())));
|
||||
|
|
@ -61,4 +61,7 @@ void main() {
|
|||
static assert(is(int == typeof(EXPR_LAND())));
|
||||
static assert(is(int == typeof(EXPR_LOR())));
|
||||
static assert(is(double == typeof(EXPR_CONDITIONAL())));
|
||||
static assert(is(double == typeof(EXPR_MIXED1())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MAX())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MIN())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void main() {
|
|||
static assert(is(string == typeof(CONST_STRING2())));
|
||||
|
||||
static assert(is(int == typeof(INT_AND_BOOL())));
|
||||
// static assert(is(int == typeof(INT_AND_CHAR())));
|
||||
static assert(is(int == typeof(INT_AND_CHAR())));
|
||||
static assert(is(int == typeof(INT_AND_INT())));
|
||||
static assert(is(uint == typeof(INT_AND_UINT())));
|
||||
static assert(is(c_long == typeof(INT_AND_LONG())));
|
||||
|
|
@ -61,4 +61,7 @@ void main() {
|
|||
static assert(is(int == typeof(EXPR_LAND())));
|
||||
static assert(is(int == typeof(EXPR_LOR())));
|
||||
static assert(is(double == typeof(EXPR_CONDITIONAL())));
|
||||
static assert(is(double == typeof(EXPR_MIXED1())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MAX())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MIN())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ void main() {
|
|||
static assert(is(char[] == typeof(CONST_STRING2())));
|
||||
|
||||
static assert(is(int == typeof(INT_AND_BOOL())));
|
||||
// static assert(is(int == typeof(INT_AND_CHAR())));
|
||||
static assert(is(int == typeof(INT_AND_CHAR())));
|
||||
static assert(is(int == typeof(INT_AND_INT())));
|
||||
static assert(is(uint == typeof(INT_AND_UINT())));
|
||||
static assert(is(c_long == typeof(INT_AND_LONG())));
|
||||
|
|
@ -60,4 +60,7 @@ void main() {
|
|||
static assert(is(bool == typeof(EXPR_LAND())));
|
||||
static assert(is(bool == typeof(EXPR_LOR())));
|
||||
static assert(is(double == typeof(EXPR_CONDITIONAL())));
|
||||
static assert(is(double == typeof(EXPR_MIXED1())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MAX())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MIN())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ void main() {
|
|||
static assert(is(string == typeof(CONST_STRING2())));
|
||||
|
||||
static assert(is(int == typeof(INT_AND_BOOL())));
|
||||
// static assert(is(int == typeof(INT_AND_CHAR())));
|
||||
static assert(is(int == typeof(INT_AND_CHAR())));
|
||||
static assert(is(int == typeof(INT_AND_INT())));
|
||||
static assert(is(uint == typeof(INT_AND_UINT())));
|
||||
static assert(is(c_long == typeof(INT_AND_LONG())));
|
||||
|
|
@ -60,4 +60,7 @@ void main() {
|
|||
static assert(is(bool == typeof(EXPR_LAND())));
|
||||
static assert(is(bool == typeof(EXPR_LOR())));
|
||||
static assert(is(double == typeof(EXPR_CONDITIONAL())));
|
||||
static assert(is(double == typeof(EXPR_MIXED1())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MAX())));
|
||||
static assert(is(int == typeof(EXPR_WCHAR_MIN())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@
|
|||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#pragma warning(disable: 4146) // unary minus operator applied to unsigned type, result still unsigned
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
|
@ -14,14 +19,20 @@
|
|||
#include <string>
|
||||
|
||||
// All kinds of numbers: hex, octal (which pose special problems to Python), negative...
|
||||
void trickyvalue1(int first, int pos = -1) {}
|
||||
void trickyvalue2(int first, unsigned rgb = 0xabcdef) {}
|
||||
void trickyvalue3(int first, int mode = 0644) {}
|
||||
|
||||
class TrickyInPython {
|
||||
public:
|
||||
int value_m1(int first, int pos = -1) { return pos; }
|
||||
unsigned value_0xabcdef(int first, unsigned rgb = 0xabcdef) { return rgb; }
|
||||
int value_0644(int first, int mode = 0644) { return mode; }
|
||||
int value_perm(int first, int mode = 0640 | 0004) { return mode; }
|
||||
int value_m01(int first, int val = -01) { return val; }
|
||||
bool booltest2(bool x = 0 | 1) { return x; }
|
||||
};
|
||||
|
||||
void doublevalue1(int first, double num = 0.0e-1) {}
|
||||
void doublevalue2(int first, double num = -0.0E2) {}
|
||||
|
||||
// Long long arguments are not handled at Python level currently but still work.
|
||||
void seek(long long offset = 0LL) {}
|
||||
void seek2(unsigned long long offset = 0ULL) {}
|
||||
void seek3(long offset = 0L) {}
|
||||
|
|
@ -152,6 +163,9 @@
|
|||
int double_if_handle_is_null(int n, MyHandle h = 0) { return h ? n : 2*n; }
|
||||
int double_if_dbl_ptr_is_null(int n, double* null_by_default)
|
||||
{ return null_by_default ? n : 2*n; }
|
||||
|
||||
void defaulted1(unsigned offset = -1U) {} // minus unsigned!
|
||||
void defaulted2(int offset = -1U) {} // minus unsigned!
|
||||
};
|
||||
int Foo::bar = 1;
|
||||
int Foo::spam = 2;
|
||||
|
|
@ -305,3 +319,11 @@ struct CDA {
|
|||
};
|
||||
%}
|
||||
|
||||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -31,9 +35,9 @@ class DirectorMethodException: public Swig::DirectorException {};
|
|||
#ifdef SWIGPHP
|
||||
|
||||
%feature("director:except") {
|
||||
if ($error == FAILURE) {
|
||||
throw Swig::DirectorMethodException();
|
||||
}
|
||||
if ($error == FAILURE) {
|
||||
Swig::DirectorMethodException::raise("$symname");
|
||||
}
|
||||
}
|
||||
|
||||
%exception {
|
||||
|
|
@ -46,9 +50,9 @@ class DirectorMethodException: public Swig::DirectorException {};
|
|||
#ifdef SWIGPYTHON
|
||||
|
||||
%feature("director:except") {
|
||||
if ($error != NULL) {
|
||||
throw Swig::DirectorMethodException();
|
||||
}
|
||||
if ($error != NULL) {
|
||||
Swig::DirectorMethodException::raise("$symname");
|
||||
}
|
||||
}
|
||||
|
||||
%exception {
|
||||
|
|
@ -84,7 +88,7 @@ class DirectorMethodException: public Swig::DirectorException {};
|
|||
#ifdef SWIGRUBY
|
||||
|
||||
%feature("director:except") {
|
||||
throw Swig::DirectorMethodException($error);
|
||||
Swig::DirectorMethodException::raise($error);
|
||||
}
|
||||
|
||||
%exception {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Swig {
|
|||
size_t ExceptionMethod()
|
||||
{
|
||||
// Check positioning of director code in wrapper file
|
||||
// Below is what we really want to test, but director exceptions vary too much across across all languages
|
||||
// Below is what we really want to test, but director exceptions vary too much across all languages
|
||||
// throw Swig::DirectorException("DirectorException was not in scope!!");
|
||||
// Instead check definition of Director class as that is defined in the same place as DirectorException (director.swg)
|
||||
size_t size = sizeof(Swig::Director);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ public:
|
|||
%include <boost_shared_ptr.i>
|
||||
|
||||
%shared_ptr(Foo)
|
||||
|
||||
%feature("director") Foo;
|
||||
|
||||
class FooBar {
|
||||
|
|
@ -72,5 +71,12 @@ public:
|
|||
static Foo* get_self(Foo *self_);
|
||||
};
|
||||
|
||||
%shared_ptr(FooDerived)
|
||||
%feature("director") FooDerived;
|
||||
|
||||
%inline %{
|
||||
struct FooDerived : Foo {
|
||||
};
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -11,25 +11,36 @@
|
|||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
#include "swig_examples_lock.h"
|
||||
|
||||
class Foo;
|
||||
extern "C" {
|
||||
#ifdef _WIN32
|
||||
unsigned int __stdcall working(void* t);
|
||||
unsigned int thread_id(0);
|
||||
static unsigned int __stdcall working(void* t);
|
||||
static HANDLE thread_handle = 0;
|
||||
#else
|
||||
void* working(void* t);
|
||||
pthread_t thread;
|
||||
static pthread_t thread;
|
||||
#endif
|
||||
|
||||
static int thread_terminate = 0;
|
||||
|
||||
static SwigExamples::CriticalSection critical_section;
|
||||
int get_thread_terminate() {
|
||||
SwigExamples::Lock lock(critical_section);
|
||||
return thread_terminate;
|
||||
}
|
||||
void set_thread_terminate(int value) {
|
||||
SwigExamples::Lock lock(critical_section);
|
||||
thread_terminate = value;
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -55,9 +66,10 @@ extern "C" {
|
|||
}
|
||||
|
||||
void stop() {
|
||||
thread_terminate = 1;
|
||||
set_thread_terminate(1);
|
||||
%#ifdef _WIN32
|
||||
/*TODO(bhy) what to do for win32? */
|
||||
WaitForSingleObject(thread_handle, INFINITE);
|
||||
CloseHandle(thread_handle);
|
||||
%#else
|
||||
pthread_join(thread, NULL);
|
||||
%#endif
|
||||
|
|
@ -65,9 +77,18 @@ extern "C" {
|
|||
|
||||
void run() {
|
||||
%#ifdef _WIN32
|
||||
_beginthreadex(NULL,0,working,this,0,&thread_id);
|
||||
unsigned int thread_id = 0;
|
||||
thread_handle = (HANDLE)_beginthreadex(NULL,0,working,this,0,&thread_id);
|
||||
if (thread_handle == 0) {
|
||||
fprintf(stderr, "_beginthreadex failed in run()\n");
|
||||
assert(0);
|
||||
}
|
||||
%#else
|
||||
pthread_create(&thread,NULL,working,this);
|
||||
int create = pthread_create(&thread,NULL,working,this);
|
||||
if (create != 0) {
|
||||
fprintf(stderr, "pthread_create failed in run()\n");
|
||||
assert(0);
|
||||
}
|
||||
%#endif
|
||||
MilliSecondSleep(500);
|
||||
}
|
||||
|
|
@ -87,15 +108,10 @@ extern "C" {
|
|||
#endif
|
||||
{
|
||||
Foo* f = static_cast<Foo*>(t);
|
||||
while ( ! thread_terminate ) {
|
||||
while (!get_thread_terminate()) {
|
||||
MilliSecondSleep(50);
|
||||
f->do_foo();
|
||||
}
|
||||
#ifdef _WIN32
|
||||
/* TODO(bhy) what's the corresponding of pthread_exit in win32? */
|
||||
#else
|
||||
pthread_exit(0);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
6
Examples/test-suite/errors/cpp_bad_global_memberptr.i
Normal file
6
Examples/test-suite/errors/cpp_bad_global_memberptr.i
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
%module xxx
|
||||
|
||||
struct Funcs {};
|
||||
|
||||
short (Funcs::* *)(bool) = 0;
|
||||
short (Funcs::* const*)(bool) = 0;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
cpp_bad_global_memberptr.i:5: Error: Missing symbol name for global declaration
|
||||
cpp_bad_global_memberptr.i:6: Error: Missing symbol name for global declaration
|
||||
26
Examples/test-suite/errors/cpp_class_definition.i
Normal file
26
Examples/test-suite/errors/cpp_class_definition.i
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
%module xxx
|
||||
|
||||
// This should error but doesn't
|
||||
#if 0
|
||||
namespace OtherSpace {
|
||||
struct L;
|
||||
}
|
||||
namespace Space11 {
|
||||
namespace SubSpace11 {
|
||||
using OtherSpace::L;
|
||||
struct L {
|
||||
void ll();
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace Space1 {
|
||||
struct A;
|
||||
}
|
||||
namespace Space2 {
|
||||
struct Space1::A {
|
||||
void x();
|
||||
};
|
||||
}
|
||||
|
||||
1
Examples/test-suite/errors/cpp_class_definition.stderr
Normal file
1
Examples/test-suite/errors/cpp_class_definition.stderr
Normal file
|
|
@ -0,0 +1 @@
|
|||
cpp_class_definition.i:22: Error: 'Space1::A' resolves to 'Space1::A' and was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
|
||||
43
Examples/test-suite/errors/cpp_invalid_qualifiers.i
Normal file
43
Examples/test-suite/errors/cpp_invalid_qualifiers.i
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
%module cpp_invalid_qualifiers
|
||||
|
||||
// Constructors, destructors and static methods cannot have qualifiers
|
||||
struct A {
|
||||
~A() const;
|
||||
};
|
||||
struct B {
|
||||
virtual ~B() const;
|
||||
};
|
||||
struct C {
|
||||
~C() &;
|
||||
};
|
||||
struct D {
|
||||
virtual ~D() &;
|
||||
};
|
||||
struct E {
|
||||
~E() &&;
|
||||
};
|
||||
struct F {
|
||||
virtual ~F() &&;
|
||||
};
|
||||
|
||||
struct J {
|
||||
J() const;
|
||||
J(int) const;
|
||||
};
|
||||
struct K {
|
||||
K() &;
|
||||
K(int) &;
|
||||
};
|
||||
struct L {
|
||||
L() &&;
|
||||
L(int) &&;
|
||||
};
|
||||
|
||||
struct M {
|
||||
static void m1() const;
|
||||
static void m2() &;
|
||||
thread_local static void m3() &&;
|
||||
static auto m4() const -> int;
|
||||
static auto m5() & -> int;
|
||||
static auto m6() && -> int;
|
||||
};
|
||||
20
Examples/test-suite/errors/cpp_invalid_qualifiers.stderr
Normal file
20
Examples/test-suite/errors/cpp_invalid_qualifiers.stderr
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
cpp_invalid_qualifiers.i:5: Error: Destructor ~A() const cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:8: Error: Destructor ~B() const cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:11: Error: Destructor ~C() & cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:14: Error: Destructor ~D() & cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:17: Error: Destructor ~E() && cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:20: Error: Destructor ~F() && cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:24: Error: Constructor cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:25: Error: Constructor cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:28: Error: Constructor cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:29: Error: Constructor cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:32: Error: Constructor cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:33: Error: Constructor cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:37: Error: Static function m1() const cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:38: Error: Static function m2() & cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:39: Error: Static function m3() && cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:39: Warning 405: Method with rvalue ref-qualifier m3() && ignored.
|
||||
cpp_invalid_qualifiers.i:40: Error: Static function m4() const cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:41: Error: Static function m5() & cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:42: Error: Static function m6() && cannot have a qualifier.
|
||||
cpp_invalid_qualifiers.i:42: Warning 405: Method with rvalue ref-qualifier m6() && ignored.
|
||||
9
Examples/test-suite/errors/cpp_invalid_template.i
Normal file
9
Examples/test-suite/errors/cpp_invalid_template.i
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
%module cpp_invalid_scope
|
||||
|
||||
%template(abc) SSS::AAA<int>;
|
||||
|
||||
namespace UUU {
|
||||
struct JJJ;
|
||||
}
|
||||
|
||||
%template(xxx) UUU::JJJ<int>;
|
||||
3
Examples/test-suite/errors/cpp_invalid_template.stderr
Normal file
3
Examples/test-suite/errors/cpp_invalid_template.stderr
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
cpp_invalid_template.i:3: Error: Undefined scope 'SSS'
|
||||
cpp_invalid_template.i:3: Error: Template 'SSS::AAA' undefined.
|
||||
cpp_invalid_template.i:9: Error: 'JJJ' is not defined as a template. (classforward)
|
||||
40
Examples/test-suite/errors/cpp_namespace_template_bad.i
Normal file
40
Examples/test-suite/errors/cpp_namespace_template_bad.i
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
%module namespace_template
|
||||
|
||||
namespace test {
|
||||
template<typename T> T max(T a, T b) { return (a > b) ? a : b; }
|
||||
template<typename T> class vector {
|
||||
public:
|
||||
vector() { }
|
||||
~vector() { }
|
||||
};
|
||||
}
|
||||
|
||||
namespace test2 {
|
||||
using namespace test;
|
||||
%template(maxshort) max<short>;
|
||||
%template(vectorshort) vector<short>;
|
||||
}
|
||||
|
||||
namespace test3 {
|
||||
using test::max;
|
||||
using test::vector;
|
||||
%template(maxlong) max<long>;
|
||||
%template(vectorlong) vector<long>;
|
||||
}
|
||||
|
||||
namespace test4 {
|
||||
using namespace test;
|
||||
typedef int Integer;
|
||||
}
|
||||
|
||||
namespace test4 {
|
||||
%template(maxInteger) max<Integer>;
|
||||
%template(vectorInteger) vector<Integer>;
|
||||
}
|
||||
|
||||
using namespace test;
|
||||
namespace test5 {
|
||||
%template(maxdouble) max<double>;
|
||||
%template(vectordouble) vector<double>;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
cpp_namespace_template_bad.i:14: Error: 'max' resolves to 'test::max' and was incorrectly instantiated in scope 'test2' instead of within scope 'test'.
|
||||
cpp_namespace_template_bad.i:15: Error: 'vector' resolves to 'test::vector' and was incorrectly instantiated in scope 'test2' instead of within scope 'test'.
|
||||
cpp_namespace_template_bad.i:21: Error: 'max' resolves to 'test::max' and was incorrectly instantiated in scope 'test3' instead of within scope 'test'.
|
||||
cpp_namespace_template_bad.i:22: Error: 'vector' resolves to 'test::vector' and was incorrectly instantiated in scope 'test3' instead of within scope 'test'.
|
||||
cpp_namespace_template_bad.i:31: Error: 'max' resolves to 'test::max' and was incorrectly instantiated in scope 'test4' instead of within scope 'test'.
|
||||
cpp_namespace_template_bad.i:32: Error: 'vector' resolves to 'test::vector' and was incorrectly instantiated in scope 'test4' instead of within scope 'test'.
|
||||
cpp_namespace_template_bad.i:37: Error: 'max' resolves to 'test::max' and was incorrectly instantiated in scope 'test5' instead of within scope 'test'.
|
||||
cpp_namespace_template_bad.i:37: Error: Template 'max' undefined.
|
||||
cpp_namespace_template_bad.i:38: Error: 'vector' resolves to 'test::vector' and was incorrectly instantiated in scope 'test5' instead of within scope 'test'.
|
||||
|
|
@ -1,2 +1,4 @@
|
|||
cpp_nested_template.i:9: Error: 'Temply' resolves to '::Temply' and was incorrectly instantiated in scope 'A' instead of within scope ''.
|
||||
cpp_nested_template.i:9: Warning 324: Named nested template instantiations not supported. Processing as if no name was given to %template().
|
||||
cpp_nested_template.i:18: Error: 'Temply' resolves to '::Temply' and was incorrectly instantiated in scope 'B' instead of within scope ''.
|
||||
cpp_nested_template.i:18: Warning 324: Named nested template instantiations not supported. Processing as if no name was given to %template().
|
||||
|
|
|
|||
4
Examples/test-suite/errors/cpp_raw_string_termination.i
Normal file
4
Examples/test-suite/errors/cpp_raw_string_termination.i
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
%module xxx
|
||||
|
||||
%feature("docstring") func2 R"ABC(Calculate :math:`D^\nu \rho(x)`.)AB";
|
||||
void func2(double* foo, int bar, char** baz);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
cpp_raw_string_termination.i:3: Error: Unterminated raw string, started with R"ABC( is not terminated by )ABC"
|
||||
cpp_raw_string_termination.i:3: Error: Syntax error in input(1).
|
||||
28
Examples/test-suite/errors/cpp_refqualifier.i
Normal file
28
Examples/test-suite/errors/cpp_refqualifier.i
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
%module cpp_refqualifier
|
||||
|
||||
%ignore Host::h_ignored;
|
||||
%ignore Host::i_ignored() &&;
|
||||
%ignore Host::j_ignored() const &&;
|
||||
|
||||
class Host {
|
||||
public:
|
||||
void h1() &;
|
||||
void h2() const &;
|
||||
void h3() &&;
|
||||
void h4() const &&;
|
||||
|
||||
void h() &;
|
||||
void h() const &;
|
||||
void h() &&;
|
||||
void h() const &&;
|
||||
|
||||
void h_ignored() &&;
|
||||
void i_ignored() &&;
|
||||
void i_ignored() &&;
|
||||
};
|
||||
|
||||
%feature("ignore", "0") Unignore::k_unignored() const &&;
|
||||
|
||||
struct Unignore {
|
||||
void k_unignored() const &&;
|
||||
};
|
||||
6
Examples/test-suite/errors/cpp_refqualifier.stderr
Normal file
6
Examples/test-suite/errors/cpp_refqualifier.stderr
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
cpp_refqualifier.i:11: Warning 405: Method with rvalue ref-qualifier h3() && ignored.
|
||||
cpp_refqualifier.i:12: Warning 405: Method with rvalue ref-qualifier h4() const && ignored.
|
||||
cpp_refqualifier.i:16: Warning 405: Method with rvalue ref-qualifier h() && ignored.
|
||||
cpp_refqualifier.i:17: Warning 405: Method with rvalue ref-qualifier h() const && ignored.
|
||||
cpp_refqualifier.i:15: Warning 512: Overloaded method Host::h() const & ignored,
|
||||
cpp_refqualifier.i:14: Warning 512: using non-const method Host::h() & instead.
|
||||
57
Examples/test-suite/errors/cpp_template_scope.i
Normal file
57
Examples/test-suite/errors/cpp_template_scope.i
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
%module xxx
|
||||
|
||||
namespace std {
|
||||
template<typename T> class vector {};
|
||||
}
|
||||
|
||||
struct S1 {};
|
||||
struct S2 {};
|
||||
struct S3 {};
|
||||
struct S4 {};
|
||||
struct S5 {};
|
||||
struct S6 {};
|
||||
struct S7 {};
|
||||
|
||||
// valid
|
||||
namespace std {
|
||||
%template(vi1) vector<S1>;
|
||||
template class vector<S1>;
|
||||
}
|
||||
|
||||
// valid
|
||||
using namespace std;
|
||||
%template(vi2) vector<S2>;
|
||||
template class vector<S2>;
|
||||
|
||||
// valid
|
||||
using std::vector;
|
||||
%template(vi3) vector<S3>;
|
||||
template class vector<S3>;
|
||||
|
||||
// ill-formed
|
||||
namespace unrelated {
|
||||
using std::vector;
|
||||
%template(vi4) vector<S4>;
|
||||
template class vector<S4>;
|
||||
}
|
||||
|
||||
// ill-formed
|
||||
namespace unrelated {
|
||||
using namespace std;
|
||||
%template(vi5) vector<S5>;
|
||||
template class vector<S5>;
|
||||
}
|
||||
|
||||
// ill-formed
|
||||
namespace unrelated {
|
||||
namespace std {
|
||||
%template(vi6) vector<S6>;
|
||||
template class vector<S6>;
|
||||
}
|
||||
}
|
||||
|
||||
// ill-formed
|
||||
namespace unrelated {
|
||||
%template(vi7) std::vector<S7>;
|
||||
template class std::vector<S7>;
|
||||
}
|
||||
11
Examples/test-suite/errors/cpp_template_scope.stderr
Normal file
11
Examples/test-suite/errors/cpp_template_scope.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
cpp_template_scope.i:18: Warning 320: Explicit template instantiation ignored.
|
||||
cpp_template_scope.i:24: Warning 320: Explicit template instantiation ignored.
|
||||
cpp_template_scope.i:29: Warning 320: Explicit template instantiation ignored.
|
||||
cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
|
||||
cpp_template_scope.i:35: Warning 320: Explicit template instantiation ignored.
|
||||
cpp_template_scope.i:41: Error: 'vector' resolves to 'std::vector' and was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
|
||||
cpp_template_scope.i:42: Warning 320: Explicit template instantiation ignored.
|
||||
cpp_template_scope.i:48: Error: 'vector' resolves to 'std::vector' and was incorrectly instantiated in scope 'unrelated::std' instead of within scope 'std'.
|
||||
cpp_template_scope.i:49: Warning 320: Explicit template instantiation ignored.
|
||||
cpp_template_scope.i:55: Error: 'std::vector' resolves to 'std::vector' and was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
|
||||
cpp_template_scope.i:56: Warning 320: Explicit template instantiation ignored.
|
||||
|
|
@ -16,6 +16,10 @@
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
%}
|
||||
|
||||
/*
|
||||
|
|
@ -146,3 +150,12 @@ bool is_python_builtin() { return false; }
|
|||
|
||||
%template(ET_i) ET<int>;
|
||||
%template(ET_d) ET<double>;
|
||||
|
||||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
|
|
@ -16,3 +20,11 @@ extern int get() throw(std::exception);
|
|||
int get() throw(std::exception) { return 0; }
|
||||
%}
|
||||
|
||||
%{
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ int & addByReference(const int &a, int b) { static int val; val = a+b; return va
|
|||
int call1(int (*d)(const int &, int), int a, int b) { return d(a, b); }
|
||||
int call2(int * (*d)(const int &, int), int a, int b) { return *d(a, b); }
|
||||
int call3(int & (*d)(const int &, int), int a, int b) { return d(a, b); }
|
||||
int call4(int & (*d)(int &, int *), int a, int b) { return d(a, &b); }
|
||||
int call5(int & (*d)(int &, int const * const), int a, int b) { return d(a, &b); }
|
||||
%}
|
||||
|
||||
%constant int (*ADD_BY_VALUE)(const int &, int) = addByValue;
|
||||
|
|
|
|||
|
|
@ -182,12 +182,3 @@ clean:
|
|||
rm -f import_stl_a.go import_stl_a.gox
|
||||
rm -f import_stl_b.go import_stl_b.gox
|
||||
rm -rf gopath
|
||||
|
||||
cvsignore:
|
||||
@echo '*_gc.c *_wrap.* *.so *.dll *.exp *.lib'
|
||||
@echo Makefile
|
||||
@echo mod_a.go mod_b.go imports_a.go imports_b.go
|
||||
@echo clientdata_prop_a.go clientdata_prop_b.go
|
||||
@echo multi_import_a.go multi_import_b.go
|
||||
@echo packageoption_a.go packageoption_b.go packageoption_c.go
|
||||
@for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.go; done
|
||||
|
|
|
|||
29
Examples/test-suite/go/typedef_funcptr_runme.go
Normal file
29
Examples/test-suite/go/typedef_funcptr_runme.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package main
|
||||
|
||||
import . "./typedef_funcptr"
|
||||
|
||||
func main() {
|
||||
a := 100
|
||||
b := 10
|
||||
|
||||
if Do_op(a,b,Addf) != 110 {
|
||||
panic(0)
|
||||
}
|
||||
if Do_op(a,b,Subf) != 90 {
|
||||
panic(0)
|
||||
}
|
||||
|
||||
if Do_op_typedef_int(a,b,Addf) != 110 {
|
||||
panic(0)
|
||||
}
|
||||
if Do_op_typedef_int(a,b,Subf) != 90 {
|
||||
panic(0)
|
||||
}
|
||||
|
||||
if Do_op_typedef_Integer(a,b,Addf) != 110 {
|
||||
panic(0)
|
||||
}
|
||||
if Do_op_typedef_Integer(a,b,Subf) != 90 {
|
||||
panic(0)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,18 @@
|
|||
%module ignore_template_constructor
|
||||
%include std_vector.i
|
||||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGPERL) || defined(SWIGRUBY)
|
||||
#if defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGPERL) || defined(SWIGRUBY)
|
||||
#define SWIG_GOOD_VECTOR
|
||||
%ignore std::vector<Flow>::vector(size_type);
|
||||
%ignore std::vector<Flow>::resize(size_type);
|
||||
#endif
|
||||
|
||||
#if defined(SWIGJAVA)
|
||||
#define SWIG_GOOD_VECTOR
|
||||
%ignore std::vector<Flow>::vector(jint);
|
||||
%ignore std::vector<Flow>::resize(jint);
|
||||
#endif
|
||||
|
||||
#if defined(SWIGTCL) || defined(SWIGPERL)
|
||||
#define SWIG_GOOD_VECTOR
|
||||
/* here, for languages with bad declaration */
|
||||
|
|
|
|||
18
Examples/test-suite/import_fragments.i
Normal file
18
Examples/test-suite/import_fragments.i
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
%module import_fragments
|
||||
|
||||
// Check %fragments forced inclusion does not result in code generation when using %import
|
||||
%import "import_fragments_a.i"
|
||||
|
||||
%{
|
||||
template<typename T>
|
||||
struct TemplateA4 {};
|
||||
%}
|
||||
|
||||
%template(TemplateA4Int) TemplateA4<int>;
|
||||
|
||||
%inline %{
|
||||
int getImport4() {
|
||||
// Requires the ImportA4 fragment to be generated in order to compile
|
||||
return ImportA4;
|
||||
}
|
||||
%}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue