merge from trunk

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11360 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2009-07-04 06:48:39 +00:00
commit 84aecae48a
44 changed files with 366 additions and 188 deletions

View file

@ -1,13 +1,41 @@
Version 1.3.40 (in progress) Version 1.3.40 (in progress)
============================ ============================
2009-07-03: olly
[Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS
and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter
of the manual. Based on patch from SF#2810380 by Christian
Gollwitzer.
2009-07-02: wsfulton
Fix -Wallkw option as reported by Solomon Gibbs.
2009-07-02: wsfulton
Fix syntax error when a nested struct contains a comment containing a * followed eventually by a /.
Regression from 1.3.37, reported by Solomon Gibbs.
2009-06-30: olly
[Ruby] Undefine close and connect macros defined by Ruby API
headers as we don't need them and they can clash with C++ methods
being wrapped. Patch from Vit Ondruch in SF#2814430.
2009-06-26: olly
[Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a
double parameter.
2009-06-24: wsfulton
Fix wrapping methods with default arguments and the compactdefaultargs feature
where a class is passed by value and is assigned a default value. The SwigValueWrapper
template workaround for a missing default constructor is no longer used as the code
generated does not call the default constructor.
2009-06-16: wsfulton 2009-06-16: wsfulton
[Java,C#] Fix enum marshalling when %ignore is used on one of the enum items. [Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
Incorrect enum values were being passed to the C++ layer or compilation errors resulted. Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
2009-06-02: talby 2009-06-02: talby
[Perl] Resolved reference.i overload support problem [Perl] Resolved reference.i overload support problem
identfied by John Potowsky. identified by John Potowsky.
2009-05-26: wsfulton 2009-05-26: wsfulton
[C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy [C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy

View file

@ -1025,7 +1025,7 @@ Deletes <tt>s</tt>.
</div> </div>
<p> <p>
<b><tt>int Len(String_or_char *s)</tt></b> <b><tt>int Len(const String_or_char *s)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1033,7 +1033,7 @@ Returns the length of the string.
</div> </div>
<p> <p>
<b><tt>char *Char(String_or_char *s)</tt></b> <b><tt>char *Char(const String_or_char *s)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1041,7 +1041,7 @@ Returns a pointer to the first character in a string.
</div> </div>
<p> <p>
<b><tt>void Append(String *s, String_or_char *t)</tt></b> <b><tt>void Append(String *s, const String_or_char *t)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1049,7 +1049,7 @@ Appends <tt>t</tt> to the end of string <tt>s</tt>.
</div> </div>
<p> <p>
<b><tt>void Insert(String *s, int pos, String_or_char *t)</tt></b> <b><tt>void Insert(String *s, int pos, const String_or_char *t)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1162,7 +1162,7 @@ Returns the number of items in <tt>h</tt>.
</div> </div>
<p> <p>
<b><tt>Object *Getattr(Hash *h, String_or_char *key)</tt></b> <b><tt>Object *Getattr(Hash *h, const String_or_char *key)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1171,7 +1171,7 @@ a simple <tt>char *</tt> string. Returns NULL if not found.
</div> </div>
<p> <p>
<b><tt>int Setattr(Hash *h, String_or_char *key, Object_or_char *val)</tt></b> <b><tt>int Setattr(Hash *h, const String_or_char *key, const Object_or_char *val)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1185,7 +1185,7 @@ of <tt>val</tt>. Returns 1 if this operation replaced an existing hash entry,
</div> </div>
<p> <p>
<b><tt>int Delattr(Hash *h, String_or_char *key)</tt></b> <b><tt>int Delattr(Hash *h, const String_or_char *key)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1249,7 +1249,7 @@ negative, the first item is returned.
</div> </div>
<p> <p>
<b><tt>int *Setitem(List *x, int n, Object_or_char *val)</tt></b> <b><tt>int *Setitem(List *x, int n, const Object_or_char *val)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1271,7 +1271,7 @@ for <tt>n</tt>.
</div> </div>
<p> <p>
<b><tt>void Append(List *x, Object_or_char *t)</tt></b> <b><tt>void Append(List *x, const Object_or_char *t)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1281,7 +1281,7 @@ used to create a String object.
</div> </div>
<p> <p>
<b><tt>void Insert(String *s, int pos, Object_or_char *t)</tt></b> <b><tt>void Insert(String *s, int pos, const Object_or_char *t)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1479,13 +1479,14 @@ Same as the C <tt>tell()</tt> function.
</div> </div>
<p> <p>
<b><tt>File *NewFile(const char *filename, const char *mode)</tt></b> <b><tt>File *NewFile(const char *filename, const char *mode, List *newfiles)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
Create a File object using the <tt>fopen()</tt> library call. This Create a File object using the <tt>fopen()</tt> library call. This
file differs from <tt>FILE *</tt> in that it can be placed in the standard file differs from <tt>FILE *</tt> in that it can be placed in the standard
SWIG containers (lists, hashes, etc.). SWIG containers (lists, hashes, etc.). The <tt>filename</tt> is added to the
<tt>newfiles</tt> list if <tt>newfiles</tt> is non-zero and the file was created successfully.
</div> </div>
<p> <p>
@ -1922,7 +1923,7 @@ Adds a reference to <tt>ty</tt>.
</div> </div>
<p> <p>
<b><tt>void SwigType_add_array(SwigType *ty, String_or_char *dim)</tt></b> <b><tt>void SwigType_add_array(SwigType *ty, const String_or_char *size)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1962,7 +1963,7 @@ Sets <tt>n</tt>th array dimensions of <tt>ty</tt> to <tt>rep</tt>.
</div> </div>
<p> <p>
<b><tt>void SwigType_add_qualifier(SwigType *ty, String_or_char *q)</tt></b> <b><tt>void SwigType_add_qualifier(SwigType *ty, const String_or_char *q)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -1971,7 +1972,7 @@ Adds a type qualifier <tt>q</tt> to <tt>ty</tt>. <tt>q</tt> is typically
</div> </div>
<p> <p>
<b><tt>void SwigType_add_memberpointer(SwigType *ty, String_or_char *cls)</tt></b> <b><tt>void SwigType_add_memberpointer(SwigType *ty, const String_or_char *cls)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -2292,7 +2293,7 @@ The following functions produce strings that are suitable for output.
</p> </p>
<p> <p>
<b><tt>String *SwigType_str(SwigType *ty, String_or_char *id = 0)</tt></b> <b><tt>String *SwigType_str(SwigType *ty, const String_or_char *id = 0)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -2303,7 +2304,7 @@ used to convert string-encoded types back into a form that is valid C syntax.
</div> </div>
<p> <p>
<b><tt>String *SwigType_lstr(SwigType *ty, String_or_char *id = 0)</tt></b> <b><tt>String *SwigType_lstr(SwigType *ty, const String_or_char *id = 0)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -2312,7 +2313,7 @@ is generated from the type's lvalue (as generated from SwigType_ltype).
</div> </div>
<p> <p>
<b><tt>String *SwigType_lcaststr(SwigType *ty, String_or_char *id = 0)</tt></b> <b><tt>String *SwigType_lcaststr(SwigType *ty, const String_or_char *id = 0)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -2323,7 +2324,7 @@ this function produces the string "<tt>(char *) foo</tt>".
</div> </div>
<p> <p>
<b><tt>String *SwigType_rcaststr(SwigType *ty, String_or_char *id = 0)</tt></b> <b><tt>String *SwigType_rcaststr(SwigType *ty, const String_or_char *id = 0)</tt></b>
</p> </p>
<div class="indent"> <div class="indent">
@ -2776,6 +2777,7 @@ such as:
class PYTHON : public Language { class PYTHON : public Language {
protected: protected:
/* General DOH objects used for holding the strings */ /* General DOH objects used for holding the strings */
File *f_begin;
File *f_runtime; File *f_runtime;
File *f_header; File *f_header;
File *f_wrappers; File *f_wrappers;
@ -2791,22 +2793,25 @@ int Python::top(Node *n) {
... ...
/* Initialize I/O */ /* Initialize I/O */
f_runtime = NewFile(outfile, "w"); f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_runtime) { if (!f_begin) {
FileErrorDisplay(outfile); FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE); SWIG_exit(EXIT_FAILURE);
} }
f_runtime = NewString("");
f_init = NewString(""); f_init = NewString("");
f_header = NewString(""); f_header = NewString("");
f_wrappers = NewString(""); f_wrappers = NewString("");
/* Register file targets with the SWIG file handler */ /* Register file targets with the SWIG file handler */
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("header", f_header); Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers); Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("runtime", f_runtime); Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init); Swig_register_filebyname("init", f_init);
/* Output module initialization code */ /* Output module initialization code */
Swig_banner(f_begin);
... ...
/* Emit code for children */ /* Emit code for children */
@ -2814,16 +2819,18 @@ int Python::top(Node *n) {
... ...
/* Write all to the file */ /* Write all to the file */
Dump(f_header, f_runtime); Dump(f_runtime, f_begin);
Dump(f_wrappers, f_runtime); Dump(f_header, f_begin);
Wrapper_pretty_print(f_init, f_runtime); Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
/* Cleanup files */ /* Cleanup files */
Delete(f_runtime);
Delete(f_header); Delete(f_header);
Delete(f_wrappers); Delete(f_wrappers);
Delete(f_init); Delete(f_init);
Close(f_runtime); Close(f_begin);
Delete(f_runtime); Delete(f_begin);
return SWIG_OK; return SWIG_OK;
} }

View file

@ -363,8 +363,8 @@ program using commands like this (shown for Linux):
<div class="shell"><pre> <div class="shell"><pre>
$ swig -python example.i $ swig -python example.i
$ gcc -c -fPIC example.c $ gcc -O2 -fPIC -c example.c
$ gcc -c -fPIC example_wrap.c -I/usr/local/include/python2.0 $ gcc -O2 -fPIC -c example_wrap.c -I/usr/local/include/python2.5
$ gcc -shared example.o example_wrap.o -o _example.so $ gcc -shared example.o example_wrap.o -o _example.so
</pre></div> </pre></div>
@ -654,26 +654,19 @@ compiler. For example:
<div class="shell"><pre> <div class="shell"><pre>
$ swig -c++ -python example.i $ swig -c++ -python example.i
$ g++ -c example.cxx $ g++ -O2 -fPIC -c example.cxx
$ g++ -c example_wrap.cxx -I/usr/local/include/python2.0 $ g++ -O2 -fPIC -c example_wrap.cxx -I/usr/local/include/python2.5
$ g++ -shared example.o example_wrap.o -o _example.so $ g++ -shared example.o example_wrap.o -o _example.so
</pre></div> </pre></div>
<p> <p>
On some platforms, you could also need to generate The -fPIC option tells GCC to generate position-independent code (PIC)
position-independent code (PIC), by using a compiler option such as -fPIC. which is required for most architectures (it's not vital on x86, but
Notably, the x86_64 (Opteron and EM64T) platform requires it, and when still a good idea as it allows code pages from the library to be shared between
using the GNU Compiler Suite, you will need to modify the previous example processes). Other compilers may need a different option specified instead of
as follows: -fPIC.
</p> </p>
<div class="shell"><pre>
$ swig -c++ -python example.i
$ g++ -fPIC -c example.cxx
$ g++ -fPIC -c example_wrap.cxx -I/usr/local/include/python2.0
$ g++ -shared example.o example_wrap.o -o _example.so
</pre></div>
<p> <p>
In addition to this, you may need to include additional library In addition to this, you may need to include additional library
files to make it work. For example, if you are using the Sun C++ compiler on files to make it work. For example, if you are using the Sun C++ compiler on
@ -683,7 +676,7 @@ Solaris, you often need to add an extra library <tt>-lCrun</tt> like this:
<div class="shell"><pre> <div class="shell"><pre>
$ swig -c++ -python example.i $ swig -c++ -python example.i
$ CC -c example.cxx $ CC -c example.cxx
$ CC -c example_wrap.cxx -I/usr/local/include/python2.0 $ CC -c example_wrap.cxx -I/usr/local/include/python2.5
$ CC -G example.o example_wrap.o -L/opt/SUNWspro/lib -o _example.so -lCrun $ CC -G example.o example_wrap.o -L/opt/SUNWspro/lib -o _example.so -lCrun
</pre></div> </pre></div>

View file

@ -66,6 +66,7 @@
<ul> <ul>
<li><a href="#Tcl_nn45">Proxy classes</a> <li><a href="#Tcl_nn45">Proxy classes</a>
</ul> </ul>
<li><a href="#Tcl_nn46">Tcl/Tk Stubs</a>
</ul> </ul>
</div> </div>
<!-- INDEX --> <!-- INDEX -->
@ -3409,5 +3410,26 @@ short, but clever Tcl script can be combined with SWIG to do many
interesting things. interesting things.
</p> </p>
<H2><a name="Tcl_nn46"></a>33.10 Tcl/Tk Stubs</H2>
<p>
For background information about the Tcl Stubs feature, see
<a href="http://www.tcl.tk/doc/howto/stubs.html">http://www.tcl.tk/doc/howto/stubs.html</a>.
</p>
<p>
As of SWIG 1.3.10, the generated C/C++ wrapper will use the Tcl Stubs
feature if compiled with <tt>-DUSE_TCL_STUBS</tt>.
</p>
<p>
As of SWIG 1.3.40, the generated C/C++ wrapper will use the Tk Stubs
feature if compiled with <tt>-DUSE_TK_STUBS</tt>. Also, you can override
the minimum version to support which is passed to <tt>Tcl_InitStubs()</tt>
and <tt>Tk_InitStubs()</tt> with <tt>-DSWIG_TCL_STUBS_VERSION="8.3"</tt>
or the version being compiled with using
<tt>-DSWIG_TCL_STUBS_VERSION=TCL_VERSION</tt>.
</p>
</body> </body>
</html> </html>

View file

@ -335,12 +335,13 @@ OCTAVE_SO = @OCTAVE_SO@
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# Build a C dynamically loadable module # Build a C dynamically loadable module
# Note: Octave requires C++ compiler when compiling C wrappers
# ---------------------------------------------------------------- # ----------------------------------------------------------------
octave: $(SRCS) octave: $(SRCS)
$(SWIG) -octave $(SWIGOPT) $(INTERFACEPATH) $(SWIG) -octave $(SWIGOPT) $(INTERFACEPATH)
$(CXX) -g -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(CXXSRCS) $(INCLUDES) -I$(OCTAVE_INCLUDE) $(CXX) -g -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(INCLUDES) -I$(OCTAVE_INCLUDE)
$(CC) -g -c $(CCSHARED) $(CFLAGS) $(SRCS) $(INCLUDES) $(OCTAVE_INCLUDE) $(CC) -g -c $(CCSHARED) $(CFLAGS) $(SRCS) $(INCLUDES)
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO) $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
# ----------------------------------------------------------------- # -----------------------------------------------------------------

View file

@ -89,8 +89,12 @@ SKIP_CPP_STD_CASES = Yes
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here
# SWIGOPT += -debug-module 4 # SWIGOPT += -debug-module 4
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -11,10 +11,14 @@ top_builddir = @top_builddir@
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now # no C++ tests for now
CPP_TEST_CASES = CPP_TEST_CASES =
#C_TEST_CASES += #C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -23,10 +23,21 @@ EXTRA_TEST_CASES += chicken_ext_test.externaltest
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
SWIGOPT += -nounit SWIGOPT += -nounit
# Custom tests - tests with additional commandline options
# If there exists a PROXYSUFFIX runme file, we also generate the wrapper
# with the -proxy argument
%.cppproxy: SWIGOPT += -proxy
%.cppproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.cproxy: SWIGOPT += -proxy
%.cproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.multiproxy: SWIGOPT += -proxy -noclosuses
%.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)
@ -57,6 +68,21 @@ SWIGOPT += -nounit
+$(swig_and_compile_external) +$(swig_and_compile_external)
$(run_testcase) $(run_testcase)
%.cppproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_cpp)
$(run_testcase)
%.cproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_c)
$(run_testcase)
%.multiproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_multi_cpp)
$(run_testcase)
# Runs the testcase. A testcase is only run if # Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name. # a file is found which has _runme.scm appended after the testcase name.
run_testcase = \ run_testcase = \
@ -64,29 +90,6 @@ run_testcase = \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi; fi;
# If there exists a PROXYSUFFIX runme file, we also generate the wrapper
# with the -proxy argument
%.cppproxy: SWIGOPT += -proxy
%.cppproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.cppproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_cpp)
$(run_testcase)
%.cproxy: SWIGOPT += -proxy
%.cproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.cproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_c)
$(run_testcase)
%.multiproxy: SWIGOPT += -proxy -noclosuses
%.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
%.multiproxy:
echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy"
+$(swig_and_compile_multi_cpp)
$(run_testcase)
# Clean # Clean
%.clean: %.clean:

View file

@ -11,10 +11,14 @@ top_builddir = @top_builddir@
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now # no C++ tests for now
CPP_TEST_CASES = CPP_TEST_CASES =
#C_TEST_CASES += #C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -16,8 +16,8 @@
# b) Define rules for %.ctest, %.cpptest, %.multicpptest and %.clean. # b) Define rules for %.ctest, %.cpptest, %.multicpptest and %.clean.
# c) Define srcdir, top_srcdir and top_builddir (these are the # c) Define srcdir, top_srcdir and top_builddir (these are the
# equivalent to configure's variables of the same name). # equivalent to configure's variables of the same name).
# 3) One off special commandline options can be achieved by adding a # 3) One off special commandline options for a testcase can be added.
# test case to CUSTOM_TEST_CASES and defining rules to run and test. # See custom tests below.
# #
# The 'check' target runs the testcases including SWIG invocation, # The 'check' target runs the testcases including SWIG invocation,
# C/C++ compilation, target language compilation (if any) and runtime # C/C++ compilation, target language compilation (if any) and runtime
@ -64,14 +64,14 @@ INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
LIBS = -L. LIBS = -L.
LIBPREFIX = lib LIBPREFIX = lib
ACTION = check ACTION = check
INTERFACEDIR = $(if $(wildcard $*.i), ./, ../) INTERFACEDIR = ../
# #
# Please keep test cases in alphabetical order. # Please keep test cases in alphabetical order.
# Note that any whitespace after the last entry in each list will break make # Note that any whitespace after the last entry in each list will break make
# #
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.) # Broken C++ test cases. (Can be run individually using: make testcase.cpptest)
CPP_TEST_BROKEN += \ CPP_TEST_BROKEN += \
constants \ constants \
cpp_broken \ cpp_broken \
@ -85,12 +85,12 @@ CPP_TEST_BROKEN += \
template_expr template_expr
# Broken C test cases. (Can be run individually using make testcase.ctest.) # Broken C test cases. (Can be run individually using: make testcase.ctest)
C_TEST_BROKEN += \ C_TEST_BROKEN += \
tag_no_clash_with_variable tag_no_clash_with_variable
# C++ test cases. (Can be run individually using make testcase.cpptest.) # C++ test cases. (Can be run individually using: make testcase.cpptest)
CPP_TEST_CASES += \ CPP_TEST_CASES += \
abstract_access \ abstract_access \
abstract_inherit \ abstract_inherit \
@ -394,6 +394,7 @@ CPP_TEST_CASES += \
virtual_destructor \ virtual_destructor \
virtual_poly \ virtual_poly \
voidtest \ voidtest \
wallkw \
wrapmacro wrapmacro
# #
@ -420,7 +421,7 @@ CPP_TEST_CASES += ${CPP_STD_TEST_CASES}
endif endif
# C test cases. (Can be run individually using make testcase.ctest.) # C test cases. (Can be run individually using: make testcase.ctest)
C_TEST_CASES += \ C_TEST_CASES += \
arrays \ arrays \
char_constant \ char_constant \
@ -459,7 +460,7 @@ C_TEST_CASES += \
unions unions
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest.) # Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest)
MULTI_CPP_TEST_CASES += \ MULTI_CPP_TEST_CASES += \
clientdata_prop \ clientdata_prop \
imports \ imports \
@ -468,10 +469,13 @@ MULTI_CPP_TEST_CASES += \
template_typedef_import \ template_typedef_import \
multi_import multi_import
# Custom tests - tests with additional commandline options
wallkw.cpptest: SWIGOPT += -Wallkw
NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \ NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \
$(C_TEST_CASES:=.ctest) \ $(C_TEST_CASES:=.ctest) \
$(MULTI_CPP_TEST_CASES:=.multicpptest) \ $(MULTI_CPP_TEST_CASES:=.multicpptest) \
$(CUSTOM_TEST_CASES:=.customtest) \
$(EXTRA_TEST_CASES) $(EXTRA_TEST_CASES)
BROKEN_TEST_CASES = $(CPP_TEST_BROKEN:=.cpptest) \ BROKEN_TEST_CASES = $(CPP_TEST_BROKEN:=.cpptest) \
@ -480,7 +484,6 @@ BROKEN_TEST_CASES = $(CPP_TEST_BROKEN:=.cpptest) \
ALL_CLEAN = $(CPP_TEST_CASES:=.clean) \ ALL_CLEAN = $(CPP_TEST_CASES:=.clean) \
$(C_TEST_CASES:=.clean) \ $(C_TEST_CASES:=.clean) \
$(MULTI_CPP_TEST_CASES:=.clean) \ $(MULTI_CPP_TEST_CASES:=.clean) \
$(CUSTOM_TEST_CASES:=.clean) \
$(CPP_TEST_BROKEN:=.clean) \ $(CPP_TEST_BROKEN:=.clean) \
$(C_TEST_BROKEN:=.clean) $(C_TEST_BROKEN:=.clean)

View file

@ -15,24 +15,26 @@ CPP_TEST_CASES = \
csharp_attributes \ csharp_attributes \
csharp_exceptions \ csharp_exceptions \
csharp_features \ csharp_features \
csharp_lib_arrays \
csharp_prepost \ csharp_prepost \
csharp_typemaps \ csharp_typemaps \
enum_thorough_simple \ enum_thorough_simple \
enum_thorough_typesafe \ enum_thorough_typesafe \
exception_partial_info exception_partial_info \
CUSTOM_TEST_CASES = \
csharp_lib_arrays \
intermediary_classname intermediary_classname
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL) SWIGOPT += -namespace $*Namespace
INTERFACEDIR = ../../ INTERFACEDIR = ../../
CSHARPFLAGSSPECIAL = CSHARPFLAGSSPECIAL =
# Custom tests - tests with additional commandline options
intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname
csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)
@ -49,12 +51,6 @@ CSHARPFLAGSSPECIAL =
+(cd $* && $(swig_and_compile_multi_cpp)) +(cd $* && $(swig_and_compile_multi_cpp))
+$(run_testcase) +$(run_testcase)
# Rules for custom tests
intermediary_classname.customtest:
$(MAKE) intermediary_classname.cpptest SWIGOPTSPECIAL="-dllimport intermediary_classname"
csharp_lib_arrays.customtest:
$(MAKE) csharp_lib_arrays.cpptest CSHARPFLAGSSPECIAL="-unsafe"
# Makes a directory for the testcase if it does not exist # Makes a directory for the testcase if it does not exist
setup = \ setup = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \

View file

@ -119,6 +119,7 @@
// tests valuewrapper // tests valuewrapper
%feature("compactdefaultargs") MyClass2::set;
%inline %{ %inline %{
enum MyType { Val1, Val2 }; enum MyType { Val1, Val2 };
@ -134,6 +135,7 @@
void set(MyClass1 cl1 = Val1) {} void set(MyClass1 cl1 = Val1) {}
// This could have been written : set(MyClass1 cl1 = MyClass1(Val1)) // This could have been written : set(MyClass1 cl1 = MyClass1(Val1))
// But it works in C++ since there is a "conversion" constructor in MyClass1. // But it works in C++ since there is a "conversion" constructor in MyClass1.
void set2(MyClass1 cl1 = Val1) {}
}; };
%} %}

View file

@ -9,14 +9,22 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
GUILE = @GUILE@ GUILE = @GUILE@
GUILE_RUNTIME=-runtime
C_TEST_CASES = long_long \
list_vector \
multivalue \
pointer_in_out
C_TEST_CASES = long_long list_vector pointer_in_out multivalue
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
# none! # none!
# Custom tests - tests with additional commandline options
%.multicpptest: SWIGOPT += $(GUILE_RUNTIME)
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)
@ -28,19 +36,6 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c) +$(swig_and_compile_c)
$(run_testcase) $(run_testcase)
# override the default in common.mk by adding SWIGOPT +=
swig_and_compile_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
SWIGOPT=" -runtime "; \
export SWIGOPT; \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $$SWIGOPT" NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
$(LANGUAGE)$(VARIANT)_cpp; \
SWIGOPT=" -noruntime "; \
done
%.multicpptest: %.multicpptest:
$(setup) $(setup)
+$(swig_and_compile_multi_cpp) +$(swig_and_compile_multi_cpp)

View file

@ -6,11 +6,15 @@ EXTRA_TEST_CASES += guilescm_ext_test.externaltest
include ../guile/Makefile include ../guile/Makefile
# Overridden variables here
INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guilescm INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guilescm
VARIANT = VARIANT =
# Refer to the guile directory for the run scripts # Refer to the guile directory for the run scripts
SCRIPTPREFIX = ../guile/ SCRIPTPREFIX = ../guile/
GUILE_RUNTIME=
# Custom tests - tests with additional commandline options
# none!
# Runs the testcase. A testcase is only run if # Runs the testcase. A testcase is only run if
# a file is found which has _runme.scm appended after the testcase name. # a file is found which has _runme.scm appended after the testcase name.
@ -26,15 +30,6 @@ setup = \
echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \ echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \
fi; fi;
swig_and_compile_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $$SWIGOPT" NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
%.externaltest: %.externaltest:
$(local_setup) $(local_setup)
+$(swig_and_compile_external) +$(swig_and_compile_external)

View file

@ -40,6 +40,9 @@ include $(srcdir)/../common.mk
SWIGOPT += -package $* SWIGOPT += -package $*
INTERFACEDIR = ../../ INTERFACEDIR = ../../
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -0,0 +1,25 @@
import wallkw.*;
public class wallkw_runme {
static {
try {
System.loadLibrary("wallkw");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
if (!wallkw.c_clone().equals("clone"))
throw new RuntimeException("clone_c keyword fail");
if (!wallkw._delegate().equals("delegate"))
throw new RuntimeException("delegate keyword fail");
if (!wallkw._pass().equals("pass"))
throw new RuntimeException("pass keyword fail");
if (!wallkw.C_alias().equals("alias"))
throw new RuntimeException("alias keyword fail");
}
}

View file

@ -1,4 +1,4 @@
%module byreference %module li_reference
%include "reference.i" %include "reference.i"

View file

@ -24,6 +24,9 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
LIBS = -L. LIBS = -L.
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -14,6 +14,9 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
# none! # none!
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -27,7 +27,7 @@ struct a
struct { struct {
/*struct*/ /*struct*/
struct { struct {
int b; int b; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
} c; } c;
} d; } d;
}; };

View file

@ -44,6 +44,9 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
# none! # none!
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
echo $@ >> testing echo $@ >> testing

View file

@ -34,6 +34,9 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
LIBS = -L. LIBS = -L.
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -15,7 +15,7 @@ CPP_TEST_CASES += \
li_cdata \ li_cdata \
li_cstring \ li_cstring \
li_cdata_carrays \ li_cdata_carrays \
byreference \ li_reference \
C_TEST_CASES += \ C_TEST_CASES += \
li_cdata \ li_cdata \
@ -27,6 +27,9 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
# none! # none!
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -1,36 +0,0 @@
use strict;
use warnings;
use Test::More tests => 68;
BEGIN { use_ok('byreference') }
require_ok('byreference');
sub chk { my($type, $call, $v1, $v2) = @_;
$byreference::FrVal = $v1;
my $v = $v2;
eval { $call->(\$v) };
is($@, '', "$type check");
is($byreference::ToVal, $v2, "$type out");
is($v, $v1, "$type in");
}
chk("double*", \&byreference::PDouble, 12.2, 18.6);
chk("double&", \&byreference::RDouble, 32.5, 64.8);
chk("float*", \&byreference::PFloat, 64.5, 96.0);
chk("float&", \&byreference::RFloat, 98.5, 6.25);
chk("int*", \&byreference::PInt, 1887, 3356);
chk("int&", \&byreference::RInt, 2622, 9867);
chk("short*", \&byreference::PShort, 4752, 3254);
chk("short&", \&byreference::RShort, 1898, 5757);
chk("long*", \&byreference::PLong, 6687, 7132);
chk("long&", \&byreference::RLong, 8346, 4398);
chk("uint*", \&byreference::PUInt, 6853, 5529);
chk("uint&", \&byreference::RUInt, 5483, 7135);
chk("ushort*", \&byreference::PUShort, 9960, 9930);
chk("ushort&", \&byreference::RUShort, 1193, 4178);
chk("ulong*", \&byreference::PULong, 7960, 4788);
chk("ulong&", \&byreference::RULong, 8829, 1603);
chk("uchar*", \&byreference::PUChar, 110, 239);
chk("uchar&", \&byreference::RUChar, 15, 97);
chk("char*", \&byreference::PChar, -7, 118);
chk("char&", \&byreference::RChar, -3, -107);
chk("bool*", \&byreference::PBool, 0, 1);
chk("bool&", \&byreference::RBool, 1, 0);

View file

@ -0,0 +1,36 @@
use strict;
use warnings;
use Test::More tests => 68;
BEGIN { use_ok('li_reference') }
require_ok('li_reference');
sub chk { my($type, $call, $v1, $v2) = @_;
$li_reference::FrVal = $v1;
my $v = $v2;
eval { $call->(\$v) };
is($@, '', "$type check");
is($li_reference::ToVal, $v2, "$type out");
is($v, $v1, "$type in");
}
chk("double*", \&li_reference::PDouble, 12.2, 18.6);
chk("double&", \&li_reference::RDouble, 32.5, 64.8);
chk("float*", \&li_reference::PFloat, 64.5, 96.0);
chk("float&", \&li_reference::RFloat, 98.5, 6.25);
chk("int*", \&li_reference::PInt, 1887, 3356);
chk("int&", \&li_reference::RInt, 2622, 9867);
chk("short*", \&li_reference::PShort, 4752, 3254);
chk("short&", \&li_reference::RShort, 1898, 5757);
chk("long*", \&li_reference::PLong, 6687, 7132);
chk("long&", \&li_reference::RLong, 8346, 4398);
chk("uint*", \&li_reference::PUInt, 6853, 5529);
chk("uint&", \&li_reference::RUInt, 5483, 7135);
chk("ushort*", \&li_reference::PUShort, 9960, 9930);
chk("ushort&", \&li_reference::RUShort, 1193, 4178);
chk("ulong*", \&li_reference::PULong, 7960, 4788);
chk("ulong&", \&li_reference::RULong, 8829, 1603);
chk("uchar*", \&li_reference::PUChar, 110, 239);
chk("uchar&", \&li_reference::RUChar, 15, 97);
chk("char*", \&li_reference::PChar, -7, 118);
chk("char&", \&li_reference::RChar, -3, -107);
chk("bool*", \&li_reference::PBool, 0, 1);
chk("bool&", \&li_reference::RBool, 1, 0);

View file

@ -16,6 +16,9 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
TARGETPREFIX =# Should be php_ for Windows, empty otherwise TARGETPREFIX =# Should be php_ for Windows, empty otherwise
# Custom tests - tests with additional commandline options
# none!
# write out tests without a _runme.php # write out tests without a _runme.php
missingcpptests: missingcpptests:
for test in $(CPP_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done for test in $(CPP_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done

View file

@ -14,6 +14,9 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
# none! # none!
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -89,6 +89,9 @@ include $(srcdir)/../common.mk
LIBS = -L. LIBS = -L.
VALGRIND_OPT += --suppressions=pythonswig.supp VALGRIND_OPT += --suppressions=pythonswig.supp
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -16,6 +16,10 @@ CPP_TEST_CASES = r_double_delete
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
# none!
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:

View file

@ -38,12 +38,10 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
SWIGOPT += -w801 -noautorename -features autodoc=4 SWIGOPT += -w801 -noautorename -features autodoc=4
# Custom tests - tests with additional commandline options
# Rules for the different types of tests
# make sure -autorename is true for the naming test
ruby_naming.cpptest: SWIGOPT += -autorename ruby_naming.cpptest: SWIGOPT += -autorename
# Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)
+$(swig_and_compile_cpp) +$(swig_and_compile_cpp)

View file

@ -50,6 +50,9 @@ end
raise RuntimeError if fail != 1 raise RuntimeError if fail != 1
# Test a number which won't fit in a 32 bit integer and is represented
# as a FIXNUM by Ruby.
raise RuntimeError if val_double(51767811298) != 51767811298
raise RuntimeError if val_double_2(1.0) != 4.0 raise RuntimeError if val_double_2(1.0) != 4.0
raise RuntimeError if val_double_2(1) != 4 raise RuntimeError if val_double_2(1) != 4

View file

@ -23,6 +23,9 @@ include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here
# none! # none!
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -11,10 +11,14 @@ top_builddir = @top_builddir@
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now # no C++ tests for now
CPP_TEST_CASES = CPP_TEST_CASES =
#C_TEST_CASES += #C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)

View file

@ -0,0 +1,16 @@
%module wallkw
// test the -Wallkw option
%warnfilter(SWIGWARN_PARSE_KEYWORD) clone; // 'clone' is a php keyword, renamed as 'c_clone'
%warnfilter(SWIGWARN_PARSE_KEYWORD) delegate; // 'delegate' is a C# keyword, renaming to '_delegate'
%warnfilter(SWIGWARN_PARSE_KEYWORD) pass; // 'pass' is a python keyword, renaming to '_pass'
%warnfilter(SWIGWARN_PARSE_KEYWORD) alias; // 'alias' is a ruby keyword, renaming to 'C_alias'
%inline %{
const char * clone() { return "clone"; }
const char * delegate() { return "delegate"; }
const char * pass() { return "pass"; }
const char * alias() { return "alias"; }
%}

View file

@ -19,7 +19,7 @@
%include <chicken/chickenkw.swg> %include <chicken/chickenkw.swg>
%include <csharp/csharpkw.swg> %include <csharp/csharpkw.swg>
%include <java/javakw.swg> %include <java/javakw.swg>
%include <php/php.swg> %include <php/phpkw.swg>
%include <pike/pikekw.swg> %include <pike/pikekw.swg>
%include <python/pythonkw.swg> %include <python/pythonkw.swg>
%include <ocaml/ocamlkw.swg> %include <ocaml/ocamlkw.swg>

View file

@ -23,8 +23,8 @@
if (PyDict_Check(obj)) { if (PyDict_Check(obj)) {
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL); SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
%#if PY_VERSION_HEX >= 0x03000000 %#if PY_VERSION_HEX >= 0x03000000
/* In Python 3.x the ".items()" method return a dict_items object */ /* In Python 3.x the ".items()" method returns a dict_items object */
items = PySequence_Fast(items, ".items() havn't returned a sequence!"); items = PySequence_Fast(items, ".items() didn't return a sequence!");
%#endif %#endif
res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val); res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
} else { } else {

View file

@ -10,6 +10,12 @@
#ifdef bind #ifdef bind
# undef bind # undef bind
#endif #endif
#ifdef close
# undef close
#endif
#ifdef connect
# undef connect
#endif
/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */

View file

@ -197,7 +197,7 @@ SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val)
} }
%fragment(SWIG_AsVal_frag(double),"header",fragment="SWIG_ruby_failed") { %fragment(SWIG_AsVal_frag(double),"header",fragment="SWIG_ruby_failed") {
%ruby_aux_method(double, NUM2DBL, (type == T_FLOAT ? NUM2DBL(obj) : (type == T_FIXNUM ? (double) FIX2INT(obj) : rb_big2dbl(obj)))) %ruby_aux_method(double, NUM2DBL, NUM2DBL(obj))
SWIGINTERN int SWIGINTERN int
SWIG_AsVal_dec(double)(VALUE obj, double *val) SWIG_AsVal_dec(double)(VALUE obj, double *val)

View file

@ -22,6 +22,11 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *);
} }
#endif #endif
/* Compatibility version for TCL stubs */
#ifndef SWIG_TCL_STUBS_VERSION
#define SWIG_TCL_STUBS_VERSION "8.1"
#endif
%} %}
%init %{ %init %{
@ -74,10 +79,18 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *interp) {
int i; int i;
if (interp == 0) return TCL_ERROR; if (interp == 0) return TCL_ERROR;
#ifdef USE_TCL_STUBS #ifdef USE_TCL_STUBS
if (Tcl_InitStubs(interp, (char*)"8.1", 0) == NULL) { /* (char*) cast is required to avoid compiler warning/error for Tcl < 8.4. */
if (Tcl_InitStubs(interp, (char*)SWIG_TCL_STUBS_VERSION, 0) == NULL) {
return TCL_ERROR; return TCL_ERROR;
} }
#endif #endif
#ifdef USE_TK_STUBS
/* (char*) cast is required to avoid compiler warning/error. */
if (Tk_InitStubs(interp, (char*)SWIG_TCL_STUBS_VERSION, 0) == NULL) {
return TCL_ERROR;
}
#endif
Tcl_PkgProvide(interp, (char*)SWIG_name, (char*)SWIG_version); Tcl_PkgProvide(interp, (char*)SWIG_name, (char*)SWIG_version);
#ifdef SWIG_namespace #ifdef SWIG_namespace

2
README
View file

@ -20,7 +20,7 @@ Active Developers:
Olly Betts (olly@survex.com) (PHP) Olly Betts (olly@survex.com) (PHP)
John Lenz (Guile, MzScheme updates, Chicken module, runtime system) John Lenz (Guile, MzScheme updates, Chicken module, runtime system)
Mark Gossage (mark@gossage.cjb.net) (Lua) Mark Gossage (mark@gossage.cjb.net) (Lua)
Joseph Wang (joe@gnacademy.org) (R) Joseph Wang (joequant@gmail.com) (R)
Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL) Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL)
Xavier Delacour (xavier.delacour@gmail.com) (Octave) Xavier Delacour (xavier.delacour@gmail.com) (Octave)

View file

@ -1054,6 +1054,8 @@ static void strip_comments(char *string) {
case 5: case 5:
if (*c == '/') if (*c == '/')
state = 0; state = 0;
else
state = 1;
*c = ' '; *c = ' ';
break; break;
case 6: case 6:

View file

@ -3332,7 +3332,8 @@ public:
Delete(jretval_decl); Delete(jretval_decl);
} }
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s\n", SwigType_str(returntype, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
@ -3475,11 +3476,13 @@ public:
Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0));
} }
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number, "No csdirectorin typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number, "No csdirectorin typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
@ -3489,11 +3492,13 @@ public:
} else { } else {
if (!desc_tm) { if (!desc_tm) {
Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number, Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number,
"No or improper directorin typemap defined for %s\n", SwigType_str(c_param_type, 0)); "No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(c_param_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = nextSibling(p); p = nextSibling(p);
} else if (!tm) { } else if (!tm) {
Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number, Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number,
"No or improper directorin typemap defined for argument %s\n", SwigType_str(pt, 0)); "No or improper directorin typemap defined for argument %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = nextSibling(p); p = nextSibling(p);
} }
@ -3502,7 +3507,8 @@ public:
Delete(tp); Delete(tp);
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
p = nextSibling(p); p = nextSibling(p);
} }
@ -3602,8 +3608,8 @@ public:
Printf(w->code, "%s\n", tm); Printf(w->code, "%s\n", tm);
} else { } else {
Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number, Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number,
"Unable to use return type %s in director method %s::%s (skipping method).\n", SwigType_str(returntype, 0), "Unable to use return type %s used in %s::%s (skipping director method)\n",
SwigType_namestr(c_classname), SwigType_namestr(name)); SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }

View file

@ -3387,7 +3387,8 @@ public:
Append(classret_desc, jnidesc_canon); Append(classret_desc, jnidesc_canon);
Delete(jnidesc_canon); Delete(jnidesc_canon);
} else { } else {
Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number, "No or improper directorin typemap defined for %s\n", SwigType_str(returntype, 0)); Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number, "No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
@ -3418,13 +3419,15 @@ public:
Delete(jnidesc_canon); Delete(jnidesc_canon);
} else { } else {
Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number, Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number,
"No or improper directorin typemap defined for %s\n", SwigType_str(c_ret_type, 0)); "No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(c_ret_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
Delete(tp); Delete(tp);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, "No jni typemap defined for %s\n", SwigType_str(returntype, 0)); Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, "No jni typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
@ -3508,8 +3511,8 @@ public:
Delete(tm); Delete(tm);
} else { } else {
Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number, Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number,
"No or improper directorin typemap for type %s used in director method %s::%s\n", SwigType_str(type, 0), SwigType_namestr(c_classname), "No or improper directorin typemap for type %s for use in %s::%s (skipping director method)\n",
SwigType_namestr(name)); SwigType_str(type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
@ -3595,11 +3598,13 @@ public:
Append(classdesc, jni_canon); Append(classdesc, jni_canon);
Delete(jni_canon); Delete(jni_canon);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number, "No javadirectorin typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number, "No javadirectorin typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, "No jtype typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, "No jtype typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }
@ -3609,19 +3614,23 @@ public:
} else { } else {
if (!desc_tm) { if (!desc_tm) {
Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number,
"No or improper directorin typemap defined for %s\n", SwigType_str(c_param_type, 0)); "No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(c_param_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = nextSibling(p); p = nextSibling(p);
} else if (!jdesc) { } else if (!jdesc) {
Swig_warning(WARN_JAVA_TYPEMAP_DIRECTORIN_NODESC, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_DIRECTORIN_NODESC, input_file, line_number,
"Missing JNI descriptor in directorin typemap defined for %s\n", SwigType_str(c_param_type, 0)); "Missing JNI descriptor in directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(c_param_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = Getattr(p, "tmap:directorin:next"); p = Getattr(p, "tmap:directorin:next");
} else if (!tm) { } else if (!tm) {
Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number,
"No or improper directorin typemap defined for argument %s\n", SwigType_str(pt, 0)); "No or improper directorin typemap defined for argument %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = nextSibling(p); p = nextSibling(p);
} else if (!cdesc) { } else if (!cdesc) {
Swig_warning(WARN_JAVA_TYPEMAP_DIRECTORIN_NODESC, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_DIRECTORIN_NODESC, input_file, line_number,
"Missing JNI descriptor in directorin typemap defined for %s\n", SwigType_str(pt, 0)); "Missing JNI descriptor in directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = Getattr(p, "tmap:directorin:next"); p = Getattr(p, "tmap:directorin:next");
} }
@ -3630,7 +3639,8 @@ public:
Delete(tp); Delete(tp);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, "No jni typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, "No jni typemap defined for %s for use in %s::%s (skipping director method)\n",
SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
p = nextSibling(p); p = nextSibling(p);
} }
@ -3742,8 +3752,8 @@ public:
Printf(w->code, "%s\n", tm); Printf(w->code, "%s\n", tm);
} else { } else {
Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number, Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number,
"Unable to use return type %s in director method %s::%s (skipping method).\n", SwigType_str(returntype, 0), "Unable to use return type %s used in %s::%s (skipping director method)\n",
SwigType_namestr(c_classname), SwigType_namestr(name)); SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false; output_director = false;
} }

View file

@ -195,7 +195,11 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
String *type = Getattr(p, "type"); String *type = Getattr(p, "type");
/* default values only emitted if in compact default args mode */ /* default values only emitted if in compact default args mode */
String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0; String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0;
SwigType *altty = SwigType_alttype(type, 0);
/* When using compactdefaultargs, the code generated initialises a variable via a constructor call that accepts the
* default value as a parameter. The default constructor is not called and therefore SwigValueWrapper is not needed. */
SwigType *altty = pvalue ? 0 : SwigType_alttype(type, 0);
int tycode = SwigType_type(type); int tycode = SwigType_type(type);
if (tycode == T_REFERENCE) { if (tycode == T_REFERENCE) {
if (pvalue) { if (pvalue) {