Skip to content

Commit

Permalink
In tclreadlineSetup.tcl.in prefixed all global variables with
Browse files Browse the repository at this point in the history
package prefix to avoid polluting the global namespace.
  • Loading branch information
Massimo Dal Zotto committed Aug 10, 2001
1 parent 94b0ff2 commit 1978f45
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
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
Expand Down
38 changes: 22 additions & 16 deletions tclreadlineSetup.tcl.in
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ proc Setup {args} {
::tclreadline::Init
}

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

namespace eval ::tclreadline {
variable prompt_string
Expand Down Expand Up @@ -263,22 +263,28 @@ proc Loop {args} {

while {1} {

# Try to transform {puts -nonewline stdout =>} into {concat =>}
if [info exists tcl_prompt2] {
set prompt2 $tcl_prompt2
} else {
set prompt2 ">"
regsub "puts\[ \t]*(-nonewline)?\[ \t](stdout)?" $tcl_prompt2 \
"concat" tcl_prompt2
}

if {[catch {
if {"" != [namespace eval ::tclreadline {info procs prompt1}]} {
set LINE [::tclreadline::readline read \
set ::tclreadline::LINE [::tclreadline::readline read \
[::tclreadline::prompt1]]
} else {
set LINE [::tclreadline::readline read %]
set ::tclreadline::LINE [::tclreadline::readline read %]
}
while {![::tclreadline::readline complete $LINE]} {
append LINE "\n"
append LINE [tclreadline::readline read ${prompt2}]
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. \
Expand All @@ -294,19 +300,19 @@ proc Loop {args} {
# 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 {[string length $::tclreadline::LINE] && [history event 0] != $::tclreadline::LINE} {
history add $::tclreadline::LINE
}

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

}
Expand Down

0 comments on commit 1978f45

Please sign in to comment.