1
2
3
4
5
6
7
8
9
10
11
12
|
1
2
3
4
5
6
7
8
9
10
11
12
|
-
-
+
+
|
/* ==================================================================
FILE: "/home/joze/src/tclreadline/tclreadline.c"
LAST MODIFICATION: "Wed Sep 15 01:00:43 1999 (joze)"
FILE: "/disk01/home/joze/src/tclreadline/tclreadline.c"
LAST MODIFICATION: "Thu Sep 16 15:43:29 1999 (joze)"
(C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
$Id$
---
tclreadline -- gnu readline for tcl
Copyright (C) 1999 Johannes Zellner
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
+
-
+
+
|
{
int i, obj_idx, status;
Tcl_Obj** objv = (Tcl_Obj**) MALLOC((argc + 1) * sizeof(Tcl_Obj *));
static char *subCmds[] = {
"read", "initialize", "write", "add", "complete",
"customcompleter", "builtincompleter", "eofchar",
"reset-terminal",
(char *) NULL
};
enum SubCmdIdx {
TCLRL_READ, TCLRL_INITIALIZE, TCLRL_WRITE, TCLRL_ADD, TCLRL_COMPLETE,
TCLRL_CUSTOMCOMPLETER, TCLRL_BUILTINCOMPLETER, TCLRL_EOFCHAR
TCLRL_CUSTOMCOMPLETER, TCLRL_BUILTINCOMPLETER, TCLRL_EOFCHAR,
TCLRL_RESET_TERMINAL
};
Tcl_ResetResult(interp); /* clear the result space */
for (i = 0; i < argc; i++) {
Tcl_Obj* objPtr = Tcl_NewStringObj(argv[i], -1);
|
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
|
+
+
+
+
+
+
+
+
+
+
+
+
|
if (tclrl_eof_string)
FREE(tclrl_eof_string);
if (!blank_line(argv[2]))
tclrl_eof_string = stripwhite(strdup(argv[2]));
}
Tcl_AppendResult(interp, tclrl_eof_string, (char*) NULL);
break;
case TCLRL_RESET_TERMINAL:
/* TODO: add this to the completer */
if (argc > 3) {
Tcl_WrongNumArgs(interp, 2, objv, "?terminal-name?");
return TCL_ERROR;
} else if (3 == argc) {
rl_reset_terminal(Tcl_GetString(objv[2]));
} else {
rl_cleanup_after_signal();
}
break;
default:
goto BAD_COMMAND;
/* NOTREACHED */
break;
}
|