From 14af846df5c01a8d5e6edc35e2ba6fa2e3011b56 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Mon, 5 Jun 2000 12:03:13 +0000 Subject: Passage en Tcl_Objs et compilation conditionnelle de GPC --- generic/Rectangle.c | 54 +++++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) (limited to 'generic/Rectangle.c') diff --git a/generic/Rectangle.c b/generic/Rectangle.c index c85dc98..f31b96f 100644 --- a/generic/Rectangle.c +++ b/generic/Rectangle.c @@ -155,17 +155,14 @@ RectTileChange(ClientData client_data, ********************************************************************************** */ static int -Init(Item item, - int *argc, - Arg **args) +Init(Item item, + int *argc, + Tcl_Obj *CONST *args[]) { WidgetInfo *wi = item->wi; RectangleItem rect = (RectangleItem) item; - Arg *elems; - int result, num_elems; -#ifdef PTK - LangFreeProc *freeProc = NULL; -#endif + Tcl_Obj **elems; + int num_elems; rect->gradient = NULL; @@ -180,42 +177,17 @@ Init(Item item, Tcl_AppendResult(wi->interp, " rectangle coords expected", NULL); return ZN_ERROR; } - result = Lang_SplitList(wi->interp, (*args)[0], &num_elems, &elems, &freeProc); - if ((result == ZN_ERROR) || (num_elems != 4)) { - rect_error: -#ifdef PTK - if (elems != NULL && freeProc) { - (*freeProc)(num_elems, elems); - } -#endif + if ((Tcl_ListObjGetElements(wi->interp, (*args)[0], &num_elems, &elems) == ZN_ERROR) || + (num_elems != 4) || + (Tcl_GetDoubleFromObj(wi->interp, elems[0], &rect->coords[0].x) == ZN_ERROR) || + (Tcl_GetDoubleFromObj(wi->interp, elems[1], &rect->coords[0].y) == ZN_ERROR) || + (Tcl_GetDoubleFromObj(wi->interp, elems[2], &rect->coords[1].x) == ZN_ERROR) || + (Tcl_GetDoubleFromObj(wi->interp, elems[3], &rect->coords[1].y) == ZN_ERROR)) { Tcl_AppendResult(wi->interp, " malformed rectangle coords", NULL); return ZN_ERROR; - } - if (Tcl_GetDouble(wi->interp, elems[0], &rect->coords[0].x) == ZN_ERROR) { - rect_error2: -#ifndef PTK - Tcl_Free((char *) elems); -#endif - goto rect_error; - }; - if (Tcl_GetDouble(wi->interp, elems[1], &rect->coords[0].y) == ZN_ERROR) { - goto rect_error2; - }; - if (Tcl_GetDouble(wi->interp, elems[2], &rect->coords[1].x) == ZN_ERROR) { - goto rect_error2; - }; - if (Tcl_GetDouble(wi->interp, elems[3], &rect->coords[1].y) == ZN_ERROR) { - goto rect_error2; }; (*args)++; (*argc)--; -#ifndef PTK - Tcl_Free((char *) elems); -#else - if (freeProc) { - (*freeProc)(num_elems, elems); - } -#endif CLEAR(rect->flags, FILLED_BIT); rect->relief = RELIEF_FLAT; @@ -321,7 +293,7 @@ Destroy(Item item) static int Configure(Item item, int argc, - ZnAttrList argv, + Tcl_Obj *CONST argv[], int *flags) { WidgetInfo *wi = item->wi; @@ -376,7 +348,7 @@ Configure(Item item, static int Query(Item item, int argc, - ZnAttrList argv) + Tcl_Obj *CONST argv[]) { if (ITEM_P.QueryAttribute((char *) item, -1, argv[0]) == ZN_ERROR) { return ZN_ERROR; -- cgit v1.1