aboutsummaryrefslogtreecommitdiff
path: root/Bezier.c
diff options
context:
space:
mode:
authorlecoanet2000-06-05 12:03:13 +0000
committerlecoanet2000-06-05 12:03:13 +0000
commit14af846df5c01a8d5e6edc35e2ba6fa2e3011b56 (patch)
tree53cef755c62c6e918425c652b117efcf4c347287 /Bezier.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 'Bezier.c')
-rw-r--r--Bezier.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/Bezier.c b/Bezier.c
index 5ad1230..0de6af5 100644
--- a/Bezier.c
+++ b/Bezier.c
@@ -173,18 +173,15 @@ BzTileChange(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;
BezierItem bz = (BezierItem) item;
- Arg *elems;
- int i, result, num_elems;
+ Tcl_Obj **elems;
+ int i, num_elems;
ZnPoint p;
-#ifdef PTK
- LangFreeProc *freeProc = NULL;
-#endif
bz->dev_points = NULL;
bz->gradient = NULL;
@@ -200,43 +197,28 @@ Init(Item item,
Tcl_AppendResult(wi->interp, " bezier coords expected", NULL);
return ZN_ERROR;
}
- result = Lang_SplitList(wi->interp, (*args)[0], &num_elems, &elems, &freeProc);
- if ((result == ZN_ERROR) || ((num_elems%2) != 0)) {
+ if ((Tcl_ListObjGetElements(wi->interp, (*args)[0], &num_elems, &elems) == ZN_ERROR) ||
+ ((num_elems % 2) != 0)) {
bz_error:
-#ifdef PTK
- if (elems != NULL && freeProc) {
- (*freeProc)(num_elems, elems);
- }
-#endif
Tcl_AppendResult(wi->interp, " malformed bezier coords", NULL);
return ZN_ERROR;
}
bz->points = ZnListNew(num_elems/2, sizeof(ZnPoint));
for (i = 0; i < num_elems; i += 2) {
- if (Tcl_GetDouble(wi->interp, elems[i], &p.x) == ZN_ERROR) {
+ if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &p.x) == ZN_ERROR) {
bz_error2:
-#ifndef PTK
- Tcl_Free((char *) elems);
-#endif
ZnListFree(bz->points);
bz->points = NULL;
goto bz_error;
}
- if (Tcl_GetDouble(wi->interp, elems[i+1], &p.y) == ZN_ERROR) {
+ if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &p.y) == ZN_ERROR) {
goto bz_error2;
}
ZnListAdd(bz->points, &p, ZnListTail);
}
(*args)++;
(*argc)--;
-#ifndef PTK
- Tcl_Free((char *) elems);
-#else
- if (freeProc) {
- (*freeProc)(num_elems, elems);
- }
-#endif
CLEAR(bz->flags, FILLED_BIT);
bz->first_end = NULL;
@@ -399,7 +381,7 @@ SetRenderFlags(BezierItem bz)
static int
Configure(Item item,
int argc,
- ZnAttrList argv,
+ Tcl_Obj *CONST argv[],
int *flags)
{
WidgetInfo *wi = item->wi;
@@ -454,7 +436,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;
@@ -624,7 +606,7 @@ ToArea(Item item,
WidgetInfo *wi = item->wi;
ZnPoint *points;
ZnPoint end_points[LINE_END_POINTS];
- int num_points, result, result2;
+ int num_points, result=-1, result2;
int lw = bz->line_width;
if (bz->dev_points == NULL) {