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/Arc.c | 64 +++++++++++++++++------------------------------------------ 1 file changed, 18 insertions(+), 46 deletions(-) (limited to 'generic/Arc.c') diff --git a/generic/Arc.c b/generic/Arc.c index 917eb0a..797f671 100644 --- a/generic/Arc.c +++ b/generic/Arc.c @@ -179,17 +179,14 @@ ArcTileChange(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; ArcItem arc = (ArcItem) item; - Arg *elems; - int result, num_elems; -#ifdef PTK - LangFreeProc *freeProc = NULL; -#endif + Tcl_Obj **elems; + int num_elems; /* Init attributes */ SET(item->flags, VISIBLE_BIT); @@ -217,42 +214,17 @@ Init(Item item, Tcl_AppendResult(wi->interp, " arc coords expected", NULL); return ZN_ERROR; } - result = Lang_SplitList(wi->interp, (*args)[0], &num_elems, &elems, &freeProc); - if ((result == ZN_ERROR) || (num_elems != 4)) { - arc_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], &arc->coords[0].x) == ZN_ERROR) || + (Tcl_GetDoubleFromObj(wi->interp, elems[1], &arc->coords[0].y) == ZN_ERROR) || + (Tcl_GetDoubleFromObj(wi->interp, elems[2], &arc->coords[1].x) == ZN_ERROR) || + (Tcl_GetDoubleFromObj(wi->interp, elems[3], &arc->coords[1].y) == ZN_ERROR)) { Tcl_AppendResult(wi->interp, " malformed arc coords", NULL); return ZN_ERROR; - } - if (Tcl_GetDouble(wi->interp, elems[0], &arc->coords[0].x) == ZN_ERROR) { - arc_error2: -#ifndef PTK - Tcl_Free((char *) elems); -#endif - goto arc_error; - }; - if (Tcl_GetDouble(wi->interp, elems[1], &arc->coords[0].y) == ZN_ERROR) { - goto arc_error2; - }; - if (Tcl_GetDouble(wi->interp, elems[2], &arc->coords[1].x) == ZN_ERROR) { - goto arc_error2; - }; - if (Tcl_GetDouble(wi->interp, elems[3], &arc->coords[1].y) == ZN_ERROR) { - goto arc_error2; }; (*args)++; (*argc)--; -#ifndef PTK - Tcl_Free((char *) elems); -#else - if (freeProc) { - (*freeProc)(num_elems, elems); - } -#endif arc->fill_color = ZnGetColorGradient(wi->interp, wi->win, ZnNameOfColor(wi->fore_color)); @@ -383,7 +355,7 @@ SetRenderFlags(ArcItem arc) static int Configure(Item item, int argc, - ZnAttrList argv, + Tcl_Obj *CONST argv[], int *flags) { WidgetInfo *wi = item->wi; @@ -431,7 +403,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; @@ -721,7 +693,7 @@ ToArea(Item item, ZnPoint pts[20]; /* Should be at least LINE_END_POINTS large */ ZnPoint center, tang; ZnBBox t_area; - int num_points, result, result2; + int num_points, result=-1, result2; ZnReal lw = arc->line_width; ZnReal rx, ry, angle, tmp; ZnBool inside, new_inside; @@ -999,10 +971,10 @@ Draw(Item item) WidgetInfo *wi = item->wi; ArcItem arc = (ArcItem) item; XGCValues values; - int width, height; - ZnPoint *p; - XPoint *xp; - int num_points, i; + int width=0, height=0; + ZnPoint *p=NULL; + XPoint *xp=NULL; + int num_points=0, i; if (ISSET(arc->flags, USING_POLY_BIT) && (ISSET(arc->flags, FILLED_BIT) || (arc->line_width))) { -- cgit v1.1