| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Use new \n[.cp] register to save compatibilty mode.
Use register names based on the filename (at the source maintenance
level) to avoid clobbering other files' saved compatibility modes.
tmac/html.tmac: Eliminate reference to saved-compatibility register by
moving its test inside the block where compatibility mode is off. This
is the only part of this changeset that was not automated.
|
|
|
|
| |
This test fails in the current state of the tree.
|
|
|
|
| |
Vim modelines go at the end of the file as well.
|
|
|
|
|
|
|
|
|
| |
Most users and developers have lexical coloring/syntax highlighting
available these days (cf. 30 years ago).
Leaving them in plain-text files (like READMEs) because these are
generally not machine-parsed (except for changelogs...) and the
indicator may conceivably be useful to novices who stumble across them.
|
|
|
|
| |
Most *.tmac files already had some.
|
|
|
|
|
|
| |
Also use more correct nomenclature for other *roffs.
ChangeLog: Add summary of what \n[.cp] actually _is_.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The register \n[.cp] is specialized and may require a statement of
rationale. When writing macro packages or documents that use groff
features and which may be mixed with other packages or documents that do
not—common scenarios include serial processing of man pages or use of
the .so or .mso requests—you may desire correct operation regardless of
compatibility mode in the surrounding context. It may occur to you to
save the existing value of \n(.C into a register, say, _C, at the
beginning of your file, turn compatibility mode off with “.cp 0”, then
restore it from that register at the end with “.cp \n(_C”. At the same
time, a modular design of a document or macro package may lead you to
multiple layers of inclusion. You cannot use the same register name
everywhere or you risk “clobbering” the value from a preceding or
enclosing context. The two‐character register namespace of AT&T troff
is confining and mnemonically challenging; you may wish to use groff's
more capacious namespace. However, attempting “.nr _my_saved_C \n(.C”
will not work in compatibility mode; the register name is too long.
“This is exactly what .do is for,” you think, “.do nr _my_saved_C
\n(.C”. The foregoing will always save zero to your register, because
.do turns compatibility mode off while it interprets its argument list.
What you need is:
.do nr _my_saved_C \n[.cp]
.cp 0
at the beginning of your file, followed by
.cp _my_saved_C
at the end. As in the C language, we all have to share one big
namespace, so choose a register name that is unlikely to collide with
other uses.
* src/roff/troff/input.cpp (do_request, init_input_requests): Implement
it.
* doc/groff.texi:
* man/groff.7.man:
* man/groff_diff.7.man: Document it.
* src/roff/groff/groff.am:
* src/roff/groff/tests/dot-cp_register_works.sh: Test it.
Enables a fix for <https://savannah.gnu.org/bugs/index.php?58162>.
Thanks to John Gardner and Ingo Schwarze for the discussion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rename section from "Incompatibilities" to "Implementation Differences"
to match Texinfo manual.
Drop subsection heading "groff language". It wasn't doing much real
work, as the only other subsection, "Intermediate output", is not very
developed (and contains some stale forward-looking comments).
The synchrony was not slavish. I have the following observations:
* The term "groff" is used in man pages; the Texinfo manual uses "GNU
troff". (Interestingly, "GNU" is never wrapped in an @acronym{} macro
despite the relentless consistency of its application to other
acronyms, and even initialisms that are not pronounceable words--i.e.,
non-acronyms.)
* The man pages use the term "roff" to refer to the family of
languages devised at Bell Labs in descent from Jerome Saltzer's
"runoff"; the Texinfo manual does not follow this practice.
* Organizational distinctions are retained. The Texinfo manual arranges
material about requests and escapes thematically by function; the man
pages tend to organize such material lexicographically by syntactical
category.
* Different quotation conventions arise from Texinfo's use of semantic
markup and assumption of the availability of different font families
versus man pages' limitation to one font family and three face styles.
* Similarly, in man pages, references to roff requests and escapes tend
to be prefixed with the appropriate sigil, and string and number
registers by the syntactic expression used to dereference them. In
Texinfo the former are generally "naked", marked up only with @code{}.
@samp{}s or examples are used for multi-term expressions, however.
* Texinfo supports footnotes and man pages don't. Parenthetical asides
are used in man pages instead.
My preference would be to migrate the Texinfo manual to the established
man page conventions for the first two items and leave the rest alone.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As an experiment, here's a word diff of changed sentences. I didn't
touch much--mainly minor wording changes, consistent use of the Oxford
comma, and hauled a sentence over from the corresponding material in
groff_diff(7).
I also amended this commit to change "TTY" to "terminal", and remove the
phrase "for more information" after cross-references; I find it
redundant.
----
AT&T 'troff' also interprets '\*[' [-or-] {+and+} '\n[' as a reference
to a string or number [-register-] {+register, respectively,+} called
'['.
For example, [-the-] {+this+} code produces bold output in both
cases, but the text [-differs:-] {+differs.+}
GNU 'troff' does not allow the use of the escape sequences '\|', '\^',
'\&', '\{', '\}', '\<SP>', '\'', '\`', '\-', '\_', '\!', '\%', and '\c'
in names of strings, macros, diversions, number registers, [-fonts-]
{+fonts,+} or environments; AT&T 'troff' does.
Macros, [-diversions-] {+diversions,+} and strings are all, in fact, the
same type of object; they contain lists of input characters and glyph
nodes in any combination. {+Special characters can be both: before
being added to the output, they act as input entities; afterwards, they
denote glyphs.+}
[-For-] {+The following+} example,
.di x
\\\\
.br
.di
[-.x-]
{+.x,+}
To [-store, for some reason,-] {+store+} an escape sequence in a
diversion that is interpreted when the diversion is reread, either use
the traditional '\!' transparent output facility, or, if this is
unsuitable, the new '\?' escape sequence.
(2) Naturally, if you've changed the escape character, you need to
prefix the 'e' with whatever it is--and you'll {+likely+} get something
other than a backslash in the output.
|
|
|
|
|
|
|
|
| |
* doc/groff.texi:
* man/groff_diff.7.man: Syncronize these documents with each other with
respect to the recent \sNN change. I hadn't realized until now how
closely the respective portions of the groff_diff(7) man page and the
Texinfo manual mirror each other. Follow the parallelism.
|
|
|
|
|
| |
...when we're done practicing equation-fu. Otherwise, dollar signs used
later in inline text lead to surprising results.
|
|
|
|
|
|
|
|
| |
Texinfo 5.0 supports the Latin-1 characters the document uses (and
others besides). Possibly earlier versions of Texinfo do as well, but
as 5.0 is now the minimum requirement, I didn't look beyond that.
Also make minor update to old ChangeLog entry.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Always refer to historical troff as "AT&T troff" instead of "Unix
troff". After literally years of wondering about this, I've decided
this is the most economical and precise way to refer what we generally
mean by what is documented in CSTR #54.
* Note that some GNU extensions have been adopted by other (t)roffs.
* Use Texinfo @samp{} for very short code snippets instead of setting
them in example displays. They take up less room this way.
* Clarify parsing limitations in compatibility mode: you get one or two
characters in names.
* Recast sentence to avoid implying that -C does additional things that
other ways of entering compatibility mode don't.
* Use Texinfo @result{} more in examples. Use it more than once to
compactly represent compatibility mode differences (with @r to comment
on the distinction).
* Elevate "\(rs" out of a footnote. It's more widely supported than
when this material was (I suspect) first written.
* Bracket the whole subsection with @codequotebacktick
@codequoteundirected on after checking that this won't cause any
misrenderings.
* Make several smaller tweaks to wording to tighten it or make it more
idiomatic (in my opinion).
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/groff.texi:
* man/groff_diff.7.man: Rewrite description of .do request, and
replace example with a more illustrative one.
* man/groff.7.man: Rewrite description of .do request briefly.
Also I'd like to again register a complaint about the page-private
macros in groff(7). Their days are numbered...
|
|
|
|
| |
This should have been part of c59015a24f1dd6056a403ab40456c99b9a51e0c6.
|
|
|
|
| |
Update version number in toc.html.
|
|
|
|
| |
Update BUGS file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The .C register cannot be manipulated manually.
$ ./build/test-groff -Tutf8
.nr .C 1
troff: backtrace: file '<standard input>':1
troff: <standard input>:1: error: can't write read-only register
This has been true since 1991.
^351da0dc troff/input.c (James Clark 1991-06-02 04:20:34 -0500 8302)
number_reg_dictionary.define(".C",
new constant_int_reg(&compatible_flag));
|
|
|
|
| |
* src/roff/groff/tests/smoke-test_html_device.sh: Simplify charmap test.
|
|
|
|
|
|
|
|
|
|
| |
1. Drop documentation of \s(nn and \s±(nn forms. They're in CSTR #54.
2. In the \s[] and \s'' forms, set the ± in italics, not bold. It's
parametric, not literal, input.
3. Add paragraph to incompatibilities section regarding the handling of
\sN and compatibility mode.
|
|
|
|
|
| |
* src/roff/groff/tests/smoke-test_html_device.sh: Skip the test if the
environment doesn't support UTF-8 (according to 'locale -k charmap').
|
|
|
|
|
|
|
|
|
|
| |
* src/roff/nroff/tests/verbose_option_works.sh.in: Rename to...
* src/roff/nroff/tests/verbose_option_works.sh: ...this. Since we no
longer use @GROFF_BIN_PATH_SETUP@, there is no longer any content
dependent on the build environment.
* src/roff/nroff/nroff.am: Stop generating the above test script. It
can now be run as it ships.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/roff/nroff/nroff.sh: Let test cases tell us to use test-groff as
groff with an environment variable.
* src/roff/nroff/tests/verbose_option_works.sh.in: Refactor. Stop
messing with @GROFF_BIN_PATH_SETUP@; instead, let test-groff handle
that for us. Locate it and export the variable GROFF_TEST_GROFF so
nroff can find it. Because we manipulate $PATH to run the tests, the
$PATH of an installed groff system will _always_ differ from that used
by a build tree; ignore it in the test cases. Dispose of bashisms and
set shebang to /bin/sh.
I have more confidence in the test script now. Does anyone else?
$ cat build/src/roff/nroff/tests/verbose_option_works.sh.log
nroff: 1.22.4.169-e44b5
groff: 1.22.4.169-e44b5
testing 'nroff -V'
test-groff -Tascii -mtty-char
testing 'nroff -V 1'
test-groff -Tascii -mtty-char 1
testing 'nroff -V "1a 1b"'
test-groff -Tascii -mtty-char "1a 1b"
testing 'nroff -V "1a 1b" 2'
test-groff -Tascii -mtty-char "1a 1b" 2
testing 'nroff -V 1a\"1b 2'
test-groff -Tascii -mtty-char 1a"1b 2
PASS src/roff/nroff/tests/verbose_option_works.sh (exit status: 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note that this commit will likely lead to a failing test case (but
perhaps not, if your build environment lacks a system groff).
It's too easy for the nroff version to get desynced from the groff
version when we're running test cases, leading to spurious results.
Make it easier to see a discrepancy.
* src/roff/nroff/nroff.sh: Call groff with -v or --version when we are
called that way.
* src/roff/nroff/tests/verbose_option_works.sh.in: Check the nroff
version being tested against the groff version being wrapped. This
exposes a bug; the system groff rather than the build tree groff was
being invoked.
Also delete an old comment in nroff.sh. The file uses the Stephen
Bourne "brace style" now, so the issue is unlikely to recur.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
groff has its own implementation of the standard C library's assert()
macro. It hasn't been updated since C89. C99 requires that the
diagnostic emitted by assert() contain the failing expression and name
of the function in scope.
* src/include/assert.h: Add additional pointer to const char arguments
to do_assert() and assertion_failed() for function name and
stringified expression.
(assertion_failed): Update prototype.
(do_assert): Accept 'func' and 'msg' parameters and pass them to
assertion_failed().
(assert): Update macro to collect '__func__' and stringify the expr
parameter (as 'msg') and pass them do do_assert().
* src/libs/libgroff/assert.cpp (assertion_failed): Rewrite diagnostic to
more closely match GNU Coding Style format and also report function
and failing expression.
Example output:
troff: ../src/roff/troff/input.cpp:2644: do_request(): assertion
failed: '0 == "But first, here's a rotten old BBC programme."'
We have no excuse to assert(0) ever again. Express the invariant that
has been violated.
|
| |
|
|
|
|
|
|
|
|
| |
* src/roff/groff/tests/smoke-test_html_device.sh: Set LC_CTYPE=C.UTF-8
so that byte sequences in the pipelines are handled correctly. Thanks
to Bjarni Ingi Gislason for the trouble report.
Fixes <https://savannah.gnu.org/bugs/?58164>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use .do so we correctly load unicode.tmac in compatibility mode.
Fixes the following problem (wrapped, filenames abbreviated):
$ echo | ./build/test-groff -C -Thtml >/dev/null
troff: backtrace: file '.../groff/build/../tmac/html.tmac':546
troff: backtrace: file '.../groff/build/../tmac/troffrc':30
troff: .../groff/build/../tmac/html.tmac:546: warning: macro
'ms' not defined
Look at that pretty backtrace! :)
|
|
|
|
|
| |
* src/roff/groff/tests/smoke-test_html_device.sh:
* src/roff/groff/groff.am: Add regression test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/roff/groff/tests/regression_savannah_58153.sh:
* src/roff/groff/tests/\
use_point_size_escape_with_single_digit_arg.sh: Use "set -e" to ensure
that multi-test script files don't hide problems. There are arguments
against "set -e" (and you can ask Greg Wooledge for all of them), but
I'm so used to it from years of writing Debian package maintainer
scripts that I feel comfortable with it. It is less verbose than
several alternatives (especially having one test script per case).
* src/roff/groff/tests/string_case_xform_unicode_escape.sh: Update with
respect to new failure output (in a comment only, since this is an
XFAIL test).
* tmac/tests/an-old_AT_and_UC_footer_saved_and_restored.sh: Drop
unnecessary "|| exit 1" from end of script. Incidentally, this script
illustrates an alternative to "set -e".
Also fix some test case text.
|
| |
|
|
|
|
|
|
| |
* ChangeLog: Explain root-clause analysis more completely.
* src/roff/troff/input.cpp: Use same brief-scope variable names as
earlier code for better continuity.
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/groff.texi (.spreadwarn):
* man/groff.7.man (.spreadwarn):
* man/groff_diff.7.man (.spreadwarn):
Recast a lot of wording, some based on suggestions from Dave Kemper.
Make more prominent the fact that spreading only applies to adjustment
mode 'b'. Document warning type used.
Fixes half of Savannah #58035.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change '\n[.$]' from a constant to a variable in a macro.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
This change has no effect on the page output, but is more correct per
§5.21.1 ("Copy-in Mode") of the groff Texinfo manual.
Fixes Savannah #58143.
Reviewed-by: G. Branden Robinson <g.branden.robinson@gmail.com>
|
|
|
|
|
| |
Texinfo 5.0 at long last broke the shackles of hideous and misleading
apstrophe/quote glyphs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* m4/groff.m4 (GROFF_MAKEINFO): Check for version 5.0 (increased from
4.8). Update diagnostics and comments.
* INSTALL.extra:
* README:
* doc/groff.texi:
* doc/webpage.ms: Document updated requirement.
* doc/fixinfo.sh: Delete; it is no longer necessary to work around
Texinfo 4.x bugs.
* doc/doc.am (EXTRA_DIST): Stop shipping fixinfo.sh.
(.texi.html): Remove makeinfo < 5.0 version check and consequent
execution of fixinfo.sh. Update comment.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enable backtracing across process/file boundaries when errors or
non-ignored warnings are encountered.
Experimentation reveals that .so, .mso, and .pso requests act as
barriers to backtracing except when explicitly requested with the
.backtrace request. Judging by the git history, this behavior dates
back to June 1991 or earlier. This did not appear to be the intention
according to a comment, which was only to suppress the output of
backtrace output for the line corresponding to the top level itself.
Unfortunately, that was not its only effect.
This change does result in one additional line of output when -b is
given and an error or (non-ignored) warning happens at the top level.
However, I regard this as unobjectionable because (1) a backtrace was in
fact explicitly requested; and (2) it seems a poor tradeoff to suppress
most of the backtrace in all complicated and frustrating cases for the
sake of one fewer line of backtrace output in a trivial one.
Now, backtracing behaves the same no matter what triggers it.
Fixes Savannah #58153.
* src/roff/troff/input.cpp (file_iterator::backtrace): Call
get_location() for its side effect of rewriting a filename of "-" to
"<standard input>", for consistency with other diagnostic messages.
(In this class, this member function always returns 1, so ignore the
return value.)
(input_stack::backtrace): Replace member function body with that
of input_stack::backtrace_all().
(input_stack::backtrace_all): Delete.
(backtrace_request): Update the only call site of the above.
* src/roff/groff/tests/regression_savannah_58153.sh:
* src/roff/groff/groff.am: Add regression test.
* src/roff/groff/tests/string_case_xform_errors.sh: Update regression
test to not be confounded by additional line of backtrace output.
Remove bashism along the way.
* doc/groff.texi:
* man/groff.7.man:
* man/groff_diff.7.man: Update documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/roff/troff/input.cpp (string_iterator::backtrace): Prefix the
output with the program name if it is known. In a deviation from the
GNU Coding Standards, put the string "backtrace:" immediately next
instead of the file and line number; this is because, particularly in
cases where the backtrace is most interesting or needed, it will
produce multiple lines of output and the common prefix aids visual
understanding.
(file_iterator::backtrace): As above; also, change prefix for popened
nodes in the iterator from "process" to "pipe". This seemed
preferable to omitting the information entirely or using an
inscrutable sigil like 'f' or 'p'. The advantage is that the output
is better aligned--better ergonomics for those who have to cope with a
lot of it. Furthermore, output the filename only once.
Example of old and new output:
/tmp/inner:2: backtrace: file '/tmp/inner'
echo .so /tmp/inner:1: backtrace: process 'echo .so /tmp/inner'
/tmp/outer:1: backtrace: file '/tmp/outer'
troff: backtrace: file '/tmp/inner':2
troff: backtrace: pipe 'echo .so /tmp/inner':1
troff: backtrace: file '/tmp/outer':1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function works only with device-specific basic units internally;
users likely think in terms of point size, so add the basic unit suffix
"u" to offer a hint about what's going on.
Example:
$ groff -ww >/dev/null
\s[10]A\s[-12]B
troff: <standard input>:1: warning: point-size escape results in
non-positive size -2000u; set to 1u
On a PostScript device with 1000 basic units to the point, the
difference is important and would be confusing without the unit
indication.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The documentation of the '\s±(N', '\s±[N]', and "\s±'N'" syntax forms
was rendering the '±' in the bold used to indicate literal input instead
of the italics used for parametric input. This is because those syntax
forms are unique to \s and the page-private macros that the page author
wrote in an apparent effort to "semantically lift" the page contents
were inadequate to express them.
My preference would be to ditch the page-private macros altogether but
that is a larger effort.
Note that in PostScript/PDF output, an italicized '±' does not appear in
italics. I assume that is because it is drawn from the "symbol font" S,
which lacks styling. This is not a regression; none of the existing '±'
glyphs in italic context render italicized or slanted either. The
output now looks correct on terminals, however.
|
|
|
|
|
|
|
|
|
|
| |
The Latin abbreviation "e.g." is always succeeded by a comma in English
prose.
Many manuals, e.g., the Chicago Manual of Style, require this.
[One instance, in tbl(1), remains. I'm leaving it so it doesn't cause
merge conflicts with a rewrite I have in progress.]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Texinfo manual has long documented the request '.ps 0' as restoring
the previous point size (just as '\s0' or '.ps' with no argument does),
but this is incorrect, since groff 1.02 or earlier (June 1991), the
request has not actually worked this way. Instead, '.ps 0' sets the
point size to 1 basic unit (thought output drivers may clamp this to a
higher value). This behavior is consistent with Hierloom troff and,
per Ingo Schwarze, Plan 9 troff. (It is, however, not consistent with
neatroff.)
* doc/groff.texi (Changing Type Sizes):
+ Stop claiming that '.ps 0' works like '\s0'.
+ Note that the resulting (computed) point size, not the argument, is
clamped.
+ Note that it is non-positive, not negative, point sizes that are
clamped to 1u.
+ Add (forward) cross-reference to section where \n[.ps] is defined
since it is mentioned here.
+ Move explanation of special handling of zero argument to \s escape
description.
* man/groff.7.man: Explain .ps N independently of \s. Note clamping
behavior.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In compatibility mode, constructs like '\s1A' would get two diagnostics,
one regarding the bad digit and another about the ambiguous form.
src/roff/troff/input.cpp (read_size): Correctly brace 'else' block.
And GCC didn't even catch the misleading indentation. Shame.
"I warned you! I warned you, but did you listen to me? Oh no, you
knew, didn't you?"
-- Tim the 21b07d7b641d4572c4916d04069e18c8feba91cc Enchanter
src/roff/groff/tests/use_point_size_escape_with_single_digit_arg.sh:
Check that we get a diagnostic when relying on ambiguous form.
|
|
|
|
|
|
|
|
| |
Fix several occurences of "writing" when "form", "style", or "mode" is
meant.
De-editorialize reference to the unmatched-parenthesis escape style (I,
too, find it clunky, but this isn't the place).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recast language regarding acceptable inputs to \sN in compatibility
mode.
Regarding migration away from \sN, stop implying that \s(NN and \s[N]
are the only options.
Swap paragraph order to put the cross-reference to
fractional-point-size-supporting escapes immediately the previous and
before the detail about whether a point-size escape constitutes an input
token.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/roff/troff/input.cpp (read_size): Move special-case interpretation
of the '\sN' form of point-size escapes when 'N' is 1, 2, or 3 to
compatibility mode (groff -C) only, and throw error diagnostic with
suggestion for remedy if encountered.
Traditionally, '\s36A' is interpreted as "set point size to 36, then
emit 'A'". However, only values in the range 10-39 are handled
specially; '\s40A' is interpreted as a four-point "0A". This is
unlike anything else in *roff grammar; see \*, \$, \f, \F, \g, \k, \m,
\M, \n, \V, and \Y.
To anticipate objections: Why not throw only a warning? Because there
isn't a warning category for supported but ambiguous syntax (this
behavior of AT&T troff dates to 1976 but apparently was not documented
until 1992). Why not throw the error outside of compatibility mode
too? Because outside of compatibility mode we (now) have an
unambiguous parse.
Background: The Graphic Systems C/A/T phototypesetter (the original
device target for AT&T troff) only supported a few discrete point
sizes in the range 6..36, so Ossanna special-cased the parser to do
what the user must have meant. Kernighan warned of this in the 1992
revision of CSTR #54 (§2.3), and more recently, McIlroy referred to it
as a "living fossil".
See: https://lists.gnu.org/archive/html/groff/2020-03/msg00054.html
https://lists.gnu.org/archive/html/groff/2020-04/msg00002.html
https://lists.gnu.org/archive/html/groff/2020-04/msg00015.html
and follow-ups for discussion.
* NEWS: Advise users of behavior change and offer guidance.
* doc/groff.texi:
* man/groff.7.man: Document the restriction of special handling of
point-size arguments to '\s' to compatibility mode.
* src/roff/groff/groff.am:
* src/roff/groff/tests/use_point_size_escape_with_single_digit_arg.sh:
Add regression test.
|
|
|
|
|
| |
It's not the sign of escape argument that is the issue, but of the
point-size value computed as a result.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
src/roff/troff/input.cpp (read_size): Disclose context (point-size
escape intepretation) in diagnostic messages. When a "bad digit" is
encountered, describe it if possible. When a relative adjustment
results in a negative point size, report the computed value. Also
rename a variable for slightly more clarity ("bad" does not refer to all
bad parses, just some cases of bad digits), and update an insufficiently
generalized comment ("\s(00" is also an acceptable expression for
point-size zero).
Based on suggestions by Ingo Schwarze and Bjarni Ingi Gislason.
Tested with -ww on:
\s[1
\s'1
\s(1A\s(1\%\s4\s-6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I reverted my recent changes to this file because Ingo hates them and
emailed me to tell me so.
For fun, throw the following at nroff:
.pl 1v
\s
\sA
\s+
\s-
\s++
\s--
\s(+
\s(-
\s(++
\s(--
\s1
\s1x
\s[+
\s[-
\s[++]
\s[--]
\s
Every one of these is malformed but the current code (in its
now-reverted state) misses a few, and sometimes characters get eaten
(instead of sent to output) because of the lack of error-checking in
read_size(). Ingo was right that my fixes were incomplete (IMO
read_size() needs a refactor), but my changes caught more problems (with
a higher volume of diagnostics, admittedly).
I'll work on something else.
|
|
|
|
| |
This reverts commit f23fb69b7b1c6d30c2a3ca12ea871f42e4e3a61a.
|