File: actions.tcl

package info (click to toggle)
tcllib 1.10-dfsg-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 17,708 kB
  • ctags: 6,122
  • sloc: tcl: 106,354; ansic: 9,205; sh: 8,707; xml: 1,766; yacc: 753; makefile: 115; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (239 lines) | stat: -rw-r--r-- 5,271 bytes parent folder | download | duplicates (2)
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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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
# -*- tcl -*-

# This file holds the commands determining the files to install. They
# are used by the installer to actually perform the installation, and
# by 'sak' to get the per-module lists of relevant files. The
# different purposes are handled through the redefinition of the
# commands [xcopy] and [xcopyf] used by the commands here.

proc _null {args} {}

proc _tcl {module libdir} {
    global distribution
    xcopy \
	    [file join $distribution modules $module] \
	    [file join $libdir $module] \
	    0 *.tcl
    return
}

proc _tcr {module libdir} {
    global distribution
    xcopy \
	    [file join $distribution modules $module] \
	    [file join $libdir $module] \
	    1 *.tcl
    return
}

proc _doc {module libdir} {
    global distribution

    _tcl $module $libdir
    xcopy \
	    [file join $distribution modules $module mpformats] \
	    [file join $libdir $module mpformats] \
	    1
    return
}

proc _msg {module libdir} {
    global distribution

    _tcl $module $libdir
    xcopy \
	    [file join $distribution modules $module msgs] \
	    [file join $libdir $module msgs] \
	    1
    return
}

proc _tex {module libdir} {
    global distribution

    _tcl $module $libdir
    xcopy \
	    [file join $distribution modules $module] \
	    [file join $libdir $module] \
	    0 *.tex
    return
}

proc _tci {module libdir} {
    global distribution

    _tcl $module $libdir
    xcopyfile [file join $distribution modules $module tclIndex] \
	    [file join $libdir $module]
    return
}

proc _manfile {f format ext docdir} {
    global distribution argv argc argv0 config

    set out [file join $docdir [file rootname [file tail $f]]].$ext

    log "Generating $out"
    if {$config(dry)} return

    if {[catch {package present doctools}]} {
	uplevel #0 [list source [file join $distribution modules doctools doctools.tcl]]
    }

    ::doctools::new dt -format $format -file $f

    file mkdir [file dirname $out]

    set data [dt format [get_input $f]]
    switch -exact -- $format {
	nroff {
	    set data [string map \
		    [list \
		    {.so man.macros} \
		    $config(man.macros)] \
		    $data]
	}
	html {}
    }
    write_out $out $data

    set warnings [dt warnings]
    if {[llength $warnings] > 0} {
	log [join $warnings \n]
    }

    dt destroy
    return
}

proc _manfile {f format ext docdir} {
    global distribution argv argc argv0 config

    set out [file join $docdir [file rootname [file tail $f]]].$ext

    log "Generating $out"
    if {$config(dry)} return

    if {[catch {package present doctools}]} {
	uplevel #0 [list source [file join $distribution modules doctools doctools.tcl]]
    }

    ::doctools::new dt -format $format -file $f

    file mkdir [file dirname $out]

    set data [dt format [get_input $f]]
    switch -exact -- $format {
	nroff {
	    set data [string map \
		    [list \
		    {.so man.macros} \
		    $config(man.macros)] \
		    $data]
	}
	html {}
    }
    write_out $out $data

    set warnings [dt warnings]
    if {[llength $warnings] > 0} {
	log [join $warnings \n]
    }

    dt destroy
    return
}

proc _manfile {f format ext docdir} {
    global distribution argv argc argv0 config

    set out [file join $docdir [file rootname [file tail $f]]].$ext

    log "Generating $out"
    if {$config(dry)} return

    if {[catch {package present doctools}]} {
	uplevel #0 [list source [file join $distribution modules doctools doctools.tcl]]
    }

    ::doctools::new dt -format $format -file $f

    file mkdir [file dirname $out]

    set data [dt format [get_input $f]]
    switch -exact -- $format {
	nroff {
	    set data [string map \
		    [list \
		    {.so man.macros} \
		    $config(man.macros)] \
		    $data]
	}
	html {}
    }
    write_out $out $data

    set warnings [dt warnings]
    if {[llength $warnings] > 0} {
	log [join $warnings \n]
    }

    dt destroy
    return
}

proc _man {module format ext docdir} {
    global distribution argv argc argv0 config

    # [SF Tcllib Bug 784519]
    # Directly access the bundled doctools package to ensure that
    # we have the truly latest code for that, and not the doctools
    # the executing tclsh would find on its own. The present query is
    # used to ensure that we load the package only once.

    #package require doctools
    if {[catch {package present doctools}]} {
	uplevel #0 [list source [file join $distribution modules doctools doctools.tcl]]
    }
    ::doctools::new dt -format $format -module $module

    foreach f [glob -nocomplain [file join $distribution modules $module *.man]] {

	set out [file join $docdir [file rootname [file tail $f]]].$ext

	log "Generating $out"
	if {$config(dry)} {continue}

	dt configure -file $f
	file mkdir [file dirname $out]

	set data [dt format [get_input $f]]
	switch -exact -- $format {
	    nroff {
		set data [string map \
			[list \
			{.so man.macros} \
			$config(man.macros)] \
			$data]
	    }
	    html {}
	}
	write_out $out $data

	set warnings [dt warnings]
	if {[llength $warnings] > 0} {
	    log [join $warnings \n]
	}
    }
    dt destroy
    return
}

proc _exa {module exadir} {
    global distribution
    xcopy \
	    [file join $distribution examples $module] \
	    [file join $exadir $module] \
	    1
    return
}