This file is indexed.

/usr/share/tcltk/xotcl1.6.7-lib/xodoc.xotcl is in xotcl 1.6.7-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# $Id: xodoc.xotcl,v 1.7 2006/09/27 08:12:40 neumann Exp $

package provide xotcl::xodoc 0.84
package require -exact xotcl::staticMetadataAnalyzer 0.84
package require xotcl::htmllib
#package require xotcl::trace
package require XOTcl

namespace eval ::xotcl::xodoc {
    namespace import ::xotcl::*

    @ @File {
	description {
	    XOTcl documentation tool. Overloads the command @, which is used
	    as a documentation token. 
	}
    }

    @ Class MetadataTokenHTML {
	description {Instmixin to provide HTML printing. Such instmixins
	    are registered for all token types.
	}
    }
    Class MetadataTokenHTML
    @ MetadataTokenHTML abstract instproc printHTML {} {
	description {Print token to HTML document object}
    }
    MetadataTokenHTML abstract instproc printHTML {}

    @ MetadataTokenHTML instproc getDocPropertiesHTML {} {
	description {
	    Returns list of properties as HTML.
	}
    }

    MetadataTokenHTML instproc getDocPropertiesHTML {htmlDoc} {
	foreach p [my set properties] { 
	    $htmlDoc startTableRow -valign top
	    if {[my exists $p]} {
		$htmlDoc startTableCell -valign top
		$htmlDoc addString "<em> [my capitalize $p]:</em>" 
		$htmlDoc endTableCell

		$htmlDoc startTableCell -valign top
		if {$p eq "errorCodes"} {
		    # Build table cell with list of error codes.
		    foreach {code desc} [my set $p] {
			set code [string map [list < &lt\; > &gt\;] $code]
			set desc [string map [list < &lt\; > &gt\;] $desc]
			$htmlDoc addString "<b>$code</b>: $desc\n<p>"
		    }
		} else {
		    $htmlDoc addString [my set $p]
		}
		$htmlDoc endTableCell
	    }
	    $htmlDoc endTableRow
	}
    }

    MetadataTokenHTML instproc reflowHTML {left paragraph} {
	#set result ""
	#foreach line [split $paragraph \n] {
	#  if {![regexp {^ *$} $line]} {
	#    append result "$left$line<br>\n"
	#  }
	#}
	#return $result
	return $paragraph
    }

    MetadataToken instmixin [concat [MetadataToken info instmixin] MetadataTokenHTML]

    @ Class FileTokenHTML -superclass MetadataTokenHTML
    Class FileTokenHTML -superclass MetadataTokenHTML
    FileTokenHTML instproc printHTML {htmlDoc} {
	$htmlDoc addLineBreak
	$htmlDoc addString "<b> Filename: </b>"
	$htmlDoc addAnchor [my set name] -href [my set name]
	$htmlDoc addLineBreak
	$htmlDoc addLineBreak
	$htmlDoc startTable -border 0
	my getDocPropertiesHTML $htmlDoc
	$htmlDoc endTable
    }

    FileToken instmixin [concat [FileToken info instmixin] FileTokenHTML]

    @ Class ConstraintTokenHTML -superclass MetadataTokenHTML
    Class ConstraintTokenHTML -superclass MetadataTokenHTML
    ConstraintTokenHTML instproc printHTML {htmlDoc} {
	$htmlDoc addAnchor "" -name [my set name]
	$htmlDoc addString "<h2> Constraint: <em> [my set name] </em> </h2>"
	$htmlDoc addLineBreak
	$htmlDoc startTable -border 0
	my getDocPropertiesHTML $htmlDoc
	$htmlDoc endTable
    }

    ConstraintToken instmixin [concat [ConstraintToken info instmixin] ConstraintTokenHTML]

    @ Class ObjTokenHTML -superclass MetadataTokenHTML
    Class ObjTokenHTML -superclass MetadataTokenHTML
    ObjTokenHTML instproc getProcsHTML {htmlDoc} {
	set c ""
	set pl [MetadataToken sortTokenList [my procList]]
	if {[my istype ClassToken]} {
	    set pl [concat [MetadataToken sortTokenList [my instprocList]] $pl]
	}
	foreach p $pl {
	    set pn [$p set name]
	    set label($pn) "<a href=\"#[my set name]-$pn\">$pn</a>"
	}
	foreach l [lsort [array names label]] {
	    if {$c ne ""} {append c ", "}
	    append c $label($l)
	}
	if {$c ne ""} {append c "."}
	$htmlDoc addString "$c"
    }
    
    ObjTokenHTML instproc printHTML {htmlDoc} {
	$htmlDoc addAnchor "" -name [my set name]
	if {[my istype MetaClassToken]} {
	    set start "<h2> MetaClass:"
	} elseif {[my istype ClassToken]} {
	    set start "<h2> Class:"
	} else {
	    set start "<h2> Object:"
	}
	$htmlDoc addString "$start <em> [my set name] </em> </h2>"
	if {[my exists cl]} {
	    $htmlDoc addString "<b>Class</b>: [my set cl]"
	    $htmlDoc addLineBreak
	}
	if {[my exists heritage]} {
	    $htmlDoc addString "<b>Heritage</b>: [my set heritage]"
	    $htmlDoc addLineBreak
	}

	set head ""
	if {[my procList] ne ""} {set head "<b> Procs </b> "}
	if {[my istype ClassToken]} {
	    if {[my instprocList] ne ""} {set head "<b> Procs/Instprocs: </b> "}
	}
	$htmlDoc addString $head
	my getProcsHTML $htmlDoc

	$htmlDoc startTable -border 0
	my getDocPropertiesHTML $htmlDoc
	$htmlDoc endTable
    }

    ObjToken instmixin [concat [ObjToken info instmixin] ObjTokenHTML]

    @ Class MethodTokenHTML -superclass MetadataTokenHTML
    Class MethodTokenHTML -superclass MetadataTokenHTML

    # Prints out method information as HTML.
    MethodTokenHTML instproc printHTML {htmlDoc} {
	#my showVars
	set argText "\n"

	HtmlBuilder args

	set a  "<em>Arguments:</em>"

	set anchor [my set obj]-[my set name]
	$htmlDoc addAnchor "" -name $anchor

	if {[my abstract]} {$htmlDoc addString  "<b><em>abstract</em></b>"}
	$htmlDoc addString  "<b>[my set name] </b>"

	args set indentLevel [$htmlDoc set indentLevel]

	if {[my exists arguments]} {
	    #set argText "<table>\n"
	    foreach {arg argDescription} [my set arguments] {
		if {[llength $arg] > 1} {
		    # A default value was given to the argument.
		    $htmlDoc addString "<em>?[lindex $arg 0]?</em>"
		    set at "<b>?[lindex $arg 0]?</b>:$argDescription Default: \"[lindex $arg 1]\"."
		} else {
		    $htmlDoc addString "<em>$arg</em>"
		    set at "<b>$arg</b>: $argDescription"
		}
		args startTableRow -valign top
		args startTableCell -valign top
		args addString $a
		set a ""
		args endTableCell
		args startTableCell -valign top
		args addString $at
		args endTableCell
		args endTableRow
	    }
	}
	$htmlDoc startTable -border 0
	
	$htmlDoc addString [args toString]
	args destroy

	my getDocPropertiesHTML $htmlDoc

	$htmlDoc endTable

	#$htmlDoc endListItem
    }

    MethodToken instmixin [concat [MethodToken info instmixin] MethodTokenHTML]

    @ Class XODoc { description "Handler class for building a documentation database" }

    Class XODoc -superclass StaticMetadataAnalyzer

    @ XODoc proc documentFileAsHTML {
				     file "filename of the xotcl file to be documented"
				     docdir "directory to which the html file is written"
				 } {
	description "Uses the xoDoc package to produce an HTML documentation of
               a specified file ***.xotcl. The file is written to ***.html
               in docdir"
	return "file basename without suffix"
    }

    XODoc proc documentFileAsHTML {file docdir} {
	set docdb [XODoc [XODoc autoname docdb]]
	::@ set analyzerObj $docdb
	$docdb analyzeFile $file
	set ext [file extension $file]
	if {$ext ne ""} {set ext -[string trimleft $ext .]}
	set docfilename [file rootname [file tail $file]]$ext
	$docdb writeFile ${docdir}/$docfilename.html $file
	$docdb destroy
	return $docfilename
    }

    XODoc instproc printPackages {htmlDoc} {
	my instvar packageList
	$htmlDoc addString "<h2> Package/File Information </h2>"
	if {[llength $packageList] > 0} {
	    foreach t $packageList {
		if {[$t type] eq "provide"} {
		    $htmlDoc addString "<b> Package provided: </b> [$t name] [$t version]"
		} elseif {[$t type] eq "require"} {
		    $htmlDoc addString "<b> Package required: </b> [$t name] [$t version]"
		}
		$htmlDoc addLineBreak
	    }
	} else {
	    $htmlDoc addString "<b> No package provided/required </b>"
	    $htmlDoc addLineBreak
	}
    }

    XODoc instproc printExtensions {htmlDoc} {
	my instvar extensions
	if {[info exists extensions]} {
	    # Add list of extensions.
	    foreach extension $extensions {
		$htmlDoc addLineBreak
		$htmlDoc addString "<h2>Document extension: <em>[$extension name]</em>"
		$htmlDoc addString "<em>Description:</em> [$extension description]"
		$htmlDoc addLineBreak
	    }
	}
    }

    XODoc instproc printObjList {htmlDoc} {
	set objList [MetadataToken sortTokenList [my objList]]

	if {[llength $objList]>0} {
	    $htmlDoc addLineBreak
	    $htmlDoc addString "<b>Defined Objects/Classes: </b>"
	    $htmlDoc startUnorderedList
	    foreach obj $objList {
		set on [$obj set name]
		$htmlDoc startListItem
		$htmlDoc addAnchor "<em>$on</em>:" -href "#$on"
		$obj getProcsHTML $htmlDoc
		$htmlDoc addLineBreak
		$htmlDoc endListItem
	    }
	    $htmlDoc endUnorderedList
	}
    }

    XODoc instproc printFileToken {htmlDoc} {
	if {[my exists fileToken]} {
	    [my set fileToken] printHTML $htmlDoc
	} else {
	    $htmlDoc addString "<b> No file information. </b>\n"
	}
	$htmlDoc addLineBreak
    }

    XODoc instproc printConstraintsList {htmlDoc} {
	set constraintList [MetadataToken sortTokenList [my constraintList]]

	if {[llength $constraintList]>0} {
	    $htmlDoc addLineBreak
	    $htmlDoc addString "<b>Defined Constraints: </b>"
	    $htmlDoc startUnorderedList
	    foreach c $constraintList {
		set cn [$c set name]
		$htmlDoc startListItem
		$htmlDoc addAnchor "<em>$cn</em>:" -href "#$cn"
		$htmlDoc addLineBreak
		$htmlDoc endListItem
	    }
	    $htmlDoc endUnorderedList
	}
    }

    XODoc instproc printConstraints {htmlDoc} {
	foreach c [my set constraintList] {
	    $htmlDoc addHorizontalRule
	    $htmlDoc startParagraph
	    $c printHTML $htmlDoc
	    $htmlDoc endParagraph
	}
	$htmlDoc addLineBreak
    }

    XODoc instproc printProcsList {htmlDoc list string} {
	if {[llength $list] > 0} {
	    $htmlDoc addString "<h3>$string</h3>"
	    $htmlDoc startUnorderedList
	    foreach s $list {
		$htmlDoc startListItem
		$s printHTML $htmlDoc
		$htmlDoc endListItem
	    }
	    $htmlDoc endUnorderedList
	}
    }
    XODoc instproc printObjs {htmlDoc} {
	set objList [MetadataToken sortTokenList [my objList]]

	foreach t $objList {
	    $htmlDoc addHorizontalRule
	    $htmlDoc startParagraph
	    $t printHTML $htmlDoc
	    if {[$t istype ClassToken]} {
		my printProcsList $htmlDoc [$t set instprocList] Instprocs
	    }
	    my printProcsList $htmlDoc [$t set procList] Procs
	    $htmlDoc endParagraph
	}
    }

    XODoc instproc replaceFormatTags {fc} {
	regsub -all <@ $fc < fc
	regsub -all </@ $fc </ fc
	return $fc
    }

    @ XODoc instproc printHTML {
	name "name of the html document"
    } {
	description "Create HTML documentation object from metadata token"
    }
    XODoc instproc printHTML {name} {
	HtmlBuilder htmlDoc
	htmlDoc startDocument -title "XOTcl - Documentation -- $name" \
	    -bgcolor FFFFFF -stylesheet xotcl-doc.css
	htmlDoc addStringIncr "<h1>"
	htmlDoc addImage -src "./logo-100.jpg" -alt "$name" -align MIDDLE 
	htmlDoc addStringDecr "$name</h1>"
	htmlDoc addHorizontalRule
	htmlDoc startParagraph

	my printPackages htmlDoc
	my printExtensions htmlDoc
	my printObjList htmlDoc
	my printConstraintsList htmlDoc
	my printFileToken htmlDoc
	my printObjs htmlDoc
	my printConstraints htmlDoc
	htmlDoc endParagraph
	htmlDoc addHorizontalRule
	htmlDoc startParagraph
	htmlDoc endParagraph
	htmlDoc addAnchor "Back to index page." -href "./index.html"
	htmlDoc addLineBreak
	htmlDoc addHorizontalRule 
	htmlDoc startParagraph 
	htmlDoc endParagraph
	htmlDoc endDocument
	set r [my replaceFormatTags [htmlDoc toString]]
	htmlDoc destroy
	return $r
    }

    @ XODoc instproc writeFile {
	filename "file name destination" name "name of the html document"
    } {
	description "Create HTML docuemntation from metadata token and write to file <filename>"
    }
    XODoc instproc writeFile {filename name} {
	set content [my printHTML $name]
	set f [open $filename w]
	puts $f $content
	close $f
    }

    namespace export \
	MetadataTokenHTML FileTokenHTML ConstraintTokenHTML ObjTokenHTML \
	MethodTokenHTML XODoc
}

namespace import ::xotcl::xodoc::*