As per schwarze@'s suggestions, roll back the refcount structure in
favour of a simpler shim for normalised data in the node allocation and
free routines. This removes the need to bump and copy references within
validator handlers, removes a pointer redirect, and also kills the
refcount structure itself. Data is assumed to "live" either in a
MDOC_BLOCK or MDOC_ELEM and is copied accordingly.
Drastically fix -T[x]html's handling of font-escape mode changes (i.e.,
using \fI or \fP). Now, using these modes will cause a font to be
rendered for each word; furthermore, setting mode within a word will do
the correct thing.
Second, make -man use real font tags (B, I, SMALL) to set its font
instead of using font modes and fix up the pre-macro unsetting of the
current mode.
This fixes how roff.7 wasn't validating (<P> closing out a font mode)
and has been checked against gcc.1 (more will come). I considered
failure to validate OUR manual to be a show-stopper for the up-coming
release.
Ingo Schwarze [Wed, 22 Dec 2010 23:53:55 +0000 (23:53 +0000)]
minor tweaks:
1. improve .Bl wording (from jmc@)
2. jmc@ noted that the .Mt default (the same as in groff) makes no sense,
and there is no better default we could use; thus, regard it as
implementation dependent and do not document it
3. fix formatting of one COMPATIBILITY note: move "and" out of .Sx
ok kristaps@, jmc@
Revert IGNPAR to a warning after clue-stick applied by schwarze@:
although technically-speaking a lost macro is an error (e.g.,
MANDOCERR_MACRO), casting out some extra whitespace (note, IGNPAR only
happens in conditions where whitespace already exists!) is hardly an
error matter.
Ingo Schwarze [Tue, 21 Dec 2010 01:46:44 +0000 (01:46 +0000)]
Sync to OpenBSD:
1) Now that growing buffers in main.c is safe, bring back the bugfix
distinguishing empty and undefined macros that was backed out in
the previous roff.c commit: `de' initializes to "", not to NULL.
2) Roff only interpolates \* strings when the leading backslash is
not escaped; using optimizations suggested by joerg@ and kristaps@.
ok kristaps@
Ingo Schwarze [Tue, 21 Dec 2010 01:22:03 +0000 (01:22 +0000)]
Sane behaviour for the growing of very small buffers:
Always grow at least to the minimum requested size.
Before this, a buffer of 1 byte was grown to 2 bytes,
which was too small and sometimes caused segfaults.
ok kristaps@
Fix list-type being clobbered by margins. Last default styles in place.
Added `Sx' to be default-italic (as in OpenBSD's cvsweb). Added `diag'
formatting, which had been lost.
Ingo Schwarze [Sun, 19 Dec 2010 12:11:42 +0000 (12:11 +0000)]
Handle .Bk the same way as groff 1.20.1:
.Bk without arguments defaults to -words.
.Bk with invalid arguments (including -lines) has no effect.
ok kristaps@
Ingo Schwarze [Sat, 18 Dec 2010 19:32:08 +0000 (19:32 +0000)]
Sync to the installed version in OpenBSD, excluding .ft documentation:
Be more careful to not confuse requests, macros and escape sequences.
Add more info at various places, including new SEE ALSO and HISTORY sections.
OK jmc@ kristaps@
Ingo Schwarze [Sat, 18 Dec 2010 19:12:00 +0000 (19:12 +0000)]
Sync to OpenBSD: More precise description of .Xo, and don't talk
about deprecation, because there are cases were choosing .Xo or
backslash line continuation is merely a matter of taste, not a
difference in readability, and well-used .Xo is even slightly
more portable.
OK jmc@
Significantly clean up Sh, Ss, SH, and SS handling in -Thtml. Now a
top-level DIV is used with only an H1 or H2 as the section header. This
makes manuals much more readable in lynx, less complicated, and
relegates left-margin widths to example.style.css.
Migrate `An' to use a pointer in its data, like everybody else. This is
the first step to having a simpler ref-counted system for "data"
associated with a node.
First, make `Pp' (next to `Sm') be allowed as the first element of a
`Bl' (before any `It' have been invoked). Next, have the existence of
either macro raise a warning, as it's technically not legal according to
mdoc.7.
Second, delete any `Pp' as the first element of a `Bl' (i.e., before an
`It') ONLY when -compact has not been specified. This matches with the
latest version of groff. This deletion happens prior to the above
check, so double-warnings will not be issued.
Remove `Pp' and `Lp' checks in front-ends to make sure we're not
printing as the first or last child of an `Ss' or `Sh': this is now
ensured within the validator.
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.