From 7aa211a9febb24a260408082576cd25e820e8872 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 12 Oct 2001 14:30:36 +0000 Subject: Adaptation pour perl-tk 800.023 --- debian/control | 2 +- generic/Item.c | 3 -- generic/tkZinc.c | 86 ++------------------------------------------------------ generic/tkZinc.h | 15 +++------- sandbox/local.pl | 2 ++ 5 files changed, 9 insertions(+), 99 deletions(-) diff --git a/debian/control b/debian/control index 9858c54..df819c4 100644 --- a/debian/control +++ b/debian/control @@ -19,7 +19,7 @@ Description: The Tk Zinc widget. Package: zinc-perl Architecture: i386 -Depends: perl-tk (>= 800.015), zinc-tk (= ${Source-Version}) +Depends: perl-tk (>= 800.023), zinc-tk (= ${Source-Version}) Provides: zinc-perl Conflicts: xradar3-perl Description: perl-tk variant of the Tk Zinc widget. diff --git a/generic/Item.c b/generic/Item.c index 361754d..c47d822 100644 --- a/generic/Item.c +++ b/generic/Item.c @@ -1538,9 +1538,6 @@ QueryAttribute(char *record, else if (attr_uid == desc->uid) { result = Tcl_GetObjResult(wi->interp); AttributeToObj(wi, record, desc, buffer, result); -#ifdef PTK0 - Tcl_DecrRefCount(result); -#endif break; } else { diff --git a/generic/tkZinc.c b/generic/tkZinc.c index e4a5f8f..82b4ce0 100644 --- a/generic/tkZinc.c +++ b/generic/tkZinc.c @@ -269,36 +269,6 @@ static void InitZinc _ANSI_ARGS_((Tcl_Interp *interp)); static void Focus _ANSI_ARGS_((WidgetInfo *wi, ZnBool got_focus)); -#ifdef PTK -Tcl_Obj * -NewLongObj(long val) -{ - Tcl_Obj *obj = Tcl_NewIntObj(0); - Tcl_SetLongObj(obj, val); - return obj; -} -#endif - -#ifdef PTK -Tcl_Obj * -NewBooleanObj(ZnBool val) -{ - Tcl_Obj *obj = Tcl_NewIntObj(0); - Tcl_SetBooleanObj(obj, val); - return obj; -} -#endif - -#ifdef PTK -Tcl_Obj * -NewDoubleObj(ZnReal val) -{ - Tcl_Obj *obj = Tcl_NewIntObj(0); - Tcl_SetDoubleObj(obj, val); - return obj; -} -#endif - Tcl_Obj * NewStringObj(char *str) { return Tcl_NewStringObj(str, strlen(str)); @@ -310,13 +280,11 @@ SetStringObj(Tcl_Obj *o, return Tcl_SetStringObj(o, str, strlen(str)); } -#if 1 char * Tcl_GetString(Tcl_Obj *obj) { return Tcl_GetStringFromObj(obj, NULL); } -#endif /* @@ -628,7 +596,7 @@ ZincObjCmd(ClientData client_data, /* Main window associated with } #ifdef PTK - Tcl_SetObjResult(interp, LangWidgetArg(interp, tkwin)); + Tcl_SetObjResult(interp, LangWidgetObj(interp, tkwin)); #else Tcl_SetObjResult(interp, NewStringObj(Tk_PathName(tkwin))); #endif @@ -2588,9 +2556,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ wi->hot_prev = item->previous; l = NewLongObj(item->id); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } break; /* @@ -2746,16 +2711,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ int append = 0; unsigned long mask; -#ifdef PTK - str = LangString(args[4]); -#else str = Tcl_GetString(args[4]); -#endif if (str[0] == 0) { result = Tk_DeleteBinding(interp, wi->binding_table, elem, Tcl_GetString(args[3])); goto done; - } + } #ifdef PTK mask = Tk_CreateBinding(interp, wi->binding_table, elem, Tcl_GetString(args[3]), args[4], append); @@ -2797,7 +2758,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ } #ifdef PTK Tcl_SetObjResult(interp, command); - Tcl_DecrRefCount(command); #else Tcl_SetObjResult(interp, NewStringObj(command)); #endif @@ -2964,9 +2924,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ l = NULL; wi->current_item->class->Part(wi->current_item, &l, &wi->current_part); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } } break; @@ -3121,9 +3078,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ if (item != ZN_NO_ITEM) { l = NewLongObj(item->id); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } goto done; } @@ -3195,9 +3149,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ if (item->parent != ZN_NO_ITEM) { l = NewLongObj(item->parent->id); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } else { /* @@ -3205,9 +3156,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ */ l = NewLongObj(item->id); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } } break; @@ -3227,9 +3175,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ } l = NewBooleanObj(item->class->has_anchors?1:0); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } break; /* @@ -3248,9 +3193,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ } l = NewBooleanObj(item->class->has_fields?1:0); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } break; /* @@ -3273,9 +3215,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ if (!item->tags || !ZnListSize(item->tags)) { l = NewBooleanObj(0); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } else { num = ZnListSize(item->tags); @@ -3285,17 +3224,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ if (tags[i] == tag_uid) { l = NewBooleanObj(1); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif goto done; } } l = NewBooleanObj(0); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } } break; @@ -3320,9 +3253,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ } l = Tcl_NewIntObj(index); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif goto done; } } @@ -3533,9 +3463,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ } l = NewBooleanObj(item->class->num_parts!=0); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } break; /* @@ -3801,9 +3728,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ if (wi->text_info.sel_item != ZN_NO_ITEM) { l = NewLongObj(wi->text_info.sel_item->id); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } break; case ZN_SEL_TO: @@ -4094,9 +4018,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ if (item != ZN_NO_ITEM) { l = NewStringObj(item->class->name); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } } break; @@ -6081,9 +6002,6 @@ MapInfoObjCmd(ClientData client_data, } l = Tcl_NewIntObj(count); Tcl_SetObjResult(interp, l); -#ifdef PTK - Tcl_DecrRefCount(l); -#endif } break; /* diff --git a/generic/tkZinc.h b/generic/tkZinc.h index cd052be..acb4471 100644 --- a/generic/tkZinc.h +++ b/generic/tkZinc.h @@ -60,20 +60,13 @@ typedef struct _TagSearch { ZnList item_stack; } TagSearch; -#ifdef PTK -Tcl_Obj *NewLongObj(long val); -Tcl_Obj *NewBooleanObj(ZnBool val); -Tcl_Obj *NewDoubleObj(ZnReal val); -#else -# define NewLongObj Tcl_NewLongObj -# define NewBooleanObj Tcl_NewBooleanObj -# define NewDoubleObj Tcl_NewDoubleObj -#endif +#define NewLongObj Tcl_NewLongObj +#define NewBooleanObj Tcl_NewBooleanObj +#define NewDoubleObj Tcl_NewDoubleObj + Tcl_Obj *NewStringObj(char *val); void SetStringObj(Tcl_Obj *o, char *val); -#if 1 char *Tcl_GetString(Tcl_Obj *obj); -#endif int ZnItemWithTagOrId(WidgetInfo *wi, Tcl_Obj *tag_or_id, Item group, ZnBool recursive, Item *item, TagSearch **search_var); diff --git a/sandbox/local.pl b/sandbox/local.pl index a1e981e..b66f179 100644 --- a/sandbox/local.pl +++ b/sandbox/local.pl @@ -150,4 +150,6 @@ $zinc->translate($rect, -150, -150); $zinc->rotate($rect, 35); $zinc->translate($rect, 150, 150); +$mw->Tk::bind('', sub { exit(0); }); + MainLoop(); -- cgit v1.1