[vtk-developers] vtkTclUtil.cxx

Sebastien BARRE sebastien.barre at kitware.com
Wed Sep 18 09:04:12 EDT 2002


At 9/18/2002 08:41 AM, Lorensen, William E (Research) wrote:
>I can modify the #if to run on the alpha as follows:
>
>#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4 && 
>TCL_RELEASE_LEVEL != TCL_ALPHA_RELEASE)

Bill, I forgot to mention that:

>C interface incompatibilities in Tcl/Tk:

[...]

>   * The C interface has been fully CONST-ified.  That is, wherever a
>     function accepts an argument or returns a result that is intended to be
>     a read-only string, it now has type (const char *) even where prior
>     releases of Tcl/Tk had type (char *).  This causes some source
>     incompatibilities.  #define USE_NON_CONST will restore an interface
>     that is source-compatible with Tcl 8.3.  See TIP 27 and
>     http://wiki.tcl.tk/3669 for more information.

I'm not in favor for using USE_NON_CONST though, I think we should support 
the new API whether or not someone choose to use USE_NON_CONST (especially 
in CMake), BUT on the other hand the right way to do it in our case (i.e. 
8.x + 8.4 + pre-8.4 support) seems to be the "Option 4" described at the 
end of this "Migration" link http://wiki.tcl.tk/3669 :

replace (in VTK code):

#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)
                                  const
#endif

by:

#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4) && 
(TCL_RELEASE_LEVEL >= TCL_FINAL_RELEASE)
         CONST84
#endif

and in CMake (cmVTKWrapTclCommand):

replace:

           "#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)\n"
           "  typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp 
*,int, CONST char *[]);\n"
           "#else\n"
           "  typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp 
*,int, char *[]);\n"
           "#endif\n"

by:

           "#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4) && 
(TCL_RELEASE_LEVEL >= TCL_FINAL_RELEASE)\n"
           "  typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp 
*,int, CONST84 char *[]);\n"
           "#else\n"
           "  typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp 
*,int, char *[]);\n"
           "#endif\n"

CONST84 is #define'd according to USE_NON_CONST, so the new syntax should 
support both.

Can you test that ?
I've no alpha/beta + unix at hand.
Thanks


--
Sebastien Barre




More information about the vtk-developers mailing list