summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-10-27 04:11:46 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-10-27 04:11:46 (GMT)
commitd7be6d4cec335a1347fae7694ed8a6be6ddcf1b5 (patch)
treee9eb7ab02a36528e1e26d6c408b9ac684aa80ea2 /tools
parent1873e3116183bc74ea836f71406de17420072399 (diff)
downloadtcl-d7be6d4cec335a1347fae7694ed8a6be6ddcf1b5.zip
tcl-d7be6d4cec335a1347fae7694ed8a6be6ddcf1b5.tar.gz
tcl-d7be6d4cec335a1347fae7694ed8a6be6ddcf1b5.tar.bz2
merge updates from HEAD
Diffstat (limited to 'tools')
-rw-r--r--tools/man2help.tcl5
-rw-r--r--tools/man2help2.tcl61
-rw-r--r--tools/man2html2.tcl45
-rw-r--r--tools/man2tcl.c30
-rwxr-xr-xtools/tcltk-man2html.tcl70
5 files changed, 178 insertions, 33 deletions
diff --git a/tools/man2help.tcl b/tools/man2help.tcl
index 91fcb89..b7404b9 100644
--- a/tools/man2help.tcl
+++ b/tools/man2help.tcl
@@ -6,14 +6,15 @@
#
# Copyright (c) 1996 by Sun Microsystems, Inc.
#
-# RCS: @(#) $Id: man2help.tcl,v 1.14 2003/06/04 23:40:18 mistachkin Exp $
+# RCS: @(#) $Id: man2help.tcl,v 1.14.12.1 2007/10/27 04:11:48 dgp Exp $
#
#
# PASS 1
#
-set man2tclprog [file join [file dirname [info script]] man2tcl.exe]
+set man2tclprog [file join [file dirname [info script]] \
+ man2tcl[file extension [info nameofexecutable]]]
proc generateContents {basename version files} {
global curID topics
diff --git a/tools/man2help2.tcl b/tools/man2help2.tcl
index 62b5b2e..a5ec3a9 100644
--- a/tools/man2help2.tcl
+++ b/tools/man2help2.tcl
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: man2help2.tcl,v 1.15 2004/07/07 12:08:43 dkf Exp $
+# RCS: @(#) $Id: man2help2.tcl,v 1.15.12.1 2007/10/27 04:11:48 dgp Exp $
#
# Global variables used by these scripts:
@@ -425,6 +425,21 @@ proc macro {name args} {
}
VE {}
VS {}
+ QW {
+ formattedText "``[lindex $args 0]''[lindex $args 1] "
+ }
+ MT {
+ text "``'' "
+ }
+ PQ {
+ formattedText \
+ "(``[lindex $args 0]''[lindex $args 1])[lindex $args 2] "
+ }
+ QR {
+ formattedText "``[lindex $args 0]"
+ dash
+ formattedText "[lindex $args 1]''[lindex $args 2] "
+ }
default {
puts stderr "Unknown macro: .$name [join $args " "]"
}
@@ -516,13 +531,12 @@ proc formattedText {text} {
dash
set text [string range $text [expr {$index+2}] end]
}
- | {
+ & - | {
set text [string range $text [expr {$index+2}] end]
}
- o {
- text "\\'"
- regexp {'([^']*)'(.*)} $text all ch text
- text $chars($ch)
+ ( {
+ char [string range $text $index [expr {$index+3}]]
+ set text [string range $text [expr {$index+4}] end]
}
default {
puts stderr "Unknown sequence: \\$c"
@@ -665,32 +679,51 @@ proc char {name} {
global file state
switch -exact $name {
- \\o {
+ {\o} {
set state(intl) 1
}
- \\\ {
+ {\ } {
textSetup
puts -nonewline $file " "
}
- \\0 {
+ {\0} {
textSetup
puts -nonewline $file " \\emspace "
}
- \\\\ {
+ {\\} - {\e} {
textSetup
puts -nonewline $file "\\\\"
}
- \\(+- {
+ {\(+-} {
textSetup
puts -nonewline $file "\\'b1 "
}
- \\% -
- \\| {
+ {\%} - {\|} {
}
- \\(bu {
+ {\(->} {
+ textSetup
+ puts -nonewline $file "->"
+ }
+ {\(bu} {
textSetup
puts -nonewline $file "\\bullet "
}
+ {\(co} {
+ textSetup
+ puts -nonewline $file "\\'a9 "
+ }
+ {\(mu} {
+ textSetup
+ puts -nonewline $file "\\'d7 "
+ }
+ {\(em} {
+ textSetup
+ puts -nonewline $file "-"
+ }
+ {\(fm} {
+ textSetup
+ puts -nonewline $file "\\'27 "
+ }
default {
puts stderr "Unknown character: $name"
}
diff --git a/tools/man2html2.tcl b/tools/man2html2.tcl
index d1887b5..9415044 100644
--- a/tools/man2html2.tcl
+++ b/tools/man2html2.tcl
@@ -6,7 +6,7 @@
#
# Copyright (c) 1996 by Sun Microsystems, Inc.
#
-# $Id: man2html2.tcl,v 1.9.8.1 2007/10/19 14:30:02 dgp Exp $
+# $Id: man2html2.tcl,v 1.9.8.2 2007/10/27 04:11:49 dgp Exp $
#
package require Tcl 8.4
@@ -308,7 +308,11 @@ proc macro {name args} {
font B
set temp $textState
set textState REF
- text options
+ if {[llength $args] > 0} {
+ text [lindex $args 0]
+ } else {
+ text options
+ }
set textState $temp
font R
text " manual entry for detailed descriptions of the above options."
@@ -374,6 +378,43 @@ proc macro {name args} {
# }
# puts -nonewline $file "<FONT COLOR=\"GREEN\">"
}
+ QW {
+ puts -nonewline $file "&\#147;"
+ text [lindex $args 0]
+ puts -nonewline $file "&\#148;"
+ if {[llength $args] > 1} {
+ text [lindex $args 1]
+ }
+ }
+ PQ {
+ puts -nonewline $file "(&\#147;"
+ if {[lindex $args 0] eq {\N'34'}} {
+ puts -nonewline $file \"
+ } else {
+ text [lindex $args 0]
+ }
+ puts -nonewline $file "&\#148;"
+ if {[llength $args] > 1} {
+ text [lindex $args 1]
+ }
+ puts -nonewline $file ")"
+ if {[llength $args] > 2} {
+ text [lindex $args 2]
+ }
+ }
+ QR {
+ puts -nonewline $file "&\#147;"
+ text [lindex $args 0]
+ puts -nonewline $file "&\#148;&\#150;&\#147;"
+ text [lindex $args 1]
+ puts -nonewline $file "&\#148;"
+ if {[llength $args] > 2} {
+ text [lindex $args 2]
+ }
+ }
+ MT {
+ puts -nonewline $file "&\#147;&\#148;"
+ }
default {
puts stderr "Unknown macro: .$name [join $args " "]"
}
diff --git a/tools/man2tcl.c b/tools/man2tcl.c
index a90b729..9bad547 100644
--- a/tools/man2tcl.c
+++ b/tools/man2tcl.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: man2tcl.c,v 1.11 2007/01/19 08:17:35 mistachkin Exp $
+ * RCS: @(#) $Id: man2tcl.c,v 1.11.2.1 2007/10/27 04:11:51 dgp Exp $
*/
static char sccsid[] = "@(#) man2tcl.c 1.3 95/08/12 17:34:08";
@@ -329,6 +329,9 @@ DoText(
p++;
} else if (*p == '&') {
p++;
+ } else if (*p == '0') {
+ PRINT(("text { }\n"));
+ p++;
} else if (*p == '(') {
if ((p[1] == 0) || (p[2] == 0)) {
fprintf(stderr, "Bad \\( sequence on line %d.\n",
@@ -338,6 +341,13 @@ DoText(
PRINT(("char {\\(%c%c}\n", p[1], p[2]));
p += 3;
}
+ } else if (*p == 'N' && *(p+1) == '\'') {
+ int ch;
+
+ p += 2;
+ sscanf(p,"%d",&ch);
+ PRINT(("text \\u%04x", ch));
+ while(*p&&*p!='\'') p++;
} else if (*p != 0) {
PRINT(("char {\\%c}\n", *p));
p++;
@@ -377,7 +387,23 @@ QuoteText(
}
for ( ; count > 0; string++, count--) {
switch (*string) {
- case '$': case '[': case '{': case ' ': case ';': case '\\':
+ case '\\':
+ if (*(string+1) == 'N' && *(string+2) == '\'') {
+ int ch;
+
+ string += 3;
+ count -= 3;
+ sscanf(string,"%d",&ch);
+ PRINT(("\\u%04x", ch));
+ while(count>0&&*string!='\'') {string++;count--;}
+ continue;
+ } else if (*(string+1) == '0') {
+ PRINT(("\\ "));
+ string++;
+ count--;
+ continue;
+ }
+ case '$': case '[': case '{': case ' ': case ';':
case '"': case '\t':
PRINTC('\\');
default:
diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl
index a107067..b71602c 100755
--- a/tools/tcltk-man2html.tcl
+++ b/tools/tcltk-man2html.tcl
@@ -179,7 +179,7 @@ proc copyright {copyright {level {}}} {
#return "<A HREF=\"$page\">Copyright</A> &#169; [htmlize-text [lrange $copyright 2 end]]"
# obfuscate any email addresses that may appear in name
set who [string map {@ (at)} [lrange $copyright 2 end]]
- return "Copyright &#169; [htmlize-text $who]"
+ return "Copyright &copy; [htmlize-text $who]"
}
proc copyout {copyrights {level {}}} {
set out "<div class=\"copy\">"
@@ -325,7 +325,10 @@ proc htmlize-text {text {charmap {}}} {
{\0} { } \
\" {&quot;} \
{<} {&lt;} \
- {>} {&gt;}
+ {>} {&gt;} \
+ \u201c "&#8220;" \
+ \u201d "&#8221;"
+
return [string map $charmap $text]
}
@@ -337,6 +340,11 @@ proc process-text {text} {
{\%} {} \
"\\\n" "\n" \
{\(+-} "&#177;" \
+ {\(co} "&copy;" \
+ {\(em} "&#8212;" \
+ {\(fm} "&#8242;" \
+ {\(mu} "&#215;" \
+ {\(->} "<font size=\"+1\">&#8594;</font>" \
{\fP} {\fR} \
{\.} . \
{\(bu} "&#8226;" \
@@ -346,6 +354,8 @@ proc process-text {text} {
lappend charmap {\-} - ; # a hyphen
set text [htmlize-text $text $charmap]
+ # General quoted entity
+ regsub -all {\\N'(\d+)'} $text "\\&#\\1;" text
while {[string first "\\" $text] >= 0} {
# C R
if {[regsub {^([^\\]*)\\fC([^\\]*)\\fR(.*)$} $text \
@@ -678,10 +688,7 @@ proc output-IP-list {context code rest} {
}
}
}
- .sp -
- .br -
- .DS -
- .CS {
+ .sp - .br - .DS - .CS {
output-directive $line
}
.RS {
@@ -1063,8 +1070,7 @@ proc output-directive {line} {
# process format directive
split-directive $line code rest
switch -exact $code {
- .BS -
- .BE {
+ .BS - .BE {
# man-puts <HR>
}
.SH - .SS {
@@ -1368,7 +1374,8 @@ proc output-directive {line} {
## merge copyright listings
##
proc merge-copyrights {l1 l2} {
- set re1 {^Copyright +\(c\) +(\w.*?)(?:all rights reserved)?(?:\. )*$}
+ set merge {}
+ set re1 {^Copyright +(?:\(c\)|\\\(co|&copy;) +(\w.*?)(?:all rights reserved)?(?:\. )*$}
set re2 {^(\d+) +(?:by +)?(\w.*)$} ;# date who
set re3 {^(\d+)-(\d+) +(?:by +)?(\w.*)$} ;# from to who
set re4 {^(\d+), *(\d+) +(?:by +)?(\w.*)$} ;# date1 date2 who
@@ -1393,9 +1400,9 @@ proc merge-copyrights {l1 l2} {
foreach who [array names dates] {
set list [lsort -dictionary $dates($who)]
if {[llength $list] == 1 || [lindex $list 0] == [lrange $list end end]} {
- lappend merge "Copyright (c) [lindex $list 0] $who"
+ lappend merge "Copyright &copy; [lindex $list 0] $who"
} else {
- lappend merge "Copyright (c) [lindex $list 0]-[lrange $list end end] $who"
+ lappend merge "Copyright &copy; [lindex $list 0]-[lrange $list end end] $who"
}
}
return [lsort -dictionary $merge]
@@ -1460,6 +1467,8 @@ proc make-man-pages {html args} {
set manual(pages) "[lindex $manual(pages) $n] [lreplace $manual(pages) $n $n]"
}
# set manual(pages) [lrange $manual(pages) 0 5]
+ set LQ \u201c
+ set RQ \u201d
foreach manual(page) $manual(pages) {
# whistle
puts stderr "scanning page $manual(page)"
@@ -1482,13 +1491,13 @@ proc make-man-pages {html args} {
set manual(section-toc) {}
set manual(section-toc-n) 1
set manual(copyrights) {}
- lappend manual(copyrights) "Copyright (c) 1995-1997 Roger E. Critchlow Jr."
+ lappend manual(copyrights) "Copyright &copy; 1995-1997 Roger E. Critchlow Jr."
lappend manual(all-pages) $manual(wing-file)/$manual(tail)
manreport 100 $manual(name)
while {[gets $manual(infp) line] >= 0} {
manreport 100 $line
if {[regexp {^[`'][/\\]} $line]} {
- if {[regexp {Copyright \(c\).*$} $line copyright]} {
+ if {[regexp {Copyright (?:\(c\)|\\\(co).*$} $line copyright]} {
lappend manual(copyrights) $copyright
}
# comment
@@ -1520,6 +1529,41 @@ proc make-man-pages {html args} {
.TH {
lappend manual(text) "$code [unquote $rest]"
}
+ .QW {
+ set rest [regexp -all -inline {\"(?:[^""]+)\"|\S+} $rest]
+ set s $LQ[unquote [lindex $rest 0]]$RQ[unquote [lindex $rest 1]]
+ if {$manual(partial-text) == ""} {
+ set manual(partial-text) $s
+ } else {
+ append manual(partial-text) \n$s
+ }
+ }
+ .PQ {
+ set rest [regexp -all -inline {\"(?:[^""]+)\"|\S+} $rest]
+ set s ($LQ[unquote [lindex $rest 0]]$RQ[unquote [lindex $rest 1]])[unquote [lindex $rest 2]]
+ if {$manual(partial-text) == ""} {
+ set manual(partial-text) $s
+ } else {
+ append manual(partial-text) \n$s
+ }
+ }
+ .QR {
+ set rest [regexp -all -inline {\"(?:[^""]+)\"|\S+} $rest]
+ set s $LQ[unquote [lindex $rest 0]]-[unquote [lindex $rest 1]]$RQ[unquote [lindex $rest 2]]
+ if {$manual(partial-text) == ""} {
+ set manual(partial-text) $s
+ } else {
+ append manual(partial-text) \n$s
+ }
+ }
+ .MT {
+ set s $LQ$RQ
+ if {$manual(partial-text) == ""} {
+ set manual(partial-text) $s
+ } else {
+ append manual(partial-text) \n$s
+ }
+ }
.HS - .UL -
.ta {
lappend manual(text) "$code [unquote $rest]"