tcl-hacks

Check-in [0f12101f26]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:put some utils where they belong
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0f12101f26daa20a662e84b890d7e66e94a42223
User & Date: aspect 2018-05-15 10:05:32
Context
2018-05-15
10:20
a bit of tidy check-in: d67dd249f2 user: aspect tags: trunk
10:05
put some utils where they belong check-in: 0f12101f26 user: aspect tags: trunk
09:39
make all instances belong to Getline, support -options in constructor check-in: 79692df96b user: aspect tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to getline/getline.tcl.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#  - incrementally fix up lines
source input.tcl
source output.tcl
source keymap.tcl
source history.tcl
source util.tcl     ;# ssplit

proc putl args {puts $args}
proc finally args {
    set ns [uplevel 1 {namespace current}]
    tailcall trace add variable :#\; unset [list apply [list args $args $ns]]
}
proc alias {alias cmd args} {
    set ns [uplevel 1 {namespace current}]
    set cmd [uplevel 1 namespace which $cmd]
    interp alias ${ns}::$alias $cmd {*}$args
}

proc rep {c} {
    if {[string length $c] != 1} {error "Bad input: [binary encode hex $c]"}
    if {[string is print $c]} {return $c}
    return "\\x[binary encode hex $c]"
}

proc srep {s} {







<
<
<
<
<
<
<
<
<
<
<







34
35
36
37
38
39
40











41
42
43
44
45
46
47
#  - incrementally fix up lines
source input.tcl
source output.tcl
source keymap.tcl
source history.tcl
source util.tcl     ;# ssplit












proc rep {c} {
    if {[string length $c] != 1} {error "Bad input: [binary encode hex $c]"}
    if {[string is print $c]} {return $c}
    return "\\x[binary encode hex $c]"
}

proc srep {s} {

Changes to getline/util.tcl.













1
2
3
4
5
6
7













proc sum ls {::tcl::mathop::+ {*}$ls}

proc sreplace {str i j {new ""}} {
    # handle indices
    set end [expr {1 + [string length $str]}]
    regsub end $i $end i
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
proc putl args {puts $args}

proc finally args {
    set ns [uplevel 1 {namespace current}]
    tailcall trace add variable :#\; unset [list apply [list args $args $ns]]
}

proc alias {alias cmd args} {
    set ns [uplevel 1 {namespace current}]
    set cmd [uplevel 1 namespace which $cmd]
    interp alias ${ns}::$alias $cmd {*}$args
}

proc sum ls {::tcl::mathop::+ {*}$ls}

proc sreplace {str i j {new ""}} {
    # handle indices
    set end [expr {1 + [string length $str]}]
    regsub end $i $end i