From d318611dd6f23fcfedd50e9b9e24620b102ba96a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 21:44:05 +0200 Subject: Adding upstream version 1.23.0. Signed-off-by: Daniel Baumann --- doc/groff.html.node/Setting-Registers.html | 215 +++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 doc/groff.html.node/Setting-Registers.html (limited to 'doc/groff.html.node/Setting-Registers.html') diff --git a/doc/groff.html.node/Setting-Registers.html b/doc/groff.html.node/Setting-Registers.html new file mode 100644 index 0000000..6fdf746 --- /dev/null +++ b/doc/groff.html.node/Setting-Registers.html @@ -0,0 +1,215 @@ + + + + + + +Setting Registers (The GNU Troff Manual) + + + + + + + + + + + + + + + + + + + + +
+ +
+

5.8.1 Setting Registers

+ + + +

Define registers and update their values with the nr request or +the \R escape sequence. +

+
+
Request: .nr ident value
+
+
Escape sequence: \R'ident value'
+
+

Set register ident to value. If ident doesn’t exist, +GNU troff creates it. In the \R escape sequence, the +delimiter need not be a neutral apostrophe; see Delimiters. It +also does not produce an input token in GNU troff. See gtroff Internals. +

+
+
.nr a (((17 + (3 * 4))) % 4)
+\n[a]
+.\R'a (((17 + (3 * 4))) % 4)'
+\n[a]
+    ⇒ 1 1
+
+ +

(Later, we will discuss additional forms of nr and \R that +can change a register’s value after it is dereferenced but before it is +interpolated. See Auto-increment.) +

+

The complete transparency of \R can cause surprising effects if +you use registers like .k, which get evaluated at the time they +are accessed. +

+
+
.ll 1.6i
+.
+aaa bbb ccc ddd eee fff ggg hhh\R':k \n[.k]'
+.tm :k == \n[:k]
+    ⇒ :k == 126950
+.
+.br
+.
+aaa bbb ccc ddd eee fff ggg hhh\h'0'\R':k \n[.k]'
+.tm :k == \n[:k]
+    ⇒ :k == 15000
+
+ +

If you process this with the PostScript device (-Tps), there will +be a line break eventually after ggg in both input lines. +However, after processing the space after ggg, the partially +collected line is not overfull yet, so GNU troff continues to +collect input until it sees the space (or in this case, the newline) +after hhh. At this point, the line is longer than the line +length, and the line gets broken. +

+

In the first input line, since the \R escape sequence leaves no +traces, the check for the overfull line hasn’t been done yet at the +point where \R gets handled, and you get a value for the +.k register that is even greater than the current line length. +

+

In the second input line, the insertion of \h'0' to cause a +zero-width motion forces GNU troff to check the line length, +which in turn causes the start of a new output line. Now .k +returns the expected value. +

+ +

nr and \R each have two additional special forms to +increment or decrement a register. +

+
+
Request: .nr ident +value
+
+
Request: .nr ident -value
+
Escape sequence: \R'ident +value'
+
+
Escape sequence: \R'ident -value'
+

Increment (decrement) register ident by value. In the +\R escape sequence, the delimiter need not be a neutral +apostrophe; see Delimiters. +

+
+
.nr a 1
+.nr a +1
+\na
+    ⇒ 2
+
+ + +

A leading minus sign in value is always interpreted as a +decrementation operator, not an algebraic sign. To assign a register a +negative value or the negated value of another register, you can +force GNU troff to interpret ‘-’ as a negation or minus, +rather than decrementation, operator: enclose it with its operand in +parentheses or subtract it from zero. +

+
+
.nr a 7
+.nr b 3
+.nr a -\nb
+\na
+    ⇒ 4
+.nr a (-\nb)
+\na
+    ⇒ -3
+.nr a 0-\nb
+\na
+    ⇒ -3
+
+ +

If a register’s prior value does not exist (the register was undefined), +an increment or decrement is applied as if to 0. +

+ +
+
Request: .rr ident
+
+ + +

Remove register ident. If ident doesn’t exist, the request +is ignored. Technically, only the name is removed; the register’s +contents are still accessible under aliases created with aln, if +any. +

+ +
+
Request: .rnn ident1 ident2
+
+ + +

Rename register ident1 to ident2. If ident1 doesn’t +exist, the request is ignored. Renaming a built-in register does not +otherwise alter its properties. +

+ +
+
Request: .aln new old
+
+ + + +

Create an alias new for an existing register old, causing +the names to refer to the same stored object. If old is +undefined, a warning in category ‘reg’ is produced and the request +is ignored. See Warnings, for information about the enablement and +suppression of warnings. +

+ + + +

To remove a register alias, invoke rr on its name. A register’s +contents do not become inaccessible until it has no more names. +

+ + +
+
+ + + + + + -- cgit v1.2.3