[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.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11353 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2009-07-03 14:17:03 +00:00
commit 7f5586a370
3 changed files with 42 additions and 1 deletions

View file

@ -1,6 +1,12 @@
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.

View file

@ -66,6 +66,7 @@
<ul>
<li><a href="#Tcl_nn45">Proxy classes</a>
</ul>
<li><a href="#Tcl_nn46">Tcl/Tk Stubs</a>
</ul>
</div>
<!-- INDEX -->
@ -3409,5 +3410,26 @@ short, but clever Tcl script can be combined with SWIG to do many
interesting things.
</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>
</html>

View file

@ -22,6 +22,11 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *);
}
#endif
/* Compatibility version for TCL stubs */
#ifndef SWIG_TCL_STUBS_VERSION
#define SWIG_TCL_STUBS_VERSION "8.1"
#endif
%}
%init %{
@ -74,10 +79,18 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *interp) {
int i;
if (interp == 0) return TCL_ERROR;
#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;
}
#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);
#ifdef SWIG_namespace