diff --git a/CHANGES.current b/CHANGES.current index 8661489a0..f6906e0a3 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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. diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html index 04959de5f..2c02a9b34 100644 --- a/Doc/Manual/Tcl.html +++ b/Doc/Manual/Tcl.html @@ -66,6 +66,7 @@ +
  • Tcl/Tk Stubs @@ -3409,5 +3410,26 @@ short, but clever Tcl script can be combined with SWIG to do many interesting things.

    +

    33.10 Tcl/Tk Stubs

    + +

    +For background information about the Tcl Stubs feature, see +http://www.tcl.tk/doc/howto/stubs.html. +

    + +

    +As of SWIG 1.3.10, the generated C/C++ wrapper will use the Tcl Stubs +feature if compiled with -DUSE_TCL_STUBS. +

    + +

    +As of SWIG 1.3.40, the generated C/C++ wrapper will use the Tk Stubs +feature if compiled with -DUSE_TK_STUBS. Also, you can override +the minimum version to support which is passed to Tcl_InitStubs() +and Tk_InitStubs() with -DSWIG_TCL_STUBS_VERSION="8.3" +or the version being compiled with using +-DSWIG_TCL_STUBS_VERSION=TCL_VERSION. +

    + diff --git a/Lib/tcl/tclinit.swg b/Lib/tcl/tclinit.swg index 93d984ae2..6910d3c51 100644 --- a/Lib/tcl/tclinit.swg +++ b/Lib/tcl/tclinit.swg @@ -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