From ee5696ef47d4e0bb5ccc54377fde9c75edc18de2 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 7 Jun 2019 22:09:32 +0000 Subject: closes [c3a211e8a5995018c82e]: search of tcl/tk is more backwards compatible now + make some errors more verbose (e. g. if scan found nothing and no tcl/tk build expected) --- tools/tcltk-man2html-utils.tcl | 4 ++++ tools/tcltk-man2html.tcl | 33 +++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index 5a4550b..e851047 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -1566,6 +1566,10 @@ proc make-manpage-section {outputDir sectionDescriptor} { puts stderr "" } + if {![llength $manual(wing-toc)]} { + fatal "not table of contents." + } + # # make the wing table of contents for the section # diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index e4cf3e9..efb3cd6 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -32,6 +32,11 @@ set ::CSSFILE "docs.css" source [file join [file dirname [info script]] tcltk-man2html-utils.tcl] proc findversion {top name useversion} { + # Default search version is a glob pattern, switch it for string match: + if {$useversion eq {{,[8-9].[0-9]{,[.ab][0-9]{,[0-9]}}}}} { + set useversion {[8-9].[0-9]} + } + # Search: set upper [string toupper $name] foreach top1 [list $top $top/..] sub {{} generic} { foreach dirname [ @@ -152,22 +157,30 @@ proc parse_command_line {} { } if {$build_tcl} { - # Find Tcl. - 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 + # Find Tcl (firstly using glob pattern / backwards compatible way) + 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 $tcltkdir $tcldir" } if {$build_tk} { - # Find Tk. - 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 + # Find Tk (firstly using glob pattern / backwards compatible way) + 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 + } } puts "using Tk source directory $tkdir" } -- cgit v0.12