Ticket #5570: expect-5.45.4-tcl9-DRAFT.patch
File expect-5.45.4-tcl9-DRAFT.patch, 42.2 KB (added by , 8 weeks ago) |
---|
-
Dbg.c
diff --git a/Dbg.c b/Dbg.c index c7689e5..993cb1b 100644
a b char *argv[]; 362 362 static char buf_basic[DEFAULT_WIDTH+1]; /* basic buffer */ 363 363 static char *buf = buf_basic; 364 364 int space; /* space remaining in buf */ 365 intlen;365 Tcl_Size len; 366 366 char *bufp; 367 367 int proc; /* if current command is "proc" */ 368 368 int arg_index; … … char *argv[]; 398 398 #if TCL_MAJOR_VERSION >= 8 399 399 -1, 400 400 #endif 401 &elementPtr,&nextPtr, (int *)0,(int *)0);401 &elementPtr,&nextPtr,NULL,NULL); 402 402 if (*elementPtr == '\0') wrap = TRUE; 403 403 else if (*nextPtr == '\0') wrap = FALSE; 404 404 else wrap = TRUE; … … Tcl_Obj *objv[]; 443 443 { 444 444 char **argv; 445 445 int argc; 446 intlen;446 Tcl_Size len; 447 447 argv = (char **)ckalloc(objc+1 * sizeof(char *)); 448 448 for (argc=0 ; argc<objc ; argc++) { 449 449 argv[argc] = Tcl_GetStringFromObj(objv[argc],&len); -
exp_chan.c
diff --git a/exp_chan.c b/exp_chan.c index 944200a..377253a 100644
a b 40 40 extern int expSetBlockModeProc _ANSI_ARGS_((int fd, int mode)); 41 41 static int ExpBlockModeProc _ANSI_ARGS_((ClientData instanceData, 42 42 int mode)); 43 static int ExpClose Proc _ANSI_ARGS_((ClientData instanceData,44 Tcl_Interp *interp ));43 static int ExpClose2Proc _ANSI_ARGS_((ClientData instanceData, 44 Tcl_Interp *interp, int flags)); 45 45 static int ExpInputProc _ANSI_ARGS_((ClientData instanceData, 46 46 char *buf, int toRead, int *errorCode)); 47 47 static int ExpOutputProc _ANSI_ARGS_(( 48 ClientData instanceData, c har *buf, int toWrite,48 ClientData instanceData, const char *buf, int toWrite, 49 49 int *errorCode)); 50 50 static void ExpWatchProc _ANSI_ARGS_((ClientData instanceData, 51 51 int mask)); … … void exp_background_channelhandler _ANSI_ARGS_((ClientData, 59 59 */ 60 60 61 61 Tcl_ChannelType expChannelType = { 62 "exp", /* Type name. */ 63 TCL_CHANNEL_VERSION_2, 64 ExpCloseProc, /* Close proc. */ 65 ExpInputProc, /* Input proc. */ 66 ExpOutputProc, /* Output proc. */ 67 NULL, /* Seek proc. */ 68 NULL, /* Set option proc. */ 69 NULL, /* Get option proc. */ 70 ExpWatchProc, /* Initialize notifier. */ 71 ExpGetHandleProc, /* Get OS handles out of channel. */ 72 NULL, /* Close2 proc */ 73 ExpBlockModeProc, /* Set blocking/nonblocking mode.*/ 62 .typeName = "exp", 63 .version = TCL_CHANNEL_VERSION_5, 64 .inputProc = ExpInputProc, 65 .outputProc = ExpOutputProc, 66 .watchProc = ExpWatchProc, 67 .getHandleProc = ExpGetHandleProc, 68 .close2Proc = ExpClose2Proc, 69 .blockModeProc = ExpBlockModeProc, 74 70 }; 75 71 76 72 typedef struct ThreadSpecificData { … … ExpInputProc(instanceData, buf, toRead, errorCodePtr) 261 257 static int 262 258 ExpOutputProc(instanceData, buf, toWrite, errorCodePtr) 263 259 ClientData instanceData; /* Exp state. */ 264 c har *buf; /* The data buffer. */260 const char *buf; /* The data buffer. */ 265 261 int toWrite; /* How many bytes to write? */ 266 262 int *errorCodePtr; /* Where to store error code. */ 267 263 { … … ExpOutputProc(instanceData, buf, toWrite, errorCodePtr) 312 308 313 309 /*ARGSUSED*/ 314 310 static int 315 ExpCloseProc(instanceData, interp) 316 ClientData instanceData; /* Exp state. */ 317 Tcl_Interp *interp; /* For error reporting - unused. */ 311 ExpClose2Proc( 312 ClientData instanceData, /* Exp state. */ 313 Tcl_Interp *interp, /* For error reporting - unused. */ 314 int flags) 318 315 { 316 if (flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) 317 return EINVAL; 318 319 319 ExpState *esPtr = (ExpState *) instanceData; 320 320 ExpState **nextPtrPtr; 321 321 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); … … expSizeZero(esPtr) 502 502 int 503 503 expWriteChars(esPtr,buffer,lenBytes) 504 504 ExpState *esPtr; 505 c har *buffer;505 const char *buffer; 506 506 int lenBytes; 507 507 { 508 508 int rc; -
exp_command.c
diff --git a/exp_command.c b/exp_command.c index b554b18..680ba15 100644
a b expStateCurrent( 191 191 { 192 192 static char *user_spawn_id = "exp0"; 193 193 194 c har *name = exp_get_var(interp,SPAWN_ID_VARNAME);194 const char *name = exp_get_var(interp,SPAWN_ID_VARNAME); 195 195 if (!name) name = user_spawn_id; 196 196 197 197 return expStateFromChannelName(interp,name,opened,adjust,any,SPAWN_ID_VARNAME); … … expStateCheck( 203 203 ExpState *esPtr, 204 204 int open, 205 205 int adjust, 206 c har *msg)206 const char *msg) 207 207 { 208 208 if (open && !esPtr->open) { 209 209 exp_error(interp,"%s: spawn id %s not open",msg,esPtr->name); … … expStateCheck( 216 216 ExpState * 217 217 expStateFromChannelName( 218 218 Tcl_Interp *interp, 219 c har *name,219 const char *name, 220 220 int open, 221 221 int adjust, 222 222 int any, 223 c har *msg)223 const char *msg) 224 224 { 225 225 ExpState *esPtr; 226 226 Tcl_Channel channel; … … exp_trap_on(int master) 284 284 } 285 285 286 286 int 287 exp_trap_off(c har *name)287 exp_trap_off(const char *name) 288 288 { 289 289 #ifdef HAVE_PTYTRAP 290 290 ExpState *esPtr; … … exp_close( 357 357 */ 358 358 359 359 ThreadSpecificData* tsdPtr = TCL_TSD_INIT(&dataKey); 360 c har*cName = Tcl_GetChannelName(esPtr->chan_orig->channel_orig);360 const char* cName = Tcl_GetChannelName(esPtr->chan_orig->channel_orig); 361 361 Tcl_HashEntry* entry = Tcl_FindHashEntry(&tsdPtr->origins,cName); 362 362 ExpOrigin* orig = (ExpOrigin*) Tcl_GetHashValue(entry); 363 363 … … static int 575 575 Exp_SpawnObjCmd( 576 576 ClientData clientData, 577 577 Tcl_Interp *interp, 578 intobjc,578 Tcl_Size objc, 579 579 Tcl_Obj *CONST objv[]) /* Argument objects. */ 580 580 { 581 581 ExpState *esPtr = 0; … … static int 1370 1370 Exp_ExpPidObjCmd( 1371 1371 ClientData clientData, 1372 1372 Tcl_Interp *interp, 1373 intobjc,1373 Tcl_Size objc, 1374 1374 Tcl_Obj *CONST objv[]) /* Argument objects. */ 1375 1375 { 1376 1376 char *chanName = 0; … … static int 1420 1420 Exp_GetpidDeprecatedObjCmd( 1421 1421 ClientData clientData, 1422 1422 Tcl_Interp *interp, 1423 intobjc,1423 Tcl_Size objc, 1424 1424 Tcl_Obj *CONST objv[]) /* Argument objects. */ 1425 1425 { 1426 1426 expDiagLog("getpid is deprecated, use pid\r\n"); … … static int 1433 1433 Exp_SleepObjCmd( 1434 1434 ClientData clientData, 1435 1435 Tcl_Interp *interp, 1436 intobjc,1436 Tcl_Size objc, 1437 1437 Tcl_Obj *CONST objv[]) /* Argument objects. */ 1438 1438 { 1439 1439 double s; … … static int 1491 1491 slow_write( 1492 1492 Tcl_Interp *interp, 1493 1493 ExpState *esPtr, 1494 c har *buffer,1494 const char *buffer, 1495 1495 int rembytes, 1496 1496 struct slow_arg *arg) 1497 1497 { … … slow_write( 1499 1499 1500 1500 while (rembytes > 0) { 1501 1501 int i, bytelen, charlen; 1502 c har *p;1502 const char *p; 1503 1503 1504 1504 p = buffer; 1505 1505 charlen = (arg->size<rembytes?arg->size:rembytes); … … static int 1599 1599 human_write( 1600 1600 Tcl_Interp *interp, 1601 1601 ExpState *esPtr, 1602 c har *buffer,1602 const char *buffer, 1603 1603 struct human_arg *arg) 1604 1604 { 1605 c har *sp;1605 const char *sp; 1606 1606 int size; 1607 1607 float t; 1608 1608 float alpha; … … exp_i_parse_states( 1837 1837 { 1838 1838 struct ExpState *esPtr; 1839 1839 char *p = i->value; 1840 intargc;1841 c har **argv;1840 Tcl_Size argc; 1841 const char **argv; 1842 1842 int j; 1843 1843 1844 1844 if (Tcl_SplitList(NULL, p, &argc, &argv) != TCL_OK) goto error; … … exp_i_update( 1864 1864 Tcl_Interp *interp, 1865 1865 struct exp_i *i) 1866 1866 { 1867 c har *p; /* string representation of list of spawn ids */1867 const char *p; /* string representation of list of spawn ids */ 1868 1868 1869 1869 if (i->direct == EXP_INDIRECT) { 1870 1870 p = Tcl_GetVar(interp,i->variable,TCL_GLOBAL_ONLY); … … static int 1916 1916 Exp_SendLogObjCmd( 1917 1917 ClientData clientData, 1918 1918 Tcl_Interp *interp, 1919 intobjc,1919 Tcl_Size objc, 1920 1920 Tcl_Obj *CONST objv[]) /* Argument objects. */ 1921 1921 { 1922 1922 static char* options[] = { "--", NULL }; … … static int 1960 1960 Exp_SendObjCmd( 1961 1961 ClientData clientData, 1962 1962 Tcl_Interp *interp, 1963 intobjc,1963 Tcl_Size objc, 1964 1964 Tcl_Obj *CONST objv[]) 1965 1965 { 1966 1966 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); … … Exp_SendObjCmd( 1976 1976 #define SEND_STYLE_BREAK 0x20 1977 1977 int send_style = SEND_STYLE_PLAIN; 1978 1978 int want_cooked = TRUE; 1979 c har *string; /* string to send */1980 intlen = -1; /* length of string to send */1979 const char *string; /* string to send */ 1980 Tcl_Size len = -1; /* length of string to send */ 1981 1981 int zeros; /* count of how many ascii zeros to send */ 1982 1982 1983 1983 char *chanName = 0; … … static int 2158 2158 Exp_LogFileObjCmd( 2159 2159 ClientData clientData, 2160 2160 Tcl_Interp *interp, 2161 intobjc,2161 Tcl_Size objc, 2162 2162 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2163 2163 { 2164 2164 static char resultbuf[1000]; … … static int 2291 2291 Exp_LogUserObjCmd( 2292 2292 ClientData clientData, 2293 2293 Tcl_Interp *interp, 2294 intobjc,2294 Tcl_Size objc, 2295 2295 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2296 2296 { 2297 2297 int old_loguser = expLogUserGet(); … … static int 2323 2323 Exp_DebugObjCmd( 2324 2324 ClientData clientData, 2325 2325 Tcl_Interp *interp, 2326 intobjc,2326 Tcl_Size objc, 2327 2327 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2328 2328 { 2329 2329 int now = FALSE; /* soon if FALSE, now if TRUE */ … … static int 2393 2393 Exp_ExpInternalObjCmd( 2394 2394 ClientData clientData, 2395 2395 Tcl_Interp *interp, 2396 intobjc,2396 Tcl_Size objc, 2397 2397 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2398 2398 { 2399 2399 int newChannel = FALSE; … … static int 2473 2473 Exp_ExitObjCmd( 2474 2474 ClientData clientData, 2475 2475 Tcl_Interp *interp, 2476 intobjc,2476 Tcl_Size objc, 2477 2477 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2478 2478 { 2479 2479 int value = 0; … … Exp_ExitObjCmd( 2486 2486 objc--; 2487 2487 objv++; 2488 2488 if (objc) { 2489 intlen;2489 Tcl_Size len; 2490 2490 char* act = Tcl_GetStringFromObj (objv[0], &len); 2491 2491 2492 2492 if (exp_onexit_action) … … static int 2529 2529 Exp_ConfigureObjCmd( 2530 2530 ClientData clientData, 2531 2531 Tcl_Interp *interp, 2532 intobjc,2532 Tcl_Size objc, 2533 2533 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2534 2534 { 2535 2535 /* Magic configuration stuff. */ … … static int 2570 2570 Exp_CloseObjCmd( 2571 2571 ClientData clientData, 2572 2572 Tcl_Interp *interp, 2573 intobjc,2573 Tcl_Size objc, 2574 2574 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2575 2575 { 2576 2576 int onexec_flag = FALSE; /* true if -onexec seen */ … … static int 2708 2708 Exp_StraceObjCmd( 2709 2709 ClientData clientData, 2710 2710 Tcl_Interp *interp, 2711 intobjc,2711 Tcl_Size objc, 2712 2712 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2713 2713 { 2714 2714 static int trace_level = 0; … … static int 2862 2862 Exp_WaitObjCmd( 2863 2863 ClientData clientData, 2864 2864 Tcl_Interp *interp, 2865 intobjc,2865 Tcl_Size objc, 2866 2866 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2867 2867 { 2868 2868 char *chanName = 0; … … static int 3075 3075 Exp_ForkObjCmd( 3076 3076 ClientData clientData, 3077 3077 Tcl_Interp *interp, 3078 intobjc,3078 Tcl_Size objc, 3079 3079 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3080 3080 { 3081 3081 int rc; … … static int 3109 3109 Exp_DisconnectObjCmd( 3110 3110 ClientData clientData, 3111 3111 Tcl_Interp *interp, 3112 intobjc,3112 Tcl_Size objc, 3113 3113 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3114 3114 { 3115 3115 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); … … static int 3219 3219 Exp_OverlayObjCmd( 3220 3220 ClientData clientData, 3221 3221 Tcl_Interp *interp, 3222 intobjc,3222 Tcl_Size objc, 3223 3223 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3224 3224 { 3225 3225 int newfd, oldfd; … … int 3310 3310 Exp_InterpreterObjCmd( 3311 3311 ClientData clientData, 3312 3312 Tcl_Interp *interp, 3313 intobjc,3313 Tcl_Size objc, 3314 3314 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3315 3315 { 3316 3316 Tcl_Obj *eofObj = 0; … … int 3358 3358 Exp_ExpContinueObjCmd( 3359 3359 ClientData clientData, 3360 3360 Tcl_Interp *interp, 3361 intobjc,3361 Tcl_Size objc, 3362 3362 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3363 3363 { 3364 3364 if (objc == 1) { … … int 3378 3378 Exp_InterReturnObjCmd( 3379 3379 ClientData clientData, 3380 3380 Tcl_Interp *interp, 3381 intobjc,3381 Tcl_Size objc, 3382 3382 Tcl_Obj *CONST objv[]) 3383 3383 { 3384 3384 /* let Tcl's return command worry about args */ … … int 3399 3399 Exp_OpenObjCmd( 3400 3400 ClientData clientData, 3401 3401 Tcl_Interp *interp, 3402 intobjc,3402 Tcl_Size objc, 3403 3403 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3404 3404 { 3405 3405 ExpState *esPtr; … … exp_create_commands(interp,c) 3517 3517 !(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) || 3518 3518 Tcl_FindHashEntry(&currNsPtr->cmdTable,c->name))) { 3519 3519 if (c->objproc) 3520 Tcl_CreateObjCommand (interp,c->name,3520 Tcl_CreateObjCommand2(interp,c->name, 3521 3521 c->objproc,c->data,exp_deleteObjProc); 3522 3522 else 3523 3523 Tcl_CreateCommand(interp,c->name,c->proc, … … exp_create_commands(interp,c) 3529 3529 && !(c->flags & EXP_NOPREFIX)) { 3530 3530 sprintf(cmdnamebuf,"exp_%s",c->name); 3531 3531 if (c->objproc) 3532 Tcl_CreateObjCommand (interp,cmdnamebuf,c->objproc,c->data,3532 Tcl_CreateObjCommand2(interp,cmdnamebuf,c->objproc,c->data, 3533 3533 exp_deleteObjProc); 3534 3534 else 3535 3535 Tcl_CreateCommand(interp,cmdnamebuf,c->proc, -
exp_command.h
diff --git a/exp_command.h b/exp_command.h index d30d911..e46d73c 100644
a b would appreciate credit if this program or parts of it are used. 24 24 #endif 25 25 26 26 #include <tclPort.h> 27 #include "expect.h" 27 28 28 29 #define EXP_CHANNELNAMELEN (16 + TCL_INTEGER_SPACE) 29 30 30 EXTERN c har * exp_get_var _ANSI_ARGS_((Tcl_Interp *,char *));31 EXTERN const char * exp_get_var _ANSI_ARGS_((Tcl_Interp *,char *)); 31 32 32 33 EXTERN int exp_default_match_max; 33 34 EXTERN int exp_default_parity; … … extern Tcl_ChannelType expChannelType; 210 211 #define EXP_INDIRECT 2 211 212 212 213 EXTERN void expAdjust _ANSI_ARGS_((ExpState *)); 213 EXTERN int expWriteChars _ANSI_ARGS_((ExpState *,c har *,int));214 EXTERN int expWriteChars _ANSI_ARGS_((ExpState *,const char *,int)); 214 215 EXTERN int expWriteCharsUni _ANSI_ARGS_((ExpState *,Tcl_UniChar *,int)); 215 216 EXTERN void exp_buffer_shuffle _ANSI_ARGS_((Tcl_Interp *,ExpState *,int,char *,char *)); 216 217 EXTERN int exp_close _ANSI_ARGS_((Tcl_Interp *,ExpState *)); … … EXTERN void exp_close_all _ANSI_ARGS_((Tcl_Interp *)); 218 219 EXTERN void exp_ecmd_remove_fd_direct_and_indirect 219 220 _ANSI_ARGS_((Tcl_Interp *,int)); 220 221 EXTERN void exp_trap_on _ANSI_ARGS_((int)); 221 EXTERN int exp_trap_off _ANSI_ARGS_((c har *));222 EXTERN int exp_trap_off _ANSI_ARGS_((const char *)); 222 223 223 224 EXTERN void exp_strftime(char *format, const struct tm *timeptr,Tcl_DString *dstring); 224 225 … … EXTERN int exp_i_update _ANSI_ARGS_((Tcl_Interp *, 308 309 309 310 struct exp_cmd_data { 310 311 char *name; 311 Tcl_ObjCmdProc *objproc;312 Tcl_ObjCmdProc2 *objproc; 312 313 Tcl_CmdProc *proc; 313 314 ClientData data; 314 315 int flags; … … EXTERN void exp_init_trap_cmds _ANSI_ARGS_((Tcl_Interp *)); 323 324 EXTERN void exp_init_interact_cmds _ANSI_ARGS_((Tcl_Interp *)); 324 325 EXTERN void exp_init_tty_cmds(); 325 326 326 EXTERN ExpState * expStateCheck _ANSI_ARGS_((Tcl_Interp *,ExpState *,int,int,c har *));327 EXTERN ExpState * expStateCheck _ANSI_ARGS_((Tcl_Interp *,ExpState *,int,int,const char *)); 327 328 EXTERN ExpState * expStateCurrent _ANSI_ARGS_((Tcl_Interp *,int,int,int)); 328 EXTERN ExpState * expStateFromChannelName _ANSI_ARGS_((Tcl_Interp *,c har *,int,int,int,char *));329 EXTERN ExpState * expStateFromChannelName _ANSI_ARGS_((Tcl_Interp *,const char *,int,int,int,const char *)); 329 330 EXTERN void expStateFree _ANSI_ARGS_((ExpState *)); 330 331 331 332 EXTERN ExpState * expCreateChannel _ANSI_ARGS_((Tcl_Interp *,int,int,int)); -
exp_int.h
diff --git a/exp_int.h b/exp_int.h index a7cd496..a5f3427 100644
a b would appreciate credit if this program or parts of it are used. 20 20 #endif 21 21 22 22 #include <errno.h> 23 #include "expect.h" 23 24 24 25 void exp_console_set _ANSI_ARGS_((void)); 25 26 void expDiagLogPtrSet _ANSI_ARGS_((void (*)_ANSI_ARGS_((char *)))); … … void expDiagLogPtr _ANSI_ARGS_((char *)); 27 28 void expDiagLogPtrX _ANSI_ARGS_((char *,int)); 28 29 void expDiagLogPtrStr _ANSI_ARGS_((char *,char *)); 29 30 void expDiagLogPtrStrStr _ANSI_ARGS_((char *,char *,char *)); 30 void expErrnoMsgSet _ANSI_ARGS_((c har * (*) _ANSI_ARGS_((int))));31 c har * expErrnoMsg _ANSI_ARGS_((int));31 void expErrnoMsgSet _ANSI_ARGS_((const char * (*) _ANSI_ARGS_((int)))); 32 const char * expErrnoMsg _ANSI_ARGS_((int)); 32 33 33 34 #ifdef NO_STDLIB_H 34 35 # include "../compat/stdlib.h" -
exp_inter.c
diff --git a/exp_inter.c b/exp_inter.c index 8802032..eba6be1 100644
a b static char * 696 696 inter_updateproc( 697 697 ClientData clientData, 698 698 Tcl_Interp *interp, /* Interpreter containing variable. */ 699 c har *name1, /* Name of variable. */700 c har *name2, /* Second part of variable name. */699 const char *name1, /* Name of variable. */ 700 const char *name2, /* Second part of variable name. */ 701 701 int flags) /* Information about what happened. */ 702 702 { 703 703 exp_configure_count++; … … int 714 714 Exp_InteractObjCmd( 715 715 ClientData clientData, 716 716 Tcl_Interp *interp, 717 intobjc,717 Tcl_Size objc, 718 718 Tcl_Obj *CONST initial_objv[]) /* Argument objects. */ 719 719 { 720 720 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); -
exp_log.c
diff --git a/exp_log.c b/exp_log.c index a0767ff..150d1af 100644
a b expWriteBytesAndLogIfTtyU(esPtr,buf,lenChars) 110 110 111 111 void 112 112 expLogDiagU(buf) 113 c har *buf;113 const char *buf; 114 114 { 115 115 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); 116 116 … … expStdoutLog TCL_VARARGS_DEF(int,arg1) 191 191 /* use this function for logging the parent/child conversation */ 192 192 void 193 193 expStdoutLogU(buf,force_stdout) 194 c har *buf;194 const char *buf; 195 195 int force_stdout; /* override value of logUser */ 196 196 { 197 197 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); … … expErrorLog TCL_VARARGS_DEF(char *,arg1) 240 240 /*ARGSUSED*/ 241 241 void 242 242 expErrorLogU(buf) 243 c har *buf;243 const char *buf; 244 244 { 245 245 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); 246 246 … … expDiagWriteObj(obj) 401 401 /* write 8-bit bytes */ 402 402 void 403 403 expDiagWriteBytes(str,len) 404 c har *str;404 const char *str; 405 405 int len; 406 406 { 407 407 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); … … int len; 414 414 /* write UTF chars */ 415 415 void 416 416 expDiagWriteChars(str,len) 417 c har *str;417 const char *str; 418 418 int len; 419 419 { 420 420 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); … … expLogUserSet(logUser) 633 633 /* in diagnostic mode, "expect -d" */ 634 634 static char * 635 635 expPrintifyReal(s) 636 c har *s;636 const char *s; 637 637 { 638 638 static int destlen = 0; 639 639 static char *dest = 0; … … expPrintifyObj(obj) 726 726 727 727 char * 728 728 expPrintify(s) /* INTL */ 729 c har *s;729 const char *s; 730 730 { 731 731 ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); 732 732 -
exp_log.h
diff --git a/exp_log.h b/exp_log.h index ca78386..2b9d4ee 100644
a b 1 1 /* exp_log.h */ 2 2 3 #include "expect.h" 4 3 5 extern void expErrorLog _ANSI_ARGS_(TCL_VARARGS(char *,fmt)); 4 extern void expErrorLogU _ANSI_ARGS_((c har *));6 extern void expErrorLogU _ANSI_ARGS_((const char *)); 5 7 6 8 extern void expStdoutLog _ANSI_ARGS_(TCL_VARARGS(int,force_stdout)); 7 extern void expStdoutLogU _ANSI_ARGS_((c har *buf, int force_stdout));9 extern void expStdoutLogU _ANSI_ARGS_((const char *buf, int force_stdout)); 8 10 9 11 EXTERN void expDiagInit _ANSI_ARGS_((void)); 10 12 EXTERN int expDiagChannelOpen _ANSI_ARGS_((Tcl_Interp *,char *)); … … EXTERN void expDiagChannelClose _ANSI_ARGS_((Tcl_Interp *)); 13 15 EXTERN char * expDiagFilename _ANSI_ARGS_((void)); 14 16 EXTERN int expDiagToStderrGet _ANSI_ARGS_((void)); 15 17 EXTERN void expDiagToStderrSet _ANSI_ARGS_((int)); 16 EXTERN void expDiagWriteBytes _ANSI_ARGS_((c har *,int));17 EXTERN void expDiagWriteChars _ANSI_ARGS_((c har *,int));18 EXTERN void expDiagWriteBytes _ANSI_ARGS_((const char *,int)); 19 EXTERN void expDiagWriteChars _ANSI_ARGS_((const char *,int)); 18 20 EXTERN void expDiagWriteObj _ANSI_ARGS_((Tcl_Obj *)); 19 21 EXTERN void expDiagLog _ANSI_ARGS_(TCL_VARARGS(char *,fmt)); 20 22 EXTERN void expDiagLogU _ANSI_ARGS_((char *)); 21 23 22 EXTERN char * expPrintify _ANSI_ARGS_((c har *));24 EXTERN char * expPrintify _ANSI_ARGS_((const char *)); 23 25 EXTERN char * expPrintifyUni _ANSI_ARGS_((Tcl_UniChar *,int)); 24 26 EXTERN char * expPrintifyObj _ANSI_ARGS_((Tcl_Obj *)); 25 27 EXTERN void expPrintf _ANSI_ARGS_(TCL_VARARGS(char *,fmt)); … … EXTERN void expLogAllSet _ANSI_ARGS_((int)); 38 40 EXTERN int expLogAllGet _ANSI_ARGS_((void)); 39 41 EXTERN void expLogToStdoutSet _ANSI_ARGS_((int)); 40 42 EXTERN int expLogToStdoutGet _ANSI_ARGS_((void)); 41 EXTERN void expLogDiagU _ANSI_ARGS_((c har *));43 EXTERN void expLogDiagU _ANSI_ARGS_((const char *)); 42 44 EXTERN int expWriteBytesAndLogIfTtyU _ANSI_ARGS_((ExpState *,Tcl_UniChar *,int)); 43 45 44 46 EXTERN int expLogUserGet _ANSI_ARGS_((void)); -
exp_main_sub.c
diff --git a/exp_main_sub.c b/exp_main_sub.c index 499c0ae..2b195a7 100644
a b handle_eval_error(interp,check_for_nostack) 227 227 Tcl_Interp *interp; 228 228 int check_for_nostack; 229 229 { 230 c har *msg;230 const char *msg; 231 231 232 232 /* if errorInfo has something, print it */ 233 233 /* else use what's in the interp result */ … … int check_for_nostack; 253 253 /* no \n at end, since ccmd will already have one. */ 254 254 /* Actually, this is not true if command is last in */ 255 255 /* file and has no newline after it, oh well */ 256 expErrorLogU(exp_cook(msg, (int *)0));256 expErrorLogU(exp_cook(msg,NULL)); 257 257 expErrorLogU("\r\n"); 258 258 } 259 259 … … Tcl_Obj *eofObj; 394 394 case TCL_OK: 395 395 str = Tcl_GetStringResult(interp); 396 396 if (*str != 0) { 397 expStdoutLogU(exp_cook(str, (int *)0),1);397 expStdoutLogU(exp_cook(str,NULL),1); 398 398 expStdoutLogU("\r\n",1); 399 399 } 400 400 continue; … … Tcl_Interp *interp; 543 543 return TCL_ERROR; 544 544 } 545 545 #else 546 if (Tcl_InitStubs(interp, " 8.1", 0) == NULL) {546 if (Tcl_InitStubs(interp, "9.0", 0) == NULL) { 547 547 return TCL_ERROR; 548 548 } 549 549 #endif … … char **argv; 713 713 exp_cmdlinecmds = TRUE; 714 714 rc = Tcl_Eval(interp,optarg); 715 715 if (rc != TCL_OK) { 716 expErrorLogU(exp_cook(Tcl_GetVar(interp,"errorInfo",TCL_GLOBAL_ONLY), (int *)0));716 expErrorLogU(exp_cook(Tcl_GetVar(interp,"errorInfo",TCL_GLOBAL_ONLY),NULL)); 717 717 expErrorLogU("\r\n"); 718 718 } 719 719 break; … … char **argv; 861 861 expDiagLog("set argv0 \"%s\"\r\n",exp_argv0); 862 862 } 863 863 864 args = Tcl_Merge(argc-optind,argv+optind); 864 /* TODO: Is the cast safe? */ 865 args = Tcl_Merge(argc-optind,(const char **)(argv+optind)); 865 866 expDiagLogU("set argv \""); 866 867 expDiagLogU(args); 867 868 expDiagLogU("\"\r\n"); -
exp_pty.c
diff --git a/exp_pty.c b/exp_pty.c index 0970211..626d7a8 100644
a b expDiagLogPtrStrStr(fmt,str1,str2) 351 351 (*expDiagLogPtrVal)(buf); 352 352 } 353 353 354 static c har * (*expErrnoMsgVal) _ANSI_ARGS_((int));354 static const char * (*expErrnoMsgVal) _ANSI_ARGS_((int)); 355 355 356 c har *356 const char * 357 357 expErrnoMsg(errorNo) 358 358 int errorNo; 359 359 { … … int errorNo; 362 362 363 363 void 364 364 expErrnoMsgSet(fn) 365 c har * (*fn) _ANSI_ARGS_((int));365 const char * (*fn) _ANSI_ARGS_((int)); 366 366 { 367 367 expErrnoMsgVal = fn; 368 368 } -
exp_trap.c
diff --git a/exp_trap.c b/exp_trap.c index 390e0e3..fe3d727 100644
a b int code; 147 147 Tcl_AsyncMark(async_handler); 148 148 } else { 149 149 got_sig = -1; 150 for (i =1;i<NSIG;i++) {150 for (int i=1;i<NSIG;i++) { 151 151 if (traps[i].mark) { 152 152 got_sig = i; 153 153 Tcl_AsyncMark(async_handler); … … int objc; 304 304 Tcl_Obj *CONST objv[]; 305 305 { 306 306 char *action = 0; 307 intn; /* number of signals in list */307 Tcl_Size n; /* number of signals in list */ 308 308 Tcl_Obj **list; /* list of signals */ 309 309 char *arg; 310 310 int len; /* length of action */ 311 int i;312 311 int show_name = FALSE; /* if user asked for current sig by name */ 313 312 int show_number = FALSE;/* if user asked for current sig by number */ 314 313 int show_max = FALSE; /* if user asked for NSIG-1 */ … … Tcl_Obj *CONST objv[]; 382 381 return TCL_ERROR; 383 382 } 384 383 385 for ( i=0;i<n;i++) {384 for (Tcl_Size i=0;i<n;i++) { 386 385 char *s; 387 386 int sig; 388 387 … … int oldcode; 509 508 510 509 if (eip) { 511 510 /* odd that Tcl doesn't have a call that does all this at once */ 512 intlen;511 Tcl_Size len; 513 512 char *s = Tcl_GetStringFromObj(eip,&len); 514 513 Tcl_AddObjErrorInfo(interp,s,len); 515 514 Tcl_DecrRefCount(eip); -
exp_tty.c
diff --git a/exp_tty.c b/exp_tty.c index 3f22c90..1bb83e7 100644
a b exp_tty_break( 277 277 /* to write send_user strings without always putting in \r. */ 278 278 /* If len == 0, use strlen to compute it */ 279 279 /* NB: if terminal is not in raw mode, nothing is done. */ 280 c har *280 const char * 281 281 exp_cook( 282 c har *s,283 int*len) /* current and new length of s */282 const char *s, 283 Tcl_Size *len) /* current and new length of s */ 284 284 { 285 285 static int destlen = 0; 286 286 static char *dest = 0; … … static int /* returns TCL_whatever */ 316 316 exec_stty( 317 317 Tcl_Interp *interp, 318 318 int argc, 319 c har **argv,319 const char **argv, 320 320 int devtty) /* if true, redirect to /dev/tty */ 321 321 { 322 322 int i; … … Exp_SttyCmd( 370 370 ClientData clientData, 371 371 Tcl_Interp *interp, 372 372 int argc, 373 c har **argv)373 const char **argv) 374 374 { 375 375 /* redirection symbol is not counted as a stty arg in terms */ 376 376 /* of recognition. */ … … Exp_SttyCmd( 382 382 int cooked = FALSE; 383 383 int was_raw, was_echo; 384 384 385 c har **redirect; /* location of "<" */386 c har *infile = 0;385 const char **redirect; /* location of "<" */ 386 const char *infile = 0; 387 387 int fd; /* (slave) fd of infile */ 388 388 int master = -1; /* master fd of infile */ 389 c har **argv0 = argv;389 const char **argv0 = argv; 390 390 391 391 for (argv=argv0+1;*argv;argv++) { 392 392 if (argv[0][0] == '<') { … … Exp_SttyCmd( 507 507 /* a different tty */ 508 508 509 509 /* temporarily zap redirect */ 510 c har *redirect_save = *redirect;510 const char *redirect_save = *redirect; 511 511 *redirect = 0; 512 512 513 513 for (argv=argv0+1;*argv;argv++) { … … Exp_SystemCmd( 569 569 ClientData clientData, 570 570 Tcl_Interp *interp, 571 571 int argc, 572 c har **argv)572 const char **argv) 573 573 { 574 574 int result = TCL_OK; 575 575 RETSIGTYPE (*old)(); /* save old sigalarm handler */ -
exp_win.c
diff --git a/exp_win.c b/exp_win.c index 97adbee..497f10d 100644
a b typedef struct { 78 78 static exp_winsize winsize = {0, 0}; 79 79 static exp_winsize win2size = {0, 0}; 80 80 81 intexp_window_size_set(fd)81 void exp_window_size_set(fd) 82 82 int fd; 83 83 { 84 84 #ifdef TIOCSWINSZ … … int fd; 89 89 #endif 90 90 } 91 91 92 intexp_window_size_get(fd)92 void exp_window_size_get(fd) 93 93 int fd; 94 94 { 95 95 #ifdef TIOCGWINSZ … … int fd; 106 106 107 107 void 108 108 exp_win_rows_set(rows) 109 c har *rows;109 const char *rows; 110 110 { 111 111 winsize.rows = atoi(rows); 112 112 exp_window_size_set(exp_dev_tty); … … exp_win_rows_get() 123 123 124 124 void 125 125 exp_win_columns_set(columns) 126 c har *columns;126 const char *columns; 127 127 { 128 128 winsize.columns = atoi(columns); 129 129 exp_window_size_set(exp_dev_tty); … … exp_win_columns_get() 142 142 * separate copy of everything above - used for handling user stty requests 143 143 */ 144 144 145 intexp_win2_size_set(fd)145 void exp_win2_size_set(fd) 146 146 int fd; 147 147 { 148 148 #ifdef TIOCSWINSZ … … int fd; 153 153 #endif 154 154 } 155 155 156 intexp_win2_size_get(fd)156 void exp_win2_size_get(fd) 157 157 int fd; 158 158 { 159 159 #ifdef TIOCGWINSZ … … int fd; 167 167 void 168 168 exp_win2_rows_set(fd,rows) 169 169 int fd; 170 c har *rows;170 const char *rows; 171 171 { 172 172 exp_win2_size_get(fd); 173 173 win2size.rows = atoi(rows); … … int fd; 191 191 void 192 192 exp_win2_columns_set(fd,columns) 193 193 int fd; 194 c har *columns;194 const char *columns; 195 195 { 196 196 exp_win2_size_get(fd); 197 197 win2size.columns = atoi(columns); -
exp_win.h
diff --git a/exp_win.h b/exp_win.h index 8e77aea..0fcdb68 100644
a b This file is in the public domain. However, the author and NIST 6 6 would appreciate credit if you use this file or parts of it. 7 7 */ 8 8 9 #include <tcl.h>/* For _ANSI_ARGS_ */9 #include "expect.h" /* For _ANSI_ARGS_ */ 10 10 11 intexp_window_size_set();12 intexp_window_size_get();11 void exp_window_size_set(); 12 void exp_window_size_get(); 13 13 14 void exp_win_rows_set _ANSI_ARGS_ ((c har* rows));14 void exp_win_rows_set _ANSI_ARGS_ ((const char* rows)); 15 15 char* exp_win_rows_get _ANSI_ARGS_ ((void)); 16 void exp_win_columns_set _ANSI_ARGS_ ((c har* columns));16 void exp_win_columns_set _ANSI_ARGS_ ((const char* columns)); 17 17 char* exp_win_columns_get _ANSI_ARGS_ ((void)); 18 18 19 void exp_win2_rows_set _ANSI_ARGS_ ((int fd, c har* rows));19 void exp_win2_rows_set _ANSI_ARGS_ ((int fd, const char* rows)); 20 20 char* exp_win2_rows_get _ANSI_ARGS_ ((int fd)); 21 void exp_win2_columns_set _ANSI_ARGS_ ((int fd, c har* columns));21 void exp_win2_columns_set _ANSI_ARGS_ ((int fd, const char* columns)); 22 22 char* exp_win2_columns_get _ANSI_ARGS_ ((int fd)); -
expect.c
diff --git a/expect.c b/expect.c index 86b4abf..eae52a7 100644
a b static char *exp_indirect_update1( /* 1-part Tcl variable names */ 163 163 static char *exp_indirect_update2( /* 2-part Tcl variable names */ 164 164 ClientData clientData, 165 165 Tcl_Interp *interp, /* Interpreter containing variable. */ 166 c har *name1, /* Name of variable. */167 c har *name2, /* Second part of variable name. */166 const char *name1, /* Name of variable. */ 167 const char *name2, /* Second part of variable name. */ 168 168 int flags); /* Information about what happened. */ 169 169 170 170 #ifdef SIMPLE_EVENT … … exp_eval_with_one_arg( 285 285 CONST char *p; 286 286 CONST char *next; 287 287 int rc; 288 int bytesLeft, numWords; 288 Tcl_Size bytesLeft; 289 int numWords; 289 290 Tcl_Parse parse; 290 291 291 292 /* … … exp_eval_with_one_arg( 325 326 numWords--, tokenPtr += (tokenPtr->numComponents + 1)) { 326 327 /* FUTURE: Save token information, do substitution later */ 327 328 328 Tcl_Obj* w = Tcl_EvalTokens(interp, tokenPtr+1,329 rc = Tcl_EvalTokensStandard(interp, tokenPtr+1, 329 330 tokenPtr->numComponents); 331 Tcl_Obj* w = (rc == TCL_OK ? Tcl_GetObjResult(interp) : NULL); 330 332 /* w has refCount 1 here, if not NULL */ 331 333 if (w == NULL) { 332 334 Tcl_DecrRefCount (res); … … exp_eval_with_one_arg( 335 337 336 338 } 337 339 Tcl_ListObjAppendElement (interp, res, w); 338 Tcl_ DecrRefCount (w); /* Local reference goes away */340 Tcl_ResetResult (interp); /* Local reference goes away */ 339 341 } 340 342 } 341 343 … … parse_expect_args( 490 492 { 491 493 Tcl_Obj* g; 492 494 Tcl_UniChar* str; 493 intstrlen;495 Tcl_Size strlen; 494 496 495 497 str = Tcl_GetUnicodeFromObj (objv[i], &strlen); 496 498 g = exp_retoglob (str, strlen); … … eval_case_string( 852 854 expDiagLog("\"? "); 853 855 854 856 if (e->gate) { 855 intplen;857 Tcl_Size plen; 856 858 Tcl_UniChar* pat = Tcl_GetUnicodeFromObj(e->gate,&plen); 857 859 858 860 expDiagLog("Gate \""); … … eval_case_string( 915 917 expDiagLogU(expPrintify(Tcl_GetString(e->pat))); 916 918 expDiagLog("\"? "); 917 919 if (str) { 918 intplen;920 Tcl_Size plen; 919 921 Tcl_UniChar* pat = Tcl_GetUnicodeFromObj(e->pat,&plen); 920 922 921 923 match = Exp_StringCaseMatch(str,numchars, pat, plen, … … eval_case_string( 932 934 } 933 935 expDiagLogU(no); 934 936 } else if (e->use == PAT_EXACT) { 935 intpatLength;937 Tcl_Size patLength; 936 938 char *pat = Tcl_GetStringFromObj(e->pat, &patLength); 937 939 Tcl_UniChar *p; 938 940 … … int 1384 1386 Exp_ExpectGlobalObjCmd( 1385 1387 ClientData clientData, 1386 1388 Tcl_Interp *interp, 1387 intobjc,1389 Tcl_Size objc, 1388 1390 Tcl_Obj *CONST objv[]) /* Argument objects. */ 1389 1391 { 1390 1392 int result = TCL_OK; … … which looks in the global space if they are not in the local space. 2042 2044 This allows the user to localize them if desired, and also to 2043 2045 avoid having to put "global" in procedure definitions. 2044 2046 */ 2045 c har *2047 const char * 2046 2048 exp_get_var( 2047 2049 Tcl_Interp *interp, 2048 2050 char *var) 2049 2051 { 2050 c har *val;2052 const char *val; 2051 2053 2052 2054 if (NULL != (val = Tcl_GetVar(interp,var,0 /* local */))) 2053 2055 return(val); … … static char * 2121 2123 exp_indirect_update2( 2122 2124 ClientData clientData, 2123 2125 Tcl_Interp *interp, /* Interpreter containing variable. */ 2124 c har *name1, /* Name of variable. */2125 c har *name2, /* Second part of variable name. */2126 const char *name1, /* Name of variable. */ 2127 const char *name2, /* Second part of variable name. */ 2126 2128 int flags) /* Information about what happened. */ 2127 2129 { 2128 2130 char *msg; … … int 2525 2527 Exp_ExpectObjCmd( 2526 2528 ClientData clientData, 2527 2529 Tcl_Interp *interp, 2528 intobjc,2530 Tcl_Size objc, 2529 2531 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2530 2532 { 2531 2533 int cc; /* number of chars returned in a single read */ … … static int 2782 2784 Exp_TimestampObjCmd( 2783 2785 ClientData clientData, 2784 2786 Tcl_Interp *interp, 2785 intobjc,2787 Tcl_Size objc, 2786 2788 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2787 2789 { 2788 2790 char *format = 0; … … int 2962 2964 Exp_MatchMaxObjCmd( 2963 2965 ClientData clientData, 2964 2966 Tcl_Interp *interp, 2965 intobjc,2967 Tcl_Size objc, 2966 2968 Tcl_Obj *CONST objv[]) /* Argument objects. */ 2967 2969 { 2968 2970 int size = -1; … … int 3008 3010 Exp_RemoveNullsObjCmd( 3009 3011 ClientData clientData, 3010 3012 Tcl_Interp *interp, 3011 intobjc,3013 Tcl_Size objc, 3012 3014 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3013 3015 { 3014 3016 int value = -1; … … int 3052 3054 Exp_ParityObjCmd( 3053 3055 ClientData clientData, 3054 3056 Tcl_Interp *interp, 3055 intobjc,3057 Tcl_Size objc, 3056 3058 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3057 3059 { 3058 3060 int parity; … … int 3091 3093 Exp_CloseOnEofObjCmd( 3092 3094 ClientData clientData, 3093 3095 Tcl_Interp *interp, 3094 intobjc,3096 Tcl_Size objc, 3095 3097 Tcl_Obj *CONST objv[]) /* Argument objects. */ 3096 3098 { 3097 3099 int close_on_eof; -
expect.h
diff --git a/expect.h b/expect.h index e5e29e3..16e28af 100644
a b would appreciate credit if this program or parts of it are used. 12 12 #define _EXPECT_H 13 13 14 14 #include <stdio.h> 15 #include <stdarg.h> 15 16 #include <setjmp.h> 16 17 /* 18 * tcl.h -- 19 * 20 * This header file describes the externally-visible facilities 21 * of the Tcl interpreter. 22 * 23 * Copyright (c) 1987-1994 The Regents of the University of California. 24 * Copyright (c) 1994-1997 Sun Microsystems, Inc. 25 * Copyright (c) 1993-1996 Lucent Technologies. 26 * Copyright (c) 1998-1999 Scriptics Corporation. 27 * 28 * See the file "license.terms" for information on usage and redistribution 29 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 30 * 31 * RCS: @(#) $Id: expect.h,v 5.32 2010/07/01 00:53:49 eee Exp $ 32 */ 33 34 #ifndef _TCL 35 #define _TCL 36 37 #ifndef __WIN32__ 38 # if defined(_WIN32) || defined(WIN32) 39 # define __WIN32__ 40 # endif 41 #endif 42 43 #ifdef __WIN32__ 44 # ifndef STRICT 45 # define STRICT 46 # endif 47 # ifndef USE_PROTOTYPE 48 # define USE_PROTOTYPE 1 49 # endif 50 # ifndef HAS_STDARG 51 # define HAS_STDARG 1 52 # endif 53 # ifndef USE_PROTOTYPE 54 # define USE_PROTOTYPE 1 55 # endif 56 57 /* 58 * Under Windows we need to call Tcl_Alloc in all cases to avoid competing 59 * C run-time library issues. 60 */ 61 62 # ifndef USE_TCLALLOC 63 # define USE_TCLALLOC 1 64 # endif 65 #endif /* __WIN32__ */ 66 67 /* 68 * The following definitions set up the proper options for Macintosh 69 * compilers. We use this method because there is no autoconf equivalent. 70 */ 71 72 #ifdef MAC_TCL 73 # ifndef HAS_STDARG 74 # define HAS_STDARG 1 75 # endif 76 # ifndef USE_TCLALLOC 77 # define USE_TCLALLOC 1 78 # endif 79 # ifndef NO_STRERROR 80 # define NO_STRERROR 1 81 # endif 82 #endif 83 84 /* 85 * Utility macros: STRINGIFY takes an argument and wraps it in "" (double 86 * quotation marks), JOIN joins two arguments. 87 */ 88 89 #define VERBATIM(x) x 90 #ifdef _MSC_VER 91 # define STRINGIFY(x) STRINGIFY1(x) 92 # define STRINGIFY1(x) #x 93 # define JOIN(a,b) JOIN1(a,b) 94 # define JOIN1(a,b) a##b 95 #else 96 # ifdef RESOURCE_INCLUDED 97 # define STRINGIFY(x) STRINGIFY1(x) 98 # define STRINGIFY1(x) #x 99 # define JOIN(a,b) JOIN1(a,b) 100 # define JOIN1(a,b) a##b 101 # else 102 # ifdef __STDC__ 103 # define STRINGIFY(x) #x 104 # define JOIN(a,b) a##b 105 # else 106 # define STRINGIFY(x) "x" 107 # define JOIN(a,b) VERBATIM(a)VERBATIM(b) 108 # endif 109 # endif 110 #endif 111 112 /* 113 * A special definition used to allow this header file to be included 114 * in resource files so that they can get obtain version information from 115 * this file. Resource compilers don't like all the C stuff, like typedefs 116 * and procedure declarations, that occur below. 117 */ 118 119 #ifndef RESOURCE_INCLUDED 120 121 #ifndef BUFSIZ 122 #include <stdio.h> 123 #endif 124 125 /* 126 * Definitions that allow Tcl functions with variable numbers of 127 * arguments to be used with either varargs.h or stdarg.h. TCL_VARARGS 128 * is used in procedure prototypes. TCL_VARARGS_DEF is used to declare 129 * the arguments in a function definiton: it takes the type and name of 130 * the first argument and supplies the appropriate argument declaration 131 * string for use in the function definition. TCL_VARARGS_START 132 * initializes the va_list data structure and returns the first argument. 133 */ 134 135 #if defined(__STDC__) || defined(HAS_STDARG) 136 # include <stdarg.h> 137 138 # define TCL_VARARGS(type, name) (type name, ...) 139 # define TCL_VARARGS_DEF(type, name) (type name, ...) 140 # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) 141 #else 142 # include <varargs.h> 143 144 # ifdef __cplusplus 145 # define TCL_VARARGS(type, name) (type name, ...) 146 # define TCL_VARARGS_DEF(type, name) (type va_alist, ...) 147 # else 148 # define TCL_VARARGS(type, name) () 149 # define TCL_VARARGS_DEF(type, name) (va_alist) 150 # endif 151 # define TCL_VARARGS_START(type, name, list) \ 152 (va_start(list), va_arg(list, type)) 153 #endif 154 155 /* 156 * Macros used to declare a function to be exported by a DLL. 157 * Used by Windows, maps to no-op declarations on non-Windows systems. 158 * The default build on windows is for a DLL, which causes the DLLIMPORT 159 * and DLLEXPORT macros to be nonempty. To build a static library, the 160 * macro STATIC_BUILD should be defined. 161 */ 162 163 #ifdef STATIC_BUILD 164 # define DLLIMPORT 165 # define DLLEXPORT 166 #else 167 # if defined(__WIN32__) && (defined(_MSC_VER) || (defined(__GNUC__) && defined(__declspec))) 168 # define DLLIMPORT __declspec(dllimport) 169 # define DLLEXPORT __declspec(dllexport) 170 # else 171 # define DLLIMPORT 172 # define DLLEXPORT 173 # endif 174 #endif 175 176 /* 177 * These macros are used to control whether functions are being declared for 178 * import or export. If a function is being declared while it is being built 179 * to be included in a shared library, then it should have the DLLEXPORT 180 * storage class. If is being declared for use by a module that is going to 181 * link against the shared library, then it should have the DLLIMPORT storage 182 * class. If the symbol is beind declared for a static build or for use from a 183 * stub library, then the storage class should be empty. 184 * 185 * The convention is that a macro called BUILD_xxxx, where xxxx is the 186 * name of a library we are building, is set on the compile line for sources 187 * that are to be placed in the library. When this macro is set, the 188 * storage class will be set to DLLEXPORT. At the end of the header file, the 189 * storage class will be reset to DLLIMPORt. 190 */ 191 192 #undef TCL_STORAGE_CLASS 193 #ifdef BUILD_tcl 194 # define TCL_STORAGE_CLASS DLLEXPORT 195 #else 196 # ifdef USE_TCL_STUBS 197 # define TCL_STORAGE_CLASS 198 # else 199 # define TCL_STORAGE_CLASS DLLIMPORT 200 # endif 201 #endif 202 203 /* 204 * Definitions that allow this header file to be used either with or 205 * without ANSI C features like function prototypes. */ 17 #include <tcl.h> 206 18 207 19 #undef _ANSI_ARGS_ 208 20 #undef CONST 209 210 #if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) || defined(USE_PROTOTYPE) 211 # define _USING_PROTOTYPES_ 1 212 # define _ANSI_ARGS_(x) x 213 # define CONST const 214 #else 215 # define _ANSI_ARGS_(x) () 216 # define CONST 217 #endif 218 219 #ifdef __cplusplus 220 # define EXTERN extern "C" TCL_STORAGE_CLASS 221 #else 222 # define EXTERN extern TCL_STORAGE_CLASS 223 #endif 224 225 /* 226 * Macro to use instead of "void" for arguments that must have 227 * type "void *" in ANSI C; maps them to type "char *" in 228 * non-ANSI systems. 229 */ 230 #ifndef __WIN32__ 231 #ifndef VOID 232 # ifdef __STDC__ 233 # define VOID void 234 # else 235 # define VOID char 236 # endif 237 #endif 238 #else /* __WIN32__ */ 239 /* 240 * The following code is copied from winnt.h 241 */ 242 #ifndef VOID 243 #define VOID void 244 typedef char CHAR; 245 typedef short SHORT; 246 typedef long LONG; 247 #endif 248 #endif /* __WIN32__ */ 249 250 /* 251 * Miscellaneous declarations. 252 */ 253 254 #ifndef NULL 255 #define NULL 0 256 #endif 257 258 typedef struct Tcl_RegExp_ *Tcl_RegExp; 259 260 /* 261 * These function have been renamed. The old names are deprecated, but we 262 * define these macros for backwards compatibilty. 263 */ 264 265 #define Tcl_Ckalloc Tcl_Alloc 266 #define Tcl_Ckfree Tcl_Free 267 #define Tcl_Ckrealloc Tcl_Realloc 268 #define Tcl_Return Tcl_SetResult 269 #define Tcl_TildeSubst Tcl_TranslateFileName 270 271 #endif /* RESOURCE_INCLUDED */ 272 273 #undef TCL_STORAGE_CLASS 274 #define TCL_STORAGE_CLASS DLLIMPORT 275 276 #endif /* _TCL */ 277 278 /* 279 * end of tcl.h definitions 280 */ 281 21 #undef CONST84 22 #undef TCL_VARARGS 23 #undef TCL_VARARGS_DEF 24 #undef TCL_VARARGS_START 25 26 #define _ANSI_ARGS_(x) x 27 #define CONST const 28 #define CONST84 const 29 #define TCL_VARARGS(type, name) (type name, ...) 30 #define TCL_VARARGS_DEF(type, name) (type name, ...) 31 #define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) 282 32 283 33 /* 284 34 * regexp definitions - from tcl8.0/tclRegexp.h -
expect_tcl.h
diff --git a/expect_tcl.h b/expect_tcl.h index 0fa5a99..59a5cd3 100644
a b would appreciate credit if this program or parts of it are used. 13 13 #define _EXPECT_TCL_H 14 14 15 15 #include <stdio.h> 16 #include "expect _comm.h"16 #include "expect.h" 17 17 18 18 /* 19 19 * This is a convenience macro used to initialize a thread local storage ptr. … … EXTERN int exp_interpret_cmdfile _ANSI_ARGS_((Tcl_Interp *,FILE *)); 44 44 EXTERN int exp_interpret_cmdfilename _ANSI_ARGS_((Tcl_Interp *,char *)); 45 45 EXTERN void exp_interpret_rcfiles _ANSI_ARGS_((Tcl_Interp *,int my_rc,int sys_rc)); 46 46 47 EXTERN c har * exp_cook _ANSI_ARGS_((char *s,int*len));47 EXTERN const char * exp_cook _ANSI_ARGS_((const char *s,Tcl_Size *len)); 48 48 49 49 EXTERN void expCloseOnExec _ANSI_ARGS_((int)); 50 50 -
retoglob.c
diff --git a/retoglob.c b/retoglob.c index 521d0ae..e426fe2 100644
a b exp_retoglob ( 100 100 #define CHOPC(c) {while (*str != (c) && strlen) CHOP(1) ;} 101 101 #define EMIT(c) {lastsz = 1; *nexto++ = (c);} 102 102 #define EMITX(c) {lastsz++; *nexto++ = (c);} 103 #define MATCH(lit) ((strlen >= (sizeof (lit)/sizeof (Tcl_UniChar))) && (0 == Tcl_UniCharNcmp (str,(lit),sizeof(lit)/sizeof (Tcl_UniChar))))103 #define MATCH(lit) ((strlen >= (sizeof (lit)/sizeof (Tcl_UniChar))) && (0 == memcmp (str,(lit),sizeof(lit)))) 104 104 #define MATCHC(c) (strlen && (*str == (c))) 105 105 #define PUSHPAREN {*nextp++ = nexto;} 106 106 #define UNEMIT {nexto -= lastsz; lastsz = -1;} -
tcldbg.h
diff --git a/tcldbg.h b/tcldbg.h index 8f9cb9a..88ff5d1 100644
a b would appreciate credit if this program or parts of it are used. 12 12 #ifndef _NIST_DBG 13 13 #define _NIST_DBG 14 14 15 #include " tcl.h"15 #include "expect.h" 16 16 17 17 typedef int (Dbg_InterProc) _ANSI_ARGS_((Tcl_Interp *interp, ClientData data)); 18 18 typedef int (Dbg_IgnoreFuncsProc) _ANSI_ARGS_((