Check-in [cf2851923e]
Not logged in
Overview
SHA1:cf2851923ea48f69e37d82273cf1c6229a949514
Date: 2001-08-10 20:05:53
User: dz@debian.org
Comment:In tclreadlineSetup.tcl.in prefixed all global variables with package prefix to avoid polluting the global namespace.
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2001-08-10
20:56
[95608888ca] Leaf: added Massimo to AUTHORS (user: johannes@zellner.org, tags: trunk)
20:05
[cf2851923e] In tclreadlineSetup.tcl.in prefixed all global variables with package prefix to avoid polluting the global namespace. (user: dz@debian.org, tags: trunk)
2001-04-08
18:34
[07bc0bf2d9] added .cvsignore (user: johannes@zellner.org, tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified ChangeLog from [2522bfd3d9] to [b10692387c].







1
2
3
4
5
6
7






2001-01-10  Johannes Zellner  <johannes@zellner.org>

	* configure.in: changed the check for readline/readline.h / readline.h

2000-12-08  Johannes Zellner  <johannes@zellner.org>

    * reordered Makefile.am so that it always includes
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2001-08-10  Massimo Dal Zotto  <dz@debian.org>

    * In tclreadlineSetup.tcl.in prefixed all global variables with
      package prefix to avoid polluting the global namespace.
      Removed also the global unused variable "a".

2001-01-10  Johannes Zellner  <johannes@zellner.org>

	* configure.in: changed the check for readline/readline.h / readline.h

2000-12-08  Johannes Zellner  <johannes@zellner.org>

    * reordered Makefile.am so that it always includes

Modified tclreadlineSetup.tcl.in from [b96052aeac] to [3ffc2c5574].

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
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
...
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

    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 \
................................................................................

    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
	    }

................................................................................
	    # 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} {







|







 







>

<
|
|




|


|

|
|
|
>
>
>
>
>
>







 







|
|



|
|
|

|


|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
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
...
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

    uplevel #0 {

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

	if {[catch {::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 \
................................................................................

    eval Setup ${args}

    uplevel #0 {

	while {1} {

	    # Try to transform {puts -nonewline stdout =>} into {concat =>}
	    if [info exists tcl_prompt2] {

		regsub "puts\[ \t]*(-nonewline)?\[ \t](stdout)?" $tcl_prompt2 \
			"concat" tcl_prompt2
	    }

	    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"
		    append ::tclreadline::LINE [::tclreadline::readline read [
		        if [info exists tcl_prompt2] {
			    eval $tcl_prompt2
			} else {
			    concat ">"
			}
		    ]]
		}
	    } ::tclreadline::errorMsg]} {
		puts stderr [list tclreadline::Loop: error. \
		$::tclreadline::errorMsg]
		continue
	    }

................................................................................
	    # 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} {