aboutsummaryrefslogtreecommitdiff
path: root/generic/Rectangle.c
diff options
context:
space:
mode:
authorlecoanet2000-06-05 12:03:13 +0000
committerlecoanet2000-06-05 12:03:13 +0000
commit14af846df5c01a8d5e6edc35e2ba6fa2e3011b56 (patch)
tree53cef755c62c6e918425c652b117efcf4c347287 /generic/Rectangle.c
parent010431ef74a07daf218da2ca2aa436be6b068623 (diff)
downloadtkzinc-14af846df5c01a8d5e6edc35e2ba6fa2e3011b56.zip
tkzinc-14af846df5c01a8d5e6edc35e2ba6fa2e3011b56.tar.gz
tkzinc-14af846df5c01a8d5e6edc35e2ba6fa2e3011b56.tar.bz2
tkzinc-14af846df5c01a8d5e6edc35e2ba6fa2e3011b56.tar.xz
Passage en Tcl_Objs et compilation conditionnelle de GPC
Diffstat (limited to 'generic/Rectangle.c')
-rw-r--r--generic/Rectangle.c54
1 files changed, 13 insertions, 41 deletions
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;