summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/man2help.tcl5
-rw-r--r--tools/man2help2.tcl61
-rw-r--r--tools/man2tcl.c30
3 files changed, 78 insertions, 18 deletions
diff --git a/tools/man2help.tcl b/tools/man2help.tcl
index 91fcb89..c61085b 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.15 2007/10/26 14:32:16 dkf 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..7cd020c 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.16 2007/10/26 14:32:16 dkf 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/man2tcl.c b/tools/man2tcl.c
index a90b729..8ddeb20 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.12 2007/10/26 14:32:16 dkf 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: