diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/tcltk-man2html-utils.tcl | 1 | ||||
| -rwxr-xr-x | tools/tcltk-man2html.tcl | 51 | ||||
| -rw-r--r-- | tools/uniParse.tcl | 8 |
3 files changed, 48 insertions, 12 deletions
diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index b69e601..5a4550b 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -149,6 +149,7 @@ proc process-text {text} { {\(em} "—" \ {\(en} "–" \ {\(fm} "′" \ + {\(mc} "µ" \ {\(mu} "×" \ {\(mi} "−" \ {\(->} "<font size=\"+1\">→</font>" \ diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index b0c2d8f..e4cf3e9 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -31,6 +31,38 @@ set ::CSSFILE "docs.css" ## source [file join [file dirname [info script]] tcltk-man2html-utils.tcl] +proc findversion {top name useversion} { + set upper [string toupper $name] + foreach top1 [list $top $top/..] sub {{} generic} { + foreach dirname [ + glob -nocomplain -tails -type d -directory $top1 *] { + + set tclh [join [list $top1 $dirname {*}$sub $name.h] /] + if {[file exists $tclh]} { + set chan [open $tclh] + set data [read $chan] + close $chan + # backslash isn't required in front of quote, but it keeps syntax + # highlighting straight in some editors + if {[regexp -lineanchor \ + [string map [list @name@ $upper] \ + {^#define\s+@name@_VERSION\s+\"([^.])+\.([^.\"]+)}] \ + $data -> major minor]} { + # to do + # use glob matching instead of string matching or add + # brace handling to [string matcch] + if {$useversion eq {} || [string match $useversion $major.$minor]} { + set top [file dirname [file dirname $tclh]] + set prefix [file dirname $top] + return [list $prefix [file tail $top] $major $minor] + } + } + } + } + } + return +} + proc parse_command_line {} { global argv Version @@ -44,7 +76,9 @@ proc parse_command_line {} { set tcldir {} set webdir ../html set build_tcl 0 + set opt_build_tcl 0 set build_tk 0 + set opt_build_tk 0 set verbose 0 # Default search version is a glob pattern set useversion {{,[8-9].[0-9]{,[.ab][0-9]{,[0-9]}}}} @@ -93,10 +127,12 @@ proc parse_command_line {} { --tcl { set build_tcl 1 + set opt_build_tcl 1 } --tk { set build_tk 1 + set opt_build_tk 1 } --verbose=* { @@ -117,20 +153,19 @@ proc parse_command_line {} { if {$build_tcl} { # Find Tcl. - set tcldir [lindex [lsort [glob -nocomplain -tails -type d \ - -directory $tcltkdir tcl$useversion]] end] - if {$tcldir eq ""} { + lassign [findversion $tcltkdir tcl $useversion] tcltkdir tcldir major minor + if {$tcldir eq {} && $opt_build_tcl} { puts stderr "tcltk-man-html: couldn't find Tcl below $tcltkdir" exit 1 } - puts "using Tcl source directory $tcldir" + puts "using Tcl source directory $tcltkdir $tcldir" } + if {$build_tk} { # Find Tk. - set tkdir [lindex [lsort [glob -nocomplain -tails -type d \ - -directory $tcltkdir tk$useversion]] end] - if {$tkdir eq ""} { + lassign [findversion $tcltkdir tk $useversion] tcltkdir tkdir major minor + if {$tkdir eq {} && $opt_build_tk} { puts stderr "tcltk-man-html: couldn't find Tk below $tcltkdir" exit 1 } @@ -143,7 +178,7 @@ proc parse_command_line {} { global overall_title set overall_title "" if {$build_tcl} { - append overall_title "[capitalize $tcldir]" + append overall_title "Tcl $major.$minor" } if {$build_tcl && $build_tk} { append overall_title "/" diff --git a/tools/uniParse.tcl b/tools/uniParse.tcl index c712e62..561c28e 100644 --- a/tools/uniParse.tcl +++ b/tools/uniParse.tcl @@ -212,7 +212,7 @@ static const unsigned short pageMap\[\] = {" puts $f $line set lastpage [expr {[lindex $line end] >> $shift}] puts stdout "lastpage: $lastpage" - puts $f "#if TCL_UTF_MAX > 3" + puts $f "#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6" set line " ," } append line [lindex $pMap $i] @@ -242,7 +242,7 @@ static const unsigned char groupMap\[\] = {" set lastj [expr {[llength $page] - 1}] if {$i == ($lastpage + 1)} { puts $f [string trimright $line " \t,"] - puts $f "#if TCL_UTF_MAX > 3" + puts $f "#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6" set line " ," } for {set j 0} {$j <= $lastj} {incr j} { @@ -342,7 +342,7 @@ static const int groups\[\] = {" puts $f $line puts -nonewline $f "}; -#if TCL_UTF_MAX > 3 +#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6 # define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1fffff) >= [format 0x%x $next]) #else # define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1f0000) != 0) @@ -401,7 +401,7 @@ enum { * Unicode character tables. */ -#if TCL_UTF_MAX > 3 +#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6 # define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0x1fffff) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\]) #else # define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0xffff) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\]) |
