summaryrefslogtreecommitdiff
path: root/src
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 /src
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.
Diffstat (limited to 'src')
-rw-r--r--src/roff/troff/div.cc24
-rw-r--r--src/roff/troff/troff.man6
2 files changed, 30 insertions, 0 deletions
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