Skip to content

Commit 6778361

Browse files
Updated to TCL 9 API.
1 parent be074ad commit 6778361

File tree

7 files changed

+21
-16
lines changed

7 files changed

+21
-16
lines changed

include/tcl++.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ into a simple I/O stream and tclindex, a simple iterator through a TCL array */
4949
#define CONST const
5050
#endif
5151

52+
#if TCL_MAJOR_VERSION < 9
53+
using Tcl_Size=int;
54+
#endif
55+
5256
#ifdef TK
5357
#include <tk.h>
5458
/* undefine all those spurious macros X11 defines - we don't need 'em! */

src/TCL_obj.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ namespace ecolab
167167
{
168168
/* delete all member commands associated with this */
169169
tclcmd c;
170-
int i, elemc; CONST84 char **elem;
170+
int i;
171+
Tcl_Size elemc;
172+
CONST84 char **elem;
171173
c | "info commands "|desc|".*\n";
172174
if (Tcl_SplitList(interp(),c.result.c_str(),&elemc,&elem)!=TCL_OK)
173175
throw error("");

src/analysis.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ int palette_class::size=0;
3838

3939
palette_class::palette_class()
4040
{
41-
#if TCL_MAJOR_VERSION >= 9
4241
Tcl_Size elemc;
43-
#else
44-
int elemc;
45-
#endif
4642

4743
if (size==0)
4844
{

src/cairoSurfaceImage.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace
7777
};
7878

7979
// Define a new image type that renders a minsky::Canvas
80-
int createCI(Tcl_Interp* interp, CONST86 char* name, int objc, Tcl_Obj *const objv[],
80+
int createCI(Tcl_Interp* interp, CONST86 char* name, Tcl_Size objc, Tcl_Obj *const objv[],
8181
CONST86 Tk_ImageType* typePtr, Tk_ImageMaster master, ClientData *masterData)
8282
{
8383
try

src/cairo_types.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ namespace ecolab
9898
{
9999
//-image is deprecated, and not used
100100
{TK_CONFIG_STRING, "-image", NULL, NULL,
101-
NULL, Tk_Offset(ImageItem, imageString), TK_CONFIG_NULL_OK},
101+
NULL, offsetof(ImageItem, imageString), TK_CONFIG_NULL_OK},
102102
{TK_CONFIG_DOUBLE, "-scale", NULL, NULL,
103-
"1.0", Tk_Offset(ImageItem, scale), TK_CONFIG_NULL_OK},
103+
"1.0", offsetof(ImageItem, scale), TK_CONFIG_NULL_OK},
104104
{TK_CONFIG_DOUBLE, "-rotation", NULL, NULL,
105-
"0.0", Tk_Offset(ImageItem, rotation), TK_CONFIG_NULL_OK},
105+
"0.0", offsetof(ImageItem, rotation), TK_CONFIG_NULL_OK},
106106
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
107107
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
108108
{TK_CONFIG_END}
@@ -452,7 +452,7 @@ namespace ecolab
452452
Tk_Canvas canvas, /* Canvas containing item. */
453453
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
454454
* modified. */
455-
int objc, /* Number of coordinates supplied in objv. */
455+
Tcl_Size objc, /* Number of coordinates supplied in objv. */
456456
Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
457457
{
458458
ImageItem *imgPtr = (ImageItem *) itemPtr;
@@ -526,7 +526,10 @@ namespace ecolab
526526

527527
tkwin = Tk_CanvasTkwin(canvas);
528528
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
529-
(CONST char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) {
529+
#if TCL_MAJOR_VERSION < 9
530+
(CONST char **)
531+
#endif
532+
objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) {
530533
return TCL_ERROR;
531534
}
532535

@@ -592,7 +595,7 @@ namespace ecolab
592595
Tcl_Interp *interp, /* Used for error reporting. */
593596
Tk_Canvas canvas, /* Canvas containing itemPtr. */
594597
Tk_Item *itemPtr, /* Image item to reconfigure. */
595-
int objc, /* Number of elements in objv. */
598+
Tcl_Size objc, /* Number of elements in objv. */
596599
Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
597600
int flags)
598601
{

src/tcl_arrays.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ NEWCMD(pcoord,1)
103103

104104
NEWCMD(max,1)
105105
{
106-
int i,n;
106+
Tcl_Size i,n;
107107
CONST84 char **v;
108108
double m=-DBL_MAX;
109109
tclreturn result;
@@ -116,7 +116,7 @@ NEWCMD(max,1)
116116

117117
NEWCMD(min,1)
118118
{
119-
int i,n;
119+
Tcl_Size i,n;
120120
CONST84 char **v;
121121
double m=DBL_MAX;
122122
tclreturn result;
@@ -129,7 +129,7 @@ NEWCMD(min,1)
129129

130130
NEWCMD(av,1)
131131
{
132-
int i,n;
132+
Tcl_Size i,n;
133133
CONST84 char **v;
134134
double m=0;
135135
tclreturn result;

src/tclmain.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ NEWCMD(cli,0)
503503

504504
NEWCMD(string_map,2)
505505
{
506-
int elemc;
506+
Tcl_Size elemc;
507507
CONST84 char **elem;
508508
Tcl_SplitList(interp(),const_cast<char*>(argv[1]),&elemc,&elem);
509509
tclreturn retval;

0 commit comments

Comments
 (0)