Ingo Schwarze [Sat, 11 Dec 2010 14:40:51 +0000 (14:40 +0000)]
Make SYNOPSIS sections and code having .nr nS enabled
behave as if the whole code were wrapped in .Bk/.Ek,
i.e. keeping input lines together on output lines.
This is compatible with new groff behaviour and deviates
from historical groff.
Tweaked version of a patch sent by kristaps@ on July 16, 2010.
ok kristaps@ jmc@ sobrado@ millert@
Ingo Schwarze [Fri, 10 Dec 2010 20:58:56 +0000 (20:58 +0000)]
Abort endless loops during roff macro and string expansion.
For now, use the simplest conceivable approach, like groff does:
Just a fixed, ugly input stack limit.
"check it in" kristaps@
Allow quote macros (`Op', `Aq', `Bq', `Dq', `Pq', `Ql', `Qq', `Sq', and
`Brq') to have zero arguments without warning. This makes sense because
the multi-line quote macros (`Oo/Oc' etc.) allow zero children anyway.
Furthermore, the documentation doesn't state that they're required to
have children.
Remove `i' and `r' macro handlers. These macros, originally part of the
me package, aren't recognised by "groff -mandoc" so we don't need to do
so either. Discussed on tech@ with schwarze@.
While at it, remove references to `b' in man.7. As far as I know, this
was never supported anyway.
Tag an internal release, 1.10.7, that marks being in sync with OpenBSD's
changes these last months (less tbl). There are still some issues that
require thought, but this extends beyond synchronisation.
This WILL NOT be pushed to the main site; it's merely a logical tag so
that there's a common fall-back in future changes.
Note that the TODO file is NOT up to date. This is ok since the tag is
purely internal.
Import changes by schwarze@ and Jason McIntyre into manuals. These are
for the new libroff macros, the new libman macros, and for the sake of
general clarity.
Note that `ft' documentation is NOT included, as I've kept it in -man:
it's highly confusing to have it in roff.7 when it's not implemented for
both -man and -mdoc, as at least in theory, roff.7 should include only
macros recognised by BOTH formats.
Add support for `ft' macro found in groff(7). Based on a patch by
schwarze@, but without the -T[x]html handling, which structurally does
not work. Also add man.7 documentation (not in original patch).
My favourite: removing lots of code in favour of smaller, tighter code.
Merge patch by schwarze@ consolidating RB, BR, etc. into one function.
man_html.c already does this.
Track down a bug of empty `de XX' macros causing uncertain behaviour by
returning empty strings in roff_getstrn() instead of NULL. This caused
maddeningly irregular segfaults in the pod2man preamble for `de IX'.
But only on DEC alpha.
Also integrate the kinda-probably-safe assertion relaxation in term.c,
field-tested by schwarze@. This allows ALL [unpreprocessed] base and
xenocara manuals for all BSD systems to run without segfault.
Merge schwarze@'s changes allowing nested displays. Tweak the patch by
making sure output doesn't add a superfluous newline with the nested displays.
Also add a COMPATIBILITY note.
Rename a macro (DATESIZ) to be in line with OpenBSD (DATESIZE).
Ingo Schwarze [Thu, 2 Dec 2010 20:41:46 +0000 (20:41 +0000)]
Track the parser status both per file (file_status), such that
we can for example skip rendering on FATAL parsing errors,
and globally (exit_status), such that we know what to return.
Without this, following files produced no rendered output
once a single file suffered from a FATAL error.
Bug reported by kristaps@, fix by me.
Merge schwarze@'s changes to allow for user-defined strings. This
primarily adds a roff_userdef() function for parsing new defines and
modifies the look-up procedure.
NOTE: there is a bug hidden away in this update that causes an infinite
loop in some pages. The cause is for the moment unknown.
Make sure that the manual section defaults to `1' if it's unset. This
behaviour only happens if `Dt' isn't specified, which can be exhibited
by running mandoc -mdoc on a man manual.
Fix a subtle error in the new main.c where the parse type (mdoc/man) was
being inherited during the parse sequence, making pset() meaningless.
Make sure that the mdoc/man curp pointer is set for each parse from a
persistent object.
This flushes out an obscure error where `man' pages called with `mdoc'
will parse and segfault due to a missing title. Never happened earlier
because `mdoc' pages were guaranteed to have a prologue. Fix this
later.
Also document the new main.c functions. Please make sure these sort of
things are documented! Throw in some whitespace to make things a bit
more readable.
Merge restructuring of main.c code. This provided by schwarze@ and inspected
carefully by joerg@. Merge roff.h header for compilation's sake (this is not
yet implemented in roff.c.).
THIS IS A BUGGY CHECK-IN. The manual type is erroneously kept between runs
of the compiler. This is a known bug.
Ingo Schwarze [Tue, 30 Nov 2010 20:45:55 +0000 (20:45 +0000)]
Merge OpenBSD mdoc.7 rev. 1.56 and 1.57:
Define the terms "callable" and "parsed" with more precision.
Be more specific about what .Xo can be used for.
Be more specific about what "historic groff" refers to.
Explicitely mention the nine argument limit below COMPATIBILITY.
feedback and ok jmc@
mdoc_action.c is no more. Attic it and remove it from the Makefile.
Remove references to MDOC_ACTED (it was only assertions) and the pre-
and post-action functions.
Move `Sh' validation from mdoc_action.c. into mdoc_validate.c.
Surprisingly, both functions were doing pretty much the same thing.
Make sure that the changes incorporate the union of both.
Clarifying role of pre_pp (now pre_par), which was confusing me due to
its name. Added some more documentation just for clarity's sake. No
functional change.
Migrate action for `Rs' into mdoc_validate.c.
Remove superfluous in-line order_rs function.
Merge `Rs' validations {BLOCK, BODY} -> {BODY}.
Make invalid children of `Rs' raise an error but otherwise be allowed.
Ingo Schwarze [Fri, 29 Oct 2010 10:38:54 +0000 (10:38 +0000)]
Referring to terms explained in other manuals, always use .Xr.
Otherwise, hyperlinks can't be produced and people will likely
miss the additional information available.
Suggested by deraadt@.
Initial commit of cleaned-up validation code for -mdoc. Remove those
ugly CPP macros in favour of real functions. Enumerate areas of short-
term future cleanup, too.
Ingo Schwarze [Sat, 2 Oct 2010 15:15:55 +0000 (15:15 +0000)]
style cleanup, no functional change:
* make the initial maxvis/mmax calculation easier to understand
* where real, non-indexing casts happen, make them explicit
* avoid a few lint warnings that can easily be fixed
* remove one needless LINTED comment
"I like this" kristaps@
Unify mdoc and man enums and structs into mandoc.h. This is part of the
slow process of logically splitting formatting frontend and parser backend
without pollution.
Ingo Schwarze [Fri, 1 Oct 2010 21:51:13 +0000 (21:51 +0000)]
* need a space before .No even if it starts with a closing delimiter
* slightly simplify .Pf *_IGNDELIM code, and share part of it with .No
* do not let opening delimiters fall out of the front of .Ns (from kristaps@)
This fixes a few spacing issues in csh(1) and ksh(1).
OK kristaps@
Merge from OpenBSD right after 1.10.6; now back to full sync.
* mdoc.c: blank lines outside literal mode are more similar to .sp than .Pp
* backslashes do not terminate macros; partial revert of mdoc.c 1.164;
the intention of that commit is fully achieved in roff.c
* mdoc_term.c: no need to list the same prototype twice
* mdoc_validate.c: drop .Pp before .sp just like .Pp before .Pp
* fix off-by-one found by jsg@ with parfait, OpenBSD term_ps.c 1.12
ok kristaps@
If an explicit scope is still open at the end of an input file,
report an ERROR: We can still render the page by just closing
the open scope, but it is likely that information will be missing
or document structure mangled.
Before, man(7) only reported a WARNING (which is dangerous because
we cannot be sure rendering is correct) and mdoc(7) ran into FATAL
(which is too drastic, there is no reason not to show what we have).
"looks good" kristaps@
sync to OpenBSD:
note that IMPLEMENTATION NOTES is not used in OpenBSD
add missing comma in "sections 1, 6, & 8 only" below EXIT STATUS
below SEE ALSO, add an .Xr to man(1), and from man(7) to mdoc(7)
Big clean-up consolidating all punctuation opening/closing functions into
a single one. This makes code auditing easier and cuts down on
bytesize.
I also removed some NOSPACE clauses that were handled implicitly by the
punctuation itself, e.g., a NOSPACE prior to printing ')', which in
term.c has its leading whitespace automatically suppressed.
A `%T' invoked outside of `Rs' should not produce trailing punctuation.
This from a TODO entry. Also stripped the superfluous NOSPACE, which is
handled in term_word() or print_text() anyway.
When the HEAD of an .Nm block in the SYNOPSIS might be wider
than the column containing it, the TERMP_HANG flag is required,
but avoid the flag when we know that the HEAD is shorter,
because in that case, the flag might ruin the alignment.
Problem originally reported by jmc@, who also spotted a regression
in an earlier version of this patch.
Allow string lengths to account for escapes. Now all calls to calculate
column width in -Tascii, -Tpdf, and -Tps will account for "more real"
string lengths.
Remove last pod2man escapes. These render ok, although \*(-- renders as
O- because the underlying macro depends on \(*W, which a prior pod2man
preamble `tr' macro rewrites as "-". This is an error in groff as this
tramples on the real \(*W, or Greek omega.