Check-in [dc9268f6ad]
Not logged in
Overview
SHA1:dc9268f6ad4c91f21cb139567a0cb8b4a018c48b
Date: 2014-03-17 21:17:14
User: quentin@minster.io
Comment:Harmonize style in all Tcl files Brace arguments of if/expr constructs
Timelines: family | ancestors | descendants | both | trunk | origin/devel
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-03-17
21:17
[320bbe752c] Enhance a bit of logic (expr should be cheaper than regexp) (user: quentin@minster.io, tags: trunk, origin/devel)
21:17
[dc9268f6ad] Harmonize style in all Tcl files Brace arguments of if/expr constructs (user: quentin@minster.io, tags: trunk, origin/devel)
2014-02-26
22:37
[a9511ba2db] Cleanup of compilation warnings * Add the -Wall compilation flag * Use rl_ding() instead of undeclared ding() (user: quentin@minster.io, tags: trunk, origin/devel)
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified tclreadlineCompleter.tcl from [1ea8a61e03] to [b445227807].

more than 10,000 changes

Modified tclreadlineInit.tcl.in from [554b1c74c7] to [339306884c].

    11     11   
    12     12   namespace eval tclreadline:: {
    13     13       namespace export Init
    14     14   }
    15     15   
    16     16   proc ::tclreadline::Init {} {
    17     17       uplevel #0 {
    18         -    if ![info exists tclreadline::library] {
    19         -        if [catch {load [file join @TCLRL_LIBDIR@ libtclreadline[info sharedlibextension]]} msg] {
    20         -        puts stderr $msg
    21         -        exit 2
           18  +        if {![info exists tclreadline::library]} {
           19  +            if {[catch {load [file join @TCLRL_LIBDIR@ libtclreadline[info sharedlibextension]]} msg]} {
           20  +                puts stderr $msg
           21  +                exit 2
           22  +            }
    22     23           }
    23         -    }
    24     24       }
    25     25   }
    26     26   
    27     27   tclreadline::Init
    28     28   ::tclreadline::readline customcompleter ::tclreadline::ScriptCompleter
    29     29   
    30     30   source [file join [file dirname [info script]] tclreadlineSetup.tcl]
    31     31   
    32     32   set auto_index(::tclreadline::ScriptCompleter) \
    33         -[list source [file join [file dirname [info script]] tclreadlineCompleter.tcl]]
           33  +    [list source [file join [file dirname [info script]] tclreadlineCompleter.tcl]]

Modified tclreadlineSetup.tcl.in from [601cc4d255] to [3c98c4bea3].

    18     18       # Save the values of errorCode and errorInfo variables, since they
    19     19       # may get modified if caught errors occur below.  The variables will
    20     20       # be restored just before re-executing the missing command.
    21     21   
    22     22       set savedErrorCode $errorCode
    23     23       set savedErrorInfo $errorInfo
    24     24       set name [lindex $args 0]
    25         -    if ![info exists auto_noload] {
    26         -    #
    27         -    # Make sure we're not trying to load the same proc twice.
    28         -    #
    29         -    if [info exists unknown_pending($name)] {
    30         -        return -code error "self-referential recursion in \"unknown\" for command \"$name\""
    31         -    }
    32         -    set unknown_pending($name) pending
    33         -    set ret [catch {auto_load $name [uplevel 1 {namespace current}]} msg]
    34         -    unset unknown_pending($name)
    35         -    if {$ret != 0} {
    36         -        return -code $ret -errorcode $errorCode \
    37         -        "error while autoloading \"$name\": $msg"
    38         -    }
    39         -    if ![array size unknown_pending] {
    40         -        unset unknown_pending
    41         -    }
    42         -    if $msg {
    43         -        set errorCode $savedErrorCode
    44         -        set errorInfo $savedErrorInfo
    45         -        set code [catch {uplevel 1 $args} msg]
    46         -        if {$code ==  1} {
           25  +    if {![info exists auto_noload]} {
           26  +        #
           27  +        # Make sure we're not trying to load the same proc twice.
    47     28           #
    48         -        # Strip the last five lines off the error stack (they're
    49         -            # from the "uplevel" command).
    50         -        #
           29  +        if {[info exists unknown_pending($name)]} {
           30  +            return -code error "self-referential recursion in \"unknown\" for command \"$name\""
           31  +        }
           32  +        set unknown_pending($name) pending
           33  +        set ret [catch {auto_load $name [uplevel 1 {namespace current}]} msg]
           34  +        unset unknown_pending($name)
           35  +        if {$ret != 0} {
           36  +            return -code $ret -errorcode $errorCode "error while autoloading \"$name\": $msg"
           37  +        }
           38  +        if {![array size unknown_pending]} {
           39  +            unset unknown_pending
           40  +        }
           41  +        if {$msg} {
           42  +            set errorCode $savedErrorCode
           43  +            set errorInfo $savedErrorInfo
           44  +            set code [catch {uplevel 1 $args} msg]
           45  +            if {$code == 1} {
           46  +                #
           47  +                # Strip the last five lines off the error stack (they're
           48  +                # from the "uplevel" command).
           49  +                #
    51     50   
    52         -        set new [split $errorInfo \n]
    53         -        set new [join [lrange $new 0 [expr [llength $new] - 6]] \n]
    54         -        return -code error -errorcode $errorCode \
    55         -        -errorinfo $new $msg
    56         -        } else {
    57         -        return -code $code $msg
           51  +                set new [split $errorInfo \n]
           52  +                set new [join [lrange $new 0 [expr {[llength $new] - 6}]] \n]
           53  +                return -code error -errorcode $errorCode -errorinfo $new $msg
           54  +            } else {
           55  +                return -code $code $msg
           56  +            }
    58     57           }
    59     58       }
    60         -    }
    61     59   
    62         -    # REMOVED THE [info script] TEST (joze, SEP 98)
    63     60       if {([info level] == 1) && [info exists tcl_interactive] && $tcl_interactive} {
    64         -    if ![info exists auto_noexec] {
           61  +    if {![info exists auto_noexec]} {
    65     62           set new [auto_execok $name]
    66     63           if {$new != ""} {
    67         -        set errorCode $savedErrorCode
    68         -        set errorInfo $savedErrorInfo
    69         -        set redir ""
    70         -        if {[info commands console] == ""} {
    71         -            set redir ">&@stdout <@stdin"
    72         -        }
    73         -        # LOOK FOR GLOB STUFF IN $ARGS (joze, SEP 98)
    74         -        return [uplevel eval exec $redir $new \
    75         -        [::tclreadline::Glob [lrange $args 1 end]]]
           64  +            set errorCode $savedErrorCode
           65  +            set errorInfo $savedErrorInfo
           66  +            set redir ""
           67  +            if {[info commands console] == ""} {
           68  +                set redir ">&@stdout <@stdin"
           69  +            }
           70  +            # look for glob stuff in $args
           71  +            return [uplevel eval exec $redir $new [::tclreadline::Glob [lrange $args 1 end]]]
    76     72           }
    77     73       }
    78     74       set errorCode $savedErrorCode
    79     75       set errorInfo $savedErrorInfo
    80     76       if {$name == "!!"} {
    81     77           set newcmd [history event]
    82     78       } elseif {[regexp {^!(.+)$} $name dummy event]} {
    83     79           set newcmd [history event $event]
    84     80       } elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $name dummy old new]} {
    85     81           set newcmd [history event -1]
    86     82           catch {regsub -all -- $old $newcmd $new newcmd}
    87     83       }
    88         -    if [info exists newcmd] {
           84  +    if {[info exists newcmd]} {
    89     85           tclLog $newcmd
    90     86           history change $newcmd 0
    91     87           return [uplevel $newcmd]
    92     88       }
    93     89   
    94     90       set ret [catch {set cmds [info commands $name*]} msg]
    95     91       if {[string compare $name "::"] == 0} {
    96     92           set name ""
    97     93       }
    98     94       if {$ret != 0} {
    99     95           return -code $ret -errorcode $errorCode \
   100         -        "error in unknown while checking if \"$name\" is a unique command abbreviation: $msg"
           96  +            "error in unknown while checking if \"$name\" is a unique command abbreviation: $msg"
   101     97       }
   102     98       if {[llength $cmds] == 1} {
   103     99           return [uplevel [lreplace $args 0 0 $cmds]]
   104    100       }
   105    101       if {[llength $cmds] != 0} {
   106    102           if {$name == ""} {
   107         -        return -code error "empty command name \"\""
          103  +            return -code error "empty command name \"\""
   108    104           } else {
   109         -        return -code error \
   110         -        "ambiguous command name \"$name\": [lsort $cmds]"
          105  +            return -code error "ambiguous command name \"$name\": [lsort $cmds]"
   111    106           }
   112    107       }
   113    108       }
   114    109       return -code error "invalid command name \"$name\""
   115    110   }
          111  +
   116    112   
   117    113   namespace eval tclreadline {
   118    114   
   119         -namespace export Setup Loop InitTclCmds InitTkCmds Print ls
          115  +    namespace export Setup Loop InitTclCmds InitTkCmds Print ls
   120    116   
   121         -proc ls {args} {
   122         -    if {[exec uname -s] == "Linux"} {
   123         -        eval exec ls --color -FC [Glob $args]
   124         -    } else {
   125         -        eval exec ls -FC [Glob $args]
   126         -    }
   127         -}
   128         -
   129         -proc Setup {args} {
   130         -
   131         -    uplevel #0 {
   132         -
   133         -    if {"" == [info commands ::tclreadline::readline]} {
   134         -        ::tclreadline::Init
          117  +    proc ls {args} {
          118  +        if {[exec uname -s] == "Linux"} {
          119  +            eval exec ls --color -FC [Glob $args]
          120  +        } else {
          121  +            eval exec ls -FC [Glob $args]
          122  +        }
   135    123       }
   136    124   
   137         -    if {"" == [info procs ::tclreadline::prompt1] && [info nameofexecutable] != ""} {
   138         -
   139         -        namespace eval ::tclreadline {
   140         -        variable prompt_string
   141         -        set base [file tail [info nameofexecutable]]
   142         -
   143         -        if {[string match tclsh* $base] && [info exists tcl_version]} {
   144         -            set prompt_string \
   145         -            "\[0;31mtclsh$tcl_version\[0m"
   146         -        } elseif {[string match wish* $base] \
   147         -            && [info exists tk_version]} {
   148         -            set prompt_string "\[0;34mwish$tk_version\[0m"
   149         -            } else {
   150         -            set prompt_string "\[0;31m$base\[0m"
          125  +    proc Setup {args} {
          126  +
          127  +        uplevel #0 {
          128  +
          129  +            if {"" == [info commands ::tclreadline::readline]} {
          130  +                ::tclreadline::Init
          131  +            }
          132  +
          133  +            if {"" == [info procs ::tclreadline::prompt1] && [info nameofexecutable] != ""} {
          134  +
          135  +                namespace eval ::tclreadline {
          136  +                    variable prompt_string
          137  +                    set base [file tail [info nameofexecutable]]
          138  +
          139  +                    if {[string match tclsh* $base] && [info exists tcl_version]} {
          140  +                        set prompt_string "\[0;31mtclsh$tcl_version\[0m"
          141  +                    } elseif {[string match wish* $base] && [info exists tk_version]} {
          142  +                        set prompt_string "\[0;34mwish$tk_version\[0m"
          143  +                    } else {
          144  +                        set prompt_string "\[0;31m$base\[0m"
          145  +                    }
          146  +
          147  +                }
          148  +
          149  +                if {"" == [info procs ::tclreadline::prompt1]} {
          150  +                    proc ::tclreadline::prompt1 {} {
          151  +                        variable prompt_string
          152  +                        global env
          153  +                        if {[catch {set pwd [pwd]} tmp]} {
          154  +                            set pwd "unable to get pwd"
          155  +                        }
          156  +
          157  +                        if [info exists env(HOME)] {
          158  +                            regsub $env(HOME) $pwd "~" pwd
          159  +                        }
          160  +                        return "$prompt_string \[$pwd\] "
          161  +                    }
          162  +                }
          163  +            }
          164  +
          165  +            if {"" == [info procs ::tclreadline::prompt2] && [info nameofexecutable] != ""} {
          166  +
          167  +                if {"" == [info procs ::tclreadline::prompt2]} {
          168  +                    proc ::tclreadline::prompt2 {} {
          169  +                        return "> "
          170  +                    }
          171  +                }
          172  +            }
          173  +
          174  +            if {"" == [info procs exit]} {
          175  +
          176  +                catch {rename ::tclreadline::Exit ""}
          177  +                rename exit ::tclreadline::Exit
          178  +
          179  +                proc exit {args} {
          180  +
          181  +                    if {[catch {::tclreadline::readline write [::tclreadline::HistoryFileGet]} \
          182  +                             ::tclreadline::errorMsg]} {
          183  +                        puts stderr $::tclreadline::errorMsg
          184  +                    }
          185  +
          186  +                    # this call is ignored, if tclreadline.c
          187  +                    # was compiled with CLEANUP_AFER_SIGNAL
          188  +                    # not defined. This is the case for
          189  +                    # older versions of libreadline.
          190  +                    #
          191  +                    ::tclreadline::readline reset-terminal
          192  +
          193  +                    if {[catch "eval ::tclreadline::Exit $args" message]} {
          194  +                        puts stderr "error:"
          195  +                        puts stderr "$message"
          196  +                    }
          197  +                    # NOTREACHED
          198  +                }
   151    199               }
   152    200   
   153    201           }
   154    202   
   155         -        if {"" == [info procs ::tclreadline::prompt1]} {
   156         -        proc ::tclreadline::prompt1 {} {
   157         -            variable prompt_string
   158         -            global env
   159         -            if {[catch {set pwd [pwd]} tmp]} {
   160         -            set pwd "unable to get pwd"
          203  +        global env
          204  +        variable historyfile
          205  +
          206  +        if {[string trim [llength $args]]} {
          207  +            set historyfile ""
          208  +            catch {set historyfile [file nativename [lindex $args 0]]}
          209  +            if {"" == [string trim $historyfile]} {
          210  +                set historyfile [lindex $args 0]
   161    211               }
   162         -
   163         -            if [info exists env(HOME)] {
   164         -            regsub $env(HOME) $pwd "~" pwd
          212  +        } else {
          213  +            if {[info exists env(HOME)]} {
          214  +                set historyfile $env(HOME)/.tclsh-history
          215  +            } else {
          216  +                set historyfile .tclsh-history
   165    217               }
   166         -            return "$prompt_string \[$pwd\]"
   167    218           }
   168         -        }
   169         -        # puts body=[info body ::tclreadline::prompt1]
   170         -    }
   171         -
   172         -    if {"" == [info procs ::tclreadline::prompt2] && [info nameofexecutable] != ""} {
   173         -
   174         -        if {"" == [info procs ::tclreadline::prompt2]} {
   175         -        proc ::tclreadline::prompt2 {} {
   176         -            return ">"
   177         -        }
   178         -        }
   179         -        # puts body=[info body ::tclreadline::prompt2]
   180         -    }
   181         -
   182         -    if {"" == [info procs exit]} {
   183         -
   184         -        catch {rename ::tclreadline::Exit ""}
   185         -        rename exit ::tclreadline::Exit
   186         -
   187         -        proc exit {args} {
   188         -
   189         -        if {[catch {
   190         -            ::tclreadline::readline write \
   191         -            [::tclreadline::HistoryFileGet]
   192         -        } ::tclreadline::errorMsg]} {
          219  +        set ::tclreadline::errorMsg [readline initialize $historyfile]
          220  +        if {$::tclreadline::errorMsg != ""} {
   193    221               puts stderr $::tclreadline::errorMsg
   194    222           }
   195    223   
   196         -        # this call is ignored, if tclreadline.c
   197         -        # was compiled with CLEANUP_AFER_SIGNAL
   198         -        # not defined. This is the case for
   199         -        # older versions of libreadline.
   200         -        #
   201         -        ::tclreadline::readline reset-terminal
          224  +        # InitCmds
   202    225   
   203         -        if [catch "eval ::tclreadline::Exit $args" message] {
   204         -            puts stderr "error:"
   205         -            puts stderr "$message"
   206         -        }
   207         -        # NOTREACHED
   208         -        }
          226  +        rename Setup ""
          227  +    }
          228  +
          229  +    proc HistoryFileGet {} {
          230  +        variable historyfile
          231  +        return $historyfile
   209    232       }
   210    233   
   211         -    }
          234  +    # obsolete
          235  +    #
          236  +    proc Glob {string} {
   212    237   
   213         -    global env
   214         -    variable historyfile
   215         -
   216         -    if {[string trim [llength ${args}]]} {
   217         -    set historyfile ""
   218         -    catch {
   219         -        set historyfile [file nativename [lindex ${args} 0]]
   220         -    }
   221         -    if {"" == [string trim $historyfile]} {
   222         -        set historyfile [lindex ${args} 0]
   223         -    }
   224         -    } else {
   225         -    if [info exists env(HOME)] {
   226         -        set historyfile  $env(HOME)/.tclsh-history
   227         -    } else {
   228         -        set historyfile  .tclsh-history
   229         -    }
   230         -    }
   231         -    set ::tclreadline::errorMsg [readline initialize $historyfile]
   232         -    if {$::tclreadline::errorMsg != ""} {
   233         -    puts stderr $::tclreadline::errorMsg
          238  +        set commandstring ""
          239  +        foreach name $string {
          240  +            set replace [glob -nocomplain -- $name]
          241  +            if {$replace == ""} {
          242  +                lappend commandstring $name
          243  +            } else {
          244  +                lappend commandstring $replace
          245  +            }
          246  +        }
          247  +        # return $commandstring
          248  +        # Christian Krone <krischan@sql.de> proposed
          249  +        return [eval concat $commandstring]
   234    250       }
   235    251   
   236         -    # InitCmds
          252  +
          253  +    proc Loop {args} {
          254  +
          255  +        eval Setup ${args}
   237    256   
   238         -    rename Setup ""
   239         -}
          257  +        uplevel #0 {
   240    258   
   241         -proc HistoryFileGet {} {
   242         -    variable historyfile
   243         -    return $historyfile
   244         -}
          259  +            while {1} {
   245    260   
   246         -# obsolete
   247         -#
   248         -proc Glob {string} {
          261  +                if {[catch {
          262  +                    set prompt "% "
          263  +                    if {"" != [info procs ::tclreadline::prompt1]} {
          264  +                        set prompt [::tclreadline::prompt1]
          265  +                    }
          266  +                    set ::tclreadline::LINE [::tclreadline::readline read $prompt]
          267  +                    while {![::tclreadline::readline complete $::tclreadline::LINE]} {
          268  +                        append ::tclreadline::LINE "\n"
          269  +                        set prompt2 "> "
          270  +                        if {"" != [info procs ::tclreadline::prompt2]} {
          271  +                            set prompt2 [::tclreadline::prompt2]
          272  +                        }
          273  +                        append ::tclreadline::LINE [tclreadline::readline read $prompt2]
          274  +                    }
          275  +                } ::tclreadline::errorMsg]} {
          276  +                    puts stderr "tclreadline::Loop: error. $::tclreadline::errorMsg"
          277  +                    continue
          278  +                }
   249    279   
   250         -    set commandstring ""
   251         -    foreach name $string {
   252         -    set replace [glob -nocomplain -- $name]
   253         -    if {$replace == ""} {
   254         -        lappend commandstring $name
   255         -    } else {
   256         -        lappend commandstring $replace
   257         -    }
   258         -    }
   259         -    # return $commandstring
   260         -    # Christian Krone <krischan@sql.de> proposed
   261         -    return [eval concat $commandstring]
   262         -}
          280  +                # Magnus Eriksson <magnus.eriksson@netinsight.se> proposed
          281  +                # to add the line also to tclsh's history.
          282  +                #
          283  +                # I decided to add only lines which are different from
          284  +                # the previous one to the history. This is different
          285  +                # from tcsh's behaviour, but I found it quite convenient
          286  +                # while using mshell on os9.
          287  +                #
          288  +                if {[string length $::tclreadline::LINE]
          289  +                        && [history event 0] != $::tclreadline::LINE} {
          290  +                    history add $::tclreadline::LINE
          291  +                }
   263    292   
          293  +                if {[catch {
          294  +                    set ::tclreadline::result [eval $::tclreadline::LINE]
          295  +                    if {$::tclreadline::result != "" && [tclreadline::Print]} {
          296  +                        puts $::tclreadline::result
          297  +                    }
          298  +                    set ::tclreadline::result ""
          299  +                } ::tclreadline::errorMsg]} {
          300  +                    puts stderr $::tclreadline::errorMsg
          301  +                    puts stderr "while evaluating $::tclreadline::LINE"
          302  +                }
   264    303   
   265         -
   266         -proc Loop {args} {
   267         -
   268         -    eval Setup ${args}
   269         -
   270         -    uplevel #0 {
   271         -
   272         -    while {1} {
   273         -
   274         -        if {[catch {
   275         -        if {"" != [namespace eval ::tclreadline {info procs prompt1}]} {
   276         -            set ::tclreadline::LINE [::tclreadline::readline read \
   277         -            [::tclreadline::prompt1]]
   278         -        } else {
   279         -            set ::tclreadline::LINE [::tclreadline::readline read %]
   280         -        }
   281         -        while {![::tclreadline::readline complete $::tclreadline::LINE]} {
   282         -            append ::tclreadline::LINE "\n"
   283         -            if {"" != [namespace eval ::tclreadline {info procs prompt2}]} {
   284         -            append ::tclreadline::LINE \
   285         -                [tclreadline::readline read [::tclreadline::prompt2]]
   286         -            } else {
   287         -            append ::tclreadline::LINE [tclreadline::readline read >]
   288    304               }
   289    305           }
   290         -        } ::tclreadline::errorMsg]} {
   291         -        puts stderr [list tclreadline::Loop: error. \
   292         -        $::tclreadline::errorMsg]
   293         -        continue
   294         -        }
          306  +    }
   295    307   
   296         -        # Magnus Eriksson <magnus.eriksson@netinsight.se> proposed
   297         -        # to add the line also to tclsh's history.
   298         -        #
   299         -        # I decided to add only lines which are different from
   300         -        # the previous one to the history. This is different
   301         -        # from tcsh's behaviour, but I found it quite convenient
   302         -        # while using mshell on os9.
   303         -        #
   304         -        if {[string length $::tclreadline::LINE] && \
   305         -            [history event 0] != $::tclreadline::LINE} {
   306         -        history add $::tclreadline::LINE
          308  +    proc Print {args} {
          309  +        variable PRINT
          310  +        if {![info exists PRINT]} {
          311  +            set PRINT yes
          312  +        }
          313  +        if [regexp -nocase \(true\|yes\|1\) $args] {
          314  +            set PRINT yes
          315  +        } elseif [regexp -nocase \(false\|no\|0\) $args] {
          316  +            set PRINT no
   307    317           }
          318  +        return $PRINT
          319  +    }
          320  +
   308    321   
   309         -        if [catch {
   310         -        set ::tclreadline::result [eval $::tclreadline::LINE]
   311         -        if {$::tclreadline::result != "" && [tclreadline::Print]} {
   312         -            puts $::tclreadline::result
   313         -        }
   314         -        set ::tclreadline::result ""
   315         -        } ::tclreadline::errorMsg] {
   316         -        puts stderr $::tclreadline::errorMsg
   317         -        puts stderr [list while evaluating $::tclreadline::LINE]
   318         -        }
   319         -
   320         -    }
   321         -    }
   322         -}
   323         -
   324         -proc Print {args} {
   325         -    variable PRINT
   326         -    if ![info exists PRINT] {
   327         -    set PRINT yes
   328         -    }
   329         -    if [regexp -nocase \(true\|yes\|1\) $args] {
   330         -    set PRINT yes
   331         -    } elseif [regexp -nocase \(false\|no\|0\) $args] {
   332         -    set PRINT no
   333         -    }
   334         -    return $PRINT
   335         -}
          322  +#    proc InitCmds {} {
          323  +#        # XXX
          324  +#        return
          325  +#        # XXX
          326  +#        global tcl_version tk_version
          327  +#        if {[info exists tcl_version]} {
          328  +#            InitTclCmds
          329  +#        }
          330  +#        if {[info exists tk_version]} {
          331  +#            InitTkCmds
          332  +#        }
          333  +#        rename InitCmds ""
          334  +#    }
   336    335   #
   337         -#
   338         -# proc InitCmds {} {
   339         -#     # XXX
   340         -#     return
   341         -#     # XXX
   342         -#     global tcl_version tk_version
   343         -#     if {[info exists tcl_version]} {
   344         -#         InitTclCmds
   345         -#     }
   346         -#     if {[info exists tk_version]} {
   347         -#         InitTkCmds
   348         -#     }
   349         -#     rename InitCmds ""
   350         -# }
          336  +#    proc InitTclCmds {} {
          337  +#        variable known_cmds
          338  +#        foreach line {
          339  +#            "after option ?arg arg ...?"
          340  +#            "append varName ?value value ...?"
          341  +#            "array option arrayName ?arg ...?"
          342  +#            "bgerror"
          343  +#            "break"
          344  +#            "catch command ?varName?"
          345  +#            "cd"
          346  +#            "clock"
          347  +#            "close <channelId>"
          348  +#            "concat"
          349  +#            "continue"
          350  +#            "eof <channelId>"
          351  +#            "error message ?errorInfo? ?errorCode?"
          352  +#            "eval arg ?arg ...?"
          353  +#            "exec ?switches? arg ?arg ...?"
          354  +#            "exit ?returnCode?"
          355  +#            "fblocked <channelId>"
          356  +#            "for start test next command"
          357  +#            "foreach varList list ?varList list ...? command"
          358  +#            "format formatString ?arg arg ...?"
          359  +#            "gets channelId ?varName?"
          360  +#            "glob"
          361  +#            "global varName ?varName ...?"
          362  +#            "incr varName ?increment?"
          363  +#            "info option ?arg arg ...?"
          364  +#            "interp cmd ?arg ...?"
          365  +#            "join list ?joinString?"
          366  +#            "lappend varName ?value value ...?"
          367  +#            "lindex list index"
          368  +#            "linsert list <index> <element> ?element ...?"
          369  +#            "list"
          370  +#            "llength list"
          371  +#            "lrange list first last"
          372  +#            "lreplace list first last ?element element ...?"
          373  +#            "lsearch ?mode? list pattern"
          374  +#            "lsort ?options? list"
          375  +#            "namespace"
          376  +#            "package option ?arg arg ...?"
          377  +#            "proc name args body"
          378  +#            "read ?-nonewline? channelId"
          379  +#            "regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?"
          380  +#            "rename oldName newName"
          381  +#            "scan <string> <format> ?varName varName ...?"
          382  +#            "set varName ?newValue?"
          383  +#            "split <string> ?splitChars?"
          384  +#            "subst ?-nobackslashes? ?-nocommands? ?-novariables? string"
          385  +#            "switch ?switches? string pattern body ... ?default body?"
          386  +#            "time <command> ?count?"
          387  +#            "unknown <cmdName> ?arg? ?...?"
          388  +#            "uplevel ?level? command ?arg ...?"
          389  +#            "vwait name"
          390  +#            "while test command"
          391  +#        } {
          392  +#            readline add $line
          393  +#            set known_cmds([lindex $line 0]) ${line}
          394  +#        }
          395  +#        rename InitTclCmds ""
          396  +#    }
   351    397   #
   352         -# proc InitTclCmds {} {
   353         -#     variable known_cmds
   354         -#     foreach line {
   355         -#         "after option ?arg arg ...?"
   356         -#         "append varName ?value value ...?"
   357         -#         "array option arrayName ?arg ...?"
   358         -#         "bgerror"
   359         -#         "break"
   360         -#         "catch command ?varName?"
   361         -#         "cd"
   362         -#         "clock"
   363         -#         "close <channelId>"
   364         -#         "concat"
   365         -#         "continue"
   366         -#         "eof <channelId>"
   367         -#         "error message ?errorInfo? ?errorCode?"
   368         -#         "eval arg ?arg ...?"
   369         -#         "exec ?switches? arg ?arg ...?"
   370         -#         "exit ?returnCode?"
   371         -#         "fblocked <channelId>"
   372         -#         "for start test next command"
   373         -#         "foreach varList list ?varList list ...? command"
   374         -#         "format formatString ?arg arg ...?"
   375         -#         "gets channelId ?varName?"
   376         -#         "glob"
   377         -#         "global varName ?varName ...?"
   378         -#         "incr varName ?increment?"
   379         -#         "info option ?arg arg ...?"
   380         -#         "interp cmd ?arg ...?"
   381         -#         "join list ?joinString?"
   382         -#         "lappend varName ?value value ...?"
   383         -#         "lindex list index"
   384         -#         "linsert list <index> <element> ?element ...?"
   385         -#         "list"
   386         -#         "llength list"
   387         -#         "lrange list first last"
   388         -#         "lreplace list first last ?element element ...?"
   389         -#         "lsearch ?mode? list pattern"
   390         -#         "lsort ?options? list"
   391         -#         "namespace"
   392         -#         "package option ?arg arg ...?"
   393         -#         "proc name args body"
   394         -#         "read ?-nonewline? channelId"
   395         -#         "regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?"
   396         -#         "rename oldName newName"
   397         -#         "scan <string> <format> ?varName varName ...?"
   398         -#         "set varName ?newValue?"
   399         -#         "split <string> ?splitChars?"
   400         -#         "subst ?-nobackslashes? ?-nocommands? ?-novariables? string"
   401         -#         "switch ?switches? string pattern body ... ?default body?"
   402         -#         "time <command> ?count?"
   403         -#         "unknown <cmdName> ?arg? ?...?"
   404         -#         "uplevel ?level? command ?arg ...?"
   405         -#         "vwait name"
   406         -#         "while test command"
   407         -#     } {
   408         -#         readline add $line
   409         -#         set known_cmds([lindex $line 0]) ${line}
   410         -#     }
   411         -#     rename InitTclCmds ""
   412         -# }
   413         -#
   414         -# proc InitTkCmds {} {
   415         -#     variable known_cmds
   416         -#     foreach line {
   417         -#         "bind window ?pattern? ?command?"
   418         -#         "bindtags window ?tags?"
   419         -#         "button pathName ?options?"
   420         -#         "canvas pathName ?options?"
   421         -#         "checkbutton pathName ?options?"
   422         -#         "clipboard option ?arg arg ...?"
   423         -#         "entry pathName ?options?"
   424         -#         "event option ?arg1?"
   425         -#         "font option ?arg?"
   426         -#         "frame pathName ?options?"
   427         -#         "grab option ?arg arg ...?"
   428         -#         "grid option arg ?arg ...?"
   429         -#         "image option ?args?"
   430         -#         "label pathName ?options?"
   431         -#         "listbox pathName ?options?"
   432         -#         "lower window ?belowThis?"
   433         -#         "menu pathName ?options?"
   434         -#         "menubutton pathName ?options?"
   435         -#         "message pathName ?options?"
   436         -#         "option cmd arg ?arg ...?"
   437         -#         "pack option arg ?arg ...?"
   438         -#         "radiobutton pathName ?options?"
   439         -#         "raise window ?aboveThis?"
   440         -#         "scale pathName ?options?"
   441         -#         "scrollbar pathName ?options?"
   442         -#         "selection option ?arg arg ...?"
   443         -#         "send ?options? interpName arg ?arg ...?"
   444         -#         "text pathName ?options?"
   445         -#         "tk option ?arg?"
   446         -#         "tkwait variable|visibility|window name"
   447         -#         "toplevel pathName ?options?"
   448         -#         "winfo option ?arg?"
   449         -#         "wm option window ?arg ...?"
   450         -#     } {
   451         -#         readline add $line
   452         -#         set known_cmds([lindex $line 0]) ${line}
   453         -#     }
   454         -#     rename InitTkCmds ""
   455         -# }
   456         -#
          398  +#    proc InitTkCmds {} {
          399  +#        variable known_cmds
          400  +#        foreach line {
          401  +#            "bind window ?pattern? ?command?"
          402  +#            "bindtags window ?tags?"
          403  +#            "button pathName ?options?"
          404  +#            "canvas pathName ?options?"
          405  +#            "checkbutton pathName ?options?"
          406  +#            "clipboard option ?arg arg ...?"
          407  +#            "entry pathName ?options?"
          408  +#            "event option ?arg1?"
          409  +#            "font option ?arg?"
          410  +#            "frame pathName ?options?"
          411  +#            "grab option ?arg arg ...?"
          412  +#            "grid option arg ?arg ...?"
          413  +#            "image option ?args?"
          414  +#            "label pathName ?options?"
          415  +#            "listbox pathName ?options?"
          416  +#            "lower window ?belowThis?"
          417  +#            "menu pathName ?options?"
          418  +#            "menubutton pathName ?options?"
          419  +#            "message pathName ?options?"
          420  +#            "option cmd arg ?arg ...?"
          421  +#            "pack option arg ?arg ...?"
          422  +#            "radiobutton pathName ?options?"
          423  +#            "raise window ?aboveThis?"
          424  +#            "scale pathName ?options?"
          425  +#            "scrollbar pathName ?options?"
          426  +#            "selection option ?arg arg ...?"
          427  +#            "send ?options? interpName arg ?arg ...?"
          428  +#            "text pathName ?options?"
          429  +#            "tk option ?arg?"
          430  +#            "tkwait variable|visibility|window name"
          431  +#            "toplevel pathName ?options?"
          432  +#            "winfo option ?arg?"
          433  +#            "wm option window ?arg ...?"
          434  +#        } {
          435  +#            readline add $line
          436  +#            set known_cmds([lindex $line 0]) ${line}
          437  +#        }
          438  +#        rename InitTkCmds ""
          439  +#    }
   457    440   
   458    441   
   459    442   }; # namespace tclreadline