]> git.pld-linux.org Git - packages/expect.git/blob - expect-tcl85.patch
- fix for compilation with TCL 8.5, taken from
[packages/expect.git] / expect-tcl85.patch
1 diff -ur expect-5.43.orig/exp_command.c expect-5.43/exp_command.c
2 --- expect-5.43.orig/exp_command.c      2004-08-20 19:18:01.000000000 +0200
3 +++ expect-5.43/exp_command.c   2008-01-19 17:40:20.000000000 +0100
4 @@ -2265,6 +2265,8 @@
5         /*NOTREACHED*/
6  }
7  
8 +static struct exp_cmd_data cmd_data[];
9 +
10  /*ARGSUSED*/
11  static int
12  Exp_CloseObjCmd(clientData, interp, objc, objv)
13 @@ -2311,12 +2313,23 @@
14         /* Historical note: we used "close"  long before there was a */
15         /* Tcl builtin by the same name. */
16  
17 +       /* The code that registered this function as the handler for */
18 +       /* the "close" command stored away the old handler in the */
19 +       /* exp_cmd_data for the "close" command. */
20 +
21 +       struct exp_cmd_data *cmd_ptr;
22         Tcl_CmdInfo info;
23 +
24 +       for(cmd_ptr = &cmd_data[0]; cmd_ptr->name; cmd_ptr++) {
25 +           if(strncmp(cmd_ptr->name, "close", 5) == 0)
26 +               break;
27 +       }
28 +
29         Tcl_ResetResult(interp);
30         if (0 == Tcl_GetCommandInfo(interp,"close",&info)) {
31             info.clientData = 0;
32         }
33 -       return(Tcl_CloseObjCmd(info.clientData,interp,objc_orig,objv_orig));
34 +       return(cmd_ptr->old_objProc(info.clientData,interp,objc_orig,objv_orig));
35      }
36  
37      if (chanName) {
38 @@ -2961,7 +2974,10 @@
39      /* if successful (i.e., TCL_RETURN is returned) */
40      /* modify the result, so that we will handle it specially */
41  
42 -    int result = Tcl_ReturnObjCmd(clientData,interp,objc,objv);
43 +    Tcl_CmdInfo info;
44 +    Tcl_GetCommandInfo(interp, "return", &info);
45 +
46 +    int result = info.objProc(clientData,interp,objc,objv);
47      if (result == TCL_RETURN)
48          result = EXP_TCL_RETURN;
49      return result;
50 @@ -3062,8 +3078,7 @@
51  
52         for (;c->name;c++) {
53                 /* if already defined, don't redefine */
54 -               if ((c->flags & EXP_REDEFINE) ||
55 -                   !(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
56 +               if (!(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
57                       Tcl_FindHashEntry(&currNsPtr->cmdTable,c->name))) {
58                         if (c->objproc)
59                                 Tcl_CreateObjCommand(interp,c->name,
60 @@ -3072,6 +3087,21 @@
61                                 Tcl_CreateCommand(interp,c->name,c->proc,
62                                                   c->data,exp_deleteProc);
63                 }
64 +               else if (c->flags & EXP_REDEFINE) { /* unless the REDEFINE flag is present */
65 +                       Tcl_CmdInfo info;
66 +
67 +                       if (Tcl_GetCommandInfo(interp, c->name, &info)) {
68 +                               c->old_proc     = info.proc;
69 +                               c->old_objProc  = info.objProc;
70 +                       }
71 +
72 +                       if (c->objproc)
73 +                               Tcl_CreateObjCommand(interp,c->name,
74 +                                                    c->objproc,c->data,exp_deleteObjProc);
75 +                       else
76 +                               Tcl_CreateCommand(interp,c->name,c->proc,
77 +                                                 c->data,exp_deleteProc);
78 +               }
79                 if (!(c->name[0] == 'e' &&
80                       c->name[1] == 'x' &&
81                       c->name[2] == 'p')
82 diff -ur expect-5.43.orig/exp_command.h expect-5.43/exp_command.h
83 --- expect-5.43.orig/exp_command.h      2004-07-30 17:35:28.000000000 +0200
84 +++ expect-5.43/exp_command.h   2008-01-19 17:40:20.000000000 +0100
85 @@ -295,6 +295,8 @@
86         Tcl_CmdProc     *proc;
87         ClientData      data;
88         int             flags;
89 +       Tcl_CmdProc     *old_proc;     /* these store the procedure for the old command, */
90 +       Tcl_ObjCmdProc  *old_objProc;  /* if any */
91  };
92  
93  EXTERN void            exp_create_commands _ANSI_ARGS_((Tcl_Interp *,
94 diff -ur expect-5.43.orig/exp_inter.c expect-5.43/exp_inter.c
95 --- expect-5.43.orig/exp_inter.c        2004-08-18 04:03:00.000000000 +0200
96 +++ expect-5.43/exp_inter.c     2008-01-19 17:40:01.000000000 +0100
97 @@ -35,7 +35,7 @@
98  
99  #include <ctype.h>
100  
101 -#include "tcl.h"
102 +#include "tclInt.h"
103  #include "string.h"
104  
105  #include "exp_tty_in.h"
This page took 0.041613 seconds and 3 git commands to generate.