summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvArc.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-07-03 06:03:44 (GMT)
committerhobbs <hobbs>2001-07-03 06:03:44 (GMT)
commitc7761841b1180a34902ee6a49a4a88c127c2d5a2 (patch)
treed82a322c1b1966e7a46b7a95f56775e4d6722eac /generic/tkCanvArc.c
parent4ffd023388cb831e30a995c1e4ff921df75059f5 (diff)
downloadtk-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/tkCanvArc.c')
-rw-r--r--generic/tkCanvArc.c78
1 files changed, 38 insertions, 40 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;
}