home *** CD-ROM | disk | FTP | other *** search
- # Tcl Documentation Reader
-
- source {<tcl$Dir>.!Choices}
-
- proc beep {} {puts -nonewline \a}
-
- w_init tcldoc
-
- w_box progInfo create "About this program"\
- { vlist {info Name TclDoc}
- {info Purpose "Read Tcl Documentation"}
- {info Author C.T.Stretch}
- {info Version {Fri,12 Aug 1994}}
- }
-
- set menudata { TclDoc {Info -dbox progInfo}
- {Quit -click exit}
- }
-
- source {<tclDoc$Dir>.index}
-
- w_bar -menu $menudata -drag {dragproc $w_file}
-
- proc process {text}\
- {
- regsub -all \t $text " " text
- regsub -all `` $text \x94 text
- regsub -all '' $text \x95 text
- regsub -all {\\([-\`'.])} $text {\1} text
- regsub -all {\\[ 0t]} $text " " text
- regsub -all {\\[|^&!%{}acdpru]} $text "" text
- regsub -all {\|} $text || text
- regsub -all {\\fI} $text |fi| text
- regsub -all {\\fB} $text |fb| text
- regsub -all {\\fR} $text |fr| text
- regsub -all {\\e} $text \\ text
- set text
- }
-
- proc outpar {}\
- { global win par ind stdind
- if {$par!=""}\
- { w_text win$win options -l${ind}i -i${ind}i
- w_text win$win write [process $par]
- set par ""
- set ind $stdind
- }
- }
-
- proc outlab {}\
- { global win line
- outpar
- w_text win$win options -l0
- w_text win$win print |cred|[string range $line 4 end]
- }
-
- proc skipdef {}\
- { global tfile line
- outpar
- while {![eof $tfile]}\
- { set line [gets $tfile]
- if {[string match ..* $line]} break
- }
- }
-
- proc inspar {}\
- { global line win ind stdind
- outpar
- regexp {.IP[ ]*([^ ]*)[ ]*[0-9]*} $line x line
- w_text win$win options -l${stdind}i
- w_text win$win print |cblue|[process $line]
- set ind [expr $stdind+.5]
- }
-
- proc insparn {}\
- { global line win ind stdind tfile
- outpar
- set len [string range $line 4 end]
- if {[string trim $len]==""} {set len 8}
- w_text win$win options -l${stdind}i
- w_text win$win print |cblue|[process [gets $tfile]]
- set ind [expr $stdind+$len*.1]
- }
-
- proc dragproc {fname}\
- { global win par ind line tfile rsind rind stdind
- set tfile [open $fname]
- w_text win$win create -width 8i -title $fname
- w_text win$win options -pon -jon -r.5i -l.5i -i.5i
- while {![eof $tfile]}\
- { set line [gets $tfile]
- switch -glob $line \
- { '* {}
- .SH* outlab
- .IP* inspar
- .TP* insparn
- .RS* {set rsind $stdind;set rind $ind;set stdind $ind;outpar}
- .RE* {outpar;set stdind $rsind;set ind $rind}
- .de* skipdef
- .VS* {}
- .VE* {}
- .* outpar
- default {append par "[string trim $line {}] "}
- }
- }
- outpar
- close $tfile
- w_text win$win open
- incr win
- }
-
- proc man {fname}\
- { dragproc $fname
- }
-
- set win 0
- set par ""
- set stdind .5
- set ind $stdind
- set rsind $stdind
- set rind $ind
-
-
-
-