[groff] 02/02: [troff]: Make `pline` report nodes in fwd order.

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit b3239d5b58a97d6a33e7d87b449b3f77a2f8a68b
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 13:10:02 2024 -0500

[troff]: Make `pline` report nodes in fwd order.

* src/roff/troff/node.cpp (node::debug_node): Report list of nodes
  produced by most recent input line in forward order, likely
  corresponding to user intuition.  (Internally, the formatter stores
  the nodes in LIFO order, for the convenience of traversing a
  singly-list list.)

Demonstration:

$ cat EXPERIMENTS/test-dumping-pending-output-line-node-list.groff
foo \f[B]bar\f[]
baz\~qux
.pline
.tm doing `pline` again should result in no output
.pline
.pl \n[nl]u
$ nroff EXPERIMENTS/test-dumping-pending-output-line-node-list.groff
{ line_start_node  nest level 0 }
{ glyph_node [f nest level 0]}
{ glyph_node [o nest level 0]}
{ glyph_node [o nest level 0]}
{ word_space_node  nest level 0 }
{ glyph_node [b nest level 0]}
{ glyph_node [a nest level 0]}
{ glyph_node [r nest level 0]}
{ word_space_node  nest level 0 }
{ glyph_node [b nest level 0]}
{ glyph_node [a nest level 0]}
{ glyph_node [z nest level 0]}
{ unbreakable_space_node  nest level 0 }
{ glyph_node [q nest level 0]}
{ glyph_node [u nest level 0]}
{ glyph_node [x nest level 0]}
doing `pline` again should result in no output
foo bar baz qux
---
 ChangeLog   |  8 
 src/roff/troff/node.cpp | 14 +++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fb04e4c1a..a64698c65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-04-30  G. Branden Robinson 
+
+   * src/roff/troff/node.cpp (node::debug_node): Report list of
+   nodes produced by most recent input line in forward order,
+   likely corresponding to user intuition.  (Internally, the
+   formatter stores the nodes in LIFO order, for the convenience of
+   traversing a singly-list list.)
+
 2024-04-30  G. Branden Robinson 
 
[troff]: Add new request `pline` to dump list of nodes
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index cc11507e1..f5d38e1e9 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -57,6 +57,8 @@ along with this program.  If not, see 
. */
 
 #endif /* not _POSIX_VERSION */
 
+#include 
+
 // declarations to avoid friend name injections
 class tfont;
 class tfont_spec;
@@ -2562,12 +2564,18 @@ void node::debug_node()
 
 void node::debug_node_list()
 {
+  // It's stored in reverse order already; this puts it forward again.
+  std::stack reversed_node_list;
   node *n = next;
 
-  debug_node();
-  while (n != 0 /* nullptr */) {
-n->debug_node();
+  assert(next != 0 /* nullptr */);
+  do {
+reversed_node_list.push(n);
 n = n->next;
+  } while (n != 0 /* nullptr */);
+  while (!reversed_node_list.empty()) {
+reversed_node_list.top()->debug_node();
+reversed_node_list.pop();
   }
 }
 

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 01/02: [troff]: Implement new `pline` request.

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 22eb8770c5a087d204b31e88879a939d0d534c8e
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 12:17:36 2024 -0500

[troff]: Implement new `pline` request.

[troff]: Add new request `pline` to dump list of nodes corresponding to
most recently seen input line.

* src/roff/troff/env.h (class environment): Declare new `dump_node_list`
  member function.

* src/roff/troff/env.cpp (environment::dump_node_list): New
  function calls `debug_node_list()` if the most recent input line was
  productive of output.

  (print_node_list): New function dumps list of nodes pending in the
  environment and produced by the most recent input line.

  (init_env_requests): Wire up `pline` request to `print_node_list()`.

* doc/groff.texi (Manipulating Filling and Adjustment, Debugging):
* man/groff.7.man (Request short reference, Debugging):
* man/groff_diff.7.man (New requests, Debugging):
* NEWS: Document it.
---
 ChangeLog  | 22 ++
 NEWS   |  5 +
 doc/groff.texi.in  | 24 +++-
 man/groff.7.man| 15 +--
 man/groff_diff.7.man   | 15 +--
 src/roff/troff/env.cpp | 12 
 src/roff/troff/env.h   |  1 +
 7 files changed, 85 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8e26a7ce1..fb04e4c1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2024-04-30  G. Branden Robinson 
+
+   [troff]: Add new request `pline` to dump list of nodes
+   corresponding to most recently seen input line.
+
+   * src/roff/troff/env.h (class environment): Declare new
+   `dump_node_list` member function.
+   * src/roff/troff/env.cpp (environment::dump_node_list): New
+   function calls `debug_node_list()` if the most recent input line
+   was productive of output.
+   (print_node_list): New function dumps list of nodes
+   pending in the environment and produced by the most recent input
+   line.
+   (init_env_requests): Wire up `pline` request to
+   `print_node_list()`.
+
+   * doc/groff.texi (Manipulating Filling and Adjustment)
+   (Debugging):
+   * man/groff.7.man (Request short reference, Debugging):
+   * man/groff_diff.7.man (New requests, Debugging):
+   * NEWS: Document it.
+
 2024-04-30  G. Branden Robinson 
 
* src/roff/troff/div.cpp (page_number):
diff --git a/NEWS b/NEWS
index cb9cedf22..11d5e7994 100644
--- a/NEWS
+++ b/NEWS
@@ -85,6 +85,11 @@ o A new request, `pcomposite`, reports to the standard error 
stream the
 o A new request, `phw`, reports to the standard error stream the current
   list of hyphenation exceptions.
 
+o A new request, `pline`, reports to the standard error stream the list
+  of nodes (an internal data structure) corresponding to the most
+  recently seen input line.  The list is empty if there was no previous
+  input line or if it was not productive.
+
 o The `hla` request, when invoked with no arguments, now clears the
   hyphenation language, disabling automatic hyphenation.
 
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 877b56894..1f6b17622 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -8353,10 +8353,13 @@ lines containing requests like @code{tl} or escape 
sequences like
 counted, but their interpolated contents can be.  Empty requests, and
 requests and escape sequences that define registers or strings or alter
 the formatting environment (as with changes to the size, face, height,
-slant, or color of the type) are not productive.  We will also preview
-the output line continuation escape sequence, @code{\c}, which
-``connects'' two input lines that would otherwise be counted separately.
-@footnote{@xref{Line Continuation}.}
+slant, or color of the type) are not productive.@footnote{If you're not
+sure whether an input line has been productive, you can use the
+@code{pline} request to see whether it produced any formatting nodes.
+@xref{Debugging}.}  We will also preview the output line continuation
+escape sequence, @code{\c}, which ``connects'' two input lines that
+would otherwise be counted separately.  @footnote{@xref{Line
+Continuation}.}
 
 @Example
 @c .ll 56n
@@ -17026,7 +17029,8 @@ exit codes respectively, to halt further processing 
when continuing
 would be fruitless.  Examine the state of the formatter with requests
 that write lists of defined names (macros, strings, and diversions),
 colors, composite characters, environments, hyphenation exceptions,
-registers, and page location traps to the standard error stream.
+registers, page location traps, and a list of nodes corresponding to
+the most recent input line to the standard error stream.
 @c END Keep parallel with section "Debugging" of groff(7).
 
 @Defreq {lf, line [@Var{file}]}
@@ -17140,6 +17144,16 @@ hyphenation pattern file rather than with 

[groff] 01/01: [mom]:[momdoc]: Minuscule html formatting change.

2024-04-30 Thread Peter Schaffter
PTPi pushed a commit to branch master
in repository groff.

commit a77fbf8fd6d6d4ff05d88f6ede9ac694b116ada1
Author: Peter Schaffter 
AuthorDate: Tue Apr 30 13:09:39 2024 -0400

[mom]:[momdoc]: Minuscule html formatting change.
---
 contrib/mom/momdoc/goodies.html | 1 -
 1 file changed, 1 deletion(-)

diff --git a/contrib/mom/momdoc/goodies.html b/contrib/mom/momdoc/goodies.html
index 7c39e1488..26960285d 100644
--- a/contrib/mom/momdoc/goodies.html
+++ b/contrib/mom/momdoc/goodies.html
@@ -1658,7 +1658,6 @@ trust shall never be put out.
 
 
 
-
 
 
 Play the man, Master Ridley; we

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 02/06: ChangeLog: Clarify old entries.

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 3f51029cb0292729282ae4b9421b6c5f6c99423b
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 08:11:39 2024 -0500

ChangeLog: Clarify old entries.
---
 ChangeLog | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 451b3e0ea..4b975c9de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,10 +59,12 @@
 
 2024-04-27  G. Branden Robinson 
 
-   * src/roff/troff/env.cpp (environment::output) [WIDOW_CONTROL]:
-   Fix code style nit (in de-configured code); explicitly compare
-   variable of pointer type to null pointer constant instead of
-   letting it pun down to a Boolean.
+   * src/roff/troff/env.cpp (environment::add_italic_correction):
+   Fix code style nit; explicitly compare variable of pointer type
+   to null pointer constant instead of letting it pun down to a
+   Boolean.
+   (environment::output) [WIDOW_CONTROL]: Same, in de-configured
+   code.
 
 2024-04-27  G. Branden Robinson 
 
@@ -4490,12 +4492,12 @@
 
* src/preproc/tbl/table.cpp: Add C preprocessor macro storing a
"text block staggering macro" name.
-   (block_entry::position_vertically): Call it in generated output
-   with a negative half-vee motion.
+   (block_entry::position_vertically): If staggering, call it in
+   generated output with a negative half-vee motion.
(block_entry::position_vertically, left_block_entry::print)
(right_block_entry::print, center_block_entry::print)
-   (alphabetic_block_entry::print): Call it in generated output
-   with a positive half-vee motion.
+   (alphabetic_block_entry::print): If staggering, call it in
+   generated output with a positive half-vee motion.
(table::init_output): Write out its definition in generated
output.  It wraps the `sp` request.  If we're in a diversion,
use the `\!` technique to recursively call ourselves and bubble

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 04/06: [troff]: Drop obscure info from `pev` req output.

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit b472774c3c86ff45a284b103d2be1c47c217cda4
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 08:30:50 2024 -0500

[troff]: Drop obscure info from `pev` req output.

* src/roff/troff/env.cpp (environment::print_env): Stop reporting the
  value of the "discarding" flag as a property of the *roff environment.
  There's no corresponding concept in CSTR #54 or groff's documentation.
  It is an internal implementation detail having to do with the disposal
  of trailing spaces on input lines (and not even in general at that; as
  far as I can tell it applies only when the `\p` escape sequence is
  also used).  Move the report of its value from here...

  (environment::dump_troff_state): ...to here, a member function that is
  only reachable if the `DEBUGGING` preprocessor symbol is defined or if
  one is using a debugger on an unstripped troff executable.
---
 ChangeLog  | 15 +++
 src/roff/troff/env.cpp |  8 ++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c320d42f0..2f329fb7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-04-30  G. Branden Robinson 
+
+   * src/roff/troff/env.cpp (environment::print_env): Stop
+   reporting the value of the "discarding" flag as a property of
+   the *roff environment.  There's no corresponding concept in CSTR
+   #54 or groff's documentation.  It is an internal
+   implementation detail having to do with the disposal of trailing
+   spaces on input lines (and not even in general at that; as far
+   as I can tell it applies only when the `\p` escape sequence is
+   also used).  Move the report of its value from here...
+   (environment::dump_troff_state): ...to here, a member function
+   that is only reachable if the `DEBUGGING` preprocessor symbol is
+   defined or if one is using a debugger on an unstripped troff
+   executable.
+
 2024-04-30  G. Branden Robinson 
 
* src/roff/troff/env.cpp (environment::possibly_break_line):
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index f36f9d6e1..6283cfc5e 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2259,6 +2259,9 @@ void environment::possibly_break_line(bool 
must_break_here,
 else
   hyphen_line_count = 0;
 delete bp;
+// Normally, the do_break() member function discards trailing spaces
+// (cf. horizontal motions) from input lines.  But when `\p` is
+// used, that mechanism is bypassed, so we do the equivalent here.
 space_total = 0;
 width_total = 0;
 node *first_non_discardable = 0 /* nullptr */;
@@ -2371,7 +2374,8 @@ node *environment::make_tag(const char *nm, int i)
 void environment::dump_troff_state()
 {
 #define SPACES ""
-  fprintf(stderr, SPACES "register 'in' = %d\n", curenv->indent.to_units());
+  fprintf(stderr, SPACES "register 'in' = %d\n",
+ curenv->indent.to_units());
   if (curenv->have_temporary_indent)
 fprintf(stderr, SPACES "register 'ti' = %d\n",
curenv->temporary_indent.to_units());
@@ -2384,6 +2388,7 @@ void environment::dump_troff_state()
  topdiv->get_page_offset().to_units());
   fprintf(stderr, SPACES "seen_break = %d\n", curenv->seen_break);
   fprintf(stderr, SPACES "seen_space = %d\n", curenv->seen_space);
+  fprintf(stderr, SPACES "discarding = %d\n", curenv->discarding);
   fflush(stderr);
 #undef SPACES
 }
@@ -3459,7 +3464,6 @@ void environment::print_env()
   errprint("  total number of spaces: %1\n", space_total);
   errprint("  input line start: %1u\n", input_line_start.to_units());
   errprint("  line tabs: %1\n", using_line_tabs ? "yes" : "no");
-  errprint("  discarding: %1\n", discarding ? "yes" : "no");
   errprint("  spread flag set: %1\n", spreading ? "yes" : "no"); // \p
   if (margin_character_node != 0 /* nullptr */) {
 errprint("  margin character flags: %1\n",

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 06/06: [troff]: Fix code style nit (`NULL` -> `0`).

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 884a78589ab0717a74b55c1dd59efc63be13503f
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 09:12:07 2024 -0500

[troff]: Fix code style nit (`NULL` -> `0`).

* src/roff/troff/div.cpp (page_number):
* src/roff/troff/env.cpp (environment::add_node)
  (environment::construct_state):
* src/roff/troff/input.cpp (psbb_locator::psbb_locator)
  (psbb_locator::parse_bounding_box, psbb_locator::get_line)
  (psbb_locator::context_args, psbb_locator::get_header_comment)
  (psbb_locator::skip_to_trailer): Use idiomatic C++98 null pointer
  constant literal.
---
 ChangeLog| 11 +++
 src/roff/troff/div.cpp   |  2 +-
 src/roff/troff/env.cpp   |  4 ++--
 src/roff/troff/input.cpp | 29 +++--
 4 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 04a617346..8e26a7ce1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-04-30  G. Branden Robinson 
+
+   * src/roff/troff/div.cpp (page_number):
+   * src/roff/troff/env.cpp (environment::add_node)
+   (environment::construct_state):
+   * src/roff/troff/input.cpp (psbb_locator::psbb_locator)
+   (psbb_locator::parse_bounding_box, psbb_locator::get_line)
+   (psbb_locator::context_args, psbb_locator::get_header_comment)
+   (psbb_locator::skip_to_trailer): Use idiomatic C++98 null
+   pointer constant literal.
+
 2024-04-30  G. Branden Robinson 
 
* src/roff/troff/env.cpp (environment::print_env): Revise
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index cb508b322..83f10e7bc 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -850,7 +850,7 @@ void page_number()
   // XXX: Yuck!  Get rid of this; macro packages already test the
   // register before invoking .pn.
   reg *r = (reg *)register_dictionary.lookup("ps4html");
-  if (r == NULL)
+  if (r == 0 /* nullptr */)
 if (has_arg() && get_integer(, topdiv->get_page_number()))
   topdiv->set_next_page_number(n);
   skip_line();
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 276042a48..166af81d6 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -358,7 +358,7 @@ void environment::add_node(node *nd)
   if (nd == 0 /* nullptr */)
 return;
   if (!suppress_push) {
-if (nd->is_special && nd->state == NULL)
+if (nd->is_special && nd->state == 0 /* nullptr */)
   nd->state = construct_state(false);
 nd->push_state = get_diversion_state();
   }
@@ -2420,7 +2420,7 @@ statem *environment::construct_state(bool has_only_eol)
 return s;
   }
   else
-return NULL;
+return 0 /* nullptr */;
 }
 
 void environment::construct_format_state(node *nd, bool was_centered,
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 82fb477b3..09b25f7cd 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6405,9 +6405,9 @@ filename(fname), llx(0), lly(0), urx(0), ury(0), 
lastc(EOF)
   // specify a %%BoundingBox comment; locate it, initially
   // expecting to find it in the comments header...
   //
-  const char *context = NULL;
-  while ((context == NULL) && get_header_comment()) {
-   if ((context = bounding_box_args()) != NULL) {
+  const char *context = 0 /* nullptr */;
+  while ((context == 0 /* nullptr */) && get_header_comment()) {
+   if ((context = bounding_box_args()) != 0 /* nullptr */) {
 
  // When the "%%BoundingBox" comment is found, it may simply
  // specify the bounding box property values, or it may defer
@@ -6420,10 +6420,10 @@ filename(fname), llx(0), lly(0), urx(0), ury(0), 
lastc(EOF)
// for the appropriate specification within it.
//
if (skip_to_trailer() > 0) {
- while ((context = bounding_box_args()) == NULL
+ while ((context = bounding_box_args()) == 0 /* nullptr */
 && get_line(DSC_LINE_MAX_ENFORCE) > 0)
;
- if (context != NULL) {
+ if (context != 0 /* nullptr */) {
//
// When we find a bounding box specification here...
//
@@ -6440,7 +6440,7 @@ filename(fname), llx(0), lly(0), urx(0), ury(0), 
lastc(EOF)
  // The trailer could not be found, so there is no context in
  // which a trailing %%BoundingBox comment might be located.
  //
- context = NULL;
+ context = 0 /* nullptr */;
  }
  if (status == PSBB_RANGE_IS_BAD) {
//
@@ -6453,7 +6453,7 @@ filename(fname), llx(0), lly(0), urx(0), ury(0), 
lastc(EOF)
  }
}
   }
-  if (context == NULL)
+  if (context == 0 /* nullptr */)
//
// Conversely, this arises when no value specifying %%BoundingBox
// comment has been found, in any appropriate 

[groff] 05/06: [troff]: Revise `pev` request output.

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 6a02d92ae2749b545d93199dd157ecf9443681fb
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 09:06:36 2024 -0500

[troff]: Revise `pev` request output.

* src/roff/troff/env.cpp (environment::print_env): Revise report.
  Recast for comprehensibility and to use terminology from our man pages
  and our Texinfo manual.  In nroff mode, stop reporting type size and
  font family parameters; the formatter ignores the relevant requests
  and escape sequences in that mode.  Report the previous and current
  resolved font names alongside the existing mounting position
  selections.
---
 ChangeLog  | 10 ++
 src/roff/troff/env.cpp | 98 ++
 2 files changed, 70 insertions(+), 38 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f329fb7b..04a617346 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-04-30  G. Branden Robinson 
+
+   * src/roff/troff/env.cpp (environment::print_env): Revise
+   report.  Recast for comprehensibility and to use terminology
+   from our man pages and our Texinfo manual.  In nroff mode, stop
+   reporting type size and font family parameters; the formatter
+   ignores the relevant requests and escape sequences in that mode.
+   Report the previous and current resolved font names alongside
+   the existing mounting position selections.
+
 2024-04-30  G. Branden Robinson 
 
* src/roff/troff/env.cpp (environment::print_env): Stop
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 6283cfc5e..276042a48 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3400,27 +3400,37 @@ void environment::print_env()
   // tab_field_spaces, tab_precedes_field
   //   composite
   //
-  errprint("  previous line length: %1u\n", prev_line_length.to_units());
+  errprint("  previous line length: %1u\n",
+  prev_line_length.to_units());
   errprint("  line length: %1u\n", line_length.to_units());
-  errprint("  previous title length: %1u\n", prev_title_length.to_units());
-  errprint("  title length: %1u\n", title_length.to_units());
-  errprint("  previous size: %1p (%2s)\n",
-  prev_size.to_points(), prev_size.to_scaled_points());
-  errprint("  size: %1p (%2s)\n",
-  size.to_points(), size.to_scaled_points());
-  errprint("  previous requested size: %1s\n", prev_requested_size);
-  errprint("  requested size: %1s\n", requested_size);
-  errprint("  previous font number: %1\n", prev_fontno);
-  errprint("  font number: %1\n", fontno);
-  errprint("  previous family: '%1'\n", prev_family->nm.contents());
-  errprint("  family: '%1'\n", family->nm.contents());
-  errprint("  space size: %1/12 of font spacewidth\n", space_size);
-  errprint("  sentence space size: %1/12 of font spacewidth\n",
+  errprint("  previous title line length: %1u\n",
+  prev_title_length.to_units());
+  errprint("  title line length: %1u\n", title_length.to_units());
+  if (!in_nroff_mode) {
+errprint("  previous type size: %1p (%2s)\n",
+prev_size.to_points(), prev_size.to_scaled_points());
+errprint("  type size: %1p (%2s)\n",
+size.to_points(), size.to_scaled_points());
+errprint("  previous requested type size: %1s\n",
+prev_requested_size);
+errprint("  requested type size: %1s\n", requested_size);
+  }
+  errprint("  previous font selection: %1 ('%2')\n", prev_fontno,
+  get_font_name(prev_fontno, this).contents());
+  errprint("  font selection: %1 ('%2')\n", fontno,
+  get_font_name(fontno, this).contents());
+  if (!in_nroff_mode) {
+errprint("  previous default family: '%1'\n",
+prev_family->nm.contents());
+errprint("  default family: '%1'\n", family->nm.contents());
+  }
+  errprint("  space size: %1/12 of font space width\n", space_size);
+  errprint("  sentence space size: %1/12 of font space width\n",
   sentence_space_size);
-  errprint("  previous line interrupted: %1\n",
+  errprint("  previous line interrupted/continued: %1\n",
   prev_line_interrupted ? "yes" : "no");
-  errprint("  fill mode: %1\n", fill ? "on" : "off");
-  errprint("  adjust mode: %1\n",
+  errprint("  filling: %1\n", fill ? "on" : "off");
+  errprint("  alignment/adjustment: %1\n",
   adjust_mode == ADJUST_LEFT
 ? "left"
 : adjust_mode == ADJUST_BOTH
@@ -3429,9 +3439,10 @@ void environment::print_env()
 ? "center"
 : "right");
   if (centered_line_count > 0)
-errprint("  lines to center: %1\n", centered_line_count);
+errprint("  lines remaining to center: %1\n", centered_line_count);
   if (right_aligned_line_count > 0)
-errprint("  lines to right justify: %1\n", right_aligned_line_count);
+errprint("  lines remaining to right-align: %1\n",
+

[groff] 03/06: [troff]: Fix code style nit.

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 623f92a2efc8feda47b3bfd095c296817688cde1
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 08:02:14 2024 -0500

[troff]: Fix code style nit.

* src/roff/troff/env.cpp (environment::possibly_break_line): Explicitly
  compare variable of pointer type to null pointer constant instead of
  letting it pun down to a Boolean.
  (environment::print_env): Similarly for testing value of function
  returning pointer.
---
 ChangeLog  |  9 +
 src/roff/troff/env.cpp | 10 +-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4b975c9de..c320d42f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-04-30  G. Branden Robinson 
+
+   * src/roff/troff/env.cpp (environment::possibly_break_line):
+   (environment::print_env): Explicitly compare variable of pointer
+   type to null pointer constant instead of letting it pun down to
+   a Boolean.
+   (environment::print_env): Similarly for testing value of
+   function returning pointer.
+
 2024-04-30  Deri James  
 
[gropdf] Re-arrange pattern matches.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index ba40f0ba1..f36f9d6e1 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2267,7 +2267,7 @@ void environment::possibly_break_line(bool 
must_break_here,
   if (!tem->discardable())
first_non_discardable = tem;
 node *to_be_discarded;
-if (first_non_discardable) {
+if (first_non_discardable != 0 /* nullptr */) {
   to_be_discarded = first_non_discardable->next;
   first_non_discardable->next = 0 /* nullptr */;
   for (tem = line; tem != 0 /* nullptr */; tem = tem->next) {
@@ -3448,7 +3448,7 @@ void environment::print_env()
 errprint("  font number before underlining: %1\n", pre_underline_fontno);
 errprint("  underline spaces: %1\n", underline_spaces ? "yes" : "no");
   }
-  if (input_trap.contents()) {
+  if (input_trap.contents() != 0 /* nullptr */) {
 errprint("  input trap macro: '%1'\n", input_trap.contents());
 errprint("  input trap line counter: %1\n", input_trap_count);
 errprint("  continued input trap: %1\n",
@@ -3460,8 +3460,8 @@ void environment::print_env()
   errprint("  input line start: %1u\n", input_line_start.to_units());
   errprint("  line tabs: %1\n", using_line_tabs ? "yes" : "no");
   errprint("  discarding: %1\n", discarding ? "yes" : "no");
-  errprint("  spread flag set: %1\n", spreading ? "yes" : "no");   // \p
-  if (margin_character_node) {
+  errprint("  spread flag set: %1\n", spreading ? "yes" : "no"); // \p
+  if (margin_character_node != 0 /* nullptr */) {
 errprint("  margin character flags: %1\n",
 margin_character_flags == MARGIN_CHARACTER_ON
   ? "on"
@@ -3474,7 +3474,7 @@ void environment::print_env()
 errprint("  margin character distance: %1u\n",
 margin_character_distance.to_units());
   }
-  if (numbering_nodes) {
+  if (numbering_nodes != 0 /* nullptr */) {
 errprint("  line number digit width: %1u\n",
 line_number_digit_width.to_units());
 errprint("  separation between number and text: %1 digit spaces\n",

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 01/06: ChangeLog: Fix entry date.

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 639186fe6b9cb45322da7c10aec02a646d75c38e
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 09:33:35 2024 -0500

ChangeLog: Fix entry date.
---
 ChangeLog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c947229d3..451b3e0ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-2024-04-24  Deri James  
+2024-04-30  Deri James  
 
[gropdf] Re-arrange pattern matches.
 

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 01/01: [gropdf] Re-arrange pattern matches.

2024-04-30 Thread Deri James
deri pushed a commit to branch master
in repository groff.

commit a951b44fd9d2acf060067b24c994604351a27888
Author: Deri James 
AuthorDate: Tue Apr 30 15:25:49 2024 +0100

[gropdf] Re-arrange pattern matches.

* src/devices/gropdf/gropdf.pl: Correct order of pattern
match.

Fixes https://savannah.gnu.org/bugs/?65585 (again!)
---
 ChangeLog| 9 +
 src/devices/gropdf/gropdf.pl | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index bb8fc9fb1..c947229d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-04-24  Deri James  
+
+   [gropdf] Re-arrange pattern matches.
+
+   * src/devices/gropdf/gropdf.pl: Correct order of pattern
+   match.
+
+   Fixes https://savannah.gnu.org/bugs/?65585 (again!)
+
 2024-04-30  Christof Meerwald 
 
* src/devices/gropdf/gropdf.pl: Call PDFDate with the output of
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 1656db821..31a35db4a 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -1983,6 +1983,7 @@ sub Clean
 my $p=shift;
 
 $p=~s/\\c?$//g;
+$p=~s/\\[eE]/\\/g;
 $p=~s/\\[ 0~t]/ /g;
 $p=~s/\\[,!"#\$%&’.0:?{}ˆ_‘|^prud]//g;
 $p=~s/\\'/\\[aa]/g;
@@ -1992,8 +1993,8 @@ sub Clean
 
 $p=~s/\\[Oz].//g;
 $p=~s/\\[ABbDHlLoRSvwXZ]$parcln//g;
-$p=~s/\\[hs][-+]?$parclntyp//g;
 $p=~s/\\[FfgkMmnVY]$parclntyp//g;
+$p=~s/\\[hs][-+]?$parclntyp//g;
 
 $p=~s/\\\((\w\w)/\\\[$1\]/g;   # convert \(xx to \[xx]
 

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 01/01: ANNOUNCE, ChangeLog: Log, ack previous commit.

2024-04-30 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 2de49ea2e3dc068f8b5bc0e6eb80c8a3aee7c1dc
Author: G. Branden Robinson 
AuthorDate: Tue Apr 30 06:38:56 2024 -0500

ANNOUNCE, ChangeLog: Log, ack previous commit.
---
 ANNOUNCE  |  1 +
 ChangeLog | 12 
 2 files changed, 13 insertions(+)

diff --git a/ANNOUNCE b/ANNOUNCE
index a63392efc..1ce5fc3b7 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -163,6 +163,7 @@ Bjarni Ingi Gislason
 Brian Inglis
 Bruno Haible
 Carsten Kunze
+Christof Meerwald
 Colin Watson
 Damian McGuckin
 Dave Kemper
diff --git a/ChangeLog b/ChangeLog
index 4bc2074ba..bb8fc9fb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-04-30  Christof Meerwald 
+
+   * src/devices/gropdf/gropdf.pl: Call PDFDate with the output of
+   `time` rather than one of the processed versions.
+   (PDFDate): Accept an epoch-seconds argument rather than a
+   reference to a list as returned by `gmtime` or `localtime`.
+   Calculate the relationship between local time and UT more
+   carefully.  Remove incorrect sign character before minutes
+   field.
+
+   Problem introduced in commit d7bbfb04ea, 9 July.
+
 2024-04-28  G. Branden Robinson 
 
* src/roff/troff/env.cpp

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 01/01: [gropdf] Fix date format.

2024-04-30 Thread Colin Watson
cjwatson pushed a commit to branch master
in repository groff.

commit 0815e503dba8d5c05921d68c6c718fe8f8440ee8
Author: Colin Watson 
AuthorDate: Tue Apr 30 12:06:31 2024 +0100

[gropdf] Fix date format.

Commit d7bbfb04ea25a82a8597cdef6ebb391cb78ab47c caused gropdf to emit
invalid PDF dates: the minutes field should not have a leading sign
character, and the sign character before the hours field should be "Z"
if local time is equal to Universal Time.

Thanks to Christof Meerwald for the report and the patch.

* src/devices/gropdf/gropdf.pl: Call PDFDate with the output of `time`
  rather than one of the processed versions.
  (PDFDate): Accept an epoch-seconds argument rather than a reference to
  a list as returned by `gmtime` or `localtime`.  Calculate the
  relationship between local time and UT more carefully.  Remove
  incorrect sign character before minutes field.
---
 src/devices/gropdf/gropdf.pl | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index acf86389f..1656db821 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -592,13 +592,7 @@ for $papersz ( split(" ", lc($possiblesizes).' #duff#') )
 # If we get here, $papersz was invalid, so try the next one.
 }
 
-my @dt;
-if ($ENV{SOURCE_DATE_EPOCH}) {
-@dt=gmtime($ENV{SOURCE_DATE_EPOCH});
-} else {
-@dt=localtime;
-}
-my $dt=PDFDate(\@dt);
+my $dt=PDFDate(time);
 
 my %info=('Creator' => "(groff version $cfg{GROFF_VERSION})",
  'Producer' => "(gropdf version $cfg{GROFF_VERSION})",
@@ -1102,14 +1096,19 @@ sub GetObj
 
 sub PDFDate
 {
-my $dt=shift;
+my $ts=shift;
+my @dt;
 my $offset;
+my $rel;
 if ($ENV{SOURCE_DATE_EPOCH}) {
$offset=0;
+   @dt=gmtime($ENV{SOURCE_DATE_EPOCH});
 } else {
-   $offset=mktime((localtime $dt)[0..5]) - mktime((gmtime $dt)[0..5]);
+   @dt=localtime($ts);
+   $offset=mktime(@dt[0..5]) - mktime((gmtime $ts)[0..5]);
 }
-
return(sprintf("D:%04d%02d%02d%02d%02d%02d%+03d'%+03d'",$dt->[5]+1900,$dt->[4]+1,$dt->[3],$dt->[2],$dt->[1],$dt->[0],int($offset/3600),int(($offset%3600)/60)));
+$rel=($offset==0)?'Z':($offset>0)?'+':'-';
+
return(sprintf("D:%04d%02d%02d%02d%02d%02d%s%02d'%02d'",$dt[5]+1900,$dt[4]+1,$dt[3],$dt[2],$dt[1],$dt[0],$rel,int(abs($offset)/3600),int((abs($offset)%3600)/60)));
 }
 
 sub ToPoints

___
Groff-commit mailing list
Groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit