groff/ChangeLog
G. Branden Robinson 2ee613cfb9 mdate.pl: Report dates in ISO 8601 format.
* mdate.pl: Report dates in ISO 8601 format (for man page center
  footers).  That is what we prescribe in groff_man_style(7), so it's
  only fair that we dog food our own recommendation.
2024-09-21 23:11:11 -05:00

10410 lines
393 KiB
Plaintext

2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* mdate.pl: Report dates in ISO 8601 format (for man page center
footers). That is what we prescribe in groff_man_style(7), so
it's only fair that we dog food our own recommendation.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* Makefile.am (set-man-page-time-stamps): New maintainer-mode
rule sets time stamps of man page source documents to match the
Git "author date" of their most recent commits. This is to make
the date reported in the center footer of the rendered page tell
the truth.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/afmtodit/afmtodit.tables: Update using the Unicode
16.0.0 version of the "UnicodeData.txt" file.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/afmtodit/afmtodit.tables: Update with freshly
changed "make-afmtodit-tables" script, adding ~192 mappings.
Fixes <https://savannah.gnu.org/bugs/?65716> (2/2). Thanks to
Deri James for the report.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/afmtodit/make-afmtodit-tables: Alter maintainer-mode
script to stop excluding code points from the Private Use Area
in the Unicode Basic Multilingual Plane from glyph mappings for
Adobe fonts (and workalikes). Doing so expands coverage to ~192
more glyphs, including groff's "braceex".
Fixes <https://savannah.gnu.org/bugs/?65716> (1/2). Thanks to
Deri James for the report.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (interpolate_macro): Fix code style
nits. Reorder equality comparisons to avoid inadvertent lvalue
assignment. Rename local variable `warned` to `was_warned` and
demote it from `int` to `bool`. Assign to it using Boolean, not
integer, literals. Explicitly compare variable of pointer type
to null pointer literal instead of letting it pun down to a
Boolean. Stop treating return value of `warning()` as
significant. If ever there was a function that was called only
for its side effects, that's it.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (device_request): Add extensive new
logic to subvert copy mode so as to interpret special character
escape sequences. We don't yet support _composite_ special
character escape sequences.
* src/roff/groff/tests/
device-control-special-character-handling.sh: Update and expand
test cases. Comment out one new case that doesn't yet work.
This change is in further service of the grueling march toward
resolution of <https://savannah.gnu.org/bugs/?63074>.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/groff.cpp (main): Clarify verbose output.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/groff.cpp: Boolify variables controlling
whether a command pipeline is constructed.
(run_commands): Demote `no_pipe` argument from `int` to `bool`.
(main): Rename `vflag` to `want_version_info` and demote it from
`int` to `bool`. Assign to it using Boolean, not integer,
literals.
* src/roff/groff/pipeline.c:
* src/roff/groff/pipeline.h:
(run_pipeline): Demote `no_pipe` argument from `int` to `bool`.
* src/roff/groff/pipeline.c: Include "stdbool.h" header file.
2024-09-20 G. Branden Robinson <g.branden.robinson@gmail.com>
[gxditview]: Accept the `-v` option groff(1) may supply.
* src/devices/xditview/xditview.c (Syntax): Report `-v` as an
accepted synonym of `-version` and `--version` in usage message.
(main): Refactor argument processing. Accept `-v`. Handle
early-exit options {`--help`, `--version` and their synonyms}
_before_ checking for an excess argument count, another error
condition.
* src/devices/xditview/gxditview.1.man (Synopsis): Document
`-v` option.
2024-09-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (remove_macro, rename_macro)
(alias_macro, chop_macro, stringdown_request, stringup_request)
(substring_request, length_request): Check for arguments: if
none are present, throw warning in category "missing" and skip
the remainder of the input line.
(do_string_case_transform): Add `assert()` since our callers
now require that arguments be present.
2024-09-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (decode_string_args): Improve
error diagnostic to disclose more context.
2024-09-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (close_stream): Handle being given a
nonexistent stream to close. Prevents null pointer dereference.
Continues 6d32f2492e, 13 September.
2024-09-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (open_file): Fix unsafe-mode SEGV
caused by null pointer dereference. Problem introduced by me in
commit 6d32f2492e, 13 September. Also add assertion; null
`FILE` stream pointers should not be getting stored in GNU
troff's `stream_dictionary`.
2024-09-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (report_color): Report color space
and channel assignments.
* doc/groff.texi.in (Debugging):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests):
* NEWS: Update documentation.
2024-09-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/include/color.h: Fix code style nit: drop unnecessary
`#include`.
2024-09-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (report_composite_characters): Fix
code style nit: eliminate unnecessary temporary variable.
2024-09-15 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Refactor. `\X` reads its delimited argument in
interpretation mode and the `device` request reads its argument
in copy mode. We want parity in special character handling for
these formatter instructions, but one works with tokenized
input and the other with tokens that happen to be a sequence of
ordinary characters. (In other words, in `\X'\[em]'` and
`.device \[em]`, the escape sequence "knows" that it is dealing
with a valid special character named "em", whereas the request
merely handles '\', '[', 'e', 'm', and ']' in series.) This
change is in service of the grueling march toward resolution of
<https://savannah.gnu.org/bugs/?63074>.
* src/roff/troff/input.cpp
(map_special_character_for_device_output): New function handles
all of the potential special (including composite) character
identifier rewriting formerly in...
(encode_special_character_for_device_output): ...this function,
which now simply calls the foregoing after extracting the
special character identifier from the `charinfo` of the current
token.
2024-09-15 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_device_extension): Make `\X`
escape sequence begin the first page of the document if it
hasn't begun already. In the "grout" page description language,
this puts the leading 'x' initialization commands on the output
stream, which we guarantee to come first in any such document.
Device extension commands 'x X' before that point are not
well-defined, and further this change brings `\X` into parity
with its sibling, the `device` request, which does so already.
2024-09-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Clean up streams on formatter exit.
* src/roff/troff/input.cpp (close_all_streams): New function
iterates `stream_dictionary` and closes each stream.
(exit_troff): Call `close_all_streams()`.
2024-09-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add `pstream` request.
* src/roff/troff/input.cpp (print_streams): New request handler
iterates through `stream_dictionary`, writing each entry.
(init_input_requests): Wire up `pstream` request to new handler.
2024-09-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Make groff streams objects of new `grostream` class, so
we can conveniently store more state in them.
* src/roff/troff/input.cpp (class grostream): Declare.
(grostream::grostream): Declare constructor.
(grostream::~grostream): Declare (trivial) destructor.
(print_streams): Report mode in which the stream was opened and
name of file backing it.
(open_file, close_stream, do_write_request)
(write_macro_request): Migrate to expect an object of type
`grostream` from a `stream_dictionary.lookup()` instead of a
pointer to `FILE`.
2024-09-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (close_request): Move stream-closing
logic (as opposed to request argument validation) into...
(close_stream): ...its own new function.
2024-09-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Declare global `stream_dictionary`
as type `object_dictionary` instead of `dictionary`, since we
want the stored values to be class objects instead of a
primitive data type.
(open_file, close_request): Update member function calls
appropriately; the former class uses return values for
`lookup()` and `remove()`, the latter does not.
(open_file): Clarify diagnostic when we try to reorient an
existing stream name to a new file, but can't close the old file
associated with the stream name.
(close_request): Remove the stream from the dictionary only if,
and after, we have successfully closed the `FILE` stream.
2024-09-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (class input_iterator): Trivially
refactor. Rename `eptr` member variable to `endptr`.
(input_stack::get, input_stack::finish_get, input_stack::peek)
(string_iterator::string_iterator, string_iterator::fill)
(string_iterator::peek, temp_iterator::temp_iterator): Migrate.
2024-09-12 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Slightly refactor. Move
responsibility for skipping the rest of the input line...
(open_file): ...from this internal helper function...
(open_request, opena_request): ...to these handler functions,
for better symmetry with other request handlers.
2024-09-12 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_open): The `write` request, an
"unsafe mode" feature, has been broken for a week. (As,
possibly, have others that write to streams.) Revert
`static_cast` operators to C-style casts, which seem to be
necessary (sometimes) with groff's bespoke, pre-STL `dictionary`
class implementation. Unfortunately, when static casts fail,
they fail silently, happily handing back null pointers that you
might not notice right away. Fixes problem introduced by me in
commit 3bb13e4752, 4 September.
2024-09-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (source_request)
(source_quietly_request, pipe_source_request, open_request)
(opena_request, close_request, macro_source_request)
(macro_source_quietly_request, ps_bbox_request): Check for
arguments: if none are present, throw warning in category
"missing" and skip the remainder of the input line.
2024-09-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor.
(do_open): Rename this...
(open_file): ...to this.
(open_request, opena_request): Update call sites.
2024-09-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor. Rename
request-handling functions to append `_request` to their names.
`source` -> `source_request`
`source_quietly` -> `source_quietly_request`
`pipe_source` -> `pipe_source_request`
`macro_source` -> `macro_source_request`
`macro_source_quietly` -> `macro_source_quietly_request`
(init_input_requests): Migrate to new names.
(open_request, opena_request): Clarify error diagnostics.
2024-09-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/soelim/soelim.1.man (Description):
* src/roff/groff/groff.1.man (groff-specific options, Usage)
(Getting started): Hyperlink man page cross references on first
occurrences.
Fixes <https://savannah.gnu.org/bugs/?66103>. Thanks to Helge
Kreutzmann and the manpage-l10n project for the report.
2024-09-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/html/pre-html.cpp (html_system): Improve report of
failing system(3) commands and fix code style nits. Use
standard constant symbol `STDOUT_FILENO` in favor of a "1"
literal. Parenthesize complex expressions. Recast diagnostic
message. Stop misreporting the `int` return value of `system()`
as the command's "(exit) status". The integer _encodes_ the
exit status in its lowest seven bits. Distinguish the cases of
the command exiting with a failing status, being signalled, and
being stopped, using standard POSIX macros; see wait(2).
2024-09-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/html/pre-html.cpp (imageList::createPage)
(imageList::createImage): Drop trailing newline from commands
constructed for passage to system(3). They (a) are unnecessary
and (b) make diagnostics repellently ugly.
2024-09-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/html/pre-html.cpp: Improve diagnostic message
handling.
(html_system)
(imageList::createPage)
(imageList::createImage)
(set_redirection)
(save_and_redirect)
(print_args [DEBUGGING]): Prefix output to standard error stream
with name of program.
(html_system [DEBUGGING])
(imageList::createPage [DEBUGGING])
(imageList::createImage [DEBUGGING])
(print_args [DEBUGGING]): Prefix output to standard error stream
with "debug:" message severity tag.
(main): Assign to `program_name` global variable before emitting
first diagnostic ([CAPTURE_MODE]), and convert that diagnostic
to use it.
2024-09-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/html/pre-html.cpp (dump_args): "`#if 0` out"
function with no call sites.
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp: Trivially refactor; rename variables
to better suggest their data types.
`suppress_start_page` -> `suppression_starting_page_number`
(suppress_node::tprint):
`current_page` -> `page_number`
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (indent, temporary_indent): Report
amount of computed indentation when warning of negative value.
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp
(possibly_handle_first_page_transition): Boolify.
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class top_level_diversion): Rename
`before_first_page` to `before_first_page_status` to emphasize
its non-Boolean nature.
* src/roff/troff/div.cpp
(top_level_diversion::top_level_diversion): Migrate constructor.
* src/roff/troff/div.cpp (top_level_diversion::output)
(top_level_diversion::transparent_output)
(top_level_diversion::copy_file)
(top_level_diversion::space)
(top_level_diversion::begin_page)
(vertical_position_reg::get_value)
(vertical_position_reg::get_string)
(nl_reg::get_string):
* src/roff/troff/env.cpp (environment::make_tag)
(environment::do_break, title):
* src/roff/troff/input.cpp
(possibly_handle_first_page_transition, device_request)
(copy_file, transparent_file): Explicitly compare to integer
literal instead of punning to Boolean.
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class top_level_diversion): Boolify
member variable `ejecting_page`, migrating trivial accessor and
mutator.
* src/roff/troff/div.cpp
(top_level_diversion::top_level_diversion): Migrate constructor.
(top_level_diversion::begin_page): Migrate.
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class top_level_diversion): Boolify and
rename member variable: `have_next_page_number` ->
`overriding_next_page_number`.
* src/roff/troff/div.cpp (top_level_diversion::begin_page)
(top_level_diversion::set_next_page_number)
(top_level_diversion::get_next_page_number): Migrate.
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class diversion, class macro_diversion)
(class top_level_diversion): Boolify trivial member function
`is_diversion()`.
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class diversion, class macro_diversion)
(class top_level_diversion): Boolify and rename `space()` member
function argument, demoting `forced` from `int` to `bool`, and
renaming it `forcing`, for symmetry with `appending` and
`boxing`.
* src/roff/troff/div.cpp (macro_diversion::space)
(top_level_diversion::space, continue_page_eject)
(save_vertical_space, output_saved_vertical_space):
* src/roff/troff/input.cpp (exit_troff): Migrate.
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class diversion, class macro_diversion)
(class top_level_diversion): Boolify `output()` member function
argument, demoting `retain_size` from `int` to `bool`.
* src/roff/troff/div.cpp (macro_diversion::output)
(top_level_diversion::output): Boolify at definition sites.
This variable seems to be coupled to `suppress_filling` in
"env.cpp".
2024-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (do_divert): Boolify function arguments.
Comment formal argument names as a compromise with the
Stroustrup-style C++ used in most of groff.
* src/roff/troff/div.h (class diversion):
* src/roff/troff/env.h (class environment): Update friend
declarations.
* src/roff/troff/div.h (class macro_diversion): Similarly
boolify and rename constructor argument.
* src/roff/troff/div.cpp (do_divert, divert, divert_append, box,
box_append): Boolify function arguments. Rename `append` to
`appending`, to match the existing `boxing`.
(macro_diversion::macro_diversion): Similarly boolify and rename
constructor argument.
2024-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp (begin_page): Boolify local variable
`got_arg`.
2024-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class diversion): Boolify member
variables that cache values of Boolean member variables of
`environment` class. Mark them as possibly nilpotent; when I
experimentally deleted each of them, no automated tests failed,
and even Peter's fearfully complex mom(7) documents looked fine.
Possibly a task for groff 1.25.
2024-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class diversion): Boolify and rename
member variable `no_space_mode` to `is_in_no_space_mode`.
* src/roff/troff/div.cpp (diversion::diversion): Use new name
and construct with Boolean, not integer, literal.
(macro_diversion::output, top_level_diversion::output)
(top_level_diversion::copy_file, top_level_diversion::space)
(begin_page, space_request, blank_line)
(no_space_mode_reg::get_value, no_space_mode::get_string):
Migrate to new name and assign to with Boolean, not integer,
literal.
2024-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp (class diversion): Drop unused member
variables `any_chars_added` and `needs_push`.
2024-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp (macro_diversion::macro_diversion):
Boolify argument to `macro` object constructor, using Boolean
instead of integer literal. Continues commit 7c5b8e5d4a, 27
August.
2024-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (macro_diversion::macro_diversion)
(page_number): Use C++ `static_cast` operator instead of C-style
type cast.
(top_level_diversion::find_next_trap)
(top_level_diversion::add_trap): Parenthesize complex
expressions.
(page_number, vertical_position_traps): Zero-initialize
stack-allocated integer.
(macro_diversion::macro_diversion)
(top_level_diversion::find_next_trap)
(top_level_diversion::add_trap, page_number): Reorder equality
comparisons to avoid inadvertent lvalue assignment.
2024-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (troff_output_file::fill_color):
Explicitly compare variable of pointer type to null pointer
literal instead of letting it pun down to a Boolean.
(glyph_node::add_self)
(dbreak_node::merge_glyph_node):
(kern_pair_node::merge_glyph_node):
(kern_pair_node::add_discretionary_hyphen): Reorder equality
comparisons to avoid inadvertent lvalue assignment.
(kern_pair_node::merge_glyph_node): Chain assignments as is done
in the rest of this file.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (print_env): Improve environment
report. Don't report two items of stale data about a completed
line, and describe them more intelligibly. Say "text length"
rather than "total width"; the former is what is compared to the
already reported "target text length". Clarify "total number of
spaces" as "number of adjustable spaces"; that's what's really
counted. Relocate report of "target text length" to more
closely follow "text length" and "number of adjustable spaces"
to make their relationship more obvious.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment_copy, space_size):
Check for arguments: if none are present, throw warning in
category "missing" and skip the remainder of the input line.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment_copy): Use C++
`static_cast` operator instead of C-style type cast. Explicitly
compare variable of pointer type to null pointer constant
instead of letting it pun down to a Boolean.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::output_line): Resize
stack-allocated character buffer to use constant defined by
libgroff for formatting unsigned `int`s as strings. Use
sprintf(3)'s 'u' conversion, not 'd', for output line number,
which cannot be negative. Explicitly discard return value of
sprintf(3).
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (class troff_output_file):
Drop `tf` and `gcol` arguments from declaration, because...
(troff_output_file::start_device_extension): Cease output of
commands to update the font, stroke color, and drawing position.
Drop now-unused `tf` and `gcol` arguments.
(device_extension_node::tprint_start): Drop `tf` and `gcol`
arguments from call site.
* tmac/tests/an_MR-works.sh: Update test expectations. The
expected commands shift location by two lines, but the output
still behaves as desired.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp
(troff_output_file::start_device_extension): Call `flush_tbuf()`
before any other function that may write to device-independent
output.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp
(troff_output_file::start_device_extension): Stop calling
`do_motion()` in argumentless version, which is called only when
writing HTML (specifically, when inlining images). It seemed to
accomplish nothing. No tests fail and "pic.html", a document
with many images, continues to render fine. In
device-independent output, a pair of absolute positioning
commands ('H' and 'V') moves to a redundant place, but the HTML
produced is identical (except for a date stamp in a comment).
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/token.h (class token): Rename enumeration
constant from `TOKEN_SPECIAL` to `TOKEN_SPECIAL_CHAR`. Rename
member function declaration from `is_special()` to
`is_special_character()`. Tokens can represent multiple types
of formatter objects (at least three of which, "special
characters", "special fonts", and "special nodes", have member
functions named `is_special()`, and which have little to do with
each other).
(token::is_special): Rename this...
(token::is_special_character): ...to this.
* src/roff/troff/input.cpp (token::next, token:operator==)
(token::description, token::get_char)
(token::add_to_zero_width_node_list, token::process): Use new
enumeration constant.
(encode_character_for_device_output): Update `is_special()`
call site.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
Migrate to "device extension [command]" terminology.
* src/devices/grodvi/grodvi.1.man:
* src/devices/gropdf/gropdf.1.man:
* src/devices/grops/grops.1.man:
* src/devices/grotty/grotty.1.man: Do it.
* tmac/tests/an_MR-works.sh: Update test output.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor and reform terminology. Call `\X`
escape sequence and `device` request device _extension_
instructions. There is already, in groff, a device command
'x u' that configures underlining of spaces (and which is
implemented only by grotty(1)). A dusty corner, to be sure, but
we could support others in the future, and further, the new term
indicates the fact that `\X` and `device` produce arguments only
for 'x X' "sub"-commands--this has always been the case and for
`\X` it was true even in Kernighan troff.
* src/roff/troff/input.cpp (do_device_control): Rename this...
(do_device_extension): ...to this.
(do_device_extension, device_request): Migrate diagnostic
messages.
* src/roff/troff/troff.1.man (Options): Migrate terminology.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Rename `special_node` class to `device_extension_node`.
* src/roff/troff/node.h (class special_node): Rename this...
(class device_extension_node): ...to this. Rename constructors.
* src/roff/troff/node.cpp
(device_extension_node::device_extension_node): Rename
constructors.
(special_node::is_same_as): Rename this...
(device_extension_node::is_same_as): ...to this.
(special_node::type): Rename this...
(device_extension_node::type): ...to this. Update return
string.
(special_node::ends_sentence): Rename this...
(device_extension_node::ends_sentence): ...to this.
(special_node::causes_tprint): Rename this...
(device_extension_node::causes_tprint): ...to this.
(special_node::is_tag): Rename this...
(device_extension_node::is_tag): ...to this.
(special_node::copy): Rename this...
(device_extension_node::copy): ...to this.
(special_node::tprint_start): Rename this...
(device_extension_node::tprint_start): ...to this.
(special_node::tprint_char): Rename this...
(device_extension_node::tprint_char): ...to this.
(special_node::tprint_end): Rename this...
(device_extension_node::tprint_end): ...to this.
(special_node::get_tfont): Rename this...
(device_extension_node::get_tfont): ...to this.
* src/roff/troff/env.cpp (configure_space_underlining)
(environment::make_tag):
* src/roff/troff/input.cpp (token::next, do_device_control)
(device_request, device_macro_request): Update constructor
calls.
* src/roff/troff/input.cpp (special_node::tprint): Rename
this...
(device_extension_node::tprint): ...to this.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp (flush_output): Rename this...
(flush_request): ...to this. Also declare it `static` since it
has no callers external to the translation unit.
(init_div_requests): Update request initialization.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (class troff_output_file): Trivially
refactor. Rename member functions declarations.
`start_special` -> `start_device_extension`
`special_char` -> `write_device_extension_char`
`end_special` -> `end_device_extension`
(troff_output_file::start_special): Rename this...
(troff_output_file::start_device_extension): ...to this.
(troff_output_file::special_char): Rename this...
(troff_output_file::write_device_extension_char): ...to this.
(troff_output_file::end_special): Rename this...
(troff_output_file::end_device_extension): ...to this.
(special_node::tprint_start, special_char::tprint_char)
(special_node::tprint_end, suppress_node::put)
(suppress_node::tprint): Update call sites.
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (class troff_output_file): Declare new
`flush` member function.
(troff_output_file::flush): New member function calls
`flush_tbuf()` and calls `real_output_file`'s own `flush` member
function.
2024-09-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/reg.cpp (dump_register): Report assigned format
of register only if it is not string-valued.
* doc/groff.texi.in (Debugging):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests):
* NEWS: Update documentation.
2024-09-02 Sven Schober <sv3sch@gmail.com>
[man]: Handle discrepant `pdf{images,totext}`.
There are at least two different implementation variants for
pdfimages and pdftotext out there: poppler's and
xpdfreader.com's.
* tmac/tests/an_UR-works.sh: Cope with minute syntax differences
between these implementations in test case.
Fixes <https://savannah.gnu.org/bugs/?66155> (1/2).
2024-09-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::next)
(map_composite_character, composite_glyph_name): Use new
`errbuf` argument of libgroff's `valid_unicode_code_sequence()`
to return information about how the input Unicode special
character identifier was defective.
2024-09-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::next)
(map_composite_character, composite_glyph_name): Slightly
refactor. Introduce temporaries for brevity.
2024-09-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (font_size::dump_size_table): Fix
thinko: report scaling unit as 'z', not 's'.
* src/roff/groff/tests/sizes-request-works.sh: Update test
expectations.
Continues commit f574a96f58, 3 September.
2024-09-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/nroff/nroff.sh: Update usage message, noting support
for options -[aDIZ].
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_open): Fix code style nits.
Use C++ `static_cast` operator instead of C-style type casts.
Emit error diagnostic if `fclose()` fails.
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* Makefile.am: Revise and update internal documentation.
Fixes <https://savannah.gnu.org/bugs/?64913>. Thanks to Bjarni
Ingi Gislason for the report.
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (usage): Break lines in usage
message.
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (usage): De-document `-h` as synonym
for `--help`. That's not true for GNU troff.
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor, renaming internal symbols matching
`glyph_color` to `stroke_color`; the latter is what our
documentation uses, and the glyph color is applied to things
other than glyphs--the outlines of geometric figures.
* src/roff/troff/env.h (class environment): Rename member
variables and functions in declarations.
`glyph_color` -> `stroke_color`
`prev_glyph_color` -> `prev_stroke_color`
`get_glyph_color` -> `get_stroke_color`
`get_prev_glyph_color` -> `get_prev_stroke_color`
`set_glyph_color` -> `set_stroke_color`
* src/roff/troff/env.cpp: Migrate. Update member function
definitions accordingly.
(environment::environment): Update constructors.
(environment::copy): Update back end of `evc` (_not_ a copy
constructor).
(glyph_color_change): Rename this...
(stroke_color_change): ...to this.
(title, environment::get_stroke_color_string): Update accesses
to member variables.
(init_env_requests): Wire up `gcolor` request to
`stroke_color_change()`. Wire up `.m` register to
`get_stroke_color_string()`.
* src/roff/troff/input.h: Migrate declaration.
(do_glyph_color): Rename this...
(do_stroke_color): ...to this.
* src/roff/troff/input.cpp: Migrate.
(do_stroke_color): Use new member function name
`set_stroke_color()`.
(token::next): Wire up `\m` escape sequence to
`do_stroke_color()`.
(read_drawing_command): Construct node using
`get_stroke_color()`.
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/reg.cpp (assign_register_format_request):
Align wording of error diagnostic with warnings thrown by same
function.
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_term): Reject scaling
units other than `f` in contexts where `f` is expected
{dimensionless values in the unit interval expressing the
magnitude of a color channel}.
Fixes <https://savannah.gnu.org/bugs/?60955>.
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_term): Accept `p` and `s`
scaling units in expressions where `z` is accepted. Also fix
code style nit: parenthesize complex expressions.
* doc/groff.texi.in (Using Fractional Type Sizes):
* man/groff_diff.7.man (Fractional type sizes and new scaling
units):
* NEWS: Document this.
* doc/groff.texi.in (Using Fractional Type Sizes): Add example.
Fixes <https://savannah.gnu.org/bugs/?66150>.
2024-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (point_size, override_sizes): Ignore
request in nroff mode, like `fam`.
2024-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (override_sizes): Fix regression
introduced in commit 5f2704d64a, yesterday. However, it was
hard to tell whether the request works.
(font_size::dump_size_table): New static member function reports
the valid size table of the environment's currently selected
font.
(environment::print_env): Report the valid size table.
* src/roff/groff/tests/sizes-request-works.sh: Test it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
Fixes <https://savannah.gnu.org/bugs/?66164>.
2024-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
Add tests to prevent recurrence of Savannah #66164.
* src/roff/groff/tests/pi-request-works.sh:
* src/roff/groff/tests/sy-request-works.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run tests.
Continues fixing <https://savannah.gnu.org/bugs/?66164>. (We
still need a regression test for the `sizes` request, but there
is no straightforward means of introspecting that aspect of
environment state at present.)
2024-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (pipe_output, system_request): Fix
requests I broke in commit 5f2704d64a, yesterday. Thanks to
Deri James for the report.
Begins fixing <https://savannah.gnu.org/bugs/?66164>. (We need
regression tests.)
2024-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Didja ever notice that `pnr` produces a lot of output,
and it isn't sorted? The `pnr` request now supports dumping
only of registers specified as arguments.
* src/roff/troff/reg.h (look_up_register): Add second argument,
`suppress_creation`, with default `false` value, in declaration.
* src/roff/troff/reg.cpp (look_up_register): Skip emission of
warning and register definition on lookup of nonexistent
register if `suppress_creation` is true.
(dump_register): New function takes over the work, formerly in
`dump_register_request()`, of writing to stderr.
(dump_register_request): Handle arguments, treating each as a
register identifier and dumping it. Otherwise behave as before.
* doc/groff.texi.in (Debugging):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests):
* NEWS: Document it.
2024-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/reg.cpp (dump_register_request): Report the
interpolation format of each register at a further tab stop.
* doc/groff.texi.in (Debugging):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests):
* NEWS: Document it.
2024-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/reg.cpp (dump_register_request): Fix code style
nit. Use C++ `reinterpret_cast` operator instead of C-style
type cast. (The use of the "dangerously omnipotent" casting
operator is made necessary by groff's pre-template dictionary
implementation.)
2024-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/reg.cpp: Trivially refactor. Rename all
functions implementing request handlers such that they end with
"_request", a practice already fitfully adopted elsewhere in GNU
troff. The idea is to help contributing developers navigate the
source code more easily.
(define_register, alter_format, remove_reg, alias_reg)
(rename_reg, print_registers): Rename these...
(define_register_request, assign_register_format_request)
(remove_register_request, alias_register_request)
(rename_register_request, dump_register_request): ...to these.
2024-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/reg.cpp (define_register, alter_format)
(remove_reg, alias_reg, rename_reg): Give warning category
"missing" more exercise. Handle omitted register arguments
where we can communicate more information about where request
parsing has gone wrong.
* src/roff/troff/reg.cpp (define_register, alter_format)
(alias_reg): Add assertions for paranoia's sake.
2024-09-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (associate_style_with_font_position):
Clarify warning diagnostic.
2024-09-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (define_color, device_request):
* src/roff/troff/node.cpp (translate_font, set_special_fonts)
(zoom_font): Align diagnostic wording with similar messages.
* src/roff/troff/input.cpp (define_color): Add an assertion for
paranoia's sake.
2024-09-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (pipe_source, open_request)
(opena_request, hyphenation_patterns_file_code, pipe_output)
(system_request): Migrate wording of error diagnostics to
describe, rather than name, the request at issue, because
requests can be aliased and moreover the original names can then
be removed. This change might also help GNU troff be more
self-documenting, though many requests remain a bit esoteric.
2024-09-02 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Update input token pointer appropriately when certain
requests requiring arguments are invalidly invoked without them.
* src/roff/troff/env.cpp (override_sizes):
* src/roff/troff/input.cpp (while_request, pipe_output)
(system_request): Check for arguments: if none are present,
throw warning in category "missing" and skip the remainder of
the input line.
(pipe_output, system_request): Add some assertions for
paranoia's sake.
Fixes <https://savannah.gnu.org/bugs/?66151>.
2024-09-02 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: The `kern` request now interprets arguments with
negative values as instructions to disable the corresponding
feature, using the *roff integer-to-Boolean conversion idiom
instead of the C/C++ one. Thus, if you invoke this request with
a register interpolation, the outcome agrees with an `if` test
of the register's value.
* src/roff/troff/node.cpp: Demote type of global
`global_kern_mode` from `int` to `bool`.
(set_kerning_mode): Assign value to `global_kern_mode` using
*roff integer-to-Boolean conversion idiom. When no argument is
present, assign using Boolean, not integer, literal.
(init_node_requests): Back `.kern` register with an object of
class `readonly_boolean_register` instead of
`readonly_register`.
* doc/groff.texi.in (Ligatures and Kerning):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests):
* NEWS: Document it.
2024-09-02 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Prevent nested use of `do` requests from causing an
assertion failure.
* src/roff/troff/input.cpp: Improve handling of nested
selections of compatibility mode. Use a global STL stack of
`bool`, `want_att_compat_stack`, to manage them. Drop global
`int` `do_old_want_att_compat` with its less-useful-than-hoped
"-1" value to signal an outermost "scope".
(do_request): Drop dubious `assert()`ion. Push the value of
`want_att_compat` onto the stack before invoking/calling the
named request/macro, and pop it afterwards.
(class enclosing_want_att_compat_reg): Add new class to handle
dynamic construction of `.cp` register value. I modeled the
approach on an idiom heavily used in "env.cpp", where read-only
registers are not modeled as accessors of C++ globals, because
they interpolate per-environment state.
(enclosing_want_att_compat_reg::get_string): Member function of
new class constructs `.cp` register value by peeking at the top
of `want_att_compat_stack`.
(init_input_requests): Wire up `.cp` register to an object of
`enclosing_want_att_compat_reg` class instead of now-dead
`do_old_want_att_compat` global.
Fixes <https://savannah.gnu.org/bugs/?66110>. Problem
introduced by me when introducing `.cp` register in commit
6a37bb5f00, 17 April 2020. Thanks to Bjarni Ingi Gislason for
suggesting the direction a minimal reproducer could take.
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
Regression-test Savannah #61100.
* src/roff/groff/tests/\
double-do-request-does-not-raise-assertion.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
2024-09-02 G. Branden Robinson <g.branden.robinson@gmail.com>
[groff]: Rename test scripts to better fit recent conventions.
We now use underscores only for structuring, as with the
various macro packages in the "tmac" directory.
* src/roff/groff/tests/ab_works.sh:
* src/roff/groff/tests/adjustment_works.sh:
* src/roff/groff/tests/\
use_point_size_escape_with_single_digit_arg.sh:
* src/roff/groff/tests/break_zero-length_output_line_sanely.sh:
* src/roff/groff/tests/\
device_control_escapes_express_basic_latin.sh:
* src/roff/groff/tests/\
do_not_loop_infinitely_when_breaking_cjk.sh:
* src/roff/groff/tests/dot-cp_register_works.sh:
* src/roff/groff/tests/dot-nm_register_works.sh:
* src/roff/groff/tests/dot-nn_register_works.sh:
* src/roff/groff/tests/dot-trap_register_works.sh:
* src/roff/groff/tests/output_driver_C_and_G_options_work.sh:
* src/roff/groff/tests/evc_produces_no_output_if_invalid.sh:
* src/roff/groff/tests/fp_should_not_traverse_directories.sh:
* src/roff/groff/tests/handle_special_input_code_points.sh:
* src/roff/groff/tests/smoke-test_html_device.sh:
* src/roff/groff/tests/html_works_with_grn_and_eqn.sh:
* src/roff/groff/tests/initialization_is_quiet.sh:
* src/roff/groff/tests/on_latin1_device_oq_is_0x27.sh:
* src/roff/groff/tests/localization_works.sh:
* src/roff/groff/tests/msoquiet_works.sh:
* src/roff/groff/tests/recognize_end_of_sentence.sh:
* src/roff/groff/tests/soquiet_works.sh:
* src/roff/groff/tests/string_case_xform_requests.sh:
* src/roff/groff/tests/string_case_xform_errors.sh:
* src/roff/groff/tests/string_case_xform_unicode_escape.sh:
* src/roff/groff/tests/substring_works.sh: Rename these...
* src/roff/groff/tests/ab-request-works.sh:
* src/roff/groff/tests/adjustment-works.sh:
* src/roff/groff/tests/\
backslash-s-works-with-single-digit-argument.sh:
* src/roff/groff/tests/break-zero-length-output-line-sanely.sh:
* src/roff/groff/tests/\
device-control-escapes-express-basic-latin.sh:
* src/roff/groff/tests/\
do-not-loop-infinitely-when-breaking-cjk.sh:
* src/roff/groff/tests/dot-cp-register-works.sh:
* src/roff/groff/tests/dot-nm-register-works.sh:
* src/roff/groff/tests/dot-nn-register-works.sh:
* src/roff/groff/tests/dot-trap-register-works.sh:
* src/roff/groff/tests/driver-C-and-G-options-work.sh:
* src/roff/groff/tests/\
evc-request-produces-no-output-if-invalid.sh:
* src/roff/groff/tests/\
fp-request-does-not-traverse-directories.sh:
* src/roff/groff/tests/handle-special-input-code-points.sh:
* src/roff/groff/tests/html-device-smoke-test.sh:
* src/roff/groff/tests/html-device-works-with-grn-and-eqn.sh:
* src/roff/groff/tests/initialization-is-quiet.sh:
* src/roff/groff/tests/latin1-device-maps-oq-to-0x27.sh:
* src/roff/groff/tests/localization-works.sh:
* src/roff/groff/tests/msoquiet-request-works.sh:
* src/roff/groff/tests/recognize-end-of-sentence.sh:
* src/roff/groff/tests/soquiet-request-works.sh:
* src/roff/groff/tests/stringdown-and-stringup-requests-work.sh:
* src/roff/groff/tests/\
stringdown-request-rejects-request-names.sh:
* src/roff/groff/tests/\
stringup-request-transforms-non-basic-latin.sh:
* src/roff/groff/tests/substring-request-works.sh: ...to these.
* src/roff/groff/groff.am (groff_TESTS, groff_XFAIL_TESTS):
Update macro assignments accordingly.
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_request): Fix assertion failure.
Validate presence of arguments before further operating.
Fixes:
$ echo '.do' | ./build/test-groff
troff: ../src/roff/troff/input.cpp:9050: request_or_macro*
lookup_request(symbol): Assertion `!nm.is_null()' failed.
.../groff: error: troff: Aborted (core dumped)
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (hyphenate): Explicitly compare
variable of pointer type to null pointer constant instead of
letting it pun down to a Boolean.
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (family_change): Ignore `fam` request
if in nroff mode.
* src/roff/troff/node.cpp (embolden_font): Ignore `bd` request
if in nroff mode.
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (asciify_macro, unformat_macro):
(warnscale_request, translate, translate_no_transparent)
(translate_input): Check for mandatory arguments to each of
these requests (`asciify`, `unformat`, `warnscale`, `tr`,
`trnt`, and `trin`), and throw warning in category "missing" if
they are lacking.
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (title):
* src/roff/troff/input.cpp (copy_file, vjustify [0])
(transparent_file): Throw warning in category "missing" and
ignore the request if given no arguments, instead of starting
the document and producing device-independent output.
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (has_arg): Improve and slightly
optimize; return `false` immediately if the current token is a
newline. This is more responsive when running interactively,
particularly with the new support for "peeking" ahead in the
input stream by requests that read their arguments in copy mode
{and in some other cases}.
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp
(encode_special_character_for_device_output): Fix off-by-one
error in C-style string handling, which led to truncation of
composite Unicode special character sequence in some cases.
Fixes problem introduced by me in commit c8332c5c1a, 25 August.
Thanks to Deri James for the report.
2024-08-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::choose_breakpoint): Fix
code style nit: parenthesize complex expressions.
2024-08-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/tests/\
device-control-special-character-handling.sh:
* src/roff/groff/tests/\
device_control_escapes_express_basic_latin.sh: Revise test
expectations.
Continues fixing Savannah #63074.
2024-08-30 G. Branden Robinson <g.branden.robinson@gmail.com>
[groff]: Add test of diagnostics for attempts to write invalid
things to device-independent output. We don't generally write
tests for invalid or incorrect input, but this particular area
has been a sore and poorly understood point for a long time.
* src/roff/groff/tests/unencodable-things-in-grout.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
Continues fixing Savannah #63074.
2024-08-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp
(encode_special_character_for_device_output): Demote diagnostics
arising from non-encodable items from errors to warnings in
category "char", since unlike most (all?) errors, GNU troff
continues processing input on the control line or within the
escape sequence argument. Clarify language to make it clearer
what is wrong with the rejected input.
Continues fixing Savannah #63074.
2024-08-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp
(encode_special_character_for_device_output): Improve detection
of non-Unicode special character escape sequences.
2024-08-30 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Reject some nonsense in `\X` arguments.
* src/roff/troff/input.cpp
(encode_special_character_for_device_output): Reject tab,
leader, and backspace characters in a `\X` device extension
escape sequence argument. Silently ignore hyphen indicator
`\%`, dummy character `\&`, and zero-width break `\:` escape
sequences in such arguments.
Continues fixing Savannah #63074.
2024-08-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/unicode.cpp (valid_unicode_code_sequence):
Tighten wording of error diagnostic.
2024-08-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (usage): Sync language with troff(1).
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
Update with respect to Unicode 15.1.0.
* src/libs/libgroff/uniuni.cpp:
* src/utils/afmtodit/afmtodit.tables: Regenerate.
Fixes <https://savannah.gnu.org/bugs/?64683>.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/make-uniuni: Fix code style nits. Permit
override via environment of `CPP` variable locating C
preprocessor program. Reduce `$0` to its "basename", and
actually use, in the usage message, the variable set aside for
that purpose. Exit with status 2, not 1, on usage error.
In generated C++ file:
- Drop old-style Emacs file-local variable.
- Use variable of type `size_t`, not `unsigned int`, to index
array.
- Use libgroff's newfangled `array_length()` template function
to measure arrays.
- Annotate why we retain a C-style type cast.
- Add editor aid comments.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/{fallbacks,tty}.tmac: Reorganize. Move recently added
fallbacks for "ascii" device from "fallbacks.tmac" to "tty.tmac"
since they are particular to one output device.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Begin fixing Savannah #63074: support construction of
arbitrary byte sequences in device control commands using groff
special character sequence notation.
* src/roff/troff/input.cpp
(encode_special_character_for_device_output): Enhance. When
constructing the content of a device control escape sequence
{and, in the future, that of a `device` request}, try harder to
convert special characters into something meaningful. If a
special character identifier looks like something other than an
attempt at a Unicode special character escape sequence already,
try to convert it into one. Otherwise, write any valid Unicode
special character identifier {in groff notation: `\[u123ABC]`}
to the macro being assembled {and thence the `special` node, and
ultimately the `x X` command this node type produces}.
* src/roff/groff/tests/\
device-control-special-character-handling.sh: Update test
expectations. "\[u1F6C3]" is now correctly passed through, and
"\[`a]" correctly converted to "\[u00E0]". Shorten test cases a
little.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp
(encode_special_character_for_device_output): Require a
non-empty special character escape sequence argument in _both_
paths through the start of the function.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp: Trivially refactor. Rename and
boolify file-scoped variable `vertical_position_traps_flag` to
`honor_vertical_position_traps`. Initialize and assign to it
using Boolean, not integer, literals. Also parenthesize complex
expressions.
(macro_diversion::output, macro_diversion::space)
(top_level_diversion::output, top_level_diversion::space)
(top_level_diversion::begin_page, continue_page_eject)
(vertical_position_traps, init_div_requests): Do it.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify and rename member function of `node` class
hierarchy to `did_space_merge()`. Its former name,
`merge_space()`, was ambiguous. There is a difference between
_testing_ a condition's truth value and _assigning_ one to it,
and further with performing some sort of side effect. {Without
having read the foregoing, which did `merge_space()` mean?}
Functional languages--including any language that distinguishes
"pure" functions from those with side effects--are better at
getting the programmer to consider these matters.
* src/roff/troff/node.h
(struct node)
(class space_node)
(class word_space_node)
(class unbreakable_space_node):
Rename `merge_space()` member function declarations to
`did_space_merge()` and demote return type from `int` to `bool`.
* src/roff/troff/node.cpp
(node::did_space_merge)
(space_node::did_space_merge)
(word_space_node::did_space_merge)
(unbreakable_space_node::did_space_merge):
Rename `merge_space()` member function definition to
`did_space_merge()` and demote return type from `int` to `bool`.
* src/roff/troff/env.cpp (environment::space_newline)
(environment::space): Update call sites.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify and rename member function of `node` class
hierarchy to `causes_tprint()`. This function indicates whether
the node requires certain formatter state (roughly, changes to
the environment) to be flushed to output before the next node is
written ("tprint"ed).
* src/roff/troff/node.h
(struct node)
(class line_start_node)
(class space_node)
(class word_space_node)
(class unbreakable_space_node)
(class diverted_space_node)
(class diverted_copy_file_node)
(class extra_size_node)
(class vertical_size_node)
(class hmotion_node)
(class space_char_hmotion_node)
(class vmotion_node)
(class hline_node)
(class vline_node)
(class dummy_node)
(class transparent_dummy_node)
(class zero_width_node)
(class left_italic_corrected_node)
(class overstrike_node)
(class bracket_node)
(class special_node)
(class suppress_node)
(class tag_node)
(class draw_node):
* src/roff/troff/node.cpp
(class glyph_node)
(class ligature_node)
(class kern_pair_node)
(class dbreak_node)
(class hyphen_inhibitor_node)
(class italic_corrected_node)
(class break_char_node)
(class composite_node):
* src/roff/troff/input.cpp
(class non_interpreted_char_node)
(class token_node)
(class non_interpreted_node):
Rename `force_tprint()` member function declarations to
`causes_tprint()` and demote return type from `int` to `bool`.
* src/roff/troff/node.cpp
(hyphen_inhibitor_node::causes_tprint)
(node::causes_tprint)
(space_node::causes_tprint)
(special_node::causes_tprint)
(tag_node::causes_tprint)
(suppress_node::causes_tprint)
(unbreakable_space_node::causes_tprint)
(draw_node::causes_tprint)
(extra_size_node::causes_tprint)
(vertical_size_node::causes_tprint)
(hmotion_node::causes_tprint)
(space_char_hmotion_node::causes_tprint)
(vmotion_node::causes_tprint)
(hline_node::causes_tprint)
(vline_node::causes_tprint)
(dummy_node::causes_tprint)
(transparent_dummy_node::causes_tprint)
(zero_width_node::causes_tprint)
(italic_corrected_node::causes_tprint)
(left_italic_corrected_node::causes_tprint)
(overstrike_node::causes_tprint)
(bracket_node::causes_tprint)
(composite_node::causes_tprint)
(glyph_node::causes_tprint)
(ligature_node::causes_tprint)
(kern_pair_node::causes_tprint)
(dbreak_node::causes_tprint)
(break_char_node::causes_tprint)
(line_start_node::causes_tprint)
(word_space_node::causes_tprint)
(diverted_space_node::causes_tprint)
(diverted_copy_file_node::causes_tprint):
* src/roff/troff/input.cpp
(non_interpreted_char_node::causes_tprint)
(token_node::causes_tprint)
(non_interpreted_node::causes_tprint):
Rename `force_tprint()` member function definition to
`causes_tprint()` and demote return type from `int` to `bool`.
* src/roff/troff/node.cpp
(troff_output_file::really_print_line): Update call site.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp: Fix code style nits.
(troff_output_file::put_char_width): Parenthesize complex
expressions. Memorization of the ~15-17-level C and C++
operator precedence tables should be a matter of shame, not
pride.
(special_node::is_same_as): Use `static_cast` instead of C-style
cast.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (class troff_output_file): Boolify
final argument to `start_special` member function.
(troff_output_file::start_special): Rename argument from
`no_init_string` to `omit_command_prefix` and demote it from
`int` to `bool`.
(special_node::tprint_start): Update call site to use new name.
* src/roff/troff/node.h (class special_node): Rename member
variable from `no_init_string` to `lacks_command_prefix` and
demote it from `int` to `bool`.
* src/roff/troff/node.cpp (special_node::special_node): Update
constructor initialization lists.
(special_node::is_same_as): Update to use new name.
(special_node::copy): Update constructor call.
(special_node::tprint): Rename argument to `start_special` call
on `troff_output_file` object: here is where the
`lacks_command_prefix` property of the `special_node` becomes an
instruction to the `troff_output_file` object to omit that
prefix.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Boolify `troff_output_file` class.
Demote member variables from `int` to `bool` and rename them.
`force_motion` -> `must_update_drawing_position`
`begun_page` -> `has_page_begun`
(troff_output_file::really_print_line)
(troff_output_file::do_motion)
(troff_output_file::put_char_width)
(troff_output_file::really_on)
(troff_output_file::really_begin_page)
(troff_output_file::really_copy_file)
(troff_output_file::troff_output_file): Update names and assign
Boolean, not integer, literals.
2024-08-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (class input_iterator)
(input_iterator::input_iterator): Boolify. Demote constructor
argument, member variable `is_diversion`, and member functions
`has_args`, `space_follows_arg`, `is_macro` `int` arguments or
return types from `int` to `bool`. Return Boolean, not integer,
literals from these and from `set_location` and `next_file`
member functions, the latter previously (partially) boolified.
(class file_iterator): Boolify `seen_escape` member variable.
Boolify and rename two others.
`popened` -> `was_popened`
`newline_flag` -> `seen_newline`
Demote return type of `next_file` member function from `int` to
`bool`.
(file_iterator::file_iterator): Update initializer list of
constructor accordingly.
(file_iterator::close, file_iterator::next_file)
(file_iterator::file, file_iterator::backtrace): ...and member
function definitions to use new names and type literals.
(class input_stack)
(input_stack::space_follows_arg):
Similarly boolify member function.
(input_stack::pop_macro): Boolify local variable `is_macro`.
(class string_iterator): Similarly demote type and rename member
function.
`newline_flag` -> `seen_newline`
(string_iterator::string_iterator): Update initializer list of
constructor accordingly. (And definition of another
argumentless constructor.)
(string_iterator::fill): ...and member function definition to
use new name and type literal.
(class string_iterator, string_iterator::is_diversion):
Similarly boolify member function.
(struct arg_list): Boolfy `space_follows` member variable.
(arg_list::arg_list): ...and constructor. Rename constructor
argument from `s` to `b` to reflect its Boolean type.
(class macro_iterator)
(macro_iterator::space_follows_arg):
(macro_iterator::macro_iterator)
(macro_iterator::is_diversion): Similarly boolify member
functions and use Boolean instead of integer literals.
(macro_iterator::macro_iterator): Rename parameter from
`init_args` to `want_arguments_initialized`.
(macro_iterator::space_follows_arg): Parenthesize complex
expression.
2024-08-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (class input_iterator): Boolify
`is_file` member function.
(class file_iterator): Boolify `is_file` member function and
define in declaration...
(file_iterator::is_file): ...instead of separately.
2024-08-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Demote `is_div` argument to `macro` constructor from
`int` to `bool`.
* src/roff/troff/request.h (class macro):
* src/roff/troff/input.cpp (macro::macro): Do it.
2024-08-26 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor. Boolify return
value and first argument of `get_location()` member functions.
Use Boolean, not integer, literals in initializers and
assignments.
(class input_iterator, class file_iterator)
(file_iterator::get_location, file_iterator::backtrace)
(class input_stack, input_stack::get_location, macro::macro)
(class string_iterator, string_iterator::get_location)
(do_define_macro, get_file_line, lineno_reg::get_string)
(writable_lineno_reg::get_value, filename_reg::get_string):
Do it.
2024-08-26 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.h:
* src/roff/troff/env.cpp (do_underline): Rename this...
(configure_underlining): ...to this.
* src/roff/troff/env.cpp (do_underline_special): Rename this...
(configure_space_underlining): ...to this. Now the argument is
self-explanatory.
2024-08-26 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (main): Migrate `.T` register backing
class from `readonly_text_register` to
`readonly_boolean_register`.
2024-08-26 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (main): Trivially refactor. Boolify
and rename variables controlled by command-line options. Use
Boolean, not integer, literals in initializers and assignments.
`iflag` -> `want_stdin_read_last`
`tflag` -> `have_explicit_device_argument`
`fflag` -> `have_explicit_default_family`
`nflag` -> `have_explicit_first_page_number`
`no_rc` -> `want_startup_macro_files_skipped`
2024-08-26 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (usage): If writing to the standard
output stream (the user requested `--help`), include a paragraph
descriptive of the program.
* src/roff/troff/troff.1.man: Sync language with the foregoing.
2024-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/unicode.cpp (valid_unicode_code_sequence):
Return a null pointer after `assert()` call, in the event
someone compiles with `NDEBUG` defined.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.h: Trivially refactor `environment` class.
Rename (private) member variables.
`dummy` -> `is_dummy_env`
`fill` -> `is_filling`
`spreading` -> `is_spreading`
`discarding` -> `is_discarding`
* src/roff/troff/env.cpp (environment::add_char)
(environment::add_node, environment::space_newline)
(environment::space, environment::environment)
(environment::copy, environment::get_fill, fill, no_fill)
(environment::interrupt, environment::newline)
(environment::output_line, environment::start_line)
(environment::possibly_break_line)
(environment::dump_troff_state, environment::do_break)
(title, environment::print_env): Migrate to new names.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp
(encode_special_character_for_device_output): New helper
function takes over much of the tedium of
`encode_character_for_device_output()`, for maintainability.
(encode_char_for_device_output): Rename this...
(encode_character_for_device_output): ...to this. Use the new
helper function when necessary.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (read_long_escape_parameters)
(interpolate_arg, encode_char_for_device_output): Clarify error
diagnostics.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/fallbacks.tmac: Spell fallbacks for Unicode special
character escape sequences correctly, using four hexadecimal
digits at minimum. Problem introduced by me in commit
81aa7b77c0, 10 October 2022.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/fallbacks.tmac: Spell fallbacks for Unicode special
character escape sequences correctly, using uppercase
hexadecimal digits. Problem dates back to commit 48a13daf13, 24
May 2012.
2024-08-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/include/unicode.h: Declare new constants `UNIBUFSZ` and
`GLYPHBUFSZ` to help callers of `glyph_name_to_unicode()` and
`unicode_to_glyph_name()` allocate sufficient memory to hold any
returned special character identifiers.
2024-08-24 G. Branden Robinson <g.branden.robinson@gmail.com>
[libgroff]: Modify `valid_unicode_code_sequence()` function to
take optional second parameter, a pointer to a character buffer
in which an error message is stored if the character sequence in
the first argument is invalid. Declare new constant `ERRBUFSZ`
to help any caller allocate sufficient memory to hold any such
generated message.
* src/include/unicode.h:
* src/libs/libgroff/unicode.cpp (valid_unicode_code_sequence):
Do it. Also squawk about use of lowercase hexadecimal digits in
Unicode special character identifiers, as these are invalid in
groff.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (encode_char_for_device_output)
(macro::append_str, do_suppress): Trivially refactor. Compare
`char` array elements to character literals rather than an
integer literal with a C-style typecast to `char`.
(macro_iterator::~macro_iterator, map_composite_character)
(composite_glyph_name, charinfo::contains): Explicitly compare
variable of pointer type to null pointer constant instead of
letting it pun down to a Boolean.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Further refactor `charinfo` class.
* src/roff/troff/charinfo.h (class charinfo): Rename enumeration
constants.
`BREAK_BEFORE` -> `ALLOWS_BREAK_BEFORE`
`BREAK_AFTER` -> `ALLOWS_BREAK_AFTER`
`TRANSPARENT` -> `IS_TRANSPARENT_TO_END_OF_SENTENCE`
`IGNORE_HCODES` -> `IGNORES_SURROUNDING_HYPHENATION_CODES`
`DONT_BREAK_BEFORE` -> `PROHIBITS_BREAK_BEFORE`
`DONT_BREAK_AFTER` -> `PROHIBITS_BREAK_AFTER`
`INTER_CHAR_SPACE` -> `IS_INTERWORD_SPACE`
Rename member functions.
`can_break_before()` -> `allows_break_before()`
`can_break_after()` -> `allows_break_after()`
`transparent()` -> `is_transparent_to_end_of_sentence()`
`ignore_hcodes()` -> `ignores_surrounding_hyphenation_codes()`
`prohibit_break_before()` -> `prohibits_break_before()`
`prohibit_break_after()` -> `prohibits_break_after()`
`inter_char_space()` -> `is_interword_space()`
`numbered()` -> `is_numbered()`
Demote the return types of the foregoing and `ends_sentence()`,
`overlaps_vertically()`, `overlaps_horizontally()`,
`first_time_not_found()`, `is_normal()`, `is_fallback()`, and
`is_special()` from `int` to `bool`. Update inline definitions.
Parenthesize complex `return` expressions.
* src/roff/troff/input.cpp (init_charset_table): Migrate to new
enumeration constants.
* src/roff/troff/node.cpp: Rename constants in `enum`
`break_char_type` to match those in "charinfo.h".
(troff_output_file::put_char_width, troff_output_file::put_char)
(charinfo_node::ends_sentence, break_char_node::add_self)
(make_glyph_node, node::add_char): Migrate to new enumeration
constant and member function names.
2024-08-24 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Boolify `charinfo` class, renaming
member functions and variables and demoting their (return) types
from `int` to `bool`. Use Boolean, not integer, literals in
initializers and assignments.
* src/roff/troff/charinfo.h:
* src/roff/troff/input.cpp: Do it.
`not_found` -> `is_not_found`
`transparent_translate` -> `is_transparently_translatable`
`translate_input` -> `translatable_as_input`
`set_translation_input()` -> `make_translatable_as_input()`
`get_translation_input()` -> `is_translatable_as_input()`
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (charinfo_node::ends_sentence): Fix
compiler warning.
warning: control reaches end of non-void function
[-Wreturn-type]
Not the most penetrating exhibit of control flow analysis.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Check for correct and diagnostic-free behavior of
`Rs`/`Re`-related macros such as `doc-reference-title-name`,
`doc-city-name`, and `doc-date`.
* tmac/tests/doc_Rs-works.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/fallbacks.tmac: Define fallbacks for all special
characters in "Accented characters" section of groff_char(7) for
"ascii" output device.
* tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh:
Update test expectations.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* font/devascii/R.proto: Map `ad` (dieresis accent) special
charcter as yet another alias of `"` on the ASCII output device.
2024-08-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (chop_macro): Clarify diagnostic.
Say whether the argument being operated on is a "diversion" or a
"macro or string", instead of the vague term "object", which is
otherwise little-used in *roff discussions.
2024-08-23 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Boolify `macro` class, renaming
member functions and variables and demoting their (return) types
from `int` to `bool`.
* src/roff/troff/request.h:
* src/roff/troff/input.cpp: Do it.
`empty_macro` -> `is_empty_macro`
`is_a_diversion`
`is_a_string`
`empty()` -> `is_empty()`
`is_diversion()`
`is_string()`
* src/roff/troff/input.cpp (macro::macro)
(macro::clear_string_flag, macro::append, macro::is_empty): Use
Boolean, not integer, literals in initializers and assignments.
2024-08-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (device_request): Don't write null
characters to device control command commands (`x X` in
device-independent output). These can occur if one interpolates
a diversion into the argument of a `device` request.
2024-08-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdfbookmark): Trivially refactor. Rename
`pdf:cleaned` string to `pdf:title` to reflect (1) its use in
the emitted PDF device control command and (2) the fact that it
is no longer sanitized by emitting it into a diversion and
invoking `asciify` on that diversion.
2024-08-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdfclean): Drop unused macro.
2024-08-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* m4/groff.m4 (GROFF_WCOREFLAG): Include <stdlib.h> header file
in test program, since it calls exit(3). Thanks to Eli Schwartz
for noting the problem.
Continues fixing <https://savannah.gnu.org/bugs/?65762>.
2024-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (doc/groff-man-pages.pdf)
(doc/groff-man-pages.utf8.txt): Run groff with "-K latin-1"
option to avoid (harmless) error when formatting
"groff_mmse.7". Prompted by discussion with Deri in Savannah
#66122.
Fixes:
troff:contrib/mm/groff_mmse.7:172: error: cannot translate
character code 229 to special character 'oa' in
device-independent output
2024-08-24 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Make compatible with ImageMagick (IM) < 7.0.
Peter Schaffter discovered some problems with recent changes to
gropdf and the `PDFPIC` macro: they were not fully compatible
with ImageMagick 6.9, which he was using. See <https://lists.
gnu.org/archive/html/groff/2024-08/msg00044.html>.
* src/devices/gropdf/gropdf.pl: One difference in IM 6 is that
an alpha channel of all zeroes meant the image was opaque, but
in 7 it is reversed and means the image is wholly transparent.
This change is documented here:-
<http://www.imagemagick.org/script/porting.php#alpha>
"Alpha
We support alpha now, previously opacity. With alpha, a value
of 0 means that the pixel does not have any coverage information
and is transparent; i.e. there was no color contribution from
any geometry because the geometry did not overlap this pixel. A
value of QuantumRange means that the pixel is opaque because the
geometry completely overlapped the pixel. As a consequence, in
version 7, the PixelInfo structure member alpha has replaced the
previous opacity member. Another consequence is the alpha part
of an sRGB value in hexadecimal notation is now reversed (e.g.
#0000 is fully transparent)."
This is now handled by gropdf.
There was an undocumented (I thought it came as part of
perlmagick--it doesn't) dependency on the module
Image::ExifTool. This is no longer used by gropdf, so not
required.
* tmac/pdfpic.tmac: Another issue was that identify(1) sometimes
reports PDF sizes that do not match the page size--it seems to
be attempting to report the size of the image embedded in the
PDF. pdfinfo(1) is thus now used first on files, which
consistently reports the page size. This imposes a slight time
penalty since non-PDF files endure a (failed) pdfinfo run.
2024-08-24 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Handle preconv better.
If preconv is used, it should also be run when generating
forward references.
* src/devices/gropdf/pdfmom.pl: Add preconv (if requested)
to the pre-run that generates the `pdf:bm` strings.
2024-08-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* font/devps/ZDR: Regenerate.
2024-08-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* font/devps/ZD: Regenerate using updated dingbats.map.
Fixes <https://savannah.gnu.org/bugs/?63018>. Thanks to Deri
James and Dave Kemper for (extensive) consultation.
2024-04-29 Deri James <deri@chuzzlewit.myzen.co.uk>
* font/devps/generate/dingbats.map: Update to map many more
Unicode code points to Zapf Dingbats glyphs.
2024-08-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/afmtodit/afmtodit.pl: Improve information written to
generated font description files in comments. Name the AFM and
map files used. Report any options specified on the command
line. The idea is to make it easier for future (and current)
maintainers to update such files because years pass between
occurrences, and institutional memory is, if not lost, laborious
to dredge up. This practice might also assist users in
producing groff description files for their own fonts. Also
write out a glyph's corresponding Unicode code point in the
comment field only if one is defined. Otherwise we get a
comment marker followed by a tab and a newline, which Git marks
in radioactive red.
Begins addressing <https://savannah.gnu.org/bugs/?65697>.
2024-08-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/afmtodit/afmtodit.pl: Define `prog` scalar as only
the "basename" of argv[0], making diagnostic and usage messages
less garrulous; see Savannah #65110. Add new `opt_w` scalar to
separate it from existing `space_width` scalar so that we can
report the options we were invoked with in a comment in the
generated file. Reorganize scalar representation of version
information: new `groff_version`, which is populated at build
time, new `short_version` which is `groff_version` stripped of
any Git revision and partial hash information; new
`version_stub` which holds the prefixed information identifying
the program and project; new `output_version` which holds the
stub and the short version; and existing `afmtodit_version`,
which holds the stub and the (full) groff version. Write
`output_version` instead of `afmtodit_version` to the generated
file. Update call sites of `croak` and new `whine` subroutines
to use `&` sigil and omit trailing newline.
(croak): Assume responsibility for writing a newline at the end
of the message.
(whine): New subroutine throws a diagnostic marked "warning".
Perl's `warn` output is ugly and not structured like other groff
diagnostics. Give it responsibility for emitting the name of
the program.
2024-08-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::add_char): Declare local
variable closer to point of use. It's also a dead store, but
demanded by our internal API. (See `node::add_char()` in
"node.cpp".) Prompted by a report by Lukas Javorsky involving
use of "SAST analyzers {combination of coverity, snyk, cppcheck,
gcc, clang, shellcheck, unicontrol}".
Also see <https://savannah.gnu.org/bugs/?66079>.
2024-08-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (get_delimited_name, do_if_request)
(read_drawing_command, read_drawing_command_color_arguments):
When complaining of mismatched or missing closing delimiter,
report the identity of the delimiter we were expecting.
* src/roff/troff/reg.cpp (alter_format): When complaining of
invalid register format, list the valid ones.
2024-08-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Adjust and parallelize diagnostic
message language.
(get_char_for_escape_parameter): Say "argument", not
"parameter".
(do_zero_width_output): Identify the invalid token.
(do_zero_width_output, charinfo_to_node_list): Characterize
invalid token more precisely as part of the escape sequence's
_argument_.
2024-08-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* NEWS: Add items for Deri's just-committed new features.
2024-06-22 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Add support for embedding bit-mapped images to a
generated pdf.
Currently gropdf supports the inclusion of pdf files as separate
images, now many other image formats are supported. The pdf
standard requires programs which process pdfs to handle embedded
jpegs, and from version 1.5 jpeg2000 images are handled natively
as well. (Current gropdf produces pdfs which conform to version
1.7).
The pdf standard supports a raw format with separate channels
{RGB/CMYK/Grey} in 8/16/32 bit formats. This is used for other
image formats. If there is a transparency channel it is
converted to an 8-bit soft mask for the image.
* src/devices/devpdf/gropdf.pl: add code to \X'pdf: pdfpic' to
handle other image types, not just pdfs.
* man/groff_tmac.5.man: document changes to PDFPIC macro.
* src/devices/devpdf/gropdf.1.man: explain use of
\X'pdf: pdfpic ...'
* tmac/pdfpic.tmac: expand the PDFPIC macro to handle multiple
image formats, not just embedding pdfs.
Fixes <https://savannah.gnu.org/bugs/?66114>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* font/devcp1047/*: Recursively delete.
* Makefile.am: Stop including the Automake file therein.
* MANIFEST: De-document.
* NEWS: Note withdrawal of "cp1047" device support.
Fixes <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/cp1047.tmac: Delete.
* tmac/tmac.am (TMACNORMALFILES): Stop shipping it.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/nroff/nroff.sh: Drop support for "cp1047" output
device.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Drop support for "cp1047" output device.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac: Drop support for "cp1047" output device.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/eqnrc: Drop eqn(1) support for "cp1047" output device.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/fallbacks.tmac:
* tmac/troffrc:
* tmac/tty.tmac: Drop "cp1047" output device support.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* m4/groff.m4 (GROFF_EBCDIC, GROFF_OS390): Drop macros.
* configure.ac: Stop using them.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[grops, grotty, libgroff, pic]: Drop EBCDIC support.
* src/devices/grops/psrm.cpp:
* src/devices/grotty/tty.cpp:
* src/libs/libgroff/invalid.cpp:
* src/preproc/pic/lex.cpp: Do it.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.h: Drop input character definitions for
CCSID (code page) 1047 (EBCDIC).
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Revise `\A` and `\B` escape
sequences to no longer interpolate anything (not even "0" for
"false") if they lexically don't even get as far as an opening
delimiter; in such a case they are invalid.
(do_name_test, do_expr_test): Do it. Change return type from
`bool` to a pointer to a constant `char`. Return null pointer
if there is no delimiter. Otherwise return string instead of
Boolean literals.
(token::next): Handle null pointer returns from these functions.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_overstrike, do_bracket)
(do_device_control): Stop pushing a newline onto the input stack
when encountering one; this character can no longer serve double
duty as a delimiter and a formattable newline.
(do_overstrike, do_bracket, do_name_test, do_expr_test)
(do_zero_width_output, do_width, do_device_control): Similarly
when finishing up with a delimited escape sequence with a
malformed ending.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix Savannah #66113 (misleading `\B` diagnostic).
* src/roff/troff/input.cpp (do_expr_test): Advance the input
token pointer at the end of the endless for loop, not the
beginning, since `get_number_rigidly()` already left it at the
next input character to be processed. (Most parameterized
escape sequence reading functions don't call an input reading
function before entering this sort of loop, so they correctly
advance the token pointer _first_.)
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix Savannah #63142 (newlines as delims).
Withdraw support for newlines as escape sequence delimiters.
Only a few (6) supported this, and the rationale behind it is
unknown. DWB 3.3 troff didn't behave this way in any case.
* src/roff/troff/input.cpp (do_overstrike, do_bracket)
(do_name_test, do_zero_width_output, do_width)
(do_device_control): Do it. As a bonus, check starting
delimters for these escape sequences (`\[obAZwX]`) for validity
in general.
(do_overstrike, do_bracket, do_zero_width_output): Avoid leaking
memory when returning early; delete the `new` node we just
allocated.
(token:next): Be prepared for the `\b` and `\o` escape sequences
to return a null pointer (if the sequence doesn't even validly
get off the ground), as handlers for `\Z` and `\X` already are.
* src/roff/groff/tests/\
some_escapes_accept_newline_delimiters.sh: Delete.
* src/roff/groff/groff.am (groff_TESTS): Drop test.
* doc/groff.texi.in (Delimiters):
* man/groff.7.man (Delimiters):
* NEWS: De-document support for newlines as delimiters.
Fixes <https://savannah.gnu.org/bugs/?63142>.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::is_usable_as_delimiter):
Generalize diagnostics. Anything that's invalid as a "starting"
delimiter is invalid as an ending one, too. Also our
terminology has been poorly paired; we say "closing" delimiter
but not "opening" for its counterpart. This fixes that.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::is_usable_as_delimiter):
Reject end-of-file as the starting delimiter for an escape
sequence.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (make_glyph_node): Don't throw a
warning if `get_char_for_escape_parameter()` in "input.cpp"
already threw an error for the same input token. Also compare
array elements of `const char` type to character, not integer,
literals.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify and rename `compatible_flag`, demoting it from
`int` to `bool` and calling it `want_att_compat`. Initialize
and assign to it using Boolean, not integer, literals.
* src/roff/troff/input.cpp (read_escape_parameter)
(read_increment_and_escape_parameter, get_copy, do_overstrike)
(do_bracket, do_name_test, do_zero_width_output, token::next)
(compatible, diagnose_invalid_identifier, do_request)
(decode_args, do_define_string, define_nocomp_string)
(do_define_macro, define_nocomp_macro, append_nocomp_macro)
(read_size, get_delimited_name, read_title_parts)
(do_device_control, do_if_request, main, init_input_requests)
(lookup_request, charinfo_to_node_list): Do it.
(class string_iterator): Boolify and rename
`saved_compatible_flag` to `att_compat`. Rename and retype
member functions.
(class input_iterator, class_string_iterator): Rename and retype
member functions.
`save_compatible_flag()` -> `set_att_compat()`
`get_compatible_flag()` -> `get_att_compat()`
The former now takes a `bool` argument instead of an `int`, and
the latter returns a `bool` instead of an `int`.
(input_stack::set_att_compat, input_stack::get_att_compat):
Update implementations accordingly.
(get_copy, token::next): Update call sites.
(init_input_requests): Back the `.C` register with object of
type `readonly_boolean_register` instead of `readonly_register`.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify and rename `ignoring`, demoting it from
`int` to `bool` and calling it `want_input_ignored`. Initialize
and assign to it using Boolean, not integer, literals.
* src/roff/troff/input.cpp (do_define_macro)
(append_indirect_nocomp_macro, copy_mode_error): Do it.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify and rename `inhibit_errors`, demoting it from
`int` to `bool` and calling it `want_errors_inhibited`.
Initialize and assign to it using Boolean, not integer,
literals.
* src/roff/troff/input.cpp (do_expr_test, main, do_error): Do
it.
(do_expr_test): Similarly boolify and rename local variable
`saved_inhibit_errors` -> `saved_want_errors_inhibited`.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify and rename `backtrace_flag`, demoting it from
`int` to `bool` and calling it `want_backtraces`. Initialize
and assign to it using Boolean, not integer, literals.
* src/roff/troff/input.cpp (main, do_error): Do it.
2024-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify and rename `class_flag`, demoting it from `int`
to `bool` and calling it `using_character_classes`. Initialize
and assign to it using Boolean, not integer, literals.
* src/roff/troff/charinfo.h
(charinfo::overlaps_horizontally, charinfo::overlaps_vertically)
(charinfo::can_break_before, charinfo::can_break_after)
(charinfo::ends_sentence, charinfo::transparent)
(charinfo::ignore_hcodes)
(charinfo::prohibit_break_before)
(charinfo::prohibit_break_after)
(charinfo::inter_char_space, charinfo::add_to_class):
* src/roff/troff/input.cpp (get_flags): Do it.
2024-08-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor.
(do_zero_width): Rename this...
(do_zero_width_output): ...to this.
(token::next): Update call site.
2024-08-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_zero_width): Tweak `\Z`
diagnostic output.
2024-08-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (read_drawing_command): Trivially
refactor. Boolify local variable `no_last_v`. Rename local
variable `err` to `had_error`.
2024-08-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (read_drawing_command): Demote
diagnostic thrown on empty drawing command escape sequence
argument list from error to warning in "missing" category. I
can imagine someone programmatically constructing a string to be
passed to a `\D` escape sequence; such a string might be empty.
2024-08-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (read_drawing_command): Handle
an invalid delimiter in a drawing command escape sequence `\D`
the same as every other escape sequence that recognizes a
restricted set of delimiters (`\h`, `\H`, `\l`, `\L`, `\N`,
`\R`, `\s`, `\S`, `\v`, and `\x`): stop parsing immediately
instead of consuming and discarding input until encountering a
matching invalid delimiter, newline, or EOF.
2024-08-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor. Rename
confusingly named functions that interpret *roff language input,
not "nodes", a family of _groff_ class objects.
(read_draw_node): Rename this...
(read_drawing_command): ...to this.
(read_color_draw_node): Rename this...
(read_drawing_command_color_arguments): ...to this.
2024-08-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp (macro_diversion::macro_diversion):
Handle member variables `diversion_trap` and
`diversion_trap_post` in constructor's initializer list, for
clarity and to ensure that they don't contain garbage.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/e.tmac (@M, $c): If the formatter is GNU troff,
use value of its `.R` register instead of "10000" to indicate an
arbitrary large integer.
(EQ): Same, but in commented form; a formatter DoS attack is
otherwise revealed.
(TS): Similar; set line length to `.R` basic units minus 1n to
avoid saturation warnings on output devices with a non-unit
horizontal motion quantum.
* tmac/html-end.tmac: Set page length to `.R` basic units minus
1v to avoid saturation warnings on output devices with a
non-unit vertical motion quantum (as the "html" device has).
* tmac/man.ultrix (HB): Use value of `.R` register instead of
"999" to indicate an arbitrary large integer.
* tmac/psfig.tmac (F+):
* tmac/s.tmac (cov*tl-au-print, ID, par@TL, par@AU, par@AI): Use
value of `.R` register instead of "9999" to indicate an
arbitrary large integer.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (init_input_requests): Initialize
`.R` read-only register to `INT_MAX` instead of 10000.
* doc/groff.texi.in (Built-in Registers):
* man/groff.7.man (Read-only registers):
* man/groff_diff.7.man (Altered registers): Document it.
* doc/groff.texi.in (Manipulating Filling and Adjustment)
(End-of-input Traps): Apply it to examples.
Fixes <https://savannah.gnu.org/bugs/?63587>.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Support construction of read-only
registers from integers.
(class readonly_text_register): Declare constructor taking `int`
argument.
(readonly_text_register::readonly_text_register): Add it.
(main): Use it to initialize `.T` register.
(init_registers): Use it to initialize `.A` register.
(init_input_requests): Use it to initialize `.g` and `.R`
registers.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Slightly refactor.
(do_overstrike): Rename local variable `on` to `osnode`.
(do_bracket): Rename local variable `bn` to `bracketnode`.
(do_expr_test): Demote return type from `int` to `bool`, and
return Boolean, not integer, literals.
(do_zero_width): Move declaration and initialization of `n`
local unaccountably far from its point of use to prepare for
shoveling of most of this function's body into a `for` loop,
required by forthcoming fix for Savannah #63142.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: When throwing a warning diagnostic about a mismatched
escape sequence delimiter, say what what we were expecting and
what we got instead.
* src/roff/troff/input.cpp (do_overstrike, do_bracket)
(do_name_test, do_zero_width, do_width, do_device_control)
(read_delimited_number, get_line_arg, do_register)
(do_expr_test):
* src/roff/troff/reg.cpp (inline_define_register [0]): Do it.
Fixes <https://savannah.gnu.org/bugs/?63202>.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_name_test): Fix buglet in
handling of newline as delimiter for the `\A`, `\w`, and `\Z`
escape sequences. An invalid C++ conditional resulted
in a newline being interpreted both as the delimiter and as an
input token, spuriously putting a space on the output. Drop
subsequent tautologous conditional: `tok != start_token` will
always evaluate true because `tok.is_eof()` is true and
`start_token` cannot be an EOF.
Before:
$ printf 'foo\A\naz\nbar\n' | groff -a
<beginning of page>
foo1 bar
After:
$ printf 'foo\A\naz\nbar\n' | ./build/test-groff -a
<beginning of page>
foo1bar
* src/roff/groff/tests/\
some_escapes_accept_newline_delimiters.sh: Update test
expectations.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (interpolate_register): Add assertion
to blow up on null pointer dereference.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix code style nits.
* src/roff/troff/input.cpp (length_request)
(interpolate_number_format, do_register): Use `static_cast`
instead of C-style cast on dictionary values.
(do_overstrike, do_bracket, do_zero_width, token::next)
(length_request, interpolate_number_format, do_register):
Explicitly compare variable of pointer type to null pointer
constant instead of letting it pun down to a Boolean.
(do_register, token::next): Reorder equality comparison to avoid
inadvertent lvalue assignment.
(do_error): Add parentheses to complex expression.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Slightly refactor; boolify a static function.
* src/roff/troff/input.cpp (get_line_arg): Demote return type
from `int` to `bool`. Return Boolean, not integer, literals.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/reg.cpp (define_register): Warn when garbage
encountered in numeric expression argument to `nr` request.
Fixes <https://savannah.gnu.org/bugs/?64240>.
2024-08-17 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename `get_number()` to
`read_measurement()`. Part of the idea here is to use the verb
"read" to suggest that the function advances the token pointer
through the input stream (and it does). Another part is to
reduce confusion, since the class `charinfo` has an unrelated
member function `get_number()`.
* src/roff/troff/token.h (get_number):
* src/roff/troff/number.cpp (get_number): Rename this...
* src/roff/troff/token.h (read_measurement):
* src/roff/troff/number.cpp (read_measurement): ...to this.
* src/roff/troff/number.cpp (read_measurement): Update
self-reference in assertion message.
* src/roff/troff/env.cpp (point_size):
* src/roff/troff/input.cpp (get_color_element)
(read_delimited_number, get_line_arg, read_size, do_register)
(do_if_request, evaluate_expression):
* src/roff/troff/node.cpp (embolden_font)
(configure_track_kerning, constantly_space_font):
* src/roff/troff/reg.cpp (define_register)
(inline_define_register [0]): Update call sites.
2024-08-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi.in (Page Location Traps): Correct erroneous
claim; the `.t` register does not interpolate the maximum
representable integer in a diversion when there is no pending
diversion trap if the output device does not have a vertical
resolution of "1" ("ps" does; "utf8" doesn't).
Problem introduced by me in commit 18697e757c, 22 November 2020.
Thanks to Dave Kemper for the discussion in Savannah #63587.
2024-08-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_term): When reading an
overlong integer literal, save the value corresponding to the
longest valid digit sequence, and use that if overflow occurs.
(scale): Demote "numeric overflow" errors to "integer value
saturated" warnings in category "range".
* src/roff/troff/hvunits.h (vunits::to_units)
(class vunits: operator +, operator -, operator *):
(hunits::to_units)
(class hunits: operator +, operator -, operator *):
* src/roff/troff/number.cpp (vunits::vunits, hunits::hunits):
Impose saturating arithmetic on overflowing operations. Demote
overflow from error, throwing warning in "range" category if
overflow would occur, and describe integer result as "saturated"
rather than "wrapped".
* src/roff/groff/tests/arithmetic-works.sh: Enable warnings in
"range" category. Update test expectations. Drop check of
operation that is no longer meaningful with refactored
arithmetic parsing.
* doc/groff.texi.in (Numeric Expressions):
* man/groff.7.man (Numeric expressions):
* NEWS: Document it.
Fixes <https://savannah.gnu.org/bugs/?66001>.
2024-08-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (get_vunits, get_hunts, get_number)
(get_integer): Clarify diagnostic when integer arithmetic wraps.
2024-08-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix code style nits.
* src/roff/troff/reg.cpp (number_value_to_ascii): Add
parentheses to complex expressions.
(number_value_to_ascii): Assign character, not integer, literal
to element of array of `char` type.
(inline_define_register [0], define_register, set_register)
(look_up_register, alter_format): Use `static_cast` instead of
C-style cast on dictionary values.
(inline_define_register [0], define_register, set_register)
(look_up_register, alter_format): Reorder equality comparisons
to avoid inadvertent lvalue assignment.
2024-08-15 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Clear array memory when allocating it from the heap.
Prompted by Lukas Javorsky's static-analysis-driven report in
Savannah #66081.
* src/roff/troff/env.cpp (override_sizes, tab_stops::to_string)
(add_hyphenation_exceptions, hyphen_trie::insert_hyphenation):
* src/roff/troff/input.cpp (read_long_escape_parameters)
(token::next, do_get_long_name, get_delimited_name, pipe_source)
(read_string, pipe_output, open_macro_package)
(do_register_assignment, do_string_assignment, copy_mode_error):
Do it.
2024-08-15 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix code style nits.
* src/roff/troff/env.cpp (override_sizes): Add parentheses to
complex expressions.
(add_hyphenation_exceptions): Reorder equality comparisons to
avoid inadvertent lvalue assignment.
(add_hyphenation_exceptions, hyphen_trie::insert_hyphenation):
Use `static_cast` instead of C-style cast on dictionary values.
* src/roff/troff/env.cpp (add_hyphenation_exceptions)
(hyphen_trie::insert_hyphenation):
* src/roff/troff/input.cpp (read_two_char_escape_parameter)
(do_get_long_name): Assign character, not integer, literal to
element of array of `char` type.
* src/roff/troff/input.cpp (read_long_escape_parameters): Demote
local variable `have_char` from `int` to `bool` and assign to it
with Boolean, not integer, literals.
* src/roff/troff/input.cpp (do_get_long_name): Explcitly
express size of array element type in argument to `memcpy()`.
2024-08-14 Lukas Javorsky <ljavorsk@redhat.com>
* src/roff/troff/env.cpp (override_sizes): Zero out
heap-allocated memory prior to use. If `strtok()` returns a
null pointer, we break early from the `for` loop before
populating it. The only other case where we break out of the
loop is when `lower` is 0, and we do so only after adding this 0
to `sizes`. Since this memory is then passed to
`font_size::init_size_table()`, which uses a zero integer to
detect the end of the list, we could then access uninitialized
memory. [The user is not required to supply a zero argument to
the `sizes` request. I also revised the patch to use memset(3)
instead of (an empty) value initializer, which is a C++03
feature. --GBR]
Fixes <https://savannah.gnu.org/bugs/?66081>.
2024-08-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (override_sizes): Refer to size range
as "invalid", not "bad", in warning diagnostic.
2024-08-14 Lukas Javorsky <ljavorsk@redhat.com>
* src/roff/troff/input.cpp (token::add_to_zero_width_node_list):
Initialize stack-allocated variable that is not populated by all
paths through this function.
Fixes <https://savannah.gnu.org/bugs/?66079>.
2024-08-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Slightly refactor: boolify.
* src/roff/troff/node.h (struct hyphen_list): Demote `hyphen`
member from `unsigned char` to `bool` and rename it to
`is_hyphen'.
(hyphen_list::hyphen_list): Migrate struct initializer list to
new name and Boolean literal.
* src/roff/troff/env.cpp (hyphenate): Update assignments to use
new name and Boolean, not integer, literals.
* src/roff/troff/node.cpp (glyph_node::add_self)
(composite_node::add_self): Update comparisons to use new name.
* src/roff/troff/node.h (struct hyphen_list): Boolify. Demote
`breakable` member from `unsigned char` to `bool` and rename it
to `is_breakable'.
(hyphen_list::hyphen_list): Migrate struct initializer list to
new name and Boolean literal.
* src/roff/troff/env.cpp (environment::hyphenate_line):
* src/roff/troff/node.cpp (break_char_node::add_self): Update
comparisons.
* src/roff/troff/node.cpp (break_char_node::add_self): Demote
`have_space_node` local variable from `int` to `bool`.
* src/roff/troff/node.h (struct node, class hmotion_node):
Boolify. Demote member function `set_unformat_flag()` and
member variable `unformat` from `int` to `bool`. These could
use renaming, but `make_unformattable()` and `is_unformattable`
would be terribly misleading.
* src/roff/troff/node.cpp (node::set_unformat_flag)
(word_space_node::set_unformat_flag)
(vertical_size_node::set_unformat_flag)
(hmotion_node::set_unformat_flag): Demote return type and use
Boolean literals for assignments and return values.
(word_space_node::word_space_node): Use Boolean literal in
constructor's initializer list.
(word_space_node::word_space_node): Update data type in
constructor's argument list.
* src/roff/troff/node.h (class hmotion_node): Demote `was_tab`
member from `unsigned char` to `bool`. Use Boolean literals for
it in constructors' initializer lists.
* src/roff/troff/node.h (struct node): Demote `is_inner`
argument from `int` to `bool` and assign to it using Boolean,
not integer, literals.
2024-08-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/token.h (token:ch): Return character instead
of integer literal for this inline function of `(unsigned) char`
type.
2024-08-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify remaining `token` class member functions that
need it.
* src/roff/troff/token.h (class token): Demote declarations of
`operator==`, `operator!=`, `add_to_zero_width_node_list`.
* src/roff/troff/input.cpp (token::operator==)
(token::operator!=, token::add_to_zero_width_node_list): Do it.
2024-08-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Throw diagnostic in event of a diversion's contents
overflowing its maximum vertical position. We can't do anything
sensible in this case, so make it a fatal error. (It's also
more likely that your host environment will exhaust memory
available to the `troff` process before encountering this
problem.)
* src/roff/troff/div.cpp: New constant symbol
`DIVERSION_LENGTH_MAX` defines the maximum permissible vertical
size of a diversion in basic units. Presently, it is `INT_MAX`.
(macro_diversion::distance_to_next_trap): When there is no
diversion trap, or its position has already been passed, report
the distance to `DIVERSION_LENGTH_MAX` (rather than `INT_MAX`)
divided by the vertical resolution.
(macro_diversion::output): Check for overflow when incrementing
vertical position upon writing out a line, and emit fatal error
diagnostic if it occurs.
Fixes <https://savannah.gnu.org/bugs/?64229>. Thanks to Dave
Kemper for the discussion.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/e.tmac (n1, n2): Invoke the renamed `po` request
directly, not our wrapper for it.
Fixes a latent issue with saturating arithmetic.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp
(macro_diversion::distance_to_next_trap): Return a value
quantized to the vertical resolution of the output device. Add
an `assert()` for a paranoia's sake, since there is an integer
arithmetic land mine here.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/tests/arithmetic-works.sh: Add more test cases.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (troff_output_file::flush_tbuf): Add
assertion: the type size should be positive.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/include/symbol.h (class symbol): Boolify `is_null()` and
`is_empty()` member functions.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Rename `WARN_TOTAL` symbol to `WARN_MAX` for
consistency with other GNU troff enumerated types.
* src/roff/troff/troff.h:
* src/roff/troff/input.cpp: Do it.
* src/roff/troff/input.cpp (warn_request): Clarify warning
diagnostic.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp
(top_level_diversion::transparent_output, continue_page_eject)
(top_level_diversion::set_diversion_trap)
(top_level_diversion::clear_diversion_trap):
* src/roff/troff/input.cpp (transparent_translate)
(get_delimited_name, do_source, pipe_source, pipe_output,
transparent_file, charinfo_to_node_list):
* src/roff/troff/node.cpp (troff_output_file::really_copy_file):
* src/roff/troff/reg.cpp (reg::increment, reg::decrement)
(reg::set_increment, reg::alter_format, reg::set_value): Clarify
error diagnostics, and stop using contractions in wording.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp
(top_level_diversion::transparent_output):
* src/roff/troff/input.cpp (transparent_translate): Drop
`GROFF_ENABLE_TRANSPARENCY_WARNINGS` environment variable
kludge. The underlying problems are better understood now and
giving the user tools to fix them is on the horizon.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp: Drop Autoconf-guarded inclusion of
<unistd.h>. Jugding by the groff 1.16 change log this appears
to have to do with the use of wait(2)-related macros, but
dropping it doesn't break a glibc-based build, and our
"src/include/nonposix.h" header has the same guarded inclusion,
so we should still get it on unusual systems. If a build breaks
due to this change, we should document the specific symbol(s) we
need and/or rely on gnulib for them.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Replace club with scalpel when including standard C
library header files.
* src/roff/troff/troff.h: Drop standard C library header file
inclusions altogether. This exhibited an old style of writing C
{and C++?} where your multi-translation unit program would have
an overarching header file, included by all your *.c files, and
into which you stuffed all of your libc header file dependencies
without documenting which symbols you actually needed or where.
This tended to lead to excessive inclusion, and that tendency
bore out here. On a glibc-based system, GNU troff doesn't need
4 of the 6 headers formerly #included here at all. And we now
use gnulib to help us with portability, which was not the case
in 1989.
* src/roff/troff/env.cpp:
* src/roff/troff/input.cpp:
* src/roff/troff/node.cpp: Include <errno.h> and annotate why.
* src/roff/troff/reg.cpp: Include <assert.h> and annotate why.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_string_case_transform): Use
libgroff's `cmupper()` and `cmlower()` functions instead of
going directly to the standard C library's `to{upp,low}er()`.
2024-08-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/troff.h: Slightly refactor; boolify and rename
some global `int`s.
- `suppress_output_flag` -> `want_output_suppressed`
- `color_flag` -> `want_color_output`
- `is_html` -> `is_writing_html`
* src/roff/troff/env.cpp (environment::newline)
(environment::make_tag, environment::construct_state)
(environment::construct_format_state)
(environment::construct_new_line_state):
* src/roff/troff/input.cpp ([top level], main):
* src/roff/troff/mtsm.cpp (statem:add_tag_ta, mtsm::push_state)
(mtsm::pop_state, mtsm::flush, mtsm:changed):
* src/roff/troff/node.cpp (suppress_node::tprint)
(space_char_hmotion_node::tprint)
(unbreakable_space_node::tprint): Migrate `is_html`.
* src/roff/troff/input.cpp ([top level], activate_color, main):
(init_input_requests):
* src/roff/troff/node.cpp (troff_output_file::fill_color)
(troff_output_file::glyph_color): Migrate `color_flag`.
* src/roff/troff/input.cpp (init_input_requests): Use
`readonly_boolean_register` class to expose `want_color_output`
to documents, not `readonly_register`.
* src/roff/troff/input.cpp ([top level], main):
* src/roff/troff/node.cpp (init_output): Migrate
`suppress_output_flag`.
2024-08-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (hyphenation_patterns_file_code):
Throw error warning of future withdrawal.
* doc/groff.texi.in (Manipulating Hyphenation):
* man/groff_diff.7.man (New requests):
* man/groff.7.man (Request short reference):
* NEWS: Document deprecation.
2024-08-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tty.tmac: Revise fallback character for `\[em]` on UTF-8
device to make it more like a true em dash, taking up two
character cells.
2024-08-09 Dave Kemper <saint.snit@gmail.com>
* tmac/andoc.tmac: Annotate "unnecessary" control lines.
Fixes <https://savannah.gnu.org/bugs/?62826>.
2024-08-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/troffrc: Define macro `troffrc*trap` to throw a
diagnostic message complaining of a text line in a startup file.
Make it the blank line and leading space macro.
* tmac/troffrc-end: Clear blank line and leading space macros.
Delete `troffrc*trap`.
Inspired by an Arch Linux blunder <https://gitlab.archlinux.org/
archlinux/packaging/packages/groff/-/commit/
db8623565d8e14d4c9c5c3a67e1c8647c34e3d48>. I've made similar
ones myself.
2024-08-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (input_stack::get)
(process_input_stack): Trivially refactor. Rename global
`old_have_formattable_input` to
`have_formattable_input_on_interrupted_line`. Yes, this
identifier is as long as your arm, but it has a highly
specialized purpose and needs to be intelligible in context.
2024-08-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc-old.tmac: Migrate from font name "C" to "CR", fixing
warnings.
troff:.../doc-old.tmac:...: warning: cannot select font 'C'
2024-08-08 Bjarni Ingi Gislason <bjarniig@simnet.is>
* tmac/doc-old.tmac: Drop spurious dot in control line.
Fixes <https://savannah.gnu.org/bugs/?57622>.
2024-08-08 Dave Kemper <saint.snit@gmail.com>
* tmac/tty.tmac: Revise fallback character for • (bullet) to
asterisk, affecting "ascii" and "latin1" output devices.
Fixes <https://savannah.gnu.org/bugs/?56015>. Thanks to Jeff
Conrad for the report.
2024-08-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tty.tmac: Revise fallback characters for ± and ∓ to
separate plus and minus signs with a slash, and to use actual
minus sign glyphs(!).
Prompted by discussion with Alex Colomar, Vincent Lefevre, and
Dave Kemper; see <https://lists.gnu.org/archive/html/groff/
2024-08/msg00016.html>.
2024-08-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Implement new `phcode` request.
* src/roff/troff/input.cpp (report_hyphenation_codes): Add.
(init_input_requests): Wire up `phcode` request name to
`report_hyphenation_codes()`.
* doc/groff.texi (Manipulating Hyphenation, Debugging):
* man/groff.7.man (Request short reference, Debugging):
* man/groff_diff.7.man (New requests, Debugging):
* NEWS: Document it.
Fixes <https://savannah.gnu.org/bugs/?66069>.
2024-08-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (set_hyphenation_codes): Handle the
common case (copying the existing hyphenation code of one
character to another) first. Support clearing a character's
hyphenation code by copying that of a character that lacks one.
Reorganize for clarity, and add comments.
Continues fixing <https://savannah.gnu.org/bugs/?66054>.
2024-08-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (hyphenate): Slightly refactor.
Reorder equality comparison to avoid inadvertent lvalue
assignment. `memset()` the stack-allocated character array
`hbuf` with null terminators as a paranoid hedge. Rename `buf`
to `bufp`, since it is a pointer and moreover used as a cursor
into the word that is a candidate for hyphenation. Pointers and
arrays are _not_ synonymous in C/C++; see Chapter 4, _Expert C
Programming: Deep C Secrets_, by van der Linden (1994). Add
assertions for further paranoia. Use `static_cast` instead of
C-style cast on dictionary values. `memset()` the
stack-allocated integer array `word` with zeroes.
2024-08-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix code style nits.
* src/roff/troff/input.cpp (temp_iterator::temp_iterator):
Explicitly cast return value of `memcpy()` to `void`.
(make_temp_iterator): Reorder comparison with null pointer to
avoid inadvertent lvalue assignment.
2024-08-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix Savannah #66052 (2/2).
* src/roff/troff/input.cpp (temp_iterator::temp_iterator):
Prevent potential heap overreads. Ensure that temporary
iterators are null-terminated when constructing them.
Fixes <https://savannah.gnu.org/bugs/?66052> (2/2). Thanks to
Lukas Javorsky for identifying the problem using "SAST analyzers
{combination of coverity, snyk, cppcheck, gcc, clang,
shellcheck, unicontrol}".
2024-08-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix Savannah #66052 (1/2).
* src/roff/troff/env.cpp (hyphenate): Fix potential one-byte
stack overwrite if attempting to hyphenate a 256-letter sequence
within a word. Reserve space for null terminator in `hbuf`
character array. Initially, this isn't necessary because the
array is simply walked to normalize hyphenation codes by their
equivalence classes. However, when we subsequently look up the
{possibly partial} word in the exception dictionaries, `hbuf`
{or a pointer into it} needs to be treatable as a C string, thus
null-terminated. Respell already correct expression later in
the code to reinforce similarity.
Fixes <https://savannah.gnu.org/bugs/?66052> (1/2). Thanks to
Lukas Javorsky for identifying the problem using "SAST analyzers
{combination of coverity, snyk, cppcheck, gcc, clang,
shellcheck, unicontrol}".
2024-08-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (set_font_specific_special_fonts):
Adjust diagnostic message for clarity (and relative brevity).
2024-08-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/{en,it}.tmac: Load "latin1.tmac".
* tmac/latin5.tmac: Add case mapping for dotless I.
Continues commit 0629380a9d, 3 August. Thanks to Dave Kemper
for the discussion.
2024-08-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[groff]: Drop tests of "cp1047" output device.
* src/roff/groff/tests/ab_works.sh:
* src/roff/groff/tests/backslash-X-works.sh:
* src/roff/groff/tests/\
backslash-exclamation-early-does-not-fail.sh:
* src/roff/groff/tests/cf-request-early-does-not-fail.sh:
* src/roff/groff/tests/device-request-works.sh:
* src/roff/groff/tests/output-request-works.sh: Do it.
Continues fixing <https://savannah.gnu.org/bugs/?65724>.
2024-08-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/ps.tmac: Drop `\[S ,]` and `\[s ,]` fallback character
definitions and hyphenation code assignments.
* NEWS: Document this.
Thanks to Werner Lemberg for noting the issue in <https://lists.
gnu.org/archive/html/groff/2024-08/msg00001.html>.
2024-08-03 G. Branden Robinson <g.branden.robinson@gmail.com>
tmac/*: Refactor hyphenation code declarations.
Move `hcode` invocations from language-specific macro files
{those that define a "groff locale", such as "english" or
"german"} to the macro files that support 8-bit character
encodings, because in the formatter, hyphenation codes are
global, not environment-specific like other hyphenation data.
{That design decision is worth reconsidering in the future,
but feels less urgent than adding UTF-8 input support to the
formatter, which may obviate some encoding-related issues.}
* tmac/LOCALIZATION: Relieve groff locale contributor of
hyphenation code definition duty.
* tmac/de.tmac: Move Latin-1 hyphenation code definitions from
here...
* tmac/latin1.tmac: ...to here. Reorganize and cover _every_
letter glyph in ISO 8859-1, including Icelandic letters that
German hyphenation patterns don't require.
* tmac/ru.tmac: Move KOI8-R hyphenation code definitions from
here...
* tmac/koi8-r.tmac: ...to here.
* tmac/latin2.tmac: Define Latin-2 hyphenation codes.
* tmac/latin5.tmac: Define Latin-5 hyphenation codes. Include
the notorious special case for the Turkish capital dotted I, and
annotate it for migration in the event we ever get a "tr.tmac"
file, because this is a language-specific case mapping, not one
strictly implied by the character encoding.
* tmac/latin9.tmac: Define Latin-9 (ISO 8859-15) hyphenation
codes.
Fixes <https://savannah.gnu.org/bugs/?59397>. Thanks to Werner
Lemberg for the discussion in <https://lists.gnu.org/archive/
html/groff/2024-08/msg00001.html>.
2024-07-31 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (set_hyphenation_codes): Accept a
special character as a source for hyphenation code assignment.
* doc/groff.texi.in (Manipulating Hyphenation) <hcode>:
* man/groff_diff.7.man (New requests) <hcode>: Document loosened
restriction.
Fixes <https://savannah.gnu.org/bugs/?66054>. Thanks to Carsten
Kunze for the report and Dave Kemper for a test case that
clarified matters.
2024-07-31 G. Branden Robinson <g.branden.robinson@gmail.com>
Regression-test Savannah #66054.
* src/roff/groff/tests/hcode-request-copies-spec-char-code.sh:
Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
2024-08-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (set_hyphenation_code): Do more input
validation of `hcode` request arguments. Handle case where an
argument is an escape sequence (but not a special character)
ourselves instead of delegating it to `token::get_char()`.
Throw errors (and stop processing arguments) when {1} the
destination character is a numeral; {2} the destination
character is a (non-special-character) escape sequence; {3} the
source character is a numeral; or {4} the source character is a
{non-special-character} escape sequence.
* doc/groff.texi.in (Manipulating Hyphenation) <hcode>:
* man/groff_diff.7.man (New requests) <hcode>: Document that the
request aborts processing its arguments upon encountering an
invalid one.
Continues <https://savannah.gnu.org/bugs/?66040>. Thanks to
Dave Kemper for further discussion.
2024-08-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi.in (Manipulating Hyphenation) <hcode>:
* man/groff_diff.7.man (New requests) <hcode>: Remove claim that
ran out ahead of ongoing code changes. A special character that
has already been assigned a hyphenation code is not _yet_ a
valid source for another character's hyphenation code.
2024-07-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (HP): The `mS` extension register has changed its
meaning (commit f680c55d38, 13 June) such that it is no longer a
reliable indicator of whether the deprecation warning for this
macro should be suppressed, so stop suppressing a deprecation
warning based on its value. In fact, stop issuing the
deprecation warning altogether. (See <https://
lists.gnu.org/archive/html/bug-ncurses/2024-04/msg00027.html>.)
2024-07-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp (page_length):
* src/roff/troff/env.cpp (line_length, title_length): Tweak
diagnostic to say "computed" rather than "invalid", because
while the value we're complaining about _is_ invalid, it is also
a numeric expression that may have traveled a great distance
through the alimentary canal of GNU troff's arithmetic
evaluator, and bear little resemblance to what the user typed in
a source document. Among other things, we no longer have any
idea what scaling units were supplied, but can report
measurements only in basic units.
Fixes <https://savannah.gnu.org/bugs/?66038>. Thanks to Dave
Kemper for the report.
2024-07-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi.in (Manipulating Hyphenation): Fix incorrect
claim and expand discussion. A special character _can_ be an
argument to the `hcode` request, and this has been true for over
20 years (for example, in "tmac/ps.tmac"). Problem dates back
to commit bd66717ef7, 16 April 2001.
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests): Sync language with our
Texinfo manual, and clarify.
2024-07-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (set_hyphenation_code): Restore
diagnostic message when attempting to assign the hyphenation
code of a special character to another character (special or
ordinary). Also initialize local variable much closer to where
we test its value, for readability.
Fixes <https://savannah.gnu.org/bugs/?66040>. Thanks to Dave
Kemper for the report.
2024-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (get_vunits, get_hunits, get_number)
(get_integer): Align assertion error messages with function
names.
2024-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_expression_start): Fix
missing space in diagnostic message.
2024-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (vunits::vunits, hunits::hunits):
Migrate to C23 checked arithmetic macros. Throw error if
addition overflows.
Fixes <https://savannah.gnu.org/bugs/?64301>. (For real this
time, fingers crossed.)
2024-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/tests/arithmetic-works.sh: Add more tests.
2024-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (vunits::vunits, hunits::hunits):
Move common subexpression to a temporary variable to prepare for
reuse in C23 checked artihmetic macros.
2024-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Enforce minimum page length.
* src/roff/troff/div.cpp (page_length): Clamp `pl` request
argument to the output device's vertical resolution (similarly
to the way `ll` and `lt` behave).
* doc/groff.texi.in (Page Layout):
* NEWS: Document this.
2024-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (line_length, title_length): Drop use
of needless temporary variable `minimum_length`. Use global
variable `hresolution` instead of static class member variable
`font::hor`. Clarify wording of warning diagnostic message when
{title} line length invalid.
2024-07-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/grog/grog.pl (interpret_line): Fix logic error; set
Boolean scalar `have_seen_first_macro_call` _after_ testing it,
not before, avoiding its tautological truth.
(infer_man_or_ms_package): Drop `TH` from list of "unique"
man(7) macro names. It isn't; most full-service macro packages
use it to manage tbl(1) headings, and we already have special
logic for handling it as the first call in a page anyway (where
it is overwhelmingly idiomatic of a man(7) document).
Fixes <https://savannah.gnu.org/bugs/?66006>. Thanks to Morten
Bo Johansen for the report.
2024-07-20 G. Branden Robinson <g.branden.robinson@gmail.com>
Regression-test Savannah #66006.
* src/utils/grog/tests/avoid-man-fakeout.sh: Do it.
* src/utils/grog/grog.am (grog_TESTS): Run test.
2024-07-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (is_char_usable_as_delimiter): Reject
`|`.
Fixes <https://savannah.gnu.org/bugs/?66009>.
2024-07-19 G. Branden Robinson <g.branden.robinson@gmail.com>
Add test of *roff arithmetic.
* src/roff/groff/tests/arithmetic-works.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
2024-07-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Prevent traps on overflowing integer arithmetic.
* bootstrap.conf: Add "stdckdint" to `gnulib_modules`.
* src/roff/troff/number.cpp: Include `config.h` and
`stdckdint.h` headers.
(get_number, get_integer, is_valid_expression): Use `ckd_add()`,
`ckd_sub()`, and `ckd_mul()` instead of primitive operations,
and throw error diagnostic if arithmetic wraps.
(is_valid_expression): Remove manual detection of overflow.
(get_vunits, get_hunits): Use `ckd_add()` (with temporary
variable, annotating why) instead of primitive operation, and
throw error diagnostic if arithmetic wraps.
(is_valid_term): When parsing integer literals, remove manual
detection of overflow, relying on `ckd_mul()` and `ckd_add()` to
indicate it. When an overflowing literal is encountered, skip
excess digits. This is a behavior change, albeit an esoteric
one; evaluation of a numeric term no longer aborts in this
scenario. When applying the *roff `|` boundary-relative motion
operator, remove manual detection of overflow, relying on
`ckd_sub()` to indicate it, and store result to temporary
variable in case it overflows and must be discarded. Otherwise,
copy temporary to the storage for the term being interpreted.
When negating a term, remove manual detection of negation of
`INT_MIN` (guaranteed to overflow in a two's complement
representation), relying on `ckd_mul()` to indicate it.
* src/roff/troff/hvunits.h: Include `config.h` and `stdckdint.h`
headers.
(vunits operator -, hunits operator -): Use `ckd_sub()` instead
of primitive operation, and throw error diagnostic if arithmetic
wraps.
(vunits::to_units, hunits::to_units): Use `ckd_mul()` instead of
primitive operation, and throw error diagnostic if arithmetic
wraps.
(vunits operator +, hunits operator +): Use `ckd_add()` instead
of primitive operation, and throw error diagnostic if arithmetic
wraps.
(vunits operator *, hunits operator *): Use `ckd_mul()` instead
of primitive operation, and throw error diagnostic if arithmetic
wraps.
Fixes <https://savannah.gnu.org/bugs/?64301>. You had to
compile GNU troff with the (GCC) compiler option `-ftrapv` for
arithmetic to trap and cause a core dump.
2024-07-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_term): Trivially refactor
implementation of boundary-relative ("absolute" [sic]) motion
operator. Rename `tem` to `position`, since it is the
horizontal or vertical drawing location to be altered.
Parenthesize expressions for clarity.
2024-07-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Refactor `has_arg()` to optionally work in copy mode.
* src/roff/troff/token.h (has_arg): Add Boolean parameter,
defaulting to `false`, indicating that "peeking" ahead in the
input stream is desired. This is for use by requests that need
to read their argument(s) in copy mode.
* src/roff/troff/input.cpp (has_arg): Implement, moving code
duplicated in `device_request` and `output_request`.
(device_request, output_request): Drop duplicated code in favor
of calling `has_arg()` with `true` argument.
2024-07-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (device_request): Honor a `device`
request even if it precedes any formatted output, as we do the
`\X` escape sequence.
Fixes <https://savannah.gnu.org/bugs/?65977>.
2024-07-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (get_long_name): Call
`do_get_long_name()` with null character literal for parameter
of `char` type, rather than punning an integral zero.
(do_get_long_name): Rename parameter from `end` to `end_char`.
2024-07-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* bootstrap: Resync with gnulib upstream. Thanks to Collin Funk
for the suggestion.
2024-07-15 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_term): Trivially refactor;
simplify tautologus Boolean expression.
2024-07-15 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::description): Revise
diagnostic when reporting unexpected character code > 128 in
input. Report only its code in decimal and Unicode-style
hexadecimal instead of trying to write it literally.
Continues <https://savannah.gnu.org/bugs/?65724>.
2024-07-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/pic.ms: Reduce vertical spacing in displays only on
typesetters. To that end:
(SS): Define new macro for starting a "small display".
(SE): ...and a macro for ending one.
Migrate use of `DS`/`DE` macros with `ps` and `vs` requests to
the new macros.
2024-07-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/groff_mdoc.7.man: Manipulate type size and vertical
spacing only in troff mode.
2024-07-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_term): Boolify. Rename
`negative` to `is_negative` and demote it and `do_next` from
`int` to `bool`. Assign to them with Boolean, not integer,
literals.
2024-07-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_expression, get_hunits)
(get_number, get_integer, is_valid_term): Trivially refactor.
Replace `v` as the general name for any numeric quantity
{possibly arising from copy-and-paste operations from a
`vunits`-handling original} with one more suggestive of its
type: `h`, `u`, or `i` for horizontal, general, or integral
units respectively.
2024-07-15 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/hvunits.h: Boolify.
(vunits:operator <, vunits::operator >, vunits::operator <=)
(vunits:operator >= vunits::operator ==, vunits::operator !=)
(hunits:operator <, hunits::operator >, hunits::operator <=)
(hunits:operator >= hunits::operator ==, hunits::operator !=):
Return `bool` instead of `int`.
2024-07-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an-ext.tmac (DS, DE): Drop (empty) macro definitions,
introduced in groff 1.20 (January 2009).
* NEWS: Document this. Technically, it's an interface change.
Any man page calling these macros (without defining them itself)
will prompt warnings if GNU troff is given the `-wmac` option
{or equivalent}.
2024-03-19 Alexis <surryhill@gmail.com>
[grohtml]: Migrate from psselect(1) to ps2ps(1).
* src/preproc/html/pre-html.cpp (imageList::createPage): Do it.
* src/devices/grohtml/grohtml.1.man (Dependencies): Document
the changed runtime requirement.
* m4/groff.m4 (GROFF_CHECK_GROHTML_PROGRAMS):
* src/roff/groff/tests/html_works_with_grn_and_eqn.sh:
* src/roff/groff/tests/smoke-test_html_device.sh: Check for
existence of `ps2ps` command instead of `psselect`.
* ANNOUNCE:
* NEWS:
* README:
* README.MinGW: Document change in dependencies.
Fixes <https://savannah.gnu.org/bugs/?65987>.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/searchpath.cpp (is_directory): New function
uses stat(2) to check file name argument to see if it's a
directory, and returns a Boolean.
(search_path::open_file):
(search_path::open_file_cautious): Use `is_directory()` before
attempting to `fopen()` a file specification; fail and set
`errno` to `EISDIR` if it's a directory so that the caller
reports a useful diagnostic.
* bootstrap.conf: Add gnulib `stat` module, because the story of
POSIX and non-POSIX systems alike trying and failing to sensibly
implement the fundamental Unix file system model is a sorry tale
of indifference and self-owns by rock star programmers.
{Seriously, read the "sys/stat.h" and "stat" sections of the
gnulib manual.}
Fixes <https://savannah.gnu.org/bugs/?65980>. Thanks to Dave
Kemper for the report.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an-ext.tmac: Fix incomplete changes to support `YS` with
an argument to reuse indentation of previous synopsis. (An
insufficiently aggressive test case is a dangerous thing.)
Revise meaning of `mS` register from "are we in a synopsis?" to
"are we reusing the previous synopsis's indentation?"
(SY): Save hyphenation and adjustment modes and disable
automatic hyphenation if we have any arguments.
(YS): Set `mS` register if we have any arguments, otherwise
clear it.
* tmac/tests/an_HY-register-works.sh: Drop test cases on
"nested" synopses. These are now ill-formed and no longer
supported. See "NEWS" file.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/an-ext_SY-and-YS-work.sh: Test new behavior of `YS`
when given an argument.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/main.cpp (main):
* src/roff/troff/input.cpp (process_startup_file): Throw error
diagnostic when a startup file cannot be opened for some reason
other than its nonexistence.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/grn/main.cpp (conv):
* src/preproc/html/pre-html.cpp (get_resolution)
(get_image_generator):
* src/roff/troff/env.cpp (hyphen_trie::read_patterns_file):
* src/roff/troff/input.cpp (process_macro_package_argument):
When failing to open a file, say why in error diagnostic.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/main.cpp (main):
* src/roff/troff/env.cpp (hyphen_trie::read_patterns_file):
* src/roff/troff/input.cpp (next_file, do_open, close_request)
(open_macro_package, process_macro_package_argument)
(do_macro_source, process_input_file): Parallelize (and shorten)
wording of diagnostic messages.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/font.cpp (text_file::~text_file)
(font::extend_ch, font::load, font::load_desc):
* src/libs/libgroff/searchpath.cpp
(search_path::open_file_cautious):
* src/roff/troff/env.cpp (hyphen_trie::read_patterns_file):
Reorder comparisons with null pointers to avoid inadvertent
lvalue assignment.
* src/libs/libgroff/font.cpp (text_file::next_line, scale_round)
(font::get_width, font::alloc_ch_index, font::load_desc): Do the
same for comparisons to integral zeroes.
* src/libs/libgroff/font.cpp (glyph_to_unicode): Add parentheses
to complex expression.
* src/libs/libgroff/searchpath.cpp (search_path::search_path)
(search_path::open_file, search_path::open_file_cautious)
* src/preproc/eqn/main.cpp (main):
* src/roff/troff/input.cpp (file_iterator::set_location)
(next_file, do_open, close_request, do_write_request)
(write_macro_request, transparent_file, open_macro_package)
(process_macro_package_argument, process_startup_file)
(do_macro_source, process_input_file): Explicitly compare
variable of pointer type to null pointer constant instead of
letting it pun down to a Boolean.
* src/roff/troff/input.cpp (writable_lineno_reg::set_value): Use
explicit void cast when ignoring function's return value.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/font.cpp (font::load, font::load_desc):
Reduce cleverness of assignment nested inside conditional--a
favorite of C obscurantists and an especially gratuitous case
since it was preceded by a declarator without an initializer.
This aligns `font::load()` with another overloaded version of
itself and with `font::scan_papersize()`.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (file_iterator::set_location): Stop
initializing the output. Preprocessing empty documents could
lead to baffling results. In groff 1.22.4 and before, you'd get
a blank document from some output drivers despite no evident
reason from the preprocessed input that this should be the case.
In groff 1.23.0, this happened for fewer output drivers but
still generated a mysterious diagnostic.
fatal error: 'V' command invalid before first 'p' command
It turns out to be unnecessary to initialize `the_output` upon
encountering an `lf` request. The spurious output aspect of the
problem dates back to commit e092fba4517, 6 February 2000
{"groff pre-1.16"}.
Fixes <https://savannah.gnu.org/bugs/?65983>.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (number_lines): Clarify diagnostics;
output line numbers cannot be negative, but input line numbers
can, in both AT&T/DWB troff and GNU troff.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify `set_location()` member function and those of
its derived classes.
* src/roff/troff/input.cpp (class input_iterator)
(class file_iterator, class input_stack)
(file_iterator::set_location):
(input_stack::set_location): Demote return type from `int` to
`bool`.
(file_iterator::set_location, input_stack::set_location): Return
Boolean instead of integer literals.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/soelim/soelim.cpp (do_file): Stop "normalizing"
an input file name of "-" to "stdin". The other preprocessors
don't do that.
2024-07-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/nroff/nroff.sh: Tweak shell pattern for clarity.
2024-07-12 G. Branden Robinson <g.branden.robinson@gmail.com>
Update gnulib to stable/2024-07.
Point to 0ba13435a9362bec0ff5fd0830907b9fac723e41.
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/devices/grolbp/lbp.cpp (main): Fix range check after
`strtol()`. In case INT_MAX==LONG_MAX, we need to check for
ERANGE to reject high values. The test 'n > INT_MAX' would
never be true.
Fixes <https://savannah.gnu.org/bugs/?65451> (6/6).
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/utils/indxbib/indxbib.cpp (check_integer_arg): Collapse
related tests.
Fixes <https://savannah.gnu.org/bugs/?65452> (4/4).
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/utils/indxbib/indxbib.cpp (check_integer_arg): Remove dead
code. The tests (LONG_MAX > INT_MAX && n > INT_MAX) and (n >
INT_MAX) are equivalent.
Fixes <https://savannah.gnu.org/bugs/?65452> (3/4).
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/utils/indxbib/indxbib.cpp (check_integer_arg): Clear
`errno` before calling `strtol()`. Otherwise, `errno` may hold
`ERANGE` from before. See strtol(3).
Fixes <https://savannah.gnu.org/bugs/?65452> (2/4).
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/utils/indxbib/indxbib.cpp (check_integer_arg): Don't
`else` after [[noreturn]].
Fixes <https://savannah.gnu.org/bugs/?65452> (1/4).
2024-03-16 Alejandro Colomar <alx@kernel.org>
[libgroff,libbib,indxbib]: Add, use `ceil_prime()`.
* src/include/lib.h:
* src/libs/libgroff/prime.cpp (ceil_prime): Add function to get
the lowest prime not less than n. While at it, fix the logic,
which was incorrect in the open-coded call sites, since for an
input of 1, it produced 3, but the first prime is 2. A recent
commit started rejecting 1 earlier, so this bug was now
impossible to trigger, but remained there.
Also, since this is a library function, let's behave well for an
input of 0, which is mathematically fine, and return also the
first prime, 2.
* src/libs/libbib/index.cpp
(index_search_item::read_common_words_file):
* src/utils/indxbib/indxbib.cpp (main): And use it where the
same logic was being open-coded.
Fixes <https://savannah.gnu.org/bugs/?65451> (5/6).
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/devices/grolbp/lbp.cpp (main): Remove bogus (and
redundant) check. `str == end` can only happen if strtol(3)
returns 0.
Fixes <https://savannah.gnu.org/bugs/?65451> (4/6).
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/devices/grodvi/dvi.cpp
(dvi_font::handle_unknown_font_command):
* src/devices/grolbp/lbp.cpp (main):
* src/devices/grolj4/lj4.cpp
(lj4_font::handle_unknown_font_command, main):
* src/devices/grops/ps.cpp (ps_printer::do_mdef)
(ps_printer::do_import):
* src/devices/grops/psrm.cpp (read_uint_arg):
* src/libs/libgroff/font.cpp (font::load):
* src/preproc/eqn/lex.cpp (do_space):
* src/preproc/pic/tex.cpp (tpic_output::command):
* src/preproc/refer/command.cpp (check_args):
* src/preproc/refer/ref.cpp (reference::compute_sort_key):
* src/preproc/refer/refer.cpp (main):
* src/utils/indxbib/indxbib.cpp (check_integer_arg):
* src/utils/lkbib/lkbib.cpp (main):
* src/utils/lookbib/lookbib.cpp (main):
* src/utils/tfmtodit/tfmtodit.cpp (main): Remove redundant checks
after strtol(3). `str == end` can only happen if strtol(3)
returns 0.
Fixes <https://savannah.gnu.org/bugs/?65451> (3/6).
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/libs/libgroff/curtime.cpp (current_time): Remove dead
code. strtol(3) can only report ERANGE, if the base is valid
{and it is}.
Fixes <https://savannah.gnu.org/bugs/?65451> (2/6).
2024-03-16 Alejandro Colomar <alx@kernel.org>
* src/libs/libgroff/curtime.cpp (current_time): Remove redundant
checks. ERANGE can only happen if strtol(3) returns either
LONG_MIN or LONG_MAX.
Fixes <https://savannah.gnu.org/bugs/?65451> (1/6).
2024-07-12 G. Branden Robinson <g.branden.robinson@gmail.com>
[nroff]: Support argument clustering.
* src/roff/nroff/nroff.sh: Support argument clustering by
iterating over the argument list and declustering options that
can be clustered (`-abCEikpRStUzZ`).
* src/roff/nroff/tests/verbose_option_works.sh: Test it.
* NEWS: Document it.
Fixes <https://savannah.gnu.org/bugs/?64684>.
2024-07-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/nroff/nroff.sh: Support groff `-a`, `-D`, `-I`, and
`-Z` options.
* src/roff/nroff/nroff.1.man:
* NEWS: Document it.
2024-07-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/nroff/nroff.sh: Describe program briefly when invoked
with `--help` option.
2024-07-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/nroff/nroff.sh: Define `prog` variable as only the
"basename" of argv[0], making diagnostic and usage messages less
garrulous. See Savannah #65110.
2024-07-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (class composite_node): Declare
`dump_node()` member function.
(composite_node::dump_node): Implement.
2024-07-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi.in (Groff Options):
* man/groff.7.man (Syntax reference conventions):
* src/roff/troff/troff.1.man (Options): Document restriction on
file names used as request arguments: no spaces, tabs, or line
feeds.
2024-07-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh:
* src/roff/groff/tests/smoke-test_html_device.sh: Revise tests
to better handle non-glibc environments. For example, Bionic
libc offers no "locale" command to query the locale's character
set from the shell. When that is the case, skip the test and
describe the failure more accurately. Fixes test failures on
Termux.
2024-05-14 Dave Kemper <saint.snit@gmail.com>
* tmac/e.tmac: Add debugging advice for developers.
Fixes <https://savannah.gnu.org/bugs/?64189>.
2024-07-09 Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
[docs]: Fix doubled word typos.
Fixes <https://savannah.gnu.org/bugs/?65886>.
2024-07-09 Dave Kemper <saint.snit@gmail.com>
[docs]: Revise "input file" usage.
Change the term "input file" to "input" in groff documentation
in cases where the referenced input need not come from a file.
Fixes <https://savannah.gnu.org/bugs/?65967>.
2024-07-09 G. Branden Robinson <g.branden.robinson@gmail.com>
Actually use the detected Netpbm option for quieting output in
the pre-grohtml(1) preprocessor.
* m4/groff.m4 (GROFF_PNMTOOLS_CAN_BE_QUIET): Set up an
Autoheader template for the C/C++ preprocessor symbol
`PNMTOOLS_QUIET`. Report the detected option (if any) as the
result of this configuration test. Get the expansion into the
"config.h" file with `AC_DEFINE_UNQUOTED`.
* src/preproc/html/pre-html.cpp (imageList::createImage): Use
the preprocessor symbol instead of a "-quiet" string literal.
2024-07-09 G. Branden Robinson <g.branden.robinson@gmail.com>
Search for and use pamcut(1), not pnmcut(1). Per upstream, the
former was introduced 23 years ago and the latter withdrawn 15
years ago. And we just got the memo!
* m4/groff.m4 (GROFF_CHECK_GROHTML_PROGRAMS):
* src/preproc/html/pre-html.cpp (imageList::createImage): Do it.
* src/roff/groff/tests/html_works_with_grn_and_eqn.sh:
* src/roff/groff/tests/smoke-test_html_device.sh: Update tests.
* NEWS:
* README.MinGW:
* src/devices/grohtml/grohtml.1.man (Dependencies): Document it.
Fixes <https://savannah.gnu.org/bugs/?65960>. Thanks to Bjarni
Ingi Gislason for the report.
2024-07-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Slightly refactor.
(pipe_output): Reduce cleverness of assignment nested inside
conditional--a favorite of C obscurantists and an especially
gratuitous case since it was immediately preceded by a
declarator without an initializer. This aligns the logic with
`system_request`.
(pipe_output, system_request): Reorder comparisons to avoid
inadvertent lvalue assignment.
2024-07-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi.in (while):
* man/groff_diff.7.man (New requests) <while>: Point out that
the `slimit` register can be used to _lower_ the formatter's
internal stack size limit as well.
Fixes <https://savannah.gnu.org/bugs/?65962>. Thanks to Bjarni
Ingi Gislason for the report and Dave Kemper for the suggestion.
2024-07-06 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an-ext.tmac (SY): Drop unnecessary `do` request.
2024-06-28 Dave Kemper <saint.snit@gmail.com>
* doc/groff.texi.in: Drop relict macro call in example.
Fixes <https://savannah.gnu.org/bugs/?65929>.
2024-06-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/grog/grog.pl: Trivially refactor. Relocate
declaration of huge list `request` closer to its point of use.
2024-06-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/grog/grog.pl: Trivially refactor. Rename scalar
`have_any_valid_arguments` to `have_any_valid_operands`,
reflecting its more specific purpose. Rename subroutine
`process_input` to `read_input`; it transforms its input only
for internal purposes (to draw inferences), without output.
Rename subroutine `do_line` to `interpret_line`. "Do" is an
overused term in software development, too often meaning
"whatever the programmer had in mind at the time but failed to
document anywhere".
2024-06-22 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] Fix invalid pdf when using certain sizes of
dashed ellipse in pic.
* src/devices/gropdf/gropdf.pl: For short dashes on flat part
of ellipse some v. small numbers written in form n.nnnE-n which
is invalid for pdfs. Also rather than split each arc always into
4 pieces, split into number of quadrants described between start
and end angle. If arc describes a straight line, use line segment
rather than bezier curve. (grops does this as well)
Fixes https://savannah.gnu.org/bugs/index.php?65901
Thanks to Morten Bo Johansen for reporting this issue.
2024-06-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::possibly_break_line):
Trivially refactor. Explicitly handle adjustment modes that had
been handled by falling completely through a `switch` statement.
Throw assertion if an unhandled case is encountered.
2024-06-21 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Recognize new POSIX.1-2024 standard.
* tmac/mdoc/doc-syms: Do it.
* tmac/groff_mdoc.7.man (Standards): Document it.
2024-06-20 G. Branden Robinson <g.branden.robinson@gmail.com>
[grog]: Fix Savannah #65902 (detect use of chem(1)).
* src/utils/grog/grog.pl: Take `cstart` and `cend` tokens out of
`preprocessor_for_macro` hash. They don't work with the
existing logic. Also drop tokens used by preprocessors that
don't have corresponding groff(1) options and therefore don't
influence the output grog(1) can emit.
(do_line): Add bespoke handling for `cstart` and `cend`. Not
only are they the only AT&T troff preprocessor tokens that are
longer than two characters, but their names collide in those
first two characters with the names of troff requests.
Fixes Savannah #65902. Thanks to Morten Bo Johansen for the
report. Problem introduced by me in commit 53a9964497, 31 July
2021.
2024-06-20 G. Branden Robinson <g.branden.robinson@gmail.com>
[grog]: Regression-test Savannah #65902.
* src/utils/grog/tests/detect-chem.sh: Do it.
* src/utils/grog/grog.am (grog_TESTS): Run test.
2024-06-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/mtsm.cpp (mtsm::inherit): Fix failing test.
2024-06-20 G. Branden Robinson <g.branden.robinson@gmail.com>
Fix Savannah #65894. Refactor troff's "mini-troff state
machine" to use STL stack implementation instead of a bespoke
one, fixing a double-free error.
* src/roff/troff/mtsm.h: Include C++ standard library "stack"
header.
(struct stack): Drop.
(class mtsm): Declare `stack` data member as a standard stack of
`statem` objects instead of a pointer to local `stack` type.
* src/roff/troff/mtsm.h (statem::merge, statem::update):
* src/roff/troff/mtsm.cpp (statem::merge, statem::update): Take
references instead of pointers to some `statem` arguments (those
that will be accessed via the `stack` data member).
* src/roff/troff/mtsm.cpp (stack::stack, stack::~stack): Drop.
(mtsm::mtsm): Drop initializer of `sp` data member.
(mtsm::~mtsm): Drop (conditional) deletion of `sp`.
(mtsm::push_state, mtsm::pop_state, mtsm::inherit): Use STL
`stack`'s `push()`, `empty()`, and `pop()` instead of primitive
operations.
(statem::update): Access data members of `mtsm` class via
references instead of pointers (using `.` instead of `->`
operator).
(statem::merge): Drop null pointer test of reference, which
can't be null.
Fixes <https://savannah.gnu.org/bugs/?65894>. This was a latent
bug exposed by commit 0951ff53e4, 10 August (a change to the
man(7) macro package; such things should _never_ cause the
formatter to crash).
2024-06-20 G. Branden Robinson <g.branden.robinson@gmail.com>
Add regression test for latent bug: surprising "grout" produced
when using "html" output device and a memory management bug is
fixed.
* src/roff/groff/tests/html-does-not-fumble-tagged-paragraph.sh:
Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
2024-06-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/grog/grog.pl (do_line): Recognize new `pline`
request forthcoming in groff 1.24 release.
2024-06-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/trans.tmac: For mm package, alias new string name
`Abstract` instead of old (and internal!) one, `cov*abs-name`.
2024-06-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::next, interpolate_arg):
Tighten up null-terminated string traversal.
2024-06-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[docs]: Fix Savannah #65837.
* doc/groff.texi: Fix erroneous documentation of input backspace
handling.
(Requests and Macros): Add footnote directing reader to "Page
Motions" node for discussion of backspace.
(Identifiers): Drop 0x08 from list of invalid input characters.
(Manipulating Filling and Adjustment): Add concept index entry
for "word space". Define "word space" as terminology.
(Page Motions): Describe semantics of input backspace character,
motivate its existence, and discourage its use.
* man/groff.7.man (Identifiers):
* man/roff.7.man (Requests and macros): Sync.
Fixes <https://savannah.gnu.org/bugs/?65837>.
2024-06-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Fix Savannah #64005 (again).
* tmac/s.tmac (bp): Fix thinko swapping the normal and no-break
control characters.
Fixes <https://savannah.gnu.org/bugs/?64005>. Thanks to Deri
James for catching this misbehavior.
2024-06-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Further regression-test Savannah #64005.
* tmac/tests/s_honor-page-break-in-text.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
2024-06-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac: Drop nilpotent junk from end of file.
Fixes <https://savannah.gnu.org/bugs/?65701>. Thanks to Bjarni
Ingi Gislason for the report.
2024-06-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* m4/groff.m4 (GROFF_WCOREFLAG): Use `AC_LANG_PROGRAM` more
idiomatically; stop explicitly defining `main()`. Reportedly
resolves implicit function declaration warnings from Clang.
Fixes <https://savannah.gnu.org/bugs/?65762>. Thanks to Eli
Schwartz for the report.
2024-06-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (interpolate_arg): Stop embedding
unprintable input characters in messages diagnosing invalid
syntax.
See
<https://lists.gnu.org/archive/html/groff/2024-05/msg00057.html>
and follow-ups.
2024-05-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (glyph_node::dump_node):
(node::dump_node): Favor `fputs()` over `fprintf()` when the
output string doesn't require formatting.
2024-05-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (dbreak_node::dump_node): Drop
extraneous space from output.
2024-05-25 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] Deal better with invalid destination names.
Bookmark destinations (supplied by -T to .pdfbookmark)
are "Name Objects" in pdf terms, as such they are limited
to characters in the range 33 (!) to 126 (~). Characters
outside this range must be coded as a # followed by the
2 digit hex number. So a space character should be '#20'.
Gropdf produces pdfs which conform to this rule, but the
pdf parser (used to import pdfs for pdfpic) expects only
valid syntax. To convert pdfmark input to a pdf object
gropdf used this inbuilt parser.
The .TH macro in an.tmac passes its first parameter as a
bookmark destination. Normally this is fine, since the
convention is that this will be the name of the program
the man page is documenting. The problem in this case
is the line:-
.TH "Pamaltsat User Manual" 0 "14 September 2018"
"netpbm documentation"
The first parameter contains spaces, which yields invalid
syntax when parsed as "/Dest /Pamaltsat User Manual(0)".
* src/devices/gropdf/gropdf: Don't use internal parser
on "user" supplied input, be a bit more careful.
Fixes:-
https://savannah.gnu.org/bugs/?65788
Thanks to Bjarni for the report.
2024-05-14 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] Problem if mixed fonts have different lenIV.
* src/devices/gropdf/gropdf: Restore default value (4) for
each font in case custom value used by previous font. Slight
change to pattern matches.
2024-05-14 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] \X'pdf: xrev' has issues.
* src/devices/gropdf/gropdf: Fails if point size not = 10, in
a number of ways.
* src/devices/gropdf/gropdf.1.man: Clarify exact operation of
'xrev'.
2024-05-14 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] Passing just "\" as a bookmark problem.
* src/devices/gropdf/gropdf: it ends up as a pdf string "(\)",
which is treated as an escaped bracket and the string is not
terminated! Solution is to embed the "\" in octal notation,
i.e. (\134).
2024-05-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (EE): Define macro with `de1` request, not `de`.
Fixes <https://savannah.gnu.org/bugs/?65729>. Thanks to Bjarni
Ingi Gislason for the report. Problem introduced by me in
commit 15f8188656, 21 February 2022.
2024-05-11 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Perform actual string comparisons.
* tmac/fallbacks.tmac:
* tmac/troffrc-end: Bracket comparands to formatted output
comparison operator with `\?` escape sequences to perform a more
elementary string comparison on them (cf. a comparison of
_formatted text_). This way they continue to perform their
function even if the default font family has no coverage of
Basic Latin (not a bizarre choice when considering potential
rendering of documents using Devanagari or East Asian
languages). Unfortunately this means of comparing strings,
while long documented in the GNU troff Manual, is neither
idiomatic for *roff macro programmers nor portable to AT&T
troff. (The *roff language historically _lacks_ a string
comparison operator.) Each macro package will have to decide
for itself whether it wants to have portability at the expense
of requiring Basic Latin coverage (possibly switching fonts
before and after a formatted output comparison for the sole
purpose of obtaining it). These two files are unconditionally
loaded by the stock `troffrc`, and therefore must be dealt with
in any case.
Fixes <https://savannah.gnu.org/bugs/?64155>. Thanks to Dave
Kemper for the report, and to him, Peter Schaffter, and Deri
James for the discussion.
2024-05-11 G. Branden Robinson <g.branden.robinson@gmail.com>
Begin withdrawing support for CCSID (code page) 1047 (EBCDIC).
* tmac/X.tmac:
* tmac/Xps.tmac:
* tmac/dvi.tmac:
* tmac/html.tmac:
* tmac/ps.tmac: Stop loading "latin1.tmac" or "cp1047.tmac"
depending on the special character `\[char97]` matching "a".
* tmac/troffrc: Simplify logic; map special character
`\[char160]` to `\~` unconditionally.
Begins fixing <https://savannah.gnu.org/bugs/?65724>.
2024-05-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (class dbreak_node): Add `dump_node`
member function, overriding virtual function in `node` base
class.
(dbreak_node::dump_node): Disclose more information, namely the
contents of any defined glyph nodes within.
2024-05-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (glyph_node::dump_node)
(node::dump_node, node::dump_node_list): Tweak output format.
2024-05-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (doc-empty-line):
* tmac/mdoc/doc-common (doc-header, doc-break-body-text)
(doc-footer, doc-end-macro): Define macros with `de1` instead of
`de` so the macro package doesn't throw warnings when used in
compatibility mode.
Fixes <https://savannah.gnu.org/bugs/?65717>. Thanks to Bjarni
Ingi Gislason for the report.
2024-05-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::get_prev_char)
(environment::width_registers, distribute_space)
(environment::start_field): Slightly refactor. Explicitly
compare variable of pointer type to null pointer constant
instead of letting it pun down to a Boolean.
2024-05-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp: Trivially refactor. Rename member
function argument indicating the diversion level to be used when
constructing a `node` struct from "pop" (a word that suggests
action, or a Boolean indicator, to me) to "divlevel", as is
already used in the constructors in "node.h".
(charinfo_node::charinfo_node, glyph_node::glyph_node)
(ligature_node::ligature_node, kern_pair_node::kern_pair_node)
(dbreak_node::dbreak_node)
(italic_corrected_node::italic_corrected_node)
(break_char_node::break_char_node)
(extra_size_node::extra_size_node)
(vertical_size_node::vertical_size_node)
(vmotion_node::vmotion_node, hline_node::hline_node)
(vline_node::vline_node, zero_width_node::zero_width_node)
(overstrike_node::overstrike_node, bracket_node::bracket_node)
(space_node::space_node)
(diverted_space_node::diverted_space_node)
(diverted_copy_file_node::diverted_copy_file_node)
(space_char_hmotion_node::space_char_hmotion_node)
(special_node::special_node)
(suppress_node::suppress_node, tag_node::tag_node)
(composite_node::composite_node)
(word_space_node::word_space_node)
(unbreakable_space_node::unbreakable_space_node)
(draw_node::draw_node)
(left_italic_corrected_node::left_italic_corrected_node): Do it.
2024-05-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (print_nodes_from_input_line): Fix
elementary mistake in request implementation. It is essential
that requests call `skip_line()` when they are done interpreting
arguments--even if there are none, to prevent the newline at the
end of the input line from being interpreted as text (and
causing a line or word break, depending on filling enablement).
2024-05-06 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an-ext.tmac (YS): Clear `mS` register unconditionally.
2024-05-06 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/an-ext_SY-and-YS-work.sh: Add test case exercising
correct suspension of automatic hyphenation. Thanks to Alex
Colomar for the report and a reproducer.
2024-05-06 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.h (class environment): Rename member
function.
* src/roff/troff/env.cpp (environment::get_using_line_tabs):
Rename this...
(environment::is_using_line_tabs): ...to this.
(init_env_requests): Update reference.
2024-05-06 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::print_env): Fix typo in
environment report.
2024-05-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_if_request): Boolify. Demote
`result` from `int` to `bool`. Assign Boolean literals to it.
2024-05-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (TH): Reset `mE` and `mS` registers from
"an-ext.tmac" to zero upon beginning a new document.
2024-05-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Revise and expand `SY` and `YS` macro behavior, largely
to accommodate C library function synopses. `SY` no longer puts
vertical space on the output, and initially breaks the output
line _only_ if it is encountered repeatedly without a preceding
`YS` call. The computed indentation of synopsis lines after the
first now also includes the width of anything on the line
_before_ the synopsis, so that you can precede the `SY` call
with, for instance, the C language data type used for the return
value in a function prototype. The `SY` macro now accepts an
optional second argument. This second argument is typeset in
bold, replaces the fixed-width space that is appended to the
synopsis keyword in `SY`'s single-argument form, and is used in
computation of the indentation of non-initial synopsis lines.
...unless overridden. You can now reuse the indentation amount
computed in a previous synopsis. To do this, give any argument
to the `YS` macro call "closing" the synopsis whose indentation
you want to reuse. When you're done with such a grouped
synopsis, simply leave the argument off the final `YS` call.
Finally, the `SY` macro is now effectively a no-op if it is
called with no arguments; no text is discarded.
* tmac/an-ext.tmac (SY, YS): Do it.
* NEWS:
* tmac/groff_man.7.man.in: Document it.
* tmac/tests/an-ext_SY-and-YS-work.sh: Update test expectations.
* contrib/chem/chem.1.man:
* contrib/eqn2graph/eqn2graph.1.man:
* contrib/gdiffmk/gdiffmk.1.man:
* contrib/glilypond/glilypond.1.man:
* contrib/gperl/gperl.1.man:
* contrib/gpinyin/gpinyin.1.man:
* contrib/grap2graph/grap2graph.1.man:
* contrib/mm/groff_mm.7.man:
* contrib/mm/groff_mmse.7.man:
* contrib/mm/mmroff.1.man:
* contrib/mom/groff_mom.7.man:
* contrib/pdfmark/pdfroff.1.man:
* contrib/pic2graph/pic2graph.1.man:
* src/devices/grodvi/grodvi.1.man:
* src/devices/grohtml/grohtml.1.man:
* src/devices/grolbp/grolbp.1.man:
* src/devices/grolj4/grolj4.1.man:
* src/devices/gropdf/gropdf.1.man:
* src/devices/gropdf/pdfmom.1.man:
* src/devices/grops/grops.1.man:
* src/devices/grotty/grotty.1.man:
* src/devices/xditview/gxditview.1.man:
* src/preproc/eqn/eqn.1.man:
* src/preproc/grn/grn.1.man:
* src/preproc/pic/pic.1.man:
* src/preproc/preconv/preconv.1.man:
* src/preproc/refer/refer.1.man:
* src/preproc/soelim/soelim.1.man:
* src/preproc/tbl/tbl.1.man:
* src/roff/groff/groff.1.man:
* src/roff/nroff/nroff.1.man:
* src/roff/troff/troff.1.man:
* src/utils/addftinfo/addftinfo.1.man:
* src/utils/afmtodit/afmtodit.1.man:
* src/utils/grog/grog.1.man:
* src/utils/hpftodit/hpftodit.1.man:
* src/utils/indxbib/indxbib.1.man:
* src/utils/lkbib/lkbib.1.man:
* src/utils/lookbib/lookbib.1.man:
* src/utils/pfbtops/pfbtops.1.man:
* src/utils/tfmtodit/tfmtodit.1.man:
* src/utils/xtotroff/xtotroff.1.man:
* tmac/groff_man.7.man.in:
* tmac/groff_me.7.man:
* tmac/groff_ms.7.man: Migrate synopses to new idiom, using `YS`
to terminate each synopsized item, and `P` to vertically
separate item(s) where appropriate.
Thanks to Alex Colomar and Lennart Jablonka for feedback and to
Peter Chubb for his suggestion of `bsearch()` as an exemplar.
2024-04-30 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename node and node list dumping
member function prefixes from "debug_" to "dump_", to reflect
the fact that they're not just for (source-level) debugging
anymore.
* src/roff/troff/node.h (struct node): Rename.
- `debug_node` -> `dump_node`
- `debug_node_list` -> `dump_node_list`
* src/roff/troff/node.cpp (glyph_node::debug_node)
(node::debug_node)
(node::debug_node_list): Rename these...
(glyph_node::dump_node)
(node::dump_node):
(node::dump_node_list): ...to these.
* src/roff/troff/env.cpp (environment::add_char)
(environment::dump_node_list):
* src/roff/troff/node.cpp (node::dump_node_list): Update call
sites.
2024-04-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (node::debug_node): Report list of
pending output nodes in forward order, likely corresponding to
user intuition. (Internally, the formatter stores the nodes in
LIFO order, for the convenience of appending to a singly-linked
list.)
2024-04-30 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add new request `pline` to dump list of nodes in the
pending output 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()`.
(print_node_list): New function dumps list of nodes
in the environment's pending output 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 <g.branden.robinson@gmail.com>
* 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 <g.branden.robinson@gmail.com>
* 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 <g.branden.robinson@gmail.com>
* 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 and if one is using a debugger on an unstripped troff
executable.
2024-04-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* 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 <deri@chuzzlewit.myzen.co.uk>
[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 <cmeerw@cmeerw.org>
* 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 <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp
(pending_output_line::pending_output_line)
(environment::add_node, environment::get_prev_char)
(environment::extract_output_line, environment::output_line)
(environment::choose_breakpoint, node_list_reverse)
(distribute_space, environment::construct_state)
(environment::construct_format_state)
(environment::construct_new_line_state)
(environment::make_tab_node): Rename function parameters and
local variables from `n` to `nd` (or `nod` in one case when `nd`
was already in use) when they are of `node *` type; the file
also uses `n` for integers, which is confusing.
2024-04-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (select_font): Fix code style nit.
Compare constant character to null character literal, not an
integral zero.
2024-04-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::add_char)
(environment::add_node, environment::add_hyphen_indicator)
(environment::add_italic_correction, environment::space_newline)
(environment::space, environment::get_input_line_position)
(environment::set_input_line_position)
(environment::get_prev_char, environment::get_text_length)
(environment::extract_output_line, environment::newline)
(environment::possibly_break_line, environment::do_break)
(environment::is_empty, environment::wrap_up_tab)
(environment::handle_tab, environment::wrap_up_field)
(environment::handle_tab, environment::wrap_up_field): Fix code
style nit. Perform explicit comparisons of `current_tab` (an
enumerated type) against `TAB_NONE` instead of punning down to a
Boolean.
2024-04-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* 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 <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename member functions and
variables such that it is easier to tell Boolean objects (or
even an imperative verb/noun action) from a countable quantity.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::get_centered_line_count)
(environment::environment, environment::copy, center)
(right_justify, environment::newline)
(environment::possibly_break_line)
(environment::dump_troff_state, environment::construct_state)
(environment::construct_format_state, environment::print_env)
(init_env_requests): Rename `center_lines` to
`centered_line_count`. Rename `get_center_lines()` to
`get_centered_line_count()`.
* src/roff/troff/env.cpp (environment::print_env): Perform
integer comparison, not Boolean test, for clarity and to ensure
consistency with *roff integer-to-Boolean conversion idiom.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp
(environment::get_right_aligned_line_count)
(environment::environment, environment::copy, center)
(right_justify, environment::newline)
(environment::possibly_break_line)
(environment::dump_troff_state, environment::construct_state)
(environment::construct_format_state, environment::print_env)
(init_env_requests): Rename `right_justify_lines` to
`right_aligned_line_count`. Rename `get_right_justify_lines()`
to `get_right_aligned_line_count()`.
* src/roff/troff/env.cpp (environment::print_env): Perform
integer comparison, not Boolean, test, for clarity and to ensure
consistency with *roff integer-to-Boolean conversion idiom.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::environment)
(environment::copy, do_underline) (environment::newline)
(environment::print_env): Rename `underline_lines` to
`underlined_line_count`.
* src/roff/troff/env.cpp (environment::print_env): Perform
integer comparison, not Boolean, test, for clarity and to ensure
consistency with *roff integer-to-Boolean conversion idiom.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::environment)
(environment::copy, environment::distance_to_next_tab)
(line_tabs_request, environment::print_env, init_env_requests):
Rename `line_tabs` to `using_line_tabs`.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::get_line_tabs): Rename
this...
(environment::get_using_line_tabs): ...to this.
2024-04-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Demote parameter of global `do_underline` function from
`int` to `bool`.
* src/roff/troff/env.h: Do it.
* src/roff/troff/env.cpp (do_underline): Do it. Rename paramter
from `underline_spaces` to `want_spaces_underlined`.
* src/roff/troff/env.h (class environment): Update friend
access.
* src/roff/troff/env.cpp (continuous_underline, underline): Call
it with Boolean, not integer, literals.
2024-04-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify `suppress_push` global variable, and declare it
in a header file.
* src/roff/troff/env.cpp: Move `extern` declaration from here...
* src/roff/troff/input.h: ...to here.
* src/roff/troff/input.cpp: Demote it from `int` to `bool` and
assign Boolean, not integer, literals to it.
2024-04-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify `translate_space_to_dummy` global variable.
* src/roff/troff/env.h:
* src/roff/troff/env.cpp: Do it.
2024-04-26 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify more `environment` class member variables,
member function parameters, and local variables.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (class pending_output_line)
(pending_output_line::output, environment::output)
(environment:output_title): Rename `no_fill` to
`suppress_filling` and demote it from `int` to `bool`.
* src/roff/troff/env.h (class environment) [WIDOW_CONTROL]:
* src/roff/troff/env.cpp (class pending_output_line)
[WIDOW_CONTROL]: Update prototype of `environment::output`
friend declaration.
* src/roff/troff/env.cpp (class pending_output_line)
(pending_output_line::pending_output_line): Demote parameter
`nf` from `int` to `bool`.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (class pending_output_line)
(environment::output, environment::newline)
(environment::output_line, environment::possibly_break_line):
(environment::construct_format_state, environment::do_break):
Demote `was_centered` from `int` to `bool`.
(environment::newline): Assign Boolean literals to variables of
type `bool`.
(class pending_output_line) [WIDOW_CONTROL]: Update prototype of
`environment::output` friend declaration.
* src/roff/troff/env.cpp (class pending_output_line)
(pending_output_line::pending_output_line)
(pending_output_line::output, environment::mark_last_line)
[WIDOW_CONTROL]: Rename `last_line` to `is_last_line` and demote
it from `int` to `bool`.
* src/roff/troff/env.cpp (class pending_output_line)
(pending_output_line::output): Demote member function's return
type from `int` to `bool`. Return Boolean, not integer,
literals from functions returning `bool`.
* src/roff/troff/env.cpp (class pending_output_line)
(pending_output_line::output): Demote parameter `ce` from `int`
to `bool`.
* src/roff/troff/env.h (class environment) [WIDOW_CONTROL]:
* src/roff/troff/env.cpp (environment::output)
(environment::output_pending_lines, widow_control_request)
(environment::output, environment::environment)
(environment::copy, environment::print_env) [WIDOW_CONTROL]:
- Rename `widow_control` to `want_widow_control` and demote it
from `int` to `bool`.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::space_newline)
(environment::space, environment::environment)
(environment::copy, environment::print_env):
- Rename member variable `spread_flag` to `spreading` and demote
it from `int` to `bool`.
- Assign Boolean literals to it.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::hyphenate_line)
(environment::possibly_break_line):
- Rename parameter `start_here` to `must_break_here` and demote
it from `int` to `bool`.
* src/roff/troff/env.cpp (environment::possibly_break_line):
* src/roff/troff/input.cpp (process_input_stack):
- Pass Boolean, not integer, literals to it.
* src/roff/troff/env.h (class environment): Demote `fill` member
variable from `int` to `bool`.
* src/roff/troff/env.cpp (environment::environment, fill)
(no_fill): Assign Boolean literals to it.
* src/roff/troff/env.h (class environment): Rename member
variable `interrupted` to `line_interrupted` and demote it from
`int` to `bool`.
* src/roff/troff/env.cpp (environment::add_char)
(environment::add_node, environment::add_italic_correction)
(environment::space, environment::set_font):
(environment::set_family, environment::set_size):
(environment::set_char_height, environment::set_char_slant):
(environment::set_glyph_color, environment::set_fill_color):
(environment::set_glyph_color, environment::set_fill_color):
(environment::environment, environment::copy):
(environment::interrupt, environment::newline): Assign Boolean
literals to it.
* src/roff/troff/env.cpp (environment::choose_breakpoint):
Demote local variable `best_bp_fits` from `int` to `bool`.
Assign Boolean literals to it.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::possibly_break_line):
Rename parameter `forced` to `must_adjust` and demote it from
`int` to `bool`.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::handle_tab): Demote
parameter `is_leader` from `int` to `bool`. Assign Boolean
literal to it.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp
(environment::construct_state): Rename parameter `only_eol` to
`has_only_eol` and demote it from `int` to `bool`.
* src/roff/troff/env.cpp (environment::add_char):
(environment::add_node):
* src/roff/troff/input.cpp (input_stack::push): Assign Boolean
literals to it.
* src/roff/troff/env.h (class environment): Demote member
variables `seen_space`, `seen_eol`, `suppress_next_eol`, and
`seen_break` from `int` to `bool`.
* src/roff/troff/env.cpp (environment::environment)
(environment_switch, no_fill, environment::newline)
(environment::construct_state)
(environment::construct_format_state)
(environment::construct_new_line_state, environment::do_break):
Assign Boolean literals to them. Simplify conditional
expressions.
* src/roff/troff/env.h (class environment): Demote member
variable `underline_spaces` from `int` to `bool`.
* src/roff/troff/env.cpp (environment::environment)
(environment::copy, do_underline, environment::newline): Assign
Boolean literals to it.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp
(environment::add_char, environment::add_node)
(environment::space_newline, environment::space)
(environment::environment, environment::copy)
(environment::newline, environment::possibly_break_line)
(environment::wrap_up_tab, environment::start_field)
(environment::wrap_up_field, environment::print_env): Rename
parameter `current_field` to `has_current_field` and demote it
from `int` to `bool`.
* src/roff/troff/env.cpp (environment::add_char):
(environment::add_node):
* src/roff/troff/input.cpp (input_stack::push): Assign Boolean
literals to it.
* src/roff/troff/env.h (class environment): Demote member
variable `composite` from `int` to `bool`.
* src/roff/troff/env.cpp (environment::environment)
(environment::copy):
* src/roff/troff/env.h (environment::set_composite): Assign
Boolean literals to it.
* src/roff/troff/env.h (environment::is_composite): Return a
`bool`, not an `int`.
* src/roff/troff/env.cpp (temporary_indent): Rename local
variable `err` to `is_valid`, invert its sense, and demote it
from `int` to `bool`. Assign Boolean literals to it.
* src/roff/troff/env.h (class environment): Demote member
variable `dummy` from `int` to `bool`.
* src/roff/troff/env.cpp (environment::environment): Assign
Boolean literals to it.
* src/roff/troff/env.h (environment::is_dummy): Return a
`bool`, not an `int`.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::is_empty): Return a
`bool`, not an `int`.
* src/roff/troff/env.cpp (hyphen_trie::read_patterns_file):
Rename local variables.
- final_pattern -> is_final_pattern
- final_hyphenation -> is_final_hyphenation
- traditional -> is_traditional
Demote these and `have_patterns`, `have_hyphenation`, and
`have_keyword` from `int` to `bool`. Assign Boolean literals to
them.
* src/roff/troff/env.h (class environment): Demote member
variable `tab_precedes_field` from `int` to `bool`.
* src/roff/troff/env.cpp (environment::wrap_up_tab): Assign
Boolean literal to it.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::add_tab): Rename
parameter `repeated` to `is_repeated` and demote it from `int`
to `bool`.
* src/roff/troff/env.cpp (environment::hyphenate_line): Demote
local variable `inhibit` from `int` to `bool`.
2024-04-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (tab_stops::to_string)
(environment::wrap_up_tab, environment::handle_tab):
* src/roff/troff/input.cpp (process_input_stack, read_size)
(token::process, main)
* src/roff/troff/node.cpp (font_info::get_tfont)
(kern_pair_node::ends_sentence, node_list_ends_sentence)
(node::split, unbreakable_space_node::nbreaks):
* src/roff/troff/reg.cpp (number_value_to_ascii):
Replace `assert(0)` calls with communicative predicates.
* src/roff/troff/number.cpp (get_vunits, get_hunits, get_number)
(get_integer, is_valid_expression, is_valid_term): Align
language of assertion failures with others in use.
2024-04-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::print_env): Fix glitch in
report of line number multiple when line numbering enabled.
Problem introduced in commit b022f38dfa, 2 September 2006.
2024-04-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::dump_troff_state): Tweak
debugging function's output to report Boolean value more
idiomatically.
2024-04-24 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify some `environment` class member variables.
* src/roff/troff/env.h (class environment): Demote type of
member variables `have_temporary_indent` and `discarding` from
`int` to `bool`.
* src/roff/troff/env.cpp (environment::environment)
(environment::copy, indent, temporary_indent)
(environment::start_line, environment:possibly_break_line)
(environment::do_break): Use Boolean instead of integer literals
to initialize or update aforementioned member variables.
2024-04-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an-ext.tmac (mQ): Remove `mU` string once unneeded.
2024-04-24 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] ignore 'Cspace' as input
* src/devices/gropdf/gropdf.pl: As grops does.
2024-04-24 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] use nospace mode if font does not contain
/space glyph.
Gropdf always had two modes, depending on whether the font
defined /space or not (using space could make the pdf
slightly more compact). Some fonts which don't have /space
do have a glyph named /u0020 and the code used that as a
space, however I'm not convinced of the robustness of this
so, now, if a font has no /space then nospace mode is used.
* src/devices/gropdf/gropdf.pl: Always use nospace mode if
font has no /space glyph.
2024-04-24 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] Can't handle DecodeParams in Deflate filter.
If gropdf called with -d (debug) the pdf is produced with
objects uncompressed, if object does not use default deflate
parameters Zlib does not decompress properly, so the
decompressed object is invalid. This affects when using a
pdf imported with 'pdfpic' which contains a png image.
This only affects imported pdfs when using the -d flag,
because otherwise it is just passed through with no
decompress.
* src/devices/gropdf/gropdf.pl: Don't decompress if object has
a DecodeParams dictionary.
2024-04-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tmac.am ($(M4CHECK)): Ensure directory exists to house
the stamp file before attempting to create the latter.
2024-04-17 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] Handle both types in one document.
The different format of font described in previous commit fails
if document contains fonts of both formats. The reason is
because the regexes included the /o flag (compile once) for
speed, but if the format changed (from RD to -|) in a different
font, parsing failed.
Now the regexes are compiled once for each font.
* src/devices/gropdf/gropdf.pl: Use qr// to compile regexes once
per font.
2024-04-17 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] Improve font parsing.
The usual (for fontforge converted ttf fonts) is to use the RD,
ND and NP operators within charstring definitions, however these
are just named in the private subrs dictionary so could be
assigned any name.
A debian .pfb version of a google .ttf font (which has not
passed through fontforge) used -| |- and | as the 3 equivalent.
In addition it used a different lenIV value for the eexec
encryption (4) and the charstring encryption (0) (didn't know
you could do that).
* src/devices/gropdf/gropdf.pl: Make RD, ND and NP variables set
from parsing the private subrs. Honour lenIV=0 when encrypting
charstrings.
2024-04-16 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf] Problem with '(' and '\' (\[rs])
Both these tokens have meaning for roff AND pdf strings. In
pdfs unbalanced parentheses have to be escaped (with '\') and
a single '\' has to be similarly escaped, '\\'. It is gropdf's
responsibility to ensure pdf strings are valid, no matter what
the input.
If '\(ul' is passed then the UTF-16 character becomes '_'.
If '\[rs](ul' is passed (i.e. '\(ul' is intended to become the
UTF-16 string) \[rs] becomes '\' leaving '\(ul', which
becomes '_', not what is intended. If the unbalanced '(' is
escaped first, '\[rs]\(ul' which could become '\\_' when the '\'
is escaped, yielding '\_'. The code which escapes parenthesis
checks it is not already preceded by '\' since adding another
would give you '\\(' which is not what you want. The correct
output should be '\\\(ul' to achieve the correct pdf string.
This fixes the above issue (I hope).
* src/devices/gropdf/gropdf.pl: Change pattern matches
2024-04-15 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an-ext.tmac <mV, mQ>: Trivially refactor. Rename string
used to store URI hyperlink from `m1` to `mU`.
2024-04-15 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Fix computation of bookmark level. If this
register's value is specified on the command line, don't clobber
it. Adjust logic for assigning tag to the bookmark to the
{possibly adjusted} base level accordingly. Based on a patch by
Deri James.
2024-04-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Retire "el" warning category.
It's much too hard to perform this analysis without the risk of
throwing this warning spuriously. Paul Eggert reported a
real-world use of `ie`/`el` requests nested without the use of
brace escape sequences in his zic(8) man page that is
structurally equivalent to the following (with indentation added
for clarity).
.ie \nA .tm register A is truthy
.el .ie t .tm in typesetter mode
. el .tm in terminal mode
Without brace escape sequences, the `skip_branch()` function
that discards input corresponding to control flow branches not
taken does not reliably keep track of the nesting level. So why
not just make `skip_branch()` more sophisticated to handle this
case? Because it doesn't generalize. What if the input changes
the control character, or uses the no-break control character?
What if the input has renamed the `ie` request or invokes it
through a macro?
* src/roff/troff/input.cpp: Drop this warning category from the
`warning_table` global.
(else_request): Stop throwing it.
* src/roff/troff/troff.h: Comment out its value in the
`warning_type` enum.
* doc/groff.texi.in (if-else, Warnings):
* src/roff/troff/troff.1.man (Warnings): De-document "el" troff
warning category.
Fixes <https://savannah.gnu.org/bugs/?65474>. Thanks to Paul
Eggert for the report.
2024-04-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (skip_branch): Handle control flow
branches consisting only of a newline correctly when skipping
them--actually skip them, as AT&T troff does. A newline after
the `el` request, or after the conditional expression of an
`if`, `ie`, or `while` request, is not "nothing"; if the branch
is taken, it puts a newline on the output, and if it is not
taken, it should neither affect output nor be _syntactically_
ignored on the pretense that the next input line was actually
part of the branch.
Fixes <https://savannah.gnu.org/bugs/?45502>. Problem likely
goes back to groff's origin. (You could always avoid it with
brace escape sequences, which might explain why it seemed to
cause little consternation.) Thanks to Carsten Kunze for the
report and to Dave Kemper for the code review.
2024-04-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Regression-test Savannah #45502.
* src/roff/groff/tests/degenerate-control-flow-works.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
2024-04-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor. Rename
functions to use more idiomatic computer science terminology.
(begin_alternative): Rename this...
(take_branch): ...to this.
(skip_alternative): Rename this...
(skip_branch): ...to this.
(do_if_request, else_request): Update call sites.
2024-04-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Refactor. Replace bespoke class
`bool_stack` with STL `stack<bool>`. Migrate global
`if_else_stack` to use it.
(process_input_stack): Migrate `trap_bol_stack` to use it.
(process_input_stack, else_request): Migrate member function
calls.
- `is_empty()` -> `empty()`
- `pop()` -> `top()`, `pop()`
2024-04-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Slightly refactor. Reconstruct
class `int_stack` as `bool_stack` since all we require are
Boolean values.
2024-04-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Slightly refactor. Boolify. Demote
and rename global `while_break_flag` to `want_loop_break`.
(do_if_request): Demote return type from `int` to `bool`.
Demote and rename local `invert` to `want_test_sense_inverted`.
(while_request): Demote and rename local `escaped` to
`is_char_escaped`.
2024-04-12 Deri James <deri@chuzzlewit.myzen.co.uk>
Correct and improve linear search introduced in commit
cd9fde325f, 4th March.
* tmac/pdf.tmac: Add mark counter, `pdf:bm.nk`.
(pdfbookmark, pdf*href-M): ...and use it.
(pdf:lookup): Add string `pdf:lookup-value` to record the `.val`
attribute of a PDF bookmark, distinctly from its `.tag`.
(pdfnote, pdfbookmark, pdf*href-M, pdf*href): Use `\A` escape
sequence to validate *roff strings as (parts of) identifiers
{seen in Keith Marshall's "pdfmark.tmac"}.
(pdf*href-M, pdf*href, pdfbookmark): Stop using old `pdf:look`
method of bookmark tag lookup. Drop conditionals on presence of
mom(7) `PRINTSTYLE` macro to select its use.
(pdfbookmark): Drop logic for cleaning bookmark tag of material
invalid in *roff identifiers, since the foregoing ensure that
we no longer use such in their construction.
(pdfmarksuspend, pdfmarkrestart): Drop management of mark
suspension state; "pdf.tmac" now subsumes this function.
Fixes <https://savannah.gnu.org/bugs/?65585>.
2024-04-12 Deri James <deri@chuzzlewit.myzen.co.uk>
Support UTF-16-encoded PDF bookmarks.
* src/utils/afmtodit/afmtodit.pl: Generate comment field holding
the UTF-16 code for each groff character.
* font/devps/AB:
* font/devps/ABI:
* font/devps/AI:
* font/devps/AR:
* font/devps/BMB:
* font/devps/BMBI:
* font/devps/BMI:
* font/devps/BMR:
* font/devps/CB:
* font/devps/CBI:
* font/devps/CI:
* font/devps/CR:
* font/devps/HB:
* font/devps/HBI:
* font/devps/HI:
* font/devps/HNB:
* font/devps/HNBI:
* font/devps/HNI:
* font/devps/HNR:
* font/devps/HR:
* font/devps/NB:
* font/devps/NBI:
* font/devps/NI:
* font/devps/NR:
* font/devps/PB:
* font/devps/PBI:
* font/devps/PI:
* font/devps/PR:
* font/devps/S:
* font/devps/TB:
* font/devps/TBI:
* font/devps/TI:
* font/devps/TR:
* font/devps/ZCMI: Regenerate with updated aftmtodit.pl.
* man/groff_font.5.man: Document use of comment field to hold
UTF-16 code.
* src/devices/gropdf/gropdf.pl (LoadFont): Extract UTF-16 code
from font comment field (rather than a new field).
(ParsePDFValue): Validate input more strictly.
(do_x): Manage state more strictly; don't suspend a mark
{hotspot} when one is not active, and don't restart it when one
is not suspended.
2024-03-26 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/grog/grog.pl (do_line): Recognize new requests in
forthcoming groff 1.24 release. Update lists of characteristic
package macros: for mm, add list management macros (except for
`LI`, made ambiguous by groff_www(7)), unnumbered header macro,
and `EPIC`; for man(7), drop `MT` (it is also an mm macro) and
add `MR`, from groff 1.23.0 and plan9port. Also discard closing
brace escape sequence as not a legitimate macro name.
2024-03-24 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Simplify `Ql` macro behavior.
* tmac/mdoc/doc-ditroff (Ql): Rip out most of the logic
{counting and measuring arguments}, replacing it with a save and
restore of the font family to temporarily use the Courier
family. The new behavior is: when formatting for terminals,
`Ql`'s arguments are quoted; when formatting for typesetters,
its arguments are set in Courier. In practice, it does not seem
difficult to distinguish even single characters in Courier from
those in Times. (If it is, an _explicit_ quoting macro like
`Sq` or `Dq` should be used.)
* tmac/groff_mdoc.7.man (Enclosure and Quoting Macros) <Ql>:
* NEWS: Document this.
See, e.g., <https://savannah.gnu.org/bugs/?61276>.
2024-03-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-ditroff (Dl): Refactor. Instead of using the
"literal" (`Li` macro) font, save the family, switch to Courier,
emit the arguments, then restore the family.
2024-03-24 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Refactor.
* tmac/doc.tmac: Move `Dl` macro definition from here...
* tmac/mdoc/doc-ditroff:
* tmac/mdoc/doc-nroff: ...to these files to prepare for changes
to the "ditroff" version.
2024-03-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-ditroff: Align typesetting font defaults with
terminal font defaults. Change `Cm`, `Fl`, and `Li` to use bold
instead of roman.
2024-03-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac: Add new string "array",
`doc-display-fam-stack`, to maintain a stack of font family
changes.
(Bd): If the `-literal` argument is given, push the current font
family onto the stack and select family `C`.
(Ed): If we're ending a display of type "literal", pop the
saved font family from its stack.
(doc-save-global-vars, doc-restore-global-vars): Add this new
string.
2024-03-23 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Change default font used for many macros when formatting
for typesetters (cf. terminals).
* tmac/mdoc/doc-ditroff: Stop switching to Courier family when
setting arguments to the macros `Ar`, `Cm`, `Er`, `Fa`, `Fd`,
`Fl`, `Fn`, `Ft`, `Ic`, `Li`, and `Nm`.
Only you can prevent aneurysms; see discussion starting at
<https://lists.gnu.org/archive/html/groff/2024-03/msg00152.html>
and bear in mind that you can use the mdoc.local file to
customize the font used to render nearly any mdoc(7) macro.
This mechanism has been in place since 1992.
2024-03-23 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Add support for `MF` rendering option in parallel with
groff man(7), and working much like the `HF` string.
* tmac/doc.tmac (initialization): If the user specifies no `MF`
string definition, define it as `I`.
* tmac/mdoc/doc-ditroff:
* tmac/mdoc/doc-nroff: Default `doc-page-identifier-font` and
`doc-Xr-font` to use the value of the `MF` string.
* NEWS:
* tmac/groff_mdoc.7.man (Options): Document it.
Fixes <https://savannah.gnu.org/bugs/?65484>.
2024-03-22 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-common ([initialization], Dt, Os, doc-header,
doc-footer, doc-reset-titles, Rd):
* tmac/mdoc/doc-ditroff:
* tmac/mdoc/doc-nroff: Rename string `doc-page-topic` to
`doc-page-identifier` and `doc-page-topic-font` to
`doc-topic-identifier-font`, following terminological reform in
groff_mdoc(7) (and groff_man(7)).
2024-03-22 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/main.cpp (main): Fix missing space in
diagnostic message.
2024-03-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/{ja,ru,zh}.tmac: Add heuristic checks for glyph coverage
of characteristic code points for these languages' scripts.
Throw the warning only once for each language. The formatter
will merrily spew "special character ... not defined" error
diagnostics for each non-covered glyph encountered; this leads
people to complain that "groff doesn't support Unicode". (This
additional warning diagnostic might not help much; the error
diagnostics already refer to characters in these scripts _by
their Unicode code points_, which should be a clue, but too
often isn't.) And this one will slip through even if someone
runs groff (or troff) with the `-E` option. If you want to
typeset Unicode, you have to use a font that covers Unicode.
groff can't force one onto your system. (We could do more to
help the user configure one for use with groff, though; see
Savannah #60930.)
* src/roff/groff/tests/initialization_is_quiet.sh: Update test;
check the "utf8" output device, not the "ps" default (which
might not have been the configured default anyway), and which
will lack glyph coverage for Chinese and Japanese (as the base
14 fonts of Adobe PostScript lacked it).
2024-03-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an-reset-paragraph-spacing, RS, RE): Trivially
refactor. Rename structurally named sets of registers emulating
arrays (more precisely in this instance, stacks) to separate the
index from the rest of the name with a `!` character, as is done
in groff ms(7) and some other packages. This makes the names
more readable and less resembling of typos in the unfortunate
event a troff(1) diagnostic message discloses their names to a
hapless human reader.
2024-03-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an-reset-paragraph-spacing): Assign
`an-saved-margin1` the value of the `BP`, not the `IN` register.
It makes no practical difference (because this is the
"outermost" inset level), but the status quo ante made the
inset register pushing and popping logic harder to reason about.
Continues commit 5d2e49f818, 9 August.
2024-03-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (Ar): Don't reset the selected font to its
previous value when formatting `doc-str-Ar-default`; the latter
string already takes care of this.
* tmac/groff_mdoc.7.man (Arguments) <Ar>: Add a case of an
interstitial ellipsis in an argument list, to demonstrate that
the typeface gets reset correctly after the ellipsis.
Fixes a post-1.23.0 regression. Thanks to Lennart Jablonka for
the report. Problem introduced by me in commit df1fc139af, 3
September.
2024-03-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-common: Trivially refactor. Rename
`doc-need-titles-reset` register to `doc-end-previous-document`,
reflecting its newly narrowed purpose.
2024-03-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-common (doc-reset-titles): New macro pulls
several string assignment operations to here...
(doc-end-macro): ...from here, because they're needed more
generally.
(Dd): Call the new macro unconditionally.
Fixes <https://savannah.gnu.org/bugs/?65480>. Problem
introduced by me in the 1.23.0 development cycle; I didn't
bother to bisect it down to an individual commit because I know
I churned parts of the macro package pretty vigorously to get
batch rendering of mixed man(7) and mdoc(7) documents working
correctly. (And as we can see, I didn't _quite_ succeed.)
2024-03-18 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Regression-test Savannah #65480.
* tmac/tests/doc_reset-data-between-documents.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
2024-03-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (Xr): Fix copy-and-paste error that made all man
page hyperlinks "internal". Continues commit 4c59005ba0, 16
March.
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an*scan-string-for-backslash): Choose an escape
character that is much less likely than the at sign to be
specified in a man(7) document's page footer.
Fixes <https://savannah.gnu.org/bugs/?65469>. Thanks to Thomas
Dickey for the report.
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/an_inner-footer-abbreviation-works.sh: Add
regression test case for Savannah #65469.
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Improve diagnostic message format (5/4).
* tmac/doc.tmac (Bd, Ta, An):
* tmac/mdoc/doc-syms (doc-St-usage): Use new `doc-report-usage`
macro instead of hand-crafting diagnostic message with `tm`
request.
* tmac/doc.tmac (Bl): Drop unneccessary argumentless `tm` request.
(doc-Bl-usage): Use three single-line `doc-report-usage`
requests instead of writing a six-line diagnostic. Both are
regrettable--`Bl` is just crazily complex.
(doc-defunct-macro): Use new `doc` string to construct bespoke
diagnostic complaining of defunct macro usage.
* tmac/doc.tmac (Bk):
* tmac/mdoc/doc-common (LP, PP, pp, SH):
* tmac/mdoc/doc-syms (At, Dx, Fx, Nx, St, Lb): Use new
`doc-warn` macro instead of hand-crafting diagnostic message
with `tm` request.
Continues fixing <https://savannah.gnu.org/bugs/?52463>, which I
should have known would not stay dead for long. (And which I
won't be surprised to see scrabble forth from the grave again.)
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (Xr): When formatting PDF, automatically attempt
lookups of `Xr` destinations as internal bookmark tags. If
lookup succeeds, link to the within-document destination rather
than an "external" URL like "man:foobar(1)".
For example, this enables "outbound" links from the
groff_mdoc(7) page to the other ~60 documents collected in
"groff-man-pages.pdf".
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-common (Os): When formatting PDF, automatically
give each `Os` call a named PDF bookmark tag that can be used in
links (inside the guts of the `Xr` macro).
For example, this enables "inbound" links to the groff_mdoc(7)
page in "groff-man-pages.pdf".
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[pdf,man,mdoc]: Refactor a recent feature.
The "pdfhref pipe" feature recently added used in-band signaling
to indicate that a PDF mark hotspot should be left open by the
`pdhref` hyperlink management macro. I'm uneasy with this
because it forecloses the possibility of using the chosen
in-band signal content as link text. (Compounding the risk of
user frustration is that there's no documentation of any of
this.) Replace it by adding a new `-S` flag to the `pdfhref`
macro, indicating the caller's desire to manage closing of the
hotspot themselves, as "tmac/an.tmac" does already.
See <https://savannah.gnu.org/bugs/?61434#comment5>.
* tmac/pdf.tmac (pdfhref): Initialize `pdf:href-S` register to
zero (false).
(pdf:href.opt-S): Define new alias for `pdf:href.flag`, so the
{complex, Unix command-emulating} `pdfhref` argument management
system treats it as a Boolean parameter.
(pdf*href): Rename `pdf:href.pipe` register to
`pdf:href.leave-mark-open`. Throw error and don't honor "-S"
parameter if the user has also specified a link text appendment
with the "-A" option. (If we're not closing the hotspot, we
don't know where the appendment will go.) Stop treating link
text (the `PDFHREF.DESC` string) specially if it is "|".
* tmac/an.tmac (an*end-hyperlink, MR):
* tmac/doc.tmac (doc-begin-hyperlink-pdf): Migrate to new API.
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdf*href): Fix derpy syntax error, introduced
by me in commit cd9fde325f, 4 March. Exposed by a pending
change.
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: When formatting PDF, attempt lookups of `MR` destinations
as internal bookmark tags. If lookup succeeds, link to the
within-document destination rather than an "external" URL like
"man:foobar(1)".
* doc/GMPfront.t.in: Drop `END` dummy macro and redefinition of
`MR` macro, moving the logic from here...
* tmac/an.tmac (MR): ...to here, and trivially refactoring to
rename variables for intelligibility. Also simplify, using the
"dangling open mark" incantation of the `pdfhref` macro that
Deri innovated, since the existing logic unconditionally writes
the link text subsequently.
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: When formatting PDF, automatically give each `TH` call a
named PDF bookmark tag that can be used in links (inside the
guts of the `MR` macro).
* doc/GMPfront.t.in (reload-man [appendment]): Move logic for
declaring a named ("tagged") bookmark from here...
* tmac/an.tmac (an*bookmark*pdf): ...to here.
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdf*href): Fix problem with hotspot placement
when there is no link text (illustrated by the "See also"
section of pic(1) when rendered to PDF). It is apparently
necessary to flush the output buffer immediately after
constructing certain device control nodes ("pdf: markstart" and
"pdf: markend" in this case). Deri understands this stuff
better than I do; the misapprehensions I exhibited in Savannah
#65052 might be related. If that's the case, then the issue is
maintaining synchrony between the formatter's idea of the
drawing position and the output driver's.
2024-03-15 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Fix Savannah #64267.
* tmac/an.tmac (an-reset-paragraph-spacing): Restore spacing
{that is, cancel no-space mode} to handle a "belated" `PD` call
immediately after a paragraphing macro (`P`, `HP`, or `IP` with
no marker argument).
Fixes <https://savannah.gnu.org/bugs/?64267>. Thanks to Alex
Colomar for the report.
2024-03-15 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Regression-test Savannah #64267.
* tmac/tests/an_PD-restores-spacing.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
2024-03-15 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Fix Savannah #65464.
* tmac/an.tmac (an*end-hyperlink): Unformat the diversion before
emitting it. This way adjustment of spaces will take place in
the context where it's actually formatted, and be more
appropriate to the line.
* tmac/tests/an_adjust-link-text-correctly.sh: Update test
expectations. The only change here was to adjustment parity.
Fixes <https://savannah.gnu.org/bugs/?65464>.
2024-03-15 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Fix Savannah #65462.
* tmac/an.tmac (TP): Save the existing adjustment mode before
disabling adjustment in the diversion used to format the
paragraph tag.
(an*TP-trap): Restore the saved adjustment mode after closing
the diversion, instead of using the configured default
adjustment mode.
Fixes <https://savannah.gnu.org/bugs/?65462>. Thanks to Russ
Allbery for the report.
2024-03-15 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Regression-test Savannah #65462.
* tmac/tests/\
an_adjustment-mode-preserved-after-paragraph-tag.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
2024-03-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/indxbib/indxbib.cpp: Validate `-h` option arguments
more carefully.
(main): Insist on an argument value of at least 2, since a hash
table of size 1 is pointless.
(check_integer_arg): Try to be more robust in the face of
C/C++'s notoriously lax integer sizing practices. We might
consider gnulib's "xstrtol" module. Promote `-h` argument
validation errors to `fatal()`. Only perform a comparison
against INT_MAX if LONG_MAX is larger than INT_MAX in the first
place. Report the supported range in range diagnostics. Use
C++- instead of C-style type cast of result.
Mitigates, but arguably does not fix,
https://savannah.gnu.org/bugs/?65452>. Thanks to Alex Colomar
for the report.
2024-03-12 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Improve diagnostic message format (4/4).
* tmac/doc.tmac (doc-report-usage): Add internal macro for
reporting usage error diagnostics. Arrange message per GNU
Coding Standards, including report of input filename.
* tmac/doc.tmac (doc-generic-macro, Cd, Fd, In, Nm, Tn, Ns, Ap)
(Bf, Ek, El, doc-Xr-usage, doc-column-list, Dl, D1, Vt, Ft, Fa)
(Fn, Fo, Rs, Re, %A, %B, %C, %D, %I, %J, %N, %O, %P, %Q, %R, %T)
(%U, %V, An, Rv, Ex, doc-Mt-usage, doc-Lk-usage):
* tmac/mdoc/doc-common (Sh, Ss):
* tmac/mdoc/doc-ditroff (Ql):
* tmac/mdoc/doc-nroff (Ql):
* tmac/mdoc/doc-syms (Lb): Use it.
Fixes <https://savannah.gnu.org/bugs/?52463> (at long last).
2024-03-12 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Improve diagnostic message format (3/4).
* tmac/doc.tmac (doc-warn): Add internal macro for reporting
warning diagnostics. Arrange message per GNU Coding Standards,
including report of input filename.
* tmac/doc.tmac (doc-generic-macro, Pf, Bf, Ef, Bk, Ek, Bd)
(doc-do-Bd-args, Ed, Bl, doc-do-Bl-args, It, doc-end-list, Re)
(doc-print-reference, em):
* tmac/mdoc/doc-common (Dd, Dt, Os, doc-check-depth): Use it.
2024-03-12 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Improve diagnostic message format (2/4).
* tmac/doc.tmac (doc-err): Add internal macro for reporting
error diagnostics. Arrange message per GNU Coding Standards,
including report of input filename.
(It, doc-fo-func-args, Fo, Fc, %V, Lk, doc-defunct-macro): Use
it.
2024-03-12 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Improve diagnostic message format (1/4).
* tmac/doc.tmac: Add new `doc` string recording the name the
macro package self-reports. Use it when issuing diagnostics
about rendering parameters (register and string settings) that
can't be honored.
2024-03-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor.
(encode_char_for_troff_output): Rename this...
(encode_char_for_device_output): ...to this.
(do_device_control): Update call site.
2024-03-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Refactor. Pull delimiter character
validator into its own function operating on a character, rather
than on an object of the token class.
(is_char_usable_as_delimiter): New function compares `char`
parameter to list of valid delimiters.
(token::is_usable_as_delimiter): Refactor to call the foregoing.
2024-03-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (is_usable_as_delimiter): Fix code
style nit, using C++-style type cast instead of C-style cast.
2024-03-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor.
(do_special): Rename this...
(do_device_control): ...to this.
2024-03-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pspic.tmac (PSPIC): Prepare for alteration of `\X` device
control escape sequence to read its argument in copy mode; use
nested backslashes instead of `\E`, which cannot meaningfully
persist into the device-independent output. (The *roff escape
character is not only undefined but meaningless in that file
format.)
2024-03-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (ascii_output_file::outc)
(ascii_output_file::outs, put_string, troff_output_file::put)
(ascii_output_file::really_transparent_char)
(ascii_output_file::really_print_line): Guard uses of standard C
library `putc()` and `fputc()` functions with a null pointer
check. They could fail if the output stream has been
invalidated. Problem present from groff's birth and apparently
exposed by man-db man's use of AppArmor. See
<https://bugs.launchpad.net/ubuntu/+source/lintian/+bug/2055402>
and follow-up discussion there.
Fixes <https://savannah.gnu.org/bugs/?65427>. Thanks to an
anonymous submitter for the report.
2024-03-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdf*href): Fix (harmless?) `ie`/`if` thinko.
2024-03-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[pdf]: Implement linear bookmark tag search.
* tmac/pdf.tmac (pdf:lookup): Given an argument, search defined
bookmark tags for a match and return one (if found) in the
string `pdf:lookup-result`, which is defined but empty if there
is no match. Previously (and, for mom(7), still--see below),
lookups were O(1) because strings named `pdf:look($TAG_NAME)`
were defined. The speed was great but unfortunately, in
practical use, tags often got *roff escape sequences stuck into
them, which drew diagnostic messages from the formatter and
could defeat the matches.
(pdfbookmark, pdf*href-M): Use the new mechanism to record a
bookmark tag if `PRINTSTYLE` (a mom(7) macro) is _not_ defined,
so as to not regress documents using that package. Store the
tag text in the string `pdf:bm\\n[pdf:bm.nr].tag`; every PDF
bookmark in a groff document gets a serial number already.
(pdf*href): Use the new mechanism to call `pdf:lookup` and
locate a match for the desired tag.
* doc/GMPfront.t.in (an*cln): Delete this macro. It iterated
through a string, scrubbing it of `\%` escape sequences. Much
more exotic things could be placed in bookmark tags; we were
fortunate that man page cross references tend to stick to ASCII,
plus `\%` to suppress hyphenation. But that's suitable only for
man page references; if we want taggable (sub)section headings,
like groff_mmse(7)'s "Se också", we need strings, not just valid
groff identifiers.
(an*bookmark): Populate `an*page-ref-nm` without cleaning it
first.
2024-03-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/GMPfront.t.in: Resync `MR` replacement with its
counterpart in "an.tmac".
2024-03-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdf*href): Fix excess escaping.
2024-03-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdfclean): Fix missing closing brace escape
sequence. Appears to have done no damage; possibly the end of
the macro definition reset the formatter's state. Or maybe we
simply got lucky with diversions with the documents in our tree.
2024-03-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Improve encoding of *roff string contents when
interpolated into device control escape sequences.
* src/roff/troff/input.cpp (encode_char_for_troff_output):
Discard several escape sequences from `\X` contents when
interpolated: `\%`, `\:`, `\&`, `\)`. Interpolate the escape
character into device-independent output as `\` no matter what
the *roff escape character is defined to be.
* src/roff/groff/tests/\
device-control-special-character-handling.sh: Update test
expectations. Comment out some tests that depended on a
reverted commit of a half-baked idea. (See Savannah #64484.)
2024-03-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Add experimental feature to support increasing
the base level of PDF bookmarks. Define register
`an*bookmark-base-level`, initialized to zero.
(PT): Add 1 to it when producing document bookmark.
(SH): Add 2 to it when producing section heading bookmark.
(SS): Add 3 to it when producing subsection heading bookmark.
2024-03-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Accept `MR` calls with only one argument.
* tmac/an.tmac (MR): If only one argument is present, do not
hyperlink it, but do set it with (potential) italic corrections.
Prompted by a similar change Deri James applied in
doc/GMPfront.t.in, and for consistency with the way we've long
handled the analogous `Xr` macro in mdoc(7).
* tmac/groff_man.7.man.in (Hyperlink macros) <MR>: Update macro
synopsis and description.
2024-03-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac: Add internal flag register
`pdf*is-mark-suspended`.
(pdfmarksuspend, pdfmarkrestart): Use it to avoid sending
PDFMark restart commands when they haven't been suspended.
2024-03-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (PT): Be consistently paranoid. The idea of a
"page ref string" (like "ls(1)") with leading space in it
strikes me as dubious, but for the time being we accept it; do
so consistently.
2024-03-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (SH): Fix code style nit.
2024-03-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (Xr): Support the crazy old menagerie of Mac OS
X/macOS man page URL formats as groff man(7) does.
2024-03-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (MR): Fix "format 4" URLs to include the section
number again in parentheses after the identifier.
2024-03-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (Xr): Fix dead store to string.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* NEWS:
* doc/groff.texi.in:
* man/groff.7.man:
* man/groff_diff.7.man: Document new `hydefault` feature.
Fixes <https://savannah.gnu.org/bugs/?63635>.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Migrate localization packages to `hydefault` request.
* tmac/cs.tmac:
* tmac/de.tmac:
* tmac/en.tmac:
* tmac/es.tmac:
* tmac/fr.tmac:
* tmac/it.tmac:
* tmac/ru.tmac:
* tmac/sv.tmac: Set the hyphenation mode default appropriately
per the hyphenation patterns and the value of the trap-awareness
bit.
* tmac/ja.tmac:
* tmac/zh.tmac: Set the hyphenation mode default to zero.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (hyphenate_request): If given no
argument, set hyphenation mode to the configured default.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add new `hydefault` request.
* src/roff/troff/env.cpp (set_hyphenation_mode_default): New
function sets the environment's default hyphenation mode.
(init_env_requests): Wire up `hydefault` to foregoing function.
* src/roff/troff/env.h (class environment): Declare foregoing
function as a friend, permitting mutator access.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (init_env_requests): Set up `hla`
request and `.hla` register here, since they're
environment-specific...
(init_hyphenation_pattern_requests): ...instead of here.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (init_hyphen_requests): Rename this...
(init_hyphenation_pattern_requests): ...to this.
* src/roff/troff/input.cpp (main): Update call site.
* src/roff/troff/request.h: Update declaration.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add `.hydefault` read-only register storing the
environment's default hyphenation mode.
* src/roff/troff/env.h (class environment): Add private member
variable `hyphenation_mode_default` and declare public member
function (accessor) `get_hyphenation_mode_default`.
* src/roff/troff/env.cpp (environment::get_hyphenation_mode):
Implement.
(environment::environment): Initialize new member variable in
ordinary and copy constructors.
(environment::copy): Copy new member variable.
(environment::print_env): Report environment's hyphenation mode
default.
(init_env_requests): Wire up hyphenation mode default value to
`.hydefault` troff register.
(class hyphenation_default_mode_reg): Add class.
(hyphenation_default_mode_reg::get_string): Implement.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp:
* src/roff/troff/env.h:
(environment::get_adjust_mode):
(environment::get_hyphenation_mode): Migrate report of these
quantities to use "unsigned int" type instead of a signed type;
this is more consistent with their internal storage, more
appropriate given their use as bit vectors, and more
future-proof in the event their meaningful values ever carry
them close to the sign bit (let's hope not).
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp: Add support for read-only numeric
registers backed by unsigned integer values. Define new type
alias `UNSIGNED_FUNCP`. Define new C++ prepreprocessor macro
`init_unsigned_env_reg`, paralleling `init_int_env_reg`.
(class unsigned_env_reg): Add new class; just like `int_env_reg`
except it's for use with "unsigned int" member variables.
(unsigned_env_reg::unsigned_env_reg)
(unsigned_env_reg::get_value)
(unsigned_env_reg::get_string): Implement.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::print_env): Report
environment's numeric hyphenation mode, not just its meaning.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor (hyphenation flags->mode).
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (class environment):
- Rename `hyphenation_flags` to `hyphenation_mode`.
- Rename `get_hyphenation_flags` to `get_hyphenation_mode`.
* src/roff/troff/env.cpp (environment::get_hyphenation_flags):
Rename this...
(environment::get_hyphenation_mode): ...to this.
(environment::get_hyphenation_mode):
(environment::environment):
(environment::copy):
(no_hyphenate):
(environment::hyphenate_line):
(environment::print_env):
(init_env_requests): Update member function and variable
references.
2024-03-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: `mso` request no longer rewrites its argument to search
for a file other than that named in the argument.
* src/roff/troff/input.cpp (do_macro_source): Drop logic that
attempts to open a macro file named "tmac.s" if "s.tmac" was
specified in the argument and not found, or vice versa.
* NEWS:
* doc/groff.texi.in (I/O):
* man/groff_diff.7.man (New requests): Document it.
See
<https://lists.gnu.org/archive/html/groff/2024-02/msg00086.html>
and follow-ups.
2024-02-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Implement hyperlink support.
* tmac/doc.tmac: Recognize `U` register as man(7) does to enable
hyperlinking, defaulting on.
(doc-begin-hyperlink-ascii):
(doc-begin-hyperlink-cp1047):
(doc-begin-hyperlink-latin1):
(doc-begin-hyperlink-utf8):
(doc-begin-hyperlink-html):
(doc-begin-hyperlink-pdf):
(doc-end-hyperlink-ascii):
(doc-end-hyperlink-cp1047):
(doc-end-hyperlink-latin1):
(doc-end-hyperlink-utf8):
(doc-end-hyperlink-html):
(doc-end-hyperlink-pdf): New macros produce appropriate device
control commands to start and stop hyperlinking of formatted
text.
(doc-begin-hyperlink-nop, doc-end-hyperlink-nop): New do-nothing
macros handle user-driven hyperlink disablement for devices
lacking hyperlink support. Create aliases for the "X100",
"X100-12", "X75", "X75-12", "dvi", "lbp", "lj4", and "ps"
devices corresponding to these.
(doc-Xr-usage, doc-Mt-usage, doc-Lk-usage): New macros eliminate
repeated logic to emit usage messages.
(Xr): Heavily rewrite to support production of hyperlinked
argument text. In mdoc, there appears to be no mechanism to
inject macro calls later in the argument stream. To correctly
place a `doc*end-hyperlink` call, we must parse (optional)
arguments ourselves until we have seen enough to know we've
reached the end of the link text (an inline macro call,
punctuation, or the end of the input line). Throw usage
diagnostic in more cases of bad input.
(Mt): Include "mailto:" schema in generated hyperlink but not in
visible link text.
(Mt, Lk): Call device-appropriate `doc-{begin,end}-hyperlink`
macros.
(Lk): Hyperlink argument only if it is a "string" (mdoc parlance
for formattable text as opposed to a macro name or punctuation).
Format link text as groff man(7) does, not like mandoc(1) does,
with its "link-text: <url>" presentation.
* tmac/mdoc.local: Add commented code illustrating how to
disable hyperlinking.
* tmac/tests/doc_Lk-respects-sentence-ending-punctuation.sh:
* tmac/tests/doc_Lk-works.sh:
* tmac/tests/doc_Mt-works.sh:
* tmac/tests/doc_Xr-works.sh:
* tmac/tests/doc_heading-font-remapping-works.sh: Update test
expectations and check output when hyperlink output enabled and
disabled.
* NEWS:
* tmac/groff_mdoc.7.man (Options): Document it.
2024-02-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/doc_Xr-works.sh: Add checks of inline `Pf` and `Ns`
call behavior after `Xr`.
2024-02-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/doc_heading-font-remapping-works.sh: Dump output of
test case in plain text in addition to device-independent *roff
format.
2024-02-22 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Rename a test.
* tmac/tests/doc_Lk-respect-sentence-ending-punctuation.sh:
Rename this...
* tmac/tests/doc_Lk-respects-sentence-ending-punctuation.sh:
...to this.
* tmac/tmac.am (tmac_TESTS): Update.
2024-02-22 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/doc_Xr-works.sh: Unit-test `Xr` macro.
* tmac/tmac.am (tmac_TESTS): Run test.
2024-02-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an*end-hyperlink): Fix bug: when no link text
was supplied, the fallback link text (the hyperlink itself) was
not appearing in PDF output. This bug was masked by another:
the "no link text supplied" branch was never being taken because
the wrong diversion dimension register was being tested. Test
register `dl` instead of `dn` and annotate the reasoning. Emit
the trailing text in two places in the logic, since the
`pdfhref` macro takes over this function with its `-A` parameter
{which we now use}, but wasn't designed to accommodate the use
case where we start the mark with one call and close it with
another, which we use for the "no link text supplied" case.
2024-02-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/an_UR-works.sh: Add tests of PDF output, using
pdftotext(1) (from poppler-utils) to scrape the text from PDF.
2024-02-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdfbookmark): Validate bookmark level argument;
complain if it is not a numeric expression and treat it as "1".
2024-02-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an*end-hyperlink): Trivially refactor. Store
the first argument in a string named `an*trailing-text` (and use
it) to clarify later logic. Delete the string when done.
2024-02-21 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Trivially refactor.
* tmac/an.tmac: Revise mechanism for detecting new page headings
that should get a top-level bookmark.
(an-end, (initialization)): Make new string
`an*previous-page-ref-string` empty.
(TH, PT): Drop `an*was-TH-bookmark-emitted` register.
(PT): Compare `an*page-ref-string` to
`an*previous-page-ref-string`; emit a bookmark if they differ.
2024-02-21 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Trivially refactor (DRY).
* tmac/mdoc/doc-ditroff:
* tmac/mdoc/doc-nroff: Move string definitions that are
identical from here...
* tmac/mdoc/doc-common: ...to here.
2024-02-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-nroff (ua): Define string as `ha` special
character, not "^". This is (probably) a matter only of
pedantic correctness, as this definition takes place only in the
"else" block of a conditional testing for the "utf8" output
device, and no other supported nroff-mode device renders "^"
surprisingly to ASCII nostalgics.
2024-02-20 Lennart Jablonka <humm@ljabl.com>
* src/preproc/eqn/main.cpp: This file includes header
<stdlib.h>. As part of the C++ standard library, <stdlib.h>
provides a bunch of stuff, including `atexit()`, in the global
name space; it need not provide that stuff in the `std` name
space.
See <https://eel.is/c++draft/support.c.headers.other>.
2024-02-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grops/psrm.cpp
(resource_manager::read_download_file): Stop interpreting spaces
as token delimiters, so that PostScript font files with spaces
in their names can be handled (read and embedded in the
generated PostScript).
* src/devices/grops/grops.1.man (Usage): Update documentation.
* NEWS: Add item reporting this user-visible change.
Fixes <https://savannah.gnu.org/bugs/?65246>. Thanks to Deri
James for the report.
2024-02-17 G. Branden Robinson <g.branden.robinson@gmail.com>
[output drivers]: Reset line number at end of input.
* src/devices/grodvi/dvi.cpp (dvi_printer::~dvi_printer):
* src/devices/grohtml/post-html.cpp
(html_printer::~html_printer):
* src/devices/grolbp/lbp.cpp (lbp_printer::~lbp_printer):
* src/devices/grolj4/lj4.cpp (lj4_printer::~lj4_printer):
* src/devices/grops/ps.cpp (ps_printer::~ps_printer):
* src/devices/grotty/tty.cpp (tty_printer::~tty_printer): Clear
line number when tearing down output writer so that diagnostic
messages aren't emitted with a misleading (and nonexistent) line
number (the number of lines in the device-independent output
file plus one). The PostScript driver in particular does large
amounts of processing at this point (like resolving PostScript
resources). The problem is more theoretical for other output
drivers, but done for consistency.
2024-02-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/string.cpp (string::string): When
constructing a new string from a pointer to char, if the
pointed-to-string doesn't exactly fit the storage reserved for
it, populate the storage with null bytes before copying, to
avoid reads of garbage heap memory.
2024-02-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grops/psrm.cpp (resource::resource): Spell "file
name" thus in diagnostic message. It's English, not C.
2024-02-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grops/psrm.cpp (resource_manager::output_prolog):
Report underlying system error when `putenv()` fails.
* src/devices/grops/psrm.cpp (resource_manager::output_prolog):
(resource_manager::supply_resource)
(resource_manager::read_download_file): Parallelize wording of
diagnostic messages.
2024-02-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grops/ps.cpp: Promote type definition to global
scope and deanonymize it as `proc_table_t` so we can use it with
`array_length` template.
* src/devices/grops/psrm.cpp: Promote `comment_info` type
definition to global scope so we can use it with `array_length`
template.
* src/devices/grops/ps.cpp (ps_printer::special):
* src/devices/grops/psrm.cpp: Slightly refactor; migrate from
`sizeof` and division operators to groff's `array_length`
template function.
(resource_manager::read_resource_arg, parse_extensions)
(resource_manager::process_file)
(resource_manager::print_extensions_comment): Switch types of
loop indices iterating over these objects from `int`s of various
signedness to `size_t`.
(resource_manager::process_file)
(resource_manager::read_download_file): Use `sizeof` operator
idiomatically; it is an operator, not a function, and should be
followed by parentheses only when making it operate on a type
cast to get the size of a non-lvalue.
2024-02-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdf.tmac (pdfbookmark): Drop unused register storing
computed length of `pdf:clean` string, `pdf:clean:len`.
2024-02-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_define_string, length_request):
Drop redundant diagnostic message on invalid string identifiers.
2024-02-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[pdf]: Regression-test Savannah #65320.
* tmac/tests/pdf_bookmark-starting-with-control-char-works.sh:
Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
(tmac_XFAIL_TESTS): Mark as an expected failure since resolution
of this bug is blocked by resolution of Savannah #65322.
2024-02-11 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Implement `.it`, `.itc`, and `.itm` registers. These
read-only (and, in the case of `.itm`, string-valued as well)
registers report the number of lines remaining in a pending
input trap, a Boolean indication of whether that pending input
trap honors output line continuation (cf. the `it` and `itc`
requests), and the name of the macro associated with the pending
input trap, respectively.
* src/roff/troff/env.h (class environment): Declare new member
functions to retrieve these data.
* src/roff/troff/env.cpp
(environment::get_input_trap_line_count)
(environment::get_input_trap_respects_continuation)
(environment::get_input_trap_macro): Implement them.
(environment::environment): Update constructors to initialize
`input_trap_count` to "-1", as a hint that no input trap has
ever been sprung in the environment. (After one has, the count
remains at zero and the name of the macro associated with the
last trap that was sprung remains in `.itm`, until a new input
trap is planted or explicitly cleared.)
(environment::copy): Set the input trap line count to "-1".
(do_input_trap): Update `it`/`itc` request handler. Reset the
input trap line count to "-1" and null out the associated macro
name. If the `it` or `itc` requests are given no arguments,
this is the situation that persists. Recast diagnostic message
when attempting to set a nonpositive input line count.
(init_env_requests): Hook up the new register names to accessor
functions.
* doc/groff.texi.in (Input Line Traps):
* man/groff.7.man (Read-only registers):
* man/groff_diff.7.man (New registers): Document them.
* NEWS: Add item.
2024-02-11 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: The `color`, `cp`, `linetabs`, and `vpt` requests now
interpret arguments with negative values as instructions to
disable the corresponding feature, using the *roff
integer-to-Boolean conversion idiom instead of the C/C++ one.
Thus, if you invoke these requests with a register
interpolation, the outcome agrees with an `if` test of the
register's value.
* src/roff/troff/div.cpp (vertical_position_traps):
* src/roff/troff/env.cpp (widow_control_request) [WIDOW_CONTROL]
(line_tabs_request):
* src/roff/troff/input.cpp (activate_color, compatible): Do it.
* doc/groff.texi.in (Tabs and Fields, Colors)
(Vertical Position Traps, Compatibility Mode):
* man/groff.7.man (Syntax reference conventions)
(Request short reference):
* man/groff_diff.7.man (New requests): Document it.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?64233>.
2024-02-08 G. Branden Robinson <g.branden.robinson@gmail.com>
Update default search path for URW fonts; Fedora 39 has come up
with a new place for them.
* font/devpdf/Foundry.in: Do it (at run time).
* m4/groff.m4 (GROFF_URW_FONTS_CHECK): Do it (at build time).
Thanks to T. Kurt Bond for the report to the groff mailing list.
<https://lists.gnu.org/archive/html/groff/2024-02/msg00018.html>
2024-02-04 G. Branden Robinson <g.branden.robinson@gmail.com>
Put version number on cover page of our Texinfo manual.
* doc/groff.texi: Rename this...
* doc/groff.texi.in: ...to this.
* doc/doc.am (EXTRA_DIST): Add "doc/groff.texi.in".
(MAINTAINERCLEANFILES): Add "doc/groff.texi".
(doc/groff.texi): Add rule for constructing "groff.texi" from
"groff.texi.in", using `DOC_SED` macro of course.
(doc/groff.info): Update dependency and construction to use the
now-generated "groff.texi" (so look for it in the build
directory).
(maintainer-clean-local): Delete "doc/groff.texi".
* doc/groff.texi.in: Replace "1.23.0+Git" with "@VERSION@".
2024-02-04 G. Branden Robinson <g.branden.robinson@gmail.com>
Put version number on cover page of collected man pages.
* doc/GMPfront.t: Rename this...
* doc/GMPfront.t.in: ...to this.
* doc/GMPfront.t.in: Add `@VERSION@` token. Set it in 10-point
italics. Reduce subsequent vertical spacing. This looks better
to my eye with the added material, but Deri's eye is better.
* doc/doc.am (DOCFILES_NOINST): Update to reflect rename.
(DOC_GMP_COVER_PAGE): Add new macro to house the generated
file's name, "doc/GMPfront.t".
($(DOC_GMP_COVER_PAGE)): New target creates this file from its
*.in. Use existing `DOC_SEC` make(1) macro to perform version
substitution.
(doc/groff-man-pages.pdf): Migrate dependency and construction
to now-generated `$(DOC_GMP_COVER_PAGE)` file.
(MOSTLYCLEANFILES): Add `$(DOC_GMP_COVER_PAGE)`.
2024-02-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (doc/groff-man-pages.pdf): Add dependency on
"pdfmom".
2024-02-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp
(non_interpreted_char_node::non_interpreted_char_node): Rename
parameter from `n` to `cc`; it is of `unsigned char` type, and
GNU troff's code uses `n` as a pointer to `node` type
ubiquitously. It also uses `c` for an `unsigned char` type
pretty reliably, but that is already a private member variable
for this class.
2024-02-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (TH): Set up end macro unconditionally here...
(an-set-up-continuous-rendering): ...instead of here.
* tmac/tests/an_TP-works.sh: Add test case for the specimen of
ill-formed input that the foregoing remedies (ending input with
a pending input line trap and continuous rendering disabled).
2024-02-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (print_hyphenation_exceptions): Flush
the standard error stream once the list is written.
2024-02-02 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Back away from color management concerns.
Hyperlink colors in PDF were showing a tendency to get "stuck
on" when they shouldn't, and the extra difficulty of managing
nested traps (`TP` followed by `UR`, for example) is proving
tricky to sort out. On top of that, the man(7) package
historically has no cognizance of color issues and it doesn't
seem like a good time to start, particularly if we only do it
for the 'pdf' output device.
* tmac/an.tmac (an-input-trap): Set stroke color to default
after springing `TP`'s supporting trap.
(an*begin-hyperlink, MR): Stop saving the stroke color.
(an*end-hyperlink, MR): Stop restoring the saved stroke color.
Set it to the default instead after formatting the link text.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Fix Savannah #61434.
* tmac/an.tmac: Support `UR`/`UE` and `MT`/`ME` hyperlinks as
paragraph tags.
(an*begin-hyperlink): Kick away the guard that prevented
attempts to do so, now that support has been refactored in
underneath it.
* tmac/groff_man.7.man.in (Hyperlink macros): De-document lack
of support for this. Retain caveat that if the output device
lacks hyperlink support, the hyperlink is typeset as part of the
paragraph body rather than the tag. I could not see any way to
achieve the alternative given the way this package uses traps
and diversions. We might make a virtue of necessity by noting
that paragraph tags could be lengthy, and URLs often will be,
and it will be hella ugly to have the tag break. Furthermore,
if we implement automated generation of link anchors based on
`TP` paragraph tags, not having their destination URLs in the
tag text means we don't have to scrape them out later.
* tmac/tests/an_link-macros-work-in-paragraph-tags.sh: Update
test expectations.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?61434>.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Refactor. Give `TP` its own trap.
(an*TP-trap): New macro takes over some of the former functions
of `an-input-trap` and `an-write-paragraph-tag`, ending the
paragraph tag diversion, restoring the adjustment mode and line
length, and calling `an-write-paragraph-tag`...
(an-write-paragraph-tag): ...which now deals only with
formatting the tag.
(an-input-trap): Ensure that `an*TP-trap` is sprung when input
line traps overlap...
(an-end): ...and when an ill-formed document ends with an input
trap pending.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Refactor.
(TH, an-write-paragraph-tag, an-input-trap, TP): Replace
register `an*is-in-paragraph-tag-diversion` with
`an*have-paragraph-tag` changing its meaning to indicate whether
we have collected a paragraph tag in a diversion that we need to
output.
(TP): Detect nesting of `TP` or `TQ` by testing name of current
diversion instead of `an*is-in-paragraph-tag-diversion`
register.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (TP): Don't set up an input trap if we're bailing
out of the macro due to invalid nesting.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Refactor to distinguish visible hyperlinks from
those that are sent only to device control commands.
(an*begin-hyperlink): Rename existing string `an*hyperlink` to
`an*visible-hyperlink`, which is the argument passed in via `UR`
and `MT` calls. Redefine `an*hyperlink` as the same argument,
but with the `an*prefix` that its caller may specify. (This
feature is used to get the "mailto:" URI scheme into links but
not clutter the page text with them.)
(an*end-hyperlink): Use `an*hyperlink` in device control
commands instead of the catenation of `an*prefix` and
`an*hyperlink`. When there is no link text, use
`an*visible-hyperlink` for it. Remove both of these strings
when done with them.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::description): Fix code style
nit. Use `sizeof` operator instead of `strlen()` to compute
length of string literal at compile time. Prompted by warning
from Clang 17.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an-end): Call `an-input-trap`. If a document
ends with an input trap pending, this ensures that any text on
the applicable input line will be emitted, better accommodating
ill-formed documents.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/an_TP-works.sh: Add unit test.
* tmac/tmac.am (tmac_TESTS): Run test.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grotty/tty.cpp (tty_printer::special): Improve
diagnostic message when handling unsupported device control
command: report name of unrecognized tag.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/an_MT-works.sh:
* tmac/tests/an_adjust-link-text-correctly.sh: Add more checks
to test cases.
* tmac/tests/an_MT-works.sh: Also stop worrying about the exact
placement of adjustment spaces in this test.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Refactor.
(an*begin-hyperlink): Before changing the stroke color to
typeset the link text, save it in new string
`an*saved-stroke-color` (as `MR` already does).
(an*end-hyperlink): After setting hyperlinked text, restore the
stroke color using the string we created for the purpose, not
the mysterious internal "pdf.tmac" string `pdf:curcol`. Delete
string afterward.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Trivially refactor (an-write-paragraph-tag):
Rename `an-env-paragraph-tag` to `an*temporary-env`.
(an*end-hyperlink, MR): Use idiomatic delimiter in device
control escape sequences.
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor; rename and boolify.
* src/roff/troff/env.h (class environment): Demote member
function `do_input_trap`'s parameter type from `int` to `bool`.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (class environment): Demote member
variable `continued_input_trap` from `int` to `bool`.
* src/roff/troff/env.cpp (class environment): Initialize member
variable `continued_input_trap` with Boolean, not integer,
literals.
* src/roff/troff/env.cpp (do_input_trap): Demote argument from
`int` to `bool` in definition...
* src/roff/troff/env.h (class environment): ...and friend
function declaration.
* src/roff/troff/env.cpp (do_input_trap): ...and rename it from
`continued` to `respect_continuation`. Assign to
`continued_input_trap` using Boolean literals.
(input_trap, input_trap_continued): Call `do_input_trap` with
Boolean literals.
2024-01-31 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/GMPfront.t: Save and restore the type size. The effective
base paragraph indentation was too large. Since it is in ens,
it turns out it was being calculated (as of the first man page
rendered) based on the type size this cover sheet left it at,
which was 16 points--a bit too big.
2024-01-31 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am ($(DOC_GNU_EPS)): Create "doc" destination
directory before trying to create a file in it. This bug has
been latent (for out-of-tree builds) for ages, but has seemingly
seldom or never arisen. It seems that even in parallel builds,
one of the many other "doc" targets that _did_ use the `MKDIR_P`
make(1) macro nearly always won the race. (In my experience, in
builds from Git, the generated forms of our Texinfo manual could
be relied upon to do this because they were near the root of the
dependency tree; other groff targets tend not to depend on
them.) Anyway, fixed now.
2024-01-31 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (DOCFILES_INST): Ship "GMPfront.t" in the
distribution archive.
2024-01-31 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an*begin-hyperlink): Stop shutting off hyperlink
support permanently if we hit one unsupported instance of `MT`
or `UR` nested inside `TP`.
Fixes <https://savannah.gnu.org/bugs/?65233>.
2024-01-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/GMPfront.t: Support non-internal man page cross
references. Port over contemporary implementation of `MR` from
"an.tmac" to its local replacement in this file. Also remove
conditionals on the `.T` string matching "pdf". Instead test
this register once at the beginning of the file and skip it with
the `nx` request if it doesn't match. This lowers the
complexity and average indentation level of the file.
Fixes <https://savannah.gnu.org/bugs/?65231>.
2024-01-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/GMPfront.t: Bikeshed the collected man pages. Retitle to
"groff Collected Reference Pages". Spell "groff" in full
lowercase. Favor requests over escape sequences. Simplify
means of setting page number.
2024-01-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (doc/groff-man-pages.pdf): Register dependency on
"doc/GMPfront.t".
2024-01-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (MR): Support hyperlinked man page cross
references in PDF.
Fixes <https://savannah.gnu.org/bugs/?62933>.
2024-01-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/tbl/table.cpp (table::add_entry): Recast recently
added diagnostic message.
2024-01-26 Deri James <deri@chuzzlewit.myzen.co.uk>
Changes to satisfy Savannah #65231.
Alter build of groff-man-pages.pdf to use the new pdfmom,
so that all forward references (i.e. reference to groff_font(5)
in addftinfo(1) page) are handled properly. Also pass bookmark
names as text strings.
* doc/doc.am: Use pdfmom.
* tmac/an.tmac: Pass parameters to .pdfbookmark as a string.
New pdfmom, can now be used with all macros.
Previously only useful for producing documents with
mom.
* src/devices/gropdf/pdfmom.pl: New --roff flag allows
other macros (e.g. -ms) to be given on the command line.
* src/devices/gropdf/pdfmom.1.man: Document the new facility.
Front Cover for groff-man-pages.pdf
Feel free to alter "artwork" at will (perhaps add maintainer
information.
* doc/GMPfront.t: Only used during build, not required as part
of installation.
Remove artifacts from using stringhex.
Introduced in commit #e62b188aacb, betraying its origin
from my deri-gropdf-ng branch which uses .stringhex.
* src/devices/gropdf/gropdf.pl: minor fixes
Fixes <https://savannah.gnu.org/bugs/?64060> (pdfmom needs
`--help` option).
2024-01-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[grog]: Fix Savannah #65227.
* src/utils/grog/grog.pl (process_arguments): Match a 'C' only
in a groff option cluster when deciding to enable compatibility
mode, not any 'C' anywhere in any option.
Fixes <https://savannah.gnu.org/bugs/?65227>.
2024-01-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Fix Savannah #65225.
* src/preproc/tbl/table.cpp (table::add_entry): Fix regression
in repeated glyph tbl(1) feature (`\R`), rendering it
inoperative. Problem introduced by me in commit 4f4b79b8aa, 26
April 2022. Restore logic to handle this table entry type.
Also throw new error diagnostic if the repeated glyph token
appears with no argument. Also improve code style by reusing
variable with already-computed entry string length instead of
calculating it again.
Fixes <https://savannah.gnu.org/bugs/?65225>. Thanks to the
anonymous submitter for a reproducing case and a correct
suggestion of the offending commit.
2024-01-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Regression-test Savannah #65225.
* src/preproc/tbl/tests/repeated-character-entry-works.sh: Do
it.
* src/preproc/tbl/tbl.am (tbl_TESTS): Run test.
2024-01-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Refactor diversion management.
* tmac/an.tmac (TH, an-write-paragraph-tag, an-input-trap, TP):
Rename `an-is-in-diversion` register to
`an*is-in-paragraph-tag-diversion`.
(an-write-paragraph-tag, TP): Rename `an-div` diversion to
`an*paragraph-tag`.
(an*begin-hyperlink, an*end-hyperlink): Rename
`an*link-text-div` to `an*link-text`.
(an-write-paragraph-tag, an*end-hyperlink): Delete diversions
after using them.
(an*end-hyperlink): Revise emission of link text diversion.
(TP): Throw warning if macro is nested with itself or `TQ`.
(an*begin-hyperlink): Throw warning if hyperlink already inside
diversion.
(TH): Initialize `an*is-in-link-text-diversion` register.
(an*begin-hyperlink): Set `an*is-in-link-text-diversion`
register. Use the register for its intended purpose. If a
nested diversion is attempted, clear `an*do-hyperlink` register.
(an*end-hyperlink): Clear `an*is-in-link-text-diversion`
register rather than deleting it.
2024-01-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (MT, ME, UR, UE): Throw warnings on bad nesting.
2024-01-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an*begin-hyperlink): Repair damage I introduced
in commit 6f12a82806, 27 January.
2024-01-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (Mt): Give macro a real implementation instead
of wrapping `Pa`. Among other benefits, this means that it
recognizes a `doc-Mt-font` string for styling of the argument,
instead of using the styling applied to `Pa`.
* tmac/mdoc/doc-ditroff (doc-Mt-font):
* tmac/mdoc/doc-nroff (doc-Mt-font): Define new strings. Set
email addresses in roman by default.
* NEWS: Report change in font styling.
Fixes <https://savannah.gnu.org/bugs/?60034>.
2024-01-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac:
* tmac/doc.tmac: Slightly refactor. Make the
`an*is-output-html` and `doc-is-output-html` registers the
{nearly} sole determinant (within each package) of behavior
tailored for HTML output. Annotate why we use each instead of
testing `.T` string.
* tmac/an.tmac (an*end-hyperlink, MR): Apply exceptions to the
above rule when explicitly issuing device control escape
sequences to embed HTML elements; only grohtml(1) can interpret
these, not grops(1) when executed by pre-grohtml(1).
2024-01-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/doc_Lk-works.sh: Add unit test.
* tmac/tmac.am (tmac_TESTS): Run test.
2024-01-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (Mt, Lk): Validate arguments.
2024-01-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/doc_Mt-works.sh: Test "direct" `Mt` call.
2024-01-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Specialize `an*bookmark` macro by output device.
(an*bookmark): Move former operation, conditional on 'pdf'
output device, from here...
(an*bookmark*pdf): ...to here.
(an*bookmark): Make into a wrapper calling the device-specific
macro.
(an*bookmark*ascii, an*bookmark*cp1047, an*bookmark*dvi)
(an*bookmark*html, an*bookmark*latin1, an*bookmark*lbp)
(an*bookmark*lj4, an*bookmark*ps, an*bookmark*utf8): Define as
empty strings.
2024-01-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Trivially refactor.
(an*bookmark, an*header, an*footer, an*begin-hyperlink)
(an*end-hyperlink, (initialization)): Retire `an*is-output-pdf`
register (and interpolation-time checks of its value) in favor
of (load-time) use of output comparison operator to check
built-in `.T` string against value "pdf".
2024-01-26 Deri James <deri@chuzzlewit.myzen.co.uk>
Our documentation groff_man.7 documents that these requests are
for hyperlinks. The .pdfhref W command expects the hotspot text
to be passed as a parameter, but these pairs of requests enclose
the required text. To solve this conundrum if the given
hyperlink text to the .pdfhref request is the single pipe
character "|" then mark all following text sent for output as
the hotspot, terminate the hotspot on receipt of \X'pdf:
markend' escape. This new facility is only available using -T
pdf, not using -T ps and the pdfmark macros. Note the advice in
the gropdf man page to use \X'pdf: marksuspend' and \X'pdf:
markrestart' to protect any headers and footers becoming part of
the hotspot in case the hyperlinked text crosses a page
boundary.
* tmac/an.tmac: add code to use .pdfhref W for these hyperlinks
and protect against crossing page boundaries.
* tmac/pdf.tmac: if the given text for a hyperlink consists of
a single pipe character "|", start the hotspot and only
terminate when \X'pdf: markend' is received. Update hyperlink
text color from RGB 0.35/0/0.6 to 0/0.35/0.6 (magenta-ish to
cyan-ish).
Fixes <https://savannah.gnu.org/bugs/?65215>.
2024-01-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor (trap Booleans).
* src/roff/troff/div.h:
* src/roff/troff/input.cpp: Rename trap-related flags and
boolify them. Assign to them using Boolean literals.
- `trap_sprung_flag` -> `was_trap_sprung`
- `postpone_traps_flag` -> `are_traps_postponed`
* src/roff/troff/div.cpp (space_request):
* src/roff/troff/env.cpp (pending_output_line::output)
(environment::output)
(environment::output_title)
* src/roff/troff/input.cpp (process_input_stack, spring_trap)
(postpone_traps, unpostpone_traps):
Update variable access sites.
* src/roff/troff/div.h:
* src/roff/troff/input.cpp: Demote return type of
`unpostpone_traps()` from `int` to `bool`.
(unpostpone_traps): Return Boolean, not integer, literals.
2024-01-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi: Resolve warnings thrown by Texinfo 7.1.
Fixes <https://savannah.gnu.org/bugs/?64889>. Thanks to Bjarni
Ingi Gislason for the report.
2024-01-23 G. Branden Robinson <g.branden.robinson@gmail.com>
[libgroff]: Fix underspecified `getenv()` prototype.
* src/libs/libgroff/getopt.c: Do it. Seen when building groff
on a non-glibc-based system (clang 17 complains).
2024-01-22 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (doc/webpage.ms): Register dependency on
"tmac/pspic.tmac".
2024-01-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (map_composite_character): Stop
throwing diagnostic message when `composite` request invoked
with only one argument. This has long worked just fine to
delete a composite character mapping. That is something a
{rare} user might conceivably want to do.
Fixes <https://savannah.gnu.org/bugs/?64937>.
2024-01-17 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Implement new `pcomposite` request.
* src/roff/troff/input.cpp (report_composite_characters): Add.
(init_input_requests): Wire up `pcomposite` request name to
`report_composite_characters()`.
* doc/groff.texi (Colors, Debugging):
* man/groff.7.man (Request short reference, Debugging):
* man/groff_diff.7.man (New requests, Debugging):
* NEWS: Document it.
2024-01-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (report_color): Flush standard error
stream after dumping defined colors. Trivially refactor to
generalize and eliminate use of pointless temporary. Continues
commit e080a78c91, 5 January.
2024-01-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (encode_char_for_troff_output):
Trivially refactor to make clearer what gets silently discarded
from (and not encoded for) device control commands.
2024-01-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Re-fix Savannah #62471 (vrules in nroff and no-space
modes).
* src/preproc/tbl/table.cpp (do_top): Compensate harder for
non-intersected vertical rules occurring at the top of a table
in nroff mode. The previous strategy would fail if no-space
mode was on and the drawing position was at the top of a page,
provoking an error from grotty ("output above first line
discarded"). Restore spacing before issuing `sp` request.
Continues fixing Savannah #62471, and commit 6ccdab9d64, 29
December.
2024-01-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Add another test case.
* src/preproc/tbl/tests/\
do-not-overdraw-page-top-in-nroff-mode.sh: Add an eleventh test
case, prompted by ascii(7) from Linux man-pages, where a table
with a vertical rule got coincidentally rendered at the very top
of a page (which can only happen in continuous rendering mode,
where the page boundaries are invisible) while no-space mode was
on (due to the table immediately following a paragraphing
macro).
2024-01-14 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Retain plain ASCII labels when possible.
* src/devices/gropdf/gropdf.pl: Do not use hexed label unless
necessary. Restores the ability for some PDF viewers to accept
"#label" as suffix to the file name.
2024-01-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/tests/\
device-control-special-character-handling.sh: Add unit test for
this feature. We want to be able to consistently pass (some)
special character escape sequences to device control commands,
and we want the `device` request and `\X` escape sequences to
behave consistently with each other.
* src/roff/groff/groff.am (groff_TESTS): Run test.
2024-01-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (encode_char_for_troff_output):
Qualify `c` argument as `const`. Reorder comparisons to avoid
inadvertent lvalue assignment. (Yes--suspenders _and_ a belt.)
2024-01-10 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix code style nits.
* src/roff/troff/input.cpp (device_request)
(device_macro_request, output_request): Declare functions
`static` since they do not require external linkage.
2024-01-09 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add unit test for `\X` (device control) escape
sequence.
* src/roff/groff/tests/backslash-X-works.sh: Add test.
* src/roff/groff/groff.am (groff_TESTS): Run test.
2024-01-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add unit test for `device` request.
* src/roff/groff/tests/device-request-works.sh: Add test.
* src/roff/groff/groff.am (groff_TESTS): Run test.
Fixes <https://savannah.gnu.org/bugs/?64959>.
2024-01-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.cpp (top_level_diversion::output)
(top_level_diversion::transparent_output)
(top_level_diversion::copy_file): Clarify diagnostic messages.
2024-01-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/div.cpp (top_level_diversion::begin_page):
Demote return type from `int` to `bool`. Return Boolean instead
of integer literals.
* src/roff/troff/div.h (class top_level_diversion): Update
declaration.
2024-01-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Enhance new tests.
* src/roff/groff/tests/\
backslash-exclamation-early-does-not-fail.sh:
* src/roff/groff/tests/output-request-early-does-not-fail.sh:
Check that escape/request parameters don't get emitted before
the output leader, and that they do show up in the output.
2024-01-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add tests of early usage of formatter features that
throw fatal errors when called "too early", but for which this
error handling appears to be dead code. Further test the
`output` request in furtherance of Savannah #64959.
* src/roff/groff/tests/\
backslash-exclamation-early-does-not-fail.sh:
* src/roff/groff/tests/cf-request-early-does-not-fail.sh:
* src/roff/groff/tests/output-request-works.sh: Add tests.
* src/roff/groff/groff.am (groff_TESTS): Run tests.
2024-01-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Revise diagnostics.
* src/roff/troff/div.cpp (top_level_diversion::output)
(top_level_diversion::transparent_output)
(top_level_diversion::copy_file): Recast diagnostic messages to
be distinguishable and provide more information about what the
problem is. Make the proffered advice agnostic with respect to
choice of control character and request renaming.
2024-01-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/input.cpp (encode_char): Rename this...
(encode_char_for_troff_output): ...to this.
(do_special): Update call site.
2024-01-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Restore diagnostic from groff 1.22.4.
* src/roff/troff/input.cpp (encode_char): Add `else` to `if`
statement checking the output device for the
"use_charnames_in_special" directive (used only by grohtml(1)).
This way we once again throw a diagnostic upon the following
input, invalid with any other output device.
printf '\\X@pdf: \\[u1234]@\n' | groff
Problem introduced by me in commit eb695ab2b5, 30 October 2021.
2024-01-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* font/devpdf/Foundry.in: More BMI, BMR mapping swap; swap the
file name pairs "URWBookmanL-LighItal" and "URWBookmanL-Ligh";
and "b018032l.pfb" and "018012l.pfb" as well.
2024-01-07 Deri James <deri@chuzzlewit.myzen.co.uk>
* src/devices/gropdf/gropdf.pl (do_x): Comment out line causing
incorrect table of contents relocation.
Thanks to Peter Schaffter for the report.
2024-01-07 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Fix inclusion of PDF v1.7 files.
PDF 1.5 introduced the object type ObjStm, which can contain a
bunch of objects in its own compressed stream, but there is a
restriction that an object with its own stream cannot be
included into the ObjStm (i.e., no streams within streams).
Gropdf has supported this for some years, but it has come to
light that some PDFs have a "skeleton" object that contains the
stream, while the rest of the object is held in an ObjStm.
* src/devices/gropdf/gropdf.pl (LoadPDF, ObjMerge): If a
skeleton object exists at the top level and in an ObjStm stream,
merge the two objects.
2024-01-07 Deri James <deri@chuzzlewit.myzen.co.uk>
* src/devices/gropdf/gropdf.pl (subs_call): Fix bad fix for
Savannah #65112.
{Problem introduced by me in commit 6e45bb0bc6, 4 January, when
I manually merged Deri's patch that wouldn't merge
automatically, and I misread the magic constant "16" as "6". My
fault, but this is also one reason symbolic constants with
human-readable names are usually preferred to numeric literals.
-- GBR}
2024-01-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix Savannah #64592 (default color name).
* src/libs/libgroff/color.cpp: Explicitly name the default color
"default", instead of permitting it to have a null name.
* doc/groff.texi (Colors):
* man/groff.7.man (Read-only registers):
* NEWS: Document it.
Fixes <https://savannah.gnu.org/bugs/?64592>. Thanks to Deri
James, Dave Kemper, and Peter Schaffter for the discussion.
2024-01-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Implement new `pcolor` request.
* src/roff/troff/input.cpp (report_color): Add.
(init_input_requests): Wire up `pcolor` request name to
`report_color()`.
* doc/groff.texi (Colors, Debugging):
* man/groff.7.man (Request short reference, Debugging):
* man/groff_diff.7.man (New requests, Debugging):
* NEWS: Document it.
2024-01-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/input.cpp
(class non_interpreted_char_node)
(class token_node)
(class non_interpreted_node):
Rename `same()` member function to `is_same_as()`. Demote
`is_same_as()` and `is_tag()` member function from `int` to
`bool`.
(non_interpreted_char_node::same):
(token_node::same):
(non_interpreted_node::same): Rename these...
(non_interpreted_char_node::is_same_as):
(token_node::is_same_as):
(non_interpreted_node::is_same_as): ...to these. Demote return
type from `int` to `bool`.
(non_interpreted_char_node::is_tag):
(operator==):
Demote return type from `int` to `bool`.
(operator==):
Return Boolean instead of integer literal. Rename local
variable `are_same` to `same` for brevity and demote it from
`int` to `bool`.
* src/roff/troff/node.cpp
(class glyph_node)
(class ligature_node)
(class kern_pair_node)
(class dbreak_node)
(class hyphen_inhibitor_node):
(class italic_corrected_node):
(class break_char_node):
(class composite_node):
Rename `same()` member function to `is_same_as()`. Demote
`is_same_as()` and `is_tag()` member function from `int` to
`bool`.
(hyphen_inhibitor_node::same):
(special_node::same):
(suppress_node::same):
(tag_node::same):
(draw_node::same):
(extra_size_node::same):
(vertical_size_node::same):
(hmotion_node::same):
(space_char_hmotion_node::same):
(vmotion_node::same):
(hline_node::same):
(vline_node::same):
(dummy_node::same):
(transparent_dummy_node::same):
(zero_width_node::same):
(italic_corrected_node::same):
(left_italic_corrected_node::same):
(overstrike_node::same):
(bracket_node::same):
(composite_node::same):
(glyph_node::same):
(ligature_node::same):
(kern_pair_node::same):
(dbreak_node::same):
(break_char_node::same):
(line_start_node::same):
(space_node::same):
(word_space_node::same):
(unbreakable_space_node::same):
(diverted_space_node::same):
(diverted_copy_file_node::same):
Rename these...
(hyphen_inhibitor_node::is_same_as):
(special_node::is_same_as):
(suppress_node::is_same_as):
(tag_node::is_same_as):
(draw_node::is_same_as):
(extra_size_node::is_same_as):
(vertical_size_node::is_same_as):
(hmotion_node::is_same_as):
(space_char_hmotion_node::is_same_as):
(vmotion_node::is_same_as):
(hline_node::is_same_as):
(vline_node::is_same_as):
(dummy_node::is_same_as):
(transparent_dummy_node::is_same_as):
(zero_width_node::is_same_as):
(italic_corrected_node::is_same_as):
(left_italic_corrected_node::is_same_as):
(overstrike_node::is_same_as):
(bracket_node::is_same_as):
(composite_node::is_same_as):
(glyph_node::is_same_as):
(ligature_node::is_same_as):
(kern_pair_node::is_same_as):
(dbreak_node::is_same_as):
(break_char_node::is_same_as):
(line_start_node::is_same_as):
(space_node::is_same_as):
(word_space_node::is_same_as):
(unbreakable_space_node::is_same_as):
(diverted_space_node::is_same_as):
(diverted_copy_file_node::is_same_as):
...to these. Demote return type from `int` to `bool`.
(hyphen_inhibitor_node::is_tag):
(node::is_tag):
(space_node::is_tag):
(special_node::is_tag):
(tag_node::is_tag):
(suppress_node::is_tag):
(unbreakable_space_node::is_tag):
(draw_node::is_tag):
(extra_size_node::is_tag):
(hmotion_node::is_tag):
(space_char_hmotion_node::is_tag):
(vmotion_node::is_tag):
(hline_node::is_tag):
(vline_node::is_tag):
(dummy_node::is_tag):
(transparent_dummy_node::is_tag):
(zero_width_node::is_tag):
(italic_corrected_node::is_tag):
(left_italic_corrected_node::is_tag):
(overstrike_node::is_tag):
(bracket_node::is_tag):
(glyph_node::is_tag):
(ligature_node::is_tag):
(kern_pair_node::is_tag):
(dbreak_node::is_tag):
(break_char_node::is_tag):
(line_start_node::is_tag):
(word_space_node::is_tag):
(diverted_space_node::is_tag):
(diverted_copy_file_node::is_tag):
Demote return type from `int` to `bool`.
(hyphen_inhibitor_node::is_tag):
(node::is_tag):
(space_node::is_tag):
(special_node::is_tag):
(tag_node::is_tag):
(unbreakable_space_node::is_tag):
(draw_node::is_tag):
(vertical_size_node::is_tag):
(hmotion_node::is_tag):
(space_char_hmotion_node::is_tag):
(vmotion_node::is_tag):
(hline_node::is_tag):
(vline_node::is_tag):
(dummy_node::is_same_as):
(dummy_node::is_tag):
(transparent_dummy_node::is_same_as):
(zero_width_node::is_tag):
(italic_corrected_node::is_tag):
(left_italic_corrected_node::is_tag):
(overstrike_node::is_tag):
(bracket_node::is_tag):
(glyph_node::is_tag):
(ligature_node::is_tag):
(kern_pair_node::is_tag):
(dbreak_node::is_tag):
(break_char_node::is_tag):
(line_start_node::is_same_as):
(line_start_node::is_tag):
(word_space_node::is_tag):
(diverted_space_node::is_tag):
(diverted_copy_file_node::is_tag):
(same_node, same_node_list):
Return Boolean instead of integer literal.
(make_glyph_node, same_node): Make explicit comparisons of
pointer types to null pointer literals.
* src/roff/troff/node.h (struct node): Demote member variable
`is_special` from `int` to `bool`. Demote pure virtual member
function `is_tag`'s return type from `int` to `bool`. Rename
pure virtual member function from `same` to `is_same_as` and
demote its return type from `int` to `bool`.
(node::node): Use Boolean instead of integer literal in
overloaded `is_special` initializers.
(class line_start_node):
(class space_node):
(class word_space_node):
(class unbreakable_space_node):
(class diverted_space_node):
(class diverted_copy_file_node):
(class extra_size_node):
(class vertical_size_node):
(class hmotion_node):
(class space_char_hmotion_node):
(class vmotion_node):
(class hline_node):
(class vline_node):
(class dummy_node):
(class transparent_dummy_node):
(class zero_width_node):
(class left_italic_corrected_node):
(class overstrike_node):
(class bracket_node):
(class special_node):
(class suppress_node):
(class tag_node):
(class draw_node):
Rename member function `same` to
`is_same_as`. Demote member functions `is_same_as` and `is_tag`
from `int` to `bool`.
* src/roff/troff/request.h (class macro): Demote friend function
`operator==` from `int` to `bool`.
2024-01-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (make_glyph_node): Trivially refactor;
Boolify local variable.
2024-01-04 Deri James <deri@chuzzlewit.myzen.co.uk>
font/devpdf/Foundry.in: Fix Savannah #65115.
* font/devpdf/Foundry.in: Fix BMI, BMR mapping swap.
Fixes <https://savannah.gnu.org/bugs/?65115>. Thanks to Bjarni
Ingi Gislason for the report.
2024-01-04 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Fix Savannah #65112.
* src/devices/gropdf/gropdf.pl (subs_call): Type 1 fonts have a
section of numbered subroutines which can be called from the
actual glyph definition; I have seen over 1000 in some large
fonts. So, when you are subsetting you need to subset (and
renumber) any relevant subroutines used by the glyph you are
subsetting.
Fixes <https://savannah.gnu.org/bugs/?65112>.
2024-01-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/grog/grog.pl: Trivially refactor; simplify code.
2024-01-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/glyphuni.cpp: Slightly refactor.
(glyph_to_unicode_init::glyph_to_unicode_init): Use
`array_length()` (our std::size for C++98) and `size_t` as type
for loop index.
2024-01-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/glyphuni.cpp: Trivially refactor.
(struct glyph_to_unicode): Rename this...
(struct glyph_to_unicode_map): ...to this. We already have a
_function_ called `glyph_to_unicode` in the code base and
apparently it's not a name space conflict (despite groff making
little use of any but the default name space), but it's
definitely confusing when searching the code.
2024-01-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[libgroff, troff]: Refactor.
* src/include/unicode.h: Rename function `check_unicode_name` to
`valid_unicode_code_sequence` and update comments to better
explain what it actually does. The validity of "u1234_5678" in
addition to "u1234" was undocumented and not even implied.
* src/libs/libgroff/unicode.cpp (check_unicode_name): Rename
this...
(valid_unicode_code_sequence): ...to this.
* src/libs/libgroff/font.cpp (glyph_to_unicode)
* src/roff/troff/input.cpp (token::next)
(map_composite_character, composite_glyph_name): Update call
sites. Make comparisons to null pointers explicit.
2024-01-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[gropdf]: Fix Savannah #65111. Add "notice" diagnostic level
for debugging.
* src/devices/gropdf/gropdf.pl (Notice): Add new subroutine. It
emits a diagnostic message only if debugging ("gropdf -d").
(Warn): Prefix diagnostic with severity level here...
(Msg): ...instead of here.
(LoadFont): Demote diagnostic about fonts lacking space glyphs
from warning to notice.
Fixes <https://savannah.gnu.org/bugs/?65111>.
2024-01-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/gropdf/gropdf.pl: Report only "basename" of
program name in diagnostic messages.
Fixes <https://savannah.gnu.org/bugs/?65110>. Thanks to Dave
Kemper for the code review.
2024-01-03 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Add `pdfpagenumbering` macro.
* tmac/pdf.tmac: Do it.
* src/devices/gropdf/gropdf.1.man: Document it.
2024-01-03 G. Branden Robinson <g.branden.robinson@gmail.com>
Increment Perl dependency from 5.6.1. gropdf requires 5.8.
* m4/groff.m4 (GROFF_PERL): Do it.
* INSTALL.extra:
* doc/webpage.ms: Document it.
2024-01-03 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Add font subsetting and Type 1 font parser.
* src/devices/gropdf/gropdf.pl: There are two main areas of
change. The first is rectifying my design mistake in the
original gropdf. It used the "t" command from groff as the
primary command as a series of input characters which would be
converted to postscript glyphs, all other text commands (for
example "c") were converted back to their input character and
treated as a single character "t" command. I was focussed on
the groff font rather than the postscript font.
While thinking about font subsetting it became clear it made
more sense to convert all input to postscript glyph names
immediately, and use them as the "common currency" rather than
focus on words. This particularly makes sense when dealing with
non-latin input which has been processed with preconv. It is
also makes it much more natural when dealing with font
subsetting. Previously this was not necessary because the whole
font was embedded by gropdf.
The second major change is the addition of a type 1 font parser
and code to generate a font which only contains the glyphs
required by the document being processed. This is the area
which needs the most testing. I have tested with dozens of
fonts that this parser is robust enough, but there are thousands
of fonts out there. It seems to be happy with fonts produced by
fontforge, which is promising.
2024-01-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/tbl/tbl.1.man (roff interface): Fix incorrect
claim regarding `#T` register.
2024-01-02 G. Branden Robinson <g.branden.robinson@gmail.com>
[man,mdoc]: Increase default line length to 80n on terminals.
The resolution of tbl(1) bugs such as Savannah #63749, #63640,
and #62471 enables us to discard a decades-old convention of
using 78n for the default line length when formatting for
terminals; this was because tbl(1) would sometimes overset
lines, with ugly consequences. (I _assume_ this was the reason;
no one ever seems to have gone on record about it--it was
seemingly yet another case of Unix folklore that "everybody
knew".) Overset lines are still possible; tbl(1) will warn if
so. They can also overset if the document disables filling; the
author is expected to know what they are doing in that case.
* tmac/an.tmac:
* tmac/doc-old.tmac:
* tmac/mdoc/doc-nroff: Do it.
* tmac/groff_man.7.man.in:
* tmac/groff_mdoc.7.man: Update documentation and annotations.
* tmac/tests/an-ext_SY-and-YS-work.sh:
* tmac/tests/an_HY-register-works.sh:
* tmac/tests/an_LL-init-sanely.sh:
* tmac/tests/an_UE-breaks-before-long-URIs.sh:
* tmac/tests/an_adjust-link-text-correctly.sh:
* tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh:
* tmac/tests/an_title-abbreviation-works.sh:
* tmac/tests/andoc_flush-between-packages.sh:
* tmac/tests/doc_indents-correctly.sh:
* tmac/tests/doc_smoke-test.sh: Update test output expectations.
* NEWS: Document it.
2024-01-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-nroff (doc-setup-page-layout): Port nroff-mode
horizontal rule width compensation from "an.tmac" (29 December)
to mdoc.
2024-01-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Update tests to more recent script conventions, and to
share more information.
* tmac/tests/an_LL-init-sanely.sh: Rename variable from
`EXAMPLE` to `input`. Write the test output to the standard
output stream. Report the horizontal motion quantum (`.H`
register) and the line length in ens (character cells) as well
for comprehensibility by *roff non-experts.
* tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh:
Write the test output to the standard output stream.
* tmac/tests/an_title-abbreviation-works.sh: Rename variables to
use lowercase instead of uppercase. Define and use `wail()`
function instead of repeating logic in failure cases. Write the
test output to the standard output stream. Report test progress
and outcomes to standard error stream.
* tmac/tests/andoc_flush-between-packages.sh: Rename variable
from `FAIL` to `fail`. Define and use `wail()` function instead
of repeating logic in failure cases.
* tmac/tests/doc_indents-correctly.sh: Define and use `wail()`
function instead of repeating logic in failure cases. Report
test progress to standard error stream. Drop redundant `exit`.
* tmac/tests/doc_smoke-test.sh: Drop redundant variable
initialization.
2023-12-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Fix Savannah #62471 (hrules in nroff mode).
This fixes the last problem I know of that keeps man pages from
freely using the full width of the terminal. (You can still
cause lines to overrun manually, of course.)
* src/preproc/tbl/table.h (class table): Define new enumeration
constant, `HAS_DATA_HRULE`, to keep track of whether a table
uses a horizontal rule as a data row.
* src/preproc/tbl/main.cpp (process_data): Set it when
encountering appropriate input.
* src/preproc/tbl/table.cpp (table::compute_overall_width):
Check for it if the table is not already boxed, and emit output
to reduce the line length by one in nroff mode.
Fixes <https://savannah.gnu.org/bugs/?62471>.
2023-12-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Regression-test Savannah #62471.
* src/preproc/tbl/tests/horizontal-rules-not-drawn-too-long.sh:
Do it.
* src/preproc/tbl/tbl.am (tbl_TESTS): Run test.
2023-12-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/tbl/table.cpp (table::compute_overall_width):
Document the nroff-mode workarounds we do in *roff comments in
the generated output.
2023-12-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (an-end): Horizontal rules in nroff mode _always_
overdraw by one character cell; this is how grotty detects
intersections with vertical rules at boundaries (see Savannah
#62471). Unfortunately it has unhappy consequences when drawing
a rule that extends to the right margin. Compensate by drawing
the rule between consecutively rendered man pages nominally one
en shorter than the line length, which turns out to be exactly
the line length.
2023-12-29 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Fix Savannah #65092 (rounded corners in hdtbl's
"color_boxes.roff" example).
The \X'ps: exec ...' for setlinejoin and setlinecap (which
hdtbl.tmac emits as one command) is documented as separate
commands in gropdf(1).
* src/devices/gropdf/gropdf.pl (do_x): Allow both setlinecap and
setlinejoin to be combined in one command.
Fixes <https://savannah.gnu.org/bugs/?64958>. Thanks to Bjarni
Ingi Gislason for the report.
2023-12-10 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Fix arc drawing when `-l` option used.
* src/devices/gropdf/gropdf.pl (PlotArcSegement): When landscape
flag `-l` is given, coordinates for arcs need rotation.
2023-11-24 Deri James <deri@chuzzlewit.myzen.co.uk>
[gropdf]: Fix processing of catenated dit files (-Z).
Normally it is safe to pass concatenated dit files to gropdf,
typically this would be a separate source file which produces a
custom cover and a different source for the body (different
macro set?). Problem occurs if one of the dits uses the same
fontno for a different font. Normally troff allocates TR to #5,
but if one of the dits has been run with the flag "U-T" then
U-TR is allocated to #5.
* src/devices/gropdf/gropdf.pl (LoadFont): Check if "x font #
name" has the same number AND name as a previously registered
font, otherwise reload the font.
2023-12-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grotty/tty.cpp (tty_printer::end_page): Add
`assert()` to check invariant.
2023-12-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/tbl/tests/check-horizontal-line-length.sh: Tweak
shell style and have test issue groff output to the standard
output stream.
2023-12-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (charinfo::contains): Add
sure-to-fail `assert()` to member function taking a `charinfo`
pointer and a `bool`. It has been marked "TODO" and
unconditionally returning false for 13 years. We should find
out if it blows up in real-world use.
2023-12-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/tbl/table.cpp (table::add_entry): Recast
diagnostic when user attempts to put a text block in a table
cell classified as numeric, and demote it from error to warning
since the program falls back to left alignment.
2023-12-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add another explicit mechanism for disabling automatic
hyphenation; accept an `hla` request without arguments for this
purpose.
* src/roff/troff/env.cpp (select_hyphenation_language): Do it.
* doc/groff.texi (Manipulating Hyphenation):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests):
* NEWS: Document it.
* src/roff/groff/tests/hla-request-works.sh: Test it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
Fixes https://savannah.gnu.org/bugs/?64958>.
2023-12-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/tests/dot-trap_register_works.sh: Fix thinko.
The test was spuriously always passing. Fortunately, the test
continues to pass when corrected. Problem introduced by me with
new `.trap` register feature in commit 4c2cd5e076, 26 July.
2023-12-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix code style nits.
* src/roff/troff/input.cpp (do_open, open_request)
(opena_request, close_request): Demote `int` arguments to
`bool`. Declare functions `static` since they do not require
external linkage.
2023-12-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Revise diagnostics when opening and closing streams.
* src/roff/troff/input.cpp (do_open, close_request): Do it.
Recast. Check `fclose()` for failure and report the system's
error description upon failure.
2023-12-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[docs]: Revise explanation of `fl` request.
This has been an annoying lacuna of groff documentation forever.
* doc/groff.texi (Debugging):
* man/groff.7.man (Request short reference): Do it.
Fixes <https://savannah.gnu.org/bugs/?64602>.
2023-12-27 G. Branden Robinson <g.branden.robinson@gmail.com>
Support pic(1) pictures when formatting HTML and using
"fallback" pic macros.
* tmac/pic.tmac (PS): Call `HTML-IMAGE` at end of macro
definition.
* tmac/pic.tmac (PF): Call `HTML-IMAGE-END` at end of macro
definition. (`PE` and `PY` call `PF`, and so are also handled.)
Fixes https://savannah.gnu.org/bugs/?65047> (2/2). Thanks to
Hans Bezemer and Dave Kemper for the report.
2023-12-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (EE): Fix latent logic error; use `if` for
conditional without an "else". Since there was no subsequent
`el` request, but the formatter was "primed" to expect one,
this could conceal an `el` usage error in a man page document or
otherwise behave strangely.
2023-12-18 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/env.cpp (environment::do_break)
(do_break_request): Boolify parameter and rename it to
`want_adjustment`. In the future, adjustment might not only
"spread", but "squeeze" as well.
(break_request): Rename this...
(break_without_adjustment): ...to this, and declare it `static`.
Pass Boolean literal to `do_break_request`.
(break_spread_request): Rename this...
(break_with_adjustment): ...to this, and declare it `static`.
Pass Boolean literal to `do_break_request`.
(init_env_requests): Update "call" sites of renamed functions.
* src/roff/troff/env.cpp (class environment): Demote
`do_break`'s parameter from `int` to `bool`, and drop parameter
names from prototype, in keeping with the Stroustrup-style C++
used in most of groff.
2023-12-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (nop_request, do_if_request)
(if_else_request, if_request, else_request, while_request)
(while_break_request, while_continue_request): Define functions
as `static`; they require no visibility outside this translation
unit.
2023-12-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (if_else_request, if_request): Throw
warning in category `missing` if given no arguments.
2023-12-08 G. Branden Robinson <g.branden.robinson@gmail.com>
Manage config.h more consistently.
* src/roff/troff/env.cpp: Ensure that we include config.h (if
necessary) _before_ C standard library header math.h.
* src/devices/xditview/Dvi.c:
* src/devices/xditview/draw.c:
* src/devices/xditview/font.c:
* src/devices/xditview/lex.c:
* src/devices/xditview/page.c:
* src/devices/xditview/parse.c:
* src/libs/libbib/map.c:
* src/libs/libgroff/change_lf.cpp:
* src/libs/libgroff/cmap.cpp:
* src/libs/libgroff/cset.cpp:
* src/libs/libgroff/fmod.c:
* src/libs/libgroff/geometry.cpp:
* src/libs/libgroff/getcwd.c:
* src/libs/libgroff/localcharset.c:
* src/libs/libgroff/prime.cpp:
* src/libs/libgroff/ptable.cpp:
* src/libs/libgroff/quotearg.c:
* src/libs/libgroff/spawnvp.c:
* src/libs/libxutil/DviChar.c:
* src/libs/libxutil/XFontName.c:
* src/libs/libxutil/xmalloc.c:
* src/preproc/eqn/eqn.ypp:
* src/preproc/grn/hdb.cpp:
* src/preproc/grn/hpoint.cpp:
* src/roff/troff/env.cpp:
* src/utils/indxbib/signal.c: Bracket inclusion of config.h with
preprocessor test of `HAVE_CONFIG_H` where absent. Use
angle bracket rather than double-quote notation for the
preprocessor file inclusion. See
<https://savannah.gnu.org/bugs/?60035>.
2023-12-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (do_hyphenation_patterns_file):
Rename...
(read_hyphenation_patterns_from_file): ...to this.
(hyphenation_patterns_file, hyphenation_patterns_file_append):
Update call sites.
(hyphenation_patterns_file): Rename...
(load_hyphenation_patterns_from_file): ...to this.
(hyphenation_patterns_file_append): ...and this...
(append_hyphenation_patterns_from_file): ... to this.
(init_hyphen_requests): Update call sites.
2023-12-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (select_hyphenation_language): Demote
missing argument diagnostic from error to warning.
(add_hyphenation_exceptions, hyphenation_patterns_file)
(hyphenation_patterns_file_append): Throw warning in category
`missing` if given no arguments.
2023-12-02 G. Branden Robinson <g.branden.robinson@gmail.com>
[libgroff]: Drop unused function parameter.
* src/include/lib.h: Drop `want_unlink` parameter from
`xtmpfile` declaration.
* src/libs/libgroff/tmpfile.cpp (xtmpfile): Drop same from
definition, along with useless (always true) conditional test.
2023-12-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (select_underline_font)
(set_font_specific_special_fonts): Tweak diagnostic messages.
2023-12-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (set_special_fonts): Revert part of
commit 44db6efc01, 3 November. Stop throwing diagnostic and
ignoring request if given no arguments; that's how you clear the
global list of fonts designated as special by request (contrast
with those that declare themselves as special in their
description files).
2023-12-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix Savannah #64957 (`device`, `output` broken).
The GNU troff(1) internal function `has_arg()` has a side effect
of advancing the token pointer (a sort of cursor into the input
stream). So when I changed `device_request()` and
`output_request()` to use `has_arg()` in commit 429723c3ec (10
November), the first character of the argument got stripped,
making it unintelligible to the output driver.
* src/roff/troff/input.cpp (device_request, output_request):
Drop call of `has_arg()` in favor of `input_stack::peek()`.
Manually discard space characters until reaching something else;
if that is a newline or EOF, throw warning diagnostic as before.
Otherwise, proceed with request processing.
Fixes <https://savannah.gnu.org/bugs/?64957>.
2023-12-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi: Fix typos.
Fixes <https://savannah.gnu.org/bugs/?64954>. Thanks to Bjarni
Ingi Gislason for the report.
2023-11-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Improve font-related diagnostics.
* src/roff/troff/node.cpp (mount_font_at_position)
(associate_style_with_font_position, select_underline_font)
(define_font_specific_character, remove_font_specific_character)
(configure_track_kerning, constantly_space_font): Throw warning
in category `missing` if given no arguments.
(set_font_specific_special_fonts, set_special_fonts): Demote
diagnostic when given no arguments to warning in category
`missing`.
(mount_font_at_position, associate_style_with_font_position):
Report invalid font mounting position in error diagostic.
(associate_style_with_font_position): Throw warning in category
`missing` if given only one argument.
2023-11-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Improve `hcode` request validation.
* src/roff/troff/input.cpp (set_hyphenation_codes): Throw
warning diagnostic if no arguments supplied. Throw error
diagnostic if there are an odd number of arguments. Check
second arguments of pairs for nonsense.
2023-11-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (hyphenation_code): Rename to...
(set_hyphenation_codes): ...this.
(init_input_requests): Update call site.
(set_hyphenation_codes): Declare as `static`; this function
doesn't need external visibility.
2023-11-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (composite_request): Rename to...
(map_composite_character): ...this.
(init_input_requests): Update call site.
(map_composite_character): Declare as `static`; this function
doesn't need external visibility.
2023-11-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (composite_request): Throw warning
diagnostic if either argument is absent; stop relying upon
`get_name()` to do so, which is a slight abuse since we
don't regard the arguments to this request as "identifiers"
{how they're described in its diagnostic messages}. Instead
test retrieved symbol for nullity and throw a more contextful
message.
2023-11-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (char_flags): Rename to...
(set_character_flags): ...this.
(init_input_requests): Update call site.
(set_character_flags): Declare as `static`; this function
doesn't need external visibility. Throw warning diagnositc when
no character arguments are present.
2023-11-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi (Miscellaneous): Clarify behavior of `mc`.
Fixes <https://savannah.gnu.org/bugs/?64891>. Thanks to Bjarni
Ingi Gislason for the report.
2023-11-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/html/pre-html.cpp (makeTempFiles): Stop explicitly
specifying parameters redundantly with their default values.
2023-11-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[libgroff]: Trivially refactor `xtmpfile`.
* src/include/lib.h:
* src/libs/libgroff/tmpfile.cpp (xtmpfile): Boolify `int`
parameter and rename it from `do_unlink` to `want_unlink`.
* src/libs/libgroff/tmpfile.cpp (xtmpfile): Make null pointer
comparison explicit. Recast diagnostic to identify what
operation failed instead of cryptically uttering only the name
of a standard C library function.
2023-11-20 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Don't enforce tag separation on `IP`.
The marker argument to the `IP` macro is often very short, such
as a bullet or list enumerator (and in fact we encourage this
practice in our style advice, promoting `TP` instead for
definition lists and similar). We therefore don't want to
enforce the `TS` tag separation for them. `.IP \[bu] 2n` is a
perfectly cromulent usage pattern.
* tmac/an.tmac: Add new Boolean-valued register,
`an*enforce-tag-separation`, to control this aspect of state.
Initialize it true.
(an-write-paragraph-tag): Multiply `TS` by this register to
apply enforcement (or not).
(IP): Temporarily clear register while setting paragraph tag.
* tmac/groff_man.7.man.in (Paragraphing macros, Options):
* NEWS: Update documentation.
2023-11-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: In source files that #include <assert.h>, ensure that
we #include <config.h> first (with a `HAVE_CONFIG_H` inclusion
guard). This should prevent build failures on AIX with Clang++.
* src/devices/grodvi/dvi.cpp:
* src/devices/grolbp/lbp.cpp:
* src/devices/grolj4/lj4.cpp:
* src/include/itable.h:
* src/include/ptable.h:
* src/include/stringclass.h:
* src/libs/libbib/linear.cpp:
* src/libs/libbib/search.cpp:
* src/libs/libdriver/printer.cpp:
* src/libs/libgroff/color.cpp:
* src/libs/libgroff/font.cpp:
* src/libs/libgroff/fontfile.cpp:
* src/libs/libgroff/nametoindex.cpp:
* src/libs/libgroff/relocate.cpp:
* src/libs/libgroff/searchpath.cpp:
* src/preproc/eqn/box.cpp:
* src/preproc/eqn/delim.cpp:
* src/preproc/eqn/pile.cpp:
* src/preproc/eqn/script.cpp:
* src/preproc/html/pre-html.cpp:
* src/preproc/pic/pic.h:
* src/preproc/preconv/preconv.cpp:
* src/preproc/soelim/soelim.cpp:
* src/roff/groff/groff.cpp:
* src/roff/troff/troff.h:
* src/utils/hpftodit/hpftodit.cpp:
* src/utils/indxbib/indxbib.cpp:
* src/utils/lkbib/lkbib.cpp:
* src/utils/lookbib/lookbib.cpp:
* src/utils/tfmtodit/tfmtodit.cpp: Do it.
Fixes <https://savannah.gnu.org/bugs/?64910>. Also see
<https://savannah.gnu.org/bugs/?61315>. Thanks to Mike Fulton
for the report.
2023-11-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp: Rename some enumeration constants.
- `BAD` -> `INVALID`
- `ABSOLUTE` -> `ASSIGN`
2023-11-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Boolify numeric expression-reading functions.
* src/roff/troff/hvunits.h (get_vunits, get_hunits):
* src/roff/troff/token.h (get_number_rigidly, get_number)
(get_integer):
* src/roff/troff/number.cpp (get_vunits, get_hunits)
(get_number_rigidly, get_number, get_integer): Do it.
2023-11-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/number.cpp (is_valid_expression): Boolify and
rename local variable from `overflow` to `had_overflow`.
2023-11-09 Paul Eggert <eggert@cs.ucla.edu>
[libbib]: Fix bogus size diagnostic.
* src/libs/libbib/index.cpp (index_search_item::check_header):
Fix size calculation typo that generated bogus diagnostic
"lookbib: error: corrupt header in index file".
{Fixes <https://savannah.gnu.org/bugs/?64879>. Problem
introduced by me in commit 4fad0459bb, 2022-01-05.
-- GBR, 2023-11-10}
2023-11-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (device_request, output_request):
Throw warning diagnostic if no arguments given.
2023-11-06 Pim <pimh@kth.se>
* src/preproc/eqn/lex.cpp: Update internal macro definitions
used to construct tilde and under-tilde ("utilde") accents to
set them in the roman face, like other accent marks in eqn.
* src/preproc/eqn/eqn.1.man (New primitives): Update example.
Fixes <https://savannah.gnu.org/bugs/?64860>. Thanks to Damian
McGuckin for reporting this problem on the groff mailing list.
<https://lists.gnu.org/archive/html/groff/2023-06/msg00143.html>
2023-11-06 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (embolden_font): Do nothing if in
nroff mode.
Fixes <https://savannah.gnu.org/bugs/?64866>.
2023-11-06 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Mark `suppression_level`,
`have_formattable_input`, `old_have_formattable_input`, and
`want_unsafe_requests` as `static` to give them internal
visibility only.
2023-11-06 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Make `in_nroff_mode` visible to other translation
units, in preparation for Savannah #64866 fix. Boolify it and
rename it from `nroff_mode`. Relocate definition alongside
other externally visible symbols.
* src/roff/troff/troff.h: Declare it.
* src/roff/troff/input.cpp: Do it.
(nroff_request, troff_request, do_if_request, do_error): Update
references.
2023-11-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (set_font_specific_special_fonts):
Declare automatic variable closer to its first point of use.
2023-11-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor dictionary implementation.
* src/roff/troff/dictionary.h (class dictionary_iterator):
(class object_dictionary_iterator):
(object_dictionary_iterator::get): Demote return type of `get()`
from `int` to `bool`.
(class object_dictionary): Demote return type of `alias()` from
`int` to `bool`.
(class object): Rename member variable `rcount` to `refcount`.
* src/roff/troff/dictionary.cpp (is_good_size):
(dictionary_iterator::get):
(object_dictionary::alias): Demote return type from `int` to
`bool`. Update return value literals.
(object::object):
(object::add_reference):
(object::remove_reference): Rename member variable `rcount` to
`refcount`.
2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Implement new `phw` request.
* src/roff/troff/env.cpp (print_hyphenation_exceptions): Add.
(init_hyphen_requests): Wire up `phw` request name to
`print_hyphenation_exceptions()`.
* doc/groff.texi (Manipulating Hyphenation, Debugging):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests):
* NEWS: Document it.
Inspired by a debugging process (that ultimately involved
input character encoding confusion) on the groff mailing list,
raised by Walter Alejandro Iglesias. See
<https://lists.gnu.org/archive/html/groff/2023-09/\
msg00032.html> and
<https://lists.gnu.org/archive/html/groff/2023-10/\
msg00008.html> and follow-ups. It my opinion it should have
been easier to ask the formatter where it thought a hyphenation
exception's hyphenation points were.
2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/reg.cpp (alter_format): Slightly refactor.
Push more diagnostic work to `tok.description()`, since it is
capable of describing any token.
2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi (Setting Registers, Strings):
* man/groff.7.man (Request short reference): Fix errors; the
`rm` and `rr` requests take an arbitrary number of arguments.
Ossanna nroff and DWB nroff both behave this way. Nor did CSTR
#54, in its 1976 or 1992 revisions, document this. Problem
appears to date back "forever", to the oldest revisions of these
files in our Git repository.
2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp: Drop parameter names from prototypes,
in keeping with the Stroustrup-style C++ used in most of groff.
2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp: Clarify diagnostic and trivially
refactor.
(hyphen_word): Rename this...
(add_hyphenation_exceptions): ...to this.
(init_hyphen_requests): Update call site.
(add_hyphenation_exceptions): Make error diagnostic more
helpful.
2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp: Add diagnostic and trivially refactor.
(set_hyphenation_language): Rename this...
(select_hyphenation_language): ...to this.
(init_hyphen_requests): Update call site.
(select_hyphenation_language): Throw more helpful diagnostic
when not given an argument; promote "missing identifier" warning
to a context-rich error.
2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi (Line Continuation): Drop concept index entry
regarding use of `\R` escape sequence after `\c` on an input
line. There is no longer anything special to say; `\R` works as
otherwise documented. Formerly (pre-1.23.0), our Texinfo manual
suggested that nothing on an input line after `\c` was
interpreted, which was false. Nothing after it is _formatted_.
Fixes <https://savannah.gnu.org/bugs/?64844>. Thanks to Bjarni
Ingi Gislason for the report.
2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (set_font_specific_special_fonts)
(set_special_fonts): Throw error when invoked with insufficient
arguments.
2023-11-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi: Add numerous @anchor commands to aid
resolution of hyperlinks into this manual based on the node
names used in groff 1.22.4 (and for several years previous, as
the document saw little change for a while). Some node names, I
did not add anchors for; they correspond either to material that
we've dropped altogether from our Texinfo manual (mainly a
somewhat stale duplicate of groff_man(7), which no GNU Info
partisan would read anyway) or were empty stubs anyway. An HTTP
404 response is therefore honest in such cases.
Fixes <https://savannah.gnu.org/bugs/?64758>. Thanks to Ingo
Schwarze for the report, Gavin Smith for proposing a
resolution technique, and Thérèse Godefroy for assistance
cleaning up our Texinfo manual's hyperlinks on the GNU web site.
2023-10-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac (TH):
* tmac/mdoc/doc-common (doc-set-up-titles): Update default
footer trap location to leave a half-inch margin below the
footer, not 1/2 inch minus one vee.
* tmac/an.tmac (PT):
* tmac/mdoc/doc-common (doc-header): Adjust vertical spacing at
page top to leave a half-inch above the header, and 1 inch
distance from the page top to the top of the running text.
* tmac/groff_man.7.man.in (Options) <-rFT>:
* tmac/groff_mdoc.7.man (Options) <-rFT>: Document new default.
* tmac/tests/an_P-register-works.sh:
* tmac/tests/andoc_P-register-works.sh:
* tmac/tests/doc_P-register-works.sh: Update test expectations.
* NEWS: Add item.
2023-10-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/refer.tmac (ref*add-J, ref*add-D, ref*add-E, ref*add-G)
(ref*add-B, ref*add-O, ref*add-A, ref*add-V, ref*add-N)
(ref*add-dflt): Fix thinko in `ie` predicates. The true
branches of the conditionals were never taken because the
condition was consistently misspelled, testing for the existence
of, for example, a register named "ef*spec!J:\\$1" (where `\\$1`
_would_ be interpolated, but not improve chances of success).
Fix by using the `d` conditional operator as obviously intended.
This enables some refer(1) formatting customization that was
unfortunately inoperative. Problem appears to date back to
commit 3bab8e6fe5, 2011-01-28.
Fixes <https://savannah.gnu.org/bugs/?64779>. Thanks to an
anonymous bug submitter for the report and the patch.
2023-10-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-ditroff (doc-Ev-font):
* tmac/mdoc/doc-nroff (doc-Ev-font): Change typeface for
environment variable identifiers from (Courier) roman to italic,
for consistency with man(7).
2023-10-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* font/devps/generate/Makefile (zapfdr.afm): Fix typo in
dependency name. Problem introduced by me in commit 2566b64e0b,
13 March 2022, which claimed "[s]hould not cause regressions
because the Make targets invoked are never called during a build
{they are isolates that you have to manually name on the command
line}." Thus was fortune's hostage seized. Apparently
OpenSUSE uses this Makefile as part of its "ghostscript-fonts-
grops" package build. (Fair enough--we _do_ install it.)
2023-10-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (while_break_request)
(while_continue_request): Clarify diagnostic messages.
2023-10-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename and boolify some file-local
functions.
* src/roff/troff/input.cpp (get_delim_number): Rename this...
(read_delimited_number): ...to this, and boolify it. The idea
behind "read" instead of "get" is that the latter more strongly
implies (to me) that the value being "got" is returned by the
function. But for `read_delimited_number`, the number is stored
{after possible unit conversion} in one of the function
parameters.
(get_delim_name): Rename this...
(get_delimited_name): ...to this.
(token::next): Update call sites.
2023-10-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename local `start` variables to
`start_token` for better code readability.
* src/roff/troff/input.cpp (do_overstrike, do_bracket)
(do_name_test, do_expr_test, do_zero_width, get_delim_number)
(get_line_arg, get_delim_name, do_register, do_width)
(do_special, read_draw_node):
* src/roff/troff/reg.cpp (inline_define_register): Do it.
2023-10-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename Boolean-valued member
function to read like a logical predicate.
* src/roff/troff/token.h (token::usable_as_delimiter): Rename...
(token::is_usable_as_delimiter): ...declaration to this.
* src/roff/troff/input.cpp (token::usable_as_delimiter):
(token::is_usable_as_delimiter): ...same for implementation.
* src/roff/troff/env.cpp (number_lines):
* src/roff/troff/input.cpp (do_expr_test, get_delim_number)
(get_line_arg, read_size, do_register, do_if_request)
(read_draw_node):
* src/roff/troff/node.cpp (has_font, embolden_font): Update call
sites.
2023-10-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::next, device_macro_request):
Recast language of one of groff's more notorious diagnostics,
eliminating the much-abused word "transparently". Also name the
offending token. It is difficult to overstate how unhelpful
diagnostic messages are when they know precisely what is wrong
but refuse to tell the user.
2023-10-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::next): Tweak language of
diagnostic message when encountering unsupported escape
sequence.
* doc/groff.texi (Using Escape Sequences): Update example
accordingly.
2023-10-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (font_change): Trivially refactor,
renaming this function...
(select_font): ...to this. Doing so aligns with other use of
the term "select" in groff font documentation. Further, when
formatting for typesetters, fonts can be "changed" in a
different sense by altering height, slant, (constancy of)
spacing, and magnification. Also mark function as "static"; it
needs no visibility outside this translation unit.
2023-10-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Throw error diagnostic on attempt to select a font
named "DESC". That will never work.
* src/roff/troff/env.cpp (font_change):
* src/roff/troff/input.cpp (token::next): Do it.
2023-09-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Add bespoke handling of `lbp` device.
* tmac/an.tmac (EX): Refactor, using new register
`an*unmap-fonts` to keep track of whether we're remapping fonts
instead of switching families. Like TeX DVI, the LBP output
device lacks a (complete) monospaced font family. In EX/EE
examples on that device, remap the bold-italic face to italics.
(EE): Revert remappings and remove `an*unmap-fonts` register.
Prompted by discussion with pandoc developers at
<https://github.com/jgm/pandoc/issues/9020>.
2023-09-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Make synopsis, usage message more helpful.
* src/preproc/eqn/eqn.1.man (Synopsis): Use descriptive phrases
as metasyntactic variables.
* src/preproc/eqn/main.cpp (usage): Sync with the foregoing.
2023-09-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/pic/troff.cpp (strsame): Add utility function for
comparing two C strings for identical content, handling null
pointer arguments as `strcmp()` does not.
(troff_output::set_location): Refactor; write the two-argument
form of the `lf` request if the current and last seen file names
_don't_ match. Problem introduced by me in commit 705be31107,
29 July. Also fix heap memory leak when repeatedly updating
`troff_output::last_filename` member variable.
Fixes <https://savannah.gnu.org/bugs/?64628>. Thanks to Bjarni
Ingi Gislason for the report.
2023-09-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[pic]: Save and restore stroke and fill colors when entering and
leaving, respectively, preprocessed regions.
* src/preproc/pic/troff.cpp: Define C/C++ preprocessor macros to
house names of *roff strings storing this information.
(troff_output::start_picture): Save stroke and fill colors.
(troff_output::finish_picture): Restore stroke and fill colors.
Fixes <https://savannah.gnu.org/bugs/?64624>. Thanks to Dave
Kemper for the report and testing this code change.
2023-09-22 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (doc/meintro_fr.ps): Depend on tbl, resolving race
in sufficiently parallelized builds. Overlooked in commit
92349ae223, 2022-05-30.
Fixes <https://savannah.gnu.org/bugs/?64695>. Thanks to
Alexander Kanavin for the report.
2023-09-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (doc/webpage.ps, doc/webpage.html): Update and
parallelize target dependencies. Resolve race by requiring
"grn" and "soelim" to be built first. Also add dependency on
`$(TMAC_PACKAGE_MS)`.
Fixes <https://savannah.gnu.org/bugs/?64681>. Thanks to
Alexander Kanavin for the report.
2023-09-15 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (charinfo_to_node_list): Trivially
refactor. Rename `old_escape_char` to `previous_escape_char`.
2023-09-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename `ascii_output_flag` to
`want_abstract_output`.
* src/roff/troff/input.cpp (main, init_registers):
* src/roff/troff/node.cpp (init_output):
* src/roff/troff/troff.h: Do it.
2023-09-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor. Rename
`unsafe_flag` to `want_unsafe_requests`.
(pipe_source, open_request, opena_request, pipe_output):
(system_request, main, init_input_requests): Do it.
(init_input_requests): Migrate from `readonly_register` to
`readonly_boolean_register`.
2023-09-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add class for Boolean-valued read-only registers.
Their values have been stored variously in `readonly_register`,
which has full `int` range, and in normal string registers, as
with `.A`.
* src/roff/troff/reg.h (class readonly_boolean_register): Add.
* src/roff/troff/input.cpp
(readonly_boolean_register::readonly_boolean_register)
(readonly_boolean_register::get_string): Define.
2023-09-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor. Rename some
functions and recast diagnostic messages.
(open_mac_file):
(process_macro_file): Rename these...
(open_macro_package):
(process_macro_package_argument): ...to these.
As our documentation now makes more clear, "macro packages" are
a subset of "macro files", and have additional rules regarding
their handling (where they are sought and how their names are
rewritten).
2023-09-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp: Trivially refactor. Rename
`begin_level` to `suppression_level`.
(do_suppress, init_input_requests): Do it.
2023-09-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (input_stack::get, token::next)
(process_input_stack, do_width, do_suppress, do_if_request)
(charinfo_to_node_list, read_color_draw_node): Trivially
refactor. Rename symbols and demote their types from `int` to
`bool`.
- `have_input` -> `have_formattable_input`
- `old_have_input` -> `old_have_formattable_input`
2023-09-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename `debug_state` symbol to
`want_html_debugging` and demote its type from `int` to `bool`.
* src/roff/troff/input.cpp:
* src/roff/troff/mtsm.cpp: Do it (declarations).
* src/roff/troff/input.cpp (input_stack::finish_get)
(input_stack::push, process_input_stack, main)
(charinfo::get_flags, charinfo::contains): Do it.
* src/roff/troff/node.cpp: Drop unused declaration.
2023-09-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor. Rename `break_flag` symbol to
`want_break` and demote its type from `int` to `bool`.
* src/roff/troff/env.h:
* src/roff/troff/input.cpp: Do it (declarations).
* src/roff/troff/div.cpp (begin_page, space_request)
(flush_output):
* src/roff/troff/env.cpp (fill, no_fill, center, right_justify)
(indent, temporary_indent, do_break_request):
* src/roff/troff/input.cpp (process_input_stack)
(macro_iterator::macro_iterator, copy_file, transparent_file):
Do it.
2023-09-12 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (doc-str-Ar-default): Use unbreakable space
between "file" and ellipsis.
2023-09-06 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/groff_me.7.man: Fix error in summary of "safe" groff
requests; `ce`, `rj`, and `ul` count (productive) _input_
lines, not output lines.
2023-09-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[libgroff]: Explicitly construct `default_color`.
Without explicit construction, link-time optimization feels free
to send this object into the twilight zone, subtly changing the
semantics of the current and previous stroke and fill colors,
making their registers interpolate "default" instead of empty
strings.
* src/libs/libgroff/color.cpp: Construct `default_color` with
empty string instead of leaving uninitalized. Problem appears
to date back to commit ea5a42d080, 2002-01-24.
Fixes <https://savannah.gnu.org/bugs/?64421>. Thanks to Günther
Noack for the report, a good reproducer, identification of
`-flto=auto` as the free variable in our experiments, and
artifact production beyond the call of duty; Peter Schaffter for
ruling out macro programming goofs; and Deri James for shrewd
pointers in the right direction (twice!).
2023-09-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Regression-test Savannah #64421.
* src/roff/groff/tests/detect-evil-link-time-optimizer.sh: Do
it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
2023-09-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/e.tmac (np, bu): Throw diagnostic if given arguments; we
document these as being "like" `ip`, but they aren't with
respect to argument handling.
(sk): Genericize existing diagnostic to use `\$0` to report its
own name.
2023-09-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Doug McIlroy pointed out a hazard of the Berkeley DD
display distance feature when footnotes end with displays; offer
advice.
* doc/ms.ms: Document caveat with display usage in footnotes.
Fixes <https://savannah.gnu.org/bugs/?64531>.
2023-09-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (doc-str-Ar-default, Ar): Stop setting ellipsis
in italics.
* tmac/groff_mdoc.7.man (Arguments): De-document apology for
former behavior.
2023-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grotty/tests/osc8_works.sh: Port test to newer
conventions.
2023-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[grog]: Drop `--ligatures`, `--run` support.
Simulate the former (which was specific to the "pdf" output
device) with the option sequence "-P -U -P y", and the latter by
using the command substitution feature of your shell; see
section "Examples" of groff(1).
* src/utils/grog/grog.pl: Do it.
* src/utils/grog/grog.1.man: De-document them.
* NEWS: Add item.
2023-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Drop AT&T troff font aliases/remappings. Now that we
have working diagnostics for font selection problems, users will
be made aware of portability issues and can address them where
they feel appropriate; in a document, in the "troffrc" file, or
by modifying these files.
* tmac/X.tmac:
* tmac/dvi.tmac:
* tmac/html.tmac:
* tmac/lbp.tmac:
* tmac/lj4.tmac:
* tmac/ps.tmac: Do it.
* NEWS: Add item.
2023-08-31 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/localization-works.sh: Test hyphenation modes for
Spanish and Russian.
2023-08-31 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/es.tmac: Correct hyphenation mode used when suppressing
hyphenation before traps. A "base" mode of 1 should map to 2,
not to 6, as (possibly) copied-and-pasted from "fr.tmac".
2023-08-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Improve robustness of mm translations.
* tmac/cs.tmac (\*[locale]-qrf):
* tmac/de.tmac (\*[locale]-qrf):
* tmac/es.tmac (\*[locale]-qrf):
* tmac/fr.tmac (\*[locale]-qrf):
* tmac/it.tmac (\*[locale]-qrf):
* tmac/ru.tmac (\*[locale]-qrf):
* tmac/sv.tmac (\*[locale]-qrf): Define string contents using
`\E` instead of `\\`, for better robustness. See our Texinfo
manual, node/section "Copy mode".
2023-08-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Rename test file for consistency.
* tmac/tests/doc_synopsis_is_not_adjusted.sh: Rename this...
* tmac/tests/doc_synopsis-is-not-adjusted.sh: ...to this.
* tmac/tmac.am (tmac_TESTS): Reflect rename.
2023-08-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[libdriver, grohtml]: Revise diagnostics.
* src/devices/grohtml/post-html.cpp
(html_printer::set_number_reg):
* src/libs/libdriver/printer.cpp (printer::set_numbered_char):
Use wording consistent with our documentation if \N'xxx' fails.
2023-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/include/lib.h (array_size): Rename to...
(array_length): ...this.
* src/preproc/eqn/box.cpp (set_param, reset_param, get_param)
(init_param_table, free_param_table): Migrate call sites.
Thanks to Alex Colomar for the discussion.
2023-08-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* Makefile.am (EXTRA_DIST): Ship ancient groff ChangeLog files
split off from ChangeLog.115 (.old, .111, .112, .113, .114).
2023-08-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (translate_font): Validate arguments.
2023-08-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor; add utility function.
* src/roff/troff/node.cpp (is_nonnegative_integer): New function
tests C-style string for validity as such; promoted from open
code because I just spotted a second place we can use it.
2023-08-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor; demote `int`-returning functions to
Boolean-returning ones and rename.
- check_font -> is_font_name
- check_style -> is_abstract_style
* src/roff/troff/node.h:
* src/roff/troff/node.cpp: Do it.
* src/roff/troff/env.cpp (is_family_valid):
* src/roff/troff/input.cpp (do_if_request): Update call sites.
2023-08-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/main.cpp (main): Trivially refactor; demote
`int` `load_startup_file` to Boolean `want_startup_file`.
2023-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Implement "reset" keyword.
* src/preproc/eqn/box.cpp: Use `static` storage class for
parametric defaults, moving them to file scope from global.
Rename `param_table` array of structs to `default_param_table`.
Use the length of this array for iteration since it is known at
compile time. Convert `param_table` to a null pointer.
(set_param): Update diagnostic message text.
(reset_param): New function restores a rendering parameter in
`param_table` to its corresponding value in
`default_param_table`.
(get_param): New function accesses `param_table` entries via a C
string rather than integer lvalues. Use `assert()` to dump
core if the parameter name is not recognized; this function is
never called by the parser, but only by static logic. Add
`fatal()` under this same circumstance, in case anyone
`#define`s `NDEBUG`.
(init_param_table): New function populates the (mutable)
`param_table` from the (immutable) `default_param_table` using
heap storage.
(free_param_table): New function avoids memory leak by freeing
the heap storage allocated for `param_table`.
* src/preproc/eqn/eqn.h: Drop external declaration of `nroff`.
* src/preproc/eqn/eqn.ypp: Add new token `RESET`.
* src/preproc/eqn/lex.cpp: Map C string "reset" to token `RESET`
in untagged struct `token_table`.
(do_reset): Handle new keyword; if argument valid, call
`reset_param()` with it.
(yylex): Hook up token `RESET` to `do_reset()`.
* src/preproc/eqn/box.h: Declare `reset_param()`, `get_param()`,
`init_param_table()`, and `free_param_table()`.
* src/preproc/eqn/main.cpp (main): Call `init_param_table()`
when starting up. Register `free_param_table()` with
`std::atexit()`.
* src/preproc/eqn/pbox.h: Drop external declarations of
rendering parameters.
* src/preproc/eqn/delim.cpp (build_extensible)
(define_extensible_string, delim_box::compute_metrics):
* src/preproc/eqn/lex.cpp (yylex):
* src/preproc/eqn/limit.cpp (limit_box::compute_metrics):
* src/preproc/eqn/list.cpp (compute_spacing):
* src/preproc/eqn/other.cpp (accent_box::compute_metrics)
(overline_char_box::overline_char_box):
(overline_box::compute_metrics, overline_box::output):
(underline_char_box::underline_char_box):
(underline_box::compute_metrics, underline_box::output):
(fat_box::compute_metrics, fat_box::output):
(vcenter_box::compute_metrics):
* src/preproc/eqn/over.cpp (over_box::compute_metrics):
(over_box::output):
* src/preproc/eqn/pile.cpp (pile_box::compute_metrics):
(matrix_box::compute_metrics, matrix_box::output):
* src/preproc/eqn/script.cpp (script_box::compute_metrics):
* src/preproc/eqn/sqrt.cpp (sqrt_box::compute_metrics): Migrate
from lvalue access to `get_param()` for parameter retrieval.
* src/preproc/eqn/eqn.1.man (Customization): Document it.
* src/preproc/eqn/tests/parameters-can-be-set-and-reset.sh: Test
it.
* src/preproc/eqn/eqn.am (eqn_TESTS): Run test.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?62692>.
2023-08-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/box.cpp (set_param): Migrate iteration style
to use new `array_size()` instead of null pointer guards at the
end of an array of structs.
2023-08-24 G. Branden Robinson <g.branden.robinson@gmail.com>
[src]: Add template function for obtaining the length of an
array.
* src/include/lib.h (array_size) [__cplusplus]: Do it.
2023-08-22 Dave Kemper <saint.snit@gmail.com>
* doc/pic.ms: Document `PY` macro, new to groff 1.23.0.
Fixes <https://savannah.gnu.org/bugs/?64575>.
2023-08-22 Dave Kemper <saint.snit@gmail.com>
* tmac/pic.tmac (PY): Call `PF` rather than duplicating its
{three bytes of} code. This is almost too trivial to DRY, but
{1} the new form is a cue to the human reader that .PY is meant
to be an alias of .PF; and {2} .PE was already defined as a
variant of .PF with an explicit call to it, so this makes the
.PY definition conform to that precedent.
2023-08-22 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an.tmac: Stop setting `an*can-hyperlink` if formatting
for PDF; we don't yet have support for this implemented, leading
to vanishing text when the `U` register is true and, for
instance, `UR`/`UE` are called with no link text.
Fixes <https://savannah.gnu.org/bugs/?64572>.
2023-08-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (PROCESSEDFILES_DEPS_HTML): Depend on
tmac/html{,-end}.tmac.
(PROCESSEDFILES_DEPS_PDF): Depend on tmac/pdf.tmac.
(PROCESSEDFILES_DEPS_PS): Depend on tmac/ps.tmac.
(PROCESSEDFILES_DEPS_TXT): Depend on tmac/tty.tmac.
2023-08-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/grops/ps.cpp (ps_printer::define_encoding):
* src/devices/grops/psrm.cpp (resource_manager::output_prolog)
(resource_manager::supply_resource): Report more intelligible
diagnostics when libgroff's `font::open_file()` returns a null
pointer without setting `errno`. The only way this can happen
is if it rejected the file name for containing a slash, thus
attempting directory traversal (recall Savannah #61424). Also
fix code style nits: explicitly `#include` errno.h C standard
library header, align style of null pointer checks, and stop
explicitly setting `errno` to zero before (indirectly) calling
`fopen()`; we inspect `errno`'s value only under a documented
error condition (a null stream pointer). See errno(3).
* NEWS: Add item; we should have mentioned this (and produced
these better diagnostics) when 1.23.0 was released.
Distributors may find this change desirable to backport.
Fixes <https://savannah.gnu.org/bugs/?64577>. Thanks to Phil
Chadwick for the report and Deri James for swiftly finding a
correct workaround that suited the reporter.
2023-08-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (class tfont_spec): Stop declaring
copy constructor. The implicitly defined one suffices.
Resolves "-Wdeprecated-copy" warning from GCC.
Fixes <https://savannah.gnu.org/bugs/?57515>. Thanks to Bjarni
Ingi Gislason for the report.
2023-08-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* configure.ac: Include paper format in configuration report.
* m4/groff.m4 (GROFF_PAGE): Slightly refactor, and help users to
figure out how the "configure" script decided upon the paper
format it did by supplementing the `AC_MSG_RESULT` message. If
not falling back to the "letter" default or honoring a
command-line setting (e.g., "./configure PAGE=a4"), report which
file or command was used to infer the paper locale. Apply DRY
principle by using shell variables more.
Prompted by discussion with Damian McGuckin on the groff list.
<https://lists.gnu.org/archive/html/groff/2023-07/msg00072.html>
2023-08-12 G. Branden Robinson <g.branden.robinson@gmail.com>
Our "Makefile.am" defines an `RM` macro if make(1) itself does
not, and our Automake files employ it extensively; sweep up the
stragglers.
* font/devpdf/devpdf.am (mostlyclean_devpdf_extra)
(uninstall_devpdf):
* src/devices/xditview/xditview.am (uninstall_xditview):
* src/libs/libgroff/libgroff.am (install_charset_data):
* src/roff/nroff/nroff.am (nroff):
* src/utils/indxbib/indxbib.am (install_indxbib):
(uninstall_indxbib): Do it.
2023-08-12 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/indxbib/indxbib.am (install_indxbib): Use `$(LN_S)`,
not `ln -s`.
2023-08-11 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Trivially refactor.
* src/preproc/eqn/main.cpp (input_char_description): Migrate to
`const`-qualified object to size an array of length computed at
compile time and avoid repeating lengthy expression.
2023-08-10 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Add new `TS` register to configure required separation
between a (`IP`, `TP`) paragraph's tag and its body, and change
the default amount used for this purpose from 1n to 2n. Retire
private register `an-tag-separation` in favor of `TS`.
* tmac/an.tmac: Assign `TS` value of 2n if not already defined.
(TH): Stop setting the default here.
(an-write-paragraph-tag): Use it.
Fixes <https://savannah.gnu.org/bugs/?64539>. Thanks to Alex
Colomar for the report.
2023-08-09 G. Branden Robinson <g.branden.robinson@gmail.com>
[man,mdoc]: Change base paragraph indentation to 5n. This
corresponds to the amount used by historical man(7) and mdoc(7)
implementations going back to Unix Version 7 and 4.3BSD-Reno,
respectively.
* tmac/an.tmac: Introduce new interface register, `BP`, to
control the base paragraph indentation amount. Formerly, `IN`
determined it, the default relative inset amount, and the
default amount of additional indentation used by `IP`, `TP`, and
the deprecated `HP`.
(an-reset-margin-and-inset-level, SH, SS): Use it.
* tmac/doc.tmac: Introduce `BP` register, replacing `IN`.
* tmac/mdoc/doc-common (Sh): Use it.
* src/preproc/tbl/tests/save-and-restore-tab-stops.sh:
* tmac/tests/an-ext_SY-and-YS-work.sh:
* tmac/tests/an_TH-repairs-hy-damage.sh:
* tmac/tests/an_UE-breaks-before-long-URIs.sh:
* tmac/tests/an_adjust-link-text-correctly.sh:
* tmac/tests/an_link-macros-work-in-paragraph-tags.sh:
* tmac/tests/an_use-input-traps-correctly.sh:
* tmac/tests/andoc_flush-between-packages.sh:
* tmac/tests/doc_Mt-works.sh:
* tmac/tests/doc_indents-correctly.sh:
* tmac/tests/doc_synopsis_is_not_adjusted.sh: Update amount of
indentation expected in output.
* tmac/groff_man.7.man.in:
* tmac/groff_mdoc.7.man: Document it.
Fixes <https://savannah.gnu.org/bugs/?64018>. Thanks to
Thorsten Glaser and Ingo Schwarze for the discussion.
2023-08-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add paranoia to `token::description()`.
* src/roff/troff/input.cpp (token::description): Clear static
buffer on entry to function to avoid another problem like
Savannah #62813.
2023-08-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor (`define_color`).
* src/roff/troff/input.cpp (define_color): Throw more helpful
diagnostics when this 3-5-argument-taking request is not given
enough of them. Rename internal variable `style` to
`color_space` to make it less opaque.
2023-08-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/input.cpp (input_char_description): Migrate to
`const`-qualified object to size an array of length computed at
compile time and avoid repeating lengthy expression.
2023-08-04 G. Branden Robinson <g.branden.robinson@gmail.com>
* man/groff_diff.7.man: Drop displayed examples. Man pages'
honor as references, not tutorials, has been vigorously
championed on the groff mailing list. Accordingly, drop
displayed examples from this page; all are available in groff's
Texinfo manual.
* NEWS: Add item in case people wonder where they've gone.
2023-08-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Fix staggering of text block entries.
* src/preproc/tbl/table.cpp: Add C preprocessor macro storing a
"text block staggering macro" name.
(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): 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
up the spacing request a diversion level (spacing requests of
anything other than 1v are ignored in diversions). Otherwise,
invoke the request.
Fixes <https://savannah.gnu.org/bugs/?64454> a.k.a. Debian
#1038391. Thanks to наб for the report and a good test case.
2023-08-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Regression-test Debian #1038391.
* src/preproc/tbl/tests/\
align-staggered-text-blocks-correctly.sh: Do it.
* src/preproc/tbl/tbl.am (tbl_TESTS): Run test.
2023-08-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Deprecate `SB` macro. It is a SunOS 4.0 (1988) extension
that in most contexts, does nothing you can't achieve with `SM`
and `B` together (in either order).
Study of the SunOS 4 man page corpus suggests a reason for its
introduction of this macro: use of `SB` immediately after `TP`
was common (610 out of 2,111 occurrences). The problem with
`TP` and the mechanism suggested above is that input traps in
troff normally ignore the `\c` escape sequence, the use of which
would be necessary to get the desired effect. In groff since
1.22.4, the man(7) `TP` macro uses GNU troff's `itc` request,
which _does_ respect `\c`. (mandoc(1) 1.14.2 and later behave
compatibly with groff man >= 1.22.4.) Solaris 11 switched to
groff as its troff implementation, so there is no reason for
newly written or currently maintained man pages to employ `SB`.
* tmac/an.tmac (SB): Throw deprecation warning.
* tmac/groff_man.7.man.in (Description): Move macro from table
to deprecation list.
(Font style macros): Move description from here...
(Deprecated features): ...to here.
(Portability): Drop mention, since we don't encourage people to
use it at all.
Fixes <https://savannah.gnu.org/bugs/?64515>.
2023-08-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (zoom_font): Validate arguments more.
Invalid inputs could have bizarre consequences.
Fixes <https://savannah.gnu.org/bugs/?64505>.
2023-08-02 G. Branden Robinson <g.branden.robinson@gmail.com>
Drop tmac/fixmacros.sed. We hadn't ever actually installed it;
it was provided only in our distribution archives, as far back
as our history indicates.
* tmac/fixmacros.sed: Delete.
* tmac/tmac.am (EXTRA_DIST): Stop shipping it.
* PROBLEMS: Recast and update relevant item description. This
is the only place the file was documented.
2023-07-31 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (doc-parse-args): Set ellipses in roman.
Thanks to Lennart Jablonka for reminding me of this issue on the
linux-man mailing list.
2023-07-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libgroff/fontfile.cpp: Update `#include`s.
(font::open_file): Do more parameter validation. Don't
construct a file name for opening from components that are null
pointers. Also `assert()` this since it should be an invariant.
Migrate from `sprintf()` to `snprintf()`; we have the size of
the destination buffer handy.
Fixes <https://savannah.gnu.org/bugs/?64485>. Thanks to Bjarni
Ingi Gislason for the report.
2023-07-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/pic/troff.cpp (troff_output::set_location): Do
more parameter validation. Generate the two-argument form of
the `lf` request only if the C string holding the new file name
to write isn't a null pointer. Also `assert()` this since it
should be an invariant.
Fixes <https://savannah.gnu.org/bugs/?64488>. Thanks to Bjarni
Ingi Gislason for the report.
2023-07-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[gxditview]: Add accelerators for "Print" action.
An apparent bug in a support library affects some users; it
disables gxditview's pop-up menu. (The menu pops up, but no
item can be selected.) Also, "Print" was the only action for
which no keyboard accelerator was defined. "p" (unmodified) is
already bound to `PreviousPage()`; bind "p" with any of the
modifiers Shift, Ctrl, Alt, or Meta to `Print()`.
* src/devices/xditview/GXditview.ad: Do it.
* src/devices/xditview/gxditview.1.man: Document it.
2023-07-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/es.tmac: Scream the entire word "BIBLIOGRAPHÍA", instead
of dying off to a murmur at the last two letters.
2023-07-26 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add new `.trap` built-in register.
* src/roff/troff/div.h (class diversion, class macro_diversion,
class top_level_diversion): Declare new member function
`get_next_trap_name`.
* src/roff/troff/div.cpp (macro_diversion::get_next_trap_name):
New member function returns name of diversion trap if any, and
if its position is greater than the vertical drawing position,
otherwise an empty string.
(top_level_diversion::get_next_trap_name): New member function
returns the name of the next vertical position trap, if any,
otherwise an empty string.
(class next_trap_name_reg): New class has one member, a
`get_string()` function.
(next_trap_name_reg::get_string): New function.
(init_div_requests): Add `.trap` to the register dictionary and
wire it up to `next_trap_name_reg`.
* doc/groff.texi (Page Location Traps):
* man/groff.7.man (Read-only registers):
* man/groff_diff.7.man (New registers): Document it.
* src/roff/groff/tests/dot-trap_register_works.sh: Test it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?64212>. Thanks to Dave
Kemper for feedback.
2023-07-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (unbreakable_space_node::tprint):
Write word marker ('w' command) to output.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?64356>.
2023-07-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/papersize.tmac: Set register `#R_MARGIN` for mom(7)'s
benefit, not `R_MARGIN`, which it neither tests nor interpolates
as a register. Continues commit bed42a77cb, 2022-11-16.
2023-07-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/papersize.tmac: If the `paper` string is defined when
this macro file is loaded, set the `O` (mm page offset register)
independently of the `W` (mm line length ["width"] register).
2023-07-21 G. Branden Robinson <g.branden.robinson@gmail.com>
[docs]: Revise material in our Texinfo manual.
* doc/groff.texi (Manipulating Filling and Adjustment): Document
a CSTR #54 erratum; the arguments to the `ss` request are in
12ths of the selected font's `spacewidth` parameter, not 36ths
of an em. Drop false claim of rounding of `.ss` and `.sss`
register values on terminal devices. (Rounding of any resulting
adjustment quantities might still occur, but this is part of the
usual application of motion quanta and not particular to the
`ss` request.) Characterize "undiscardable space" as
"horizontal motion" to help the reader acquire this essential
distinction between horizontal spaces and motions.
(Manipulating Spacing): Clarify behavior. Distinguish `sp`
request from `\v` escape sequence and cross reference the
latter. Recast to squeeze presentation of `ss` request onto one
U.S. letter page when typeset. Drop (commented-out) trivial
example of `ls` usage in favor of new example illustrating some
macros using `vs` instead, for pedagogical purposes and to eat
up a lot of dead space on the page caused by a later lengthy
example. (Knuth-Plass for the...uh...win.)
(Page Control): Stop (arguably) mis-applying the term "widow",
in favor of less metaphorical language. Extend Woolf example to
narrow the seas of vertical space produced by TeX's formatting
of the page it occupies. (Our blanched discourse can use the
purple prose.)
(Page Motion): Fix straggling use of "escape" as a noun; we
prefer "escape sequence".
* man/groff.7.man (Request short reference) <ss>: Sync.
Fixes <https://savannah.gnu.org/bugs/?64440>. Thanks to Dave
Kemper for the report and review.
2023-07-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::print_env): Fix error in
report. The units of {minimum inter-word, additional
inter-sentence} space size are 12ths of the font's "spacewidth"
parameter, not 36ths of an em.
Consider the following input.
.\" groff -T ps -Z
.nf
foo bar1
.ss 12
foo bar2 \" cases 1 and 2 are the same
foo\h'1m/3u'bar3 \" wider than 1 & 2
foo\h'1m/36u*12u'bar4 \" slightly narrower than case 3
.ss 11
foo bar5 \" narrower than case 1 (as expected)
foo\h'1m/36u*11u'bar6 \" between cases (1,2) and 4
2023-07-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/papersize.tmac: If not already defined, set `PO` register
to one inch to integrate with ms(7), man(7), and mdoc(7).
2023-07-18 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Improve documentation of pic(1) usage.
* tmac/groff_ms.7.man
(Tables, figures, equations, and references): Document the
mandatory arguments to `PS`. Explain that pic(1) will supply
them. (This is documentation of the _package's_ interface.)
* doc/groff.texi: As above, and add example of pic(1) input.
Also tighten wording.
* doc/ms.ms: As above, and supply pic output corresponding to
example (if typesetting). Add a keep.
* doc/doc.am (doc/ms.ps): Preprocess with pic; call groff with
`-p` option when generating document.
* src/utils/grog/tests/smoke-test.sh: Drop a test case; we no
longer have an ms(7) document in the tree that uses tbl and eqn
but not pic.
2023-07-17 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Fix post-1.23.0 regression.
* src/preproc/tbl/main.cpp (process_format): Fix thinkos
introduced in commit ba420961c3, 19 May, which caused the first
character after [PpVv] column modifiers to be ignored. Problem
visible in typeset renderings of our "ms.ms" document, where
some table entries were getting rendered at a type size of 1p.
2023-07-17 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Fix Savannah #64438.
* tmac/s.tmac (@PS): Stop treating excess arguments as
erroneous, foregoing preparation for pic(1) output. Fixes
regression from groff 1.22.4.
Fixes <https://savannah.gnu.org/bugs/?64438>. Thanks to Doug
McIlroy for the report, Dave Kemper for root-cause analysis, and
Deri James for usability feedback.
2023-07-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* arch/djgpp/config.site:
* arch/misc/shdeps.sh:
* bootstrap:
* font/devdvi/generate/CompileFonts:
* font/devps/generate/afmname:
* font/devps/generate/make-zapfdr:
* font/util/make-Rproto:
* gendef.sh:
* m4/groff.m4:
* mdate.pl:
* src/devices/grops/grops.1.man:
* src/devices/xditview/ad2c:
* src/libs/libgroff/config.charset:
* src/libs/libgroff/make-uniuni:
* src/preproc/eqn/neqn.sh:
* src/roff/nroff/nroff.sh:
* src/utils/afmtodit/make-afmtodit-tables:
* test-groff.in:
* tmac/hyphenex.pl: Stop endorsing shebang line space myth.
Fixes <https://savannah.gnu.org/bugs/?64058>.
2023-07-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* m4/groff.m4 (GROFF_PROG_YACC): Behave more like `AC_PROG_YACC`
where useful, seeking "bison" first. Drop comment claiming that
"Bison-generated parsers have problems with C++ compilers other
than g++", which dates back to groff 1.10, 26 November 1995.
Let us optimistically assume that GNU Bison (and C++ compilers)
have improved since then.
2023-07-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/groff.cpp (main): Update copyright notice and
warranty disclaimer. Bump year. Lead with declaration as free
software (join us now); specify GPL version and user's option to
upgrade to later version. Use a warranty disclaimer inspired by
GNU Bison. Drop mention of "COPYING" file, which is not
installed by groff's "install" make(1) target and not sufficient
information to aid users of groff packages prepared by
distributors (which neverless are legally bound to provide
licensing information via some means, and do so with high
reliability). After almost 35 years, we can have some hope that
people have heard of the GNU GPL and can locate a copy of it
without great difficulty. Also drop use of term "subprogram".
2023-07-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/man.local: Stop disabling hyperlinks on non-HTML output
devices. less(1) version 566 and later are in wide distribution
now and will be more so by the time of the next groff release.
* tmac/tests/an_UE-breaks-before-long-URIs.sh: Force hyperlinks
off with `-rU0` to preserve test validity.
* NEWS: Add item.
Thanks to Colin Watson for pioneering these changes in Debian's
groff 1.23.0-1 package.
2023-07-12 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/html/pushback.cpp (pushBackBuffer::isString):
Partially revert commit 411b42f4ec, 2 June. This member
function needs a signed type to iterate backwards for internal
validation purposes, so use `ptrdiff_t` instead of `size_t`.
Fixes post-1.23.0 problem with pre-grohtml infinitely looping on
complex documents like groff_char(7). Mea culpa.
2023-06-26 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Clarify diagnostic message.
* src/preproc/eqn/lex.cpp (do_delim): Do it.
Thanks to Doug McIlroy for the report <https://lists.gnu.org/\
archive/html/groff/2023-06/msg00158.html>.
2023-06-23 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Add unit tests for drawing commands.
* src/roff/groff/tests/draw-arc.sh:
* src/roff/groff/tests/draw-circle.sh:
* src/roff/groff/tests/draw-ellipse.sh:
* src/roff/groff/tests/draw-filled-circle.sh:
* src/roff/groff/tests/draw-filled-ellipse.sh:
* src/roff/groff/tests/draw-filled-polygon.sh:
* src/roff/groff/tests/draw-line.sh:
* src/roff/groff/tests/draw-polygon.sh:
* src/roff/groff/tests/draw-spline.sh:
* src/roff/groff/tests/set-stroke-thickness.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run tests.
2023-06-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[man, mdoc]: Parameterize page offset.
* tmac/mdoc/doc-ditroff (doc-setup-page-layout):
* tmac/mdoc/doc-nroff (doc-setup-page-layout): Stop forcing the
page offset to the device defaults, redundantly.
* tmac/an.tmac:
* tmac/mdoc/doc-ditroff (doc-setup-page-layout):
* tmac/mdoc/doc-nroff (doc-setup-page-layout): Honor `PO`
register if set at startup.
* tmac/groff_man.7.man.in (Options):
* tmac/groff_mdoc.7.man (Options): Document it.
* NEWS: Add item.
2023-06-02 G. Branden Robinson <g.branden.robinson@gmail.com>
Slightly refactor.
[grodvi, grops, xditview, libbib, libgroff, eqn, pre-grohtml,
preconv, refer, troff, tfmtodit]: Store return value of
`strlen()` in a `size_t` (or `ptrdiff_t` if we're performing
subtraction on it) instead of an `int`. Change temporaries
{loop indices and similar} to use the same types.
* src/devices/grodvi/dvi.cpp (dvi_printer::do_special):
* src/devices/grops/ps.cpp (ps_output::comment_arg):
(ps_output::put_string, ps_output::put_number):
(ps_output::put_float, ps_output::put_color):
* src/devices/grops/ps.cpp (class ps_output) <put_string, col>:
<max_line_length>:
* src/devices/xditview/Dvi.c (ClassInitialize):
* src/include/symbol.h (class symbol) <block_size>:
* src/libs/libbib/index.cpp (index_search_item::munge_filename):
(index_search_item::search_item):
* src/libs/libgroff/fontfile.cpp (font::open_file):
* src/libs/libgroff/string.cpp (string::operator=):
(string::operator+):
* src/libs/libgroff/symbol.cpp (symbol::symbol):
(symbol::block_size):
* src/preproc/eqn/delim.cpp (define_extensible_string):
* src/preproc/html/pre-html.cpp (char_buffer::can_see):
* src/preproc/html/pushback.cpp (pushBackBuffer::isString):
* src/preproc/preconv/preconv.cpp (emacs2mine):
* src/preproc/refer/label.ypp (format_expr::evaluate):
* src/roff/troff/input.cpp (make_temp_iterator, pipe_source):
* src/utils/tfmtodit/tfmtodit.cpp (main): Do it.
* src/preproc/html/pushback.cpp (pushBackBuffer::isString): Drop
`while` loop that is now tautologically true due to comparison
of unsigned types.
2023-05-30 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (font_change): Trivially refactor.
Simplify conditionals.
2023-05-30 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Trivially refactor. Rename `check_tabs` member functions
to `diagnose_tab_stop_usage`, to be more expressive and to
prepare for the diagnosis of leaders in the input as well.
* src/preproc/eqn/box.cpp (box::check_tabs):
(box_list::list_check_tabs):
(pointer_box::check_tabs):
(tab_box::check_tabs):
* src/preproc/eqn/box.h (box::check_tabs):
(box_list::list_check_tabs):
(list_box::check_tabs):
(pile_box::check_tabs):
(matrix_box::check_tabs):
(pointer_box::check_tabs):
(tab_box::check_tabs):
* src/preproc/eqn/delim.cpp (delim_box::check_tabs):
* src/preproc/eqn/limit.cpp (limit_box::check_tabs):
* src/preproc/eqn/list.cpp (list_box::check_tabs):
* src/preproc/eqn/other.cpp (accent_box::check_tabs):
(uaccent_box::check_tabs):
* src/preproc/eqn/over.cpp (over_box::check_tabs):
* src/preproc/eqn/pile.cpp (pile_box::check_tabs):
(matrix_box::check_tabs):
* src/preproc/eqn/script.cpp (script_box::check_tabs):
* src/preproc/eqn/sqrt.cpp (sqrt_box::check_tabs):
Rename these...
* src/preproc/eqn/box.cpp (box::check_tabs):
(box::diagnose_tab_stop_usage):
(box_list::list_diagnose_tab_stop_usage):
(pointer_box::list_diagnose_tab_stop_usage):
(tab_box::diagnose_tab_stop_usage):
* src/preproc/eqn/box.h (box::diagnose_tab_stop_usage):
(box_list::list_diagnose_tab_stop_usage):
(list_box::diagnose_tab_stop_usage):
(pile_box::diagnose_tab_stop_usage):
(matrix_box::diagnose_tab_stop_usage):
(pointer_box::diagnose_tab_stop_usage):
(tab_box::diagnose_tab_stop_usage):
* src/preproc/eqn/delim.cpp
(delim_box::diagnose_tab_stop_usage):
* src/preproc/eqn/limit.cpp
(limit_box::diagnose_tab_stop_usage):
* src/preproc/eqn/list.cpp (list_box::diagnose_tab_stop_usage):
* src/preproc/eqn/other.cpp
(accent_box::diagnose_tab_stop_usage):
(uaccent_box::diagnose_tab_stop_usage):
* src/preproc/eqn/over.cpp (over_box::diagnose_tab_stop_usage):
* src/preproc/eqn/pile.cpp (pile_box::diagnose_tab_stop_usage):
(matrix_box::diagnose_tab_stop_usage):
* src/preproc/eqn/script.cpp
(script_box::diagnose_tab_stop_usage):
* src/preproc/eqn/sqrt.cpp (sqrt_box::diagnose_tab_stop_usage):
...to these.
* src/preproc/eqn/box.cpp (box::top_level)
(box_list::list_diagnose_tab_stop_usage):
(pointer_box::diagnose_tab_stop_usage):
* src/preproc/eqn/delim.cpp
(delim_box::diagnose_tab_stop_usage):
* src/preproc/eqn/limit.cpp
(limit_box::diagnose_tab_stop_usage):
* src/preproc/eqn/list.cpp (list_box::diagnose_tab_stop_usage):
* src/preproc/eqn/other.cpp
(accent_box::diagnose_tab_stop_usage):
(uaccent_box::diagnose_tab_stop_usage):
* src/preproc/eqn/over.cpp (over_box::diagnose_tab_stop_usage):
* src/preproc/eqn/pile.cpp (pile_box::diagnose_tab_stop_usage):
(matrix_box::diagnose_tab_stop_usage):
* src/preproc/eqn/script.cpp
(script_box::diagnose_tab_stop_usage):
* src/preproc/eqn/sqrt.cpp (sqrt_box::diagnose_tab_stop_usage):
Update call sites.
2023-05-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Trivially refactor. Boolify `tab_box` member variable
`disabled`.
* src/preproc/eqn/box.cpp (tab_box::tab_box)
(tab_box::check_tabs):
* src/preproc/eqn/box.h (class tab_box): Do it.
* src/preproc/eqn/box.cpp (tab_box::check_tabs): Also recast
diagnostic message to clarify what "level" we're talking about:
it's lexical. Which, sadly, probably won't help any but
CS/SWeng people...
2023-05-25 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.h (read_hyphen_file): Drop relic prototype
for undeclared function. Should have been disposed of on
1992-09-21, per ChangeLog.old (né ChangeLog.115).
2023-05-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (do_error): Describe vertical page
locations in output warning diagnostics in terms of lines on
nroff devices.
* doc/groff.texi (Debugging) <warnscale>:
* man/groff.7.man (Request short reference) <warnscale>:
Document this change.
* NEWS: Add item.
2023-05-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Refactor handling of type size and vertical spacing.
* src/preproc/tbl/table.h (struct inc_number): Rename this...
(struct size_expression): ...to this, and change its member
types. The `inc` `short` becomes a `relativity` enum
because it only ever takes 3 values. The `val` short becomes an
`int`, undoing what I suspect to be premature optimization.
* src/preproc/tbl/main.cpp (entry_modifier::entry_modifier)
(entry_format::debug_print, process_format):
* src/preproc/tbl/table.cpp (set_modifier, set_inline_modifier)
(restore_inline_modifier): Update to reflect new types and
enum literals.
2023-05-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/tbl/main.cpp (process_format): Check for EOF after
eating spaces and tabs when processing [pPvVwW] column
modifiers, and emit an appropriate error diagnostic. This was
already being done for [fFmM].
2023-05-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/tbl/main.cpp (process_format): Accept (and
discard) space and tab characters after [pPvV] in a column
descriptor, as is already done for [fFmMwW]. Modify [wW] to use
the same loop style as the others, for consistency.
2023-05-19 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/box.cpp (half_space_box::output)
(full_space_box::output, thick_space_box::output)
(half_space_box::output): Add assertions to catch unexpected
flow of control.
2023-05-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Implement tunable "half_space" and "full_space"
parameters. They default to the same widths as "thin_space" and
"thick_space", respectively, but control the widths of the '^'
and '~' input tokens.
* src/preproc/eqn/box.cpp: Add globals `half_space`,
`full_space`.
(struct S): Recognize "half_space" and "full_space" as
parameters to the "set" primitive, and map them to the globals.
(half_space_box::output): Format the half space width.
(full_space_box::output): Format the full space width.
(full_space_box::output, thick_space_box::output): Drop
workaround for Firefox 1.5 MathML bug (November 2005). Emit
"&ThickSpace;" entity instead of "&ensp;".
* src/preproc/eqn/eqn.1.man (Customization): Document feature.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?64216>. Thanks to Doug
McIlroy for the report and Damian McGuckin for the discussion.
2023-05-19 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Add `thick_space` and `thin_space` classes.
* src/preproc/eqn/box.cpp:
* src/preproc/eqn/box.h: Do it.
2023-05-18 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Trivially refactor. Rename "space_box" class to
"full_space_box" for clarity and to prepare for adding distinct
thin and thick space box classes.
* src/preproc/eqn/box.cpp (space_box::space_box)
(space_box::output, space_box::debug_print):
* src/preproc/eqn/box.h (class space_box): Rename these...
* src/preproc/eqn/box.cpp (full_space_box::full_space_box)
(full_space_box::output, full_space_box::debug_print):
* src/preproc/eqn/box.h (class full_space_box): ...to these.
* src/preproc/eqn/eqn.ypp (simple): Construct item using new
type name.
2023-05-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/hvunits.h: Boolify.
(class vunits, class hunits, vunits::is_zero, hunits::is_zero):
Do it.
2023-05-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp: Rename request-handling functions to
better describe their operation.
(font_translate, font_position, style, underline_font)
(define_font_special_character, remove_font_special_character)
(font_special_request, special_request, font_zoom_request)
(bold_font, track_kern, constant_space, ligature, kern_request)
(set_soft_hyphen_char): Rename these...
(translate_font, mount_font_at_position)
(associate_style_with_font_position, select_underline_font)
(define_font_specific_character, remove_font_specific_character)
(set_font_specific_special_fonts, set_special_fonts, zoom_font)
(embolden_font, configure_track_kerning, constantly_space_font)
(set_ligature_mode, set_kerning_mode)
(set_soft_hyphen_character): ...to these.
2023-05-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (font_translate, font_position, style)
(underline_font, define_font_special_character)
(remove_font_special_character, font_special_request)
(special_request, font_zoom_request, bold_font, track_kern)
(constant_space, ligature, kern_request, set_soft_hyphen_char):
Declare functions as `static`.
2023-05-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix Savannah #64166.
* src/roff/troff/node.cpp (bold_font): Add `WARN_MISSING`
diagnostic if request given no arguments; it does nothing, and
the behavior of this request is sufficiently complex that it's
worth saying so. Stop throwing font lookup error if second
argument cannot be resolved as a font name; it might be an
emboldening amount instead.
2023-05-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/s.tmac (PE): Turn on no-space mode after a pic(1)
display, when not flying back with `PF`. Continues fix for
Savannah #62688.
2023-05-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/input.cpp (token::~token, token::operator=):
Drop workaround for bug in compiler (SGI C++) that dates back to
groff 1.07 (March 1993). But don't go back to using the ternary
operator.
2023-05-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Fix Savannah #64104.
* src/roff/troff/input.cpp (set_escape_char): Rename this...
(assign_escape_character): ...to this. Don't permit the escape
character to be set to the same thing as the control or no-break
control characters.
* doc/groff.texi (Using Escape Sequences): Document
restrictions.
* src/roff/troff/env.h (class environment): Slightly refactor.
Rename fields `control_char` and `no_break_control_char` to
`control_character` and `no_break_control_character`,
respectively, and make them private. Add public getters and
setters for them.
(get_control_character): New public member function returns
`unsigned char`.
(set_control_character): New public member function takes an
`unsigned char` and returns a `bool`.
(get_no_break_control_character):
(set_no_break_control_character): Similar.
* src/roff/troff/env.cpp (environment::environment): Update
constructors to use new field names and initialize them in their
new order of declaration.
(environment::copy): Similar. (Not to be confused with a copy
constructor, this member function implements the operation of a
valid `evc` GNU troff request.)
(environment::get_control_character):
(environment::set_control_character):
(environment::get_no_break_control_character):
(environment::set_no_break_control_character): Implement.
* src/roff/troff/env.cpp: Drop handling of `cc` and `c2`
requests.
(control_char, no_break_control_char): Drop implementations.
(init_env_requests): Drop `init_request` calls for them.
* src/roff/troff/input.cpp: Resurrect handling of `cc` and `c2`
requests here, with more error handling.
(assign_escape_character, process_input_stack): Use the new
getters defined above in environment object since the relevant
fields are now private.
(assign_control_character): New function assumes the former
responsibilities of `env.cpp::control_char()` and rejects the
request if the desired character is already the escape or
no-break control character.
(assign_no_break_control_character): New function assumes the
former responsibilities of `env.cpp::no_break_control_char()`
and rejects the request if the desired character is already the
escape or control character.
(process_input_stack): Reorder comparisons to avoid inadvertent
lvalue assignment. Add parentheses to assignment with complex
RHS.
(init_input_requests): Attach `cc` and `c2` requests to new
functions above.
* doc/groff.texi (Control Characters): Document restrictions.
2023-05-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Don't quote a character with itself in diagnostics.
* src/roff/troff/input.cpp (token::description)
(input_char_description): When quoting the ' character in
diagnostics, use double-quotes, not apostrophes.
2023-05-06 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/input.cpp (top level, warnscale_request, main,
do_error): Rename global `warn_scaling_indicator` to
`warn_scaling_unit`, to align with our documentation.
2023-05-06 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Revise output warning diagnostic format.
* src/roff/troff/input.cpp (do_error): For the `OUTPUT_WARNING`
value of the `error_type` enum, spell out the words "page" and
"diversion" instead of abbreviating them, and place the
diversion information (if present) in parentheses.
2023-05-02 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Trivially refactor.
* src/roff/troff/reg.cpp (set_number_reg): Rename to...
(set_register): ...this.
* src/roff/troff/reg.h: Update extern reference.
* src/roff/troff/div.cpp (mark):
* src/roff/troff/input.cpp (length_request, do_register)
(token::add_to_zero_width_node_list, do_register_assignment)
(init_registers): Update call sites.
* src/roff/troff/div.cpp (interpolate_number_reg): Rename to...
(interpolate_register): ...this.
(get_copy, token::next, length_request, read_title_parts):
Update call sites.
* src/roff/troff/token.h: Update extern reference. Explicitly
declare as `extern`.
* src/roff/troff/reg.cpp (define_number_reg): Rename to...
(define_register): ...this.
(init_reg_requests): Update call site.
(set_number_reg): Rename to...
(set_register): ...this.
(print_number_regs): Rename to...
(print_registers): ...this.
* src/roff/troff/reg.cpp (lookup_number_reg): Rename to...
(look_up_register): ...this.
* src/roff/troff/input.cpp (interpolate_register): Update call
site.
* src/roff/troff/reg.h: Update extern reference. Explicitly
declare as `extern`.
2023-04-30 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Improve tests of line number accuracy.
* src/preproc/eqn/tests/\
diagnostics-report-correct-line-numbers.sh: Add cases to check
behavior of valid input, not just error cases. Also add some
unexecuted test cases for future use.
2023-04-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/include/lf.h (interpret_lf_args):
* src/libs/libgroff/lf.cpp (interpret_lf_args): Boolify.
2023-04-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Fix Savannah #64122.
* src/preproc/tbl/table.cpp (table::init_output): Specify
scaling unit when using `hym` and `hys` requests. Continues
commit cee547e883, 30 January 2021.
Thanks to Frederic Chartier and Peter Schaffter for the report.
2023-04-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Regression-test Savannah #64122.
* src/preproc/tbl/tests/\
save-and-restore-hyphenation-parameters.sh: Update input and add
check.
2023-04-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Drop `POPEN_MISSING` preprocessor macro.
3 source files test this macro but nothing appears to define it.
It dates back to (at least) 1994. I suspect this of being
bitrot. Reasons include: (1) We test for a declaration of
`popen` in our "configure.ac" file; (2) our gxditview command
uses `popen` _without_ #ifdef-guarding it (perhaps the
assumption was that any system that supported X11 also had a
working `popen`); (3) our "nonposix.h" header file defines a
macro aliasing `popen` to `_popen`, which is its typical name on
Windows systems, and is the most likely build host candidate for
which support might have been missing as late as 1994.
Microsoft end-of-lifed MS-DOS in 2000. If someone wants to
start up a FreeDOS port, talk to us. Maybe even that has a
functional `popen()`. Here's hopin'.
* src/roff/troff/input.cpp ([global], file_iterator::close)
(pipe_source, pipe_output, init_input_requests):
* src/roff/troff/node.cpp (class real_output_file)
(output_file::real_output_file, output_file::~real_output_file):
* src/roff/troff/node.h: Do it.
2023-04-14 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Implement new "gifont" primitive.
* src/preproc/eqn/eqn.ypp: Add token "GFONT" (to supplement
"GIFONT", already renamed from "GFONT".
* src/preproc/eqn/lex.cpp (struct token_table): Map "gifont" and
"gfont" inputs to "GIFONT" and "GFONT" tokens.
(do_gfont, do_gifont): Employ parallel implementations,
differing only in diagnostic message text.
(yylex): Handle token "GFONT" by calling `do_gfont()`.
* src/preproc/eqn/eqn.1.man (New primitives, Fonts, Options)
(Bugs): Document it.
* NEWS: Add item.
Fixes <https://savannah.gnu.org/bugs/?63967>. Thanks to Damian
McGuckin, Doug McIlroy, and Ralph Corderoy for support and
suggestions.
2023-04-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/lex.cpp (do_include, do_undef, do_gsize)
(do_gifont, do_grfont, do_gbfont, do_space, do_chartype)
(do_set): Recast diagnostic messages to use terminology
established in man page, and use more idiomatic English in
phrasing. Distinguish which argument has the problem when
lexical analysis of "chartype" and "set" commands fails.
2023-04-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/lex.cpp (do_include, ignore_definition)
(do_definition, do_undef, do_gsize, do_gifont, do_grfont)
(do_gbfont, do_sprintf, do_ifdef, do_chartype, do_set): Recast
diagnostic messages to characterize input as "invalid" rather
than "bad".
2023-04-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[eqn]: Trivially refactor, renaming various globals from
containing "gfont" to "gifont", to make it clearer that they
deal with the italic font used by equations.
* src/preproc/eqn/box.cpp (gfont): Rename global char pointer
from this...
(gifont): ...to this.
* src/preproc/eqn/box.cpp (get_gfont, set_gfont):
* src/preproc/eqn/box.h (get_gfont, set_gfont):
* src/preproc/eqn/lex.cpp (do_gfont): Rename functions from
these...
* src/preproc/eqn/box.cpp (get_gifont, set_gifont):
* src/preproc/eqn/box.h (gifont, get_gifont, set_gifont):
* src/preproc/eqn/lex.cpp (do_gifont): ...to these.
* src/preproc/eqn/box.cpp (get_gifont, set_gifont): Update
global `gfont` access sites.
* src/preproc/eqn/box.cpp (box::top_level):
* src/preproc/eqn/eqn.ypp (simple):
* src/preproc/eqn/lex.cpp (do_gifont, yylex):
* src/preproc/eqn/main.cpp (main): Update call sites.
* src/preproc/eqn/eqn.ypp:
* src/preproc/eqn/lex.cpp (token_table, yylex): Rename "GFONT"
token type to "GIFONT".
2023-04-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/preproc/eqn/main.cpp (main): Prefix generated *roff
diagnostics with name of input file (the document). Use
`tmc`/`tm1` to coalesce multi-line diagnostic onto one line of
output to stderr. Tighten wording. Continues the long process
of fixing Savannah #52463.
2023-04-03 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (temp_iterator::temp_iterator):
Skip allocation of zero-length arrays. Resolves "-Walloc-zero"
warning from GCC.
Fixes <https://savannah.gnu.org/bugs/?62398>. Thanks to Bjarni
Ingi Gislason for the report.
2023-04-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (token::description): Revise
construction of description of printable ordinary input
characters (U+0021 through U+007E). This is to facilitate
better diagnostics from the `rchar` request in the future. See
Savannah #63985.
2023-04-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (chop_macro)
(do_string_case_transform, substring_request, asciify_macro):
(unformat_macro, write_macro_request): When diagnosing
impossible operations on request names, report the name of the
request they were attempted upon.
* src/roff/groff/tests/string_case_xform_errors.sh: Update test
expectations.
2023-04-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Make futile aliasing an error.
* src/roff/troff/input.cpp (alias_macro): Promote diagnostic
when attempting to alias a nonexistent macro/string/diversion
from warning to error; this aligns with the handling of the
requests `chop`, `stringup`, `stringdown`, `substring`,
`asciify`, `unformat`, and `writem` when they are regarded as
impossible. Further, attempting to alias a nonexistent object
does not create an empty one, unlike interpolating it; try ".als
baz qux", then ".pm".
* src/roff/troff/reg.cpp (alias_reg): Promote diagnostic when
attempting to alias a nonexistent register from warning to
error. Attempting to alias a nonexistent register does not
create an empty one, unlike interpolating it; try ".aln q r",
then ".pnr".
2023-03-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Trivially refactor. Rename variables and functions to
use the term "rule" rather than "line". The value of the term
"rule" is that it is not confusable with "lines" of (text) input
or output.
* src/preproc/tbl/main.cpp (struct format) <vline>:
(format::format) <vline>:
(format::add_rows) <old_vline, vline>:
(format::~format) <vline>:
(struct input_entry_format) <vline, vline_count>:
(input_entry_format::input_entry_format) <vline, vline_count>:
(input_entry_format::debug_print) <vline, vline_count>:
(process_format) <vline_count>:
(process_data) ([anonymous] enum) <SINGLE_HLINE, DOUBLE_HLINE>:
* src/preproc/tbl/table.cpp:
* src/preproc/tbl/table.h (enum format_type) <FORMAT_HLINE,
FORMAT_DOUBLE_HLINE>
(class table) <vline, vline_spanned, ([anonymous] enum)
<HAS_TOP_VLINE, HAS_TOP_HLINE>, add_single_hline,
add_double_hline, add_vlines, print_single_hline,
print_double_hline: Rename these...
* src/preproc/tbl/main.cpp (struct format) <vrule>:
(format::format) <vrule>:
(format::add_rows) <old_vrule, vrule>:
(format::~format) <vrule>:
(struct input_entry_format) <vrule, vrule_count>:
(input_entry_format::input_entry_format) <vrule, vrule_count>:
(input_entry_format::debug_print) <vrule, vrule_count>:
(process_format) <vrule_count>:
(process_data) ([anonymous] enum) <SINGLE_HRULE, DOUBLE_HRULE>:
* src/preproc/tbl/table.cpp:
* src/preproc/tbl/table.h (enum format_type) <FORMAT_HRULE,
FORMAT_DOUBLE_HRULE>
(class table) <vrule, vrule_spanned, ([anonymous] enum)
<HAS_TOP_VRULE, HAS_TOP_HRULE>, add_single_hrule,
add_double_hrule, add_vrules, print_single_hrule,
print_double_hrule: ...to these.
2023-02-25 G. Branden Robinson <g.branden.robinson@gmail.com>
[tbl]: Fix Savannah #63838.
* src/preproc/tbl/table.cpp (table::add_entry): Throw error
diagnostic if table entry ends in the zero-motion escape
sequence `\z`. This is nonsense and provokes baffling
diagnostics from the formatter. Stick user's nose directly into
the problem.
Fixes <https://savannah.gnu.org/bugs/?63838>. Thanks to the
mandoc(1) project for documenting the issue in a regression
test.
2023-04-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Improve portability to non-GNU, non-LLVM compilers.
* bootstrap.conf (gnulib_modules): Add "attribute".
* src/libs/libgroff/getopt.c:
* src/libs/libgroff/new.cpp: Include gnulib's "attribute.h"
header file.
* src/libs/libgroff/getopt.c (_getopt_initialize):
* src/libs/libgroff/new.cpp (operator delete): Replace GNU C
unused attribute syntax with gnulib's "MAYBE_UNUSED".
Thanks to Bruno Haible for the report and suggested remedy.
2023-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libxutil/XFontName.c (utoa): Rename function from
this...
(xu_utoa): ...to this, to avoid name collision when using
"newlib" portability library.
(XFormatFontName): Update call site.
* PROBLEMS: Drop item.
Fixes <https://savannah.gnu.org/bugs/?63831>. Thanks to Brian
Inglis for the report.
2023-05-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Preserve user-selected font family.
* tmac/an.tmac: When initializing, save the currently selected
font family as `an*body-family` instead of forcing 'T' (Times,
which is the formatter's default, even on nroff-mode devices
that can't switch families). This change makes the formatter's
`-f` option work on man(7) documents again (important for
Japanese man pages, but there is now once again nothing stopping
you from viewing man pages in Palatino or Helvetica on the 'ps'
and 'pdf' devices where these families are available). It also
reopens an avenue for rogue pages to affect the rendering of
unrelated documents later in batch rendering, but there are many
other, and worse, ways for rogue pages to do damage. Problem
introduced by me in commit e0e16d8e65, 15 March 2022.
Fixes <https://savannah.gnu.org/bugs/?64130>. Thanks to Deri
James for the report.
2023-05-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Stop `HP` producing excess vertical space.
* tmac/an.tmac (HP): Fix thinko/typo when expanding macro as
string to call `an-deprecation-warn`.
* tmac/an-ext.tmac (SY): Put 1v of vertical space on the output
if we are starting a (non-nested) synopsis.
Thanks to Alex Colomar for the report. Problem introduced by me
in commit aea1dfb11b, 6 March 2022.
2023-04-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Default vertical spacing to 120% of type size, not 2
points larger.
* tmac/s.tmac (par@load-init, par@init): Do it.
* NEWS: Add item.
2023-04-26 G. Branden Robinson <g.branden.robinson@gmail.com>
[pdfpic]: Refactor.
* tmac/pdfpic.tmac: Migrate gathering of image dimensions from
`sy` and a temporary file to `pso`.
(pdfpic@cleanup): Drop `pdfpic*temporary-file` string.
(pdfpic@get-image-dimensions): Remove redirection. Invoke
`pso`, not `sy`.
(PDFPIC): Stop constructing `pdfpic*temporary-file` string.
Stop testing `systat` register. Stop sourcing and deleting
temporary file.
2023-04-21 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/pdfpic.tmac: Refactor to make comprehensible some
woefully undocumented cleverness and improve efficiency.
(PDFPIC): Break out flaming-hoop-leaping "clever" bit of `sy`
usage into its own macro, calling from here and relocating its
requests from here...
(pdfpic@get-image-dimensions): ...to here. When using `sy`
request to collect and munge output of pdfinfo(1), (a) disable
the escape character while defining the macro; (b) construct the
command in a roff string, appending to it in discrete, hopefully
comprehensible chunks; (c) disable the escape character during
macro interpretation wherever possible (most of it); (d) retain
doubled backslashes so that they survive subsequent string
interpolation; (e) stop using grep(1) in the pipeline when
sed(1) is perfectly capable of performing its own input
filtering; (f) invoke sed with '-n' option and emit output only
upon a successful substitution; (g) replace unportable(!) POSIX
BRE character class '[:digit:]' in substitution match text with
'[0-9]'; and most importantly (h) replace multi-line sed 's'
replacement text (see below for the reason we can't use it) with
single roff control line employing the groff extension escape
sequence `\R` to assign multiple registers. Annotate
portability and escaping challenges. Tested on GNU/Linux, macOS
12, and (with simulated pdfinfo(1) output) Solaris 11.
There is a problem with trying to embed true newlines into the
arguments of a `sy` request. The C++ function that GNU troff
uses to assemble the command string (character by character)
_does not recognize C/C++ string literal escape sequences_.
This means that you _cannot_ embed "\n" in `sy`'s arguments and
have it survive, as a newline character, into the command string
passed to the standard C library's system(3) function. ("A\nB"
gets encoded as 'A', '\\', 'n', 'B', not 'A', '\n', 'B'.)
Unfortunately, this appears to be AT&T troff-compatible
behavior. But it means that you _cannot_ portably construct
multi-line replacement text for sed's 's' command. (Other sed
commands like 'a', 'c', and 'i' will be similarly affected.)
See Savannah #64071.
* PROBLEMS: Drop item.
Fixes <https://savannah.gnu.org/bugs/?64061>. Thanks to Bruno
Haible for the report, and to him and Ralph Corderoy for the
discussion of portable and efficient sed constructs.
2023-04-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[pdfpic]: Clean up better.
* tmac/pdfpic.tmac (PDFPIC): Call `pdfpic@cleanup` before
returning when falling back to `PSPIC` for non-PDF documents.
2023-04-05 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tty.tmac: Add angle bracket fallbacks.
Thanks to Mike Fulton for the report, and to Ralph Corderoy and
Dave Kemper for the discussion.
2023-03-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[tests]: Add Spanish language support (5/5).
* src/roff/groff/tests/localization_works.sh:
* tmac/tests/e_ld-works.sh: Test it.
Fixes <https://savannah.gnu.org/bugs/?63921>. Thanks to Eloi
Montañés.
2023-03-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[docs]: Add Spanish language support (4/5).
* doc/groff.texi (Manipulating Hyphenation):
* doc/ms.ms (Language and localization):
* man/groff_tmac.5.man (Localization files): Document it.
* NEWS: Add item.
2023-03-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Add Spanish language support (3/5).
* tmac/hyphen.es:
* tmac/es.tmac: Update editor aids.
2023-03-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Add Spanish language support (2/5).
* tmac/es.tmac: Spell weekday and month names in lowercase;
every style authority I could find online mandates this, and it
meshes with my half-remembered formal instruction in the
language. Fix groff composite special character escape
sequences to place the base character first. Replace one
Unicode special character escape sequence with a composite
special character escape sequence, for consistency.
2023-03-13 Eloi Montañés <em@ilsrv.com>
[tmac]: Add Spanish language support (1/5).
* tmac/hyphen.es: Add hyphenation patterns (encoded in Latin-9).
* tmac/es.tmac: Add groff locale for Spanish.
* tmac/tmac.am (TMACNORMALFILES): Ship new files.
* doc/groff.texi (Manipulating Hyphenation): Add file/package
index entry for "es.tmac".
* LICENSES: Update for CTAN Spanish hyphenation patterns.
2023-03-09 G. Branden Robinson <g.branden.robinson@gmail.com>
[tests]: Add Russian language support (7/7).
* src/roff/groff/tests/localization_works.sh:
* tmac/tests/e_ld-works.sh: Test it.
Fixes <https://savannah.gnu.org/bugs/?63076>. Thanks to Nikita
Ivanov.
2023-03-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[docs]: Add Russian language support (6/7).
* doc/groff.texi (Input Encodings, Manipulating Hyphenation):
* doc/ms.ms (Language and localization):
* man/groff_tmac.5.man (Localization packages, Input encodings):
Document support for KOI8-R encoding and Russian language.
2023-03-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Add Russian language support (5/7).
* tmac/tmac.am (TMACNORMALFILES): Ship new Russian language
support files.
2023-03-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Add Russian language support (4/7).
* tmac/koi8-ru.tmac: Rename this file...
* tmac/koi8-r.tmac: ...to this. There _is_ a "KOI8-RU"
encoding, which appears to subsume KOI8-B and KOI8-U (by
replacing more box drawing characters), but this file does not
remap their values to applicable Unicode code points.
* tmac/ru.tmac: Load the encoding file under its new name.
2023-03-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[tmac]: Add Russian language support (3/7).
* tmac/hyphen.ru:
* tmac/ru.tmac: Update editor aids so these files can be edited
more intelligibly using GNU Emacs. Annotate apparent problem
with Vim's KOI8-R support.
2023-03-08 G. Branden Robinson <g.branden.robinson@gmail.com>
Add Russian language support (2/7).
LICENSES: Update for CTAN Russian hyphenation patterns.
2023-03-08 Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
[tmac]: Add Russian language support (1/7).
* tmac/hyphen.ru: Add hyphenation patterns (encoded in KOI8-R).
* tmac/koi8-ru.tmac: Add character encoding support.
* tmac/ru.tmac: Add groff locale for Russian.
2023-04-07 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/s.tmac (@EQ): Trivially refactor. Shift valid
pseudo-enumeration type values from 0..2 to 1..3 so that they
more idiomatically test for truth values in roff (where zero and
negative values are false). Simplify a conditional accordingly.
2023-04-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Fix Savannah #64013.
* tmac/s.tmac (@EQ): Revise argument handling. If there is only
one argument and it is not a recognized alignment, warn and
treat it as an equation label. If there are two arguments but
the first is not a recognized alignment, throw a warning
diagnostic (but still use default alignment with the second
argument as label). An explicitly empty first argument is
synonymous with "C".
Fixes <https://savannah.gnu.org/bugs/?64013>.
2023-04-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Regression-test Savannah #64013.
* tmac/tests/s_EQ-handles-empty-first-arg.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
2023-04-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Fix Savannah #64005.
* tmac/s.tmac (@break-page, bp): Define alias for `bp` request
and wrapper for `bp` to (if needed) temporarily disable no-space
mode, so that a document's `bp` requests are honored even if
no-space mode is on, as can happen after displays. Fixes a
regression from groff 1.22.4 and historical ms implementations
introduced by me on 6 July when resolving Savannah #62688.
Fixes <https://savannah.gnu.org/bugs/?64005>. Thanks to Michał
Kruszewski for reporting the problem and Dave Kemper for
identifying the cause.
2023-04-05 G. Branden Robinson <g.branden.robinson@gmail.com>
[ms]: Regression-test Savannah #64005.
* tmac/tests/s_honor-page-break-after-display.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
2023-03-24 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-common (Sh): Restore hyphenation configured with
`HY` register upon entry to any new section. Disable adjustment
and hyphenation when in the "Synopsis" section.
Fixes <https://savannah.gnu.org/bugs/?63957>. Thanks to Alex
Colomar for reporting an issue that brought this one to light.
2023-03-24 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Regression-test Savannah #63957.
* tmac/tests/doc_synopsis_is_not_adjusted.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
2023-03-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tmac.am (tmac/stamp-wrap): Stop prepending groff's man(7)
package wrapper ("-man") on hosts with a system man package with
a request to source itself; this was search-and-replace damage
from resolving Savannah #60789. The wrapper still worked, but
reported any errors inside the wrapped macro package many times
until the process ran out of file descriptors. Problem
introduced by me in commit fdac25937f, 2021-07-05.
Fixes <https://savannah.gnu.org/bugs/?63924>.
2023-05-13 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/tests/an-ext_SY-and-YS-work.sh: Add test.
* tmac/tmac.am (tmac_TESTS): Run test.
2023-04-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Skip an Autoconf check if not necessary.
* m4/groff.m4 (GROFF_PNMTOPS_NOSETPAGE): Skip check if no
"pnmtops" command was found.
2023-04-06 G. Branden Robinson <g.branden.robinson@gmail.com>
[doc]: Abstract document dependencies on the mom package.
* doc/doc.am (doc/automake.pdf): Replace dependency with new
macro `TMAC_PACKAGE_MOM`.
Aligns with <https://savannah.gnu.org/bugs/?62541> (4/4).
2023-04-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[doc]: Add document dependencies on the ms package.
* tmac/tmac.am (TMAC_PACKAGE_MS): Define new macro comprising
the files of the ms package.
* doc/doc.am (doc/ms.ps, doc/webpage.ps, doc/pic.html)
(doc/pic.ps): Add dependency on new macro.
Fixes <https://savannah.gnu.org/bugs/?62541> (2/4).
2023-04-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[doc]: Add document dependencies on the "me" package.
* tmac/tmac.am (TMAC_PACKAGE_ME): Define new macro comprising
the files of the "me" package.
* doc/doc.am (doc/grnexmpl.ps, doc/meintro.ps)
(doc/meintro_fr.ps, doc/meref.ps): Add dependency on new macro.
Fixes <https://savannah.gnu.org/bugs/?62541> (1/4).
2023-04-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Install PDF documents better. Ship only one copy of
"automake.pdf", and install it and the new "groff-man-pages.pdf"
in the "pdf/" subdirectory of the destination "doc" directory.
* doc/doc.am (PROCESSEDDOCFILES): Drop
"$(PROCESSEDDOCFILES_PDF)" from macro definition.
(nodist_docpdfdoc_DATA) [USE_GROPDF]: Use it here instead,
replacing a literal "doc/automake.pdf".
(mostlyclean-doc) [USE_GROPDF]: Clean these same files.
2023-04-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Ship groff.dvi (our Texinfo manual in DVI format).
* doc/doc.am (install-dvi-local, uninstall-dvi): Add targets.
(uninstall-local): Depend on "uninstall-dvi".
2023-04-03 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Resume shipping pic.html.
* m4/groff.m4 (GROFF_CHECK_GROHTML_PROGRAMS)
(GROFF_GROHTML_PROGRAM_NOTICE, GROFF_PNMTOOLS_CAN_BE_QUIET):
Rename "make_htmldoc" to "use_grohtml" as expected by
"configure.ac". Also stop `AC_SUBST`ing it; we don't need
"@use_grohtml@" in our Makefiles since an `AM_CONDITIONAL` in
configure.ac already does an equivalent thing. Continues commit
aa5787c1eb by me from 20 May.
(PROCESSEDDOCFILES): Drop "$(PROCESSEDDOCFILES_HTML)" from macro
definition; annotate why.
2023-03-13 G. Branden Robinson <g.branden.robinson@gmail.com>
m4/groff.m4 (GROFF_TMAC): Eliminate garbage leading space from
contents of `tmac_wrap` shell variable.
2023-03-13 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Clarify output of `GROFF_TMAC` Autoconf test.
* configure.ac: Correct characterization of the list of macro
packages reported. It is not the list of macro packages
receiving a "g" prefix, but the list of macro packages reciving
a wrapper macro file in groff's macro directory, each of which
sources the corresponding system (likely AT&T-descended troff)
macro package. Fixes wording I introduced in commit 4d30dd7424,
31 May.
* m4/groff.m4 (GROFF_TMAC): Clarify first "checking" message:
we are looking for a file name prefix on existing system macro
packages (like "tmac."). This has nothing to do with the prefix
applied to groff commands, or the "g" prefixed to groff
implementations of the man, mm, and ms packages. Tighten
wording of second "checking" message. Consistently say "(none)"
instead of "none" or "none found".
Fixes <https://savannah.gnu.org/bugs/?63900>.
2023-03-11 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (install-txt): Look for "groff.txt" in the source
and build directories in sequence; it could be in either place
depending on whether the build is from the Git repository or
from a distribution archive. Annotate this. Fixes
"install-doc" target when building from Git repository. Problem
introduced by me in commit 691fc70108, 22 February. Thanks to
Nikita Ivanov for the report.
(install-pdf-local, install-html-local): Similar.
Also fixes <https://savannah.gnu.org/bugs/?64059>, later
reported anonymously.
2023-03-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/doc.am (maintainer-clean-local): Remove temporary "*.t2d"
and "*.t2p" directories created by texi2dvi.
2023-04-20 Bruno Haible <bruno@clisp.org>
[build]: Fix gxditview linking on AIX.
* m4/groff.m4 (GROFF_X11): Add macro dependency on
`AC_CANONICAL_HOST`. Introduce new variable `X_AW_DEPS`, empty
on most hosts. If we otherwise have Athena widget library
support, and the host is AIX, force linkage against Xpm and Xext
libraries to reflect modern Athena dependencies, which AIX's
linker doesn't figure out on its own. `AC_SUBST` this variable,
exposing it to Automake files.
* src/devices/xditview/xditview.am (gxditview_LDADD): Use it.
{A similar change might also be useful for HP-UX, another Unix
System V descendant; see
<http://hpux.connect.org.uk/hppd/cgi-bin/wwwtar?/hpux/Gnu/\
groff-1.23.0/groff-1.23.0-src-11.31.tar.gz+groff-1.23.0/\
HPUX.Install+text>. --GBR, 2023-07-10}
2023-04-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* bootstrap.conf (gnulib_modules): Add "sys_wait" module. MinGW
does not provide "sys/wait.h", which we require in
src/preproc/html/pre-html.cpp since commit 11137209ed, 27 June.
2023-04-20 G. Branden Robinson <g.branden.robinson@gmail.com>
* Makefile.am: Initialize (as empty) Automake variables that we
don't use but which gnulib modules expect to be defined.
(AUTOMAKE_OPTIONS, SUBDIRS, noinst_HEADERS, noinst_LTLIBRARIES)
(pkgdata_DATA, MOSTLYCLEANDIRS, AM_CFLAGS): Do it.
Thanks to Bruno Haible for the advice.
2023-04-22 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Regression-test Savannah #57665, but for mdoc.
* tmac/tests/doc_TS-do-not-keep-tables-when-cR-set.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.
Fixes <https://savannah.gnu.org/bugs/?64037>.
________________________________________________________________________
##### License
Copyright 2023-2024 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
##### Editor settings
Local Variables:
fill-column: 72
mode: change-log
version-control: never
End:
vim:set autoindent textwidth=72: