Check-in [12f1ef0408]
Not logged in
Overview
Comment: Modified Files: README sample.tclshrc tclreadline.n.in tclreadlineSetup.tcl.in Added Files: Makefile.in tclreadline.c tclreadlineConfig.sh.in tclreadlineInit.tcl.in
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 12f1ef04084e8a17ce0e9bb65d5e76c62c10d4f8
User & Date: johannes@zellner.org on 1999-08-22 22:28:30
Other Links: manifest | tags
Context
1999-08-22
22:34
tclreadlineSetup.tcl.in check-in: 66eb0d332d user: johannes@zellner.org tags: trunk
22:28
Modified Files: README sample.tclshrc tclreadline.n.in tclreadlineSetup.tcl.in Added Files: Makefile.in tclreadline.c tclreadlineConfig.sh.in tclreadlineInit.tcl.in check-in: 12f1ef0408 user: johannes@zellner.org tags: trunk
21:31
Modified Files: README tclreadline.n.in tclreadlineSetup.tcl.in Added Files: Makefile.in tclreadline.c tclreadlineConfig.sh.in tclreadlineInit.tcl.in check-in: 32efe7b8fe user: johannes@zellner.org tags: trunk
Changes

Modified README from [b445706663] to [109aca9237].

1
2
3
4
5
6
7
8
9
10

    FILE: "/home/joze/src/tclreadline/README"
    LAST MODIFICATION: "Sun Aug 22 23:24:34 1999 (joze)"
    (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
    $Id$
    ---

    tclreadline -- gnu readline for tcl
    Copyright (C) 1999  Johannes Zellner



|







1
2
3
4
5
6
7
8
9
10

    FILE: "/home/joze/src/tclreadline/README"
    LAST MODIFICATION: "Mon Aug 23 00:21:24 1999 (joze)"
    (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
    $Id$
    ---

    tclreadline -- gnu readline for tcl
    Copyright (C) 1999  Johannes Zellner

79
80
81
82
83
84
85
86









87
88
89
90
91
92
93
94

95
96
97
98

tclreadline-0.9: (Aug 1999)

    changes:
        - tclreadline::readline customcompleter
        - tclreadline::readline builtincompleter
        - tclreadline::readline eofchar
        - variable, array and '[' command completion.










    bug fixes:
        - history entries.
        - macro mappings didn't work. (only on hitting
          mapped characters more than once.)
        - minor fixes in configure.in

tclreadline-0.8:

    minor bug fixes.

tclreadline-0.7:
    first `public release'.







|
>
>
>
>
>
>
>
>
>


|
|



|
>
|

|

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

tclreadline-0.9: (Aug 1999)

    changes:
        - tclreadline::readline customcompleter
        - tclreadline::readline builtincompleter
        - tclreadline::readline eofchar
        - variable, array and '[' command completion by the script
          tclreadline::ScriptCompleter. See the man page or try
          typing "puts $env<TAB>" ... Command completion currently only
          works, if a '[' preceeds immediately a non-white character.
        - the redefinition of the command `cd' was removed due to 
          multiple requests. This redefinition can be found in the
          file `sample.tclshrc' and can be uncommented, if desired. 
        - the definition of the command `ls' was moved outside the
          proc tclreadline::Setup and can be used with the command
          namespace import tclreadline::ls (see sample.tclshrc).

    bug fixes:
        - lines added to tcl's history. (were only in readline's hist.)
        - macro mappings didn't work. (only when hitting
          mapped characters more than once.)
        - minor fixes in configure.in

tclreadline-0.8: (May 1999)
    - adapted for tcl8.1.
    - minor bug fixes.

tclreadline-0.7: (Mar 1999)
    first `public release'.

Modified sample.tclshrc from [79de25f768] to [7e7f1c5e92].

1
2
3
4
5
6
7
8
9
10

11



















12







13








14
15
16
#!/bin/sh
# FILE: "/diska/home/joze/src/tclreadline/sample.tclshrc"
# LAST MODIFICATION: "Fri Aug 20 15:39:58 1999 (joze)"
# (C) 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# vim:set ft=tcl: \
exec tclsh "$0" "$@"


if {$tcl_interactive} {

    package require tclreadline



















    namespace import ::tclreadline::Print







#    ::tclreadline::Print no








    ::tclreadline::Loop
}


|
|







>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# FILE: "/home/joze/src/tclreadline/sample.tclshrc"
# LAST MODIFICATION: "Mon Aug 23 00:00:23 1999 (joze)"
# (C) 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# vim:set ft=tcl: \
exec tclsh "$0" "$@"


if {$tcl_interactive} {

    package require tclreadline

    # uncomment the following if block, if you
    # want `ls' executed after every `cd'. (This was
    # the default up to 0.8 == tclreadline_version.)
    #
    # if {"" == [info procs cd]} {
    #     catch {rename ::tclreadline::Cd ""}
    #     rename cd ::tclreadline::Cd
    #     proc cd {args} {
    #         if {[catch {eval ::tclreadline::Cd $args} message]} {
    #             puts stderr "$message"
    #         }
    #         ls
    #     }
    # }

    # uncomment the following line to use
    # tclreadline's fancy ls proc.
    #
    # namespace import ::tclreadline::ls

    # tclreadline::Print is on (`yes') by default.
    # This mimics the command echoing like in the
    # non-readline interactive tclsh.
    # If you don't like this, uncomment the following
    # line.
    #
    # ::tclreadline::Print no

    # uncomment the folling line, if you want
    # to change tclreadline's print behaviour
    # frequently with less typing.
    #
    # namespace import ::tclreadline::Print

    # go to tclrealdine's main loop.
    ::tclreadline::Loop
}

Modified tclreadline.n.in from [401a33cf08] to [d7922e5c29].

1
2
3
4
5
6
7
8
9
10
11
12
.TH tclreadline n "@TCLREADLINE_VERSION@" "Johannes Zellner"

.\" (C) 1999 by Johannes Zellner
.\" FILE: "/home/joze/src/tclreadline/tclreadline.n.in"
.\" LAST MODIFICATION: "Sun Aug 22 23:24:34 1999 (joze)"
.\" (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
.\" $Id$
.\" ---
.\"
.\" tclreadline -- gnu readline for the tcl scripting language
.\" Copyright (C) 1999  Johannes Zellner
.\"




|







1
2
3
4
5
6
7
8
9
10
11
12
.TH tclreadline n "@TCLREADLINE_VERSION@" "Johannes Zellner"

.\" (C) 1999 by Johannes Zellner
.\" FILE: "/home/joze/src/tclreadline/tclreadline.n.in"
.\" LAST MODIFICATION: "Mon Aug 23 00:15:10 1999 (joze)"
.\" (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
.\" $Id$
.\" ---
.\"
.\" tclreadline -- gnu readline for the tcl scripting language
.\" Copyright (C) 1999  Johannes Zellner
.\"
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

Example: \fB% puts $b<TAB>\fP will call the custom completer
with the four arguments \fI"$b"\fP, \fI"5"\fP, \fI"8"\fP and \fI"puts $b"\fP.
The custom completer could return a string like "$bl $black $blue", which
will complete "$b" to "$bl" (the longest match) and offer a list of two
further matches "$black" and "$blue".

For further reference, see the proc tclreadline::script_completer in
the file tclreadlineSetup.tcl.

.TP 5
\fB::tclreadline::readline builtincompleter\fP [\fIbool\fP]
enable or disable the builtin completer. If the builtin completer
is enabled, it will be invoked either if there is no custom completer,
or the custom completer returned an empty  string. The builtin







|







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

Example: \fB% puts $b<TAB>\fP will call the custom completer
with the four arguments \fI"$b"\fP, \fI"5"\fP, \fI"8"\fP and \fI"puts $b"\fP.
The custom completer could return a string like "$bl $black $blue", which
will complete "$b" to "$bl" (the longest match) and offer a list of two
further matches "$black" and "$blue".

For further reference, see the proc tclreadline::ScriptCompleter in
the file tclreadlineSetup.tcl.

.TP 5
\fB::tclreadline::readline builtincompleter\fP [\fIbool\fP]
enable or disable the builtin completer. If the builtin completer
is enabled, it will be invoked either if there is no custom completer,
or the custom completer returned an empty  string. The builtin
164
165
166
167
168
169
170
171
172
173
174
175
176



177



178
179
180
181
182
183
184

.TP 5
\fB::tclreadline::Print\fP [\fIyes / no\fP]
turns on or off the default behavior of tclsh to print the result of
every command. This is turned on by default, so it will just behave
as the tclsh w/o tclreadline. Turning off might be useful, when reading
binary data for example. If \fB::tclreadline::Print\fP is called w/o
arguments, it just returns the current setting.

.TP 5
\fB::tclreadline::Loop\fP
enter the tclreadline main loop. This command is typically called from
the startup resource file (something .tclshrc, depending on the interpreter



you use). \fB::tclreadline::Loop\fP will normally not return.




.TP 5
\fB::tclreadline::prompt1\fP
a proc which is called by ::tclreadline::Loop and returns a string
which will be displayed as the primary prompt. This prompt will be
something like "[info nameofexecutable] \[[pwd]\]" possibly fancy colored.
The default proc is defined on entering the ::tclreadline::Loop,







|





>
>
>
|
>
>
>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190

.TP 5
\fB::tclreadline::Print\fP [\fIyes / no\fP]
turns on or off the default behavior of tclsh to print the result of
every command. This is turned on by default, so it will just behave
as the tclsh w/o tclreadline. Turning off might be useful, when reading
binary data for example. If \fB::tclreadline::Print\fP is called w/o
arguments, it returns the current setting.

.TP 5
\fB::tclreadline::Loop\fP
enter the tclreadline main loop. This command is typically called from
the startup resource file (something .tclshrc, depending on the interpreter
you use, see the file `sample.tclshrc'). The main loop sets up some
completion characteristics as variable -- try something like "puts $b<TAB>" -- 
and command completion -- try "puts [in<TAB>".
\fB::tclreadline::Loop\fP will normally not return. 
If you want to write your own main loop and/or own custom completers,
it is probably a good idea to start with tclreadline::Loop
(see the file tclreadlineSetup.tcl).

.TP 5
\fB::tclreadline::prompt1\fP
a proc which is called by ::tclreadline::Loop and returns a string
which will be displayed as the primary prompt. This prompt will be
something like "[info nameofexecutable] \[[pwd]\]" possibly fancy colored.
The default proc is defined on entering the ::tclreadline::Loop,
276
277
278
279
280
281
282
283

284
285
286
287
288





Christian Krone <krischan@sql.de>,
Larry W. Virden <lvirden@cas.org>,
David Engel <dlengel@home.com>, <david@debian.org>

.SH DEBIAN PACKAGE
David Engel <dlengel@home.com>, <david@debian.org>

.SH HISTORY

This version of \fBtclreadline\fP is still a development version.
Pretty a lot of features and ideas are not implemented yet. The
reason for this is the lack of time and manpower.
So you are welcome to modify and contribute to the code.
If you have suggestions, please let me know.












|
>





>
>
>
>
>
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
Christian Krone <krischan@sql.de>,
Larry W. Virden <lvirden@cas.org>,
David Engel <dlengel@home.com>, <david@debian.org>

.SH DEBIAN PACKAGE
David Engel <dlengel@home.com>, <david@debian.org>

.SH DISCLAIMER

This version of \fBtclreadline\fP is still a development version.
Pretty a lot of features and ideas are not implemented yet. The
reason for this is the lack of time and manpower.
So you are welcome to modify and contribute to the code.
If you have suggestions, please let me know.

\fBtclreadline\fP comes with the GPL (GNU General Public License).
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Modified tclreadlineSetup.tcl.in from [92fdf6b439] to [65d3fcdc8e].

1
2
3
4
5
6
7
8
9
10
#!/usr/local/bin/tclsh
# FILE: "/home/joze/src/tclreadline/tclreadlineSetup.tcl.in"
# LAST MODIFICATION: "Sun Aug 22 22:30:43 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#


|







1
2
3
4
5
6
7
8
9
10
#!/usr/local/bin/tclsh
# FILE: "/home/joze/src/tclreadline/tclreadlineSetup.tcl.in"
# LAST MODIFICATION: "Sun Aug 22 23:54:09 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
        } else {
            append part $char
        }
    }
    return ${part}
}

proc tclreadline::vars_cmds_completer {part start end line} {
    if {{$} == [string index $part 0]} {
        # variable completion. Check first, if the
        # variable starts with a plain `$' or should
        # be enclosed in braces.
        #
        if {"\{" == [string index $part 1]} {
            set var [string range $part 2 end]







|







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
        } else {
            append part $char
        }
    }
    return ${part}
}

proc tclreadline::ScriptCompleter {part start end line} {
    if {{$} == [string index $part 0]} {
        # variable completion. Check first, if the
        # variable starts with a plain `$' or should
        # be enclosed in braces.
        #
        if {"\{" == [string index $part 1]} {
            set var [string range $part 2 end]
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
proc ::tclreadline::Setup {} {

    uplevel #0 {

        if {[info commands ::tclreadline::readline] == ""} {
            ::tclreadline::Init
        }
        tclreadline::readline customcompleter tclreadline::vars_cmds_completer

        if {[catch {set a [::tclreadline::prompt1]}] \
            && [info nameofexecutable] != ""} {

            namespace eval ::tclreadline {
                variable prompt_string
                set base [file tail [info nameofexecutable]]







|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
proc ::tclreadline::Setup {} {

    uplevel #0 {

        if {[info commands ::tclreadline::readline] == ""} {
            ::tclreadline::Init
        }
        tclreadline::readline customcompleter tclreadline::ScriptCompleter

        if {[catch {set a [::tclreadline::prompt1]}] \
            && [info nameofexecutable] != ""} {

            namespace eval ::tclreadline {
                variable prompt_string
                set base [file tail [info nameofexecutable]]