summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-05-07 13:36:23 +0000
committerwlemb <wlemb>2001-05-07 13:36:23 +0000
commitb655be22360e0275e96d7307fc2b06c66ebbc6ee (patch)
treee919600932d6a29c9dd0750d4a9f8871fec444a2
parent2cb0df330838a0f76209415679eae40517857968 (diff)
downloadgroff-b655be22360e0275e96d7307fc2b06c66ebbc6ee.tar.gz
The .ns and .rs requests are now honoured not only in the top-level
but in all diversions (similar to UNIX troff). This change is based on a patch from Tadziu Hoffmann <hoffmann@usm.uni-muenchen.de>. * src/roff/troff/div.h (diversion): Add `no_space_mode' member. (top_level_diversion): Remove `no_space_mode' member. * src/roff/troff/div.cc (diversion::diversion, top_level_diversion::top_level_diversion): Updated. (macro_diversion::output): Reset `no_space_mode'. (no_space, restore_spacing): Use `curdiv' unconditionally. (space_request, blank_line): Check `curdiv->no_space_mode'. (no_space_mode_reg::get_value, no_space_mode_reg::get_string): Use `curdiv' unconditionally. * NEWS, src/roff/troff/troff.man, man/groff.man, doc/groff.texinfo: Updated.
-rw-r--r--ChangeLog20
-rw-r--r--NEWS52
-rw-r--r--doc/groff.texinfo13
-rw-r--r--man/groff.man2
-rw-r--r--src/roff/troff/div.cc28
-rw-r--r--src/roff/troff/div.h2
-rw-r--r--src/roff/troff/troff.man2
7 files changed, 64 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index 60cebd2c..2f7df796 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2001-05-07 Werner LEMBERG <wl@gnu.org>
+
+ The .ns and .rs requests are now honoured not only in the top-level
+ but in all diversions (similar to UNIX troff).
+
+ This change is based on a patch from Tadziu Hoffmann
+ <hoffmann@usm.uni-muenchen.de>.
+
+ * src/roff/troff/div.h (diversion): Add `no_space_mode' member.
+ (top_level_diversion): Remove `no_space_mode' member.
+ * src/roff/troff/div.cc (diversion::diversion,
+ top_level_diversion::top_level_diversion): Updated.
+ (macro_diversion::output): Reset `no_space_mode'.
+ (no_space, restore_spacing): Use `curdiv' unconditionally.
+ (space_request, blank_line): Check `curdiv->no_space_mode'.
+ (no_space_mode_reg::get_value, no_space_mode_reg::get_string): Use
+ `curdiv' unconditionally.
+ * NEWS, src/roff/troff/troff.man, man/groff.man, doc/groff.texinfo:
+ Updated.
+
2001-05-06 Werner LEMBERG <wl@gnu.org>
Added two new requests `de1' and `am1' which are similar to `de' and
diff --git a/NEWS b/NEWS
index d7c64b85..d80825c4 100644
--- a/NEWS
+++ b/NEWS
@@ -16,16 +16,19 @@ o Two new requests `de1' and `am1' which are similar to `de' and `am' but
o Added request `brp'. This is the same as `\p'.
-o New read-only number register `.ns'. Returns 1 in no-space mode (if in
- top-level diversion), 0 otherwise.
+o Similar to other versions of troff, `.ns' now works in all diversions,
+ not only in the top-level one.
+
+o New read-only number register `.ns'. Returns 1 if in no-space mode,
+ 0 otherwise.
Nroff
-----
o Options -p (pic) and -t (tbl) added.
-o The environment variable GROFF_BIN_PATH will now be checked before PATH
- for finding groff.
+o The environment variable GROFF_BIN_PATH is now checked before PATH for
+ finding groff.
VERSION 1.17
============
@@ -33,18 +36,18 @@ VERSION 1.17
Groff
-----
-o `-mFOO' will now search first for `FOO.tmac' and then for `tmac.FOO'. The
+o `-mFOO' now searches first for `FOO.tmac' and then for `tmac.FOO'. The
old behaviour has been changed to overcome problems with platforms which
have an 8+3 file name limit, and platforms which have other versions of
troff installed also. Additionally, all macro files have been renamed
using the latter scheme to avoid 8+3 name clashes.
-o The new environment variable GROFF_BIN_PATH will be checked for programs
- groff is calling (preprocessors, troff, and output devices) before PATH.
- If not set, it defaults to the directory where the groff binary is
- located. Previously, it was PATH only. The nroff script will only use
- GROFF_BIN_PATH to find the groff binary but passes both the GROFF_BIN_PATH
- and PATH environment variable to groff.
+o The new environment variable GROFF_BIN_PATH is checked for programs groff
+ is calling (preprocessors, troff, and output devices) before PATH. If not
+ set, it defaults to the directory where the groff binary is located.
+ Previously, it was PATH only. The nroff script only uses GROFF_BIN_PATH
+ to find the groff binary but passes both the GROFF_BIN_PATH and PATH
+ environment variable to groff.
Troff
-----
@@ -76,9 +79,9 @@ o The mdoc package has been completely rewritten, using the full power of
encounter any abnormal results, please report them to bug-groff@gnu.org.
o A new command line option for the `man' macros (similar to the `mdoc'
- package has been implemented: `-rcR=1' (now the default in nroff mode) will
- produce one single, very long page instead of multiple pages. `-rcR=0'
- will deactivate it.
+ package has been implemented: `-rcR=1' (now the default in nroff mode)
+ produces one single, very long page instead of multiple pages. `-rcR=0'
+ deactivates it.
o The `return' request has been added to return immediately from a macro.
@@ -102,7 +105,7 @@ o `box' and `boxa' are two new requests which behave similarly to `di' and
o The `asciify' request has been extended to `unformat' space characters
and some other escape sequences also.
- `\ ' will no longer be unformatted as a space but remains an unpaddable,
+ `\ ' is no longer unformatted as a space but remains an unpaddable,
unbreakable space character.
o The new `unformat' request is similar to `asciify' but only handles space
@@ -211,7 +214,7 @@ o The `cu' request in nroff mode now works as documented (i.e., it
Grog
----
-o The grog script will now work in non-compatibility mode also (which is the
+o The grog script now works in non-compatibility mode also (which is the
default). As usual, use the `-C' option to activate compatibility mode.
Grops
@@ -249,16 +252,15 @@ o For security reasons the following changes have been done:
Use the `-F' command line option or the GROFF_FONT_PATH environment
variable if you really need the current directory.
-o groff will now install its data files into
- /usr/local/share/groff/<version> by default, following the GNU standard.
- Additionally, a local tmac directory (by default
- /usr/local/share/groff/site-tmac) will be scanned before the standard tmac
- directory. Wrapper files for system-specific macro packages (if
- necessary) are put into /usr/local/lib/groff/site-tmac; this directory
- will be searched before the local tmac directory.
+o groff now installs its data files into /usr/local/share/groff/<version> by
+ default, following the GNU standard. Additionally, a local tmac directory
+ (by default /usr/local/share/groff/site-tmac) is scanned before the
+ standard tmac directory. Wrapper files for system-specific macro packages
+ (if necessary) are put into /usr/local/lib/groff/site-tmac; this directory
+ is searched before the local tmac directory.
-o All programs now have option `-v' to show the version number; they will
- exit immediately afterwards, following the GNU standards. Additionally,
+o All programs now have option `-v' to show the version number; they exit
+ immediately afterwards, following the GNU standards. Additionally,
`--version' and `--help' have been added, doing the obvious actions.
VERSION 1.16.1
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index dbcda089..c8965c78 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -4663,22 +4663,15 @@ by a page number (see @ref{Page Control}, for more information). This
mode ends when actual text is output or the @code{rs} request is
encountered. The read-only number register @code{.ns} is set to@w{ }1.
-@cindex top-level diversion
-@cindex diversion, top-level
This request is useful for macros which want to avoid that subsequent
macros inadvertently insert some vertical space before the text starts
-(for example, to set up the first paragraph after a section header). It
-has no effect if not called within the top-level diversion
-(@pxref{Diversions}).
+(for example, to set up the first paragraph after a section header).
@c XXX xref
@endDefreq
-@cindex top-level diversion
-@cindex diversion, top-level
@Defreq {rs, }
-Disable no-space mode. It has no effect if not called within the
-top-level diversion (@pxref{Diversions}).
+Disable no-space mode.
@c XXX xref
@endDefreq
@@ -7410,7 +7403,7 @@ The @code{als} request can make a macro have more than one name.
This would be called as
@Example
-.vl $Id: groff.texinfo,v 1.76 2001/05/05 14:25:55 wlemb Exp $
+.vl $Id: groff.texinfo,v 1.77 2001/05/07 13:36:24 wlemb Exp $
@endExample
@endDefesc
diff --git a/man/groff.man b/man/groff.man
index c2a66661..2b79604a 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -2445,7 +2445,7 @@ Useful in conjunction with
.register .trunc .
.REG .ns
.number 1
-in no-space mode (if in top-level diversion),
+if in no-space mode,
.number 0
otherwise.
.REG .o Current page offset.
diff --git a/src/roff/troff/div.cc b/src/roff/troff/div.cc
index a2e80d55..0ca45c32 100644
--- a/src/roff/troff/div.cc
+++ b/src/roff/troff/div.cc
@@ -49,7 +49,8 @@ static vunits truncated_space;
static vunits needed_space;
diversion::diversion(symbol s)
-: prev(0), nm(s), vertical_position(V0), high_water_mark(V0), marked_place(V0)
+: prev(0), nm(s), vertical_position(V0), high_water_mark(V0),
+ no_space_mode(0), marked_place(V0)
{
}
@@ -249,6 +250,7 @@ void macro_diversion::transparent_output(node *n)
void macro_diversion::output(node *nd, int retain_size,
vunits vs, vunits post_vs, hunits width)
{
+ no_space_mode = 0;
vertical_size v(vs, post_vs);
while (nd != 0) {
nd->set_vertical_size(&v);
@@ -316,7 +318,7 @@ top_level_diversion::top_level_diversion()
page_length(units_per_inch*11),
prev_page_offset(units_per_inch), page_offset(units_per_inch),
page_trap_list(0), have_next_page_number(0),
- ejecting_page(0), before_first_page(1), no_space_mode(0)
+ ejecting_page(0), before_first_page(1)
{
}
@@ -722,15 +724,13 @@ void begin_page()
void no_space()
{
- if (curdiv == topdiv)
- topdiv->no_space_mode = 1;
+ curdiv->no_space_mode = 1;
skip_line();
}
void restore_spacing()
{
- if (curdiv == topdiv)
- topdiv->no_space_mode = 0;
+ curdiv->no_space_mode = 0;
skip_line();
}
@@ -755,8 +755,8 @@ void space_request()
n = curenv->get_vertical_spacing();
while (!tok.newline() && !tok.eof())
tok.next();
- if (!unpostpone_traps())
- curdiv->space(n);
+ if (!unpostpone_traps() && !curdiv->no_space_mode)
+ curdiv->space(n);
else
// The line might have had line spacing that was truncated.
truncated_space += n;
@@ -767,7 +767,7 @@ void space_request()
void blank_line()
{
curenv->do_break();
- if (!trap_sprung_flag)
+ if (!trap_sprung_flag && !curdiv->no_space_mode)
curdiv->space(curenv->get_vertical_spacing());
else
truncated_space += curenv->get_vertical_spacing();
@@ -1122,19 +1122,13 @@ public:
int no_space_mode_reg::get_value(units *val)
{
- if (curdiv == topdiv)
- *val = topdiv->no_space_mode;
- else
- *val = 0;
+ *val = curdiv->no_space_mode;
return 1;
}
const char *no_space_mode_reg::get_string()
{
- if (curdiv == topdiv)
- return topdiv->no_space_mode ? "1" : "0";
- else
- return "0";
+ return curdiv->no_space_mode ? "1" : "0";
}
void init_div_requests()
diff --git a/src/roff/troff/div.h b/src/roff/troff/div.h
index 83f9e33c..3b726c37 100644
--- a/src/roff/troff/div.h
+++ b/src/roff/troff/div.h
@@ -33,6 +33,7 @@ protected:
vunits vertical_position;
vunits high_water_mark;
public:
+ int no_space_mode;
vunits marked_place;
diversion(symbol s = NULL_SYMBOL);
virtual ~diversion();
@@ -101,7 +102,6 @@ class top_level_diversion : public diversion {
int ejecting_page; // Is the current page being ejected?
public:
int before_first_page;
- int no_space_mode;
top_level_diversion();
void output(node *nd, int retain_size, vunits vs, vunits post_vs,
hunits width);
diff --git a/src/roff/troff/troff.man b/src/roff/troff/troff.man
index 5f888866..a37d623f 100644
--- a/src/roff/troff/troff.man
+++ b/src/roff/troff/troff.man
@@ -1875,7 +1875,7 @@ register.
.TP
.B \en[.ns]
.B 1
-if no-space mode is active (if in top-level diversion),
+if no-space mode is active,
.B 0
otherwise.
.TP