2 # The next line is executed by /bin/sh, but not tcl \
3 exec tclsh "$0" ${1+"$@"}
5 package require Tcl 8.5-
7 # Convert Ousterhout format man pages into highly crosslinked hypertext.
9 # Along the way detect many unmatched font changes and other odd things.
11 # Note well, this program is a hack rather than a piece of software
12 # engineering. In that sense it's probably a good example of things
13 # that a scripting language, like Tcl, can do well. It is offered as
14 # an example of how someone might convert a specific set of man pages
15 # into hypertext, not as a general solution to the problem. If you
16 # try to use this, you'll be very much on your own.
18 # Copyright (c) 1995-1997 Roger E. Critchlow Jr
22 set ::CSSFILE "docs.css"
25 <a href="http://sourceforge.net/projects/tcl">
26 <img src="http://sflogo.sourceforge.net/sflogo.php?group_id=10894&type=14"
27 width="150" height="40"
28 alt="Get Tcl at SourceForge.net. Fast, secure and Free Open Source software downloads" />
32 proc parse_command_line {} {
35 # These variables determine where the man pages come from and where
36 # the converted pages go to.
37 global tcltkdir tkdir tcldir webdir build_tcl build_tk
38 global build_tdbc build_tdbcodbc build_tdbcsqlite3 build_tdbcmysql
39 global build_tdbcpostgres
40 global tdbcdir tdbcodbcdir tdbcsqlite3dir tdbcmysqldir tdbcpostgresdir
42 # Set defaults based on original code.
50 set tdbcpostgresdir {}
56 set build_tdbcsqlite3 0
58 set build_tdbcpostgres 0
60 # Default search version is a glob pattern
61 set useversion {{,[8-9].[0-9]{,[.ab][0-9]{,[0-9]}}}}
63 # Handle arguments a la GNU:
65 # --useversion=<version>
70 foreach option $argv {
71 switch -glob -- $option {
73 puts "tcltk-man-html $Version"
78 puts "usage: tcltk-man-html \[OPTION\] ...\n"
79 puts " --help print this help, then exit"
80 puts " --version print version number, then exit"
81 puts " --srcdir=DIR find tcl and tk source below DIR"
82 puts " --htmldir=DIR put generated HTML in DIR"
83 puts " --tcl build tcl help"
84 puts " --tk build tk help"
85 puts " --useversion version of tcl/tk to search for"
90 # length of "--srcdir=" is 9.
91 set tcltkdir [string range $option 9 end]
95 # length of "--htmldir=" is 10
96 set webdir [string range $option 10 end]
100 # length of "--useversion=" is 13
101 set useversion [string range $option 13 end]
121 set build_tdbcsqlite3 1
125 set build_tdbcmysql 1
129 set build_tdbcpostgres 1
133 puts stderr "tcltk-man-html: unrecognized option -- `$option'"
141 set tcldir [lindex [lsort [glob -nocomplain -tails -type d \
142 -directory $tcltkdir tcl$useversion]] end]
144 puts stderr "tcltk-man-html: couldn't find Tcl below $tcltkdir"
147 puts "using Tcl source directory $tcldir"
152 set tkdir [lindex [lsort [glob -nocomplain -tails -type d \
153 -directory $tcltkdir tk$useversion]] end]
155 puts stderr "tcltk-man-html: couldn't find Tk below $tcltkdir"
158 puts "using Tk source directory $tkdir"
163 set tdbcdir [lindex [lsort [glob -nocomplain -tails -type d \
164 -directory $tcltkdir \
165 tdbc$useversion]] end]
166 if {$tdbcdir eq ""} {
167 puts stderr "tcltk-man-html: couldn't find Tdbc below $tcltkdir"
170 puts "using Tdbc source directory $tcldir"
173 if {$build_tdbcodbc} {
175 set tdbcodbcdir [lindex [lsort [glob -nocomplain -tails -type d \
176 -directory $tcltkdir \
177 tdbcodbc$useversion]] end]
178 if {$tdbcodbcdir eq ""} {
179 puts stderr "tcltk-man-html: couldn't find Tdbcodbc below $tcltkdir"
182 puts "using Tdbcodbc source directory $tcldir"
185 if {$build_tdbcsqlite3} {
187 set tdbcsqlite3dir [lindex [lsort [glob -nocomplain -tails -type d \
188 -directory $tcltkdir \
189 tdbcsqlite3$useversion]] end]
190 if {$tdbcsqlite3dir eq ""} {
191 puts stderr "tcltk-man-html: couldn't find Tdbcsqlite3 below $tcltkdir"
194 puts "using Tdbcsqlite3 source directory $tcldir"
197 if {$build_tdbcmysql} {
199 set tdbcmysqldir [lindex [lsort [glob -nocomplain -tails -type d \
200 -directory $tcltkdir \
201 tdbcmysql$useversion]] end]
202 if {$tdbcmysqldir eq ""} {
203 puts stderr "tcltk-man-html: couldn't find Tdbcmysql below $tcltkdir"
206 puts "using Tdbcmysql source directory $tcldir"
210 if {$build_tdbcpostgres} {
212 set tdbcpostgresdir [lindex [lsort [glob -nocomplain -tails -type d \
213 -directory $tcltkdir \
214 tdbcpostgres$useversion]] end]
215 if {$tdbcpostgresdir eq ""} {
216 puts stderr "tcltk-man-html: couldn't find Tdbcpostgres below \
220 puts "using Tdbcpostgres source directory $tcldir"
223 # the title for the man pages overall
227 append overall_title "[capitalize $tcldir]"
229 if {$build_tcl && $build_tk} {
230 append overall_title "/"
233 append overall_title "[capitalize $tkdir]"
235 if {!$build_tcl && !$build_tk &&
236 ($build_tdbc || $build_tdbcodbc || $build_tdbcsqlite3
237 || $build_tdbcmysql || $build_tdbcpostgres)} {
238 append overall_title "[capitalize $tdbcdir]"
240 append overall_title " Documentation"
243 proc capitalize {string} {
244 return [string toupper $string 0]
250 set manual(report-level) 1
252 proc manerror {msg} {
256 set procname [lindex [info level -1] 0]
257 if {[info exists manual(name)]} {
258 set name $manual(name)
260 if {[info exists manual(section)] && [string length $manual(section)]} {
261 puts stderr "$name: $manual(section): $procname: $msg"
263 puts stderr "$name: $procname: $msg"
267 proc manreport {level msg} {
269 if {$level < $manual(report-level)} {
270 uplevel 1 [list manerror $msg]
276 uplevel 1 [list manerror $msg]
284 if {[info exists ::TARGET] && $::TARGET eq "devsite"} {
287 return "contents.htm"
290 proc copyright {copyright {level {}}} {
291 # We don't actually generate a separate copyright page anymore
292 #set page "${level}copyright.htm"
293 #return "<A HREF=\"$page\">Copyright</A> © [htmlize-text [lrange $copyright 2 end]]"
294 # obfuscate any email addresses that may appear in name
295 set who [string map {@ (at)} [lrange $copyright 2 end]]
296 return "Copyright © [htmlize-text $who]"
298 proc copyout {copyrights {level {}}} {
299 set out "<div class=\"copy\">"
300 foreach c $copyrights {
301 append out "[copyright $c $level]\n"
306 proc CSS {{level ""}} {
307 return "<link rel=\"stylesheet\" href=\"${level}$::CSSFILE\" type=\"text/css\" media=\"all\">\n"
310 return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
312 proc htmlhead {title header args} {
314 if {[lindex $args end] eq "../[indexfile]"} {
315 # XXX hack - assume same level for CSS file
318 set out "[DOCTYPE]\n<HTML>\n<HEAD><TITLE>$title</TITLE>\n[CSS $level]</HEAD>\n"
319 foreach {uptitle url} $args {
320 set header "<a href=\"$url\">$uptitle</a> <small>></small> $header"
322 append out "<BODY><H2>$header</H2>"
324 if {[info exists manual(subheader)]} {
326 foreach {name subdir} $manual(subheader) {
327 if {$name eq $title} {
330 lappend subs "<A HREF=\"${level}$subdir/[indexfile]\">$name</A>"
333 append out "\n<H3>[join $subs { | }]</H3>"
338 set hBd "1px dotted #11577b"
340 body, div, p, th, td, li, dd, ul, ol, dl, dt, blockquote {
341 font-family: Verdana, sans-serif;
344 pre, code { font-family: 'Courier New', Courier, monospace; }
347 background-color: #f6fcec;
348 border-top: 1px solid #6A6A6A;
349 border-bottom: 1px solid #6A6A6A;
355 background-color: #FFFFFF;
358 letter-spacing: .2px;
363 font-family: Georgia, serif;
378 background-color: #c5dce8;
380 border: 1px solid #6A6A6A;
385 background-color: #e8f2f6;
390 h3 { font-size: 12px; }
391 h4 { font-size: 11px; }
393 .keylist dt, .arguments dt {
397 border-top: 1px solid #999;
400 .keylist dt { font-weight: bold; }
402 .keylist dd, .arguments dd {
405 border-top: 1px solid #999;
409 background-color: #f6fcfc;
412 border-top: 1px solid #6A6A6A;
422 return [string map [list \" {}] $arg]
425 proc parse-directive {line codename restname} {
426 upvar 1 $codename code $restname rest
427 return [regexp {^(\.[.a-zA-Z0-9]*) *(.*)} $line all code rest]
430 proc htmlize-text {text {charmap {}}} {
431 # contains some extras for use in nroff->html processing
432 # build on the list passed in, if any
446 return [string map $charmap $text]
449 proc process-text {text} {
451 # preprocess text; note that this is an incomplete map, and will probably
452 # need to have things added to it as the manuals expand to use them.
463 {\(->} "<font size=\"+1\">→</font>" \
468 lappend charmap {\o'o^'} {ô} ; # o-circumflex in re_syntax.n
469 lappend charmap {\-\|\-} -- ; # two hyphens
470 lappend charmap {\-} - ; # a hyphen
472 set text [htmlize-text $text $charmap]
473 # General quoted entity
474 regsub -all {\\N'(\d+)'} $text "\\&#\\1;" text
475 while {[string first "\\" $text] >= 0} {
477 if {[regsub {^([^\\]*)\\fC([^\\]*)\\fR(.*)$} $text \
478 {\1<TT>\2</TT>\3} text]} continue
480 if {[regsub {^([^\\]*)\\fB([^\\]*)\\fR(.*)$} $text \
481 {\1<B>\2</B>\3} text]} continue
483 if {[regsub {^([^\\]*)\\fB([^\\]*)\\fI(.*)$} $text \
484 {\1<B>\2</B>\\fI\3} text]} continue
486 if {[regsub {^([^\\]*)\\fI([^\\]*)\\fR(.*)$} $text \
487 {\1<I>\2</I>\3} text]} continue
489 if {[regsub {^([^\\]*)\\fI([^\\]*)\\fB(.*)$} $text \
490 {\1<I>\2</I>\\fB\3} text]} continue
493 [regsub {^([^\\]*)\\fB([^\\]*)\\fB(.*)$} $text \
495 || [regsub {^([^\\]*)\\fI([^\\]*)\\fI(.*)$} $text \
497 || [regsub {^([^\\]*)\\fR([^\\]*)\\fR(.*)$} $text \
500 manerror "impotent font change: $text"
505 manerror "uncaught backslash: $text"
506 set text [string map [list "\\" "\"] $text]
511 ## pass 2 text input and matching
515 set manual(text-length) [llength $manual(text)]
516 set manual(text-pointer) 0
520 return [expr {$manual(text-pointer) < $manual(text-length)}]
525 set text [lindex $manual(text) $manual(text-pointer)]
526 incr manual(text-pointer)
529 manerror "read past end of text"
532 proc is-a-directive {line} {
533 return [string match .* $line]
535 proc split-directive {line opname restname} {
536 upvar 1 $opname op $restname rest
537 set op [string range $line 0 2]
538 set rest [string trim [string range $line 3 end]]
540 proc next-op-is {op restname} {
542 upvar 1 $restname rest
544 set text [lindex $manual(text) $manual(text-pointer)]
545 if {[string equal -length 3 $text $op]} {
546 set rest [string range $text 4 end]
547 incr manual(text-pointer)
553 proc backup-text {n} {
555 if {$manual(text-pointer)-$n >= 0} {
556 incr manual(text-pointer) -$n
559 proc match-text args {
561 set nargs [llength $args]
562 if {$manual(text-pointer) + $nargs > $manual(text-length)} {
571 set arg [string trim $arg]
572 set targ [string trim [lindex $manual(text) $manual(text-pointer)]]
575 incr manual(text-pointer)
578 if {[regexp {^@(\w+)$} $arg all name]} {
582 incr manual(text-pointer)
585 if {[regexp -nocase {^(\.[A-Z][A-Z])@(\w+)$} $arg all op name]\
586 && [string equal $op [lindex $targ 0]]} {
588 set var [lrange $targ 1 end]
590 incr manual(text-pointer)
598 proc expand-next-text {n} {
600 return [join [lrange $manual(text) $manual(text-pointer) \
601 [expr {$manual(text-pointer)+$n-1}]] \n\n]
606 proc man-puts {text} {
608 lappend manual(output-$manual(wing-file)-$manual(name)) $text
612 ## build hypertext links to tables of contents
614 proc long-toc {text} {
616 set here M[incr manual(section-toc-n)]
617 set there L[incr manual(long-toc-n)]
618 lappend manual(section-toc) \
619 "<DD><A HREF=\"$manual(name).htm#$here\" NAME=\"$there\">$text</A>"
620 return "<A NAME=\"$here\">$text</A>"
622 proc option-toc {name class switch} {
624 if {[string match "*OPTIONS" $manual(section)]} {
625 if {$manual(name) ne "ttk_widget" && ($manual(name) ne "ttk_entry" ||
626 ![string match validate* $name])} {
627 # link the defined option into the long table of contents
628 set link [long-toc "$switch, $name, $class"]
629 regsub -- "$switch, $name, $class" $link "$switch" link
632 } elseif {"$manual(name):$manual(section)" ne "options:DESCRIPTION"} {
633 error "option-toc in $manual(name) section $manual(section)"
636 # link the defined standard option to the long table of contents and make
637 # a target for the standard option references from other man pages.
639 set first [lindex $switch 0]
641 set there L[incr manual(long-toc-n)]
642 set manual(standard-option-$manual(name)-$first) \
643 "<A HREF=\"$manual(name).htm#$here\">$switch, $name, $class</A>"
644 lappend manual(section-toc) \
645 "<DD><A HREF=\"$manual(name).htm#$here\" NAME=\"$there\">$switch, $name, $class</A>"
646 return "<A NAME=\"$here\">$switch</A>"
648 proc std-option-toc {name page} {
650 if {[info exists manual(standard-option-$page-$name)]} {
651 lappend manual(section-toc) <DD>$manual(standard-option-$page-$name)
652 return $manual(standard-option-$page-$name)
654 manerror "missing reference to \"$name\" in $page.n"
655 set here M[incr manual(section-toc-n)]
656 set there L[incr manual(long-toc-n)]
658 lappend manual(section-toc) "<DD><A HREF=\"$page.htm#$other\">$name</A>"
659 return "<A HREF=\"$page.htm#$other\">$name</A>"
662 ## process the widget option section
663 ## in widget and options man pages
665 proc output-widget-options {rest} {
668 lappend manual(section-toc) <DL>
671 while {[next-op-is .OP rest]} {
672 switch -exact -- [llength $rest] {
674 lassign $rest switch name class
677 set switch [lrange $rest 0 2]
678 set name [lindex $rest 3]
679 set class [lindex $rest 4]
682 fatal "bad .OP $rest"
685 if {![regexp {^(<.>)([-\w ]+)(</.>)$} $switch \
686 all oswitch switch cswitch]} {
687 if {![regexp {^(<.>)([-\w ]+) or ([-\w ]+)(</.>)$} $switch \
688 all oswitch switch1 switch2 cswitch]} {
689 error "not Switch: $switch"
691 set switch "$switch1$cswitch or $oswitch$switch2"
693 if {![regexp {^(<.>)([\w]*)(</.>)$} $name all oname name cname]} {
694 error "not Name: $name"
696 if {![regexp {^(<.>)([\w]*)(</.>)$} $class all oclass class cclass]} {
697 error "not Class: $class"
699 man-puts "$para<DT>Command-Line Name: $oswitch[option-toc $name $class $switch]$cswitch"
700 man-puts "<DT>Database Name: $oname$name$cname"
701 man-puts "<DT>Database Class: $oclass$class$cclass"
702 man-puts <DD>[next-text]
705 if {[next-op-is .RS rest]} {
706 while {[more-text]} {
708 if {[is-a-directive $line]} {
709 split-directive $line code rest
710 switch -exact -- $code {
715 manerror "unbalanced .RS at section end"
720 output-directive $line
730 lappend manual(section-toc) </DL>
736 proc output-RS-list {} {
738 if {[next-op-is .IP rest]} {
739 output-IP-list .RS .IP $rest
740 if {[match-text .RE .sp .RS @rest .IP @rest2]} {
742 output-IP-list .RS .IP $rest2
744 if {[match-text .RE .sp .RS @rest .RE]} {
748 if {[next-op-is .RE rest]} {
753 while {[more-text]} {
755 if {[is-a-directive $line]} {
756 split-directive $line code rest
757 switch -exact -- $code {
762 manerror "unbalanced .RS at section end"
767 output-directive $line
778 ## process .IP lists which may be plain indents,
779 ## numeric lists, or definition lists
781 proc output-IP-list {context code rest} {
783 if {![string length $rest]} {
784 # blank label, plain indent, no contents entry
786 while {[more-text]} {
788 if {[is-a-directive $line]} {
789 split-directive $line code rest
790 if {$code eq ".IP" && $rest eq {}} {
794 if {$code in {.br .DS .RS}} {
795 output-directive $line
806 # labelled list, make contents
807 if {$context ne ".SH" && $context ne ".SS"} {
810 set dl "<DL class=\"[string tolower $manual(section)]\">"
812 lappend manual(section-toc) $dl
816 while {[more-text]} {
818 if {[is-a-directive $line]} {
819 split-directive $line code rest
820 switch -exact -- $code {
823 output-IP-list .IP $code $rest
826 if {$manual(section) eq "ARGUMENTS" || \
827 [regexp {^\[\d+\]$} $rest]} {
828 man-puts "$para<DT>$rest<DD>"
829 } elseif {"•" eq $rest} {
830 man-puts "$para<DT><DD>$rest "
832 man-puts "$para<DT>[long-toc $rest]<DD>"
834 if {"$manual(name):$manual(section)" eq \
835 "selection:DESCRIPTION"} {
836 if {[match-text .RE @rest .RS .RS]} {
837 man-puts <DT>[long-toc $rest]<DD>
841 .sp - .br - .DS - .CS {
842 output-directive $line
845 if {[match-text .RS]} {
846 output-directive $line
848 } elseif {[match-text .CS]} {
851 } elseif {[match-text .PP]} {
854 } elseif {[match-text .DS]} {
858 output-directive $line
862 if {[match-text @rest1 .br @rest2 .RS]} {
863 # yet another nroff kludge as above
864 man-puts "$para<DT>[long-toc $rest1]"
865 man-puts "<DT>[long-toc $rest2]<DD>"
867 } elseif {[match-text @rest .RE]} {
868 # gad, this is getting ridiculous
870 man-puts "</DL><P>$rest<DL>"
878 } elseif {$accept_RE} {
879 output-directive $line
902 man-puts "$para</DL>"
903 lappend manual(section-toc) </DL>
905 manerror "missing .RE in output-IP-list"
910 ## handle the NAME section lines
911 ## there's only one line in the NAME section,
912 ## consisting of a comma separated list of names,
913 ## followed by a hyphen and a short description.
915 proc output-name {line} {
917 # split name line into pieces
918 regexp {^([^-]+) - (.*)$} $line all head tail
919 # output line to manual page untouched
921 # output line to long table of contents
922 lappend manual(section-toc) <DL><DD>$line</DD></DL>
923 # separate out the names for future reference
924 foreach name [split $head ,] {
925 set name [string trim $name]
926 if {[llength $name] > 1} {
927 manerror "name has a space: {$name}\nfrom: $line"
929 lappend manual(wing-toc) $name
930 lappend manual(name-$name) $manual(wing-file)/$manual(name)
934 ## build a cross-reference link if appropriate
936 proc cross-reference {ref} {
938 if {[string match "Tcl_*" $ref]} {
940 } elseif {[string match "Tk_*" $ref]} {
942 } elseif {$ref eq "Tcl"} {
945 set lref [string tolower $ref]
948 ## nothing to reference
950 if {![info exists manual(name-$lref)]} {
952 array file history info interp string trace after clipboard grab
953 image option pack place selection tk tkwait update winfo wm
955 if {[regexp "^$name \[a-z0-9]*\$" $lref] && \
956 [info exists manual(name-$name)] && \
957 $manual(tail) ne "$name.n"} {
958 return "<A HREF=\"../$manual(name-$name).htm\">$ref</A>"
961 if {$lref in {stdin stdout stderr end}} {
962 # no good place to send these
969 ## would be a self reference
971 foreach name $manual(name-$lref) {
972 if {"$manual(wing-file)/$manual(name)" in $name} {
977 ## multiple choices for reference
979 if {[llength $manual(name-$lref)] > 1} {
980 set tcl_i [lsearch -glob $manual(name-$lref) *TclCmd*]
981 set tcl_ref [lindex $manual(name-$lref) $tcl_i]
982 set tk_i [lsearch -glob $manual(name-$lref) *TkCmd*]
983 set tk_ref [lindex $manual(name-$lref) $tk_i]
984 if {$tcl_i >= 0 && $manual(wing-file) eq "TclCmd"
985 || $manual(wing-file) eq "TclLib"} {
986 return "<A HREF=\"../$tcl_ref.htm\">$ref</A>"
988 if {$tk_i >= 0 && $manual(wing-file) eq "TkCmd"
989 || $manual(wing-file) eq "TkLib"} {
990 return "<A HREF=\"../$tk_ref.htm\">$ref</A>"
992 if {$lref eq "exit" && $manual(tail) eq "tclsh.1" && $tcl_i >= 0} {
993 return "<A HREF=\"../$tcl_ref.htm\">$ref</A>"
995 puts stderr "multiple cross reference to $ref in $manual(name-$lref) from $manual(wing-file)/$manual(tail)"
999 ## exceptions, sigh, to the rule
1001 switch -exact -- $manual(tail) {
1003 if {$lref eq "focus"} {
1005 set clue [string first command $tail]
1006 if {$clue < 0 || $clue > 5} {
1010 if {$lref in {bitmap image text}} {
1014 checkbutton.n - radiobutton.n {
1015 if {$lref in {image}} {
1020 if {$lref in {checkbutton radiobutton}} {
1025 if {$lref in {bitmap image set}} {
1030 if {$lref in {string}} {
1035 if {$lref in {text}} {
1040 if {$lref in {exec}} {
1045 if {$lref in {error continue break}} {
1050 if {$lref in {set}} {
1056 ## return the cross reference
1058 return "<A HREF=\"../$manual(name-$lref).htm\">$ref</A>"
1061 ## reference generation errors
1063 proc reference-error {msg text} {
1065 puts stderr "$manual(tail): $msg: {$text}"
1069 ## insert as many cross references into this text string as are appropriate
1071 proc insert-cross-references {text} {
1074 ## we identify cross references by:
1076 ## <B>emboldening</B>
1079 ## [a-zA-Z0-9]+ manual entry
1080 ## and we avoid messing with already anchored text
1083 ## find where each item lives
1085 array set offset [list \
1086 anchor [string first {<A } $text] \
1087 end-anchor [string first {</A>} $text] \
1088 quote [string first {``} $text] \
1089 end-quote [string first {''} $text] \
1090 bold [string first {<B>} $text] \
1091 end-bold [string first {</B>} $text] \
1092 tcl [string first {Tcl_} $text] \
1093 tk [string first {Tk_} $text] \
1094 Tcl1 [string first {Tcl manual entry} $text] \
1095 Tcl2 [string first {Tcl overview manual entry} $text] \
1098 ## accumulate a list
1100 foreach name [array names offset] {
1101 if {$offset($name) >= 0} {
1102 set invert($offset($name)) $name
1103 lappend offsets $offset($name)
1107 ## if nothing, then we're done.
1109 if {![info exists offsets]} {
1115 set offsets [lsort -integer $offsets]
1117 ## see which we want to use
1119 switch -exact -- $invert([lindex $offsets 0]) {
1121 if {$offset(end-anchor) < 0} {
1122 return [reference-error {Missing end anchor} $text]
1124 set head [string range $text 0 $offset(end-anchor)]
1125 set tail [string range $text [expr {$offset(end-anchor)+1}] end]
1126 return $head[insert-cross-references $tail]
1129 if {$offset(end-quote) < 0} {
1130 return [reference-error "Missing end quote" $text]
1132 if {$invert([lindex $offsets 1]) eq "tk"} {
1133 set offsets [lreplace $offsets 1 1]
1135 if {$invert([lindex $offsets 1]) eq "tcl"} {
1136 set offsets [lreplace $offsets 1 1]
1138 switch -exact -- $invert([lindex $offsets 1]) {
1140 set head [string range $text 0 [expr {$offset(quote)-1}]]
1141 set body [string range $text [expr {$offset(quote)+2}] \
1142 [expr {$offset(end-quote)-1}]]
1143 set tail [string range $text \
1144 [expr {$offset(end-quote)+2}] end]
1145 return "$head``[cross-reference $body]''[insert-cross-references $tail]"
1149 set head [string range $text \
1150 0 [expr {$offset(end-quote)+1}]]
1151 set tail [string range $text \
1152 [expr {$offset(end-quote)+2}] end]
1153 return "$head[insert-cross-references $tail]"
1156 return [reference-error "Uncaught quote case" $text]
1159 if {$offset(end-bold) < 0} {
1162 if {$invert([lindex $offsets 1]) eq "tk"} {
1163 set offsets [lreplace $offsets 1 1]
1165 if {$invert([lindex $offsets 1]) eq "tcl"} {
1166 set offsets [lreplace $offsets 1 1]
1168 switch -exact -- $invert([lindex $offsets 1]) {
1170 set head [string range $text 0 [expr {$offset(bold)-1}]]
1171 set body [string range $text [expr {$offset(bold)+3}] \
1172 [expr {$offset(end-bold)-1}]]
1173 set tail [string range $text \
1174 [expr {$offset(end-bold)+4}] end]
1175 return "$head<B>[cross-reference $body]</B>[insert-cross-references $tail]"
1178 set head [string range $text \
1179 0 [expr {$offset(end-bold)+3}]]
1180 set tail [string range $text \
1181 [expr {$offset(end-bold)+4}] end]
1182 return "$head[insert-cross-references $tail]"
1185 return [reference-error "Uncaught bold case" $text]
1188 set head [string range $text 0 [expr {$offset(tk)-1}]]
1189 set tail [string range $text $offset(tk) end]
1190 if {![regexp {^(Tk_\w+)(.*)$} $tail all body tail]} {
1191 return [reference-error "Tk regexp failed" $text]
1193 return $head[cross-reference $body][insert-cross-references $tail]
1196 set head [string range $text 0 [expr {$offset(tcl)-1}]]
1197 set tail [string range $text $offset(tcl) end]
1198 if {![regexp {^(Tcl_\w+)(.*)$} $tail all body tail]} {
1199 return [reference-error {Tcl regexp failed} $text]
1201 return $head[cross-reference $body][insert-cross-references $tail]
1205 set off [lindex $offsets 0]
1206 set head [string range $text 0 [expr {$off-1}]]
1208 set tail [string range $text [expr {$off+3}] end]
1209 return $head[cross-reference $body][insert-cross-references $tail]
1214 return [reference-error "Out of place $invert([lindex $offsets 0])" $text]
1219 ## process formatting directives
1221 proc output-directive {line} {
1223 # process format directive
1224 split-directive $line code rest
1225 switch -exact -- $code {
1230 # drain any open lists
1231 # announce the subject
1232 set manual(section) $rest
1233 # start our own stack of stuff
1234 set manual($manual(name)-$manual(section)) {}
1235 lappend manual(has-$manual(section)) $manual(name)
1236 if {$code ne ".SS"} {
1237 man-puts "<H3>[long-toc $manual(section)]</H3>"
1239 man-puts "<H4>[long-toc $manual(section)]</H4>"
1241 # some sections can simply free wheel their way through the text
1242 # some sections can be processed in their own loops
1243 switch -exact -- $manual(section) {
1245 if {$manual(tail) in {CrtImgType.3 CrtItemType.3 CrtPhImgFmt.3}} {
1246 # these manual pages have two NAME sections
1247 if {[info exists manual($manual(tail)-NAME)]} {
1250 set manual($manual(tail)-NAME) 1
1254 set line [next-text]
1255 if {[is-a-directive $line]} {
1257 output-name [join $names { }]
1260 lappend names [string trim $line]
1265 lappend manual(section-toc) <DL>
1268 [next-op-is .nf rest]
1269 || [next-op-is .br rest]
1270 || [next-op-is .fi rest]
1275 [next-op-is .SH rest]
1276 || [next-op-is .SS rest]
1277 || [next-op-is .BE rest]
1278 || [next-op-is .SO rest]
1283 if {[next-op-is .sp rest]} {
1287 set more [next-text]
1288 if {[is-a-directive $more]} {
1289 manerror "in SYNOPSIS found $more"
1293 foreach more [split $more \n] {
1295 if {$manual(wing-file) in {TclLib TkLib}} {
1296 lappend manual(section-toc) <DD>$more
1300 lappend manual(section-toc) </DL>
1304 while {[more-text]} {
1305 if {[next-op-is .SH rest] || [next-op-is .SS rest]} {
1309 set more [next-text]
1310 if {[is-a-directive $more]} {
1316 foreach cr [split $more ,] {
1317 set cr [string trim $cr]
1318 if {![regexp {^<B>.*</B>$} $cr]} {
1321 if {[regexp {^<B>(.*)\([13n]\)</B>$} $cr all name]} {
1326 man-puts [join $nmore {, }]
1331 while {[more-text]} {
1332 if {[next-op-is .SH rest] || [next-op-is .SS rest]} {
1336 set more [next-text]
1337 if {[is-a-directive $more]} {
1343 foreach key [split $more ,] {
1344 set key [string trim $key]
1345 lappend manual(keyword-$key) [list $manual(name) $manual(wing-file)/$manual(name).htm]
1346 set initial [string toupper [string index $key 0]]
1347 lappend keys "<A href=\"../Keywords/$initial.htm\#$key\">$key</A>"
1349 man-puts [join $keys {, }]
1354 if {[next-op-is .IP rest]} {
1355 output-IP-list $code .IP $rest
1358 if {[next-op-is .PP rest]} {
1364 # When there's a sequence of multiple .SO chunks, process into one
1367 if {[match-text @stuff .SE]} {
1368 foreach opt [split $stuff \n\t] {
1369 lappend optslist [list $opt $rest]
1372 manerror "unexpected .SO format:\n[expand-next-text 2]"
1374 if {![next-op-is .SO rest]} {
1378 output-directive {.SH STANDARD OPTIONS}
1380 lappend manual(section-toc) <DL>
1381 foreach optionpair [lsort -dictionary -index 0 $optslist] {
1382 lassign $optionpair option targetPage
1383 man-puts "<DT><B>[std-option-toc $option $targetPage]</B>"
1386 lappend manual(section-toc) </DL>
1389 output-widget-options $rest
1393 output-IP-list .IP .IP $rest
1404 manerror "unexpected .RE"
1412 manerror "unexpected .DE"
1416 if {[next-op-is .ta rest]} {
1417 # skip the leading .ta directive if it is there
1419 if {[match-text @stuff .DE]} {
1420 set td "<td><p style=\"font-size:12px;padding-left:.5em;padding-right:.5em;\">"
1421 set bodyText [string map [list \n <tr>$td \t $td] \n$stuff]
1422 man-puts "<dl><dd><table border=\"0\">$bodyText</table></dl>"
1423 #man-puts <PRE>$stuff</PRE>
1424 } elseif {[match-text .fi @ul1 @ul2 .nf @stuff .DE]} {
1425 man-puts "<PRE>[lindex $ul1 1][lindex $ul2 1]\n$stuff</PRE>"
1427 manerror "unexpected .DS format:\n[expand-next-text 2]"
1432 if {[next-op-is .ta rest]} {
1435 if {[match-text @stuff .CE]} {
1436 man-puts <PRE>$stuff</PRE>
1438 manerror "unexpected .CS format:\n[expand-next-text 2]"
1443 manerror "unexpected .CE"
1450 # these are tab stop settings for short tables
1451 switch -exact -- $manual(name):$manual(section) {
1453 {bind:EVENT TYPES} -
1454 {bind:BINDING SCRIPTS AND SUBSTITUTIONS} -
1456 {expr:MATH FUNCTIONS} -
1457 {history:DESCRIPTION} -
1458 {history:HISTORY REVISION} -
1459 {switch:DESCRIPTION} -
1460 {upvar:DESCRIPTION} {
1464 manerror "ignoring $line"
1469 if {[match-text @more .fi]} {
1470 foreach more [split $more \n] {
1473 } elseif {[match-text .RS @more .RE .fi]} {
1475 foreach more [split $more \n] {
1479 } elseif {[match-text .RS @more .RS @more2 .RE .RE .fi]} {
1481 foreach more [split $more \n] {
1485 foreach more2 [split $more2 \n] {
1489 } elseif {[match-text .RS @more .RS @more2 .RE @more3 .RE .fi]} {
1491 foreach more [split $more \n] {
1495 foreach more2 [split $more2 \n] {
1499 foreach more3 [split $more3 \n] {
1503 } elseif {[match-text .sp .RS @more .RS @more2 .sp .RE .RE .fi]} {
1504 man-puts <P><DL><DD>
1505 foreach more [split $more \n] {
1509 foreach more2 [split $more2 \n] {
1512 man-puts </DL></DL><P>
1513 } elseif {[match-text .RS .sp @more .sp .RE .fi]} {
1514 man-puts <P><DL><DD>
1515 foreach more [split $more \n] {
1520 manerror "ignoring $line"
1524 manerror "ignoring $line"
1532 manerror "ignoring $line"
1535 manerror "ignoring comment $line"
1538 manerror "unrecognized format directive: $line"
1543 ## merge copyright listings
1545 proc merge-copyrights {l1 l2} {
1547 set re1 {^Copyright +(?:\(c\)|\\\(co|©) +(\w.*?)(?:all rights reserved)?(?:\. )*$}
1548 set re2 {^(\d+) +(?:by +)?(\w.*)$} ;# date who
1549 set re3 {^(\d+)-(\d+) +(?:by +)?(\w.*)$} ;# from to who
1550 set re4 {^(\d+), *(\d+) +(?:by +)?(\w.*)$} ;# date1 date2 who
1551 foreach copyright [concat $l1 $l2] {
1552 if {[regexp -nocase -- $re1 $copyright -> info]} {
1553 set info [string trimright $info ". "] ; # remove extra period
1554 if {[regexp -- $re2 $info -> date who]} {
1555 lappend dates($who) $date
1557 } elseif {[regexp -- $re3 $info -> from to who]} {
1558 for {set date $from} {$date <= $to} {incr date} {
1559 lappend dates($who) $date
1562 } elseif {[regexp -- $re3 $info -> date1 date2 who]} {
1563 lappend dates($who) $date1 $date2
1567 puts "oops: $copyright"
1569 foreach who [array names dates] {
1570 set list [lsort -dictionary $dates($who)]
1571 if {[llength $list] == 1 || [lindex $list 0] eq [lrange $list end end]} {
1572 lappend merge "Copyright © [lindex $list 0] $who"
1574 lappend merge "Copyright © [lindex $list 0]-[lrange $list end end] $who"
1577 return [lsort -dictionary $merge]
1580 proc makedirhier {dir} {
1581 if {![file isdirectory $dir] && \
1582 [catch {file mkdir $dir} error]} {
1583 return -code error "cannot create directory $dir: $error"
1587 proc addbuffer {args} {
1589 if {$manual(partial-text) ne ""} {
1590 append manual(partial-text) \n
1592 append manual(partial-text) [join $args ""]
1594 proc flushbuffer {} {
1596 if {$manual(partial-text) ne ""} {
1597 lappend manual(text) [process-text $manual(partial-text)]
1598 set manual(partial-text) ""
1603 ## foreach of the man directories specified by args
1604 ## convert manpages into hypertext in the directory
1605 ## specified by html.
1607 proc make-man-pages {html args} {
1608 global manual overall_title tcltkdesc
1610 set cssfd [open $html/$::CSSFILE w]
1611 puts $cssfd [gencss]
1613 set manual(short-toc-n) 1
1614 set manual(short-toc-fp) [open $html/[indexfile] w]
1615 puts $manual(short-toc-fp) [htmlhead $overall_title $overall_title]
1616 puts $manual(short-toc-fp) "<DL class=\"keylist\">"
1617 set manual(merge-copyrights) {}
1619 # preprocess to set up subheader for the rest of the files
1620 if {![llength $arg]} {
1623 set name [lindex $arg 1]
1624 set file [lindex $arg 2]
1625 lappend manual(subheader) $name $file
1628 if {![llength $arg]} {
1631 set manual(wing-glob) [lindex $arg 0]
1632 set manual(wing-name) [lindex $arg 1]
1633 set manual(wing-file) [lindex $arg 2]
1634 set manual(wing-description) [lindex $arg 3]
1635 set manual(wing-copyrights) {}
1636 makedirhier $html/$manual(wing-file)
1637 set manual(wing-toc-fp) [open $html/$manual(wing-file)/[indexfile] w]
1639 puts stderr "scanning section $manual(wing-name)"
1640 # put the entry for this section into the short table of contents
1641 puts $manual(short-toc-fp) "<DT><A HREF=\"$manual(wing-file)/[indexfile]\">$manual(wing-name)</A></DT><DD>$manual(wing-description)</DD>"
1642 # initialize the wing table of contents
1643 puts $manual(wing-toc-fp) [htmlhead $manual(wing-name) \
1644 $manual(wing-name) $overall_title "../[indexfile]"]
1645 # initialize the short table of contents for this section
1646 set manual(wing-toc) {}
1647 # initialize the man directory for this section
1648 makedirhier $html/$manual(wing-file)
1649 # initialize the long table of contents for this section
1650 set manual(long-toc-n) 1
1651 # get the manual pages for this section
1652 set manual(pages) [lsort -dictionary [glob $manual(wing-glob)]]
1653 set n [lsearch -glob $manual(pages) */ttk_widget.n]
1655 set manual(pages) "[lindex $manual(pages) $n] [lreplace $manual(pages) $n $n]"
1657 set n [lsearch -glob $manual(pages) */options.n]
1659 set manual(pages) "[lindex $manual(pages) $n] [lreplace $manual(pages) $n $n]"
1661 # set manual(pages) [lrange $manual(pages) 0 5]
1664 foreach manual_page $manual(pages) {
1665 set manual(page) $manual_page
1667 puts stderr "scanning page $manual(page)"
1668 set manual(tail) [file tail $manual(page)]
1669 set manual(name) [file root $manual(tail)]
1670 set manual(section) {}
1671 if {$manual(name) in {case pack-old menubar}} {
1673 manerror "discarding $manual(name)"
1676 set manual(infp) [open $manual(page)]
1678 set manual(partial-text) {}
1679 foreach p {.RS .DS .CS .SO} {
1682 set manual(stack) {}
1683 set manual(section) {}
1684 set manual(section-toc) {}
1685 set manual(section-toc-n) 1
1686 set manual(copyrights) {}
1687 lappend manual(all-pages) $manual(wing-file)/$manual(tail)
1688 manreport 100 $manual(name)
1690 while {[gets $manual(infp) line] >= 0} {
1692 if {"$line" eq "'\\\" IGNORE"} {
1696 if {"$line" eq "'\\\" END IGNORE"} {
1703 if {[regexp {^[`'][/\\]} $line]} {
1704 if {[regexp {Copyright (?:\(c\)|\\\(co).*$} $line copyright]} {
1705 lappend manual(copyrights) $copyright
1710 if {"$line" eq {'}} {
1714 if {![parse-directive $line code rest]} {
1718 switch -exact -- $code {
1719 .ad - .na - .so - .ne - .AS - .VE - .VS - . {
1724 switch -exact -- $code {
1727 if {[llength $rest] == 0} {
1728 gets $manual(infp) rest
1730 lappend manual(text) "$code [unquote $rest]"
1734 lappend manual(text) "$code [unquote $rest]"
1737 set rest [regexp -all -inline {\"(?:[^""]+)\"|\S+} $rest]
1738 addbuffer $LQ [unquote [lindex $rest 0]] $RQ \
1739 [unquote [lindex $rest 1]]
1742 set rest [regexp -all -inline {\"(?:[^""]+)\"|\S+} $rest]
1743 addbuffer ( $LQ [unquote [lindex $rest 0]] $RQ \
1744 [unquote [lindex $rest 1]] ) \
1745 [unquote [lindex $rest 2]]
1748 set rest [regexp -all -inline {\"(?:[^""]+)\"|\S+} $rest]
1749 addbuffer $LQ [unquote [lindex $rest 0]] - \
1750 [unquote [lindex $rest 1]] $RQ \
1751 [unquote [lindex $rest 2]]
1758 lappend manual(text) "$code [unquote $rest]"
1760 .BS - .BE - .br - .fi - .sp - .nf {
1762 if {"$rest" ne {}} {
1763 manerror "unexpected argument: $line"
1765 lappend manual(text) $code
1769 lappend manual(text) [concat .IP [process-text "[lindex $rest 0] \\fB[lindex $rest 1]\\fR ([lindex $rest 2])"]]
1773 regexp {^(.*) +\d+$} $rest all rest
1774 lappend manual(text) ".IP [process-text [unquote [string trim $rest]]]"
1778 while {[is-a-directive [set next [gets $manual(infp)]]]} {
1779 manerror "ignoring $next after .TP"
1781 if {"$next" ne {'}} {
1782 lappend manual(text) ".IP [process-text $next]"
1787 lappend manual(text) [concat .OP [process-text \
1788 "\\fB[lindex $rest 0]\\fR \\fB[lindex $rest 1]\\fR \\fB[lindex $rest 2]\\fR"]]
1792 lappend manual(text) {.PP}
1797 lappend manual(text) $code
1802 lappend manual(text) $code
1807 if {[llength $rest] == 0} {
1808 lappend manual(text) "$code options"
1810 lappend manual(text) "$code [unquote $rest]"
1816 lappend manual(text) $code
1821 lappend manual(text) $code
1826 lappend manual(text) $code
1831 lappend manual(text) $code
1836 lappend manual(text) $code
1839 while {[gets $manual(infp) line] >= 0} {
1840 if {[string match "..*" $line]} {
1846 error "found .. outside of .de"
1850 manerror "unrecognized format directive: $line"
1857 if {$manual(.RS) != 0} {
1858 puts "unbalanced .RS .RE"
1860 if {$manual(.DS) != 0} {
1861 puts "unbalanced .DS .DE"
1863 if {$manual(.CS) != 0} {
1864 puts "unbalanced .CS .CE"
1866 if {$manual(.SO) != 0} {
1867 puts "unbalanced .SO .SE"
1872 if {[next-op-is .HS rest]} {
1873 set manual($manual(name)-title) \
1874 "[lrange $rest 1 end] [lindex $rest 0] manual page"
1875 } elseif {[next-op-is .TH rest]} {
1876 set manual($manual(name)-title) "[lindex $rest 0] manual page - [lrange $rest 4 end]"
1879 manerror "no .HS or .TH record found"
1882 while {[more-text]} {
1883 set line [next-text]
1884 if {[is-a-directive $line]} {
1885 output-directive $line
1890 man-puts [copyout $manual(copyrights) "../"]
1891 set manual(wing-copyrights) [merge-copyrights $manual(wing-copyrights) $manual(copyrights)]
1894 # make the long table of contents for this page
1896 set manual(toc-$manual(wing-file)-$manual(name)) [concat <DL> $manual(section-toc) </DL>]
1900 # make the wing table of contents for the section
1903 foreach name $manual(wing-toc) {
1904 if {[string length $name] > $width} {
1905 set width [string length $name]
1908 set perline [expr {120 / $width}]
1909 set nrows [expr {([llength $manual(wing-toc)]+$perline)/$perline}]
1912 foreach name [lsort -dictionary $manual(wing-toc)] {
1913 set tail $manual(name-$name)
1914 if {[llength $tail] > 1} {
1915 manerror "$name is defined in more than one file: $tail"
1916 set tail [lindex $tail [expr {[llength $tail]-1}]]
1918 set tail [file tail $tail]
1919 append rows([expr {$n%$nrows}]) \
1920 "<td> <a href=\"$tail.htm\">$name</a>"
1923 puts $manual(wing-toc-fp) <table>
1924 foreach row [lsort -integer [array names rows]] {
1925 puts $manual(wing-toc-fp) <tr>$rows($row)</tr>
1927 puts $manual(wing-toc-fp) </table>
1930 # insert wing copyrights
1932 puts $manual(wing-toc-fp) [copyout $manual(wing-copyrights) "../"]
1933 puts $manual(wing-toc-fp) $::logo
1934 puts $manual(wing-toc-fp) "</BODY></HTML>"
1935 close $manual(wing-toc-fp)
1936 set manual(merge-copyrights) [merge-copyrights $manual(merge-copyrights) $manual(wing-copyrights)]
1940 ## build the keyword index.
1942 file delete -force -- $html/Keywords
1943 makedirhier $html/Keywords
1944 set keyfp [open $html/Keywords/[indexfile] w]
1945 puts $keyfp [htmlhead "$tcltkdesc Keywords" "$tcltkdesc Keywords" \
1946 $overall_title "../[indexfile]"]
1947 set letters {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}
1948 # Create header first
1950 foreach a $letters {
1951 set keys [array names manual "keyword-\[[string totitle $a$a]\]*"]
1952 if {[llength $keys]} {
1953 lappend keyheader "<A HREF=\"$a.htm\">$a</A>"
1955 # No keywords for this letter
1956 lappend keyheader $a
1959 set keyheader "<H3>[join $keyheader " |\n"]</H3>"
1960 puts $keyfp $keyheader
1961 foreach a $letters {
1962 set keys [array names manual "keyword-\[[string totitle $a$a]\]*"]
1963 if {![llength $keys]} {
1967 set afp [open $html/Keywords/$a.htm w]
1968 puts $afp [htmlhead "$tcltkdesc Keywords - $a" \
1969 "$tcltkdesc Keywords - $a" \
1970 $overall_title "../[indexfile]"]
1971 puts $afp $keyheader
1972 puts $afp "<DL class=\"keylist\">"
1973 foreach k [lsort -dictionary $keys] {
1974 set k [string range $k 8 end]
1975 puts $afp "<DT><A NAME=\"$k\">$k</A></DT>"
1978 foreach man $manual(keyword-$k) {
1979 set name [lindex $man 0]
1980 set file [lindex $man 1]
1981 lappend refs "<A HREF=\"../$file\">$name</A>"
1983 puts $afp "[join $refs {, }]</DD>"
1986 # insert merged copyrights
1987 puts $afp [copyout $manual(merge-copyrights)]
1989 puts $afp "</BODY></HTML>"
1992 # insert merged copyrights
1993 puts $keyfp [copyout $manual(merge-copyrights)]
1995 puts $keyfp "</BODY></HTML>"
1999 ## finish off short table of contents
2001 puts $manual(short-toc-fp) "<DT><A HREF=\"Keywords/[indexfile]\">Keywords</A><DD>The keywords from the $tcltkdesc man pages."
2002 puts $manual(short-toc-fp) "</DL>"
2003 # insert merged copyrights
2004 puts $manual(short-toc-fp) [copyout $manual(merge-copyrights)]
2005 puts $manual(short-toc-fp) $::logo
2006 puts $manual(short-toc-fp) "</BODY></HTML>"
2007 close $manual(short-toc-fp)
2012 unset manual(section)
2013 foreach path $manual(all-pages) {
2014 set manual(wing-file) [file dirname $path]
2015 set manual(tail) [file tail $path]
2016 set manual(name) [file root $manual(tail)]
2017 set text $manual(output-$manual(wing-file)-$manual(name))
2019 foreach item $text {
2020 incr ntext [llength [split $item \n]]
2023 set toc $manual(toc-$manual(wing-file)-$manual(name))
2026 incr ntoc [llength [split $item \n]]
2029 puts stderr "rescanning page $manual(name) $ntoc/$ntext"
2030 set outfd [open $html/$manual(wing-file)/$manual(name).htm w]
2031 puts $outfd [htmlhead "$manual($manual(name)-title)" \
2032 $manual(name) $manual(wing-file) "[indexfile]" \
2033 $overall_title "../[indexfile]"]
2035 (($ntext > 60) && ($ntoc > 32)) || $manual(tail) in {
2036 Hash LinkVar SetVar TraceVar ConfigWidg CrtImgType CrtItemType
2037 CrtPhImgFmt DoOneEvent GetBitmap GetColor GetCursor GetDash
2038 GetJustify GetPixels GetVisual ParseArgv QueueEvent
2045 foreach item $text {
2046 puts $outfd [insert-cross-references $item]
2049 puts $outfd "</BODY></HTML>"
2057 set tcltkdesc ""; set cmdesc ""; set appdir ""
2059 append tcltkdesc "Tcl"
2061 append appdir "$tcldir"
2063 if {$build_tcl && $build_tk} {
2064 append tcltkdesc "/"
2065 append cmdesc " and "
2069 append tcltkdesc "Tk"
2071 append appdir "$tkdir"
2073 if {!$build_tcl && !$build_tk} {
2074 set cmdesc "Tcl DataBase Connectivity"
2075 set tcltkdesc "TDBC"
2081 append appdir $sep $tdbcdir
2084 if {$build_tdbcodbc} {
2085 append appdir $sep $tdbcodbcdir
2088 if {$build_tdbcsqlite3} {
2089 append appdir $sep $tdbcsqlite3dir
2092 if {$build_tdbcmysql} {
2093 append appdir $sep $tdbcmysqldir
2096 if {$build_tdbcpostgres} {
2097 append appdir $sep $tdbcpostgresdir
2101 set usercmddesc "The interpreters which implement $cmdesc."
2102 set tclcmddesc {The commands which the <B>tclsh</B> interpreter implements.}
2103 set tkcmddesc {The additional commands which the <B>wish</B> interpreter implements.}
2104 set tcllibdesc {The C functions which a Tcl extended C program may use.}
2105 set tklibdesc {The additional C functions which a Tk extended C program may use.}
2106 set tdbcdesc {The commands that are implemented by Tcl DataBase Connectivity (TDBC)}
2107 set tdbclibdesc {The C functions that are implemented by Tcl DataBase Connectivity (TDBC)}
2108 set tdbcodbcdesc {The ODBC driver for Tcl DataBase Connectivity (TDBC)}
2109 set tdbcsqlite3desc {The Sqlite3 driver for Tcl DataBase Connectivity (TDBC)}
2110 set tdbcmysqldesc {The MySQL driver for Tcl DataBase Connectivity (TDBC)}
2111 set tdbcpostgresdesc {The Postgres driver for Tcl DataBase Connectivity (TDBC)}
2115 make-man-pages $webdir \
2116 [expr {($build_tcl || $build_tk) ? "$tcltkdir/{$appdir}/doc/*.1 \"$tcltkdesc Applications\" UserCmd {$usercmddesc}" : ""}] \
2117 [expr {$build_tcl ? "$tcltkdir/$tcldir/doc/*.n {Tcl Commands} TclCmd {$tclcmddesc}" : ""}] \
2118 [expr {$build_tk ? "$tcltkdir/$tkdir/doc/*.n {Tk Commands} TkCmd {$tkcmddesc}" : ""}] \
2119 [expr {$build_tcl ? "$tcltkdir/$tcldir/doc/*.3 {Tcl Library} TclLib {$tcllibdesc}" : ""}] \
2120 [expr {$build_tk ? "$tcltkdir/$tkdir/doc/*.3 {Tk Library} TkLib {$tklibdesc}" : ""}] \
2121 [expr {$build_tdbc ? "$tcltkdir/$tdbcdir/doc/*.n {Tcl Database Connectivity} TDBC {$tdbcdesc}" : ""}] \
2122 [expr {$build_tdbcodbc ? "$tcltkdir/$tdbcodbcdir/doc/*.n {TDBC-ODBC Bridge} Tdbcodbc {$tdbcodbcdesc}" : ""}] \
2123 [expr {$build_tdbcsqlite3 ? "$tcltkdir/$tdbcsqlite3dir/doc/*.n {TDBC driver for Sqlite3} Tdbcsqlite3 {$tdbcsqlite3desc}" : ""}] \
2124 [expr {$build_tdbcmysql ? "$tcltkdir/$tdbcmysqldir/doc/*.n {TDBC driver for MySQL} Tdbcmysql {$tdbcmysqldesc}" : ""}] \
2125 [expr {$build_tdbcpostgres ? "$tcltkdir/$tdbcpostgresdir/doc/*.n {TDBC driver for Postgres} Tdbcpostgres {$tdbcpostgresdesc}" : ""}] \
2126 [expr {$build_tdbc ? "$tcltkdir/$tdbcdir/doc/*.3 {Tcl Database Connectivity C API} TdbcLib {$tdbclibdesc}" : ""}] \
2128 puts $error\n$errorInfo