Tk Library Source Code
Check-in [08d61afec4]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

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

Overview
Comment:Updated sak code to the latest from tcllib.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tklib-0-6-rc
Files: files | file ages | folders
SHA1:08d61afec429122aac8ed1ac5e4ad05c0e6b61a5
User & Date: andreask 2013-03-11 20:41:41
Context
2013-03-11
20:47
Version fixes check-in: 303f6a8aa4 user: andreask tags: tklib-0-6-rc
20:41
Updated sak code to the latest from tcllib. check-in: 08d61afec4 user: andreask tags: tklib-0-6-rc
20:33
Fixed old urls in various locations, added meta files to repository to make checkout like distribution. check-in: 8d8e05c279 user: andreask tags: tklib-0-6-rc
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to support/devel/sak/doc/doc.tcl.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
68
69
70
71
72
73
74
75
76



77
78
79
80
81
82
83
    auto::saveManpages $manpages

    # Then scan the found pages and extract the information needed for
    # keyword index and table of contents.
    array set meta [auto::scanManpages $manpages]

    # Sort through the extracted data.
    array set kwic  {}
    array set title {}
    array set cat   {}
    array set name  {}
    set       apps  {}
    array set mods  {}

    foreach page [array names meta] {
	unset -nocomplain m
	array set m $meta($page)

	# Collect keywords and file mapping for index.
	foreach kw $m(keywords) {
................................................................................
    #parray kwic
    #parray title
    #parray name
    #parray cat
    #puts "apps = $apps"
    #parray mods

    auto::saveKeywordIndex    kwic  name
    auto::saveTableOfContents title name cat apps mods



    return
}

proc ::sak::doc::imake {modules} {
    global base
    # The argument (= set of modules) is irrelevant to this command.
    auto::saveManpages [auto::findManpages $base]







|
|
|
|
|
|







 







|
|
>
>
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
    auto::saveManpages $manpages

    # Then scan the found pages and extract the information needed for
    # keyword index and table of contents.
    array set meta [auto::scanManpages $manpages]

    # Sort through the extracted data.
    array set kwic  {} ; # map: keyword  -> list (file...)
    array set title {} ; # map: file     -> description
    array set cat   {} ; # map: category -> list (file...)
    array set name  {} ; # map: file     -> label
    set       apps  {} ; # list (file...) 
    array set mods  {} ; # map: module   -> list(file...)

    foreach page [array names meta] {
	unset -nocomplain m
	array set m $meta($page)

	# Collect keywords and file mapping for index.
	foreach kw $m(keywords) {
................................................................................
    #parray kwic
    #parray title
    #parray name
    #parray cat
    #puts "apps = $apps"
    #parray mods

    auto::saveKeywordIndex           kwic  name
    auto::saveTableOfContents        title name cat apps mods
    auto::saveSimpleTableOfContents1 title name apps toc_apps.txt
    auto::saveSimpleTableOfContents2 title name mods toc_mods.txt
    auto::saveSimpleTableOfContents3 title name cat  toc_cats.txt
    return
}

proc ::sak::doc::imake {modules} {
    global base
    # The argument (= set of modules) is irrelevant to this command.
    auto::saveManpages [auto::findManpages $base]

Changes to support/devel/sak/doc/doc_auto.tcl.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
...
158
159
160
161
162
163
164
























































































165
166
167
168
169
170
171
}

proc ::sak::doc::auto::kwic {} {
    variable here
    return [file join $here kwic.txt]
}

proc ::sak::doc::auto::toc {} {
    variable here
    return [file join $here toc.txt]
}

## ### ### ### ######### ######### #########

proc ::sak::doc::auto::findManpages {base} {
    set top [file normalize $base]
    set manpages {}
................................................................................
    Tag+ division_end
    Tag+ division_end
    Tag+ toc_end

    fileutil::writeFile [toc] [join $lines \n]
    return
}

























































































proc ::sak::doc::auto::Sortable {files nv mfv mnv} {
    upvar 1 $nv name $mfv maxf $mnv maxn
    # Generate a list of files sortable by name, and also find the
    # max length of all relevant names.
    set maxf 0
    set maxn 0







|

|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
...
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
}

proc ::sak::doc::auto::kwic {} {
    variable here
    return [file join $here kwic.txt]
}

proc ::sak::doc::auto::toc {{name toc.txt}} {
    variable here
    return [file join $here $name]
}

## ### ### ### ######### ######### #########

proc ::sak::doc::auto::findManpages {base} {
    set top [file normalize $base]
    set manpages {}
................................................................................
    Tag+ division_end
    Tag+ division_end
    Tag+ toc_end

    fileutil::writeFile [toc] [join $lines \n]
    return
}

proc ::sak::doc::auto::saveSimpleTableOfContents1 {tv nv dv fname} {
    upvar 1 $tv title $nv name $dv data
    # title: file     -> description
    # name:  file     -> label
    # data:  list(file...)

    TagsBegin
    Tag+ toc_begin [list {Table Of Contents} {}]

    # The man pages are sorted in several ways for the toc.
    # Subsections are the modules or apps, whatever is in data.

    # Not handled: 'no applications'
    Tag+ division_start [list {Applications}]
    foreach item [lsort -dict -index 0 [Sortable $data name maxf maxl]] {
	foreach {label file} $item break
	Tag+ item \
	    [FmtR maxf $file] \
	    [FmtR maxl $label] \
	    [list $title($file)]
    }
    Tag+ division_end
    Tag+ toc_end

    fileutil::writeFile [toc $fname] [join $lines \n]
    return
}

proc ::sak::doc::auto::saveSimpleTableOfContents2 {tv nv dv fname} {
    upvar 1 $tv title $nv name $dv data
    # title: file     -> description
    # name:  file     -> label
    # data:  module -> list (file...)

    TagsBegin
    Tag+ toc_begin [list {Table Of Contents} {}]

    # The man pages are sorted in several ways for the toc.
    # Subsections are the modules or apps, whatever is in data.

    # Not handled: 'no modules'
    Tag+ division_start [list {Modules}]
    foreach m [lsort -dict [array names data]] {
	Tag+ division_start [list $m]
	foreach item [lsort -dict -index 0 [Sortable $data($m) name maxf maxl]] {
	    foreach {label file} $item break
	    Tag+ item \
		[FmtR maxf $file] \
		[FmtR maxl $label] \
		[list $title($file)]
	}
	Tag+ division_end
    }
    Tag+ division_end
    Tag+ toc_end

    fileutil::writeFile [toc $fname] [join $lines \n]
    return
}

proc ::sak::doc::auto::saveSimpleTableOfContents3 {tv nv cv fname} {
    upvar 1 $tv title $nv name $cv cat
    # title: file     -> description
    # name:  file     -> label
    # cat:   category -> list (file...)

    TagsBegin
    Tag+ toc_begin [list {Table Of Contents} {}]

    Tag+ division_start [list {By Categories}]
    foreach c [lsort -dict [array names cat]] {
	Tag+ division_start [list $c]
	foreach item [lsort -dict -index 0 [Sortable $cat($c) name maxf maxl]] {
	    foreach {label file} $item break
	    Tag+ item \
		[FmtR maxf $file] \
		[FmtR maxl $label] \
		[list $title($file)]
	}
	Tag+ division_end
    }
    Tag+ division_end
    Tag+ toc_end

    fileutil::writeFile [toc $fname] [join $lines \n]
    return
}

proc ::sak::doc::auto::Sortable {files nv mfv mnv} {
    upvar 1 $nv name $mfv maxf $mnv maxn
    # Generate a list of files sortable by name, and also find the
    # max length of all relevant names.
    set maxf 0
    set maxn 0

Changes to support/devel/sak/localdoc/localdoc.tcl.

14
15
16
17
18
19
20
21
22

23
24
25
26

27
28
29
30
31
32
33
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
59
60
61
62
63
64



65



66
67
68


69
70




71
72
73
74
75
76
77
78


79
80




81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
proc ::sak::localdoc::usage {} {
    package require sak::help
    puts stdout \n[sak::help::on localdoc]
    exit 1
}

proc ::sak::localdoc::run {} {
    set noe [info nameofexecutable]


    set dtplite [auto_execok dtplite]
    if {$dtplite == {}} {
	put stderr "Need dtplite, not found in the PATH"
	return

    }

    # Relative path is necessary to handle possibility of fossil
    # repository and website as child of a larger website. Absolute
    # adressing may not point to our root, but the outer site.
    #set nav /home

    # NOTE: This may not work for the deeper nested manpages.
    # doc/tip/embedded/www/toc.html
    #set nav ../../../../../home

    # Indeed, not working for the nested pages.
    # Use absolute, for main location.
    set nav /tklib




    puts "Removing old documentation..."
    file delete -force embedded
    file mkdir embedded/man
    file mkdir embedded/www

    puts "Reindex the documentation..."
    sak::doc::imake __dummy__
    sak::doc::index __dummy__

    puts "Generating manpages..."
    exec 2>@ stderr >@ stdout $noe $dtplite \


	-exclude {*/doctools/tests/*} \
	-exclude {*/support/*} \
	-ext n \
	-o embedded/man \
	nroff .

    # Note: Might be better to run them separately.
    # Note @: Or we shuffle the results a bit more in the post processing stage.

    set toc [string map {
	.man     .html
	modules/ tklib/files/modules/



    } [fileutil::cat support/devel/sak/doc/toc.txt]]




    puts "Generating HTML... Pass 1, draft..."
    exec 2>@ stderr >@ stdout $noe $dtplite \


	-toc $toc \
	-nav Home $nav \




	-exclude {*/doctools/tests/*} \
	-exclude {*/support/*} \
	-merge \
	-o embedded/www \
	html .

    puts "Generating HTML... Pass 2, resolving cross-references..."
    exec 2>@ stderr >@ stdout $noe $dtplite \


	-toc $toc \
	-nav Home $nav \




	-exclude {*/doctools/tests/*} \
	-exclude {*/support/*} \
	-merge \
	-o embedded/www \
	html .

    return
}

# ### ### ### ######### ######### #########

package provide sak::localdoc 1.0

##
# ###







|
<
>
|
|
|
|
>
|
<
<
<
<
<
<
<
<
|

<
<
<
>
>
>






<
<
<
<

<
>
>
|
|
|
|
|




|

|
>
>
>
|
>
>
>


<
>
>
|
<
>
>
>
>
|
|
|
|
|


<
>
>
|
<
>
>
>
>
|
|
|
|
|










14
15
16
17
18
19
20
21

22
23
24
25
26
27
28








29
30



31
32
33
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
59
60
61
62
63

64
65
66

67
68
69
70
71
72
73
74
75
76
77

78
79
80

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
proc ::sak::localdoc::usage {} {
    package require sak::help
    puts stdout \n[sak::help::on localdoc]
    exit 1
}

proc ::sak::localdoc::run {} {
    package require cmdline

    package require fileutil
    package require textutil::repeat
    package require doctools
    package require doctools::toc
    package require doctools::idx
    package require dtplite









    set nav ../../../../home




    puts "Reindex the documentation..."
    sak::doc::imake __dummy__
    sak::doc::index __dummy__

    puts "Removing old documentation..."
    file delete -force embedded
    file mkdir embedded/man
    file mkdir embedded/www





    puts "Generating manpages..."

    dtplite::do \
	[list \
	     -exclude {*/doctools/tests/*} \
	     -exclude {*/support/*} \
	     -ext n \
	     -o embedded/man \
	     nroff .]

    # Note: Might be better to run them separately.
    # Note @: Or we shuffle the results a bit more in the post processing stage.

    set map  {
	.man     .html
	modules/ tcllib/files/modules/
	apps/    tcllib/files/apps/
    }

    set toc  [string map $map [fileutil::cat support/devel/sak/doc/toc.txt]]
    set apps [string map $map [fileutil::cat support/devel/sak/doc/toc_apps.txt]]
    set mods [string map $map [fileutil::cat support/devel/sak/doc/toc_mods.txt]]
    set cats [string map $map [fileutil::cat support/devel/sak/doc/toc_cats.txt]]

    puts "Generating HTML... Pass 1, draft..."

    dtplite::do \
	[list \
	     -toc $toc \

	     -nav {Tcllib Home} $nav \
	     -post+toc Categories $cats \
	     -post+toc Modules $mods \
	     -post+toc Applications $apps \
	     -exclude {*/doctools/tests/*} \
	     -exclude {*/support/*} \
	     -merge \
	     -o embedded/www \
	     html .]

    puts "Generating HTML... Pass 2, resolving cross-references..."

    dtplite::do \
	[list \
	     -toc $toc \

	     -nav {Tcllib Home} $nav \
	     -post+toc Categories $cats \
	     -post+toc Modules $mods \
	     -post+toc Applications $apps \
	     -exclude {*/doctools/tests/*} \
	     -exclude {*/support/*} \
	     -merge \
	     -o embedded/www \
	     html .]

    return
}

# ### ### ### ######### ######### #########

package provide sak::localdoc 1.0

##
# ###

Changes to support/devel/sak/util/anim.tcl.

1
2
3
4
5
6








7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- tcl -*-
# (C) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
##
# ###

namespace eval ::sak::animate {}









# ###

proc ::sak::animate::init {} {
    variable prefix
    variable n      0
    variable max    [llength $prefix]
    variable extend 0
}

proc ::sak::animate::next {string} {
    variable prefix
    variable n
    variable max
    Extend string

    puts -nonewline stdout \r\[[lindex $prefix $n]\]\ $string
    flush           stdout

    incr n ; if {$n >= $max} {set n 0}
    return
}

proc ::sak::animate::last {string} {
    variable clear
    Extend string

    puts  stdout \r\[$clear\]\ $string
    flush stdout
    return
}

# ###

proc ::sak::animate::Extend {sv} {
    variable extend
    upvar 1 $sv string

    set l [string length $string]
    while {[string length $string] < $extend} {append string " "}
    if {$l > $extend} {set extend $l}
    return
}

# ###

namespace eval ::sak::animate {
    namespace export init next last

    variable  prefix {
	{*   }	{*   }	{*   }	{*   }	{*   }

|



|
>
>
>
>
>
>
>
>







<






|

|








<






<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44












45
46
47
48
49
50
51
# -*- tcl -*-
# (C) 2006-2013 Andreas Kupries <andreas_kupries@users.sourceforge.net>
##
# ###

namespace eval ::sak::animate {
    # EL (Erase Line)
    #    Sequence: ESC [ n K
    # ** Effect: if n is 0 or missing, clear from cursor to end of line
    #    Effect: if n is 1, clear from beginning of line to cursor
    #    Effect: if n is 2, clear entire line

    variable eeol \033\[K
}

# ###

proc ::sak::animate::init {} {
    variable prefix
    variable n      0
    variable max    [llength $prefix]

}

proc ::sak::animate::next {string} {
    variable prefix
    variable n
    variable max
    variable eeol

    puts -nonewline stdout \r\[[lindex $prefix $n]\]\ $string$eeol
    flush           stdout

    incr n ; if {$n >= $max} {set n 0}
    return
}

proc ::sak::animate::last {string} {
    variable clear


    puts  stdout \r\[$clear\]\ $string
    flush stdout
    return
}













# ###

namespace eval ::sak::animate {
    namespace export init next last

    variable  prefix {
	{*   }	{*   }	{*   }	{*   }	{*   }

Changes to support/devel/sak/validate/syntax.tcl.

190
191
192
193
194
195
196

197

198
199
200
201
202
203
204
	if {[string equal $c set]}       continue
	if {[string equal $c if]}        continue
	if {[string equal $c rename]}    continue
	if {[string equal $c namespace]} continue
	interp eval $ip [list ::rename $c {}]
    }


    interp eval $ip [list ::namespace delete ::tcl]

    interp eval $ip [list ::rename namespace {}]
    interp eval $ip [list ::rename rename    {}]

    foreach m {
	pcx::register unknown
    } {
	interp alias $ip $m {} ::sak::validate::syntax::PCX/[string map {:: _} $m] $ip







>
|
>







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
	if {[string equal $c set]}       continue
	if {[string equal $c if]}        continue
	if {[string equal $c rename]}    continue
	if {[string equal $c namespace]} continue
	interp eval $ip [list ::rename $c {}]
    }

    if {![package vsatisfies [package present Tcl] 8.6]} {
	interp eval $ip [list ::namespace delete ::tcl]
    }
    interp eval $ip [list ::rename namespace {}]
    interp eval $ip [list ::rename rename    {}]

    foreach m {
	pcx::register unknown
    } {
	interp alias $ip $m {} ::sak::validate::syntax::PCX/[string map {:: _} $m] $ip

Changes to support/devel/sak/validate/testsuites.tcl.

135
136
137
138
139
140
141

142

143
144
145
146
147
148
149
	if {[string equal $c set]}       continue
	if {[string equal $c if]}        continue
	if {[string equal $c rename]}    continue
	if {[string equal $c namespace]} continue
	interp eval $ip [list ::rename $c {}]
    }


    interp eval $ip [list ::namespace delete ::tcl]

    interp eval $ip [list ::rename namespace {}]
    interp eval $ip [list ::rename rename    {}]

    foreach m {
	testing unknown useLocal useLocalKeep useAccel
    } {
	interp alias $ip $m {} ::sak::validate::testsuites::Process/$m $ip







>
|
>







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
	if {[string equal $c set]}       continue
	if {[string equal $c if]}        continue
	if {[string equal $c rename]}    continue
	if {[string equal $c namespace]} continue
	interp eval $ip [list ::rename $c {}]
    }

    if {![package vsatisfies [package present Tcl] 8.6]} {
	interp eval $ip [list ::namespace delete ::tcl]
    }
    interp eval $ip [list ::rename namespace {}]
    interp eval $ip [list ::rename rename    {}]

    foreach m {
	testing unknown useLocal useLocalKeep useAccel
    } {
	interp alias $ip $m {} ::sak::validate::testsuites::Process/$m $ip