Check-in [7d8cdbb1ff]
Not logged in
Overview
Comment: .csymrc .login .tclshrc .vimrc vim xyz-stereo tcl_ft.vim HKLlink.h hkl.h tclreadlineSetup.tcl.in
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7d8cdbb1ff72e2b5e045dac116be3aae723f63e0
User & Date: johannes@zellner.org on 1999-09-04 08:48:11
Other Links: manifest | tags
Context
1999-09-06
06:58
TODO tclreadlineSetup.tcl.in check-in: c7a9a1576d user: johannes@zellner.org tags: trunk, CVS
1999-09-04
08:48
.csymrc .login .tclshrc .vimrc vim xyz-stereo tcl_ft.vim HKLlink.h hkl.h tclreadlineSetup.tcl.in check-in: 7d8cdbb1ff user: johannes@zellner.org tags: trunk
1999-09-03
18:00
Modified Files: .csymrc include/zellner/StdVector.h src/csym/.csymrc src/csym/csym.cc src/tclreadline/tclreadlineSetup.tcl.in Added Files: src/csym/version src/tclreadline/Makefile.in src/tclreadline/tclreadline.c src/tclreadline/tclreadlineConfig.sh.in src/tclreadline/tclreadlineInit.tcl.in check-in: 99d8d2b9c5 user: johannes@zellner.org tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified tclreadlineSetup.tcl.in from [7817716c44] to [99e76e529e].

     1      1   #!/usr/locanl/bin/tclsh
     2         -# FILE: "/home/joze/src/tclreadline/tclreadlineSetup.tcl.in"
     3         -# LAST MODIFICATION: "Fri Sep  3 16:16:44 1999 (joze)"
            2  +# FILE: "/diska/home/joze/src/tclreadline/tclreadlineSetup.tcl.in"
            3  +# LAST MODIFICATION: "Sat Sep  4 07:35:09 1999 (joze)"
     4      4   # (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
     5      5   # $Id$
     6      6   # ---
     7      7   #
     8      8   # tclreadline -- gnu readline for tcl
     9      9   # Copyright (C) 1999  Johannes Zellner
    10     10   #
................................................................................
   742    742                       set mod [string range $part 1 end]
   743    743                   } else {
   744    744                       set mod $part
   745    745                   }
   746    746   
   747    747                   if {[catch [list set script_result \
   748    748                       [complete(${cmd}) $part \
   749         -                    $start $end $line $pos $mod]] msg]
          749  +                    $start $end $line $pos $mod]] ::tclreadline::errorMsg]
   750    750                   } {
   751    751                       error "error during evaluation of `complete(${cmd})'"
   752    752                   }
   753    753                   return ${script_result}
   754    754               }
   755    755           }
   756    756           # no specific command completer found.
................................................................................
   788    788           if {[catch {set a [::tclreadline::prompt1]}] \
   789    789               && [info nameofexecutable] != ""} {
   790    790   
   791    791               namespace eval ::tclreadline {
   792    792                   variable prompt_string
   793    793                   set base [file tail [info nameofexecutable]]
   794    794   
   795         -                if {$base == "tclsh" && [info exists tcl_version]} {
          795  +                if {[string match tclsh* $base] && [info exists tcl_version]} {
   796    796                       set prompt_string \
   797         -                        "\[0;91m$base$tcl_version\[0m"
   798         -                } elseif {$base == "wish" && [info exists tk_version]} {
   799         -                    set prompt_string "\[0;94m$base$tk_version\[0m"
          797  +                        "\[0;91mtclsh$tcl_version\[0m"
          798  +                } elseif {[string match wish* $base] \
          799  +                    && [info exists tk_version]} {
          800  +                    set prompt_string "\[0;94mwish$tk_version\[0m"
   800    801                   } else {
   801    802                       set prompt_string "\[0;91m$base\[0m"
   802    803                   }
   803    804   
   804    805               }
   805    806   
   806    807               if {"" == [info procs ::tclreadline::prompt1]} {
................................................................................
   826    827               rename exit ::tclreadline::Exit
   827    828   
   828    829               proc exit {args} {
   829    830   
   830    831                   if {[catch {
   831    832                       ::tclreadline::readline write \
   832    833                       [::tclreadline::HistoryFileGet]
   833         -                } msg]} {
   834         -                    puts stderr $msg
          834  +                } ::tclreadline::errorMsg]} {
          835  +                    puts stderr $::tclreadline::errorMsg
   835    836                   }
   836    837   
   837    838                   if [catch "eval ::tclreadline::Exit $args" message] {
   838    839                       puts stderr "error:"
   839    840                       puts stderr "$message"
   840    841                   }
   841    842                   # NOTREACHED
................................................................................
   858    859       } else {
   859    860           if [info exists env(HOME)] {
   860    861               set historyfile  $env(HOME)/.tclsh-history
   861    862           } else {
   862    863               set historyfile  .tclsh-history
   863    864           }
   864    865       }
   865         -    set msg [readline initialize $historyfile]
   866         -    if {$msg != ""} {
   867         -        puts stderr "$msg"
          866  +    set ::tclreadline::errorMsg [readline initialize $historyfile]
          867  +    if {$::tclreadline::errorMsg != ""} {
          868  +        puts stderr $::tclreadline::errorMsg
   868    869       }
   869    870   
   870    871       InitCmds
   871    872   
   872    873       rename Setup ""
   873    874   }
   874    875   
................................................................................
   916    917                   } else {
   917    918                       set LINE [::tclreadline::readline read %]
   918    919                   }
   919    920                   while {![::tclreadline::readline complete $LINE]} {
   920    921                       append LINE "\n"
   921    922                       append LINE [tclreadline::readline read ${prompt2}]
   922    923                   }
   923         -            } msg]} {
   924         -                puts stderr [list tclreadline::Loop: error. $msg]
          924  +            } ::tclreadline::errorMsg]} {
          925  +                puts stderr [list tclreadline::Loop: error. \
          926  +                $::tclreadline::errorMsg]
   925    927                   continue
   926    928               }
   927    929   
   928    930               # Magnus Eriksson <magnus.eriksson@netinsight.se> proposed
   929    931               history add $LINE
   930    932   
   931    933               if [catch {
   932    934                   set result [eval $LINE]
   933    935                   if {$result != "" && [tclreadline::Print]} {
   934    936                       puts $result
   935    937                   }
   936    938                   set result ""
   937         -            } msg] {
   938         -                puts stderr $msg
          939  +            } ::tclreadline::errorMsg] {
          940  +                puts stderr $::tclreadline::errorMsg
   939    941                   puts stderr [list while evaluating $LINE]
   940    942               }
   941    943   
   942    944           }
   943    945       }
   944    946   }
   945    947   
................................................................................
  2152   2154   
  2153   2155   # -------------------------------------
  2154   2156   #                  TK
  2155   2157   # -------------------------------------
  2156   2158   
  2157   2159   # generic widget configuration
  2158   2160   
  2159         -proc TrySubCmds cmd {
         2161  +proc TrySubCmds {cmd} {
  2160   2162       set trystring ____
  2161   2163       set result ""
  2162   2164       if [catch {set result [${cmd} ${trystring}]} msg] {
  2163   2165           if {[regexp {bad *option.*____.*: *must *be( .*$)} ${msg} all raw]} {
  2164   2166               regsub -all -- , ${raw} { } raw
  2165   2167               set len [llength ${raw}]
  2166   2168               set len_2 [expr ${len} - 2]
................................................................................
  2167   2169               for {set i 0} {${i} < ${len}} {incr i} {
  2168   2170                   set word [lindex ${raw} ${i}]
  2169   2171                   if {"or" != ${word} && ${i} != ${len_2}} {
  2170   2172                       lappend result ${word}
  2171   2173                   }
  2172   2174   
  2173   2175               }
         2176  +        } else {
         2177  +            # check, if it's a blt error msg ...
         2178  +            #
         2179  +            set msglst [split ${msg} \n]
         2180  +            foreach line ${msglst} {
         2181  +                if {[regexp "${cmd}\[ \t\]\+\(\[^ \t\]*\)\[^:\]*$" \
         2182  +                    ${line} all sub]} {
         2183  +                    lappend result [list ${sub}]
         2184  +                }
         2185  +            }
  2174   2186           }
  2175   2187       }
  2176   2188       return ${result}
  2177   2189   }
  2178         -        
         2190  +
  2179   2191   proc WidgetList {pattern} {
  2180   2192       regsub {^([^\.])} ${pattern} {\.\1} pattern
  2181   2193       if {[winfo exists ${pattern}]} {
  2182   2194           return [winfo children ${pattern}]
  2183   2195       } else {
  2184   2196           regsub {.[^.]*$} $pattern {} pattern
  2185   2197           if {[winfo exists ${pattern}]} {