summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-05-05 08:41:32 +0000
committerwlemb <wlemb>2001-05-05 08:41:32 +0000
commitc16c00ada1460d9e62dbda93ee793be219bc2b2a (patch)
tree11e8ed3b647834c433844125e43ac4765f7535bb
parent90bf5fed3b356f5f2d5d8d7b1bd82a526d8717d5 (diff)
downloadgroff-c16c00ada1460d9e62dbda93ee793be219bc2b2a.tar.gz
Added `.q' number register: Returns 1 if in no-space mode (if in
top-level diversion), 0 otherwise. * src/roff/troff/div.cc (no_space_mode_reg): New class. (init_div_requests): Updated. * NEWS, src/roff/troff/troff.man, man/groff.man, doc/groff.texinfo: Document it.
-rw-r--r--ChangeLog10
-rw-r--r--NEWS3
-rw-r--r--doc/groff.texinfo5
-rw-r--r--man/groff.man5
-rw-r--r--src/roff/troff/div.cc24
-rw-r--r--src/roff/troff/troff.man6
6 files changed, 51 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4576c76d..67a9a0ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-05-05 Werner LEMBERG <wl@gnu.org>
+
+ Added `.q' number register: Returns 1 if in no-space mode (if in
+ top-level diversion), 0 otherwise.
+
+ * src/roff/troff/div.cc (no_space_mode_reg): New class.
+ (init_div_requests): Updated.
+ * NEWS, src/roff/troff/troff.man, man/groff.man, doc/groff.texinfo:
+ Document it.
+
2001-05-04 Werner LEMBERG <wl@gnu.org>
* src/roff/nroff/nroff.man: Improved documentation (especially
diff --git a/NEWS b/NEWS
index 3592b2c2..aa57e25a 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ Troff
o Added request `brp'. This is the same as `\p'.
+o New read-only number register `.q'. Returns 1 in no-space mode (if in
+ top-level diversion), 0 otherwise.
+
Nroff
-----
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index b537d1ac..91fa2638 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -4655,12 +4655,13 @@ The @code{.a} read-only number register contains the most recent
@cindex blank lines, disabling
@cindex lines, blank, disabling
@Defreq {ns, }
+@Defregx {.q}
Enable @dfn{no-space mode}. In this mode, spacing (either via
@code{sp} or via blank lines) is disabled. The @code{bp} request to
advance to the next page is also disabled, except if it is accompanied
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.
+encountered. The read-only number register @code{.q} is set to@w{ }1.
@cindex top-level diversion
@cindex diversion, top-level
@@ -7409,7 +7410,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.74 2001/04/16 14:47:18 wlemb Exp $
+.vl $Id: groff.texinfo,v 1.75 2001/05/05 08:41:38 wlemb Exp $
@endExample
@endDefesc
diff --git a/man/groff.man b/man/groff.man
index 6c3daad1..a3321fc4 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -2420,6 +2420,11 @@ Useful in conjunction with
.register .trunc .
.REG .o Current page offset.
.REG .p Current page length.
+.REG .q
+.number 1
+in no-space mode (if in top-level diversion),
+.number 0
+otherwise.
.REG .pn
The number of the next page: either the value set by a
.request .pn
diff --git a/src/roff/troff/div.cc b/src/roff/troff/div.cc
index 281c1af8..4abd27af 100644
--- a/src/roff/troff/div.cc
+++ b/src/roff/troff/div.cc
@@ -1114,6 +1114,29 @@ void nl_reg::set_value(units n)
topdiv->before_first_page = 2;
}
+class no_space_mode_reg : public reg {
+public:
+ int get_value(units *);
+ const char *get_string();
+};
+
+int no_space_mode_reg::get_value(units *val)
+{
+ if (curdiv == topdiv)
+ *val = topdiv->no_space_mode;
+ else
+ *val = 0;
+ return 1;
+}
+
+const char *no_space_mode_reg::get_string()
+{
+ if (curdiv == topdiv)
+ return topdiv->no_space_mode ? "1" : "0";
+ else
+ return "0";
+}
+
void init_div_requests()
{
init_request("wh", when_request);
@@ -1143,6 +1166,7 @@ void init_div_requests()
number_reg_dictionary.define(".z", new diversion_name_reg);
number_reg_dictionary.define(".o", new page_offset_reg);
number_reg_dictionary.define(".p", new page_length_reg);
+ number_reg_dictionary.define(".q", new no_space_mode_reg);
number_reg_dictionary.define(".d", new vertical_position_reg);
number_reg_dictionary.define(".h", new high_water_mark_reg);
number_reg_dictionary.define(".t", new distance_to_next_trap_reg);
diff --git a/src/roff/troff/troff.man b/src/roff/troff/troff.man
index 86d5ba40..fff107ca 100644
--- a/src/roff/troff/troff.man
+++ b/src/roff/troff/troff.man
@@ -1873,6 +1873,12 @@ The current pointsize in scaled points.
.B \en[.psr]
The last-requested pointsize in scaled points.
.TP
+.B \en[.q]
+.B 1
+if no-space mode is active (if in top-level diversion),
+.B 0
+otherwise.
+.TP
.B \en[.rj]
The number of lines to be right-justified as set by the
.B rj