merge frome trunk

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11524 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2009-08-10 01:40:09 +00:00
commit b0e85706b6
60 changed files with 510 additions and 734 deletions

View file

@ -318,7 +318,7 @@ python_clean:
rm -f *_wrap* *~ .~* mypython@EXEEXT@ *.pyc
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@ *@PYTHON_SO@
if [ -f runme.py ]; then (rm -f runme3.py runme3.py.bak;) fi;
if [ -f runme.py ]; then rm -f runme3.py runme3.py.bak; fi
##################################################################

View file

@ -1,16 +0,0 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.i
TARGET = example
INTERFACE = example.i
all::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
scilab -nwni < runme.sci
clean::
$(MAKE) -f $(TOP)/Makefile scilab_clean
rm -f *.sce *.so lib*lib.c *_wrap.c
check: all

View file

@ -1,16 +0,0 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
all::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
scilab -nwni < runme.sci
clean::
$(MAKE) -f $(TOP)/Makefile scilab_clean
rm -f *.sce *.so lib*lib.c *_wrap.c
check: all

View file

@ -1,16 +0,0 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
all::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
scilab -nwni < runme.sci
clean::
$(MAKE) -f $(TOP)/Makefile scilab_clean
rm -f *.sce *.so lib*lib.c *_wrap.c
check: all

View file

@ -1,16 +0,0 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
all::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
scilab -nwni < runme.sci
clean::
$(MAKE) -f $(TOP)/Makefile scilab_clean
rm -f *.sce *.so lib*lib.c *_wrap.c
check: all

View file

@ -1,16 +0,0 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
all::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
scilab -nwni < runme.sci
clean::
$(MAKE) -f $(TOP)/Makefile scilab_clean
rm -f *.sce *.so lib*lib.c *_wrap.c
check: all

View file

@ -1,16 +0,0 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = example
INTERFACE = example.i
all::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
scilab -nwni < runme.sci
clean::
$(MAKE) -f $(TOP)/Makefile scilab_clean
rm -f *.sce *.so lib*lib.c *_wrap.c
check: all

View file

@ -114,9 +114,9 @@ include $(srcdir)/../common.mk
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
%.clean:
@rm -f $*.cl

View file

@ -38,9 +38,9 @@ CPP_TEST_CASES =
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFIBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFIBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra cffi code)
%.clean:

View file

@ -43,25 +43,25 @@ SWIGOPT += -nounit
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
$(MAKE) $*.cppproxy; ) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.cppproxy; \
fi
%.ctest:
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
$(MAKE) $*.cproxy; ) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.cproxy; \
fi
%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \
$(MAKE) $*.multiproxy; ) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.multiproxy; \
fi
%.externaltest:
$(setup)
@ -86,9 +86,9 @@ SWIGOPT += -nounit
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:

View file

@ -38,9 +38,9 @@ CPP_TEST_CASES =
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISPBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISPBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra clisp code)
%.clean:

View file

@ -405,6 +405,7 @@ CPP_TEST_CASES += \
CPP_STD_TEST_CASES += \
director_string \
ignore_template_constructor \
li_std_combinations \
li_std_deque \
li_std_except \
li_std_pair \

View file

@ -121,7 +121,8 @@ int* const globalRet2() {return &GlobalInt;}
%{
static int wxEVT_COMMAND_BUTTON_CLICKEDv;
static int **wxEVT_COMMAND_BUTTON_CLICKEDp;
static int *wxEVT_COMMAND_BUTTON_CLICKEDp;
static int **wxEVT_COMMAND_BUTTON_CLICKEDpp = &wxEVT_COMMAND_BUTTON_CLICKEDp;
#if defined(SWIGR)
#undef lang1 /* conflicts with symbol in R internals */
#endif
@ -137,7 +138,7 @@ char *langs[] ={ lang1 };
#define EWXWEXPORT_VAR
const int* wxEVENT_COMMAND_BUTTON_CLICKEDr = (int*) &wxEVT_COMMAND_BUTTON_CLICKEDv;
const int* wxEVENT_COMMAND_BUTTON_CLICKEDp = (int*) *wxEVT_COMMAND_BUTTON_CLICKEDp;
const int* wxEVENT_COMMAND_BUTTON_CLICKEDp = (int*) *wxEVT_COMMAND_BUTTON_CLICKEDpp;
char **languages1 = &langs[0];
char **languages2 = (char **)&langs[0];
}

View file

@ -73,10 +73,6 @@ public:
%include "std_vector.i"
#if defined(SWIGCSHARP)
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(Flow, Space::Flow)
#endif
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#define SWIG_GOOD_VECTOR
%ignore std::vector<Space::Flow>::vector(size_type);

View file

@ -59,31 +59,31 @@ setup = \
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
fi; \
if [ ! -d $* ]; then \
mkdir $*; \
fi;
mkdir $*; \
fi
# Compiles C# files then runs the testcase. A testcase is only run if
# a file is found which has _runme.cs appended after the testcase name.
# Note C# uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` \
$*$(CSHARPPATHSEPARATOR)*.cs' csharp_compile && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; ) \
else ( \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; \
else \
cd $* && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
CSHARPSRCS='*.cs' csharp_compile; ); \
fi;
CSHARPSRCS='*.cs' csharp_compile && cd .. ; \
fi
# Clean: remove testcase directories
%.clean:
@if [ -d $* ]; then \
rm -rf $*; \
fi;
rm -rf $*; \
fi
clean:
@rm -f *.exe *.exe.mdb

View file

@ -169,7 +169,7 @@ public class li_std_map_runme {
if (keyStringified != " 1 2 3 4 5")
throw new Exception("Wrapped method stringifyKeys test failed. Got " + keyStringified);
// Test a map with a new specialized type (Struct)
// Test a map with a new complex type (Struct)
{
IntStructMap ismap = new IntStructMap();
for (int i = 0; i < 10; i++)
@ -178,12 +178,12 @@ public class li_std_map_runme {
}
if (ismap.Count != 10)
throw new Exception("Count test on specialized map failed");
throw new Exception("Count test on complex type map failed");
foreach (KeyValuePair<int, Struct> p in ismap)
{
if ((p.Key * 10.1) != p.Value.num)
throw new Exception("Iteration test on specialized map failed for index " + p.Key);
throw new Exception("Iteration test on complex type map failed for index " + p.Key);
}
}
@ -196,12 +196,12 @@ public class li_std_map_runme {
}
if (ispmap.Count != 10)
throw new Exception("Count test on specialized pointer map failed");
throw new Exception("Count test on complex type pointer map failed");
foreach (KeyValuePair<int, Struct> p in ispmap)
{
if ((p.Key * 10.1) != p.Value.num)
throw new Exception("Iteration test on specialized pointer map failed for index " + p.Key);
throw new Exception("Iteration test on complex type pointer map failed for index " + p.Key);
}
}
{
@ -212,29 +212,29 @@ public class li_std_map_runme {
}
if (iscpmap.Count != 10)
throw new Exception("Count test on specialized const pointer map failed");
throw new Exception("Count test on complex type const pointer map failed");
foreach (KeyValuePair<int, Struct> p in iscpmap)
{
if ((p.Key * 10.1) != p.Value.num)
throw new Exception("Iteration test on specialized const pointer map failed for index " + p.Key);
throw new Exception("Iteration test on complex type const pointer map failed for index " + p.Key);
}
}
// Test non-specialized map
// Test complex type as key (Struct)
{
StructIntMap limap = new StructIntMap();
Struct s7 = new Struct(7);
Struct s8 = new Struct(8);
limap.setitem(s7 , 8);
if (limap.getitem(s7) != 8)
throw new Exception("Assignment test on non-specialized map failed");
limap[s7] = 8;
if (limap[s7] != 8)
throw new Exception("Assignment test on complex key map failed");
if (!limap.ContainsKey(s7))
throw new Exception("Key test (1) on non-specialized map failed");
throw new Exception("Key test (1) on complex key map failed");
if (limap.ContainsKey(s8))
throw new Exception("Key test (2) on non-specialized map failed");
throw new Exception("Key test (2) on complex key map failed");
}
// All done

View file

@ -14,6 +14,8 @@ public class runme {
throw new Exception("test failed");
if (special_variable_macros.testJim(name) != "multiname num")
throw new Exception("test failed");
if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
throw new Exception("test failed");
NewName newName = NewName.factory("factoryname");
name = newName.getStoredName();
}

View file

@ -44,9 +44,9 @@ include $(srcdir)/../common.mk
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:

View file

@ -19,16 +19,16 @@ GUILE_RUNTIME=
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
setup = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \
fi;
fi
%.externaltest:
$(local_setup)
@ -41,9 +41,9 @@ local_setup = \
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \
fi;
fi
local_run_testcase = \
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$*$(SCRIPTSUFFIX); \
fi

View file

@ -67,24 +67,24 @@ setup = \
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
fi; \
if [ ! -d $* ]; then \
mkdir $*; \
fi;
mkdir $*; \
fi
# Compiles java files then runs the testcase. A testcase is only run if
# a file is found which has _runme.java appended after the testcase name.
# Note Java uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows, SHLIB_PATH on HPUX and DYLD_LIBRARY_PATH on Mac OS X.
run_testcase = \
(cd $* && $(COMPILETOOL) $(JAVAC) -classpath . *.java) && \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
$(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) -classpath . $*_runme;) \
fi;
cd $* && $(COMPILETOOL) $(JAVAC) -classpath . *.java && cd .. && \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) -classpath . $*_runme; \
fi
# Clean: remove testcase directories
%.clean:
@if [ -d $* ]; then \
rm -rf $*; \
fi;
rm -rf $*; \
fi
clean:
@rm -f *.class hs_err*.log

View file

@ -24,6 +24,8 @@ public class special_variable_macros_runme {
throw new RuntimeException("test failed");
if (!special_variable_macros.testJim(name).equals("multiname num"))
throw new RuntimeException("test failed");
if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
throw new RuntimeException("test failed");
NewName newName = NewName.factory("factoryname");
name = newName.getStoredName();
}

View file

@ -0,0 +1,15 @@
%module li_std_combinations
%include <std_vector.i>
%include <std_string.i>
%include <std_pair.i>
%template(VectorInt) std::vector<int>;
%template(VectorString) std::vector<std::string>;
%template(PairIntString) std::pair<int, std::string>;
%template(VectorPairIntString) std::vector< std::pair<int, std::string> >;
%template(PairIntVectorString) std::pair< int, std::vector<std::string> >;
%template(VectorVectorString) std::vector< std::vector<std::string> >;
%template(PairIntPairIntString) std::pair< int, std::pair<int, std::string> >;

View file

@ -46,18 +46,6 @@ struct Struct {
%}
#if defined(SWIGCSHARP)
// Specialize some more non-default map types
SWIG_STD_MAP_SPECIALIZED(int, int *, int, SWIGTYPE_p_int)
SWIG_STD_MAP_SPECIALIZED(int, const int *, int, SWIGTYPE_p_int)
SWIG_STD_MAP_SPECIALIZED_SIMPLE(int, Struct)
SWIG_STD_MAP_SPECIALIZED(int, Struct *, int, Struct)
SWIG_STD_MAP_SPECIALIZED(int, const Struct *, int, Struct)
SWIG_STD_MAP_SPECIALIZED(Struct *, int, Struct, int)
#endif
//#if !defined(SWIGR)
// Test out some maps with pointer types

View file

@ -75,12 +75,7 @@ const std::vector<const Struct *> & vecstructconstptr(const std::vector<const St
%}
#if defined(SWIGCSHARP)
SWIG_STD_VECTOR_SPECIALIZE(Struct, Struct *)
SWIG_STD_VECTOR_SPECIALIZE(Struct, const Struct *)
SWIG_STD_VECTOR_SPECIALIZE(SWIGTYPE_p_int, int *)
SWIG_STD_VECTOR_SPECIALIZE(SWIGTYPE_p_int, const int *)
// Also test non-specialized versions
// Also test const and non-const pointers, but not strictly necessary since std::vector was enhanced in swig-1.3.40
%template(StructurePtrVector) std::vector<Structure *>;
%template(StructureConstPtrVector) std::vector<const Structure *>;
#endif
@ -93,10 +88,6 @@ SWIG_STD_VECTOR_SPECIALIZE(SWIGTYPE_p_int, const int *)
%template(StructPtrVector) std::vector<Struct *>;
%template(StructConstPtrVector) std::vector<const Struct *>;
#if defined(SWIGCSHARP)
SWIG_STD_VECTOR_SPECIALIZE(MyClass, MyClass *)
#endif
#if !defined(SWIGTCL)
%inline {
struct MyClass {};

View file

@ -46,9 +46,9 @@ LIBS = -L.
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lua appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(LUA) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(LUA) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra lua code)
%.clean:

View file

@ -36,9 +36,9 @@ include $(srcdir)/../common.mk
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:

View file

@ -14,13 +14,13 @@ C_TEST_CASES =
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) -a \
-f $(top_srcdir)/Examples/test-suite/$*.list ] ; then ( \
-f $(top_srcdir)/Examples/test-suite/$*.list ] ; then \
$(COMPILETOOL) $(OCAMLC) -c $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./runme) ; \
elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./runme; \
elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(COMPILETOOL) $(OCAMLC) -c $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme $(srcdir)/$(*).cmo $(srcdir)/$(*)_runme.cmo $(srcdir)/$(*)_wrap.o && \
$(RUNTOOL) ./runme) ; \
$(RUNTOOL) ./runme; \
fi ;
check_quant:

View file

@ -56,9 +56,9 @@ LIBS = -L.
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.m appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVEPATH=$(srcdir):OCTAVEPATH $(RUNTOOL) $(OCTAVE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVEPATH=$(srcdir):OCTAVEPATH $(RUNTOOL) $(OCTAVE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: remove the generated .m file
%.clean:

View file

@ -2,7 +2,7 @@ wrapmacro
a = 2;
b = -1;
wrapmacro.max(a,b);
wrapmacro.max(a/7.0, -b*256);
wrapmacro.maximum(a,b);
wrapmacro.maximum(a/7.0, -b*256);
wrapmacro.GUINT16_SWAP_LE_BE_CONSTANT(1);

View file

@ -49,10 +49,9 @@ include $(srcdir)/../common.mk
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.pl appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PERL) $(TEST_RUNNER) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
fi; \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PERL) $(TEST_RUNNER) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: remove the generated .pm file
%.clean:

View file

@ -9,6 +9,6 @@ require_ok('wrapmacro');
my $a = 2;
my $b = -1;
is(wrapmacro::max($a,$b), 2);
is(wrapmacro::max($a/7.0, -$b*256), 256);
is(wrapmacro::maximum($a,$b), 2);
is(wrapmacro::maximum($a/7.0, -$b*256), 256);
is(wrapmacro::GUINT16_SWAP_LE_BE_CONSTANT(1), 256);

View file

@ -44,12 +44,14 @@ missingtests: missingcpptests missingctests
+$(swig_and_compile_multi_cpp)
+$(run_testcase)
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.php appended after the testcase name.
# Runs the testcase. Tries to run testcase_runme.php, and if that's not
# found, runs testcase.php, except for multicpptests.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHPSCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL=$(RUNTOOL) php_run;) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHPSCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL=$(RUNTOOL) php_run; \
elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHPSCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*.php RUNTOOL=$(RUNTOOL) php_run; \
fi
# Clean: remove the generated .php file
%.clean:

View file

@ -0,0 +1,20 @@
<?php
require "tests.php";
require "import_nomodule.php";
// No new functions
check::functions(array(create_foo,delete_foo,test1));
// No new classes
check::classes(array(import_nomodule,Bar));
// now new vars
check::globals(array());
$f = import_nomodule::create_Foo();
import_nomodule::test1($f,42);
import_nomodule::delete_Foo($f);
$b = new Bar();
import_nomodule::test1($b,37);
check::done();
?>

View file

@ -0,0 +1,19 @@
<?php
require "tests.php";
require "overload_rename.php";
// No new functions
check::functions(array());
// No new classes
check::classes(array(Foo));
// now new vars
check::globals(array());
$f = new Foo(1.0);
$f = new Foo(1.0,1.0);
$f = Foo::Foo_int(1.0,1);
$f = Foo::Foo_int(1.0,1,1.0);
check::done();
?>

View file

@ -70,6 +70,8 @@ class check {
}
function classname($string,$object) {
if (!is_object($object))
return check::fail("The second argument is a " . gettype($object) . ", not an object.");
if (strtolower($string)!=strtolower($classname=get_class($object))) return check::fail("Object: \$object is of class %s not class %s",$classname,$string);
return TRUE;
}

View file

@ -36,9 +36,9 @@ include $(srcdir)/../common.mk
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.pike appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PIKE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PIKE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: remove the generated .pike file
%.clean:

View file

@ -125,17 +125,16 @@ py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
ifeq (,$(PY3))
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
$(run_python);)\
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(run_python);\
fi
else
run_testcase = \
if [ -f $(py2_runme) ]; then ( \
$(MAKE) -f $(srcdir)/Makefile $(py3_runme) && \
$(run_python);) \
elif [ -f $(py3_runme) ]; then ( \
$(run_python);) \
fi;
if [ -f $(py2_runme) ]; then \
$(MAKE) -f $(srcdir)/Makefile $(py3_runme) && $(run_python); \
elif [ -f $(py3_runme) ]; then \
$(run_python); \
fi
endif
# Clean: remove the generated .py file
@ -143,7 +142,7 @@ endif
@rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
@rm -f $*.py;
@#We only remove the _runme3.py if it is generated by 2to3 from a _runme.py.
@if [ -f $(py2_runme) ]; then (rm -f $(py3_runme) $(py3_runme).bak;) fi;
@if [ -f $(py2_runme) ]; then rm -f $(py3_runme) $(py3_runme).bak; fi
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean

View file

@ -11,4 +11,6 @@ if special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap":
raise "test failed"
if special_variable_macros.testJim(name) != "multiname num":
raise "test failed"
if special_variable_macros.testJohn(special_variable_macros.PairIntBool(10, False)) != 123:
raise "test failed"

View file

@ -1,4 +1,3 @@
import string
from template_typedef_cplx2 import *
from template_typedef_import import *

View file

@ -2,6 +2,6 @@ import wrapmacro
a = 2
b = -1
wrapmacro.max(a,b)
wrapmacro.max(a/7.0, -b*256)
wrapmacro.maximum(a,b)
wrapmacro.maximum(a/7.0, -b*256)
wrapmacro.GUINT16_SWAP_LE_BE_CONSTANT(1)

View file

@ -42,20 +42,19 @@ include $(srcdir)/../common.mk
# Run the runme if it exists. If not just load the R wrapper to
# check for syntactic correctness
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" \
$(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ;) \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
else \
($(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(WRAPSUFFIX);) \
fi;
$(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(WRAPSUFFIX); \
fi
run_multitestcase = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ]; then ( \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" \
$(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ;) \
$(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX); \
else \
($(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX);) \
$(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX); \
fi; \
done
# Clean
@ -64,10 +63,10 @@ clean:
%.clean:
@rm -f $*.R $*_wrap.so $*_wrap.cpp $*_wrap.c $*_wrap.o $*_runme.Rout $*.Rout
@if [ -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then ( \
@if [ -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
rm -f $${f}.R $${f}.Rout ; \
done ) \
done \
fi

View file

@ -60,9 +60,9 @@ ruby_naming.cpptest: SWIGOPT += -autorename
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.rb appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:

View file

@ -110,6 +110,40 @@ const char * testJim(Name *jim, int count) {
}
%}
//////////////////////////////////////////////////////////////////////////////////////
// Template types with more than one template parameter
// check $1 and $input get expanded properly when used from $typemap()
%typemap(in) Space::Pair<int, bool> PAIR_INT_BOOL ($1_type temp)
%{
/*%typemap(in) Name *GENERIC start */
temp = Space::Pair<int, bool>(123, true);
(void)$input;
$1 = ($1_ltype)temp;
/*%typemap(in) Name *GENERIC end */
%}
%typemap(in) Space::Pair<int, bool> john {
// %typemap(in) Name *john start
$typemap(in, Space::Pair<int, bool> PAIR_INT_BOOL)
// %typemap(in) Name *john end
}
%inline %{
namespace Space {
template <typename T1, typename T2> struct Pair {
Pair(T1 f, T2 s) : first(f), second(s) {}
Pair() {}
T1 first;
T2 second;
};
int testJohn(Space::Pair<int, bool> john) {
return john.first;
}
}
%}
%template(PairIntBool) Space::Pair<int, bool>;
//////////////////////////////////////////////////////////////////////////////////////
// A real use case for $typemap

View file

@ -45,9 +45,9 @@ include $(srcdir)/../common.mk
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.tcl appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(TCLSH) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(TCLSH) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:

View file

@ -23,10 +23,10 @@
using namespace std;
struct XX {
XX() { cout << "XX()" << endl; }
XX() { if (debug) cout << "XX()" << endl; }
XX(int i) { if (debug) cout << "XX(" << i << ")" << endl; }
XX(const XX &other) { cout << "XX(const XX &)" << endl; }
XX& operator =(const XX &other) { cout << "operator=(const XX &)" << endl; return *this; }
XX(const XX &other) { if (debug) cout << "XX(const XX &)" << endl; }
XX& operator =(const XX &other) { if (debug) cout << "operator=(const XX &)" << endl; return *this; }
~XX() { if (debug) cout << "~XX()" << endl; }
static XX create() {
return XX(123);

View file

@ -38,9 +38,9 @@ CPP_TEST_CASES =
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(UFFIBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(UFFIBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra uffi code)
%.clean:

View file

@ -21,7 +21,8 @@ typedef unsigned short guint16;
(guint16) ((guint16) (val) >> 8) | \
(guint16) ((guint16) (val) << 8)))
#define max(a,b) ((a) > (b) ? (a) : (b))
/* Don't use max(), it's a builtin function for PHP. */
#define maximum(a,b) ((a) > (b) ? (a) : (b))
%}
@ -41,8 +42,8 @@ type SWIGMACRO_##name(lparams) {
/* Here, wrapping the macros */
%wrapmacro(guint16, GUINT16_SWAP_LE_BE_CONSTANT, guint16 val, val);
%wrapmacro(size_t, max, PLIST(size_t a, const size_t& b), PLIST(a, b));
%wrapmacro(double, max, PLIST(double a, double b), PLIST(a, b));
%wrapmacro(size_t, maximum, PLIST(size_t a, const size_t& b), PLIST(a, b));
%wrapmacro(double, maximum, PLIST(double a, double b), PLIST(a, b));
/* Maybe in the future, a swig directive will make this easier: