Ticket #2126: expect-5.43-avoid-tcl-internals-1.patch

File expect-5.43-avoid-tcl-internals-1.patch, 3.3 KB (added by bryan@linuxfromscratch.org, 17 years ago)
  • exp_command.c

    Submitted By: Bryan Kadzban <bryan@kadzban.is-a-geek.net>
    Date: 2008-01-12
    Initial Package Version: 5.43
    Upstream status: Not Submitted - Test Version
    Origin: LFS ticket 2126 (http://wiki.linuxfromscratch.org/lfs/ticket/2126)
    Description: Removes references to functions that Tcl 8.5 no longer exposes.
    
    diff -Naur expect-5.43/exp_command.c expect-5.43-patched/exp_command.c
    old new  
    22652265        /*NOTREACHED*/
    22662266}
    22672267
     2268static struct exp_cmd_data cmd_data[];
     2269
    22682270/*ARGSUSED*/
    22692271static int
    22702272Exp_CloseObjCmd(clientData, interp, objc, objv)
     
    23112313        /* Historical note: we used "close"  long before there was a */
    23122314        /* Tcl builtin by the same name. */
    23132315
     2316        /* The code that registered this function as the handler for */
     2317        /* the "close" command stored away the old handler in the */
     2318        /* exp_cmd_data for the "close" command. */
     2319
     2320        struct exp_cmd_data *cmd_ptr;
    23142321        Tcl_CmdInfo info;
     2322
     2323        for(cmd_ptr = &cmd_data[0]; cmd_ptr->name; cmd_ptr++) {
     2324            if(strncmp(cmd_ptr->name, "close", 5) == 0)
     2325                break;
     2326        }
     2327
    23152328        Tcl_ResetResult(interp);
    23162329        if (0 == Tcl_GetCommandInfo(interp,"close",&info)) {
    23172330            info.clientData = 0;
    23182331        }
    2319         return(Tcl_CloseObjCmd(info.clientData,interp,objc_orig,objv_orig));
     2332        return(cmd_ptr->old_objProc(info.clientData,interp,objc_orig,objv_orig));
    23202333    }
    23212334
    23222335    if (chanName) {
     
    29612974    /* if successful (i.e., TCL_RETURN is returned) */
    29622975    /* modify the result, so that we will handle it specially */
    29632976
    2964     int result = Tcl_ReturnObjCmd(clientData,interp,objc,objv);
     2977    Tcl_CmdInfo info;
     2978    Tcl_GetCommandInfo(interp, "return", &info);
     2979
     2980    int result = info.objProc(clientData,interp,objc,objv);
    29652981    if (result == TCL_RETURN)
    29662982        result = EXP_TCL_RETURN;
    29672983    return result;
     
    30623078
    30633079        for (;c->name;c++) {
    30643080                /* if already defined, don't redefine */
    3065                 if ((c->flags & EXP_REDEFINE) ||
    3066                     !(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
     3081                if (!(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
    30673082                      Tcl_FindHashEntry(&currNsPtr->cmdTable,c->name))) {
    30683083                        if (c->objproc)
    30693084                                Tcl_CreateObjCommand(interp,c->name,
     
    30723087                                Tcl_CreateCommand(interp,c->name,c->proc,
    30733088                                                  c->data,exp_deleteProc);
    30743089                }
     3090                else if (c->flags & EXP_REDEFINE) { /* unless the REDEFINE flag is present */
     3091                        Tcl_CmdInfo info;
     3092
     3093                        if (Tcl_GetCommandInfo(interp, c->name, &info)) {
     3094                                c->old_proc     = info.proc;
     3095                                c->old_objProc  = info.objProc;
     3096                        }
     3097
     3098                        if (c->objproc)
     3099                                Tcl_CreateObjCommand(interp,c->name,
     3100                                                     c->objproc,c->data,exp_deleteObjProc);
     3101                        else
     3102                                Tcl_CreateCommand(interp,c->name,c->proc,
     3103                                                  c->data,exp_deleteProc);
     3104                }
    30753105                if (!(c->name[0] == 'e' &&
    30763106                      c->name[1] == 'x' &&
    30773107                      c->name[2] == 'p')
  • exp_command.h

    diff -Naur expect-5.43/exp_command.h expect-5.43-patched/exp_command.h
    old new  
    297297        Tcl_CmdProc     *proc;
    298298        ClientData      data;
    299299        int             flags;
     300        Tcl_CmdProc     *old_proc;     /* these store the procedure for the old command, */
     301        Tcl_ObjCmdProc  *old_objProc;  /* if any */
    300302};
    301303
    302304EXTERN void             exp_create_commands _ANSI_ARGS_((Tcl_Interp *,