os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tools/man2help.tcl
Update contrib.
3 # This file defines procedures that work in conjunction with the
4 # man2tcl program to generate a Windows help file from Tcl manual
7 # Copyright (c) 1996 by Sun Microsystems, Inc.
9 # RCS: @(#) $Id: man2help.tcl,v 1.13.2.1 2003/06/04 23:41:15 mistachkin Exp $
16 set man2tclprog [file join [file dirname [info script]] man2tcl.exe]
18 proc generateContents {basename version files} {
26 set fd [open [file join [file dirname [info script]] $basename$version.cnt] w]
27 fconfigure $fd -translation crlf
28 puts $fd ":Base $basename$version.hlp"
29 foreach package [getPackages] {
30 foreach section [getSections $package] {
31 if {![info exists lastSection]} {
34 if {[string compare $lastSection $section]} {
37 set lastSection $section
39 foreach topic [getTopics $package $section] {
40 if {[string compare $lastTopic $topic]} {
41 set id $topics($package,$section,$topic)
42 puts $fd "2 $topic=$id"
56 proc generateHelp {basename files} {
57 global curID topics keywords file id_keywords
60 foreach key [array names keywords] {
61 foreach id $keywords($key) {
62 lappend id_keywords($id) $key
66 set file [open [file join [file dirname [info script]] $basename.rtf] w]
67 fconfigure $file -translation crlf
68 puts $file "\{\\rtf1\\ansi \\deff0\\deflang1033\{\\fonttbl\{\\f0\\froman\\fcharset0\\fprq2 Times New Roman\;\}\{\\f1\\fmodern\\fcharset0\\fprq1 Courier New\;\}\}"
82 # Given a file as argument, translate the file to a tcl script and
86 # file - Name of file to translate.
90 if {[catch {eval [exec $man2tclprog [glob $file]]} msg]} {
101 # Given a directory as argument, translate all the man pages in
105 # dir - Name of the directory.
108 puts "Generating man pages for $dir..."
109 foreach f [lsort [glob -directory $dir "*.\[13n\]"]] {
114 # process command line arguments
117 puts stderr "usage: $argv0 \[options\] projectName version manFiles..."
123 if {![string compare [lindex $argv $arg] "-bitmap"]} {
124 set bitmap [lindex $argv [incr arg]]
127 set baseName [lindex $argv $arg]
128 set version [lindex $argv [incr arg]]
130 foreach i [lrange $argv [incr arg] end] {
132 if {[file isdir $i]} {
133 foreach f [lsort [glob -directory $i "*.\[13n\]"]] {
136 } elseif {[file exists $i]} {
140 source [file join [file dirname [info script]] index.tcl]
141 generateContents $baseName $version $files
142 source [file join [file dirname [info script]] man2help2.tcl]
143 generateHelp $baseName $files