1
2
3
4
5
6
7
8
9
10
11
|
1
2
3
4
5
6
7
8
9
10
11
|
-
+
|
/* ==================================================================
FILE: "/home/joze/src/tclreadline/tclreadline.c"
LAST MODIFICATION: "Son, 27 Aug 2000 16:11:02 +0200 (joze)"
LAST MODIFICATION: "Mit, 20 Sep 2000 19:27:47 +0200 (joze)"
(C) 1998 - 2000 by Johannes Zellner, <johannes@zellner.org>
$Id$
---
tclreadline -- gnu readline for tcl
http://www.zellner.org/tclreadline/
Copyright (c) 1998 - 2000, Johannes Zellner <johannes@zellner.org>
This software is copyright under the BSD license.
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
+
+
+
|
* We need it here to decide, if we should read more
* characters from a macro. Dirty, but it should work.
*/
extern char* _rl_executing_macro;
#endif
#include "tclreadline.h"
static const char* tclrl_library = TCLRL_LIBRARY;
static const char* tclrl_version_str = TCLRL_VERSION_STR;
static const char* tclrl_patchlevel_str = TCLRL_PATCHLEVEL_STR;
#define MALLOC(size) Tcl_Alloc((int) size)
#define FREE(ptr) if (ptr) { Tcl_Free((char*) ptr); ptr = 0; }
enum {
_CMD_SET = (1 << 0),
_CMD_GET = (1 << 1)
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
-
-
-
-
|
static int TclReadlineInitialize(Tcl_Interp* interp, char* historyfile);
static int blank_line(char* str);
static char** TclReadlineCompletion(char* text, int start, int end);
static char* TclReadline0generator(char* text, int state);
static char* TclReadlineKnownCommands(char* text, int state, int mode);
static int TclReadlineParse(char** args, int maxargs, char* buf);
/* must be non-static */
int Tclreadline_SafeInit(Tcl_Interp* interp);
int Tclreadline_Init(Tcl_Interp* interp);
enum {
LINE_PENDING = -1,
LINE_EOF = (1 << 8),
LINE_COMPLETE = (1 << 9)
};
|
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
|
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
|
-
+
-
+
-
+
-
+
-
+
|
(char*) &tclrl_history_length, TCL_LINK_INT)))
return status;
if (TCL_OK != (status = Tcl_LinkVar(interp, "::tclreadline::library",
(char*) &tclrl_library, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
return status;
if (TCL_OK != (status = Tcl_LinkVar(interp, "::tclreadline::version",
(char*) &TCLRL_VERSION, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
(char*) &tclrl_version_str, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
return status;
if (TCL_OK != (status = Tcl_LinkVar(interp, "::tclreadline::patchLevel",
(char*) &TCLRL_PATCHLEVEL, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
(char*) &tclrl_patchlevel_str, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
return status;
if (TCL_OK != (status = Tcl_LinkVar(interp, "::tclreadline::license",
(char*) &tclrl_license, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
return status;
if (TCL_OK != (status = Tcl_LinkVar(interp, "tclreadline_library",
(char*) &tclrl_library, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
return status;
if (TCL_OK != (status = Tcl_LinkVar(interp, "tclreadline_version",
(char*) &TCLRL_VERSION, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
(char*) &tclrl_version_str, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
return status;
if (TCL_OK != (status = Tcl_LinkVar(interp, "tclreadline_patchLevel",
(char*) &TCLRL_PATCHLEVEL, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
(char*) &tclrl_patchlevel_str, TCL_LINK_STRING | TCL_LINK_READ_ONLY)))
return status;
return Tcl_PkgProvide(interp, "tclreadline", TCLRL_VERSION);
return Tcl_PkgProvide(interp, "tclreadline", (char*)tclrl_version_str);
}
static int
TclReadlineInitialize(Tcl_Interp* interp, char* historyfile)
{
rl_readline_name = "tclreadline";
/* rl_special_prefixes = "${\"["; */
|