Check-in [41d16f099d]
Not logged in
Overview
Comment:Apply the Debian patchset Debian source package: tcl-tclreadline 2.1.0-12 Fully applied patches: * complete_nontcl.patch * completion_matches.patch * completion_pbug.patch * memuse.patch * tclshpath.patch * varnames.patch Partially applied patches: * manpage.patch * tinfo.patch Dropped patches: * kfreebsd.patch * link.patch * tclrldir.patch
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | origin/devel
Files: files | file ages | folders
SHA1: 41d16f099d370ea0b288f09dd724e12b87592f3f
User & Date: quentin@minster.io on 2014-02-18 23:09:10
Other Links: branch diff | manifest | tags
Context
2014-02-19
00:07
Apply the Gentoo patchset Gentoo ebuild: dev-tcltk/tclreadline-2.1.0-r4 Fully applied patches: * direct sed patches from the ebuild * tclreadline-2.1.0-gold.patch * tclreadline-2.1.0-rl-executing-macro.patch * tclreadline-2.1.0-rl-history-expand.patch * tclreadline-2.1.0-rl-prompt.patch Partially applied patches: * tclreadline-2.1.0-alloc-free.patch check-in: f61c58e424 user: quentin@minster.io tags: trunk, origin/devel
2014-02-18
23:09
Apply the Debian patchset Debian source package: tcl-tclreadline 2.1.0-12 Fully applied patches: * complete_nontcl.patch * completion_matches.patch * completion_pbug.patch * memuse.patch * tclshpath.patch * varnames.patch Partially applied patches: * manpage.patch * tinfo.patch Dropped patches: * kfreebsd.patch * link.patch * tclrldir.patch check-in: 41d16f099d user: quentin@minster.io tags: trunk, origin/devel
22:32
Add the 'ident' attribute to all files check-in: fa523361f5 user: quentin@minster.io tags: trunk, origin/devel
Changes

Modified configure.in from [f10843c742] to [72c6a348ad].

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
if test -z "$TCL_INCLUDE_DIR"; then
    AC_MSG_ERROR([
  Can't find tcl.h.  Use --with-tcl-includes to specify the directory
  containing tcl.h on your system.])
else
    AC_MSG_RESULT($TCL_INCLUDE_DIR/tcl.h)
fi


# ---
# check for the terminal library.
# ---

AC_ARG_WITH(tlib-library,
    [  --with-tlib-library=DIR
		  lib spec to tlib (e.g. '-L/usr/local/lib -lncurses')],
    LIBS="$LIBS $withval",
    for tlib in ncurses termlib termcap curses; do
	brk=yes
	AC_CHECK_LIB($tlib, tputs, , brk=no)
	if test $brk = "yes"; then
	    HAVE_TLIB=yes
	    break
	fi
    done
    if test "x" = "x$HAVE_TLIB"; then
	AC_MSG_ERROR([
	    no terminal library found. Please retry with the --with-tlib argument.
	])
    fi
)


#--------------------------------------------------------------------
#   Check for readline.h
#--------------------------------------------------------------------

AC_ARG_WITH(readline-includes,
            [  --with-readline-includes=DIR readline include files in DIR],
            rl_includes=$withval, rl_includes="")







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







118
119
120
121
122
123
124


























125
126
127
128
129
130
131
if test -z "$TCL_INCLUDE_DIR"; then
    AC_MSG_ERROR([
  Can't find tcl.h.  Use --with-tcl-includes to specify the directory
  containing tcl.h on your system.])
else
    AC_MSG_RESULT($TCL_INCLUDE_DIR/tcl.h)
fi


























#--------------------------------------------------------------------
#   Check for readline.h
#--------------------------------------------------------------------

AC_ARG_WITH(readline-includes,
            [  --with-readline-includes=DIR readline include files in DIR],
            rl_includes=$withval, rl_includes="")

Modified pkgIndex.tcl.in from [8cc3f9dc8d] to [e32c88be89].

1
2
3
4
5
6
7
8
#!/usr/local/bin/tclsh
# FILE: "/home/joze/src/tclreadline/pkgIndex.tcl.in"
# LAST MODIFICATION: "Mit, 10 Jan 2001 06:29:33 +0100 (joze)"
# (C) 1998 - 2001 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
# tclreadline -- gnu readline for tcl
# http://www.zellner.org/tclreadline/
<








1
2
3
4
5
6
7

# FILE: "/home/joze/src/tclreadline/pkgIndex.tcl.in"
# LAST MODIFICATION: "Mit, 10 Jan 2001 06:29:33 +0100 (joze)"
# (C) 1998 - 2001 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
# tclreadline -- gnu readline for tcl
# http://www.zellner.org/tclreadline/

Modified tclreadline.c from [5166ffcdb3] to [8df3bd02ad].

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#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)
};









|
|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#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) malloc((int) size)
#define FREE(ptr) if (ptr) { free((char*) ptr); ptr = 0; }

enum {
    _CMD_SET     = (1 << 0),
    _CMD_GET     = (1 << 1)
};


741
742
743
744
745
746
747
748
749
750
751
752
753
754
755

	    matches[i] = (char*) NULL; /* terminate */
	}
	Tcl_ResetResult(tclrl_interp); /* clear result space */
    }

    if (!matches && tclrl_use_builtin_completer) {
	matches = completion_matches(text, TclReadline0generator);
    }

    return matches;
}

static char*
TclReadline0generator(char* text, int state)







|







741
742
743
744
745
746
747
748
749
750
751
752
753
754
755

	    matches[i] = (char*) NULL; /* terminate */
	}
	Tcl_ResetResult(tclrl_interp); /* clear result space */
    }

    if (!matches && tclrl_use_builtin_completer) {
	matches = rl_completion_matches(text, (rl_compentry_func_t *)TclReadline0generator);
    }

    return matches;
}

static char*
TclReadline0generator(char* text, int state)

Modified tclreadline.n.in from [d9f3f38a64] to [561d62d80a].

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
to modify your .tclshrc according to the section \fBFILES\fP.

For the functionality of the GNU readline you should refer to
the readline's documentation.

.PP
The following list will give all commands, which are currently
implemented in the shared lib (e.g. libtclreadline@TCLREADLINE_VERSION@.so).
Additional commands were introduced in a startup script
\fBtclreadlineSetup.tcl\fP, which lives in the tclreadline
installation directory.
(typically something like /usr/local/lib/tclreadline ..)
These commands are primarily for internal use and not documented here.

Note that all commands reside in the namespace \fB::tclreadline::\fP.







|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
to modify your .tclshrc according to the section \fBFILES\fP.

For the functionality of the GNU readline you should refer to
the readline's documentation.

.PP
The following list will give all commands, which are currently
implemented in the shared lib (e.g. libtclreadline@VERSION@.so).
Additional commands were introduced in a startup script
\fBtclreadlineSetup.tcl\fP, which lives in the tclreadline
installation directory.
(typically something like /usr/local/lib/tclreadline ..)
These commands are primarily for internal use and not documented here.

Note that all commands reside in the namespace \fB::tclreadline::\fP.
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
of the line). The default for this script is "puts {}; exit". Setting
this to an empty value disables any action on eof.
\fBtclreadline::readline eof\fP returns the current eof script.

.TP 5
\fB::tclreadline::readline initialize\fP \fIhistoryfile\fP
initialize the tclreadline interface and read the history from
the \fIhistoryfile\fP. On succes an empty string is returned.
This command has to be called before any other tclreadline commands.

.TP 5
\fB::tclreadline::readline read\fP \fIprompt\fP
prints the \fIprompt\fP to stdout and enters the tclreadline event
loop. Both readline and X events are processed. Returns the
(eventually history-expanded) input string.







|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
of the line). The default for this script is "puts {}; exit". Setting
this to an empty value disables any action on eof.
\fBtclreadline::readline eof\fP returns the current eof script.

.TP 5
\fB::tclreadline::readline initialize\fP \fIhistoryfile\fP
initialize the tclreadline interface and read the history from
the \fIhistoryfile\fP. On success an empty string is returned.
This command has to be called before any other tclreadline commands.

.TP 5
\fB::tclreadline::readline read\fP \fIprompt\fP
prints the \fIprompt\fP to stdout and enters the tclreadline event
loop. Both readline and X events are processed. Returns the
(eventually history-expanded) input string.
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234





235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
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,
if it is not already defined. So: If you define your own proc
::tclreadline::prompt1 before entering ::tclreadline::Loop, this
proc is called each time the prompt is to be displayed.
Example:
.CS
    package require tclreadline
    namespace eval tclreadline {
        proc prompt1 {} {
            return "[clock format [clock seconds]]> "
        }
    }
    ::tclreadline::Loop
.CE

Note that non-printable control characters as color control characters
must be enclosed in literal ctrl-a / ctrl-b to tell readline the length
of the printable prompt. See for example the variable `prompt_string'
in the file tclreadlineSetup.tcl in your tclreadline installation directory.







.\" .SH "EXAMPLES"


.\" .SH "ENVIRONMENT VARIABLES"

.SH "VARIABLES"

\fItclreadline\fP defines the following variables in the
namespace \fI::tclreadline\fP:
(for backwards compatiblity the global variables tclreadline_version,
 tclreadline_patchLevel and tclreadline_library are still present).

.TP 5
\fBtclreadline::version\fP (read-only)
holds the version string "@TCLREADLINE_VERSION@".

.TP 5
\fBtclreadline::patchLevel\fP (read-only)
holds the patch level string "@PATCHLEVEL_STR@".

.TP 5
\fBtclreadline::library\fP (read-only)
holds the library string "@TCLREADLINE_LIBRARY@".

.TP 5
\fBtclreadline::license\fP (read-only)
holds a BSD license statement.

.TP 5
\fBtclreadline::historyLength\fP







|




















>
>
>
>
>










|




|







|







207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
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,
if it is not already defined. So: If you define your own proc
::tclreadline::prompt1 before entering ::tclreadline::Loop, this
proc is called each time the prompt is to be displayed.
Example:
.CS
    package require tclreadline
    namespace eval tclreadline {
        proc prompt1 {} {
            return "[clock format [clock seconds]]> "
        }
    }
    ::tclreadline::Loop
.CE

Note that non-printable control characters as color control characters
must be enclosed in literal ctrl-a / ctrl-b to tell readline the length
of the printable prompt. See for example the variable `prompt_string'
in the file tclreadlineSetup.tcl in your tclreadline installation directory.

.TP 5
\fB::tclreadline::prompt2\fP
a proc which is called by ::tclreadline::Loop and returns a string
which will be displayed as the secondary prompt when interactively
prompting  for  continuation  of  an incomplete command.

.\" .SH "EXAMPLES"


.\" .SH "ENVIRONMENT VARIABLES"

.SH "VARIABLES"

\fItclreadline\fP defines the following variables in the
namespace \fI::tclreadline\fP:
(for backwards compatibility the global variables tclreadline_version,
 tclreadline_patchLevel and tclreadline_library are still present).

.TP 5
\fBtclreadline::version\fP (read-only)
holds the version string "@VERSION@".

.TP 5
\fBtclreadline::patchLevel\fP (read-only)
holds the patch level string "@PATCHLEVEL_STR@".

.TP 5
\fBtclreadline::library\fP (read-only)
holds the library string "@TCLRL_DIR@".

.TP 5
\fBtclreadline::license\fP (read-only)
holds a BSD license statement.

.TP 5
\fBtclreadline::historyLength\fP

Modified tclreadlineCompleter.tcl from [d56a0206cd] to [cf379af2f8].

621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
					return 0
				}
			} else {
				return 0
			}
		}
	}
	if {![catch [list set type [image type ${cmd}]]]} {
		switch -- ${type} {
			photo {
				set result [PhotoObj ${text} ${start} ${end} ${line} ${pos}]
				return 1
			}
			default {
				# let the fallback completers do the job.







|







621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
					return 0
				}
			} else {
				return 0
			}
		}
	}
	if {![catch {set type [image type $cmd]}]} {
		switch -- ${type} {
			photo {
				set result [PhotoObj ${text} ${start} ${end} ${line} ${pos}]
				return 1
			}
			default {
				# let the fallback completers do the job.
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
			set alias [uplevel [info level] \
			subst [lindex [lindex [QuoteQuotes ${line}] 0] 0]]

			# make `alias' a fully qualified name.
			# this can raise an error, if alias is
			# no valid command.
			#
			if {[catch [list set alias [namespace origin $alias]]]} {
				return ""
			}

			# strip leading ::'s.
			#
			regsub -all {^::} $alias {} alias
			set namespc [namespace qualifiers $alias]







|







1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
			set alias [uplevel [info level] \
			subst [lindex [lindex [QuoteQuotes ${line}] 0] 0]]

			# make `alias' a fully qualified name.
			# this can raise an error, if alias is
			# no valid command.
			#
			if {[catch {set alias [namespace origin $alias]}]} {
				return ""
			}

			# strip leading ::'s.
			#
			regsub -all {^::} $alias {} alias
			set namespc [namespace qualifiers $alias]
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
# proc complete(regexp) {text start end line pos mod} {
#     We're not on windoze here ...
# }

proc complete(regsub) {text start end line pos mod} {
	set prev [PreviousWord ${start} ${line}]
	if {[llength ${prev}] && "--" != $prev && \
		("-" == [string index ${prev} 0] || 1 == ${pos)}} {
		set cmds [RemoveUsedOptions ${line} {
			-all -nocase --} {--}]
		if {[llength ${cmds}]} {
			return [string trim [CompleteFromList ${text} ${cmds}]]
		}
	} else {
		set virtual_pos [expr ${pos} - [FirstNonOption ${line}]]







|







3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
# proc complete(regexp) {text start end line pos mod} {
#     We're not on windoze here ...
# }

proc complete(regsub) {text start end line pos mod} {
	set prev [PreviousWord ${start} ${line}]
	if {[llength ${prev}] && "--" != $prev && \
		("-" == [string index ${prev} 0] || 1 == ${pos})} {
		set cmds [RemoveUsedOptions ${line} {
			-all -nocase --} {--}]
		if {[llength ${cmds}]} {
			return [string trim [CompleteFromList ${text} ${cmds}]]
		}
	} else {
		set virtual_pos [expr ${pos} - [FirstNonOption ${line}]]
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
	return [CompleteFromList ${text} [RemoveUsedOptions ${line} {
		-nobackslashes -nocommands -novariables <string>}]]
}

proc complete(switch) {text start end line pos mod} {
	set prev [PreviousWord ${start} ${line}]
	if {[llength ${prev}] && "--" != ${prev} && \
		("-" == [string index ${prev} 0] || 1 == ${pos)}} {
		set cmds [RemoveUsedOptions ${line} {
			-exact -glob -regexp --} {--}]
		if {[llength ${cmds}]} {
			return [string trim [CompleteFromList ${text} ${cmds}]]
		}
	} else {
		set virtual_pos [expr ${pos} - [FirstNonOption ${line}]]







|







3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
	return [CompleteFromList ${text} [RemoveUsedOptions ${line} {
		-nobackslashes -nocommands -novariables <string>}]]
}

proc complete(switch) {text start end line pos mod} {
	set prev [PreviousWord ${start} ${line}]
	if {[llength ${prev}] && "--" != ${prev} && \
		("-" == [string index ${prev} 0] || 1 == ${pos})} {
		set cmds [RemoveUsedOptions ${line} {
			-exact -glob -regexp --} {--}]
		if {[llength ${cmds}]} {
			return [string trim [CompleteFromList ${text} ${cmds}]]
		}
	} else {
		set virtual_pos [expr ${pos} - [FirstNonOption ${line}]]

Modified tclreadlineInit.tcl.in from [9814e2f545] to [56eefa1686].

1
2
3
4
5
6
7
8
#!/usr/local/bin/tclsh
# FILE: "/home/joze/src/tclreadline/tclreadlineInit.tcl.in"
# LAST MODIFICATION: "Mit, 10 Jan 2001 06:29:33 +0100 (joze)"
# (C) 1998 - 2001 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
# tclreadline -- gnu readline for tcl
# http://www.zellner.org/tclreadline/
<








1
2
3
4
5
6
7

# FILE: "/home/joze/src/tclreadline/tclreadlineInit.tcl.in"
# LAST MODIFICATION: "Mit, 10 Jan 2001 06:29:33 +0100 (joze)"
# (C) 1998 - 2001 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
# tclreadline -- gnu readline for tcl
# http://www.zellner.org/tclreadline/

Modified tclreadlineSetup.tcl.in from [b96052aeac] to [91dcec21a3].

1
2
3
4
5
6
7
8
#!/usr/locanl/bin/tclsh
# FILE: "/home/joze/src/tclreadline/tclreadlineSetup.tcl.in"
# LAST MODIFICATION: "Mit, 10 Jan 2001 06:29:34 +0100 (joze)"
# (C) 1998 - 2001 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
# tclreadline -- gnu readline for tcl
# http://www.zellner.org/tclreadline/
<








1
2
3
4
5
6
7

# FILE: "/home/joze/src/tclreadline/tclreadlineSetup.tcl.in"
# LAST MODIFICATION: "Mit, 10 Jan 2001 06:29:34 +0100 (joze)"
# (C) 1998 - 2001 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
# tclreadline -- gnu readline for tcl
# http://www.zellner.org/tclreadline/
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

    uplevel #0 {

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

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

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

		if {[string match tclsh* $base] && [info exists tcl_version]} {
		    set prompt_string \







|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

    uplevel #0 {

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

	if {"" == [info procs ::tclreadline::prompt1] && [info nameofexecutable] != ""} {

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

		if {[string match tclsh* $base] && [info exists tcl_version]} {
		    set prompt_string \
166
167
168
169
170
171
172










173
174
175
176
177
178
179
			regsub $env(HOME) $pwd "~" pwd
		    }
		    return "$prompt_string \[$pwd\]"
		}
	    }
	    # puts body=[info body ::tclreadline::prompt1]
	}











	if {"" == [info procs exit]} {

	    catch {rename ::tclreadline::Exit ""}
	    rename exit ::tclreadline::Exit

	    proc exit {args} {







>
>
>
>
>
>
>
>
>
>







165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
			regsub $env(HOME) $pwd "~" pwd
		    }
		    return "$prompt_string \[$pwd\]"
		}
	    }
	    # puts body=[info body ::tclreadline::prompt1]
	}

	if {"" == [info procs ::tclreadline::prompt2] && [info nameofexecutable] != ""} {

	    if {"" == [info procs ::tclreadline::prompt2]} {
		proc ::tclreadline::prompt2 {} {
		    return ">"
		}
	    }
	    # puts body=[info body ::tclreadline::prompt2]
	}

	if {"" == [info procs exit]} {

	    catch {rename ::tclreadline::Exit ""}
	    rename exit ::tclreadline::Exit

	    proc exit {args} {
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280




281

282
283
284
285
286
287
288
289
290
291
292
293
294
295
296

297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316

    eval Setup ${args}

    uplevel #0 {

	while {1} {

	    if [info exists tcl_prompt2] {
		set prompt2 $tcl_prompt2
	    } else {
		set prompt2 ">"
	    }

	    if {[catch {
		if {"" != [namespace eval ::tclreadline {info procs prompt1}]} {
		    set LINE [::tclreadline::readline read \
		    [::tclreadline::prompt1]]
		} else {
		    set LINE [::tclreadline::readline read %]
		}
		while {![::tclreadline::readline complete $LINE]} {
		    append LINE "\n"




		    append LINE [tclreadline::readline read ${prompt2}]

		}
	    } ::tclreadline::errorMsg]} {
		puts stderr [list tclreadline::Loop: error. \
		$::tclreadline::errorMsg]
		continue
	    }

	    # Magnus Eriksson <magnus.eriksson@netinsight.se> proposed
	    # to add the line also to tclsh's history.
	    #
	    # I decided to add only lines which are different from
	    # the previous one to the history. This is different
	    # from tcsh's behaviour, but I found it quite convenient
	    # while using mshell on os9.
	    #

	    if {[string length $LINE] && [history event 0] != $LINE} {
		history add $LINE
	    }

	    if [catch {
		set result [eval $LINE]
		if {$result != "" && [tclreadline::Print]} {
		    puts $result
		}
		set result ""
	    } ::tclreadline::errorMsg] {
		puts stderr $::tclreadline::errorMsg
		puts stderr [list while evaluating $LINE]
	    }

	}
    }
}

proc Print {args} {







<
<
<
<
<
<


|


|

|
|
>
>
>
>
|
>















>
|
|



|
|
|

|


|







268
269
270
271
272
273
274






275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325

    eval Setup ${args}

    uplevel #0 {

	while {1} {







	    if {[catch {
		if {"" != [namespace eval ::tclreadline {info procs prompt1}]} {
		    set ::tclreadline::LINE [::tclreadline::readline read \
		    [::tclreadline::prompt1]]
		} else {
		    set ::tclreadline::LINE [::tclreadline::readline read %]
		}
		while {![::tclreadline::readline complete $::tclreadline::LINE]} {
		    append ::tclreadline::LINE "\n"
		    if {"" != [namespace eval ::tclreadline {info procs prompt2}]} {
			append ::tclreadline::LINE \
			    [tclreadline::readline read [::tclreadline::prompt2]]
		    } else {
			append ::tclreadline::LINE [tclreadline::readline read >]
		    }
		}
	    } ::tclreadline::errorMsg]} {
		puts stderr [list tclreadline::Loop: error. \
		$::tclreadline::errorMsg]
		continue
	    }

	    # Magnus Eriksson <magnus.eriksson@netinsight.se> proposed
	    # to add the line also to tclsh's history.
	    #
	    # I decided to add only lines which are different from
	    # the previous one to the history. This is different
	    # from tcsh's behaviour, but I found it quite convenient
	    # while using mshell on os9.
	    #
	    if {[string length $::tclreadline::LINE] && \
		    [history event 0] != $::tclreadline::LINE} {
		history add $::tclreadline::LINE
	    }

	    if [catch {
		set ::tclreadline::result [eval $::tclreadline::LINE]
		if {$::tclreadline::result != "" && [tclreadline::Print]} {
		    puts $::tclreadline::result
		}
		set ::tclreadline::result ""
	    } ::tclreadline::errorMsg] {
		puts stderr $::tclreadline::errorMsg
		puts stderr [list while evaluating $::tclreadline::LINE]
	    }

	}
    }
}

proc Print {args} {