diff options
author | hobbs <hobbs> | 2001-07-03 06:03:44 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2001-07-03 06:03:44 (GMT) |
commit | c7761841b1180a34902ee6a49a4a88c127c2d5a2 (patch) | |
tree | d82a322c1b1966e7a46b7a95f56775e4d6722eac /generic | |
parent | 4ffd023388cb831e30a995c1e4ff921df75059f5 (diff) | |
download | tk-c7761841b1180a34902ee6a49a4a88c127c2d5a2.zip tk-c7761841b1180a34902ee6a49a4a88c127c2d5a2.tar.gz tk-c7761841b1180a34902ee6a49a4a88c127c2d5a2.tar.bz2 |
* generic/tkCanvArc.c:
* generic/tkCanvBmap.c:
* generic/tkCanvLine.c:
* generic/tkCanvPoly.c:
* generic/tkCanvText.c:
* generic/tkCanvWind.c:
* generic/tkRectOval.c: corrected argument handling in
Create<Item> functions that could lead to ABRs or FMRs and
corrected names of argc/argv to objc/objv.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkCanvArc.c | 78 | ||||
-rw-r--r-- | generic/tkCanvBmap.c | 66 | ||||
-rw-r--r-- | generic/tkCanvLine.c | 93 | ||||
-rw-r--r-- | generic/tkCanvPoly.c | 91 | ||||
-rw-r--r-- | generic/tkCanvText.c | 67 | ||||
-rw-r--r-- | generic/tkCanvWind.c | 73 | ||||
-rw-r--r-- | generic/tkRectOval.c | 77 |
7 files changed, 266 insertions, 279 deletions
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index f90061f..d1d5f68 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvArc.c,v 1.8 2000/02/01 11:41:09 hobbs Exp $ + * RCS: @(#) $Id: tkCanvArc.c,v 1.9 2001/07/03 06:03:44 hobbs Exp $ */ #include <stdio.h> @@ -196,19 +196,19 @@ static Tk_ConfigSpec configSpecs[] = { static void ComputeArcBbox _ANSI_ARGS_((Tk_Canvas canvas, ArcItem *arcPtr)); static int ConfigureArc _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[], int flags)); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[], int flags)); static int CreateArc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int objc, Tcl_Obj *CONST objv[])); static void DeleteArc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display)); static void DisplayArc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height)); static int ArcCoords _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[])); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[])); static int ArcToArea _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr)); static double ArcToPoint _ANSI_ARGS_((Tk_Canvas canvas, @@ -286,29 +286,27 @@ Tk_ItemType tkArcType = { */ static int -CreateArc(interp, canvas, itemPtr, argc, argv) +CreateArc(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Interpreter for error reporting. */ Tk_Canvas canvas; /* Canvas to hold new item. */ Tk_Item *itemPtr; /* Record to hold new item; header * has been initialized by caller. */ - int argc; /* Number of arguments in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing arc. */ + int objc; /* Number of arguments in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing arc. */ { ArcItem *arcPtr = (ArcItem *) itemPtr; - int i; + int i = 4; - if (argc==1) { + if (objc == 1) { i = 1; - } else { - char *arg = Tcl_GetStringFromObj(argv[1], NULL); - if ((argc>1) && (arg[0] == '-') - && (arg[1] >= 'a') && (arg[1] <= 'z')) { + } else if (objc > 1) { + char *arg = Tcl_GetString(objv[1]); + if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; - } else { - i = 4; } } - if (argc < i) { + + if (objc < i) { Tcl_AppendResult(interp, "wrong # args: should be \"", Tk_PathName(Tk_CanvasTkwin(canvas)), " create ", itemPtr->typePtr->name, " x1 y1 x2 y2 ?options?\"", @@ -342,10 +340,10 @@ CreateArc(interp, canvas, itemPtr, argc, argv) * Process the arguments to fill in the item record. */ - if ((ArcCoords(interp, canvas, itemPtr, i, argv) != TCL_OK)) { + if ((ArcCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) { goto error; } - if (ConfigureArc(interp, canvas, itemPtr, argc-4, argv+4, 0) == TCL_OK) { + if (ConfigureArc(interp, canvas, itemPtr, objc-4, objv+4, 0) == TCL_OK) { return TCL_OK; } error: @@ -372,19 +370,19 @@ CreateArc(interp, canvas, itemPtr, argc, argv) */ static int -ArcCoords(interp, canvas, itemPtr, argc, argv) +ArcCoords(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing item. */ Tk_Item *itemPtr; /* Item whose coordinates are to be * read or modified. */ - int argc; /* Number of coordinates supplied in - * argv. */ - Tcl_Obj *CONST argv[]; /* Array of coordinates: x1, y1, + int objc; /* Number of coordinates supplied in + * objv. */ + Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, * x2, y2, ... */ { ArcItem *arcPtr = (ArcItem *) itemPtr; - if (argc == 0) { + if (objc == 0) { Tcl_Obj *obj = Tcl_NewObj(); Tcl_Obj *subobj = Tcl_NewDoubleObj(arcPtr->bbox[0]); Tcl_ListObjAppendElement(interp, obj, subobj); @@ -395,26 +393,26 @@ ArcCoords(interp, canvas, itemPtr, argc, argv) subobj = Tcl_NewDoubleObj(arcPtr->bbox[3]); Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_SetObjResult(interp, obj); - } else if ((argc == 1)||(argc == 4)) { - if (argc==1) { - if (Tcl_ListObjGetElements(interp, argv[0], &argc, - (Tcl_Obj ***) &argv) != TCL_OK) { + } else if ((objc == 1)||(objc == 4)) { + if (objc==1) { + if (Tcl_ListObjGetElements(interp, objv[0], &objc, + (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; - } else if (argc != 4) { + } else if (objc != 4) { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 4, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 4, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } } - if ((Tk_CanvasGetCoordFromObj(interp, canvas, argv[0], + if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &arcPtr->bbox[0]) != TCL_OK) - || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[1], + || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &arcPtr->bbox[1]) != TCL_OK) - || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[2], + || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[2], &arcPtr->bbox[2]) != TCL_OK) - || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[3], + || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[3], &arcPtr->bbox[3]) != TCL_OK)) { return TCL_ERROR; } @@ -422,7 +420,7 @@ ArcCoords(interp, canvas, itemPtr, argc, argv) } else { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } @@ -449,12 +447,12 @@ ArcCoords(interp, canvas, itemPtr, argc, argv) */ static int -ConfigureArc(interp, canvas, itemPtr, argc, argv, flags) +ConfigureArc(interp, canvas, itemPtr, objc, objv, flags) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing itemPtr. */ Tk_Item *itemPtr; /* Arc item to reconfigure. */ - int argc; /* Number of elements in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing things to configure. */ + int objc; /* Number of elements in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */ int flags; /* Flags to pass to Tk_ConfigureWidget. */ { ArcItem *arcPtr = (ArcItem *) itemPtr; @@ -469,7 +467,7 @@ ConfigureArc(interp, canvas, itemPtr, argc, argv, flags) Tk_State state; tkwin = Tk_CanvasTkwin(canvas); - if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc, (char **) argv, + if (Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, (char **) objv, (char *) arcPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index bcef7f3..39cf6a2 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvBmap.c,v 1.4 1999/12/14 06:52:25 hobbs Exp $ + * RCS: @(#) $Id: tkCanvBmap.c,v 1.5 2001/07/03 06:03:44 hobbs Exp $ */ #include <stdio.h> @@ -92,8 +92,8 @@ static Tk_ConfigSpec configSpecs[] = { */ static int BitmapCoords _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[])); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[])); static int BitmapToArea _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr)); static double BitmapToPoint _ANSI_ARGS_((Tk_Canvas canvas, @@ -103,11 +103,11 @@ static int BitmapToPostscript _ANSI_ARGS_((Tcl_Interp *interp, static void ComputeBitmapBbox _ANSI_ARGS_((Tk_Canvas canvas, BitmapItem *bmapPtr)); static int ConfigureBitmap _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[], int flags)); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[], int flags)); static int CreateBitmap _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int objc, Tcl_Obj *CONST objv[])); static void DeleteBitmap _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display)); static void DisplayBitmap _ANSI_ARGS_((Tk_Canvas canvas, @@ -168,22 +168,22 @@ Tk_ItemType tkBitmapType = { */ static int -CreateBitmap(interp, canvas, itemPtr, argc, argv) +CreateBitmap(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Interpreter for error reporting. */ Tk_Canvas canvas; /* Canvas to hold new item. */ Tk_Item *itemPtr; /* Record to hold new item; header * has been initialized by caller. */ - int argc; /* Number of arguments in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing rectangle. */ + int objc; /* Number of arguments in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; int i; - if (argc==1) { + if (objc==1) { i = 1; } else { - char *arg = Tcl_GetStringFromObj(argv[1], NULL); - if (((argc>1) && (arg[0] == '-') + char *arg = Tcl_GetStringFromObj(objv[1], NULL); + if (((objc>1) && (arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z'))) { i = 1; } else { @@ -191,7 +191,7 @@ CreateBitmap(interp, canvas, itemPtr, argc, argv) } } - if (argc < i) { + if (objc < i) { Tcl_AppendResult(interp, "wrong # args: should be \"", Tk_PathName(Tk_CanvasTkwin(canvas)), " create ", itemPtr->typePtr->name, " x y ?options?\"", @@ -219,10 +219,10 @@ CreateBitmap(interp, canvas, itemPtr, argc, argv) * Process the arguments to fill in the item record. */ - if ((BitmapCoords(interp, canvas, itemPtr, i, argv) != TCL_OK)) { + if ((BitmapCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) { goto error; } - if (ConfigureBitmap(interp, canvas, itemPtr, argc-i, argv+i, 0) == TCL_OK) { + if (ConfigureBitmap(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) { return TCL_OK; } @@ -250,40 +250,40 @@ CreateBitmap(interp, canvas, itemPtr, argc, argv) */ static int -BitmapCoords(interp, canvas, itemPtr, argc, argv) +BitmapCoords(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing item. */ Tk_Item *itemPtr; /* Item whose coordinates are to be * read or modified. */ - int argc; /* Number of coordinates supplied in - * argv. */ - Tcl_Obj *CONST argv[]; /* Array of coordinates: x1, y1, + int objc; /* Number of coordinates supplied in + * objv. */ + Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, * x2, y2, ... */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; - if (argc == 0) { + if (objc == 0) { Tcl_Obj *obj = Tcl_NewObj(); Tcl_Obj *subobj = Tcl_NewDoubleObj(bmapPtr->x); Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewDoubleObj(bmapPtr->y); Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_SetObjResult(interp, obj); - } else if (argc <3) { - if (argc==1) { - if (Tcl_ListObjGetElements(interp, argv[0], &argc, - (Tcl_Obj ***) &argv) != TCL_OK) { + } else if (objc <3) { + if (objc==1) { + if (Tcl_ListObjGetElements(interp, objv[0], &objc, + (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; - } else if (argc != 2) { + } else if (objc != 2) { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 2, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 2, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } } - if ((Tk_CanvasGetCoordFromObj(interp, canvas, argv[0], &bmapPtr->x) != TCL_OK) - || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[1], &bmapPtr->y) + if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &bmapPtr->x) != TCL_OK) + || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &bmapPtr->y) != TCL_OK)) { return TCL_ERROR; } @@ -291,7 +291,7 @@ BitmapCoords(interp, canvas, itemPtr, argc, argv) } else { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } @@ -317,12 +317,12 @@ BitmapCoords(interp, canvas, itemPtr, argc, argv) */ static int -ConfigureBitmap(interp, canvas, itemPtr, argc, argv, flags) +ConfigureBitmap(interp, canvas, itemPtr, objc, objv, flags) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing itemPtr. */ Tk_Item *itemPtr; /* Bitmap item to reconfigure. */ - int argc; /* Number of elements in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing things to configure. */ + int objc; /* Number of elements in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */ int flags; /* Flags to pass to Tk_ConfigureWidget. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; @@ -336,7 +336,7 @@ ConfigureBitmap(interp, canvas, itemPtr, argc, argv, flags) Tk_State state; tkwin = Tk_CanvasTkwin(canvas); - if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc, (char **) argv, + if (Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, (char **) objv, (char *) bmapPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 708490d..9a0c369 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvLine.c,v 1.8 2000/10/24 23:51:33 ericm Exp $ + * RCS: @(#) $Id: tkCanvLine.c,v 1.9 2001/07/03 06:03:44 hobbs Exp $ */ #include <stdio.h> @@ -83,13 +83,13 @@ static int ArrowheadPostscript _ANSI_ARGS_((Tcl_Interp *interp, static void ComputeLineBbox _ANSI_ARGS_((Tk_Canvas canvas, LineItem *linePtr)); static int ConfigureLine _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[], int flags)); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[], int flags)); static int ConfigureArrows _ANSI_ARGS_((Tk_Canvas canvas, LineItem *linePtr)); static int CreateLine _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int objc, Tcl_Obj *CONST objv[])); static void DeleteLine _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display)); static void DisplayLine _ANSI_ARGS_((Tk_Canvas canvas, @@ -100,7 +100,7 @@ static int GetLineIndex _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *obj, int *indexPtr)); static int LineCoords _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int objc, Tcl_Obj *CONST objv[])); static void LineDeleteCoords _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last)); static void LineInsert _ANSI_ARGS_((Tk_Canvas canvas, @@ -291,13 +291,13 @@ Tk_ItemType tkLineType = { */ static int -CreateLine(interp, canvas, itemPtr, argc, argv) +CreateLine(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Interpreter for error reporting. */ Tk_Canvas canvas; /* Canvas to hold new item. */ Tk_Item *itemPtr; /* Record to hold new item; header * has been initialized by caller. */ - int argc; /* Number of arguments in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing line. */ + int objc; /* Number of arguments in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing line. */ { LineItem *linePtr = (LineItem *) itemPtr; int i; @@ -330,17 +330,16 @@ CreateLine(interp, canvas, itemPtr, argc, argv) * start with a digit or a minus sign followed by a digit. */ - for (i = 0; i < argc; i++) { - char *arg = Tcl_GetStringFromObj(argv[i], NULL); - if ((arg[0] == '-') && (arg[1] >= 'a') - && (arg[1] <= 'z')) { + for (i = 0; i < objc; i++) { + char *arg = Tcl_GetString(objv[i]); + if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { break; } } - if (i && (LineCoords(interp, canvas, itemPtr, i, argv) != TCL_OK)) { + if (i && (LineCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) { goto error; } - if (ConfigureLine(interp, canvas, itemPtr, argc-i, argv+i, 0) == TCL_OK) { + if (ConfigureLine(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) { return TCL_OK; } @@ -368,21 +367,21 @@ CreateLine(interp, canvas, itemPtr, argc, argv) */ static int -LineCoords(interp, canvas, itemPtr, argc, argv) +LineCoords(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing item. */ Tk_Item *itemPtr; /* Item whose coordinates are to be * read or modified. */ - int argc; /* Number of coordinates supplied in - * argv. */ - Tcl_Obj *CONST argv[]; /* Array of coordinates: x1, y1, + int objc; /* Number of coordinates supplied in + * objv. */ + Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, * x2, y2, ... */ { LineItem *linePtr = (LineItem *) itemPtr; int i, numPoints; double *coordPtr; - if (argc == 0) { + if (objc == 0) { int numCoords; Tcl_Obj *subobj, *obj = Tcl_NewObj(); @@ -405,27 +404,27 @@ LineCoords(interp, canvas, itemPtr, argc, argv) Tcl_SetObjResult(interp, obj); return TCL_OK; } - if (argc == 1) { - if (Tcl_ListObjGetElements(interp, argv[0], &argc, - (Tcl_Obj ***) &argv) != TCL_OK) { + if (objc == 1) { + if (Tcl_ListObjGetElements(interp, objv[0], &objc, + (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } } - if (argc & 1) { + if (objc & 1) { Tcl_AppendResult(interp, "odd number of coordinates specified for line", (char *) NULL); return TCL_ERROR; - } else if (argc < 4) { + } else if (objc < 4) { Tcl_AppendResult(interp, "too few coordinates specified for line", (char *) NULL); return TCL_ERROR; } else { - numPoints = argc/2; + numPoints = objc/2; if (linePtr->numPoints != numPoints) { coordPtr = (double *) ckalloc((unsigned) - (sizeof(double) * argc)); + (sizeof(double) * objc)); if (linePtr->coordPtr != NULL) { ckfree((char *) linePtr->coordPtr); } @@ -433,8 +432,8 @@ LineCoords(interp, canvas, itemPtr, argc, argv) linePtr->numPoints = numPoints; } coordPtr = linePtr->coordPtr; - for (i = 0; i <argc; i++) { - if (Tk_CanvasGetCoordFromObj(interp, canvas, argv[i], + for (i = 0; i <objc; i++) { + if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[i], coordPtr++) != TCL_OK) { return TCL_ERROR; } @@ -481,12 +480,12 @@ LineCoords(interp, canvas, itemPtr, argc, argv) */ static int -ConfigureLine(interp, canvas, itemPtr, argc, argv, flags) +ConfigureLine(interp, canvas, itemPtr, objc, objv, flags) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing itemPtr. */ Tk_Item *itemPtr; /* Line item to reconfigure. */ - int argc; /* Number of elements in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing things to configure. */ + int objc; /* Number of elements in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */ int flags; /* Flags to pass to Tk_ConfigureWidget. */ { LineItem *linePtr = (LineItem *) itemPtr; @@ -497,7 +496,7 @@ ConfigureLine(interp, canvas, itemPtr, argc, argv, flags) Tk_State state; tkwin = Tk_CanvasTkwin(canvas); - if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc, (char **) argv, + if (Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, (char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } @@ -981,7 +980,7 @@ LineInsert(canvas, itemPtr, beforeThis, obj) Tcl_Obj *obj; /* New coordinates to be inserted. */ { LineItem *linePtr = (LineItem *) itemPtr; - int length, argc, i; + int length, objc, i; double *new, *coordPtr; Tk_State state = itemPtr->state; Tcl_Obj **objv; @@ -990,8 +989,8 @@ LineInsert(canvas, itemPtr, beforeThis, obj) state = ((TkCanvas *)canvas)->canvas_state; } - if (!obj || (Tcl_ListObjGetElements((Tcl_Interp *) NULL, obj, &argc, &objv) != TCL_OK) - || !argc || argc&1) { + if (!obj || (Tcl_ListObjGetElements((Tcl_Interp *) NULL, obj, &objc, &objv) != TCL_OK) + || !objc || objc&1) { return; } length = 2*linePtr->numPoints; @@ -1009,11 +1008,11 @@ LineInsert(canvas, itemPtr, beforeThis, obj) linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1]; } - new = (double *) ckalloc((unsigned)(sizeof(double) * (length + argc))); + new = (double *) ckalloc((unsigned)(sizeof(double) * (length + objc))); for(i=0; i<beforeThis; i++) { new[i] = linePtr->coordPtr[i]; } - for(i=0; i<argc; i++) { + for(i=0; i<objc; i++) { if (Tcl_GetDoubleFromObj((Tcl_Interp *) NULL,objv[i], new+(i+beforeThis))!=TCL_OK) { Tcl_ResetResult(((TkCanvas *)canvas)->interp); @@ -1023,11 +1022,11 @@ LineInsert(canvas, itemPtr, beforeThis, obj) } for(i=beforeThis; i<length; i++) { - new[i+argc] = linePtr->coordPtr[i]; + new[i+objc] = linePtr->coordPtr[i]; } if(linePtr->coordPtr) ckfree((char *)linePtr->coordPtr); linePtr->coordPtr = new; - linePtr->numPoints = (length + argc)/2; + linePtr->numPoints = (length + objc)/2; if ((length>3) && (state != TK_STATE_HIDDEN)) { /* @@ -1040,14 +1039,14 @@ LineInsert(canvas, itemPtr, beforeThis, obj) */ itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW; - if (beforeThis>0) {beforeThis -= 2; argc+=2; } - if ((beforeThis+argc)<length) argc+=2; + if (beforeThis>0) {beforeThis -= 2; objc+=2; } + if ((beforeThis+objc)<length) objc+=2; if (linePtr->smooth) { if(beforeThis>0) { - beforeThis-=2; argc+=2; + beforeThis-=2; objc+=2; } - if((beforeThis+argc+2)<length) { - argc+=2; + if((beforeThis+objc+2)<length) { + objc+=2; } } itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[beforeThis]; @@ -1059,7 +1058,7 @@ LineInsert(canvas, itemPtr, beforeThis, obj) TkIncludePoint(itemPtr, coordPtr); } } - if ((linePtr->lastArrowPtr != NULL) && ((beforeThis+argc)>=length)) { + if ((linePtr->lastArrowPtr != NULL) && ((beforeThis+objc)>=length)) { /* include old last arrow */ for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { @@ -1067,7 +1066,7 @@ LineInsert(canvas, itemPtr, beforeThis, obj) } } coordPtr = linePtr->coordPtr+beforeThis+2; - for(i=2; i<argc; i+=2) { + for(i=2; i<objc; i+=2) { TkIncludePoint(itemPtr, coordPtr); coordPtr+=2; } @@ -1094,7 +1093,7 @@ LineInsert(canvas, itemPtr, beforeThis, obj) TkIncludePoint(itemPtr, coordPtr); } } - if ((linePtr->lastArrowPtr != NULL) && ((beforeThis+argc)<(length-2))) { + if ((linePtr->lastArrowPtr != NULL) && ((beforeThis+objc)<(length-2))) { /* include new right arrow */ for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 3b6568e..8e21d4f 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvPoly.c,v 1.6 2000/06/03 08:38:12 hobbs Exp $ + * RCS: @(#) $Id: tkCanvPoly.c,v 1.7 2001/07/03 06:03:44 hobbs Exp $ */ #include <stdio.h> @@ -165,11 +165,11 @@ static Tk_ConfigSpec configSpecs[] = { static void ComputePolygonBbox _ANSI_ARGS_((Tk_Canvas canvas, PolygonItem *polyPtr)); static int ConfigurePolygon _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[], int flags)); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[], int flags)); static int CreatePolygon _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int objc, Tcl_Obj *CONST objv[])); static void DeletePolygon _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display)); static void DisplayPolygon _ANSI_ARGS_((Tk_Canvas canvas, @@ -180,7 +180,7 @@ static int GetPolygonIndex _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *obj, int *indexPtr)); static int PolygonCoords _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int objc, Tcl_Obj *CONST objv[])); static void PolygonDeleteCoords _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last)); static void PolygonInsert _ANSI_ARGS_((Tk_Canvas canvas, @@ -255,13 +255,13 @@ Tk_ItemType tkPolygonType = { */ static int -CreatePolygon(interp, canvas, itemPtr, argc, argv) +CreatePolygon(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Interpreter for error reporting. */ Tk_Canvas canvas; /* Canvas to hold new item. */ Tk_Item *itemPtr; /* Record to hold new item; header * has been initialized by caller. */ - int argc; /* Number of arguments in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing polygon. */ + int objc; /* Number of arguments in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing polygon. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int i; @@ -296,18 +296,17 @@ CreatePolygon(interp, canvas, itemPtr, argc, argv) * start with a digit or a minus sign followed by a digit. */ - for (i = 0; i < argc; i++) { - char *arg = Tcl_GetStringFromObj((Tcl_Obj *) argv[i], NULL); - if ((arg[0] == '-') && (arg[1] >= 'a') - && (arg[1] <= 'z')) { + for (i = 0; i < objc; i++) { + char *arg = Tcl_GetString(objv[i]); + if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { break; } } - if (i && PolygonCoords(interp, canvas, itemPtr, i, argv) != TCL_OK) { + if (i && PolygonCoords(interp, canvas, itemPtr, i, objv) != TCL_OK) { goto error; } - if (ConfigurePolygon(interp, canvas, itemPtr, argc-i, argv+i, 0) + if (ConfigurePolygon(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) { return TCL_OK; } @@ -336,20 +335,20 @@ CreatePolygon(interp, canvas, itemPtr, argc, argv) */ static int -PolygonCoords(interp, canvas, itemPtr, argc, argv) +PolygonCoords(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing item. */ Tk_Item *itemPtr; /* Item whose coordinates are to be * read or modified. */ - int argc; /* Number of coordinates supplied in - * argv. */ - Tcl_Obj *CONST argv[]; /* Array of coordinates: x1, y1, + int objc; /* Number of coordinates supplied in + * objv. */ + Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, * x2, y2, ... */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int i, numPoints; - if (argc == 0) { + if (objc == 0) { /* * Print the coords used to create the polygon. If we auto * closed the polygon then we don't report the last point. @@ -362,19 +361,19 @@ PolygonCoords(interp, canvas, itemPtr, argc, argv) Tcl_SetObjResult(interp, obj); return TCL_OK; } - if (argc == 1) { - if (Tcl_ListObjGetElements(interp, argv[0], &argc, - (Tcl_Obj ***) &argv) != TCL_OK) { + if (objc == 1) { + if (Tcl_ListObjGetElements(interp, objv[0], &objc, + (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } } - if (argc & 1) { + if (objc & 1) { Tcl_AppendResult(interp, "odd number of coordinates specified for polygon", (char *) NULL); return TCL_ERROR; } else { - numPoints = argc/2; + numPoints = objc/2; if (polyPtr->pointsAllocated <= numPoints) { if (polyPtr->coordPtr != NULL) { ckfree((char *) polyPtr->coordPtr); @@ -386,11 +385,11 @@ PolygonCoords(interp, canvas, itemPtr, argc, argv) */ polyPtr->coordPtr = (double *) ckalloc((unsigned) - (sizeof(double) * (argc+2))); + (sizeof(double) * (objc+2))); polyPtr->pointsAllocated = numPoints+1; } - for (i = argc-1; i >= 0; i--) { - if (Tk_CanvasGetCoordFromObj(interp, canvas, argv[i], + for (i = objc-1; i >= 0; i--) { + if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[i], &polyPtr->coordPtr[i]) != TCL_OK) { return TCL_ERROR; } @@ -402,12 +401,12 @@ PolygonCoords(interp, canvas, itemPtr, argc, argv) * Close the polygon if it isn't already closed. */ - if (argc>2 && ((polyPtr->coordPtr[argc-2] != polyPtr->coordPtr[0]) - || (polyPtr->coordPtr[argc-1] != polyPtr->coordPtr[1]))) { + if (objc>2 && ((polyPtr->coordPtr[objc-2] != polyPtr->coordPtr[0]) + || (polyPtr->coordPtr[objc-1] != polyPtr->coordPtr[1]))) { polyPtr->autoClosed = 1; polyPtr->numPoints++; - polyPtr->coordPtr[argc] = polyPtr->coordPtr[0]; - polyPtr->coordPtr[argc+1] = polyPtr->coordPtr[1]; + polyPtr->coordPtr[objc] = polyPtr->coordPtr[0]; + polyPtr->coordPtr[objc+1] = polyPtr->coordPtr[1]; } ComputePolygonBbox(canvas, polyPtr); } @@ -434,12 +433,12 @@ PolygonCoords(interp, canvas, itemPtr, argc, argv) */ static int -ConfigurePolygon(interp, canvas, itemPtr, argc, argv, flags) +ConfigurePolygon(interp, canvas, itemPtr, objc, objv, flags) Tcl_Interp *interp; /* Interpreter for error reporting. */ Tk_Canvas canvas; /* Canvas containing itemPtr. */ Tk_Item *itemPtr; /* Polygon item to reconfigure. */ - int argc; /* Number of elements in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing things to configure. */ + int objc; /* Number of elements in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */ int flags; /* Flags to pass to Tk_ConfigureWidget. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; @@ -452,7 +451,7 @@ ConfigurePolygon(interp, canvas, itemPtr, argc, argv, flags) Tk_State state; tkwin = Tk_CanvasTkwin(canvas); - if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc, (char **) argv, + if (Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, (char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } @@ -1022,7 +1021,7 @@ PolygonInsert(canvas, itemPtr, beforeThis, obj) Tcl_Obj *obj; /* New coordinates to be inserted. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; - int length, argc, i; + int length, objc, i; Tcl_Obj **objv; double *new; Tk_State state = itemPtr->state; @@ -1031,18 +1030,18 @@ PolygonInsert(canvas, itemPtr, beforeThis, obj) state = ((TkCanvas *)canvas)->canvas_state; } - if (!obj || (Tcl_ListObjGetElements((Tcl_Interp *) NULL, obj, &argc, &objv) != TCL_OK) - || !argc || argc&1) { + if (!obj || (Tcl_ListObjGetElements((Tcl_Interp *) NULL, obj, &objc, &objv) != TCL_OK) + || !objc || objc&1) { return; } length = 2*(polyPtr->numPoints - polyPtr->autoClosed); while(beforeThis>length) beforeThis-=length; while(beforeThis<0) beforeThis+=length; - new = (double *) ckalloc((unsigned)(sizeof(double) * (length + 2 + argc))); + new = (double *) ckalloc((unsigned)(sizeof(double) * (length + 2 + objc))); for (i=0; i<beforeThis; i++) { new[i] = polyPtr->coordPtr[i]; } - for (i=0; i<argc; i++) { + for (i=0; i<objc; i++) { if (Tcl_GetDoubleFromObj((Tcl_Interp *) NULL,objv[i], new+(i+beforeThis))!=TCL_OK) { ckfree((char *) new); @@ -1051,10 +1050,10 @@ PolygonInsert(canvas, itemPtr, beforeThis, obj) } for(i=beforeThis; i<length; i++) { - new[i+argc] = polyPtr->coordPtr[i]; + new[i+objc] = polyPtr->coordPtr[i]; } if(polyPtr->coordPtr) ckfree((char *) polyPtr->coordPtr); - length+=argc; + length+=objc; polyPtr->coordPtr = new; polyPtr->numPoints = (length/2) + polyPtr->autoClosed; @@ -1078,7 +1077,7 @@ PolygonInsert(canvas, itemPtr, beforeThis, obj) new[length] = new[0]; new[length+1] = new[1]; - if (((length-argc)>3) && (state != TK_STATE_HIDDEN)) { + if (((length-objc)>3) && (state != TK_STATE_HIDDEN)) { /* * This is some optimizing code that will result that only the part * of the polygon that changed (and the objects that are overlapping @@ -1101,11 +1100,11 @@ PolygonInsert(canvas, itemPtr, beforeThis, obj) itemPtr->x1 = itemPtr->x2 = (int) polyPtr->coordPtr[beforeThis]; itemPtr->y1 = itemPtr->y2 = (int) polyPtr->coordPtr[beforeThis+1]; - beforeThis-=2; argc+=4; + beforeThis-=2; objc+=4; if(polyPtr->smooth) { - beforeThis-=2; argc+=4; + beforeThis-=2; objc+=4; } /* be carefull; beforeThis could now be negative */ - for(i=beforeThis; i<beforeThis+argc; i+=2) { + for(i=beforeThis; i<beforeThis+objc; i+=2) { j=i; if(j<0) j+=length; if(j>=length) j-=length; diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index fa419c3..2d462ee 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvText.c,v 1.8 1999/12/21 23:55:10 hobbs Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.9 2001/07/03 06:03:44 hobbs Exp $ */ #include <stdio.h> @@ -141,10 +141,10 @@ static void ComputeTextBbox _ANSI_ARGS_((Tk_Canvas canvas, TextItem *textPtr)); static int ConfigureText _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[], int flags)); + Tcl_Obj *CONST objv[], int flags)); static int CreateText _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int argc, Tcl_Obj *CONST objv[])); static void DeleteText _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display)); static void DisplayCanvText _ANSI_ARGS_((Tk_Canvas canvas, @@ -163,7 +163,7 @@ static void SetTextCursor _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int index)); static int TextCoords _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int argc, Tcl_Obj *CONST objv[])); static void TextDeleteChars _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last)); static void TextInsert _ANSI_ARGS_((Tk_Canvas canvas, @@ -226,30 +226,27 @@ Tk_ItemType tkTextType = { */ static int -CreateText(interp, canvas, itemPtr, argc, argv) +CreateText(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Interpreter for error reporting. */ Tk_Canvas canvas; /* Canvas to hold new item. */ Tk_Item *itemPtr; /* Record to hold new item; header has been * initialized by caller. */ - int argc; /* Number of arguments in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing rectangle. */ + int objc; /* Number of arguments in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */ { TextItem *textPtr = (TextItem *) itemPtr; - int i; + int i = 2; - if (argc==1) { + if (objc == 1) { i = 1; - } else { - char *arg = Tcl_GetStringFromObj(argv[1], NULL); - if ((argc>1) && (arg[0] == '-') - && (arg[1] >= 'a') && (arg[1] <= 'z')) { + } else if (objc > 1) { + char *arg = Tcl_GetString(objv[1]); + if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; - } else { - i = 2; } } - if (argc < i) { + if (objc < i) { Tcl_AppendResult(interp, "wrong # args: should be \"", Tk_PathName(Tk_CanvasTkwin(canvas)), " create ", itemPtr->typePtr->name, " x y ?options?\"", (char *) NULL); @@ -293,10 +290,10 @@ CreateText(interp, canvas, itemPtr, argc, argv) * Process the arguments to fill in the item record. */ - if ((TextCoords(interp, canvas, itemPtr, i, argv) != TCL_OK)) { + if ((TextCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) { goto error; } - if (ConfigureText(interp, canvas, itemPtr, argc-i, argv+i, 0) == TCL_OK) { + if (ConfigureText(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) { return TCL_OK; } @@ -324,38 +321,38 @@ CreateText(interp, canvas, itemPtr, argc, argv) */ static int -TextCoords(interp, canvas, itemPtr, argc, argv) +TextCoords(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing item. */ Tk_Item *itemPtr; /* Item whose coordinates are to be read or * modified. */ - int argc; /* Number of coordinates supplied in argv. */ - Tcl_Obj *CONST argv[]; /* Array of coordinates: x1, y1, x2, y2, ... */ + int objc; /* Number of coordinates supplied in objv. */ + Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, x2, y2, ... */ { TextItem *textPtr = (TextItem *) itemPtr; - if (argc == 0) { + if (objc == 0) { Tcl_Obj *obj = Tcl_NewObj(); Tcl_Obj *subobj = Tcl_NewDoubleObj(textPtr->x); Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewDoubleObj(textPtr->y); Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_SetObjResult(interp, obj); - } else if (argc < 3) { - if (argc==1) { - if (Tcl_ListObjGetElements(interp, argv[0], &argc, - (Tcl_Obj ***) &argv) != TCL_OK) { + } else if (objc < 3) { + if (objc==1) { + if (Tcl_ListObjGetElements(interp, objv[0], &objc, + (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; - } else if (argc != 2) { + } else if (objc != 2) { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 2, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 2, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } } - if ((Tk_CanvasGetCoordFromObj(interp, canvas, argv[0], &textPtr->x) != TCL_OK) - || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[1], + if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &textPtr->x) != TCL_OK) + || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &textPtr->y) != TCL_OK)) { return TCL_ERROR; } @@ -363,7 +360,7 @@ TextCoords(interp, canvas, itemPtr, argc, argv) } else { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } @@ -390,12 +387,12 @@ TextCoords(interp, canvas, itemPtr, argc, argv) */ static int -ConfigureText(interp, canvas, itemPtr, argc, argv, flags) +ConfigureText(interp, canvas, itemPtr, objc, objv, flags) Tcl_Interp *interp; /* Interpreter for error reporting. */ Tk_Canvas canvas; /* Canvas containing itemPtr. */ Tk_Item *itemPtr; /* Rectangle item to reconfigure. */ - int argc; /* Number of elements in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing things to configure. */ + int objc; /* Number of elements in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */ int flags; /* Flags to pass to Tk_ConfigureWidget. */ { TextItem *textPtr = (TextItem *) itemPtr; @@ -410,7 +407,7 @@ ConfigureText(interp, canvas, itemPtr, argc, argv, flags) Tk_State state; tkwin = Tk_CanvasTkwin(canvas); - if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc, (char **) argv, + if (Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, (char **) objv, (char *) textPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index fab0015..ed218b2 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvWind.c,v 1.4 1999/12/14 06:52:26 hobbs Exp $ + * RCS: @(#) $Id: tkCanvWind.c,v 1.5 2001/07/03 06:03:44 hobbs Exp $ */ #include <stdio.h> @@ -75,11 +75,11 @@ static Tk_ConfigSpec configSpecs[] = { static void ComputeWindowBbox _ANSI_ARGS_((Tk_Canvas canvas, WindowItem *winItemPtr)); static int ConfigureWinItem _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[], int flags)); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[], int flags)); static int CreateWinItem _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int objc, Tcl_Obj *CONST objv[])); static void DeleteWinItem _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display)); static void DisplayWinItem _ANSI_ARGS_((Tk_Canvas canvas, @@ -91,8 +91,8 @@ static void ScaleWinItem _ANSI_ARGS_((Tk_Canvas canvas, static void TranslateWinItem _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY)); static int WinItemCoords _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[])); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[])); static void WinItemLostSlaveProc _ANSI_ARGS_(( ClientData clientData, Tk_Window tkwin)); static void WinItemRequestProc _ANSI_ARGS_((ClientData clientData, @@ -175,30 +175,27 @@ static Tk_GeomMgr canvasGeomType = { */ static int -CreateWinItem(interp, canvas, itemPtr, argc, argv) +CreateWinItem(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Interpreter for error reporting. */ Tk_Canvas canvas; /* Canvas to hold new item. */ Tk_Item *itemPtr; /* Record to hold new item; header * has been initialized by caller. */ - int argc; /* Number of arguments in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing window. */ + int objc; /* Number of arguments in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing window. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; - int i; + int i = 2; - if (argc==1) { + if (objc == 1) { i = 1; - } else { - char *arg = Tcl_GetStringFromObj(argv[1], NULL); - if (((argc>1) && (arg[0] == '-') - && (arg[1] >= 'a') && (arg[1] <= 'z'))) { + } else if (objc > 1) { + char *arg = Tcl_GetString(objv[1]); + if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; - } else { - i = 2; } } - if (argc < i) { + if (objc < i) { Tcl_AppendResult(interp, "wrong # args: should be \"", Tk_PathName(Tk_CanvasTkwin(canvas)), " create ", itemPtr->typePtr->name, " x y ?options?\"", @@ -220,10 +217,10 @@ CreateWinItem(interp, canvas, itemPtr, argc, argv) * Process the arguments to fill in the item record. */ - if ((WinItemCoords(interp, canvas, itemPtr, i, argv) != TCL_OK)) { + if ((WinItemCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) { goto error; } - if (ConfigureWinItem(interp, canvas, itemPtr, argc-i, argv+i, 0) == TCL_OK) { + if (ConfigureWinItem(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) { return TCL_OK; } @@ -251,40 +248,40 @@ CreateWinItem(interp, canvas, itemPtr, argc, argv) */ static int -WinItemCoords(interp, canvas, itemPtr, argc, argv) +WinItemCoords(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing item. */ Tk_Item *itemPtr; /* Item whose coordinates are to be * read or modified. */ - int argc; /* Number of coordinates supplied in - * argv. */ - Tcl_Obj *CONST argv[]; /* Array of coordinates: x1, y1, + int objc; /* Number of coordinates supplied in + * objv. */ + Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, * x2, y2, ... */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; - if (argc == 0) { + if (objc == 0) { Tcl_Obj *obj = Tcl_NewObj(); Tcl_Obj *subobj = Tcl_NewDoubleObj(winItemPtr->x); Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewDoubleObj(winItemPtr->y); Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_SetObjResult(interp, obj); - } else if (argc < 3) { - if (argc==1) { - if (Tcl_ListObjGetElements(interp, argv[0], &argc, - (Tcl_Obj ***) &argv) != TCL_OK) { + } else if (objc < 3) { + if (objc==1) { + if (Tcl_ListObjGetElements(interp, objv[0], &objc, + (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; - } else if (argc != 2) { + } else if (objc != 2) { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 2, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 2, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } } - if ((Tk_CanvasGetCoordFromObj(interp, canvas, argv[0], &winItemPtr->x) - != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[1], + if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &winItemPtr->x) + != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &winItemPtr->y) != TCL_OK)) { return TCL_ERROR; } @@ -292,7 +289,7 @@ WinItemCoords(interp, canvas, itemPtr, argc, argv) } else { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } @@ -318,12 +315,12 @@ WinItemCoords(interp, canvas, itemPtr, argc, argv) */ static int -ConfigureWinItem(interp, canvas, itemPtr, argc, argv, flags) +ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing itemPtr. */ Tk_Item *itemPtr; /* Window item to reconfigure. */ - int argc; /* Number of elements in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing things to configure. */ + int objc; /* Number of elements in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */ int flags; /* Flags to pass to Tk_ConfigureWidget. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; @@ -332,7 +329,7 @@ ConfigureWinItem(interp, canvas, itemPtr, argc, argv, flags) oldWindow = winItemPtr->tkwin; canvasTkwin = Tk_CanvasTkwin(canvas); - if (Tk_ConfigureWidget(interp, canvasTkwin, configSpecs, argc, (char **) argv, + if (Tk_ConfigureWidget(interp, canvasTkwin, configSpecs, objc, (char **) objv, (char *) winItemPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index 95634c5..10ab308 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkRectOval.c,v 1.7 2000/04/19 22:20:45 ericm Exp $ + * RCS: @(#) $Id: tkRectOval.c,v 1.8 2001/07/03 06:03:44 hobbs Exp $ */ #include <stdio.h> @@ -142,11 +142,11 @@ static Tk_ConfigSpec configSpecs[] = { static void ComputeRectOvalBbox _ANSI_ARGS_((Tk_Canvas canvas, RectOvalItem *rectOvalPtr)); static int ConfigureRectOval _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[], int flags)); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[], int flags)); static int CreateRectOval _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[])); + int objc, Tcl_Obj *CONST objv[])); static void DeleteRectOval _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display)); static void DisplayRectOval _ANSI_ARGS_((Tk_Canvas canvas, @@ -157,8 +157,8 @@ static int OvalToArea _ANSI_ARGS_((Tk_Canvas canvas, static double OvalToPoint _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr)); static int RectOvalCoords _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[])); + Tk_Canvas canvas, Tk_Item *itemPtr, int objc, + Tcl_Obj *CONST objv[])); static int RectOvalToPostscript _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass)); static int RectToArea _ANSI_ARGS_((Tk_Canvas canvas, @@ -243,31 +243,28 @@ Tk_ItemType tkOvalType = { */ static int -CreateRectOval(interp, canvas, itemPtr, argc, argv) +CreateRectOval(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* For error reporting. */ Tk_Canvas canvas; /* Canvas to hold new item. */ Tk_Item *itemPtr; /* Record to hold new item; header * has been initialized by caller. */ - int argc; /* Number of arguments in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing rectangle. */ + int objc; /* Number of arguments in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; - int i; + int i = 4; - if (argc==1) { + if (objc == 1) { i = 1; - } else { - char *arg = Tcl_GetStringFromObj(argv[1], NULL); - if ((argc>1) && (arg[0] == '-') - && (arg[1] >= 'a') && (arg[1] <= 'z')) { + } else if (objc > 1) { + char *arg = Tcl_GetString(objv[1]); + if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; - } else { - i = 4; } } - if (argc < i) { + if (objc < i) { Tcl_AppendResult(interp, "wrong # args: should be \"", Tk_PathName(Tk_CanvasTkwin(canvas)), " create ", itemPtr->typePtr->name, " x1 y1 x2 y2 ?options?\"", @@ -296,10 +293,10 @@ CreateRectOval(interp, canvas, itemPtr, argc, argv) * Process the arguments to fill in the item record. */ - if ((RectOvalCoords(interp, canvas, itemPtr, i, argv) != TCL_OK)) { + if ((RectOvalCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) { goto error; } - if (ConfigureRectOval(interp, canvas, itemPtr, argc-i, argv+i, 0) + if (ConfigureRectOval(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) { return TCL_OK; } @@ -328,19 +325,19 @@ CreateRectOval(interp, canvas, itemPtr, argc, argv) */ static int -RectOvalCoords(interp, canvas, itemPtr, argc, argv) +RectOvalCoords(interp, canvas, itemPtr, objc, objv) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing item. */ Tk_Item *itemPtr; /* Item whose coordinates are to be * read or modified. */ - int argc; /* Number of coordinates supplied in - * argv. */ - Tcl_Obj *CONST argv[]; /* Array of coordinates: x1, y1, + int objc; /* Number of coordinates supplied in + * objv. */ + Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, * x2, y2, ... */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; - if (argc == 0) { + if (objc == 0) { Tcl_Obj *obj = Tcl_NewObj(); Tcl_Obj *subobj = Tcl_NewDoubleObj(rectOvalPtr->bbox[0]); Tcl_ListObjAppendElement(interp, obj, subobj); @@ -351,26 +348,26 @@ RectOvalCoords(interp, canvas, itemPtr, argc, argv) subobj = Tcl_NewDoubleObj(rectOvalPtr->bbox[3]); Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_SetObjResult(interp, obj); - } else if ((argc == 1)||(argc == 4)) { - if (argc==1) { - if (Tcl_ListObjGetElements(interp, argv[0], &argc, - (Tcl_Obj ***) &argv) != TCL_OK) { + } else if ((objc == 1)||(objc == 4)) { + if (objc==1) { + if (Tcl_ListObjGetElements(interp, objv[0], &objc, + (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; - } else if (argc != 4) { + } else if (objc != 4) { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } } - if ((Tk_CanvasGetCoordFromObj(interp, canvas, argv[0], + if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &rectOvalPtr->bbox[0]) != TCL_OK) - || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[1], + || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &rectOvalPtr->bbox[1]) != TCL_OK) - || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[2], + || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[2], &rectOvalPtr->bbox[2]) != TCL_OK) - || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[3], + || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[3], &rectOvalPtr->bbox[3]) != TCL_OK)) { return TCL_ERROR; } @@ -378,7 +375,7 @@ RectOvalCoords(interp, canvas, itemPtr, argc, argv) } else { char buf[64 + TCL_INTEGER_SPACE]; - sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", argc); + sprintf(buf, "wrong # coordinates: expected 0 or 4, got %d", objc); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } @@ -406,12 +403,12 @@ RectOvalCoords(interp, canvas, itemPtr, argc, argv) */ static int -ConfigureRectOval(interp, canvas, itemPtr, argc, argv, flags) +ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags) Tcl_Interp *interp; /* Used for error reporting. */ Tk_Canvas canvas; /* Canvas containing itemPtr. */ Tk_Item *itemPtr; /* Rectangle item to reconfigure. */ - int argc; /* Number of elements in argv. */ - Tcl_Obj *CONST argv[]; /* Arguments describing things to configure. */ + int objc; /* Number of elements in objv. */ + Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */ int flags; /* Flags to pass to Tk_ConfigureWidget. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; @@ -426,7 +423,7 @@ ConfigureRectOval(interp, canvas, itemPtr, argc, argv, flags) tkwin = Tk_CanvasTkwin(canvas); - if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc, (char **) argv, + if (Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, (char **) objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } |