summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwlemb <wlemb>2002-05-15 01:11:18 +0000
committerwlemb <wlemb>2002-05-15 01:11:18 +0000
commit8f90d499189ca6f2ef8615ecc8104c15ecd1aa08 (patch)
treea431c995e240efee76f8f8fb8670b635bc43b692 /src
parent84122cb3601f293232c153b3d9c057b96fc76a21 (diff)
downloadgroff-8f90d499189ca6f2ef8615ecc8104c15ecd1aa08.tar.gz
* src/roff/troff/env.cc(hyphen_trie::hpf_getc): Accept ^^x (char
code of x in range 0-127) also. * doc/groff.texinfo, man/groff_diff.man: Updated.
Diffstat (limited to 'src')
-rw-r--r--src/roff/troff/env.cc43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc
index 2d677745..57630c92 100644
--- a/src/roff/troff/env.cc
+++ b/src/roff/troff/env.cc
@@ -3477,9 +3477,8 @@ void hyphen_trie::do_delete(void *v)
. No support for digraphs and like `\$'.
- . The only multi-character construction recognized is `^^xx' (`x' is
- 0-9 or a-f), handled by `hpf_getc'; other use of `^' causes an
- error.
+ . `^^xx' (`x' is 0-9 or a-f), and `^^x' (character code of `x' in the
+ range 0-127) are recognized; other use of `^' causes an error.
. No macro expansion.
@@ -3502,6 +3501,7 @@ void hyphen_trie::do_delete(void *v)
int hyphen_trie::hpf_getc(FILE *f)
{
int c = getc(f);
+ int c1;
int cc = 0;
if (c != '^')
return c;
@@ -3509,22 +3509,31 @@ int hyphen_trie::hpf_getc(FILE *f)
if (c != '^')
goto fail;
c = getc(f);
- if (c >= '0' && c <= '9')
- cc = (c - '0') * 16;
- else if (c >= 'a' && c <= 'f')
- cc = (c - 'a' + 10) * 16;
- else
- goto fail;
- c = getc(f);
- if (c >= '0' && c <= '9')
- cc += c - '0';
- else if (c >= 'a' && c <= 'f')
- cc += c - 'a' + 10;
- else
- goto fail;
+ c1 = getc(f);
+ if (((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'))
+ && ((c1 >= '0' && c1 <= '9') || (c1 >= 'a' && c1 <= 'f'))) {
+ if (c >= '0' && c <= '9')
+ c -= '0';
+ else
+ c = c - 'a' + 10;
+ if (c1 >= '0' && c1 <= '9')
+ c1 -= '0';
+ else
+ c1 = c1 - 'a' + 10;
+ cc = c * 16 + c1;
+ }
+ else {
+ ungetc(c1, f);
+ if (c >= 0 && c <= 63)
+ cc = c + 64;
+ else if (c >= 64 && c <= 127)
+ cc = c - 64;
+ else
+ goto fail;
+ }
return cc;
fail:
- error("`^' only allowed as `^^xx' in hyphenation patterns file");
+ error("invalid ^, ^^x, or ^^xx character in hyphenation patterns file");
return c;
}