public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/plplot] rawhide: Build with Tcl/Tk 9 (rhbz#2337750)
@ 2026-08-01  3:01 Orion Poplawski
  0 siblings, 0 replies; only message in thread
From: Orion Poplawski @ 2026-08-01  3:01 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/plplot
Branch : rawhide
Commit : cc6299065637550fe66a0e4a52d95ae5dadffe0a
Author : Orion Poplawski <orion@nwra.com>
Date   : 2026-07-31T21:01:09-06:00
Stats  : +1205/-2 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/plplot/c/cc6299065637550fe66a0e4a52d95ae5dadffe0a?branch=rawhide

Log:
Build with Tcl/Tk 9 (rhbz#2337750)

---
diff --git a/plplot-tcl9.patch b/plplot-tcl9.patch
new file mode 100644
index 0000000..a4b777e
--- /dev/null
+++ b/plplot-tcl9.patch
@@ -0,0 +1,1198 @@
+diff -up plplot-5.15.0/bindings/tcl/tclAPI.c.tcl9 plplot-5.15.0/bindings/tcl/tclAPI.c
+--- plplot-5.15.0/bindings/tcl/tclAPI.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/bindings/tcl/tclAPI.c	2026-07-30 17:48:31.291647796 -0600
+@@ -47,6 +47,12 @@
+ 
+ #include "tclgen.h"
+ 
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++/* Tcl 9 provides Tcl_Size directly. */
++#else
++typedef int Tcl_Size;
++#endif
++
+ // Include non-redacted API?
+ //#define PLPLOTTCLTK_NON_REDACTED_API
+ // Exclude non-redacted API?
+@@ -3840,7 +3846,7 @@ plmapCmd( ClientData PL_UNUSED( clientDa
+ //--------------------------------------------------------------------------
+ 
+ static int *
+-GetEntries( Tcl_Interp *interp, const char *string, int *n )
++GetEntries( Tcl_Interp *interp, const char *string, Tcl_Size *n )
+ {
+     tclMatrix *mati;
+     int       argc;
+@@ -3889,12 +3895,12 @@ static int
+ plmapfillCmd( ClientData PL_UNUSED( clientData ), Tcl_Interp *interp,
+               int argc, const char *argv[] )
+ {
+-    PLFLT  minlong, maxlong, minlat, maxlat;
+-    PLINT  transform;
+-    PLINT  idxname;
+-    PLINT  *entries;
+-    PLINT  nentries;
+-    double dminlong;
++    PLFLT    minlong, maxlong, minlat, maxlat;
++    PLINT    transform;
++    PLINT    idxname;
++    PLINT    *entries;
++    Tcl_Size nentries;
++    double   dminlong;
+ 
+     return_code = TCL_OK;
+ 
+@@ -4001,12 +4007,12 @@ static int
+ plmaplineCmd( ClientData PL_UNUSED( clientData ), Tcl_Interp *interp,
+               int argc, const char *argv[] )
+ {
+-    PLFLT  minlong, maxlong, minlat, maxlat;
+-    PLINT  transform;
+-    PLINT  idxname;
+-    PLINT  *entries;
+-    PLINT  nentries;
+-    double dminlong;
++    PLFLT    minlong, maxlong, minlat, maxlat;
++    PLINT    transform;
++    PLINT    idxname;
++    PLINT    *entries;
++    Tcl_Size nentries;
++    double   dminlong;
+ 
+     return_code = TCL_OK;
+ 
+@@ -4120,7 +4126,7 @@ plmapstringCmd( ClientData PL_UNUSED( cl
+     PLINT      transform;
+     PLINT      idxname;
+     PLINT      *entries;
+-    PLINT      nentries;
++    Tcl_Size   nentries;
+     const char *string;
+     double     dminlong;
+ 
+@@ -4781,7 +4787,7 @@ plstripcCmd( ClientData PL_UNUSED( clien
+     PLBOOL     y_ascl, acc;
+     PLINT      colbox, collab;
+     PLINT      colline[4], styline[4];
+-    int        nlegend;
++    Tcl_Size   nlegend;
+     const char **legline;
+     const char *labx;
+     const char *laby;
+@@ -4973,7 +4979,7 @@ plslabelfuncCmd( ClientData PL_UNUSED( c
+ // (data argument is optional)
+ //--------------------------------------------------------------------------
+ 
+-static int *argv_to_ints( Tcl_Interp *interp, const char *list_numbers, int *number )
++static int *argv_to_ints( Tcl_Interp *interp, const char *list_numbers, Tcl_Size *number )
+ {
+     int     i, retcode;
+     int     *array;
+@@ -5000,7 +5006,7 @@ static int *argv_to_ints( Tcl_Interp *in
+     return array;
+ }
+ 
+-static PLFLT *argv_to_PLFLTs( Tcl_Interp *interp, const char *list_numbers, int *number )
++static PLFLT *argv_to_PLFLTs( Tcl_Interp *interp, const char *list_numbers, Tcl_Size *number )
+ {
+     int     i, retcode;
+     PLFLT   *array;
+@@ -5029,15 +5035,15 @@ static PLFLT *argv_to_PLFLTs( Tcl_Interp
+     return array;
+ }
+ 
+-static char **argv_to_chars( Tcl_Interp *interp, const char *list_strings, int *number )
++static char **argv_to_chars( Tcl_Interp *interp, const char *list_strings, Tcl_Size *number )
+ {
+-    int     i, retcode;
+-    char    **array;
+-    char    *string;
+-    int     length;
+-    int     idx;
+-    Tcl_Obj *list;
+-    Tcl_Obj *elem;
++    int      i, retcode;
++    char     **array;
++    char     *string;
++    Tcl_Size length;
++    int      idx;
++    Tcl_Obj  *list;
++    Tcl_Obj  *elem;
+ 
+     list = Tcl_NewStringObj( list_strings, ( -1 ) );
+ 
+@@ -5088,9 +5094,9 @@ pllegendCmd( ClientData PL_UNUSED( clien
+     char    **text;
+     char    **symbols;
+ 
+-    int     number_opts;
+-    int     number_texts;
+-    int     dummy;
++    Tcl_Size number_opts;
++    Tcl_Size number_texts;
++    Tcl_Size dummy;
+     double  value;
+ 
+     Tcl_Obj *data[2];
+@@ -5208,24 +5214,24 @@ plcolorbarCmd( ClientData PL_UNUSED( cli
+     PLFLT     low_cap_color, high_cap_color;
+     PLINT     cont_color;
+     PLFLT     cont_width;
+-    PLINT     n_label_opts;
+-    PLINT     n_labels;
++    Tcl_Size  n_label_opts;
++    Tcl_Size  n_labels;
+     PLINT     *label_opts;
+     char      **labels;
+-    PLINT     n_axis_opts;
+-    PLINT     n_ticks;
+-    PLINT     n_sub_ticks;
++    Tcl_Size  n_axis_opts;
++    Tcl_Size  n_ticks;
++    Tcl_Size  n_sub_ticks;
+     PLINT     n_axes;
+     char      **axis_opts;
+     PLFLT     *ticks;
+     PLINT     *sub_ticks;
+     Tcl_Obj   *list_vectors;
+-    int       n_vectors;
++    Tcl_Size  n_vectors;
+     PLINT     *vector_sizes;
+     PLFLT     **vector_values;
+     int       retcode;
+     int       i;
+-    int       length;
++    Tcl_Size  length;
+     Tcl_Obj   *vector;
+     tclMatrix *vectorPtr;
+ 
+diff -up plplot-5.15.0/bindings/tcl/tclMain.c.tcl9 plplot-5.15.0/bindings/tcl/tclMain.c
+--- plplot-5.15.0/bindings/tcl/tclMain.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/bindings/tcl/tclMain.c	2026-07-30 17:48:31.292462773 -0600
+@@ -48,6 +48,12 @@
+ // Required for definition of PL_UNUSED macro
+ #include "plplotP.h"
+ 
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++/* Tcl 9 provides Tcl_Size directly. */
++#else
++typedef int Tcl_Size;
++#endif
++
+ #define TclFormatInt( buf, n )    sprintf( ( buf ), "%ld", (long) ( n ) )
+ 
+ # undef TCL_STORAGE_CLASS
+@@ -74,8 +80,8 @@
+ // on some systems, so it's better just to leave it out.
+ //
+ 
+-extern int isatty _ANSI_ARGS_( ( int fd ) );
+-extern char *           strcpy _ANSI_ARGS_( ( char *dst, CONST char *src ) );
++extern int isatty ( int fd );
++extern char *           strcpy ( char *dst, const char *src );
+ 
+ static const char *tclStartupScriptFileName = NULL;
+ 
+@@ -217,7 +223,8 @@ pltclMain( int argc, char **argv, char *
+     Tcl_Obj     *resultPtr;
+     Tcl_Obj     *commandPtr = NULL;
+     char        buffer[1000], *args;
+-    int         code, gotPartial, tty, length;
++    int         code, gotPartial, tty;
++    Tcl_Size    length;
+     int         exitCode = 0;
+     Tcl_Channel inChannel, outChannel, errChannel;
+     Tcl_Interp  *interp;
+@@ -251,7 +258,7 @@ pltclMain( int argc, char **argv, char *
+             argv++;
+         }
+     }
+-    args = Tcl_Merge( argc - 1, ( CONST char * CONST * )argv + 1 );
++    args = Tcl_Merge( argc - 1, ( const char * const * )argv + 1 );
+     Tcl_ExternalToUtfDString( NULL, args, -1, &argString );
+     Tcl_SetVar( interp, "argv", Tcl_DStringValue( &argString ), TCL_GLOBAL_ONLY );
+     Tcl_DStringFree( &argString );
+diff -up plplot-5.15.0/bindings/tcl/tclMatrix.c.tcl9 plplot-5.15.0/bindings/tcl/tclMatrix.c
+--- plplot-5.15.0/bindings/tcl/tclMatrix.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/bindings/tcl/tclMatrix.c	2026-07-30 17:48:31.292884588 -0600
+@@ -40,6 +40,12 @@
+ #include "pldll.h"
+ #include "tclMatrix.h"
+ 
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++/* Tcl 9 provides Tcl_Size directly. */
++#else
++typedef int Tcl_Size;
++#endif
++
+ // Cool math macros
+ 
+ #ifndef MAX
+@@ -513,7 +519,7 @@ static int MatrixAssign( Tcl_Interp* int
+     static int verbose = 0;
+ 
+     const char ** newargs;
+-    int        numnewargs;
++    Tcl_Size   numnewargs;
+     int        i;
+ 
+     if ( verbose )
+diff -up plplot-5.15.0/bindings/tk/plframe.c.tcl9 plplot-5.15.0/bindings/tk/plframe.c
+--- plplot-5.15.0/bindings/tk/plframe.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/bindings/tk/plframe.c	2026-07-30 18:35:39.337998536 -0600
+@@ -209,29 +209,29 @@ typedef struct
+ 
+ static Tk_ConfigSpec configSpecs[] = {
+     { TK_CONFIG_BORDER,        "-background",     "background",     "Background",
+-      DEF_PLFRAME_BG_COLOR, Tk_Offset( PlFrame, border ),
++      DEF_PLFRAME_BG_COLOR, offsetof( PlFrame, border ),
+       TK_CONFIG_COLOR_ONLY, NULL },
+ //
+ //  {TK_CONFIG_COLOR, (char *) NULL, (char *) NULL, (char *) NULL,
+-//      (char *) NULL, Tk_Offset(PlFrame, bgColor),
++//      (char *) NULL, offsetof(PlFrame, bgColor),
+ //      TK_CONFIG_COLOR_ONLY},
+ //
+ #ifndef MAC_TCL
+     { TK_CONFIG_COLOR,         "-plbg",           "plbackground",   "Plbackground",
+-      DEF_PLFRAME_BG_COLOR, Tk_Offset( PlFrame, bgColor ),
++      DEF_PLFRAME_BG_COLOR, offsetof( PlFrame, bgColor ),
+       TK_CONFIG_COLOR_ONLY, NULL },
+ #endif
+     { TK_CONFIG_BORDER,        "-background",     "background",     "Background",
+-      DEF_PLFRAME_BG_MONO, Tk_Offset( PlFrame, border ),
++      DEF_PLFRAME_BG_MONO, offsetof( PlFrame, border ),
+       TK_CONFIG_MONO_ONLY, NULL },
+ //
+ //  {TK_CONFIG_COLOR, (char *) NULL, (char *) NULL, (char *) NULL,
+-//      (char *) NULL, Tk_Offset(PlFrame, bgColor),
++//      (char *) NULL, offsetof(PlFrame, bgColor),
+ //      TK_CONFIG_MONO_ONLY},
+ //
+ #ifndef MAC_TCL
+     { TK_CONFIG_COLOR,         "-plbg",           (char *) NULL,    (char *) NULL,
+-      DEF_PLFRAME_BG_MONO, Tk_Offset( PlFrame, bgColor ),
++      DEF_PLFRAME_BG_MONO, offsetof( PlFrame, bgColor ),
+       TK_CONFIG_MONO_ONLY, NULL },
+ #endif
+     { TK_CONFIG_SYNONYM,       "-bd",             "borderWidth",    (char *) NULL,
+@@ -239,27 +239,27 @@ static Tk_ConfigSpec configSpecs[] = {
+     { TK_CONFIG_SYNONYM,       "-bg",             "background",     (char *) NULL,
+       (char *) NULL, 0, 0, NULL },
+     { TK_CONFIG_PIXELS,        "-borderwidth",    "borderWidth",    "BorderWidth",
+-      DEF_PLFRAME_BORDER_WIDTH, Tk_Offset( PlFrame, borderWidth ), 0, NULL },
++      DEF_PLFRAME_BORDER_WIDTH, offsetof( PlFrame, borderWidth ), 0, NULL },
+     { TK_CONFIG_ACTIVE_CURSOR, "-cursor",         "cursor",         "Cursor",
+-      DEF_PLFRAME_CURSOR, Tk_Offset( PlFrame, cursor ), TK_CONFIG_NULL_OK, NULL },
++      DEF_PLFRAME_CURSOR, offsetof( PlFrame, cursor ), TK_CONFIG_NULL_OK, NULL },
+     { TK_CONFIG_STRING,        "-bopcmd",         "bopcmd",         "PgCommand",
+-      (char *) NULL, Tk_Offset( PlFrame, bopCmd ), TK_CONFIG_NULL_OK, NULL },
++      (char *) NULL, offsetof( PlFrame, bopCmd ), TK_CONFIG_NULL_OK, NULL },
+     { TK_CONFIG_STRING,        "-eopcmd",         "eopcmd",         "PgCommand",
+-      (char *) NULL, Tk_Offset( PlFrame, eopCmd ), TK_CONFIG_NULL_OK, NULL },
++      (char *) NULL, offsetof( PlFrame, eopCmd ), TK_CONFIG_NULL_OK, NULL },
+     { TK_CONFIG_PIXELS,        "-height",         "height",         "Height",
+-      DEF_PLFRAME_HEIGHT, Tk_Offset( PlFrame, height ), 0, NULL },
++      DEF_PLFRAME_HEIGHT, offsetof( PlFrame, height ), 0, NULL },
+     { TK_CONFIG_RELIEF,        "-relief",         "relief",         "Relief",
+-      DEF_PLFRAME_RELIEF, Tk_Offset( PlFrame, relief ), 0, NULL },
++      DEF_PLFRAME_RELIEF, offsetof( PlFrame, relief ), 0, NULL },
+     { TK_CONFIG_PIXELS,        "-width",          "width",          "Width",
+-      DEF_PLFRAME_WIDTH, Tk_Offset( PlFrame, width ), 0, NULL },
++      DEF_PLFRAME_WIDTH, offsetof( PlFrame, width ), 0, NULL },
+     { TK_CONFIG_BOOLEAN,       "-xhairs",         (char *) NULL,    (char *) NULL,
+-      "0", Tk_Offset( PlFrame, xhairs ), TK_CONFIG_DONT_SET_DEFAULT, NULL },
++      "0", offsetof( PlFrame, xhairs ), TK_CONFIG_DONT_SET_DEFAULT, NULL },
+     { TK_CONFIG_BOOLEAN,       "-rubberband",     (char *) NULL,    (char *) NULL,
+-      "0", Tk_Offset( PlFrame, rband ), TK_CONFIG_DONT_SET_DEFAULT, NULL },
++      "0", offsetof( PlFrame, rband ), TK_CONFIG_DONT_SET_DEFAULT, NULL },
+     { TK_CONFIG_STRING,        "-xscrollcommand", "xScrollCommand", "ScrollCommand",
+-      (char *) NULL, Tk_Offset( PlFrame, xScrollCmd ), TK_CONFIG_NULL_OK, NULL },
++      (char *) NULL, offsetof( PlFrame, xScrollCmd ), TK_CONFIG_NULL_OK, NULL },
+     { TK_CONFIG_STRING,        "-yscrollcommand", "yScrollCommand", "ScrollCommand",
+-      (char *) NULL, Tk_Offset( PlFrame, yScrollCmd ), TK_CONFIG_NULL_OK, NULL },
++      (char *) NULL, offsetof( PlFrame, yScrollCmd ), TK_CONFIG_NULL_OK, NULL },
+     { TK_CONFIG_END,           (char *) NULL,     (char *) NULL,    (char *) NULL,
+       (char *) NULL, 0, 0, NULL }
+ };
+@@ -272,8 +272,8 @@ int   plFrameCmd( ClientData, Tcl_Interp
+ 
+ // These are invoked by the TK dispatcher
+ 
+-#if TK_MAJOR_VERSION < 4 || ( TK_MAJOR_VERSION == 4 && TK_MINOR_VERSION == 0 )
+-#define FreeProcArg    ClientData
++#if TK_MAJOR_VERSION >= 9
++#define FreeProcArg    void *
+ #else
+ #define FreeProcArg    char *
+ #endif
+@@ -547,7 +547,7 @@ PlFrameWidgetCmd( ClientData clientData,
+             argv[0], " option ?arg arg ...?\"", (char *) NULL );
+         return TCL_ERROR;
+     }
+-    Tk_Preserve( (ClientData) plFramePtr );
++    Tcl_Preserve( (ClientData) plFramePtr );
+     c      = argv[1][0];
+     length = (int) strlen( argv[1] );
+ 
+@@ -816,7 +816,7 @@ PlFrameWidgetCmd( ClientData clientData,
+ #endif
+ 
+ done:
+-    Tk_Release( (ClientData) plFramePtr );
++    Tcl_Release( (ClientData) plFramePtr );
+     return result;
+ }
+ 
+@@ -825,7 +825,7 @@ done:
+ //
+ // DestroyPlFrame --
+ //
+-//	This procedure is invoked by Tk_EventuallyFree or Tk_Release to
++//	This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
+ //	clean up the internal structure of a plframe at a safe time
+ //	(when no-one is using it anymore).
+ //
+@@ -941,7 +941,7 @@ PlFrameConfigureEH( ClientData clientDat
+         plFramePtr->height = Tk_Height( tkwin );
+         if ( ( tkwin != NULL ) && !( plFramePtr->flags & REFRESH_PENDING ) )
+         {
+-            Tk_DoWhenIdle( DisplayPlFrame, (ClientData) plFramePtr );
++            Tcl_DoWhenIdle( DisplayPlFrame, (ClientData) plFramePtr );
+             plFramePtr->flags |= REFRESH_PENDING;
+             plFramePtr->flags |= UPDATE_V_SCROLLBAR | UPDATE_H_SCROLLBAR;
+         }
+@@ -958,16 +958,16 @@ PlFrameConfigureEH( ClientData clientDat
+         plFramePtr->tkwin = NULL;
+         if ( plFramePtr->flags & REFRESH_PENDING )
+         {
+-            Tk_CancelIdleCall( DisplayPlFrame, (ClientData) plFramePtr );
++            Tcl_CancelIdleCall( DisplayPlFrame, (ClientData) plFramePtr );
+         }
+-        Tk_EventuallyFree( (ClientData) plFramePtr, DestroyPlFrame );
++        Tcl_EventuallyFree( (ClientData) plFramePtr, DestroyPlFrame );
+         break;
+ 
+     case MapNotify:
+         pldebug( "PLFrameConfigureEH", "MapNotify\n" );
+         if ( plFramePtr->flags & REFRESH_PENDING )
+         {
+-            Tk_CancelIdleCall( DisplayPlFrame, (ClientData) plFramePtr );
++            Tcl_CancelIdleCall( DisplayPlFrame, (ClientData) plFramePtr );
+         }
+ 
+         // For some reason, "." must be mapped or PlFrameInit will die (Note:
+@@ -979,7 +979,7 @@ PlFrameConfigureEH( ClientData clientDat
+         {
+             Tcl_VarEval( plFramePtr->interp, "update", (char *) NULL );
+         }
+-        Tk_DoWhenIdle( PlFrameInit, (ClientData) plFramePtr );
++        Tcl_DoWhenIdle( PlFrameInit, (ClientData) plFramePtr );
+         break;
+     }
+ }
+@@ -1044,7 +1044,7 @@ PlFrameExposeEH( ClientData clientData,
+     {
+         if ( ( tkwin != NULL ) && !( plFramePtr->flags & REFRESH_PENDING ) )
+         {
+-            Tk_DoWhenIdle( DisplayPlFrame, (ClientData) plFramePtr );
++            Tcl_DoWhenIdle( DisplayPlFrame, (ClientData) plFramePtr );
+             plFramePtr->width  = Tk_Width( tkwin );
+             plFramePtr->height = Tk_Height( tkwin );
+             plFramePtr->flags |= REFRESH_PENDING;
+@@ -1735,7 +1735,7 @@ DisplayPlFrame( ClientData clientData )
+         {
+             plFramePtr->flags |= REFRESH_PENDING;
+             plFramePtr->flags &= ~RESIZE_PENDING;
+-            Tk_DoWhenIdle( DisplayPlFrame, clientData );
++            Tcl_DoWhenIdle( DisplayPlFrame, clientData );
+             return;
+         }
+ 
+@@ -2222,25 +2222,59 @@ Cmd( Tcl_Interp *interp, register PlFram
+ //
+ //--------------------------------------------------------------------------
+ //
+-// ConfigurePlFrame --
++// ConfigureWidgetCompat --
+ //
+-//	This procedure is called to process an argv/argc list, plus the Tk
+-//	option database, in order to configure (or reconfigure) a
+-//	plframe widget.
+-//
+-// Results:
+-//	The return value is a standard Tcl result.  If TCL_ERROR is
+-//	returned, then interp->result contains an error message.
+-//
+-// Side effects:
+-//	Configuration information, such as text string, colors, font, etc.
+-//	get set for plFramePtr; old resources get freed, if there were
+-//	any.
++//	Compatibility wrapper for Tk_ConfigureWidget.  Tk 9 expects the
++//	argument vector as Tcl_Obj pointers rather than string pointers.
+ //
+ //--------------------------------------------------------------------------
+ //
+ 
+ static int
++ConfigureWidgetCompat( Tcl_Interp *interp, Tk_Window tkwin,
++                        const Tk_ConfigSpec *configSpecs,
++                        int argc, const char **argv, char *widgRec, int flags )
++{
++#if TK_MAJOR_VERSION >= 9
++    Tcl_Obj **objv = NULL;
++    int i;
++    int result;
++
++    if ( argc > 0 )
++    {
++        objv = (Tcl_Obj **) Tcl_Alloc( (size_t) argc * sizeof( Tcl_Obj * ) );
++        if ( objv == NULL )
++        {
++            Tcl_SetResult( interp, "out of memory", TCL_STATIC );
++            return TCL_ERROR;
++        }
++
++        for ( i = 0; i < argc; i++ )
++        {
++            objv[i] = Tcl_NewStringObj( argv[i], -1 );
++        }
++    }
++
++    result = Tk_ConfigureWidget( interp, tkwin, configSpecs, argc,
++        (Tcl_Obj *const *) objv, widgRec, flags );
++
++    if ( objv != NULL )
++    {
++        for ( i = 0; i < argc; i++ )
++        {
++            Tcl_DecrRefCount( objv[i] );
++        }
++        Tcl_Free( (char *) objv );
++    }
++
++    return result;
++#else
++    return Tk_ConfigureWidget( interp, tkwin, configSpecs, argc, argv,
++        widgRec, flags );
++#endif
++}
++
++static int
+ ConfigurePlFrame( Tcl_Interp *interp, register PlFrame *plFramePtr,
+                   int argc, const char **argv, int flags )
+ {
+@@ -2267,8 +2301,8 @@ ConfigurePlFrame( Tcl_Interp *interp, re
+ 
+     dbug_enter( "ConfigurePlFrame" );
+ 
+-    if ( Tk_ConfigureWidget( interp, tkwin, configSpecs,
+-             argc, (CONST char **) argv, (char *) plFramePtr, flags ) != TCL_OK )
++    if ( ConfigureWidgetCompat( interp, tkwin, configSpecs,
++             argc, (const char **) argv, (char *) plFramePtr, flags ) != TCL_OK )
+     {
+         return TCL_ERROR;
+     }
+@@ -2347,7 +2381,7 @@ ConfigurePlFrame( Tcl_Interp *interp, re
+     if ( need_redisplay && Tk_IsMapped( tkwin )
+          && !( plFramePtr->flags & REFRESH_PENDING ) )
+     {
+-        Tk_DoWhenIdle( DisplayPlFrame, (ClientData) plFramePtr );
++        Tcl_DoWhenIdle( DisplayPlFrame, (ClientData) plFramePtr );
+         plFramePtr->flags |= REFRESH_PENDING;
+         plFramePtr->flags |= UPDATE_V_SCROLLBAR | UPDATE_H_SCROLLBAR;
+     }
+@@ -2614,16 +2648,27 @@ Openlink( Tcl_Interp *interp, register P
+     ( TK_MAJOR_VERSION == 4 && TK_MINOR_VERSION == 0 ) || \
+     TK_MAJOR_VERSION > 7
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
+-    Tk_CreateFileHandler( iodev->fd, TK_READABLE, (Tk_FileProc *) ReadData,
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++    Tcl_CreateFileHandler( iodev->fd, TCL_READABLE, (Tcl_FileProc *) ReadData,
++        (void *) plFramePtr );
++#else
++    Tcl_CreateFileHandler( iodev->fd, TCL_READABLE, (Tcl_FileProc *) ReadData,
+         (ClientData) plFramePtr );
+ #endif
++#endif
+ #else
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++    Tcl_CreateFileHandler( Tcl_GetFile( (ClientData) iodev->fd, TCL_UNIX_FD ),
++        TCL_READABLE, (Tcl_FileProc *) ReadData,
++        (void *) plFramePtr );
++#else
+     Tcl_CreateFileHandler( Tcl_GetFile( (ClientData) iodev->fd, TCL_UNIX_FD ),
+-        TK_READABLE, (Tk_FileProc *) ReadData,
++        TCL_READABLE, (Tcl_FileProc *) ReadData,
+         (ClientData) plFramePtr );
+ #endif
+ #endif
++#endif
+ 
+     return TCL_OK;
+ }
+@@ -2654,7 +2699,7 @@ Closelink( Tcl_Interp *interp, register
+     ( TK_MAJOR_VERSION == 4 && TK_MINOR_VERSION == 0 ) || \
+     TK_MAJOR_VERSION > 7
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
+-    Tk_DeleteFileHandler( iodev->fd );
++    Tcl_DeleteFileHandler( iodev->fd );
+ #endif
+ #else
+ //    Tk_DeleteFileHandler( iodev->file );
+@@ -2732,7 +2777,7 @@ ReadData( ClientData clientData, int mas
+     register PDFstrm    *pdfs  = plr->pdfs;
+     int result = TCL_OK;
+ 
+-    if ( mask & TK_READABLE )
++    if ( mask & TCL_READABLE )
+     {
+         // Read from FIFO or socket
+ 
+@@ -2962,7 +3007,7 @@ Redraw( Tcl_Interp *PL_UNUSED( interp ),
+     if ( ( plFramePtr->tkwin != NULL ) &&
+          !( plFramePtr->flags & REFRESH_PENDING ) )
+     {
+-        Tk_DoWhenIdle( DisplayPlFrame, (ClientData) plFramePtr );
++        Tcl_DoWhenIdle( DisplayPlFrame, (ClientData) plFramePtr );
+         plFramePtr->flags |= REFRESH_PENDING;
+     }
+ 
+@@ -3407,7 +3452,7 @@ UpdateVScrollbar( register PlFrame *plFr
+ 
+     if ( result != TCL_OK )
+     {
+-        Tk_BackgroundError( plFramePtr->interp );
++        Tcl_BackgroundError( plFramePtr->interp );
+     }
+ }
+ 
+@@ -3439,7 +3484,7 @@ UpdateHScrollbar( register PlFrame *plFr
+ 
+     if ( result != TCL_OK )
+     {
+-        Tk_BackgroundError( plFramePtr->interp );
++        Tcl_BackgroundError( plFramePtr->interp );
+     }
+ }
+ 
+diff -up plplot-5.15.0/bindings/tk/tcpip.c.tcl9 plplot-5.15.0/bindings/tk/tcpip.c
+--- plplot-5.15.0/bindings/tk/tcpip.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/bindings/tk/tcpip.c	2026-07-30 17:48:31.294075773 -0600
+@@ -595,7 +595,7 @@ readError:
+     {
+ // Exclude UNIX-only feature
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
+-        Tk_DeleteFileHandler( iodev->fd );
++        Tcl_DeleteFileHandler( iodev->fd );
+ #endif
+         close( iodev->fd );
+     }
+diff -up plplot-5.15.0/bindings/tk/tkMain.c.tcl9 plplot-5.15.0/bindings/tk/tkMain.c
+--- plplot-5.15.0/bindings/tk/tkMain.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/bindings/tk/tkMain.c	2026-07-30 17:48:31.294419781 -0600
+@@ -79,20 +79,19 @@
+ 
+ // From itkDecls.h
+ 
+-EXTERN int Itk_Init _ANSI_ARGS_( ( Tcl_Interp * interp ) );
++EXTERN int Itk_Init ( Tcl_Interp * interp );
+ 
+ // From tclIntDecls.h
+ 
+ //#ifndef Tcl_Import_TCL_DECLARED
+ #if 0
+-EXTERN int Tcl_Import _ANSI_ARGS_( ( Tcl_Interp * interp,
+-                                     Tcl_Namespace * nsPtr, char * pattern,
+-                                     int allowOverwrite ) );
++EXTERN int Tcl_Import ( Tcl_Interp * interp,
++                        Tcl_Namespace * nsPtr, char * pattern,
++                        int allowOverwrite );
+ #endif
+ 
+ #ifndef Tcl_GetGlobalNamespace_TCL_DECLARE
+-EXTERN Tcl_Namespace * Tcl_GetGlobalNamespace _ANSI_ARGS_( (
+-                                                               Tcl_Interp * interp ) );
++EXTERN Tcl_Namespace * Tcl_GetGlobalNamespace ( Tcl_Interp * interp );
+ #endif
+ 
+ //
+@@ -102,13 +101,11 @@ EXTERN Tcl_Namespace * Tcl_GetGlobalName
+ //
+ 
+ // these are defined in unistd.h, included by plplotP.h
+-// extern void		exit _ANSI_ARGS_((int status));
+-// extern int		isatty _ANSI_ARGS_((int fd));
+-// extern int		read _ANSI_ARGS_((int fd, char *buf, size_t size));
++// extern void		exit (int status);
++// extern int		isatty (int fd);
++// extern int		read (int fd, char *buf, size_t size);
+ //
+-#if !defined ( _WIN32 )
+-extern char *           strrchr _ANSI_ARGS_( ( CONST char *string, int c ) );
+-#else
++#if defined ( _WIN32 )
+ // On Windows we do not have a convenient console to work with
+ #define isatty( a )    0
+ #endif
+@@ -157,9 +154,8 @@ static Tk_ArgvInfo argTable[] = {
+ // Forward declarations for procedures defined later in this file:
+ //
+ 
+-static void Prompt _ANSI_ARGS_( ( Tcl_Interp * interploc, int partial ) );
+-static void StdinProc _ANSI_ARGS_( ( ClientData clientData,
+-                                     int mask ) );
++static void Prompt ( Tcl_Interp * interploc, int partial );
++static void StdinProc ( ClientData clientData, int mask );
+ 
+ //
+ //--------------------------------------------------------------------------
+@@ -315,7 +311,7 @@ pltkMain( int argc, const char **argv, c
+     //
+     //fprintf( stderr, "Before Tcl_Merge\n" );
+ 
+-    args = Tcl_Merge( argc - 1, ( CONST char * CONST * )argv + 1 );
++    args = Tcl_Merge( argc - 1, ( const char * const * )argv + 1 );
+     Tcl_SetVar( interp, "argv", args, TCL_GLOBAL_ONLY );
+     ckfree( args );
+     sprintf( buf, "%d", argc - 1 );
+@@ -409,7 +405,7 @@ pltkMain( int argc, const char **argv, c
+             char        *fullName;
+             FILE        *f;
+ 
+-            fullName = Tcl_TildeSubst( interp, RcFileName, &buffer );
++            fullName = Tcl_TranslateFileName( interp, RcFileName, &buffer );
+             if ( fullName == NULL )
+             {
+                 fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) );
+@@ -431,7 +427,11 @@ pltkMain( int argc, const char **argv, c
+         }
+ // Exclude UNIX-only feature
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 )
+-        Tk_CreateFileHandler( 0, TK_READABLE, StdinProc, (ClientData) 0 );
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++        Tcl_CreateFileHandler( 0, TCL_READABLE, StdinProc, (void *) 0 );
++#else
++        Tcl_CreateFileHandler( 0, TCL_READABLE, StdinProc, (ClientData) 0 );
++#endif
+ #endif
+         if ( tty )
+         {
+@@ -517,7 +517,7 @@ StdinProc( ClientData PL_UNUSED( clientD
+             else
+             {
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 )
+-                Tk_DeleteFileHandler( 0 );
++                Tcl_DeleteFileHandler( 0 );
+ #endif
+             }
+             return;
+@@ -551,11 +551,19 @@ StdinProc( ClientData PL_UNUSED( clientD
+     // command being evaluated.
+     //
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 )
+-    Tk_CreateFileHandler( 0, 0, StdinProc, (ClientData) 0 );
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++    Tcl_CreateFileHandler( 0, 0, StdinProc, (void *) 0 );
++#else
++    Tcl_CreateFileHandler( 0, 0, StdinProc, (ClientData) 0 );
++#endif
+ #endif
+     code = Tcl_RecordAndEval( interp, cmd, 0 );
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 )
+-    Tk_CreateFileHandler( 0, TK_READABLE, StdinProc, (ClientData) 0 );
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++    Tcl_CreateFileHandler( 0, TCL_READABLE, StdinProc, (void *) 0 );
++#else
++    Tcl_CreateFileHandler( 0, TCL_READABLE, StdinProc, (ClientData) 0 );
++#endif
+ #endif
+     Tcl_DStringFree( &command );
+     res = Tcl_GetStringResult( interp );
+diff -up plplot-5.15.0/bindings/tk/tkshell.c.tcl9 plplot-5.15.0/bindings/tk/tkshell.c
+--- plplot-5.15.0/bindings/tk/tkshell.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/bindings/tk/tkshell.c	2026-07-30 17:48:31.294749103 -0600
+@@ -119,7 +119,7 @@ plWait_Until( ClientData clientData, Tcl
+         if ( result )
+             break;
+ 
+-        Tk_DoOneEvent( 0 );
++        Tcl_DoOneEvent( 0 );
+     }
+     return TCL_OK;
+ }
+diff -up plplot-5.15.0/bindings/tk-x-plat/plplotter.c.tcl9 plplot-5.15.0/bindings/tk-x-plat/plplotter.c
+--- plplot-5.15.0/bindings/tk-x-plat/plplotter.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/bindings/tk-x-plat/plplotter.c	2026-07-31 19:37:47.086966918 -0600
+@@ -223,41 +223,41 @@ typedef struct PlPlotter
+ 
+ static Tk_ConfigSpec configSpecs[] = {
+     { TK_CONFIG_BOOLEAN,       "-activeplot",     (char *) NULL,    (char *) NULL,
+-      "1", Tk_Offset( PlPlotter, active_plot ), TK_CONFIG_DONT_SET_DEFAULT },
++      "1", offsetof( PlPlotter, active_plot ), TK_CONFIG_DONT_SET_DEFAULT },
+     { TK_CONFIG_BORDER,        "-background",     "background",     "Background",
+-      DEF_PLFRAME_BG_COLOR, Tk_Offset( PlPlotter, border ),
++      DEF_PLFRAME_BG_COLOR, offsetof( PlPlotter, border ),
+       TK_CONFIG_COLOR_ONLY },
+     { TK_CONFIG_BORDER,        "-background",     "background",     "Background",
+-      DEF_PLFRAME_BG_MONO, Tk_Offset( PlPlotter, border ),
++      DEF_PLFRAME_BG_MONO, offsetof( PlPlotter, border ),
+       TK_CONFIG_MONO_ONLY },
+     { TK_CONFIG_SYNONYM,       "-bd",             "borderWidth",    (char *) NULL,
+       (char *) NULL, 0, 0 },
+     { TK_CONFIG_SYNONYM,       "-bg",             "background",     (char *) NULL,
+       (char *) NULL, 0, 0 },
+     { TK_CONFIG_STRING,        "-bopcmd",         "bopcmd",         "PgCommand",
+-      (char *) NULL, Tk_Offset( PlPlotter, bopCmd ), TK_CONFIG_NULL_OK },
++      (char *) NULL, offsetof( PlPlotter, bopCmd ), TK_CONFIG_NULL_OK },
+     { TK_CONFIG_PIXELS,        "-borderwidth",    "borderWidth",    "BorderWidth",
+-      DEF_PLFRAME_BORDER_WIDTH, Tk_Offset( PlPlotter, borderWidth ), 0 },
++      DEF_PLFRAME_BORDER_WIDTH, offsetof( PlPlotter, borderWidth ), 0 },
+     { TK_CONFIG_BOOLEAN,       "-doublebuffer",   (char *) NULL,    (char *) NULL,
+-      "0", Tk_Offset( PlPlotter, double_buffer ), TK_CONFIG_DONT_SET_DEFAULT },
++      "0", offsetof( PlPlotter, double_buffer ), TK_CONFIG_DONT_SET_DEFAULT },
+     { TK_CONFIG_ACTIVE_CURSOR, "-cursor",         "cursor",         "Cursor",
+-      DEF_PLFRAME_CURSOR, Tk_Offset( PlPlotter, cursor ), TK_CONFIG_NULL_OK },
++      DEF_PLFRAME_CURSOR, offsetof( PlPlotter, cursor ), TK_CONFIG_NULL_OK },
+     { TK_CONFIG_STRING,        "-eopcmd",         "eopcmd",         "PgCommand",
+-      (char *) NULL, Tk_Offset( PlPlotter, eopCmd ), TK_CONFIG_NULL_OK },
++      (char *) NULL, offsetof( PlPlotter, eopCmd ), TK_CONFIG_NULL_OK },
+     { TK_CONFIG_PIXELS,        "-height",         "height",         "Height",
+-      DEF_PLFRAME_HEIGHT, Tk_Offset( PlPlotter, height ), 0 },
++      DEF_PLFRAME_HEIGHT, offsetof( PlPlotter, height ), 0 },
+     { TK_CONFIG_RELIEF,        "-relief",         "relief",         "Relief",
+-      DEF_PLFRAME_RELIEF, Tk_Offset( PlPlotter, relief ), 0 },
++      DEF_PLFRAME_RELIEF, offsetof( PlPlotter, relief ), 0 },
+     { TK_CONFIG_PIXELS,        "-width",          "width",          "Width",
+-      DEF_PLFRAME_WIDTH, Tk_Offset( PlPlotter, width ), 0 },
++      DEF_PLFRAME_WIDTH, offsetof( PlPlotter, width ), 0 },
+     { TK_CONFIG_BOOLEAN,       "-xhairs",         (char *) NULL,    (char *) NULL,
+-      "0", Tk_Offset( PlPlotter, xhairs ), TK_CONFIG_DONT_SET_DEFAULT },
++      "0", offsetof( PlPlotter, xhairs ), TK_CONFIG_DONT_SET_DEFAULT },
+     { TK_CONFIG_BOOLEAN,       "-rubberband",     (char *) NULL,    (char *) NULL,
+-      "0", Tk_Offset( PlPlotter, rband ), TK_CONFIG_DONT_SET_DEFAULT },
++      "0", offsetof( PlPlotter, rband ), TK_CONFIG_DONT_SET_DEFAULT },
+     { TK_CONFIG_STRING,        "-xscrollcommand", "xScrollCommand", "ScrollCommand",
+-      (char *) NULL, Tk_Offset( PlPlotter, xScrollCmd ), TK_CONFIG_NULL_OK },
++      (char *) NULL, offsetof( PlPlotter, xScrollCmd ), TK_CONFIG_NULL_OK },
+     { TK_CONFIG_STRING,        "-yscrollcommand", "yScrollCommand", "ScrollCommand",
+-      (char *) NULL, Tk_Offset( PlPlotter, yScrollCmd ), TK_CONFIG_NULL_OK },
++      (char *) NULL, offsetof( PlPlotter, yScrollCmd ), TK_CONFIG_NULL_OK },
+     { TK_CONFIG_END,           (char *) NULL,     (char *) NULL,    (char *) NULL,
+       (char *) NULL, 0, 0 }
+ };
+@@ -282,27 +282,27 @@ static void  PlPlotterMotionEH( ClientDa
+ static void  PlPlotterEnterEH( ClientData, register XEvent * );
+ static void  PlPlotterLeaveEH( ClientData, register XEvent * );
+ static void  PlPlotterButtonPressEH( ClientData clientData, register XEvent * );
+-static int   PlPlotterWidgetCmd( ClientData, Tcl_Interp *, int, CONST char ** );
++static int   PlPlotterWidgetCmd( ClientData, Tcl_Interp *, int, const char ** );
+ static int   ReadData( ClientData, int );
+ static void  Install_cmap( PlPlotter *plPlotterPtr );
+ 
+ // These are invoked by PlPlotterWidgetCmd to process widget commands
+ 
+-static int   Closelink( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   Cmd( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   ConfigurePlPlotter( Tcl_Interp *, PlPlotter *, int, CONST char **, int );
+-static int   Draw( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   Info( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   Openlink( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   Orient( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   Page( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   NextPage( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   Print( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   Redraw( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   Save( Tcl_Interp *, PlPlotter *, int, CONST char ** );
+-static int   View( Tcl_Interp *, PlPlotter *, int, CONST char ** );
++static int   Closelink( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   Cmd( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   ConfigurePlPlotter( Tcl_Interp *, PlPlotter *, int, const char **, int );
++static int   Draw( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   Info( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   Openlink( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   Orient( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   Page( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   NextPage( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   Print( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   Redraw( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   Save( Tcl_Interp *, PlPlotter *, int, const char ** );
++static int   View( Tcl_Interp *, PlPlotter *, int, const char ** );
+ static int   Scroll( Tcl_Interp *, PlPlotter * );
+-static int   report( Tcl_Interp *, PlPlotter *, int, CONST char ** );
++static int   report( Tcl_Interp *, PlPlotter *, int, const char ** );
+ 
+ // Routines for manipulating graphic crosshairs
+ 
+@@ -321,7 +321,7 @@ static void  UpdateRband( PlPlotter * );
+ 
+ // Utility routines
+ 
+-static void  gbox( PLFLT *, PLFLT *, PLFLT *, PLFLT *, CONST char ** );
++static void  gbox( PLFLT *, PLFLT *, PLFLT *, PLFLT *, const char ** );
+ static void  UpdateVScrollbar( register PlPlotter * );
+ static void  UpdateHScrollbar( register PlPlotter * );
+ 
+@@ -467,7 +467,7 @@ plPlotterCmd( ClientData PL_UNUSED( clie
+ // for active plot
+     ActiveState( plPlotterPtr, 1 );
+ 
+-    if ( ConfigurePlPlotter( interp, plPlotterPtr, argc - 2, (CONST char **) argv + 2, 0 ) != TCL_OK )
++    if ( ConfigurePlPlotter( interp, plPlotterPtr, argc - 2, (const char **) argv + 2, 0 ) != TCL_OK )
+     {
+         Tk_DestroyWindow( plPlotterPtr->tkwin );
+         return TCL_ERROR;
+@@ -501,7 +501,7 @@ plPlotterCmd( ClientData PL_UNUSED( clie
+ 
+ static int
+ PlPlotterWidgetCmd( ClientData clientData, Tcl_Interp *interp,
+-                    int argc, CONST char **argv )
++                    int argc, const char **argv )
+ {
+     register PlPlotter *plPlotterPtr = (PlPlotter *) clientData;
+     int  result = TCL_OK;
+@@ -516,7 +516,7 @@ PlPlotterWidgetCmd( ClientData clientDat
+             argv[0], " option ?arg arg ...?\"", (char *) NULL );
+         return TCL_ERROR;
+     }
+-    Tk_Preserve( (ClientData) plPlotterPtr );
++    Tcl_Preserve( (ClientData) plPlotterPtr );
+     c      = argv[1][0];
+     length = (int) strlen( argv[1] );
+ 
+@@ -781,7 +781,7 @@ PlPlotterWidgetCmd( ClientData clientDat
+     }
+ 
+ done:
+-    Tk_Release( (ClientData) plPlotterPtr );
++    Tcl_Release( (ClientData) plPlotterPtr );
+     return result;
+ }
+ 
+@@ -790,7 +790,7 @@ done:
+ //
+ // DestroyPlPlotter --
+ //
+-//      This procedure is invoked by Tk_EventuallyFree or Tk_Release to
++//      This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
+ //      clean up the internal structure of a plframe at a safe time
+ //      (when no-one is using it anymore).
+ //
+@@ -918,7 +918,7 @@ PlPlotterConfigureEH( ClientData clientD
+         {
+             Tcl_CancelIdleCall( DisplayPlPlotter, (ClientData) plPlotterPtr );
+         }
+-        Tk_EventuallyFree( (ClientData) plPlotterPtr, (Tcl_FreeProc *) DestroyPlPlotter );
++        Tcl_EventuallyFree( (ClientData) plPlotterPtr, (Tcl_FreeProc *) DestroyPlPlotter );
+         break;
+ 
+     case MapNotify:
+@@ -1610,7 +1610,7 @@ DisplayPlPlotter( ClientData clientData
+ 
+ static int
+ scol0( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-       int i, CONST char *col, int *p_changed )
++       int i, const char *col, int *p_changed )
+ {
+     PLStream *pls = plPlotterPtr->pls;
+     XColor   xcol;
+@@ -1656,7 +1656,7 @@ scol0( Tcl_Interp *interp, register PlPl
+ 
+ static int
+ scol1( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-       int i, CONST char *col, CONST char *pos, CONST char *rev, int *p_changed )
++       int i, const char *col, const char *pos, const char *rev, int *p_changed )
+ {
+     PLStream *pls = plPlotterPtr->pls;
+     XColor   xcol;
+@@ -1727,7 +1727,7 @@ scol1( Tcl_Interp *interp, register PlPl
+ 
+ static int
+ Cmd( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-     int argc, CONST char **argv )
++     int argc, const char **argv )
+ {
+     PLStream *pls = plPlotterPtr->pls;
+     int      length;
+@@ -2029,27 +2029,61 @@ static void ActiveState( register PlPlot
+ //
+ //--------------------------------------------------------------------------
+ //
+-// ConfigurePlPlotter --
++// ConfigureWidgetCompat --
+ //
+-//      This procedure is called to process an argv/argc list, plus the Tk
+-//      option database, in order to configure (or reconfigure) a
+-//      plframe widget.
+-//
+-// Results:
+-//      The return value is a standard Tcl result.  If TCL_ERROR is
+-//      returned, then interp->result contains an error message.
+-//
+-// Side effects:
+-//      Configuration information, such as text string, colors, font, etc.
+-//      get set for plPlotterPtr; old resources get freed, if there were
+-//      any.
++//      Compatibility wrapper for Tk_ConfigureWidget.  Tk 9 expects the
++//      argument vector as Tcl_Obj pointers rather than string pointers.
+ //
+ //--------------------------------------------------------------------------
+ //
+ 
+ static int
++ConfigureWidgetCompat( Tcl_Interp *interp, Tk_Window tkwin,
++                        const Tk_ConfigSpec *configSpecs,
++                        int argc, const char **argv, char *widgRec, int flags )
++{
++#if TK_MAJOR_VERSION >= 9
++    Tcl_Obj **objv = NULL;
++    int i;
++    int result;
++
++    if ( argc > 0 )
++    {
++        objv = (Tcl_Obj **) Tcl_Alloc( (size_t) argc * sizeof( Tcl_Obj * ) );
++        if ( objv == NULL )
++        {
++            Tcl_SetResult( interp, "out of memory", TCL_STATIC );
++            return TCL_ERROR;
++        }
++
++        for ( i = 0; i < argc; i++ )
++        {
++            objv[i] = Tcl_NewStringObj( argv[i], -1 );
++        }
++    }
++
++    result = Tk_ConfigureWidget( interp, tkwin, configSpecs, argc,
++        (Tcl_Obj *const *) objv, widgRec, flags );
++
++    if ( objv != NULL )
++    {
++        for ( i = 0; i < argc; i++ )
++        {
++            Tcl_DecrRefCount( objv[i] );
++        }
++        Tcl_Free( (char *) objv );
++    }
++
++    return result;
++#else
++    return Tk_ConfigureWidget( interp, tkwin, configSpecs, argc, argv,
++        widgRec, flags );
++#endif
++}
++
++static int
+ ConfigurePlPlotter( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-                    int argc, CONST char **argv, int flags )
++                    int argc, const char **argv, int flags )
+ {
+     register Tk_Window tkwin = plPlotterPtr->tkwin;
+     PLStream           *pls  = plPlotterPtr->pls;
+@@ -2074,7 +2108,7 @@ ConfigurePlPlotter( Tcl_Interp *interp,
+ 
+     dbug_enter( "ConfigurePlPlotter" );
+ 
+-    if ( Tk_ConfigureWidget( interp, tkwin, configSpecs,
++    if ( ConfigureWidgetCompat( interp, tkwin, configSpecs,
+              argc, argv, (char *) plPlotterPtr, flags ) != TCL_OK )
+     {
+         return TCL_ERROR;
+@@ -2192,7 +2226,7 @@ ConfigurePlPlotter( Tcl_Interp *interp,
+ 
+ static int
+ Draw( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-      int argc, CONST char **argv )
++      int argc, const char **argv )
+ {
+     register Tk_Window tkwin = plPlotterPtr->tkwin;
+     int  result = TCL_OK;
+@@ -2291,7 +2325,7 @@ Draw( Tcl_Interp *interp, register PlPlo
+ 
+ static int
+ Info( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-      int argc, CONST char **argv )
++      int argc, const char **argv )
+ {
+     int  length;
+     char c;
+@@ -2353,7 +2387,7 @@ Info( Tcl_Interp *interp, register PlPlo
+ 
+ static int
+ Openlink( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-          int argc, CONST char **argv )
++          int argc, const char **argv )
+ {
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 )
+     register PLRDev  *plr   = plPlotterPtr->plr;
+@@ -2420,9 +2454,14 @@ Openlink( Tcl_Interp *interp, register P
+     }
+ 
+     plr->pdfs = pdf_bopen( NULL, 4200 );
++#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
++    Tcl_CreateFileHandler( iodev->fd, TCL_READABLE, (Tcl_FileProc *) ReadData,
++        (void *) plPlotterPtr );
++#else
+     Tcl_CreateFileHandler( iodev->fd,
+-        TK_READABLE, (Tk_FileProc *) ReadData,
++        TCL_READABLE, (Tcl_FileProc *) ReadData,
+         (ClientData) plPlotterPtr );
++#endif
+ 
+ #endif
+ 
+@@ -2438,7 +2477,7 @@ Openlink( Tcl_Interp *interp, register P
+ 
+ static int
+ Closelink( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-           int PL_UNUSED( argc ), CONST char ** PL_UNUSED( argv ) )
++           int PL_UNUSED( argc ), const char ** PL_UNUSED( argv ) )
+ {
+ #if !defined ( MAC_TCL ) && !defined ( _WIN32 )
+     register PLRDev  *plr   = plPlotterPtr->plr;
+@@ -2542,7 +2581,7 @@ ReadData( ClientData clientData, int mas
+     register PDFstrm    *pdfs  = plr->pdfs;
+     int result = TCL_OK;
+ 
+-    if ( mask & TK_READABLE )
++    if ( mask & TCL_READABLE )
+     {
+         // Read from FIFO or socket
+ 
+@@ -2583,7 +2622,7 @@ ReadData( ClientData clientData, int mas
+ 
+ static int
+ Orient( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-        int argc, CONST char **argv )
++        int argc, const char **argv )
+ {
+     int result = TCL_OK;
+ 
+@@ -2626,7 +2665,7 @@ Orient( Tcl_Interp *interp, register PlP
+ 
+ static int
+ Print( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-       int PL_UNUSED( argc ), CONST char ** PL_UNUSED( argv ) )
++       int PL_UNUSED( argc ), const char ** PL_UNUSED( argv ) )
+ {
+     PLINT ipls;
+     int   result = TCL_OK;
+@@ -2719,7 +2758,7 @@ Print( Tcl_Interp *interp, register PlPl
+ 
+ static int
+ NextPage( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-          int argc, CONST char ** PL_UNUSED( argv ) )
++          int argc, const char ** PL_UNUSED( argv ) )
+ {
+     TkwDev *dev = (TkwDev *) plPlotterPtr->pls->dev;
+     if ( argc == 0 )
+@@ -2745,7 +2784,7 @@ NextPage( Tcl_Interp *interp, register P
+ 
+ static int
+ Page( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-      int argc, CONST char **argv )
++      int argc, const char **argv )
+ {
+ // page -- return current device window parameters
+ 
+@@ -2786,7 +2825,7 @@ Page( Tcl_Interp *interp, register PlPlo
+ 
+ static int
+ Redraw( Tcl_Interp * PL_UNUSED( interp ), register PlPlotter *plPlotterPtr,
+-        int PL_UNUSED( argc ), CONST char ** PL_UNUSED( argv ) )
++        int PL_UNUSED( argc ), const char ** PL_UNUSED( argv ) )
+ {
+     dbug_enter( "Redraw" );
+ 
+@@ -2810,7 +2849,7 @@ Redraw( Tcl_Interp * PL_UNUSED( interp )
+ 
+ static int
+ Save( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-      int argc, CONST char **argv )
++      int argc, const char **argv )
+ {
+     int  length;
+     char c;
+@@ -2942,7 +2981,7 @@ Save( Tcl_Interp *interp, register PlPlo
+ 
+ static int
+ View( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-      int argc, CONST char **argv )
++      int argc, const char **argv )
+ {
+     int   length;
+     int   dontRedraw = 0;
+@@ -3094,7 +3133,7 @@ Scroll( Tcl_Interp *interp, register PlP
+ 
+ static int
+ report( Tcl_Interp *interp, register PlPlotter *plPlotterPtr,
+-        int argc, CONST char **argv )
++        int argc, const char **argv )
+ {
+     PLFLT x, y;
+     char  res[40];
+@@ -3204,7 +3243,7 @@ UpdateHScrollbar( register PlPlotter *pl
+ //--------------------------------------------------------------------------
+ 
+ static void
+-gbox( PLFLT *xl, PLFLT *yl, PLFLT *xr, PLFLT *yr, CONST char **argv )
++gbox( PLFLT *xl, PLFLT *yl, PLFLT *xr, PLFLT *yr, const char **argv )
+ {
+     PLFLT x0, y0, x1, y1;
+ 
+diff -up plplot-5.15.0/drivers/tk.c.tcl9 plplot-5.15.0/drivers/tk.c
+--- plplot-5.15.0/drivers/tk.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/drivers/tk.c	2026-07-30 17:48:31.297015350 -0600
+@@ -631,7 +631,7 @@ GetCursor( PLStream *pls, PLGraphicsIn *
+ 
+     while ( gin->pX < 0 && dev->locate_mode )
+     {
+-        Tk_DoOneEvent( 0 );
++        Tcl_DoOneEvent( 0 );
+     }
+ 
+ // Clean up
+@@ -1180,7 +1180,7 @@ launch_server( PLStream *pls )
+ // This couldn't be done with
+ //	Tcl_SetVar(dev->interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
+ // after plserver has been launched? It doesnt work, hoewever.
+-// Tk_CreateFileHandler (0, TK_READABLE, NULL, 0) doesnt work also
++// Tk_CreateFileHandler (0, TCL_READABLE, NULL, 0) doesnt work also
+ //
+ 
+     argv[i++] = "-file";                        // Startup file
+@@ -1602,7 +1602,7 @@ WaitForPage( PLStream *pls )
+ 
+     while ( !dev->exit_eventloop )
+     {
+-        Tk_DoOneEvent( 0 );
++        Tcl_DoOneEvent( 0 );
+     }
+     dev->exit_eventloop = 0;
+ }
+@@ -2179,7 +2179,7 @@ tk_wait( PLStream *pls, const char *cmd
+         if ( result )
+             break;
+ 
+-        Tk_DoOneEvent( 0 );
++        Tcl_DoOneEvent( 0 );
+     }
+ }
+ 
+diff -up plplot-5.15.0/drivers/tkwin.c.tcl9 plplot-5.15.0/drivers/tkwin.c
+--- plplot-5.15.0/drivers/tkwin.c.tcl9	2019-06-01 17:24:33.000000000 -0600
++++ plplot-5.15.0/drivers/tkwin.c	2026-07-30 17:48:31.297725633 -0600
+@@ -979,7 +979,11 @@ Init( PLStream *pls )
+ // Get initial drawing area dimensions
+     dev->width  = (unsigned int) Tk_Width( plf->tkwin );
+     dev->height = (unsigned int) Tk_Height( plf->tkwin );
++#if defined( TK_MAJOR_VERSION ) && TK_MAJOR_VERSION >= 9
++    dev->border = (unsigned int) Tk_InternalBorderLeft( plf->tkwin );
++#else
+     dev->border = (unsigned int) Tk_InternalBorderWidth( plf->tkwin );
++#endif
+     tkwd->depth = (unsigned int) Tk_Depth( plf->tkwin );
+ 
+     dev->init_width  = dev->width;

diff --git a/plplot.spec b/plplot.spec
index a88ea59..6938773 100644
--- a/plplot.spec
+++ b/plplot.spec
@@ -101,6 +101,9 @@ Patch15:        https://sourceforge.net/p/plplot/support-requests/_discuss/threa
 # Replace removed Python 2 C API macros with Python 3 equivalents
 # for compatibility with SWIG 4.5.0
 Patch16:        plplot-swig45.patch
+# Tcl/Tk 9 support
+# https://sourceforge.net/p/plplot/plplot/merge-requests/9/
+Patch17:        plplot-tcl9.patch
 
 
 BuildRequires:  cmake >= 3.13.2
@@ -138,8 +141,8 @@ Obsoletes:      %{name}-java-devel < %{version}-%{release}
 %endif
 BuildRequires:  freetype-devel, qhull-devel , ncurses-devel
 BuildRequires:  gd-devel
-BuildRequires:  tcl-devel < 1:9
-BuildRequires:  tk-devel < 1:9
+BuildRequires:  tcl-devel
+BuildRequires:  tk-devel
 %if %{with itcl}
 BuildRequires:  itcl-devel, itk-devel
 BuildRequires:  iwidgets
@@ -185,6 +188,7 @@ BuildRequires:  xorg-x11-drv-dummy
 BuildRequires:  mesa-dri-drivers
 %endif
 BuildRequires:  chrpath
+Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
 Requires:       gnu-free-mono-fonts
 Requires:       gnu-free-sans-fonts
 Requires:       gnu-free-serif-fonts
@@ -433,6 +437,7 @@ Requires:       wxGTK-devel%{?_isa}
 %patch -P14 -p1
 %patch -P15 -p1
 %patch -P16 -p1
+%patch -P17 -p1 -b .tcl9
 # Use cmake FindLua
 rm cmake/modules/FindLua.cmake
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-01  3:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-01  3:01 [rpms/plplot] rawhide: Build with Tcl/Tk 9 (rhbz#2337750) Orion Poplawski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox