source: patches/expect-5.43.0-avoid-tcl-internals-1.patch@ 970c8d2

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 970c8d2 was e8e6c4e, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Commit patches from the last commit.

  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[e8e6c4e]1Submitted By: Bryan Kadzban <bryan@kadzban.is-a-geek.net>
2Date: 2008-01-12
3Initial Package Version: 5.43
4Upstream status: Not Submitted - Test Version
5Origin: LFS ticket 2126 (http://wiki.linuxfromscratch.org/lfs/ticket/2126)
6Description: Removes references to functions that Tcl 8.5 no longer exposes.
7
8diff -Naur expect-5.43/exp_command.c expect-5.43-patched/exp_command.c
9--- expect-5.43/exp_command.c 2004-08-20 13:18:01.000000000 -0400
10+++ expect-5.43-patched/exp_command.c 2008-01-12 11:42:45.000000000 -0500
11@@ -2265,6 +2265,8 @@
12 /*NOTREACHED*/
13 }
14
15+static struct exp_cmd_data cmd_data[];
16+
17 /*ARGSUSED*/
18 static int
19 Exp_CloseObjCmd(clientData, interp, objc, objv)
20@@ -2311,12 +2313,23 @@
21 /* Historical note: we used "close" long before there was a */
22 /* Tcl builtin by the same name. */
23
24+ /* The code that registered this function as the handler for */
25+ /* the "close" command stored away the old handler in the */
26+ /* exp_cmd_data for the "close" command. */
27+
28+ struct exp_cmd_data *cmd_ptr;
29 Tcl_CmdInfo info;
30+
31+ for(cmd_ptr = &cmd_data[0]; cmd_ptr->name; cmd_ptr++) {
32+ if(strncmp(cmd_ptr->name, "close", 5) == 0)
33+ break;
34+ }
35+
36 Tcl_ResetResult(interp);
37 if (0 == Tcl_GetCommandInfo(interp,"close",&info)) {
38 info.clientData = 0;
39 }
40- return(Tcl_CloseObjCmd(info.clientData,interp,objc_orig,objv_orig));
41+ return(cmd_ptr->old_objProc(info.clientData,interp,objc_orig,objv_orig));
42 }
43
44 if (chanName) {
45@@ -2961,7 +2974,10 @@
46 /* if successful (i.e., TCL_RETURN is returned) */
47 /* modify the result, so that we will handle it specially */
48
49- int result = Tcl_ReturnObjCmd(clientData,interp,objc,objv);
50+ Tcl_CmdInfo info;
51+ Tcl_GetCommandInfo(interp, "return", &info);
52+
53+ int result = info.objProc(clientData,interp,objc,objv);
54 if (result == TCL_RETURN)
55 result = EXP_TCL_RETURN;
56 return result;
57@@ -3062,8 +3078,7 @@
58
59 for (;c->name;c++) {
60 /* if already defined, don't redefine */
61- if ((c->flags & EXP_REDEFINE) ||
62- !(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
63+ if (!(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
64 Tcl_FindHashEntry(&currNsPtr->cmdTable,c->name))) {
65 if (c->objproc)
66 Tcl_CreateObjCommand(interp,c->name,
67@@ -3072,6 +3087,21 @@
68 Tcl_CreateCommand(interp,c->name,c->proc,
69 c->data,exp_deleteProc);
70 }
71+ else if (c->flags & EXP_REDEFINE) { /* unless the REDEFINE flag is present */
72+ Tcl_CmdInfo info;
73+
74+ if (Tcl_GetCommandInfo(interp, c->name, &info)) {
75+ c->old_proc = info.proc;
76+ c->old_objProc = info.objProc;
77+ }
78+
79+ if (c->objproc)
80+ Tcl_CreateObjCommand(interp,c->name,
81+ c->objproc,c->data,exp_deleteObjProc);
82+ else
83+ Tcl_CreateCommand(interp,c->name,c->proc,
84+ c->data,exp_deleteProc);
85+ }
86 if (!(c->name[0] == 'e' &&
87 c->name[1] == 'x' &&
88 c->name[2] == 'p')
89diff -Naur expect-5.43/exp_command.h expect-5.43-patched/exp_command.h
90--- expect-5.43/exp_command.h 2008-01-12 11:44:11.000000000 -0500
91+++ expect-5.43-patched/exp_command.h 2008-01-12 11:26:05.000000000 -0500
92@@ -297,6 +297,8 @@
93 Tcl_CmdProc *proc;
94 ClientData data;
95 int flags;
96+ Tcl_CmdProc *old_proc; /* these store the procedure for the old command, */
97+ Tcl_ObjCmdProc *old_objProc; /* if any */
98 };
99
100 EXTERN void exp_create_commands _ANSI_ARGS_((Tcl_Interp *,
Note: See TracBrowser for help on using the repository browser.