summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2002-07-07 08:10:56 +0000
committerwlemb <wlemb>2002-07-07 08:10:56 +0000
commited9502220fca75eec0254f1c26c7258400ce25b5 (patch)
tree9e5bf7682f706b0f4ccff16204acabf5e9e72b6d
parentb1e38e988e773d47711d8cea364bec4c50bf6a12 (diff)
downloadgroff-ed9502220fca75eec0254f1c26c7258400ce25b5.tar.gz
Changing the substring request to make it fit better with other
string manipulation functions in other programming languages: Index 0 is now the first character in the string, and index -1 indicates the last character. Since this request didn't work properly anyway in the last release, it doesn't harm too much to change the syntax. * src/roff/troff/input.cc (substring_macro): Use loops to get the real string length (ignoring COMPATIBLE_SAVE and COMPATIBLE_RESTORE) and offsets. Implement change described above. * man/groff_char.man, tmac/doc-common (doc-header), tmac/doc.tmac (doc-do-Bd-args, doc-do-Bl-args: Changed accordingly. * NEWS, doc/groff.texinfo, man/groff_diff.man: Updated. Make .chop work with .de1 and friends. COMPATIBLE_SAVE and COMPATIBLE_RESTORE are completely ignored. * src/roff/troff/input.cc (char_list::set, char_list::get): New functions. (macro): `length' field renamed to `len'. Added new field `empty_macro' (1 if macro is empty), to be used instead of checking `len'. Updated all callers. (macro::empty): Updated. (macro::length, macro::set, macro::get): New functions. (macro::append): Ignore COMPATIBLE_SAVE and COMPATIBLE_RESTORE. Set `empty_macro'. (chop_macro): Check and remove trailing COMPATIBLE_SAVE/ COMPATIBLE_RESTORE pairs. (asciify): Ignore COMPATIBLE_SAVE and COMPATIBLE_RESTORE. * src/roff/troff/request.h: Updated. * doc/groff.texinfo: Document .chop's behaviour better. * doc/pic.ms: Fix documentation for the addition of positions. * tmac/doc.tmac, tmac/an-old.tmac: Need groff version 1.18.
-rw-r--r--ChangeLog47
-rw-r--r--NEWS6
-rw-r--r--doc/groff.texinfo17
-rw-r--r--doc/pic.ms25
-rw-r--r--man/groff_char.man2
-rw-r--r--man/groff_diff.man20
-rw-r--r--src/roff/groff/groff.cc4
-rw-r--r--src/roff/troff/input.cc208
-rw-r--r--src/roff/troff/request.h8
-rw-r--r--tmac/an-old.tmac4
-rw-r--r--tmac/doc-common2
-rw-r--r--tmac/doc.tmac18
12 files changed, 265 insertions, 96 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ee000c4..648e239d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,50 @@
+2002-06-04 Werner LEMBERG <wl@gnu.org>
+
+ Changing the substring request to make it fit better with other
+ string manipulation functions in other programming languages:
+ Index 0 is now the first character in the string, and index -1
+ indicates the last character. Since this request didn't work
+ properly anyway in the last release, it doesn't harm too much to
+ change the syntax.
+
+ * src/roff/troff/input.cc (substring_macro): Use loops to get
+ the real string length (ignoring COMPATIBLE_SAVE and
+ COMPATIBLE_RESTORE) and offsets.
+ Implement change described above.
+
+ * man/groff_char.man, tmac/doc-common (doc-header), tmac/doc.tmac
+ (doc-do-Bd-args, doc-do-Bl-args: Changed accordingly.
+
+ * NEWS, doc/groff.texinfo, man/groff_diff.man: Updated.
+
+2002-06-03 Werner LEMBERG <wl@gnu.org>
+
+ Make .chop work with .de1 and friends. COMPATIBLE_SAVE and
+ COMPATIBLE_RESTORE are completely ignored.
+
+ * src/roff/troff/input.cc (char_list::set, char_list::get): New
+ functions.
+ (macro): `length' field renamed to `len'.
+ Added new field `empty_macro' (1 if macro is empty), to be used
+ instead of checking `len'.
+ Updated all callers.
+ (macro::empty): Updated.
+ (macro::length, macro::set, macro::get): New functions.
+ (macro::append): Ignore COMPATIBLE_SAVE and COMPATIBLE_RESTORE.
+ Set `empty_macro'.
+ (chop_macro): Check and remove trailing COMPATIBLE_SAVE/
+ COMPATIBLE_RESTORE pairs.
+ (asciify): Ignore COMPATIBLE_SAVE and COMPATIBLE_RESTORE.
+ * src/roff/troff/request.h: Updated.
+
+ * doc/groff.texinfo: Document .chop's behaviour better.
+
+2002-06-02 Werner LEMBERG <wl@gnu.org>
+
+ * doc/pic.ms: Fix documentation for the addition of positions.
+
+ * tmac/doc.tmac, tmac/an-old.tmac: Need groff version 1.18.
+
2002-06-29 Werner LEMBERG <wl@gnu.org>
Implementation of string arguments of the form \*[foo arg1 arg2 ...]
diff --git a/NEWS b/NEWS
index 9b5d343f..5bf1e9a7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-4~This file describes recent user-visible changes in groff. Bug fixes are not
+This file describes recent user-visible changes in groff. Bug fixes are not
described. There are more details in the man and info pages.
VERSION 1.18
@@ -104,6 +104,10 @@ o Two new requests `ds1' and `as1' which are similar to `ds' and `as' but
with compatibility mode disabled during expansion of strings defined by
them.
+o The syntax of the `substring' request has been changed: The first
+ character in a string now has index 0, the last character has index -1.
+ Note that this is an incompatible change.
+
o `.hpf' has been extended. It can now handle most TeX hyphenation
patterns file without modification. To do that, the commands \patterns,
\hyphenation, and \endinput are recognized. Please refer to groff_diff.7
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index 2f79d13a..0d6369fd 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -9222,15 +9222,15 @@ requests.
@cindex substring (@code{substring})
Replace the string named @var{str} with the substring
defined by the indices @var{n1} and@w{ }@var{n2}. The first character
-in the string has index one. If @var{n2} is omitted, it is taken to
+in the string has index@w{ }0. If @var{n2} is omitted, it is taken to
be equal to the string's length. If the index value @var{n1} or
-@var{n2} is negative or zero, it is counted from the end of the
-string, going backwards: The last character has index@w{ }0, the
-character before the last character has index@w{ }@minus{}1, etc.
+@var{n2} is negative, it is counted from the end of the
+string, going backwards: The last character has index@w{ }@minus{}1, the
+character before the last character has index@w{ }@minus{}2, etc.
@Example
.ds xxx abcdefgh
-.substring xxx 2 -3
+.substring xxx 1 -4
\*[xxx]
@result{} bcde
@endExample
@@ -9295,7 +9295,7 @@ type @samp{mac} and ignores the request.
@Defreq {chop, xx}
Remove (chop) the last character from the macro, string, or diversion
-named @var{xx}. This is useful for removing the newline from the end
+named @var{xx}. This is useful for removing the newline from the end
of diversions that are to be interpolated as strings. This command
can be used repeatedly; see @ref{Gtroff Internals}, for details on
nodes inserted additionally by @code{gtroff}.
@@ -11926,6 +11926,11 @@ the @code{unformat} request.
Macros only contain elements in the token list (and the node list is
empty); diversions and strings can contain elements in both lists.
+Note that the @code{chop} request simply reduces the number of elements in a
+macro, string, or diversion by one. Exceptions are @dfn{compatibility save}
+and @dfn{compatibility ignore} input tokens which are ignored. The
+@code{substring} request also ignores those input tokens.
+
Some requests like @code{tr} or @code{cflags} work on glyph
identifiers only; this means that the associated glyph can be changed
without destroying this association. This can be very helpful for
diff --git a/doc/pic.ms b/doc/pic.ms
index 45e531f7..a1f1d4f4 100644
--- a/doc/pic.ms
+++ b/doc/pic.ms
@@ -10,7 +10,7 @@
.\" This document was written for free use and redistribution by
.\" Eric S. Raymond <esr@thyrsus.com> in August 1995.
.\"
-.\" $Id: pic.ms,v 1.17 2002/06/24 18:10:28 wlemb Exp $
+.\" $Id: pic.ms,v 1.18 2002/07/07 08:10:57 wlemb Exp $
.\"
.\" Set a proper TeX
.ie t .ds tx T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
@@ -110,11 +110,11 @@ flow of data in \fBpic\fP processing:
.PS
ellipse "document";
arrow;
-box "\fIgpic\/\fP(1)"
+box width 0.6 "\fIgpic\/\fP(1)"
arrow;
-box width 1.2 "\fIgtbl\/\fP(1) or \fIgeqn\/\fP(1)" "(optional)" dashed;
+box width 1.1 "\fIgtbl\/\fP(1) or \fIgeqn\/\fP(1)" "(optional)" dashed;
arrow;
-box "\fIgtroff\/\fP(1)";
+box width 0.6 "\fIgtroff\/\fP(1)";
arrow;
ellipse "PostScript"
.PE
@@ -129,11 +129,11 @@ This was produced from the following \fBpic\fP program:
\&.PS
ellipse "document";
arrow;
-box "\efIpic\efP(1)"
+box width 0.6 "\efIpic\e/\efP(1)"
arrow;
-box width 1.2 "\efIgtbl\e/\efP(1) or \efIgeqn\e/\efP(1)" "(optional)" dashed;
+box width 1.1 "\efIgtbl\e/\efP(1) or \efIgeqn\e/\efP(1)" "(optional)" dashed;
arrow;
-box "\efIgtroff\e/\efP(1)";
+box width 0.6 "\efIgtroff\e/\efP(1)";
arrow;
ellipse "PostScript"
\&.PE
@@ -1016,7 +1016,9 @@ combine them to specify new positions.
.NH 3
Vector Sums and Displacements
.PP
-Any two positions may be added or subtracted to yield a new position.
+Positions may be added or subtracted to yield a new position (to be
+more precise, you can only add a position and an expression pair; the
+latter must be on the right side of the addition or subtraction sign).
The result is the conventional vector sum or difference of coordinates.
For example, \fBlast box .ne + (0.1, 0)\fP is a valid position. This
example illustrates a common use, to define a position slightly offset
@@ -1652,6 +1654,7 @@ behavior is therefore equivalent to \fBuntil .PE\fP).
.PP
Accordingly, the command
.RS
+.KS
.IP
.ft CW
.nf
@@ -1665,10 +1668,12 @@ box
\&.PE
.R
.fi
+.KE
.RE
.LP
is equivalent to
.RS
+.KS
.IP
.ft CW
.nf
@@ -1680,6 +1685,7 @@ box
\&.PE
.R
.fi
+.KE
.RE
.NH 2
Debug Messages
@@ -1846,7 +1852,8 @@ gets decorated with two numeric arguments which are the X and
Y\~dimensions of the picture in inches. The post-processor can use
these to reserve space for the picture and center it.
.PP
-The \fBmgs\fP macros, for example, include the following definitions:
+The GNU incarnation of the \fBms\fP macro package, for example, includes
+the following definitions:
.KS
.DS
.ps -1
diff --git a/man/groff_char.man b/man/groff_char.man
index 5c06e2d6..d21757b0 100644
--- a/man/groff_char.man
+++ b/man/groff_char.man
@@ -37,7 +37,7 @@ the original English.
. if '\*[.T]'dvi' .if !r ECFONTS .ds aq \'
. \" The same is true for X
. ds dev \*[.T]
-. substring dev 1 1
+. substring dev 0 0
. if '\*[dev]'X' .ds aq \'
.\}
.
diff --git a/man/groff_diff.man b/man/groff_diff.man
index 0c6df2e6..c6c1c23a 100644
--- a/man/groff_diff.man
+++ b/man/groff_diff.man
@@ -3,7 +3,7 @@
.ig
groff_diff.man
-Last update : 29 June 2002
+Last update : 05 July 2002
This file is part of groff, the GNU roff type-setting system.
It is the source of the man-page groff_diff(7).
@@ -47,8 +47,12 @@ FDL in the main directory of the groff source package.
.
.\" --------------------------------------------------------------------
.\" start of macro definitions
+.
.eo
.
+.de c
+..
+.
.de TQ
. br
. ns
@@ -68,12 +72,12 @@ FDL in the main directory of the groff source package.
. Text \[oq]\f[B]\*[@arg1]\f[]\[cq]\$*
. rm @arg1
..
-.\" A shell command line
+.c A shell command line
.de ShellCommand
. br
. IR "shell#" "\h'1m'\f[CB]\$*\f[]\/"
..
-.\" reference of a request or macro
+.c reference of a request or macro
.de request
. ds @arg1 \$1
. shift 1
@@ -83,7 +87,7 @@ FDL in the main directory of the groff source package.
..
.als option request
.
-.\" representation of an escape sequence
+.c representation of an escape sequence
.de esc
. ds @arg1 \$1
. shift
@@ -2038,7 +2042,7 @@ with the substring defined by the indices
.I n1
and
.IR n2 .
-The first character in the string has index one.
+The first character in the string has index\~0.
.
If
.I n2
@@ -2048,11 +2052,11 @@ If the index value
.I n1
or
.I n2
-is negative or zero, it will be counted from the end of the string,
+is negative, it will be counted from the end of the string,
going backwards:
.
-The last character has index\~0, the character before the last
-character has index\~-1, etc.
+The last character has index\~-1, the character before the last
+character has index\~-2, etc.
.
.TP
.BI .tkf\ f\ s1\ n1\ s2\ n2
diff --git a/src/roff/groff/groff.cc b/src/roff/groff/groff.cc
index 82c1c987..25cea346 100644
--- a/src/roff/groff/groff.cc
+++ b/src/roff/groff/groff.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2000, 2001, 2002 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -178,7 +178,7 @@ int main(int argc, char **argv)
vflag = 1;
{
printf("GNU groff version %s\n", Version_string);
- printf("Copyright (C) 1989-2001 Free Software Foundation, Inc.\n"
+ printf("Copyright (C) 2002 Free Software Foundation, Inc.\n"
"GNU groff comes with ABSOLUTELY NO WARRANTY.\n"
"You may redistribute copies of groff and its subprograms\n"
"under the terms of the GNU General Public License.\n"
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index a4d28682..1ce5061e 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -2788,6 +2788,8 @@ public:
char_list();
~char_list();
void append(unsigned char);
+ void set(unsigned char, int);
+ unsigned char get(int);
int length();
private:
unsigned char *ptr;
@@ -2834,6 +2836,44 @@ void char_list::append(unsigned char c)
len++;
}
+void char_list::set(unsigned char c, int offset)
+{
+ assert(len > offset);
+ // optimization for access at the end
+ int boundary = len - len % char_block::SIZE;
+ if (offset >= boundary) {
+ *(tail->s + offset - boundary) = c;
+ return;
+ }
+ char_block *tem = head;
+ int l = 0;
+ for (;;) {
+ l += char_block::SIZE;
+ if (l > offset) {
+ *(tem->s + offset % char_block::SIZE) = c;
+ return;
+ }
+ tem = tem->next;
+ }
+}
+
+unsigned char char_list::get(int offset)
+{
+ assert(len > offset);
+ // optimization for access at the end
+ int boundary = len - len % char_block::SIZE;
+ if (offset >= boundary)
+ return *(tail->s + offset - boundary);
+ char_block *tem = head;
+ int l = 0;
+ for (;;) {
+ l += char_block::SIZE;
+ if (l > offset)
+ return *(tem->s + offset % char_block::SIZE);
+ tem = tem->next;
+ }
+}
+
class node_list {
node *head;
node *tail;
@@ -2906,12 +2946,14 @@ macro::macro()
filename = 0;
lineno = 0;
}
- length = 0;
+ len = 0;
+ empty_macro = 1;
p = 0;
}
macro::macro(const macro &m)
-: p(m.p), filename(m.filename), lineno(m.lineno), length(m.length)
+: p(m.p), filename(m.filename), lineno(m.lineno), len(m.len),
+ empty_macro(m.empty_macro)
{
if (p != 0)
p->count++;
@@ -2927,7 +2969,8 @@ macro &macro::operator=(const macro &m)
p = m.p;
filename = m.filename;
lineno = m.lineno;
- length = m.length;
+ len = m.len;
+ empty_macro = m.empty_macro;
return *this;
}
@@ -2936,14 +2979,34 @@ void macro::append(unsigned char c)
assert(c != 0);
if (p == 0)
p = new macro_header;
- if (p->cl.length() != length) {
- macro_header *tem = p->copy(length);
+ if (p->cl.length() != len) {
+ macro_header *tem = p->copy(len);
if (--(p->count) <= 0)
delete p;
p = tem;
}
p->cl.append(c);
- ++length;
+ ++len;
+ if (c != COMPATIBLE_SAVE && c != COMPATIBLE_RESTORE)
+ empty_macro = 0;
+}
+
+void macro::set(unsigned char c, int offset)
+{
+ assert(p != 0);
+ assert(c != 0);
+ p->cl.set(c, offset);
+}
+
+unsigned char macro::get(int offset)
+{
+ assert(p != 0);
+ return p->cl.get(offset);
+}
+
+int macro::length()
+{
+ return len;
}
void macro::append_str(const char *s)
@@ -2963,15 +3026,16 @@ void macro::append(node *n)
assert(n != 0);
if (p == 0)
p = new macro_header;
- if (p->cl.length() != length) {
- macro_header *tem = p->copy(length);
+ if (p->cl.length() != len) {
+ macro_header *tem = p->copy(len);
if (--(p->count) <= 0)
delete p;
p = tem;
}
p->cl.append(0);
p->nl.append(n);
- ++length;
+ ++len;
+ empty_macro = 0;
}
void macro::append_unsigned(unsigned int i)
@@ -2993,7 +3057,7 @@ void macro::append_int(int i)
void macro::print_size()
{
- errprint("%1", length);
+ errprint("%1", len);
}
// make a copy of the first n bytes
@@ -3064,7 +3128,7 @@ string_iterator::string_iterator(const macro &m, const char *p, symbol s)
: mac(m), how_invoked(p),
newline_flag(0), suppress_newline_flag(0), lineno(1), nm(s)
{
- count = mac.length;
+ count = mac.len;
if (count != 0) {
bp = mac.p->cl.head;
nd = mac.p->nl.head;
@@ -3136,8 +3200,6 @@ int string_iterator::peek()
if (count <= 0)
return EOF;
const unsigned char *p = eptr;
- if (count <= 0)
- return EOF;
if (p >= bp->s + char_block::SIZE) {
p = bp->next->s;
}
@@ -3265,7 +3327,7 @@ input_iterator *make_temp_iterator(const char *s)
}
}
-// this is used when macros are interpolated using the .macro_name notation
+// this is used when macros with arguments are interpolated
struct arg_list {
macro mac;
@@ -3337,11 +3399,11 @@ void macro_iterator::shift(int n)
int operator==(const macro &m1, const macro &m2)
{
- if (m1.length != m2.length)
+ if (m1.len != m2.len)
return 0;
string_iterator iter1(m1);
string_iterator iter2(m2);
- int n = m1.length;
+ int n = m1.len;
while (--n >= 0) {
node *nd1 = 0;
int c1 = iter1.get(&nd1);
@@ -3516,7 +3578,7 @@ macro *macro::to_macro()
int macro::empty()
{
- return length == 0;
+ return empty_macro == 1;
}
macro_iterator::macro_iterator(symbol s, macro &m, const char *how_invoked)
@@ -4103,41 +4165,70 @@ void chop_macro()
macro *m = p->to_macro();
if (!m)
error("cannot chop request");
- else if (m->length == 0)
+ else if (m->empty())
error("cannot chop empty macro");
- else
- m->length -= 1;
+ else {
+ int have_restore = 0;
+ // we have to check for additional save/restore pairs which could be
+ // there due to empty am1 requests.
+ for (;;) {
+ if (m->get(m->len - 1) != COMPATIBLE_RESTORE)
+ break;
+ have_restore = 1;
+ m->len -= 1;
+ if (m->get(m->len - 1) != COMPATIBLE_SAVE)
+ break;
+ have_restore = 0;
+ m->len -= 1;
+ if (m->len == 0)
+ break;
+ }
+ if (m->len == 0)
+ error("cannot chop empty macro");
+ else {
+ if (have_restore)
+ m->set(COMPATIBLE_RESTORE, m->len - 1);
+ else
+ m->len -= 1;
+ }
+ }
}
skip_line();
}
void substring_macro()
{
- int start;
+ int start; // 0, 1, ..., n-1 or -1, -2, ...
symbol s = get_name(1);
if (!s.is_null() && get_integer(&start)) {
request_or_macro *p = lookup_request(s);
macro *m = p->to_macro();
if (!m)
- error("cannot substring request");
+ error("cannot apply `substring' on a request");
else {
- if (start <= 0)
- start += m->length - 1;
- else
- start--;
- int end = 0;
+ int end = -1;
if (!has_arg() || get_integer(&end)) {
- if (end <= 0)
- end += m->length - 1;
- else
- end--;
+ int real_length = 0; // 1, 2, ..., n
+ string_iterator iter1(*m);
+ for (int l = 0; l < m->len; l++) {
+ int c = iter1.get(0);
+ if (c == COMPATIBLE_SAVE || c == COMPATIBLE_RESTORE)
+ continue;
+ if (c == EOF)
+ break;
+ real_length++;
+ }
+ if (start < 0)
+ start += real_length;
+ if (end < 0)
+ end += real_length;
if (start > end) {
int tem = start;
start = end;
end = tem;
}
- if (start >= m->length || end < 0) {
- m->length = 0;
+ if (start >= real_length || end < 0) {
+ m->len = 0;
if (m->p) {
if (--(m->p->count) <= 0)
delete m->p;
@@ -4148,29 +4239,32 @@ void substring_macro()
}
if (start < 0)
start = 0;
- if (end >= m->length)
- end = m->length - 1;
- if (start == 0)
- m->length = end + 1;
- else {
- string_iterator iter(*m);
- int i;
- for (i = 0; i < start; i++)
- if (iter.get(0) == EOF)
- break;
- macro mac;
- for (; i <= end; i++) {
- node *nd;
- int c = iter.get(&nd);
- if (c == EOF)
- break;
- if (c == 0)
- mac.append(nd);
- else
- mac.append((unsigned char)c);
- }
- *m = mac;
+ if (end >= real_length)
+ end = real_length - 1;
+ // now extract the substring
+ string_iterator iter(*m);
+ int i;
+ for (i = 0; i < start; i++) {
+ int c = iter.get(0);
+ while (c == COMPATIBLE_SAVE || c == COMPATIBLE_RESTORE)
+ c = iter.get(0);
+ if (c == EOF)
+ break;
}
+ macro mac;
+ for (; i <= end; i++) {
+ node *nd;
+ int c = iter.get(&nd);
+ while (c == COMPATIBLE_SAVE || c == COMPATIBLE_RESTORE)
+ c = iter.get(0);
+ if (c == EOF)
+ break;
+ if (c == 0)
+ mac.append(nd);
+ else
+ mac.append((unsigned char)c);
+ }
+ *m = mac;
}
}
}
@@ -5520,6 +5614,10 @@ const char *asciify(int c)
case ESCAPE_COLON:
buf[1] = ':';
break;
+ case COMPATIBLE_SAVE:
+ case COMPATIBLE_RESTORE:
+ buf[0] = '\0';
+ break;
default:
if (invalid_input_char(c))
buf[0] = '\0';
diff --git a/src/roff/troff/request.h b/src/roff/troff/request.h
index 5654b830..96ced224 100644
--- a/src/roff/troff/request.h
+++ b/src/roff/troff/request.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
@@ -48,7 +48,8 @@ class macro : public request_or_macro {
macro_header *p;
const char *filename; // where was it defined?
int lineno;
- int length;
+ int len;
+ int empty_macro;
public:
macro();
~macro();
@@ -59,6 +60,9 @@ public:
void append_unsigned(unsigned int i);
void append_int(int i);
void append_str(const char *);
+ void set(unsigned char, int);
+ unsigned char get(int);
+ int length();
void invoke(symbol);
macro *to_macro();
void print_size();
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index fd133b3e..d1b9d03d 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -41,8 +41,8 @@
.nr _C \n(.C
.cp 0
.
-.if (\n[.x]\n[.y]\n[.Y] < 1171) \
-. ab You need GNU troff version 1.17.1 or higher to run this version of man!
+.if (\n[.x]\n[.y] < 118) \
+. ab You need GNU troff version 1.18 or higher to run this version of man!
.
.if !r D .nr D 0
.if !r C .nr C 0
diff --git a/tmac/doc-common b/tmac/doc-common
index 2496cf6a..439b3a36 100644
--- a/tmac/doc-common
+++ b/tmac/doc-common
@@ -535,7 +535,7 @@
. nr doc-reg-dh1 \w'\*[doc-caption-font2]\*[doc-volume]\f[]'
. if (\n[doc-reg-dh] + \n[doc-reg-dh1] + \n[doc-reg-dh] >= \n[.lt]) \{\
. while (\n[doc-reg-dh] + \n[doc-reg-dh1] + \n[doc-reg-dh] >= \n[.lt]) \{\
-. substring doc-header-string 1 -1
+. substring doc-header-string 0 -2
. nr doc-reg-dh \w'\*[doc-caption-font]\*[doc-header-string]\|.\|.\|.\f[]'
. \}
. as doc-header-string "\|.\|.\|.
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index 334102ac..36676432 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -57,8 +57,8 @@
.cp 0
.
.
-.if (\n[.x]\n[.y] < 117) \
-. ab You need GNU troff version 1.17 or higher to run this version of mdoc!
+.if (\n[.x]\n[.y] < 118) \
+. ab You need GNU troff version 1.18 or higher to run this version of mdoc!
.
.
.\" Load start-up files
@@ -2767,7 +2767,7 @@
. \" character yields identical numerical results (ignoring the
. \" scaling indicator)
. ds doc-str-ddBa "\$2
-. substring doc-str-ddBa 1 -1
+. substring doc-str-ddBa 0 -2
. if \B(\*[doc-str-ddBa]) \{\
. nr doc-reg-ddBa3 (;(\$2))
. nr doc-reg-ddBa4 (\*[doc-str-ddBa])
@@ -3082,10 +3082,10 @@
. ds doc-tag-width-stack\n[doc-list-depth] TagwidtH
.
. ds doc-str-dBla "\*[doc-arg\n[doc-arg-ptr]]
-. substring doc-str-dBla 1 1
+. substring doc-str-dBla 0 0
. ie .\*[doc-str-dBla] \{\
. ds doc-str-dBla "\*[doc-arg\n[doc-arg-ptr]]
-. substring doc-str-dBla 2
+. substring doc-str-dBla 1
. doc-first-parameter \*[doc-str-dBla]
. doc-get-width "\*[doc-str-dfp]
. doc-get-arg-type "\*[doc-str-dfp]
@@ -3129,7 +3129,7 @@
. \" character yields identical numerical results (ignoring the
. \" scaling indicator)
. ds doc-str-dBla1 "\*[doc-str-dBla]
-. substring doc-str-dBla1 1 -1
+. substring doc-str-dBla1 0 -2
. if \B(\*[doc-str-dBla1]) \{\
. nr doc-reg-dBla3 (;(\*[doc-str-dBla]))
. nr doc-reg-dBla4 (\*[doc-str-dBla1])
@@ -3171,7 +3171,7 @@
. warn (\n[.warn] - (\n[.warn] / 32 % 2 * 32))
.
. ds doc-str-dBla1 "\*[doc-str-dBla]
-. substring doc-str-dBla1 1 -1
+. substring doc-str-dBla1 0 -2
. if \B(\*[doc-str-dBla1]) \{\
. nr doc-reg-dBla3 (;(\*[doc-str-dBla]))
. nr doc-reg-dBla4 (\*[doc-str-dBla1])
@@ -3208,10 +3208,10 @@
. ie "\*[doc-list-type-stack\n[doc-list-depth]]"column-list" \{\
. nr doc-num-columns +1
. ds doc-str-dBla \*[doc-arg\n[doc-arg-ptr]]
-. substring doc-str-dBla 1 1
+. substring doc-str-dBla 0 0
. ie .\*[doc-str-dBla] \{\
. ds doc-str-dBla "\*[doc-arg\n[doc-arg-ptr]]
-. substring doc-str-dBla 2
+. substring doc-str-dBla 1
. doc-first-parameter \*[doc-str-dBla]
. doc-get-width "\*[doc-str-dfp]
. doc-get-arg-type "\*[doc-str-dfp]