[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff-commit] groff ChangeLog NEWS doc/groff.texinfo man/grof...
From: |
Werner LEMBERG |
Subject: |
[Groff-commit] groff ChangeLog NEWS doc/groff.texinfo man/grof... |
Date: |
Sat, 14 Feb 2009 17:21:38 +0000 |
CVSROOT: /cvsroot/groff
Module name: groff
Changes by: Werner LEMBERG <wl> 09/02/14 17:21:38
Modified files:
. : ChangeLog NEWS
doc : groff.texinfo
man : groff.man groff_diff.man
src/roff/troff : input.cpp
Log message:
Implement a leading spaces macro request, `lsm', in analogy to
`blm'.
Implement two new number registers, \n[lsn] and \n[lss], which hold
the number of spaces and the horizontal space, respectively, which
would be inserted if the macro registered by `lsm' wasn't called.
* src/roff/troff/input.cpp (leading_spaces_macro_name,
leading_spaces_number, leading_spaces_space): New global
variables.
(leading_spaces_macro): New function.
(process_input_stack) <token::TOKEN_SPACE>: Handle `lsm'.
(init_input_requests): Register `lsm', \n[lsn], and \n[lss].
* NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo
(Leading Spaces Traps): Document new requests and registers.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/ChangeLog?cvsroot=groff&r1=1.1194&r2=1.1195
http://cvs.savannah.gnu.org/viewcvs/groff/NEWS?cvsroot=groff&r1=1.256&r2=1.257
http://cvs.savannah.gnu.org/viewcvs/groff/doc/groff.texinfo?cvsroot=groff&r1=1.281&r2=1.282
http://cvs.savannah.gnu.org/viewcvs/groff/man/groff.man?cvsroot=groff&r1=1.102&r2=1.103
http://cvs.savannah.gnu.org/viewcvs/groff/man/groff_diff.man?cvsroot=groff&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/groff/src/roff/troff/input.cpp?cvsroot=groff&r1=1.57&r2=1.58
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/ChangeLog,v
retrieving revision 1.1194
retrieving revision 1.1195
diff -u -b -r1.1194 -r1.1195
--- ChangeLog 10 Feb 2009 13:29:58 -0000 1.1194
+++ ChangeLog 14 Feb 2009 17:21:35 -0000 1.1195
@@ -1,3 +1,21 @@
+2009-02-14 Werner LEMBERG <address@hidden>
+
+ Implement a leading spaces macro request, `lsm', in analogy to
+ `blm'.
+ Implement two new number registers, \n[lsn] and \n[lss], which hold
+ the number of spaces and the horizontal space, respectively, which
+ would be inserted if the macro registered by `lsm' wasn't called.
+
+ * src/roff/troff/input.cpp (leading_spaces_macro_name,
+ leading_spaces_number, leading_spaces_space): New global
+ variables.
+ (leading_spaces_macro): New function.
+ (process_input_stack) <token::TOKEN_SPACE>: Handle `lsm'.
+ (init_input_requests): Register `lsm', \n[lsn], and \n[lss].
+
+ * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo
+ (Leading Spaces Traps): Document new requests and registers.
+
2009-02-10 Denis M. Wilson <address@hidden>
* man/groff.man: Document missing number registers (`$$', `.b',
Index: NEWS
===================================================================
RCS file: /cvsroot/groff/groff/NEWS,v
retrieving revision 1.256
retrieving revision 1.257
diff -u -b -r1.256 -r1.257
--- NEWS 10 Jan 2009 07:48:15 -0000 1.256
+++ NEWS 14 Feb 2009 17:21:36 -0000 1.257
@@ -9,6 +9,18 @@
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.20.2
+==============
+
+Troff
+-----
+
+o The new `lsm' request specifies a macro to be invoked when leading spaces
+ in an input line are encountered (which are removed then). Number
+ registers `lsn' and `lss' hold the number of removed leading spaces and
+ the corresponding horizontal space, respectively.
+
+
VERSION 1.20.1
==============
Index: doc/groff.texinfo
===================================================================
RCS file: /cvsroot/groff/groff/doc/groff.texinfo,v
retrieving revision 1.281
retrieving revision 1.282
diff -u -b -r1.281 -r1.282
--- doc/groff.texinfo 10 Feb 2009 13:29:59 -0000 1.281
+++ doc/groff.texinfo 14 Feb 2009 17:21:37 -0000 1.282
@@ -4751,9 +4751,11 @@
@cindex fill mode
@cindex mode, fill
address@hidden leading spaces macro (@code{lsm})
A line that begins with a space causes a break and the space is output
at the beginning of the next line. Note that this space isn't adjusted,
-even in fill mode.
+even in fill mode; however, the behaviour can be modified with the
+leading spaces macro request @code{lsm}. @xref{Leading Spaces Traps}.
The end of file also causes a break -- otherwise the last line of the
document may vanish!
@@ -12043,6 +12045,7 @@
* Diversion Traps::
* Input Line Traps::
* Blank Line Traps::
+* Leading Spaces Traps::
* End-of-input Traps::
@end menu
@@ -12338,7 +12341,7 @@
@c ---------------------------------------------------------------------
address@hidden Blank Line Traps, End-of-input Traps, Input Line Traps, Traps
address@hidden Blank Line Traps, Leading Spaces Traps, Input Line Traps, Traps
@subsection Blank Line Traps
@cindex blank line traps
@cindex traps, blank line
@@ -12351,7 +12354,32 @@
@c ---------------------------------------------------------------------
address@hidden End-of-input Traps, , Blank Line Traps, Traps
address@hidden Leading Spaces Traps, End-of-input Traps, Blank Line Traps, Traps
address@hidden Leading Spaces Traps
address@hidden leading spaces traps
address@hidden traps, leading spaces
+
address@hidden {lsm, macro}
address@hidden {lsn}
address@hidden {lss}
address@hidden leading spaces macro (@code{lsm})
+Set a leading spaces trap. @code{gtroff} executes @var{macro} when it
+encounters leading spaces in an input line; the implicit line break
+which normally happens in this case is suppressed. A line consisting
+of spaces only, however, is treated as an empty line, possibly subject
+to an empty line macro set with the @code{blm} request.
+
+Leading spaces are removed from the input line before calling the
+leading spaces macro. The number of removed spaces is stored in
+register @code{lsn}; the horizontal space which would be emitted if
+there was no leading space macro is stored in register @code{lss}.
+Note that @code{lsn} and @code{lss} are available even if no leading
+space macro has been set.
address@hidden
+
address@hidden
---------------------------------------------------------------------
+
address@hidden End-of-input Traps, , Leading Spaces Traps, Traps
@subsection End-of-input Traps
@cindex end-of-input traps
@cindex traps, end-of-input
Index: man/groff.man
===================================================================
RCS file: /cvsroot/groff/groff/man/groff.man,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- man/groff.man 10 Feb 2009 13:29:59 -0000 1.102
+++ man/groff.man 14 Feb 2009 17:21:37 -0000 1.103
@@ -1873,6 +1873,15 @@
.scaleindicator m ).
.
.TPx
+.REQ .lsm
+Unset the leading spaces macro.
+.
+.TPx
+.REQ .lsm "macro"
+Set the leading spaces macro to
+.IR macro .
+.
+.TPx
.REQ .ls
Change to the previous value of additional intra-line skip.
.
@@ -3902,6 +3911,15 @@
Output line number.
.
.TPx
+.REG lsn
+The number of leading spaces of an input line.
+.
+.TPx
+.REG lss
+The horizontal space corresponding to the leading spaces of an input
+line.
+.
+.TPx
.REG minutes
The number of minutes after the hour.
.
Index: man/groff_diff.man
===================================================================
RCS file: /cvsroot/groff/groff/man/groff_diff.man,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- man/groff_diff.man 5 Jan 2009 20:33:55 -0000 1.70
+++ man/groff_diff.man 14 Feb 2009 17:21:37 -0000 1.71
@@ -1767,6 +1767,19 @@
is set to\~1 if in line-tabs mode, and 0 otherwise.
.
.TP
+.BI .lsm\ xx
+Set the leading spaces macro to
+.IR xx .
+If there are leading spaces in an input line, it is invoked instead of
+the usual troff behaviour; the leading spaces are removed.
+Registers
+.B \[rs]n[lsn]
+and
+.B \[rs]n[lss]
+hold the number of removed leading spaces and the corresponding
+horizontal space, respectively.
+.
+.TP
.BI .mso\ file
The same as the
.B so
@@ -2900,7 +2913,7 @@
.B \[rs]n[urx]
.TQ
.B \[rs]n[ury]
-These four registers are set by the
+These four read/\:write registers are set by the
.B psbb
request and contain the bounding box values (in PostScript units) of a
given PostScript image.
@@ -2952,6 +2965,14 @@
The current horizontal position at input line.
.
.TP
+.B \[rs]n[lsn]
+.TQ
+.B \[rs]n[lss]
+If there are leading spaces in an input line, these registers
+hold the number of leading spaces and the corresponding
+horizontal space, respectively.
+.
+.TP
.B \[rs]n[minutes]
The number of minutes after the hour.
.
Index: src/roff/troff/input.cpp
===================================================================
RCS file: /cvsroot/groff/groff/src/roff/troff/input.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- src/roff/troff/input.cpp 5 Jan 2009 20:11:12 -0000 1.57
+++ src/roff/troff/input.cpp 14 Feb 2009 17:21:38 -0000 1.58
@@ -101,6 +101,7 @@
static int escape_char = '\\';
static symbol end_macro_name;
static symbol blank_line_macro_name;
+static symbol leading_spaces_macro_name;
static int compatible_flag = 0;
int ascii_output_flag = 0;
int suppress_output_flag = 0;
@@ -2608,6 +2609,12 @@
skip_line();
}
+void leading_spaces_macro()
+{
+ leading_spaces_macro_name = get_name();
+ skip_line();
+}
+
static void trapping_blank_line()
{
if (!blank_line_macro_name.is_null())
@@ -2773,6 +2780,9 @@
return 0;
}
+static int leading_spaces_number = 0;
+static int leading_spaces_space = 0;
+
void process_input_stack()
{
int_stack trap_bol_stack;
@@ -2853,11 +2863,12 @@
do {
node *n;
cc = get_copy(&n);
- if (cc != EOF)
+ if (cc != EOF) {
if (cc != '\0')
curdiv->transparent_output(transparent_translate(cc));
else
curdiv->transparent_output(n);
+ }
} while (cc != '\n' && cc != EOF);
if (cc == EOF)
curdiv->transparent_output('\n');
@@ -2919,9 +2930,15 @@
trapping_blank_line();
else {
push_token(tok);
+ leading_spaces_number = nspaces;
+ leading_spaces_space = space_width.to_units() * nspaces;
+ if (!leading_spaces_macro_name.is_null())
+ spring_trap(leading_spaces_macro_name);
+ else {
curenv->do_break();
curenv->add_node(new hmotion_node(space_width * nspaces,
curenv->get_fill_color()));
+ }
bol = 0;
}
}
@@ -4080,7 +4097,7 @@
postponed_trap = nm;
return;
}
- static char buf[2] = { BEGIN_TRAP, 0 };
+ static char buf[2] = { BEGIN_TRAP, '\0' };
static char buf2[2] = { END_TRAP, '\0' };
input_stack::push(make_temp_iterator(buf2));
request_or_macro *p = lookup_request(nm);
@@ -7812,6 +7829,7 @@
init_request("ig", ignore);
init_request("length", length_request);
init_request("lf", line_file);
+ init_request("lsm", leading_spaces_macro);
init_request("mso", macro_source);
init_request("nop", nop_request);
init_request("nroff", nroff_request);
@@ -7879,6 +7897,8 @@
number_reg_dictionary.define("c.", new writable_lineno_reg);
number_reg_dictionary.define("llx", new variable_reg(&llx_reg_contents));
number_reg_dictionary.define("lly", new variable_reg(&lly_reg_contents));
+ number_reg_dictionary.define("lsn", new
variable_reg(&leading_spaces_number));
+ number_reg_dictionary.define("lss", new variable_reg(&leading_spaces_space));
number_reg_dictionary.define("opmaxx",
new variable_reg(&output_reg_maxx_contents));
number_reg_dictionary.define("opmaxy",
- [Groff-commit] groff ChangeLog NEWS doc/groff.texinfo man/grof...,
Werner LEMBERG <=