CVS log for mandoc/mdoc_validate.c

[BACK] Up to [cvsweb.bsd.lv] / mandoc

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.391 / (download) - annotate - [select for diffs], Wed Jun 8 16:31:46 2022 UTC (21 months, 2 weeks ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.390: +3 -2 lines
Diff to previous 1.390 (unified) to selected 1.250 (unified)

When looking for the next block to tag, we aren't interested in children
of the current block but really want the next block instead.  This fixes
a segfault reported by Evan Silberman <evan at jklol dot net> on bugs@.

Revision 1.390 / (download) - annotate - [select for diffs], Mon Oct 4 14:19:14 2021 UTC (2 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.389: +6 -7 lines
Diff to previous 1.389 (unified) to selected 1.250 (unified)

store the operating system name obtained from uname(3) in the adequate
struct together with similar state date rather than in a function-scope
static variable, such that it can be free(3)d in roff_man_free();
no functional change

Revision 1.389 / (download) - annotate - [select for diffs], Sun Jul 18 11:41:23 2021 UTC (2 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6
Changes since 1.388: +2 -2 lines
Diff to previous 1.388 (unified) to selected 1.250 (unified)

Support auto-tagging for ".It Va".

This combination is somewhat rare because few libraries expose so many
global variables that they need a list to enumerate them, but when the
idiom does occur, tagging the variable names is generally useful.
For example, this helps awk(1), dc(1), make(1), rc.subr(8), ...

Missing feature reported and patch reviewed, tested, and OK'ed by kn@.

Revision 1.388 / (download) - annotate - [select for diffs], Fri Oct 30 13:24:33 2020 UTC (3 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.387: +2 -2 lines
Diff to previous 1.387 (unified) to selected 1.250 (unified)

Promote section headers that can can be used unmodified as fragment
identifiers from TAG_WEAK to TAG_STRONG,
such that for example ...#DESCRIPTION always works.
Suggested by Aman Verma on the discuss@ list.

Revision 1.387 / (download) - annotate - [select for diffs], Sun Apr 26 21:41:07 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.386: +26 -2 lines
Diff to previous 1.386 (unified) to selected 1.250 (unified)

While we do not recommend the idiom ".Fl Fl long" for long options
because it is an abuse of semantic macros for device-specific
presentational effects, this idiom is so widespread that it makes
sense to convert it to the recommended ".Fl \-long" during the
validation phase.  For example, this improves HTML formatting
in pages where authors have used the dubious .Fl Fl.

Feature suggested by Steffen Nurpmeso <steffen at sdaoden dot eu>
on freebsd-hackers.

Revision 1.386 / (download) - annotate - [select for diffs], Fri Apr 24 12:02:33 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.385: +8 -2 lines
Diff to previous 1.385 (unified) to selected 1.250 (unified)

provide a STYLE message when mandoc knows the file name and the extension
disagrees with the section number given in the .Dt or .TH macro;
feature suggested and patch tested by jmc@

Revision 1.385 / (download) - annotate - [select for diffs], Sat Apr 18 20:40:10 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.384: +2 -2 lines
Diff to previous 1.384 (unified) to selected 1.250 (unified)

When a .Tg is attached to a paragraph, attach the permalink
to the first word, or the first few words if they are short.

Revision 1.384 / (download) - annotate - [select for diffs], Wed Apr 8 11:56:03 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.383: +3 -3 lines
Diff to previous 1.383 (unified) to selected 1.250 (unified)

Use a separate node->tag attribute rather than abusing the node->string
attribute for the purpose.  No functional change intended.
The purpose is to make it possible to later attach tags to text nodes.

Revision 1.383 / (download) - annotate - [select for diffs], Mon Apr 6 10:16:17 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.382: +41 -7 lines
Diff to previous 1.382 (unified) to selected 1.250 (unified)

Support manual tagging of .Pp, .Bd, .D1, .Dl, .Bl, and .It.
In HTML output, improve the logic for writing inside permalinks:
skip them when there is no child content or when there is a risk
that the children might contain flow content.

Revision 1.382 / (download) - annotate - [select for diffs], Thu Apr 2 15:04:36 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.381: +8 -4 lines
Diff to previous 1.381 (unified) to selected 1.250 (unified)

Copy tagged strings before marking hyphens as breakable.
For example, this makes ":tCo-processes" work in ksh(1).

Revision 1.381 / (download) - annotate - [select for diffs], Wed Apr 1 20:21:08 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.380: +38 -24 lines
Diff to previous 1.380 (unified) to selected 1.250 (unified)

Just like we are already doing it in HTML output, automatically tag
section and subsection headers in terminal output, too.  Even though
admittedly, commands like "/SEE" and "/   Subsec" work, too, there
is no downside, and besides, with the recent improvements in the
tagging framework, implementation cost is negligible.

Revision 1.380 / (download) - annotate - [select for diffs], Fri Mar 13 15:32:28 2020 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.379: +126 -74 lines
Diff to previous 1.379 (unified) to selected 1.250 (unified)

Split tagging into a validation part including prioritization
in tag.{h,c} and {mdoc,man}_validate.c
and into a formatting part including command line argument checking
in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c.

Immediate functional benefits include:
* Improved prioritization of automatic tags for .Em and .Sy.
* Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged.
* Explicit tagging of .Er and .Fl now works in HTML output.
* Automatic tagging of .IP and .TP now works in HTML output.
But mainly, this patch provides clean earth to build further improvements on.

Technical changes:
* Main program: Write a tag file for ASCII and UTF-8 output only.
* All formatters: There is no more need to delay writing the tags.
* mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection.
* HTML formatter: If available, use the "string" attribute as the tag.
* HTML formatter: New function to write permalinks, to reduce code duplication.

Style cleanup in the vicinity while here:
* mdoc(7) terminal formatter: To set up bold font for children,
defer to termp_bold_pre() rather than calling term_fontpush() manually.
* mdoc(7) terminal formatter: Garbage collect some duplicate functions.
* mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions.
* Where possible, use switch statements rather than if cascades.
* Get rid of some more Yoda notation.

The necessity for such changes was first discussed with kn@, but i didn't
bother him with a request to review the resulting -673/+782 line patch.

Revision 1.379 / (download) - annotate - [select for diffs], Thu Feb 27 21:43:44 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.378: +45 -6 lines
Diff to previous 1.378 (unified) to selected 1.250 (unified)

Fully support explicit tagging of .Sh and .Ss.
This fixes the offset of two lines in terminal output
and this improves HTML output by putting the id= attribute
and <a> element into the respective <h1> or <h2> element rather
than writing an additional <mark> element.

To that end, introduce node flags NODE_ID (to make the node a link
target, for example by writing an HTML id= attribute or by calling
tag_put()) and NODE_HREF (to make the node a link source, used only
in HTML output, used only to write an <a class="permalink"> element).

In particular:
* In the validator, generalize the concept of the "next node"
such that it also works before .Sh and .Ss.
* If the first argument of .Tg is empty, don't forget to complain
if there are additional arguments, which will be ignored.
* In the terminal formatter, support writing of explicit tags
for all kinds of nodes, not just for .Tg.
* In deroff(), allow nodes to have an explicit string representation
even when they aren't text nodes.  Use this for explicitly tagged
section headers.  Suprisingly, this is sufficient to make HTML
output work, without explicit code changes in the HTML formatter.
* In syntax tree output, display NODE_ID and NODE_HREF.

Revision 1.378 / (download) - annotate - [select for diffs], Thu Feb 27 01:43:52 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.377: +70 -86 lines
Diff to previous 1.377 (unified) to selected 1.250 (unified)

Introduce the concept of nodes that are semantically transparent:
they are skipped when looking for previous or following high-level
macros.  Examples include roff(7) .ft, .ll, and .ta, mdoc(7) .Sm
and .Tg, and man(7) .DT and .PD.  Use this concept for a variety
of improved decisions in various validators and formatters.

While here,
* remove a few const qualifiers on struct arguments that caused trouble;
* get rid of some more Yoda notation in the vicinity;
* and apply some other stylistic improvements in the vicinity.

I found this class of issues while considering .Tg patches from kn@.

Revision 1.377 / (download) - annotate - [select for diffs], Sun Jan 19 18:02:00 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.376: +39 -2 lines
Diff to previous 1.376 (unified) to selected 1.250 (unified)

Introduce a new mdoc(7) macro .Tg ("tag") to explicitly mark a place
as defining a term.  Please only use it when automatic tagging does
not work.  Manual page authors will not be required to add the new
macro; using it remains optional.  HTML output is still rudimentary
in this version and will be polished later.

Thanks to kn@ for reminding me that i have been considering since
BSDCan 2014 whether something like this might be useful.  Given
that possibilities of making automatic tagging better are running
out and there are still several situations where automatic tagging
cannot do the job, i think the time is now ripe.

Feedback and no objection from millert@; OK espie@ inoguchi@ kn@.

Revision 1.376 / (download) - annotate - [select for diffs], Sun Jan 19 16:44:50 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.375: +7 -8 lines
Diff to previous 1.375 (unified) to selected 1.250 (unified)

Align to the new, sane behaviour of the groff_mdoc(7) .Dd macro:
without an argument, use the empty string, and always concatenate
all arguments, no matter their number.
This allows reducing the number of arguments of mandoc_normdate()
and some other simplifications, at the same time polishing some
error messages by adding the name of the macro in question.

Revision 1.375 / (download) - annotate - [select for diffs], Fri Sep 13 19:26:46 2019 UTC (4 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.374: +12 -6 lines
Diff to previous 1.374 (unified) to selected 1.250 (unified)

Improve validation of function names:
1. Relax checking to accept function types of the form
"ret_type (fname)(args)" (suggested by Yuri Pankov <yuripv dot net>).
2. Tighten checking to require the closing parenthesis.

Revision 1.374 / (download) - annotate - [select for diffs], Thu Jun 27 15:07:30 2019 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.373: +4 -16 lines
Diff to previous 1.373 (unified) to selected 1.250 (unified)

Fix mandoc_normdate() and the way it is used.
In the past, it could return NULL but the calling code wasn't prepared
to handle that.  Make sure it always returns an allocated string.
While here, simplify the code by handling the "quick" attribute
inside mandoc_normdate() rather than at multiple callsites.

Triggered by deraadt@ pointing out
that snprintf(3) error handling was incomplete in time2a().

Revision 1.373 / (download) - annotate - [select for diffs], Wed Mar 13 18:29:18 2019 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.372: +3 -3 lines
Diff to previous 1.372 (unified) to selected 1.250 (unified)

Contrary to what the NetBSD attribute(3) manual page suggests,
using __dead instead of __attribute__((__noreturn__)) actually
hinders portability rather than helping it.

Given that mandoc already uses __attribute__ in several files
and that in the portable version, ./configure already contains
rudimentary support for ignoring it on platforms that do not
support it, use __attribute__ directly.

This is expected to fix build failures that Stephen Gregoratto
<dev at sgregoratto dot me> reported from Arch and Debian Linux.

Revision 1.372 / (download) - annotate - [select for diffs], Mon Mar 11 13:21:11 2019 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.371: +3 -3 lines
Diff to previous 1.371 (unified) to selected 1.250 (unified)

mark check_abort() and post_abort() as __dead;
based on a patch by Christos@ Zoulas at NetBSD

Revision 1.371 / (download) - annotate - [select for diffs], Mon Mar 4 13:01:57 2019 UTC (5 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.370: +14 -40 lines
Diff to previous 1.370 (unified) to selected 1.250 (unified)

When the -S option is given to man(1) and the requested manual page
name is not found and the requested architecture is unknown, complain
about the architecture rather than about the manual page name:

$ man -S vax cpu
man: Unknown architecture "vax".
$ man -S sparc64 foobar
man: No entry for foobar in the manual.

Friendlier error message suggested by jmc@, who also OK'ed the patch.

Revision 1.370 / (download) - annotate - [select for diffs], Mon Mar 4 11:40:09 2019 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.369: +2 -2 lines
Diff to previous 1.369 (unified) to selected 1.250 (unified)

Fix the last straggler where the struct roff_node "line" member
was abused to detect an input line break;
instead, use the NODE_LINE flag to improve robustness.

Revision 1.369 / (download) - annotate - [select for diffs], Mon Dec 31 08:38:21 2018 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.368: +3 -5 lines
Diff to previous 1.368 (unified) to selected 1.250 (unified)

Use the new flag NODE_NOFILL in the validators, which is sometimes
simpler and always more robust.  In particular, move the nesting
warnings for .EX and .EE from man_state(), where they were misplaced,
to the man(7) validator.

Revision 1.368 / (download) - annotate - [select for diffs], Mon Dec 31 07:46:07 2018 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.367: +3 -3 lines
Diff to previous 1.367 (unified) to selected 1.250 (unified)

Cleanup, no functional change:
Use the new parser flag ROFF_NOFILL in the mdoc(7) parser, too,
instead of the old MDOC_LITERAL, which was an alias for the
former MAN_LITERAL.

Revision 1.367 / (download) - annotate - [select for diffs], Mon Dec 31 04:55:47 2018 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.366: +3 -3 lines
Diff to previous 1.366 (unified) to selected 1.250 (unified)

Cleanup, minus 15 LOC, no functional change:
Simplify the way the man(7) and mdoc(7) validators are called.
Reset the parser state with a common function before calling them.
There is no need to again reset the parser state afterwards,
the parsers are no longer used after validation.
This allows getting rid of man_node_validate() and mdoc_node_validate()
as separate functions.

Revision 1.366 / (download) - annotate - [select for diffs], Sun Dec 30 00:49:55 2018 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.365: +3 -3 lines
Diff to previous 1.365 (unified) to selected 1.250 (unified)

Cleanup, no functional change:

The struct roff_man used to be a bad mixture of internal parser
state and public parsing results.  Move the public results to the
parsing result struct roff_meta, which is already public.  Move the
rest of struct roff_man to the parser-internal header roff_int.h.

Since the validators need access to the parser state, call them
from the top level parser during mparse_result() rather than from
the main programs, also reducing code duplication.

This keeps parser internal state out of thee main programs (five
in mandoc portable) and out of eight formatters.

Revision 1.365 / (download) - annotate - [select for diffs], Fri Dec 14 05:18:02 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.364: +160 -225 lines
Diff to previous 1.364 (unified) to selected 1.250 (unified)

Almost mechanical diff to remove the "struct mparse *" argument
from mandoc_msg(), where it is no longer used.
While here, rename mandoc_vmsg() to mandoc_msg() and retire the
old version:  There is really no point in having another function
merely to save "%s" in a few places.
Minus 140 lines of code.

Revision 1.364 / (download) - annotate - [select for diffs], Tue Dec 4 02:53:51 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.363: +14 -41 lines
Diff to previous 1.363 (unified) to selected 1.250 (unified)

Clean up the validation of .Pp, .PP, .sp, and .br.  Make sure all
combinations are handled, and are handled in a systematic manner.
This resolves some erratic duplicate handling, handles a number of
missing cases, and improves diagnostics in various respects.

Move validation of .br and .sp to the roff validation module
rather than doing that twice in the mdoc and man validation modules.
Move the node relinking function to the roff library where it belongs.

In validation functions, only look at the node itself, at previous
nodes, and at descendants, not at following nodes or ancestors,
such that only nodes are inspected which are already validated.

Revision 1.363 / (download) - annotate - [select for diffs], Mon Dec 3 21:00:11 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.362: +43 -15 lines
Diff to previous 1.362 (unified) to selected 1.250 (unified)

In the validators, translate obsolete macro aliases (Lp, Ot, LP, P)
to the standard forms (Pp, Ft, PP) up front, such that later code
does not need to look for the obsolete versions.
This reduces the risk of incomplete handling.

Revision 1.362 / (download) - annotate - [select for diffs], Fri Aug 17 20:33:38 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.361: +2 -2 lines
Diff to previous 1.361 (unified) to selected 1.250 (unified)

Remove more pointer arithmetic passing via regions outside the array
that is undefined according to the C standard.  Robert Elz <kre at
munnari dot oz dot au> pointed out i wasn't quite done yet.

Revision 1.361 / (download) - annotate - [select for diffs], Thu Aug 16 15:05:34 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.360: +3 -4 lines
Diff to previous 1.360 (unified) to selected 1.250 (unified)

Do not calculate a pointer to a memory location before the beginning of
a static array.  Christos Zoulas, Robert Elz, and Andreas Gustafsson
point out that is undefined behaviour by the C standard even if we
never access the pointer.

Revision 1.360 / (download) - annotate - [select for diffs], Wed Aug 1 16:00:58 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4
Changes since 1.359: +2 -3 lines
Diff to previous 1.359 (unified) to selected 1.250 (unified)

Fix an off-by-one string read access that could happen if an empty
string argument preceded a string argument beginning with "--".
Found by Leah Neukirchen <leah at vuxu dot org> with -Wpointer-compare.

Revision 1.359 / (download) - annotate - [select for diffs], Wed Aug 1 13:46:15 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.358: +2 -2 lines
Diff to previous 1.358 (unified) to selected 1.250 (unified)

Avoid a read access one byte beyond the end of an allocated string
which occurred in situations like ".Fl a Cm --"; found by
Leah Neukirchen <leah at vuxu dot org> with valgrind on Void Linux.

Revision 1.358 / (download) - annotate - [select for diffs], Wed Apr 11 17:11:13 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.357: +6 -3 lines
Diff to previous 1.357 (unified) to selected 1.250 (unified)

preserve comments before .Dd when converting mdoc(7) to man(7)
with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>

Revision 1.357 / (download) - annotate - [select for diffs], Thu Apr 5 09:17:26 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.356: +3 -3 lines
Diff to previous 1.356 (unified) to selected 1.250 (unified)

use the portable \(lq and \(rq internally rather than \(Lq and \(Rq

Revision 1.356 / (download) - annotate - [select for diffs], Fri Mar 16 20:41:41 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.355: +3 -2 lines
Diff to previous 1.355 (unified) to selected 1.250 (unified)

Ouch, fix previous:  In the edge case of a single-character string
containing nothing but a single hyphen, the pointer got incremented
twice at one point, causing a read overrun found by naddy@.

Revision 1.355 / (download) - annotate - [select for diffs], Fri Mar 16 15:05:44 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.354: +66 -9 lines
Diff to previous 1.354 (unified) to selected 1.250 (unified)

Style message about bad input encoding of em-dashes as -- instead of \(em.
Suggested by Thomas Klausner <wiz at NetBSD>; discussed with jmc@.

Revision 1.354 / (download) - annotate - [select for diffs], Tue Feb 6 16:29:57 2018 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.353: +9 -10 lines
Diff to previous 1.353 (unified) to selected 1.250 (unified)

Delete the "no blank before trailing delimiter" check from the
partial explicit macros.  Leah Neukirchen <leah at vuxu dot org>
rightfully points out that the check makes no sense for these macros.

Revision 1.353 / (download) - annotate - [select for diffs], Tue Sep 12 18:21:03 2017 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.352: +5 -2 lines
Diff to previous 1.352 (unified) to selected 1.250 (unified)

Do not segfault when there are two .Dt macros, the first without
an architecture argument and the second with an invalid one.
Bug found by jsg@ with afl(1).

Revision 1.352 / (download) - annotate - [select for diffs], Wed Aug 2 13:29:04 2017 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3
Changes since 1.351: +3 -6 lines
Diff to previous 1.351 (unified) to selected 1.250 (unified)

No longer use names that only occur in the SYNOPSIS section as names
for man(1) lookup.  For OpenBSD base and Xenocara, that functionality
was never intended to be required, and i just fixed the last handful
of offenders using it - not counting the horribly ill-designed
interfaces engine(3) and lh_new(3) which are impossible to properly
document in the first place.

Of course, apropos(1) and whatis(1) continue to use SYNOPSIS .Nm,
.Fn, and .Fo macros, so "man -k ENGINE_get_load_privkey_function"
still works.

This change also gets rid of a few bogus warnings "cross reference
to self" which actually are *not* to self, like in yp(8).

This former functionality was intended to help third-party software
in the ports tree and on non-OpenBSD systems containing manual pages
with incomplete or corrupt NAME sections.  But it turned out it did
more harm than good, and caused more confusion than relief,
specifically for third party manuals and for maintainers of
mandoc-portable on other operating systems.  So kill it.
Problems reported, among others, by Yuri Pankov (illumos).

OK jmc@

Revision 1.351 / (download) - annotate - [select for diffs], Mon Jul 31 15:19:06 2017 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.350: +2 -2 lines
Diff to previous 1.350 (unified) to selected 1.250 (unified)

Fix an out of bounds read access to a constant array that caused
segfaults on certain hardened versions of glibc.  Triggered by .sp
or blank lines right before .SS or .SH, or before the first .Sh.
Found the hard way by Dr. Markus Waldner on Debian
and by Leah Neukirchen on Void Linux.

Revision 1.350 / (download) - annotate - [select for diffs], Thu Jul 20 12:54:02 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_2
Changes since 1.349: +16 -1 lines
Diff to previous 1.349 (unified) to selected 1.250 (unified)

correctly handle letters in .Nx arguments; improves for example
getpgid(2), ac(8), ldconfig(8), mount_ffs(8), sa(8), ttyflags(8), ...

Revision 1.349 / (download) - annotate - [select for diffs], Sat Jul 15 16:40:29 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.348: +6 -5 lines
Diff to previous 1.348 (unified) to selected 1.250 (unified)

If -column, -diag, -inset, -item, or -ohang lists have a -width,
don't just talk about ignoring it, actually do ignore it.
No change for terminal output, improves HTML output.

Revision 1.348 / (download) - annotate - [select for diffs], Mon Jul 3 17:33:06 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.347: +95 -49 lines
Diff to previous 1.347 (unified) to selected 1.250 (unified)

report trailing delimiters after macros where they are usually a mistake;
the idea came up in a discussion with Thomas Klausner <wiz at NetBSD>

Revision 1.347 / (download) - annotate - [select for diffs], Sun Jul 2 15:31:59 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.346: +13 -3 lines
Diff to previous 1.346 (unified) to selected 1.250 (unified)

add warning "cross reference to self"; inspired by mdoclint

Revision 1.346 / (download) - annotate - [select for diffs], Sat Jul 1 09:47:30 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.345: +6 -2 lines
Diff to previous 1.345 (unified) to selected 1.250 (unified)

Basic reporting of .Xrs to manual pages that don't exist
in the base system, inspired by mdoclint(1).

We are able to do this because (1) the -mdoc parser, the -Tlint validator,
and the man(1) manual page lookup code are all in the same program
and (2) the mandoc.db(5) database format allows fast lookup.

Feedback from, previous versions tested by, and OK jmc@.

A few features will be added to this in the tree, step by step.

Revision 1.345 / (download) - annotate - [select for diffs], Thu Jun 29 15:22:17 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.344: +20 -5 lines
Diff to previous 1.344 (unified) to selected 1.250 (unified)

warn about some non-portable idioms in .Bl -column;
triggered by a question from Yuri Pankov (illumos)

Revision 1.344 / (download) - annotate - [select for diffs], Tue Jun 27 12:18:00 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.343: +6 -3 lines
Diff to previous 1.343 (unified) to selected 1.250 (unified)

warn about .Ns macros that have no effect because they are followed
by an isolated closing delimiter; inspired by mdoclint

Revision 1.343 / (download) - annotate - [select for diffs], Sun Jun 25 17:43:45 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.342: +63 -2 lines
Diff to previous 1.342 (unified) to selected 1.250 (unified)

Catch typos in .Sh names; suggested by jmc@.

I'm using a very simple, linear time / zero space fuzzy string
matching heuristic rather than a full Levenshtein metric, to keep
the code both simple and fast.

Revision 1.342 / (download) - annotate - [select for diffs], Sat Jun 24 18:58:33 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.341: +40 -1 lines
Diff to previous 1.341 (unified) to selected 1.250 (unified)

operating system dependent message about unknown architecture;
inspired by mdoclint

Revision 1.341 / (download) - annotate - [select for diffs], Sat Jun 24 15:59:50 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.340: +8 -1 lines
Diff to previous 1.340 (unified) to selected 1.250 (unified)

in the base system, suggest leaving .Os blank; inspired by mdoclint

Revision 1.340 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:33 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.339: +21 -15 lines
Diff to previous 1.339 (unified) to selected 1.250 (unified)

Split -Wstyle into -Wstyle and the even lower -Wbase, and add
-Wopenbsd and -Wnetbsd to check conventions for the base system of
a specific operating system.  Mark operating system specific messages
with "(OpenBSD)" at the end.

Please use just "-Tlint" to check base system manuals (defaulting
to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the
manuals of portable software projects you maintain that are not
part of OpenBSD base, to avoid bogus recommendations about base
system conventions that do not apply.

Issue originally reported by semarie@, solution using
an idea from tedu@, discussed with jmc@ and jca@.

Revision 1.339 / (download) - annotate - [select for diffs], Sat Jun 17 22:43:14 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.338: +5 -2 lines
Diff to previous 1.338 (unified) to selected 1.250 (unified)

style message about missing RCS ids; inspired by mdoclint

Revision 1.338 / (download) - annotate - [select for diffs], Sun Jun 11 20:03:02 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.337: +2 -2 lines
Diff to previous 1.337 (unified) to selected 1.250 (unified)

ooops, fix a glitch in the previous commit...

Revision 1.337 / (download) - annotate - [select for diffs], Sun Jun 11 19:37:01 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.336: +28 -6 lines
Diff to previous 1.336 (unified) to selected 1.250 (unified)

Style message about legacy man(7) date format in mdoc(7) documents
and operating system dependent messages about missing or unexpected
Mdocdate; inspired by mdoclint(1).

Revision 1.336 / (download) - annotate - [select for diffs], Sun Jun 11 17:16:51 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.335: +25 -8 lines
Diff to previous 1.335 (unified) to selected 1.250 (unified)

style message about missing .Fn markup; inspired by mdoclint

Revision 1.335 / (download) - annotate - [select for diffs], Sun Jun 11 14:24:55 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.334: +4 -4 lines
Diff to previous 1.334 (unified) to selected 1.250 (unified)

Do not issue the message "no blank before trailing delimiter" for .No.
In practice, that message only matters inside .Bf, and even there, it
can occasionally be a false positive.  In all other cases, it usually
is a false positive, so it is better to drop it outright.
Suggested by jmc@.

Revision 1.334 / (download) - annotate - [select for diffs], Sat Jun 10 16:54:16 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.333: +76 -3 lines
Diff to previous 1.333 (unified) to selected 1.250 (unified)

Reduce false positives for the "no blank before trailing delimiter" message.
This brings us down to one false positive for about every 18 pages.

Revision 1.333 / (download) - annotate - [select for diffs], Sat Jun 10 01:48:53 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.332: +75 -39 lines
Diff to previous 1.332 (unified) to selected 1.250 (unified)

style message about missing blank before trailing delimiter;
inspired by mdoclint(1), and jmc@ considers it useful

Revision 1.332 / (download) - annotate - [select for diffs], Thu Jun 8 00:23:30 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.331: +4 -1 lines
Diff to previous 1.331 (unified) to selected 1.250 (unified)

warning about unknown .Lb arguments; inspired by mdoclint(1)

Revision 1.331 / (download) - annotate - [select for diffs], Wed Jun 7 23:29:48 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.330: +37 -3 lines
Diff to previous 1.330 (unified) to selected 1.250 (unified)

style checks related to .Er; inspired by mdoclint(1)

Revision 1.330 / (download) - annotate - [select for diffs], Thu Jun 1 15:25:39 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.329: +7 -1 lines
Diff to previous 1.329 (unified) to selected 1.250 (unified)

STYLE message about full stop at the end of .Nd; inspired by mdoclint(1)

Revision 1.329 / (download) - annotate - [select for diffs], Wed May 31 15:31:00 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.328: +33 -1 lines
Diff to previous 1.328 (unified) to selected 1.250 (unified)

STYLE message about missing use of Ox/Nx/Fx/Dx; OK jmc@ wiz@

Revision 1.328 / (download) - annotate - [select for diffs], Tue May 30 19:30:38 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.327: +14 -2 lines
Diff to previous 1.327 (unified) to selected 1.250 (unified)

STYLE message about useless macros we don't want (Bt Tn Ud);
not a WARNING because they don't endanger portability

Revision 1.327 / (download) - annotate - [select for diffs], Sun May 14 14:00:58 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.326: +2 -2 lines
Diff to previous 1.326 (unified) to selected 1.250 (unified)

warn about punctuation between .Xr and .Rs in SEE ALSO;
inspired by mdoclint

Revision 1.326 / (download) - annotate - [select for diffs], Fri May 5 15:17:32 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.325: +5 -5 lines
Diff to previous 1.325 (unified) to selected 1.250 (unified)

Move .sp to the roff modules.  Enough infrastructure is in place
now that this actually saves code: -70 LOC.

Revision 1.325 / (download) - annotate - [select for diffs], Fri May 5 13:17:55 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.324: +1 -2 lines
Diff to previous 1.324 (unified) to selected 1.250 (unified)

move .ll to the roff modules

Revision 1.324 / (download) - annotate - [select for diffs], Fri May 5 02:06:19 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.323: +3 -2 lines
Diff to previous 1.323 (unified) to selected 1.250 (unified)

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules.  As a side effect,
mdoc(7) now handles .ft, too.  Of course, do not use that.

Revision 1.323 / (download) - annotate - [select for diffs], Thu May 4 17:48:29 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.322: +18 -7 lines
Diff to previous 1.322 (unified) to selected 1.250 (unified)

Parser reorg:
Generate the first node on the roff level: .br
Fix some column numbers in diagnostic messages while here.

Revision 1.322 / (download) - annotate - [select for diffs], Sat Apr 29 12:45:42 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.321: +8 -8 lines
Diff to previous 1.321 (unified) to selected 1.250 (unified)

Parser unification: use nice ohashes for all three request and macro tables;
no functional change, minus two source files, minus 200 lines of code.

Revision 1.321 / (download) - annotate - [select for diffs], Fri Apr 28 16:25:11 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.320: +4 -1 lines
Diff to previous 1.320 (unified) to selected 1.250 (unified)

Delete .Pp right before the first .Sh and right before any .Ss,
and warn about it; mdoclint(1) does so, and it makes sense.

Revision 1.320 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:18 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.319: +37 -42 lines
Diff to previous 1.319 (unified) to selected 1.250 (unified)

Continue parser unification:
* Make enum rofft an internal interface as enum roff_tok in "roff.h".
* Represent mdoc and man macros in enum roff_tok.
* Make TOKEN_NONE a proper enum value and use it throughout.
* Put the prologue macros first in the macro tables.
* Unify mdoc_macroname[] and man_macroname[] into roff_name[].

Revision 1.319 / (download) - annotate - [select for diffs], Mon Mar 6 17:26:04 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.318: +5 -1 lines
Diff to previous 1.318 (unified) to selected 1.250 (unified)

Using .Nd only makes sense in the NAME section.
Warn if that macro occurs elsewhere.
Triggered by a question from Dag-Erling Smoergrav <des @ FreeBSD>.

Revision 1.318 / (download) - annotate - [select for diffs], Mon Feb 6 03:44:58 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1, VERSION_1_13
Changes since 1.317: +11 -1 lines
Diff to previous 1.317 (unified) to selected 1.250 (unified)

The .Nm macro does not only use the default name when it has no
argument, but also when the first argument is a child macro.
Arcane issue found in the FreeBSD cxgbetool(8) manual that Baptiste
Daroussin <bapt at FreeBSD> sent me long ago for a different reason.

While solving this, switch to the new technique of doing text
production in the validator, reducing code duplication in the
formatters, which also makes -Ttree output clearer.

Revision 1.317 / (download) - annotate - [select for diffs], Wed Jan 11 17:39:53 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.316: +188 -82 lines
Diff to previous 1.316 (unified) to selected 1.250 (unified)

Do text production for .Bt, .Ex, .Rv, .Ud at the validation stage
rather than in the formatters.  Use NODE_NOSRC flag for .Lb and
NODE_NOSRC and NODE_NOPRT for .St.  Results in a more rigorous
syntax tree and in 135 lines less code.

This work was triggered by a question from Abhinav Upadhyay <er dot
abhinav dot upadhyay at gmail dot com> (NetBSD) on discuss@.

Revision 1.316 / (download) - annotate - [select for diffs], Tue Jan 10 23:36:34 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.315: +46 -22 lines
Diff to previous 1.315 (unified) to selected 1.250 (unified)

Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.
More rigorous AST and 40 lines less code.

Revision 1.315 / (download) - annotate - [select for diffs], Tue Jan 10 21:59:47 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.314: +43 -7 lines
Diff to previous 1.314 (unified) to selected 1.250 (unified)

For the .Ux/.Ox family of macros, do text production at the validation
stage rather than in each and every individual formatter, using the
new NODE_NOSRC flag.  More rigorous and also ten lines less code.

Revision 1.314 / (download) - annotate - [select for diffs], Tue Jan 10 13:47:00 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.313: +4 -4 lines
Diff to previous 1.313 (unified) to selected 1.250 (unified)

unify names of AST node flags; no change of cpp output

Revision 1.313 / (download) - annotate - [select for diffs], Tue Jan 10 12:53:07 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.312: +16 -15 lines
Diff to previous 1.312 (unified) to selected 1.250 (unified)

Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.
Use them to mark generated nodes and nodes that shall not produce output.
Let -Ttree output mode display these new flags.
Use NODE_NOSRC for .Ar, .Mt, and .Pa default arguments.
Use NODE_NOPRT for .Dd, .Dt, and .Os.

These will help to make handling of text production macros more rigorous.

Revision 1.312 / (download) - annotate - [select for diffs], Sun Jan 8 02:01:17 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.311: +3 -2 lines
Diff to previous 1.311 (unified) to selected 1.250 (unified)

Tolerate bare tabs in SYNOPSIS .Cd for now.
It's used in half a dozen pages.
Even though i have been thinking about it for years,
i still can't suggest anything better.
The false positives are annoying.

Revision 1.311 / (download) - annotate - [select for diffs], Sun Jan 8 00:11:24 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.310: +19 -11 lines
Diff to previous 1.310 (unified) to selected 1.250 (unified)

Stricter validation of the NAME section, in particular:
- require a comma between names
- reject all other text nodes
- reject all empty Nm below NAME, not only in the leading position
- reject Nm after Nd

Revision 1.310 / (download) - annotate - [select for diffs], Wed Dec 28 17:34:18 2016 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.309: +19 -3 lines
Diff to previous 1.309 (unified) to selected 1.250 (unified)

Make the second, section number argument of .Xr mandatory.
In fact, we have been requiring it for many years.
The only reason to not warn when it was missing
was excessive traditionalism - it was optional in 4.4BSD.

Revision 1.309 / (download) - annotate - [select for diffs], Sun Oct 9 18:16:56 2016 UTC (7 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.308: +1 -82 lines
Diff to previous 1.308 (unified) to selected 1.250 (unified)

Delete complicated code dealing with .Bl -tag without -width,
and just let it default to -width 6n, which agrees with the
traditional -width Ds that is still in widespread use.

I just pushed a patch upstream to GNU roff that does the same for
groff_mdoc(7).  Before, groff contained code that was even more
complicated than mandoc, but both resulted in quite different
user-visible output.  Now, both agree, and output is nicer for both.

Useless complication noticed by Carsten Kunze (Heirloom roff).

Revision 1.308 / (download) - annotate - [select for diffs], Sat Aug 20 14:43:50 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.307: +34 -6 lines
Diff to previous 1.307 (unified) to selected 1.250 (unified)

If a column list starts with implicit rows (that is, rows without .It)
and roff-level nodes (e.g. tbl or eqn) follow, don't run into an
assertion.  Instead, wrap the roff-level nodes in their own row.
Issue found by tb@ with afl(1).

Revision 1.307 / (download) - annotate - [select for diffs], Thu Aug 11 11:39:46 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.306: +3 -2 lines
Diff to previous 1.306 (unified) to selected 1.250 (unified)

oops, fix stupid typo in previous

Revision 1.306 / (download) - annotate - [select for diffs], Thu Aug 11 10:47:16 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.305: +5 -4 lines
Diff to previous 1.305 (unified) to selected 1.250 (unified)

If a .Bd display is on the one hand doomed to be deleted because
it has no type, but is on the other hand breaking another block,
delete its end marker as well, or the end marker may remain behind
as an orphan, triggering an assertion in the terminal formatter.
Problem found by tb@ with afl(1).

Revision 1.305 / (download) - annotate - [select for diffs], Wed Aug 10 20:17:50 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.304: +8 -5 lines
Diff to previous 1.304 (unified) to selected 1.250 (unified)

Don't deref NULL if the only child of the first .Sh is an empty
in-line macro, and don't printf("%s", NULL) if the first child
of the first .Sh is a macro; again found by tb@ with afl(1).
(No, you should never use macros in any .Sh at all, please.)

Revision 1.304 / (download) - annotate - [select for diffs], Wed Aug 10 12:29:38 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.303: +4 -3 lines
Diff to previous 1.303 (unified) to selected 1.250 (unified)

Don't printf("%s", NULL) if .It has a macro as an argument
in a list of a type where items don't takes arguments.
Issue found by tb@ with afl(1).

Revision 1.303 / (download) - annotate - [select for diffs], Wed Aug 10 12:06:41 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.302: +2 -1 lines
Diff to previous 1.302 (unified) to selected 1.250 (unified)

When validating a .Bl list that defaults to -item for want of a type,
don't let a subsequent -width access mdoc_argnames[] out of bounds.
Found by tb@ with afl(1).

Revision 1.302 / (download) - annotate - [select for diffs], Tue Aug 9 15:09:27 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.301: +5 -4 lines
Diff to previous 1.301 (unified) to selected 1.250 (unified)

fix printf("%s", NULL);
found while investigating an unrelated bug report from jsg@

Revision 1.301 / (download) - annotate - [select for diffs], Fri Jan 8 17:48:09 2016 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.300: +12 -14 lines
Diff to previous 1.300 (unified) to selected 1.250 (unified)

Delete the redundant "nchild" member of struct roff_node, replacing
most uses by one, a few by two pointer checks, and only one by a
tiny loop - not only making data smaller, but code shorter as well.

This gets rid of an implicit invariant that confused both static
analysis tools and human auditors.  No functional change.

Revision 1.300 / (download) - annotate - [select for diffs], Fri Oct 30 19:04:16 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.299: +11 -1 lines
Diff to previous 1.299 (unified) to selected 1.250 (unified)

If a .Bd block has no arguments at all, drop the block and only keep
its contents.  Removing a gratuitious difference to groff output
found after a related bug report from krw@.

Revision 1.299 / (download) - annotate - [select for diffs], Wed Oct 21 23:51:11 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.298: +212 -242 lines
Diff to previous 1.298 (unified) to selected 1.250 (unified)

Move all mdoc(7) node validation done before child parsing
to the new separate validation pass, except for a tiny bit
needed by the parser which goes to the new mdoc_state() module;
cleaner, simpler, and surprisingly also shorter by 15 lines.

Revision 1.298 / (download) - annotate - [select for diffs], Tue Oct 20 02:01:32 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.297: +65 -130 lines
Diff to previous 1.297 (unified) to selected 1.250 (unified)

In order to become able to generate syntax tree nodes on the roff(7)
level, validation must be separated from parsing and rewinding.
This first big step moves calling of the mdoc(7) post_*() functions
out of the parser loop into their own mdoc_validate() pass, while
using a new mdoc_state() module to make syntax tree state handling
available to both the parser loop and the validation pass.

Revision 1.297 / (download) - annotate - [select for diffs], Mon Oct 19 20:04:10 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.296: +59 -56 lines
Diff to previous 1.296 (unified) to selected 1.250 (unified)

style cleanup, no functional change

Revision 1.296 / (download) - annotate - [select for diffs], Mon Oct 12 21:26:02 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.295: +1 -2 lines
Diff to previous 1.295 (unified) to selected 1.250 (unified)

Delete an assignment that is unconditionally overwritten two lines later;
found by Svyatoslav Mishyn <juef at openmailbox dot org>
with the clang static analyzer.

Revision 1.295 / (download) - annotate - [select for diffs], Mon Oct 12 00:08:16 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.294: +2 -23 lines
Diff to previous 1.294 (unified) to selected 1.250 (unified)

To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

Revision 1.294 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:19 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.293: +47 -47 lines
Diff to previous 1.293 (unified) to selected 1.250 (unified)

modernize style: "return" is not a function

Revision 1.293 / (download) - annotate - [select for diffs], Sat Sep 26 00:54:04 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.292: +1 -4 lines
Diff to previous 1.292 (unified) to selected 1.250 (unified)

/* NOTREACHED */ after abort() is silly, delete it

Revision 1.292 / (download) - annotate - [select for diffs], Mon Sep 14 15:36:14 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.291: +2 -25 lines
Diff to previous 1.291 (unified) to selected 1.250 (unified)

Remove the warning about children of .Vt blocks because actually,
.Vt type global_variable No = Dv defined_constant ;
is the best way to specify in the SYNOPSIS how a global variable
is initialized in the rare case where that matters.
Issue noticed by jmc@.

Revision 1.291 / (download) - annotate - [select for diffs], Thu Apr 23 16:17:44 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.290: +5 -5 lines
Diff to previous 1.290 (unified) to selected 1.250 (unified)

Unify mdoc_deroff() and man_deroff() into a common function deroff().
No functional change except that for mdoc(7), it now skips leading
escape sequences just like it already did for man(7).
Escape sequences rarely occur in mdoc(7) code and if they do,
skipping them is an improvement in this context.
Minus 30 lines of code.

Revision 1.290 / (download) - annotate - [select for diffs], Mon Apr 20 09:48:53 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.289: +3 -2 lines
Diff to previous 1.289 (unified) to selected 1.250 (unified)

Avoid out-of-bounds read access before the beginning of the
mdoc_macros[] array.  This sometimes prevented proper warnings
about text nodes preceding the first section header.

Revision 1.289 / (download) - annotate - [select for diffs], Sun Apr 19 14:25:41 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.288: +6 -6 lines
Diff to previous 1.288 (unified) to selected 1.250 (unified)

Unify some node handling functions that use TOKEN_NONE.
* mdoc_word_alloc(), man_word_alloc() -> roff_word_alloc()
* mdoc_word_append(), man_word_append() -> roff_word_append()
* mdoc_addspan(), man_addspan() -> roff_addtbl()
* mdoc_addeqn(), man_addeqn() -> roff_addeqn()
Minus 50 lines of code, no functional change.

Revision 1.288 / (download) - annotate - [select for diffs], Sun Apr 19 14:00:20 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.287: +3 -3 lines
Diff to previous 1.287 (unified) to selected 1.250 (unified)

Decouple the token code for "no request or macro" from the individual
high-level parsers to allow further unification of functions that
only need to recognize this code, but that don't care about different
high-level macrosets beyond that.

Revision 1.287 / (download) - annotate - [select for diffs], Sun Apr 19 13:50:26 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.286: +16 -15 lines
Diff to previous 1.286 (unified) to selected 1.250 (unified)

Unify node handling functions:
* node_alloc() for mdoc and man_node_alloc() -> roff_node_alloc()
* node_append() for mdoc and man_node_append() -> roff_node_append()
* mdoc_head_alloc() and man_head_alloc() -> roff_head_alloc()
* mdoc_body_alloc() and man_body_alloc() -> roff_body_alloc()
* mdoc_node_unlink() and man_node_unlink() -> roff_node_unlink()
* mdoc_node_free() and man_node_free() -> roff_node_free()
* mdoc_node_delete() and man_node_delete() -> roff_node_delete()
Minus 130 lines of code, no functional change.

Revision 1.286 / (download) - annotate - [select for diffs], Sat Apr 18 16:06:41 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.285: +15 -15 lines
Diff to previous 1.285 (unified) to selected 1.250 (unified)

Replace the structs mdoc and man by a unified struct roff_man.
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.

Revision 1.285 / (download) - annotate - [select for diffs], Thu Apr 2 22:48:17 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.284: +56 -56 lines
Diff to previous 1.284 (unified) to selected 1.250 (unified)

Second step towards parser unification:
Replace struct mdoc_node and struct man_node by a unified struct roff_node.
To be able to use the tok member for both mdoc(7) and man(7) without
defining all the macros in roff.h, sacrifice a tiny bit of type safety
and make tok an int rather than an enum.
Almost mechanical, no functional change.
Written on the Eurostar from Bruxelles to London on the way to p2k15.

Revision 1.284 / (download) - annotate - [select for diffs], Thu Apr 2 21:36:50 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.283: +50 -49 lines
Diff to previous 1.283 (unified) to selected 1.250 (unified)

First step towards parser unification:
Replace enum mdoc_type and enum man_type by a unified enum roff_type.
Almost mechanical, no functional change.
Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.

Revision 1.283 / (download) - annotate - [select for diffs], Mon Feb 23 13:55:55 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.282: +5 -1 lines
Diff to previous 1.282 (unified) to selected 1.250 (unified)

oops, in NAME, don't nag about the comma after .Nm

Revision 1.282 / (download) - annotate - [select for diffs], Mon Feb 23 13:31:04 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.281: +25 -25 lines
Diff to previous 1.281 (unified) to selected 1.250 (unified)

improve NAME section diagnostics;
confusing messages reported by Jan Stary <hans at stare dot cz>

Revision 1.281 / (download) - annotate - [select for diffs], Tue Feb 17 20:37:17 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.280: +2 -2 lines
Diff to previous 1.280 (unified) to selected 1.250 (unified)

Render \(lq and \(rq as '"' in -Tascii mode but leave the rendering
of .Do/.Dc, .Dq, .Lb, and .St untouched.
Reduces groff-mandoc differences in OpenBSD base by about 7%.
Reminded of the issue by naddy@.

Revision 1.280 / (download) - annotate - [select for diffs], Mon Feb 16 19:02:48 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.279: +41 -43 lines
Diff to previous 1.279 (unified) to selected 1.250 (unified)

clean up post_dt() validation function;
improved diagnostics, minus six lines of code

Revision 1.279 / (download) - annotate - [select for diffs], Sat Feb 14 13:23:57 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.278: +3 -2 lines
Diff to previous 1.278 (unified) to selected 1.250 (unified)

shut up about tabs in SYNOPSIS .Fd lines, there is no good way to avoid them

Revision 1.278 / (download) - annotate - [select for diffs], Thu Feb 12 12:24:33 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.277: +6 -40 lines
Diff to previous 1.277 (unified) to selected 1.250 (unified)

Delete the mdoc_node.pending pointer and the function calculating
it, make_pending(), which was the most difficult function of the
whole mdoc(7) parser.  After almost five years of maintaining this
hellhole, i just noticed the pointer isn't needed after all.

Blocks are always rewound in the reverse order they were opened;
that even holds for broken blocks.  Consequently, it is sufficient
to just mark broken blogs with the flag MDOC_BROKEN and breaking
blocks with the flag MDOC_ENDED.  When rewinding, instead of iterating
the pending pointers, just iterate from each broken block to its
parents, rewinding all that are MDOC_ENDED and stopping after
processing the first ancestor that it not MDOC_BROKEN.  For ENDBODY
markers, use the mdoc_node.body pointer in place of the former
mdoc_node.pending.

This also fixes an assertion failure found by jsg@ with afl,
test case #467 (Bo Bl It Bd Bc It), where (surprise surprise)
the pending pointer got corrupted.

Improved functionality, minus one function, minus one struct field,
minus 50 lines of code.

Revision 1.277 / (download) - annotate - [select for diffs], Tue Feb 10 08:05:30 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.276: +2 -2 lines
Diff to previous 1.276 (unified) to selected 1.250 (unified)

trim trailing white space, no code change;
from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux

Revision 1.276 / (download) - annotate - [select for diffs], Fri Feb 6 16:06:25 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.275: +3 -3 lines
Diff to previous 1.275 (unified) to selected 1.250 (unified)

replace the last legacy generic message type, "argument count wrong",
by more specific messages, improving diagnostics for .cc .tr .Bl -column

Revision 1.275 / (download) - annotate - [select for diffs], Fri Feb 6 07:13:14 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.274: +19 -81 lines
Diff to previous 1.274 (unified) to selected 1.250 (unified)

Delete the legacy generic warning type MANDOCERR_ARGCWARN,
replacing the last instances by more specific warnings.
Improved functionality, minus 50 lines of code.

Revision 1.274 / (download) - annotate - [select for diffs], Fri Feb 6 03:38:45 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.273: +22 -13 lines
Diff to previous 1.273 (unified) to selected 1.250 (unified)

better handle .Fo and .Fd without argument
better handle .Fo with more than one argument

Revision 1.273 / (download) - annotate - [select for diffs], Fri Feb 6 02:04:54 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.272: +45 -39 lines
Diff to previous 1.272 (unified) to selected 1.250 (unified)

better handle empty .Bd .Bl .D1 .Dl blocks

Revision 1.272 / (download) - annotate - [select for diffs], Fri Feb 6 01:07:22 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.271: +3 -11 lines
Diff to previous 1.271 (unified) to selected 1.250 (unified)

better handle .In .Sh .Ss .St .Xr without arguments

Revision 1.271 / (download) - annotate - [select for diffs], Thu Feb 5 01:46:56 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.270: +7 -5 lines
Diff to previous 1.270 (unified) to selected 1.250 (unified)

fix handling of empty .An macros

Revision 1.270 / (download) - annotate - [select for diffs], Wed Feb 4 22:30:10 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.269: +37 -36 lines
Diff to previous 1.269 (unified) to selected 1.250 (unified)

Discard excess head arguments for .Bd .Bl .Bk and delete hwarn_eq0().
Discard empty .Bk blocks.
Improve related diagnostics.

Revision 1.269 / (download) - annotate - [select for diffs], Wed Feb 4 19:20:12 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.268: +15 -11 lines
Diff to previous 1.268 (unified) to selected 1.250 (unified)

improve diagnostics regarding arguments of .An .Pp .Lp .br .sp
in particular, get rid of check_count(..., CHECK_EQ, 0)

Revision 1.268 / (download) - annotate - [select for diffs], Wed Feb 4 18:03:47 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.267: +34 -36 lines
Diff to previous 1.267 (unified) to selected 1.250 (unified)

discard .Rs head arguments and improve .Rs diagnostics

Revision 1.267 / (download) - annotate - [select for diffs], Wed Feb 4 16:38:56 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.266: +27 -25 lines
Diff to previous 1.266 (unified) to selected 1.250 (unified)

more specific .Nd diagnostics, allowing to get rid of enum check_lvl
and the respective argument of check_count()

Revision 1.266 / (download) - annotate - [select for diffs], Tue Feb 3 00:48:47 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.265: +12 -4 lines
Diff to previous 1.265 (unified) to selected 1.250 (unified)

Bring .Pp/.Lp handling inside .Nm blocks closer to groff;
as a bonus, get rid of another call to rew_sub().

Revision 1.265 / (download) - annotate - [select for diffs], Thu Dec 18 20:15:56 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.264: +5 -2 lines
Diff to previous 1.264 (unified) to selected 1.250 (unified)

Only keep leading .Sm inside a list when it immediately precedes
the first .It.  Otherwise, move it out together with whatever
follows.  Fixing an assertion failure found by jsg@ with afl.

Revision 1.264 / (download) - annotate - [select for diffs], Thu Dec 18 19:23:41 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.263: +7 -7 lines
Diff to previous 1.263 (unified) to selected 1.250 (unified)

When the head of a list item is extended with a partial explicit
macro (for example .Xo) and never closed again, the item ends up
without a body block.  This can even happen for list types that
usually don't have heads in the first place.  So even in this
case, check for the existence of the body before accessing it.
NULL pointer access found by jsg@ with afl.

Revision 1.263 / (download) - annotate - [select for diffs], Sun Nov 30 05:29:00 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.262: +2 -2 lines
Diff to previous 1.262 (unified) to selected 1.250 (unified)

Multiple fixes with respect to .Pf:
* The first argument of .Pf is not parsed.
* Normal delimiter handling does not apply to the first argument of .Pf.
* Warn if nothing follows a prefix (inspired by groff_mdoc(7)).
* In that case, do not suppress spacing.

Revision 1.262 / (download) - annotate - [select for diffs], Fri Nov 28 18:36:35 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.261: +3 -13 lines
Diff to previous 1.261 (unified) to selected 1.250 (unified)

Retire support for CSRG supplementary document titles.  These are
long obsolete and were never written in mdoc(7) in the first place.
Removes 100 lines from source files.

Revision 1.261 / (download) - annotate - [select for diffs], Fri Nov 28 18:09:01 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.260: +7 -14 lines
Diff to previous 1.260 (unified) to selected 1.250 (unified)

Drop useless architecture table.  Validating architecture names
is a job for makewhatis(8)/mandoc.db(5), not for the parser.
Removes 150 lines from source files and 4k (1%) from the binary.
Bloat found by deraadt@.

Revision 1.260 / (download) - annotate - [select for diffs], Fri Nov 28 17:24:41 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.259: +1 -4 lines
Diff to previous 1.259 (unified) to selected 1.250 (unified)

kill a pointless assert

Revision 1.259 / (download) - annotate - [select for diffs], Fri Nov 28 01:05:43 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.258: +222 -323 lines
Diff to previous 1.258 (unified) to selected 1.250 (unified)

Simplify code by making mdoc validation handlers void.
No functional change, minus 90 lines of code.

Revision 1.258 / (download) - annotate - [select for diffs], Thu Nov 27 23:40:19 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.257: +2 -2 lines
Diff to previous 1.257 (unified) to selected 1.250 (unified)

Downgrade .Bd -file from FATAL to ERROR.
Since this was the last remaining FATAL error in this area,
this change will allow major simplifications in the mdoc(7) parser.

Revision 1.257 / (download) - annotate - [select for diffs], Thu Nov 27 16:20:31 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.256: +13 -18 lines
Diff to previous 1.256 (unified) to selected 1.250 (unified)

Fix the obsolete .Db (toggle debug mode) macro to ignore its arguments
and not trigger an assertion when there is more than one argument;
the latter found by jsg@ with afl.

Revision 1.256 / (download) - annotate - [select for diffs], Wed Nov 26 19:24:03 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.255: +1 -3 lines
Diff to previous 1.255 (unified) to selected 1.250 (unified)

remove an unreachable warning about .Sm arguments

Revision 1.255 / (download) - annotate - [select for diffs], Mon Nov 17 06:44:58 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.254: +16 -6 lines
Diff to previous 1.254 (unified) to selected 1.250 (unified)

Multiple fixes with respect to in-line macros:
* .No selects the default font; relevant e.g. in .Bf blocks
* no need to force empty .Li elements
* closing delimiters as leading macro arguments do not suppress space
* opening delimiters at the end of a macro line do not suppress space
* correctly handle delimiter spacing in -Tman
As a side effect, these fixes let mandoc warn about empty .No macros
as requested by bentley@.

Revision 1.254 / (download) - annotate - [select for diffs], Thu Oct 30 20:10:02 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.253: +19 -43 lines
Diff to previous 1.253 (unified) to selected 1.250 (unified)

Major bugsquashing with respect to -offset and -width:
1. Support specifying the .Bd and .Bl -offset as a macro default width;
while here, simplify the code handling the same for .Bl -width.
2. Correct handling of .Bl -offset arguments:  unlike .Bd -offset, the
arguments "left", "indent", and "indent-two" have no special meaning.
3. Fix the scaling of string length -offset and -width arguments in -Thtml.
Triggered by an incomplete documentation patch from bentley@.

Revision 1.253 / (download) - annotate - [select for diffs], Mon Oct 13 14:05:32 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.252: +3 -2 lines
Diff to previous 1.252 (unified) to selected 1.250 (unified)

sync with OpenBSD:
check sorting of .Xr's case-insensitively;
no idea why this was different here

Revision 1.252 / (download) - annotate - [select for diffs], Mon Oct 13 14:01:21 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.251: +6 -4 lines
Diff to previous 1.251 (unified) to selected 1.250 (unified)

Do not warn about declarations of functions returning function pointers,
getting rid of a false positive noticed by bentley@.

Revision 1.251 / (download) - annotate - [select for diffs], Sat Oct 11 21:34:04 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.250: +2 -2 lines
Diff to previous 1.250 (unified)

oops, don't crash when .Fo has no argument

Revision 1.250 / (download) - annotate - [selected], Sat Oct 11 21:14:16 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.249: +29 -2 lines
Diff to previous 1.249 (unified)

warn about parentheses in function names after .Fn and .Fo;
particularly useful when converting from other languages to mdoc(7);
feature suggested by bentley@

Revision 1.249 / (download) - annotate - [select for diffs], Fri Sep 12 00:54:10 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.248: +26 -3 lines
Diff to previous 1.248 (unified) to selected 1.250 (unified)

warn about commas in function arguments; inspired by mdoclint(1)

Revision 1.248 / (download) - annotate - [select for diffs], Thu Sep 11 23:53:30 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.247: +66 -1 lines
Diff to previous 1.247 (unified) to selected 1.250 (unified)

warn about botched .Xr ordering and punctuation below SEE ALSO;
inspired by mdoclint(1)

Revision 1.247 / (download) - annotate - [select for diffs], Sun Sep 7 23:25:01 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.246: +40 -9 lines
Diff to previous 1.246 (unified) to selected 1.250 (unified)

warn about AUTHORS sections without .An macros, inspired by mdoclint(1)

Revision 1.246 / (download) - annotate - [select for diffs], Sun Sep 7 00:05:28 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.245: +9 -10 lines
Diff to previous 1.245 (unified) to selected 1.250 (unified)

Allow .ll in the prologue; Daniel Levai reports Slackware Linux uses this.

Revision 1.245 / (download) - annotate - [select for diffs], Tue Aug 19 17:31:55 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_4, VERSION_1_12
Changes since 1.244: +2 -2 lines
Diff to previous 1.244 (unified) to selected 1.250 (unified)

Do not dereference a NULL pointer if a .Bl macro has
no -type, -width, -offset or -compact arguments whatsoever;
this got broken in rev. 1.238.

Revision 1.244 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.243: +2 -5 lines
Diff to previous 1.243 (unified) to selected 1.250 (unified)

Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
Include <sys/types.h> where needed, it does not belong in config.h.
Remove <stdio.h> from config.h; if it is missing somewhere, it should
be added, but i cannot find a *.c file where it is missing.

Revision 1.243 / (download) - annotate - [select for diffs], Wed Aug 6 15:09:05 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.242: +74 -82 lines
Diff to previous 1.242 (unified) to selected 1.250 (unified)

Bring the handling of defective prologues even closer to groff,
in particular relaxing the distinction between prologue and body
and further improving messages.
* The last .Dd wins and the last .Os wins, even in the body.
* The last .Dt before the first body macro wins.
* Missing title in .Dt defaults to UNTITLED.  Warn about it.
* Missing section in .Dt does not default to 1.  But warn about it.
* Do not warn multiple times about the same mdoc(7) prologue macro.
* Warn about missing .Os.
* Incomplete .TH defaults to empty strings.  Warn about it.

Revision 1.242 / (download) - annotate - [select for diffs], Sat Aug 2 00:02:42 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.241: +150 -128 lines
Diff to previous 1.241 (unified) to selected 1.250 (unified)

Simplify by allowing only one post-handler.
Saves 36 static arrays and 10 lines of code
at the expense of only five new trivial static functions.
No functional change.

Revision 1.241 / (download) - annotate - [select for diffs], Fri Aug 1 22:22:11 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.240: +29 -47 lines
Diff to previous 1.240 (unified) to selected 1.250 (unified)

Simplify by allowing only one pre-handler.
Saves 12 static arrays and 19 lines of code.
No functional change.

Revision 1.240 / (download) - annotate - [select for diffs], Fri Aug 1 17:40:34 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.239: +5 -3 lines
Diff to previous 1.239 (unified) to selected 1.250 (unified)

demacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg()

Revision 1.239 / (download) - annotate - [select for diffs], Fri Aug 1 17:27:44 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.238: +45 -33 lines
Diff to previous 1.238 (unified) to selected 1.250 (unified)

mention requests and macros in more messages

Revision 1.238 / (download) - annotate - [select for diffs], Thu Jul 31 09:22:21 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.237: +22 -10 lines
Diff to previous 1.237 (unified) to selected 1.250 (unified)

Split MANDOCERR_IGNARGV into one message for .An and one for .Bl
and report the macro name and argument.

Revision 1.237 / (download) - annotate - [select for diffs], Thu Jul 31 00:41:10 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14
Changes since 1.236: +13 -21 lines
Diff to previous 1.236 (unified) to selected 1.250 (unified)

In .Bl -column, if some of the column width declarations are given
right after the -column argument and some at the very end of the
argument list, after some other arguments like -compact, concatenate
the column lists.
This gets rid of one of the last useless FATAL errors
and actually shortens the code by a few lines.

This fixes an issue introduced more than five years ago, at first
causing an assert() since mdoc_action.c rev. 1.14 (June 17, 2009),
then later a FATAL error since mdoc_validate rev. 1.130 (Nov. 30, 2010),
and marked as "TODO" ever since.

Revision 1.236 / (download) - annotate - [select for diffs], Wed Jul 30 23:38:52 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.235: +6 -12 lines
Diff to previous 1.235 (unified) to selected 1.250 (unified)

Remove the useless FATAL error "argument count wrong, violates syntax".
The last remaining instance was .It in .Bl -column with more than one
excessive .Ta.  However, simply downgrading from FATAL to ERROR, it just
works fine, almost the same way as in groff, without any other changes.

Revision 1.235 / (download) - annotate - [select for diffs], Wed Jul 30 17:06:26 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.234: +4 -54 lines
Diff to previous 1.234 (unified) to selected 1.250 (unified)

Get rid of the useless FATAL error "child violates parent syntax".
When finding items outside lists, simply skip them and throw an ERROR.
Handle subsections before the first section instead of bailing out.

Revision 1.234 / (download) - annotate - [select for diffs], Wed Jul 30 14:50:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.233: +16 -8 lines
Diff to previous 1.233 (unified) to selected 1.250 (unified)

Remove two useless FATAL errors.
When a file contains neither text nor macros, treat it as an empty document.
When the mdoc(7) document prologue is incomplete, use some default values.

Revision 1.233 / (download) - annotate - [select for diffs], Wed Jul 30 12:58:21 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.232: +3 -2 lines
Diff to previous 1.232 (unified) to selected 1.250 (unified)

better name and wording for the last two non-generic errors

Revision 1.232 / (download) - annotate - [select for diffs], Wed Jul 30 00:19:16 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.231: +17 -26 lines
Diff to previous 1.231 (unified) to selected 1.250 (unified)

Various improvements related to .Ex and .Rv:
* let .Nm fall back to the empty string, not to UNKNOWN
* never let .Rv copy an argument from .Nm
* avoid spurious \fR after empty .Nm in -Tman
* correct handling of .Ex and .Rv in -Tman
* correct the wording of the output for .Rv without arguments
* use non-breaking spaces in .Ex and .Rv output where required
* split MANDOCERR_NONAME into a warning for .Ex and an error for .Nm

Revision 1.231 / (download) - annotate - [select for diffs], Tue Jul 29 13:58:18 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.230: +2 -2 lines
Diff to previous 1.230 (unified) to selected 1.250 (unified)

Partial implementation of .Bd -centered.

In groff, .Bd -centered operates in fill mode, which is relatively
hard to implement, while this implementation operates in non-fill
mode so far.  As long as you pay attention that your lines do not
overflow, it works.  To make sure that rendering is the same for
mandoc and groff, it is recommended to insert .br between lines
for now.  This implementation will need improvement later.

Revision 1.230 / (download) - annotate - [select for diffs], Mon Jul 7 16:12:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.229: +12 -35 lines
Diff to previous 1.229 (unified) to selected 1.250 (unified)

no need to delete any content from .Rs blocks,
and downgrade the related message from ERROR to WARNING

Revision 1.229 / (download) - annotate - [select for diffs], Sun Jul 6 19:09:00 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.228: +3 -2 lines
Diff to previous 1.228 (unified) to selected 1.250 (unified)

Clean up messages related to plain text and to escape sequences.
* Mention invalid escape sequences and string names, and fallbacks.
* Hierarchical naming.

Revision 1.228 / (download) - annotate - [select for diffs], Sat Jul 5 12:34:17 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.227: +62 -57 lines
Diff to previous 1.227 (unified) to selected 1.250 (unified)

Cleanup with respect to bad macro arguments.
* Fix .Sm with invalid arg: move arg out and toggle mode.
* Promote "unknown standard" from WARNING to ERROR, it loses information.
* Delete MANDOCERR_BADWIDTH, it would only indicate a mandoc(1) bug.
* Do not report MANDOCERR_BL_LATETYPE when there is no type at all.
* Mention macro names, arguments and fallbacks.

Revision 1.227 / (download) - annotate - [select for diffs], Sat Jul 5 01:12:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.226: +52 -56 lines
Diff to previous 1.226 (unified) to selected 1.250 (unified)

Cleanup regarding -offset and -width:
* Bugfix: Last one wins, not first one.
* Fix .Bl -width without argument: it means 0n, so do not ignore it.
* Report macro names, argument names and fallbacks in related messages.
* Simplify: Garbage collect auxiliary variables in pre_bd() and pre_bl().

Revision 1.226 / (download) - annotate - [select for diffs], Fri Jul 4 16:12:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.225: +27 -24 lines
Diff to previous 1.225 (unified) to selected 1.250 (unified)

Clean up messages regarding excess arguments:
* Downgrade ".Bf -emphasis Em" from FATAL to WARNING.
* Mention the macros, the arguments, and the fallbacks.
* Hierarchical naming.

Revision 1.225 / (download) - annotate - [select for diffs], Fri Jul 4 01:50:07 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.224: +13 -17 lines
Diff to previous 1.224 (unified) to selected 1.250 (unified)

Clean up messages related to missing arguments.
* Do not warn about empty -column cells, they seem valid to me.
* Downgrade empty item and missing -std from ERROR to WARNING.
* Hierarchical naming.
* Descriptive, not imperative style.
* Mention macro names, argument names, and fallbacks.
* Garbage collect some unreachable code in post_it().

Revision 1.224 / (download) - annotate - [select for diffs], Thu Jul 3 23:24:56 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.223: +23 -25 lines
Diff to previous 1.223 (unified) to selected 1.250 (unified)

Fix formatting of empty .Bl -inset item heads.
Downgrade empty item heads from ERROR to WARNING.
Show the list type in the error message.
Choose better variable names for nodes in post_it().

Revision 1.223 / (download) - annotate - [select for diffs], Wed Jul 2 20:19:11 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.222: +4 -2 lines
Diff to previous 1.222 (unified) to selected 1.250 (unified)

Improve and test the messages about empty macros,
in particular reporting the macro names involved.

Revision 1.222 / (download) - annotate - [select for diffs], Wed Jul 2 19:55:10 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.221: +5 -4 lines
Diff to previous 1.221 (unified) to selected 1.250 (unified)

When .Sm is called without an argument, groff toggles the spacing mode,
so let us do the same for compatibility.  Using this feature is of
course not recommended except in manual page obfuscation contests.

Revision 1.221 / (download) - annotate - [select for diffs], Wed Jul 2 13:10:45 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.220: +8 -4 lines
Diff to previous 1.220 (unified) to selected 1.250 (unified)

Disentangle the MANDOCERR_CHILD message, which reported three
completely different things, into three distinct messages.
Also mention the macro names we are talking about.

Revision 1.220 / (download) - annotate - [select for diffs], Wed Jul 2 11:43:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.219: +5 -3 lines
Diff to previous 1.219 (unified) to selected 1.250 (unified)

Clean up warnings related to macros and nesting.
* Hierarchical naming of enum mandocerr items.
* Improve the wording to make it comprehensible.
* Mention the offending macro.
* Garbage collect one chunk of ancient, long unreachable code.

Revision 1.219 / (download) - annotate - [select for diffs], Wed Jul 2 05:52:25 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.218: +30 -14 lines
Diff to previous 1.218 (unified) to selected 1.250 (unified)

Improve "skipping paragraph macro" messages,
showing which macro was skipped and before or after what.

Revision 1.218 / (download) - annotate - [select for diffs], Wed Jul 2 03:48:07 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.217: +38 -5 lines
Diff to previous 1.217 (unified) to selected 1.250 (unified)

Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,
since this is hardly more complicated than explicitly ignoring them
as we did in the past.  Of course, do not use them!

Revision 1.217 / (download) - annotate - [select for diffs], Tue Jul 1 22:37:15 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.216: +48 -27 lines
Diff to previous 1.216 (unified) to selected 1.250 (unified)

Clean up the warnings related to document structure.
* Hierarchical naming of the related enum mandocerr items.
* Mention the offending macro, section title, or string.
While here, improve some wordings:
* Descriptive instead of imperative style.
* Uniform style for "missing" and "skipping".
* Where applicable, mention the fallback used.

Revision 1.216 / (download) - annotate - [select for diffs], Fri Jun 20 23:02:31 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.215: +10 -14 lines
Diff to previous 1.215 (unified) to selected 1.250 (unified)

As suggested by jmc@, only include line and column numbers into messages
when they are meaningful, to avoid confusing stuff like this:
$ mandoc /dev/null
mandoc: /dev/null:0:1: FATAL: not a manual
Instead, just say:
mandoc: /dev/null: FATAL: not a manual

Another example this applies to is documents having a prologue,
but lacking a body.  Do not throw a FATAL error for these; instead,
issue a WARNING and show the empty document, in the man(7) case with
the same amount of blank lines as groff does.  Also downgrade mdoc(7)
documents having content before the first .Sh from FATAL to WARNING.

Revision 1.215 / (download) - annotate - [select for diffs], Fri Jun 20 17:24:00 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.214: +10 -10 lines
Diff to previous 1.214 (unified) to selected 1.250 (unified)

Start systematic improvements of error reporting.
So far, this covers all WARNINGs related to the prologue.

1) hierarchical naming of MANDOCERR_* constants
2) mention the macro name in messages where that adds clarity
3) add one missing MANDOCERR_DATE_MISSING msg
4) fix the wording of one message related to the man(7) prologue

Started on the plane back from Ottawa.

Revision 1.214 / (download) - annotate - [select for diffs], Wed Apr 23 21:06:41 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.213: +5 -5 lines
Diff to previous 1.213 (unified) to selected 1.250 (unified)

Audit malloc(3)/calloc(3)/realloc(3) usage.
* Change eight reallocs to reallocarray to be safe from overflows.
* Change one malloc to reallocarray to be safe from overflows.
* Change one calloc to reallocarray, no zeroing needed.
* Change the order of arguments of three callocs (aesthetical).

Revision 1.213 / (download) - annotate - [select for diffs], Wed Apr 23 16:08:33 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.212: +12 -21 lines
Diff to previous 1.212 (unified) to selected 1.250 (unified)

Audit strlcpy(3)/strlcat(3) usage.

* Repair three instances of silent truncation, use asprintf(3).
* Change two instances of strlen(3)+malloc(3)+strlcpy(3)+strlcat(3)+...
to use asprintf(3) instead to make them less error prone.
* Cast the return value of four instances where the destination
buffer is known to be large enough to (void).
* Completely remove three useless instances of strlcpy(3)/strlcat(3).
* Mark two places in -Thtml with XXX that can cause information loss
and crashes but are not easy to fix, requiring design changes of
some internal interfaces.
* The file mandocdb.c remains to be audited.

Revision 1.212 / (download) - annotate - [select for diffs], Sun Apr 20 20:48:53 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.211: +14 -23 lines
Diff to previous 1.211 (unified) to selected 1.250 (unified)

strlen+malloc+snprintf is error prone;
rewrite post_lb() to use asprintf(3) instead

Revision 1.211 / (download) - annotate - [select for diffs], Sun Apr 20 19:40:13 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.210: +5 -7 lines
Diff to previous 1.210 (unified) to selected 1.250 (unified)

make sure static buffers for snprintf(3) are large enough
and cast snprintf return value to (void) where they are

Revision 1.210 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:05 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.209: +240 -254 lines
Diff to previous 1.209 (unified) to selected 1.250 (unified)

KNF: case (FOO):  ->  case FOO:, remove /* LINTED */ and /* ARGSUSED */,
remove trailing whitespace and blanks before tabs, improve some indenting;
no functional change

Revision 1.209 / (download) - annotate - [select for diffs], Tue Apr 15 00:41:09 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.208: +8 -12 lines
Diff to previous 1.208 (unified) to selected 1.250 (unified)

Using macros in .Sh header lines, or having .Sm off or .Bk -words open
while processing .Sh, is not at all recommended, but it's not strictly
a syntax violation either, and in any case, mandoc must not die in an
assertion.  I broke this in rev. 1.124.

Crash found while trying to read the (rather broken) original 4.3BSD-Reno
od(1) manual page.

Revision 1.208 / (download) - annotate - [select for diffs], Mon Mar 31 01:05:32 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.207: +4 -1 lines
Diff to previous 1.207 (unified) to selected 1.250 (unified)

Support the CONTEXT section for kernel manual pages found in Solaris and
OpenBSD manuals.  It describes which contexts you can call functions in.
from dlg@, ok jmc@ deraadt@

Revision 1.207 / (download) - annotate - [select for diffs], Sun Mar 30 23:28:06 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.206: +5 -3 lines
Diff to previous 1.206 (unified) to selected 1.250 (unified)

Allow ERRORS in section 4; OpenBSD rev. 1.121.

Revision 1.206 / (download) - annotate - [select for diffs], Sun Mar 30 19:47:48 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.205: +2 -1 lines
Diff to previous 1.205 (unified) to selected 1.250 (unified)

Implement the roff(7) .ll (line length) request.
Found by naddy@ in the textproc/enchant(1) port.
Of course, do not use this in new manuals.

Revision 1.205 / (download) - annotate - [select for diffs], Sun Mar 23 15:14:50 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.204: +27 -78 lines
Diff to previous 1.204 (unified) to selected 1.250 (unified)

Retire the old concat() function.
For .Sh, i wasn't even needed at all.
For .Dd, .Nm, and .Os, use the new mdoc_deroff() instead.
This gets rid of the last limited-size static buffers in this file,
hence eliminates the last explicit MANDOCERR_MEM throwers here,
and it shortens the code by 50 lines.

Revision 1.204 / (download) - annotate - [select for diffs], Sun Mar 23 12:11:18 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.203: +4 -6 lines
Diff to previous 1.203 (unified) to selected 1.250 (unified)

avoid repetitive code for asprintf error handling

Revision 1.203 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.202: +2 -1 lines
Diff to previous 1.202 (unified) to selected 1.250 (unified)

The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions.  Split the auxiliaries out into their own file and header.
While here, do some #include cleanup.

Revision 1.202 / (download) - annotate - [select for diffs], Sat Jan 11 22:16:10 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.201: +2 -2 lines
Diff to previous 1.201 (unified) to selected 1.250 (unified)

Remove useless use of strnlen(3).
Yuckiness pointed out by deraadt@.

Revision 1.201 / (download) - annotate - [select for diffs], Tue Jan 7 09:10:45 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.200: +23 -30 lines
Diff to previous 1.200 (unified) to selected 1.250 (unified)

Cache the result of uname(3) such that we don't need to call it
over and over again for each manual; found with gprof(1).
Speeds up mandocdb(8) -Q by 3%, now at 39.5% of makewhatis(8).

Revision 1.200 / (download) - annotate - [select for diffs], Mon Jan 6 22:39:25 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.199: +6 -6 lines
Diff to previous 1.199 (unified) to selected 1.250 (unified)

Another 18% speedup for mandocdb(8) -Q, found by gprof(1).
In -Q mode, refrain form validating and normalizing the format
of the date given in .Dd or .TH, as it won't be used anyway.

For /usr/share/man, mandocdb -Q now takes 45% of the time of makewhatis(8).

Revision 1.199 / (download) - annotate - [select for diffs], Mon Jan 6 00:53:33 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.198: +2 -1 lines
Diff to previous 1.198 (unified) to selected 1.250 (unified)

Joerg Sonnenberger contributed copyrightable amounts of text to
some files.  To make it clear that he also put his contributions
under the ISC license, with his explicit permission, add his
Copyright notice to the relevant files.  No code change.

Revision 1.198 / (download) - annotate - [select for diffs], Sun Dec 15 21:23:52 2013 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3
Changes since 1.197: +3 -3 lines
Diff to previous 1.197 (unified) to selected 1.250 (unified)

The "value" argument to the roff(7) .nr requests ends right before
the first non-digit character.  While here, implement and document
an optional sign, requesting increment or decrement, as documented
in the Ossanna/Kernighan/Ritter troff manual and supported by groff.

Reported by bentley@ on discuss@.

Revision 1.197 / (download) - annotate - [select for diffs], Mon Oct 21 23:47:58 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.196: +9 -3 lines
Diff to previous 1.196 (unified) to selected 1.250 (unified)

There are three kinds of input lines: text lines, macros taking
positional arguments (like Dt Fn Xr) and macros taking text as
arguments (like Nd Sh Em %T An).  In the past, even the latter put
each word of their arguments into its own MDOC_TEXT node; instead,
concatenate arguments unless delimiters, keeps or spacing mode
prevent that.  Regarding mandoc(1), this is internal refactoring,
no output change intended.

Regarding mandocdb(8), this fixes yet another regression introduced
when switching from DB to SQLite: The ability to search for strings
crossing word boundaries was lost and is hereby restored.  At the
same time, database sizes and build times are both reduced by a bit
more than 5% each.

Revision 1.196 / (download) - annotate - [select for diffs], Sun Oct 6 22:46:15 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.195: +62 -20 lines
Diff to previous 1.195 (unified) to selected 1.250 (unified)

We don't do hyphenation, but we allow breaking the line at hyphens that are
already there in the middle of words.  So far, we only allowed this on text
lines.  Now it turns out some macros allow this for their arguments, too,
in particular .Nd and most of the .%? citation macros.

Issue found by Franco Fichtner <franco at lastsummer dot de> while doing
systematic groff-mandoc comparisons in the DragonFly base system, THANKS!

While here, garbage collect two empty prevalidator function pointer lists
and sort a couple of function declarations.

Revision 1.195 / (download) - annotate - [select for diffs], Sun Oct 6 13:32:46 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.194: +60 -21 lines
Diff to previous 1.194 (unified) to selected 1.250 (unified)

If there is random stuff inside a .Bl block body before the first .It,
do not throw a FATAL error and do not die, but just throw a WARNING
and move the stuff out of the .Bl block.

This bug felt completely 2008-ish; meanwhile, such bugs from the
Kristaps-doesnt-like-syntax-errors-so-lets-just-give-up--Era
are becoming rare, but this was one of the last survivors.

Thanks to bentley@ for reminding me to finally fix this.

Revision 1.194 / (download) - annotate - [select for diffs], Sat Oct 5 22:08:12 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.193: +7 -6 lines
Diff to previous 1.193 (unified) to selected 1.250 (unified)

Support setting arbitrary roff(7) number registers,
preserving read support for the ".nr nS" SYNOPSIS state register.

Inspired by NetBSD roff.c rev. 1.18 (Christos Zoulas, March 21, 2013),
but implemented differently.  I don't want to have yet another different
implementation of a hash table in mandoc - it would be the second one
in roff.c alone and the fifth one in mandoc grand total.
Instead, i designed and implemented roff_setreg() and roff_getreg()
to be similar to roff_setstrn() and roff_getstrn().

Once we feel the need to optimize, we can introduce one common
hash table implementation for everything in mandoc.

Revision 1.193 / (download) - annotate - [select for diffs], Mon Sep 16 00:25:07 2013 UTC (10 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_2
Changes since 1.192: +3 -2 lines
Diff to previous 1.192 (unified) to selected 1.250 (unified)

One of the WARNING messages has to use the word "section" twice in two
different meanings, that cannot be helped.  But we can make this less
confusing by stating that the second instance refers to stuff like (2),
(3), and (9), and by adding the sections header the first instance
refers to, for example ERRORS or RETURN VALUES.

Source for confusion noticed by Jan Stary <hans at stare dot cz>,
better wording suggested by jmc@, tweaked by me.

Revision 1.192 / (download) - annotate - [select for diffs], Mon Aug 5 14:36:01 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.191: +3 -3 lines
Diff to previous 1.191 (unified) to selected 1.250 (unified)

Put .%C before .%D in .Rs output
because that's the usual order in formal citations.

My patch that was accepted into groff by Werner Lemberg
uses the same order, so keep groff and mandoc consistent.

Revision 1.191 / (download) - annotate - [select for diffs], Sat Nov 17 00:26:33 2012 UTC (11 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.190: +17 -17 lines
Diff to previous 1.190 (unified) to selected 1.250 (unified)

Cleanup naming of local variables to make the code easier on the eye:
Settle for "struct man *man", "struct mdoc *mdoc", "struct meta *meta"
and avoid the confusing "*m" which was sometimes this, sometimes that.
No functional change.

ok kristaps@ some time ago

Revision 1.190 / (download) - annotate - [select for diffs], Fri Nov 16 22:21:05 2012 UTC (11 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.189: +2 -2 lines
Diff to previous 1.189 (unified) to selected 1.250 (unified)

Warn about unknown volume or arch in Dt macro arguments;
patch written by Nicolas Joly <njoly at pasteur dot fr>.

Revision 1.189 / (download) - annotate - [select for diffs], Wed Jul 18 11:11:12 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.188: +34 -5 lines
Diff to previous 1.188 (unified) to selected 1.250 (unified)

Fix handling of paragraph macros inside lists:
* When they are trailing the last item, move them outside the list.
* When they are trailing any other none-compact item, drop them.

OpenBSD rev. mdoc_validate.c 1.107, mdoc.c 1.91

Revision 1.188 / (download) - annotate - [select for diffs], Mon Jul 16 09:51:54 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.187: +37 -7 lines
Diff to previous 1.187 (unified) to selected 1.250 (unified)

Several -mdoc parser improvements related to vertical spacing:
* So far, .Pp and .Lp were removed before paragraph type blocks.
* Now also remove .br before paragraph type blocks.
* Treat .Lp as a paragraph like .Pp, so remove .Pp, .Lp, .br before it.
* Do not treat .sp as a paragraph, don't remove anything before it.
* After .Sh, .Ss, .Pp, and .Lp, remove .Pp, .Lp, .sp, .br, and blank lines.
* After .sp and .br, remove .br.
OpenBSD rev. mdoc.c 1.89 and mdoc_validate.c 1.106

Revision 1.187 / (download) - annotate - [select for diffs], Thu Jul 12 15:11:14 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.186: +18 -13 lines
Diff to previous 1.186 (unified) to selected 1.250 (unified)

The post_nm() validation function crashed when the first .Nm child node
was a non-text node.  Fix this by rewriting post_nm() to always set
the meta name to UNKNOWN when the name is missing or unusable.
While here, make MANDOCERR_NONAME an ERROR, as it usually renders
the page content unintelligible.

Bug reported by Maxim <Belooussov at gmail dot com>, thanks.
OpenBSD rev. 1.105

Revision 1.186 / (download) - annotate - [select for diffs], Wed Jul 11 16:57:43 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.185: +3 -3 lines
Diff to previous 1.185 (unified) to selected 1.250 (unified)

fix position and formatting of %U;
OpenBSD rev. 1.104 and 1.145, respectively

Revision 1.185 / (download) - annotate - [select for diffs], Tue Jul 10 14:38:51 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.184: +17 -5 lines
Diff to previous 1.184 (unified) to selected 1.250 (unified)

* implement -Tman .Bl -item -inset -diag -ohang -dash -hyphen -enum .It
* fix -Tman .Bl -bullet .It
* adjust the -Tascii .Bl -bullet -dash -hyphen .It
default and minimum width to new groff standards,
it changed from 4n (in groff 1.15) to 2n (in groff 1.21)
* same for -Tascii -enum, it changed from 5n to 2n
* use -hang formatting for -Tascii -enum -width 2n
* for -Tascii -enum, the default is -width 3n

Revision 1.184 / (download) - annotate - [select for diffs], Sun May 27 17:48:57 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.183: +13 -12 lines
Diff to previous 1.183 (unified) to selected 1.250 (unified)

Support -Ios='OpenBSD 5.1' to override uname(3) as the source of the
default value for the mdoc(7) .Os macro.
Needed for man.cgi on the OpenBSD website.

Problem with man.cgi first noticed by deraadt@;
beck@ and deraadt@ agree with the way to solve the issue.

"Please check them in and I'll look into them later!" kristaps@

Revision 1.183 / (download) - annotate - [select for diffs], Sun May 27 17:39:28 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.182: +2 -2 lines
Diff to previous 1.182 (unified) to selected 1.250 (unified)

update Copyright years according to the CVS logs; no code change

Revision 1.182 / (download) - annotate - [select for diffs], Fri Mar 23 05:50:25 2012 UTC (12 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.181: +8 -3 lines
Diff to previous 1.181 (unified) to selected 1.250 (unified)

Make the `-width' field to `Bl' not puke if it doesn't have an argument.
This makes mandoc work much, much nicer with Mac OSX manpages.

Revision 1.181 / (download) - annotate - [select for diffs], Sat Dec 3 16:58:54 2011 UTC (12 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.180: +16 -1 lines
Diff to previous 1.180 (unified) to selected 1.250 (unified)

When processing .Sh HEAD, as soon as we know which section this is,
fix up the section attributes of the HEAD, it's parent BLOCK, and
all its (text) children.  This is required because the section
attributes get set when each node is allocated, i.e. before processing
the content of the node itself.  Thus, the listed nodes got the section
attribute of the preceding section.  No need to fix up the BODY, all
is fine there already.
Found while implementing TYPE_Sh for mandocdb(8).
OK and comment requested by kristaps@.

Revision 1.180 / (download) - annotate - [select for diffs], Fri Dec 2 01:37:14 2011 UTC (12 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.179: +2 -2 lines
Diff to previous 1.179 (unified) to selected 1.250 (unified)

In man(7), when no explicit volume name is given, use the default
volume name for the respective manual section, just like in mdoc(7).
This gives us nicer page headers for cvs(1), lynx(1), tic(1),
mkhybrid(8), and many curses(3) manuals.

ok kristaps@

To not break compatibility, i wrote a corresponding patch for GNU troff
which Werner Lemberg accepted upstream at rev. 1.65 of:
http://cvs.savannah.gnu.org/viewvc/groff/tmac/an-old.tmac?root=groff

Revision 1.179 / (download) - annotate - [select for diffs], Sat Nov 19 13:29:47 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.178: +6 -2 lines
Diff to previous 1.178 (unified) to selected 1.250 (unified)

Improve misleading comment:
* Not sure there were any text nodes, might have been other stuff instead.
* Not sure it was just one node, maybe several were deleted.
* No problem if some nodes were deleted, as long as some valid ones are left.
* We do not leave early, but after cleaning out all the crap.
* We are not "bailing", but we consider the block valid after cleanup.

Revision 1.178 / (download) - annotate - [select for diffs], Fri Nov 18 14:58:24 2011 UTC (12 years, 4 months ago) by joerg
Branch: MAIN
Changes since 1.177: +5 -1 lines
Diff to previous 1.177 (unified) to selected 1.250 (unified)

Bail out explicitly on invalid .Rs content like:
.Rs
plain text
.Re

This avoids a crash on invalid.

Revision 1.177 / (download) - annotate - [select for diffs], Sun Oct 16 12:20:34 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.176: +5 -6 lines
Diff to previous 1.176 (unified) to selected 1.250 (unified)

Remove a bunch of useless assignments,
and assert that print_bvspace cannot be called on NULL pointers.
No change in behaviour, none of these were bugs,
but the code becomes easier to understand.
Based on a clang report posted by joerg@; ok kristaps@.

Revision 1.176 / (download) - annotate - [select for diffs], Fri Sep 2 19:40:18 2011 UTC (12 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_0, VERSION_1_11_7
Changes since 1.175: +2 -2 lines
Diff to previous 1.175 (unified) to selected 1.250 (unified)

Make -man check for tabs correctly print the column.

Revision 1.175 / (download) - annotate - [select for diffs], Fri Aug 19 13:59:23 2011 UTC (12 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.174: +3 -3 lines
Diff to previous 1.174 (unified) to selected 1.250 (unified)

Avoid incorrect casting by using an implicit cast.  Reported by Thomas
Klausner.

Revision 1.174 / (download) - annotate - [select for diffs], Tue Aug 16 12:23:51 2011 UTC (12 years, 7 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_6
Changes since 1.173: +3 -3 lines
Diff to previous 1.173 (unified) to selected 1.250 (unified)

Fixed mingw compatibility where the "z" printf() modifier isn't
recognised.  It's easier to make these u_int than to jump through hoops
for a special formatter.

Revision 1.173 / (download) - annotate - [select for diffs], Wed Aug 10 14:07:23 2011 UTC (12 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.172: +42 -35 lines
Diff to previous 1.172 (unified) to selected 1.250 (unified)

Allow `Sx' and `Ss' to have child nodes.  Fixes manuals in NetBSD.
Originally pointed out by joerg@ then again by Thomas Klausner by way of
Nicolas Joy.  Note: don't use these constructions as you can't link to
the sections with `Sx'.

Revision 1.172 / (download) - annotate - [select for diffs], Tue Jul 26 14:09:01 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.171: +6 -32 lines
Diff to previous 1.171 (unified) to selected 1.250 (unified)

Move checking of escapes into roff.c, where we're already stepping
through looking for user-defined escapes.  This clears up a nice bit of
validation code.

Revision 1.171 / (download) - annotate - [select for diffs], Sun Jul 24 18:15:14 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_5
Changes since 1.170: +2 -2 lines
Diff to previous 1.170 (unified) to selected 1.250 (unified)

Scary-looking but otherwise harmless changes allow me to build for Windows.
That is to say, with mingw32.  This amounts to the following:

 (1) break compat.c into compat_strlcpy.c and compat_strlcat.c
 (2) add compat_getsubopt.c (from OpenBSD) and test-getsubopt.c
 (3) add test-strptime.c for HAVE_STRPTIME
 (4) add ifdef bits here and there, where necessary
 (5) remove some harmless unportable stuff (u_char, localtime_r)

I've added the appropriate mdocml.zip target to the Makefile, too.

Revision 1.170 / (download) - annotate - [select for diffs], Mon Jul 18 07:46:41 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.169: +2 -2 lines
Diff to previous 1.169 (unified) to selected 1.250 (unified)

Make `struct roff' be passed into libmdoc and libman upon creation.
This is required for supporting in-line equations.  While here, push
registers properly into roff and add an set/get/mod interface.

Revision 1.169 / (download) - annotate - [select for diffs], Sat Apr 30 10:18:24 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_4, VERSION_1_11_3, VERSION_1_11_2
Changes since 1.168: +2 -2 lines
Diff to previous 1.168 (unified) to selected 1.250 (unified)

No code change: fixing spelling errors.  From a patch by uqs@.  Thanks!

Revision 1.168 / (download) - annotate - [select for diffs], Wed Apr 13 09:57:08 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.167: +3 -3 lines
Diff to previous 1.167 (unified) to selected 1.250 (unified)

Remove the warning for empty bodies of `Sh', `Ss', `SH', and `SS'.  This
prompted by a TODO by schwarze@, originally from Gleydson Soares, that
an empty `SS' was raising an error (it hasn't for some time).  It makes
sense these shouldn't warn, as omitting their contents doesn't change
anything in the structure of the document (groff and mandoc specifically
account for the whitespace between empty sections).

This doesn't change any manuals, which only refer to the line arguments
(or possibly next-line, in the case of man(7) syntax).

Revision 1.167 / (download) - annotate - [select for diffs], Sat Apr 9 15:29:40 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.166: +20 -12 lines
Diff to previous 1.166 (unified) to selected 1.250 (unified)

Remove a2roffdeco() and mandoc_special() functions and replace them with
a public (mandoc.h) function mandoc_escape(), which merges the
functionality of both prior functions.

Reason: code duplication.  The a2roffdeco() and mandoc_special()
functions were pretty much the same thing and both quite complex.  This
allows one function to receive improvements in (e.g.) subexpression
handling and performance, instead of having to replicate functionality.

As such, the mandoc_escape() function already handles a superset of the
escapes handled in previous versions and has improvements in performance
(using strcspn(), for example) and reliable handling of subexpressions.

This code Works For Me, but may need work to catch any regressions.
Since the benefits are great (leaner code, simpler API), I'd rather have
it in-tree than floating as a patch.

Revision 1.166 / (download) - annotate - [select for diffs], Sun Apr 3 09:53:50 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_1
Changes since 1.165: +2 -2 lines
Diff to previous 1.165 (unified) to selected 1.250 (unified)

Make uname have its return value checked for -1 (POSIX style), not
non-zero.  From a PR by Yuri Pankov, ok schwarze@.

Revision 1.165 / (download) - annotate - [select for diffs], Tue Mar 22 14:33:05 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.164: +2 -1 lines
Diff to previous 1.164 (unified) to selected 1.250 (unified)

libmdoc.h and libman.h were including mdoc.h and man.h, respectively.
Don't have them do that (includes in header files = faugh), and have
individual files directly include these files.

Revision 1.164 / (download) - annotate - [select for diffs], Sun Mar 20 16:02:05 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.163: +11 -11 lines
Diff to previous 1.163 (unified) to selected 1.250 (unified)

Consolidate messages.  Have all parse-time messages (in libmdoc,
libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the
time being in libmandoc.h.  This requires struct mparse to be passed
into the allocation routines instead of mandocmsg and a void pointer.
Then, move some of the functionality of the old mmsg() into read.c's
mparse_mmsg() (check against wlevel and setting of file_status) and use
main.c's mmsg() as simply a printing tool.

Revision 1.163 / (download) - annotate - [select for diffs], Thu Mar 17 12:14:19 2011 UTC (13 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_10
Changes since 1.162: +2 -2 lines
Diff to previous 1.162 (unified) to selected 1.250 (unified)

Note that mdoc_valids[] is static.

Revision 1.162 / (download) - annotate - [select for diffs], Thu Mar 17 11:30:23 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.161: +7 -8 lines
Diff to previous 1.161 (unified) to selected 1.250 (unified)

Clean-up in libmdoc: fix last checks for mdoc_*msg return value, then
make mdoc_vmsg not return an int.  libmdoc is now completely clean of
return-value checks from the message subsystem.

Revision 1.161 / (download) - annotate - [select for diffs], Thu Mar 17 09:24:51 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.160: +97 -4 lines
Diff to previous 1.160 (unified) to selected 1.250 (unified)

Move mdoc_macro2len() into mdoc_validate.c as macro2len(), as that's the
only place that it's being used.

Revision 1.160 / (download) - annotate - [select for diffs], Thu Mar 17 09:22:39 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.159: +39 -2 lines
Diff to previous 1.159 (unified) to selected 1.250 (unified)

Move mdoc_str2sec() into mdoc_validate.c as a2sec(), as that's the only
place that it's being used.

Revision 1.159 / (download) - annotate - [select for diffs], Tue Mar 15 16:23:51 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.158: +3 -2 lines
Diff to previous 1.158 (unified) to selected 1.250 (unified)

Make lint shut up a little bit.

Revision 1.158 / (download) - annotate - [select for diffs], Mon Mar 7 01:35:51 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.157: +13 -15 lines
Diff to previous 1.157 (unified) to selected 1.250 (unified)

Clean up date handling,
as a first step to get rid of the frequent petty warnings in this area:
 - always store dates as strings, not as seconds since the Epoch
 - for input, try the three most common formats everywhere
 - for unrecognized format, just pass the date though verbatim
 - when there is no date at all, still use the current date
Originally triggered by a one-line patch from Tim van der Molen,
<tbvdm at xs4all dot nl>, which is included here.
Feedback and OK on manual parts from jmc@.
"please check this in" kristaps@

Revision 1.157 / (download) - annotate - [select for diffs], Wed Feb 9 09:18:15 2011 UTC (13 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.156: +3 -1 lines
Diff to previous 1.156 (unified) to selected 1.250 (unified)

Allow -man to process EQN as well.  Also fix a segfault in missing case
statements in the post-handler for EQN in -mdoc and -man.

Revision 1.156 / (download) - annotate - [select for diffs], Sun Feb 6 21:44:36 2011 UTC (13 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.155: +3 -1 lines
Diff to previous 1.155 (unified) to selected 1.250 (unified)

Add initial libmdoc and libman top-most machinery for accepting TBL
directives.  For now this will just ignore them (except for -Ttree,
which just notes that an EQN's been accepted).

Revision 1.155 / (download) - annotate - [select for diffs], Wed Feb 2 21:40:45 2011 UTC (13 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.154: +13 -2 lines
Diff to previous 1.154 (unified) to selected 1.250 (unified)

If `Ns' is specified on its own line, it should be ignored.  This is
shitty groff behaviour.  Do the same, but raise a warning to this
effect.  This from a TODO noted by schwarze@.

Revision 1.154 / (download) - annotate - [select for diffs], Tue Jan 25 15:46:05 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.153: +22 -2 lines
Diff to previous 1.153 (unified) to selected 1.250 (unified)

Push capitalisation of `Bx' second argument into validator, where it belongs.

Revision 1.153 / (download) - annotate - [select for diffs], Tue Jan 25 10:37:49 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.152: +3 -3 lines
Diff to previous 1.152 (unified) to selected 1.250 (unified)

If %B is specified, quote %T.  Noted by schwarze@ in the TODO.

Revision 1.152 / (download) - annotate - [select for diffs], Sat Jan 22 14:00:52 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.151: +21 -37 lines
Diff to previous 1.151 (unified) to selected 1.250 (unified)

Check argument count validation for all in_line() macros.
Most empty in_line() macros are already removed by the parser,
so there is no need to check again in mdoc_validate.c.
This also downgrades almost all remaining argument count issues
from ERROR to WARNING.
ok kristaps@

Revision 1.151 / (download) - annotate - [select for diffs], Mon Jan 3 23:53:51 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_10_9
Changes since 1.150: +68 -66 lines
Diff to previous 1.150 (unified) to selected 1.250 (unified)

Partial cleanup of argument count validation in mdoc(7):

* Do not segfault on empty .Db, .Rs, .Sm, and .St.
* Let check_count() really throw the requested level, not always ERROR.
* Downgrade most bad argument counts from ERROR to WARNING.
* And some related internal cleanup.

Looks fine to kristaps@.

Note that the macros using eerr_ge1() still need to be checked at a later
time; but as all the others are done, let's use what we already have.

Revision 1.150 / (download) - annotate - [select for diffs], Sat Jan 1 12:18:37 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.149: +17 -4 lines
Diff to previous 1.149 (unified) to selected 1.250 (unified)

Add table processing structures to -mdoc.  This consists of an
external-facing function mdoc_addspan(), then various bits to prohibit
printing and scanning (this requires some if's to be converted into
switch's).

Revision 1.149 / (download) - annotate - [select for diffs], Sat Dec 25 23:25:53 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.148: +4 -17 lines
Diff to previous 1.148 (unified) to selected 1.250 (unified)

Implement schwarze@'s much more elegant version of my %T/%J fix.

Revision 1.148 / (download) - annotate - [select for diffs], Sat Dec 25 13:50:37 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.147: +17 -2 lines
Diff to previous 1.147 (unified) to selected 1.250 (unified)

Specifying both %T and %J in an `Rs' block causes the title to be quoted
instead of underlined.  This only happens in -Tascii, as -T[x]html both
underlines and italicises.

Revision 1.147 / (download) - annotate - [select for diffs], Fri Dec 24 14:00:40 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_8
Changes since 1.146: +59 -79 lines
Diff to previous 1.146 (unified) to selected 1.250 (unified)

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.

Revision 1.146 / (download) - annotate - [select for diffs], Wed Dec 22 22:05:38 2010 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.145: +6 -4 lines
Diff to previous 1.145 (unified) to selected 1.250 (unified)

At the beginning of .Bl, .Sm is allowed,
and .Lp should cause a warning, not an error.
"I don't suppose I mind this." kristaps@

Revision 1.145 / (download) - annotate - [select for diffs], Wed Dec 22 11:15:16 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.144: +77 -75 lines
Diff to previous 1.144 (unified) to selected 1.250 (unified)

Implement reference-counted version of original union mdoc_data.  This
simplifies clean-up and allows for more types without extra hassle.

Also made in-line literal types in -T[x]html use CODE instead of SPAN to
match how literal blocks use PRE.

Revision 1.144 / (download) - annotate - [select for diffs], Thu Dec 16 17:14:48 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.143: +8 -5 lines
Diff to previous 1.143 (unified) to selected 1.250 (unified)

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.

Revision 1.143 / (download) - annotate - [select for diffs], Thu Dec 16 00:57:50 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.142: +3 -18 lines
Diff to previous 1.142 (unified) to selected 1.250 (unified)

Back out last: apparently `Bl', `It', and `Pp' need a little bit more
study to see exactly what's legal and what's not.

Revision 1.142 / (download) - annotate - [select for diffs], Thu Dec 16 00:53:04 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.141: +18 -3 lines
Diff to previous 1.141 (unified) to selected 1.250 (unified)

Allow `It' to have a trailing paragraph if the surrounding list is in
compact mode.

Revision 1.141 / (download) - annotate - [select for diffs], Thu Dec 16 00:25:35 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.140: +16 -14 lines
Diff to previous 1.140 (unified) to selected 1.250 (unified)

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.

Revision 1.140 / (download) - annotate - [select for diffs], Wed Dec 15 23:39:40 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.139: +27 -7 lines
Diff to previous 1.139 (unified) to selected 1.250 (unified)

Add a "last child" member of struct mdoc_node.

Remove `Pp' or `Lp' if it is the FIRST or LAST child of an `Sh' or `Sh' body.

Make "skipping paragraph" be an error, not a warning, as information (an
invoked macro) is ignored.

Revision 1.139 / (download) - annotate - [select for diffs], Thu Dec 9 10:32:22 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.138: +10 -10 lines
Diff to previous 1.138 (unified) to selected 1.250 (unified)

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.

Originally reported by Alex Kozlov, thanks!

Revision 1.138 / (download) - annotate - [select for diffs], Sun Dec 5 15:59:27 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_7
Changes since 1.137: +2 -7 lines
Diff to previous 1.137 (unified) to selected 1.250 (unified)

Remove repeat notification of -width omission.  From a patch by schwarze@.

Revision 1.137 / (download) - annotate - [select for diffs], Sun Dec 5 15:55:01 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.136: +3 -4 lines
Diff to previous 1.136 (unified) to selected 1.250 (unified)

Remove long-standing FIXME regarding the consolidation of WIDTHARG and
NOARGV warnings.  From patch by schwarze@.

Revision 1.136 / (download) - annotate - [select for diffs], Sun Dec 5 15:49:37 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.135: +7 -4 lines
Diff to previous 1.135 (unified) to selected 1.250 (unified)

Merge schwarze@'s patch to allow uname() to fail without causing an exit.

Revision 1.135 / (download) - annotate - [select for diffs], Sun Dec 5 15:37:30 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.134: +7 -11 lines
Diff to previous 1.134 (unified) to selected 1.250 (unified)

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).

Revision 1.134 / (download) - annotate - [select for diffs], Wed Dec 1 13:05:13 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.133: +2 -2 lines
Diff to previous 1.133 (unified) to selected 1.250 (unified)

Fixed a goddamn subtle error causing MDOC_LITERAL to remain set after a
call to `Dl' or `Bd -literal' or unfilled.

Revision 1.133 / (download) - annotate - [select for diffs], Tue Nov 30 14:27:37 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.132: +158 -169 lines
Diff to previous 1.132 (unified) to selected 1.250 (unified)

Simplify the many if ( ! mdoc_nmsg()) return(0) etc. calls with just the
error printing, as this is superseded by exit_status in main.c.

Make check_argv() and check_text() return void.

Make MDOC_Std test in check_argv() to pre_std().

Re-write post_root() to check more conditions before returning.

Revision 1.132 / (download) - annotate - [select for diffs], Tue Nov 30 12:59:20 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.131: +295 -75 lines
Diff to previous 1.131 (unified) to selected 1.250 (unified)

Moved all prologue actions from mdoc_action.c into mdoc_validate.c.  The
file is now ready for removal.

Revision 1.131 / (download) - annotate - [select for diffs], Tue Nov 30 12:35:10 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.130: +156 -1 lines
Diff to previous 1.130 (unified) to selected 1.250 (unified)

Move post_bl() and subfunctions from mdoc_action.c into mdoc_validate.c.

Revision 1.130 / (download) - annotate - [select for diffs], Tue Nov 30 10:32:05 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.129: +57 -12 lines
Diff to previous 1.129 (unified) to selected 1.250 (unified)

Move -column list validation and normal-formisation from mdoc_action.c
into mdoc_validate.c.

Revision 1.129 / (download) - annotate - [select for diffs], Mon Nov 29 16:06:46 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.128: +38 -7 lines
Diff to previous 1.128 (unified) to selected 1.250 (unified)

Migrate `Nm' and `Pa' handling from mdoc_action.c into mdoc_validate.c.

Document that `Pa' is replaced by a tilde, just like `Mt'.

Revision 1.128 / (download) - annotate - [select for diffs], Mon Nov 29 15:45:15 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.127: +74 -11 lines
Diff to previous 1.127 (unified) to selected 1.250 (unified)

Remove left-over rsord[] in mdoc_actions.c.

Remove MANDOCERR_BADLIB (not used).

Moved `St' handling from mdoc_action.c into mdoc_validate.c.

Moved relevant MDOC_LITERAL macros (`Dl', `Bd' subtypes) from
mdoc_action.c into mdoc_validate.c.

Revision 1.127 / (download) - annotate - [select for diffs], Mon Nov 29 14:56:43 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.126: +26 -5 lines
Diff to previous 1.126 (unified) to selected 1.250 (unified)

Move `Lb' handling from mdoc_action.c into mdoc_validate.c.

Revision 1.126 / (download) - annotate - [select for diffs], Mon Nov 29 14:50:33 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.125: +36 -6 lines
Diff to previous 1.125 (unified) to selected 1.250 (unified)

Move `At' handling from mdoc_action.c into mdoc_validate.c.

Revision 1.125 / (download) - annotate - [select for diffs], Mon Nov 29 13:51:03 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.124: +46 -28 lines
Diff to previous 1.124 (unified) to selected 1.250 (unified)

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.

Revision 1.124 / (download) - annotate - [select for diffs], Mon Nov 29 13:12:24 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.123: +10 -8 lines
Diff to previous 1.123 (unified) to selected 1.250 (unified)

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.

Revision 1.123 / (download) - annotate - [select for diffs], Mon Nov 29 13:02:47 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.122: +47 -5 lines
Diff to previous 1.122 (unified) to selected 1.250 (unified)

Move `Mt', `Ar', and `Li' handling from mdoc_action.c into mdoc_validate.c.

Clarify that `Mt' gets a default `~' (as per groff 1.20) and document it
in mdoc.7.

Made `Lk' be removed in mdoc_macro.c if it has no arguments.  This fixes
segfaults in mdoc_{term,html}.c that nobody's managed to raise yet.

Revision 1.122 / (download) - annotate - [select for diffs], Mon Nov 29 12:22:28 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.121: +104 -35 lines
Diff to previous 1.121 (unified) to selected 1.250 (unified)

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.

Revision 1.121 / (download) - annotate - [select for diffs], Mon Oct 11 15:46:19 2010 UTC (13 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.120: +6 -5 lines
Diff to previous 1.120 (unified) to selected 1.250 (unified)

Use proper error for `An' multiple arguments.

Making IGNARGV be an ERROR, not a WARNING, as information is lost.

Revision 1.120 / (download) - annotate - [select for diffs], Mon Oct 11 13:24:33 2010 UTC (13 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.119: +130 -88 lines
Diff to previous 1.119 (unified) to selected 1.250 (unified)

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.

Revision 1.119 / (download) - annotate - [select for diffs], Mon Sep 27 23:03:44 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +2 -2 lines
Diff to previous 1.118 (unified) to selected 1.250 (unified)

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@

Revision 1.118 / (download) - annotate - [select for diffs], Mon Sep 27 11:25:03 2010 UTC (13 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_6
Changes since 1.117: +7 -2 lines
Diff to previous 1.117 (unified) to selected 1.250 (unified)

Consider both `Lp' and `Pp' when stripping prior paragraph marks.

Revision 1.117 / (download) - annotate - [select for diffs], Mon Sep 27 09:26:27 2010 UTC (13 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.116: +24 -4 lines
Diff to previous 1.116 (unified) to selected 1.250 (unified)

Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless -compact is
specified).

Revision 1.116 / (download) - annotate - [select for diffs], Sun Aug 29 10:30:58 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.115: +4 -4 lines
Diff to previous 1.115 (unified) to selected 1.250 (unified)

Made -mdoc `Pp', `Lp', and `br' not FATAL when having arguments.

Revision 1.115 / (download) - annotate - [select for diffs], Fri Aug 20 01:02:07 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +3 -7 lines
Diff to previous 1.114 (unified) to selected 1.250 (unified)

Implement a simple, consistent user interface for error handling.
We now have sufficient practical experience to know what we want,
so this is intended to be final:
- provide -Wlevel (warning, error or fatal) to select what you care about
- provide -Wstop to stop after parsing a file with warnings you care about
- provide consistent exit status codes for those warnings you care about
- fully document what warnings, errors and fatal errors mean
- remove all other cruft from the user interface, less is more:
- remove all -f knobs along with the whole -f option
- remove the old -Werror because calling warnings "fatal" is silly
- always finish parsing each file, unless fatal errors prevent that
This commit also includes a couple of related simplifications behind
the scenes regarding error handling.
Feedback and OK  kristaps@;  Joerg Sonnenberger (NetBSD) and
Sascha Wildner (DragonFly BSD) agree with the general direction.

Revision 1.114 / (download) - annotate - [select for diffs], Mon Jul 26 13:45:49 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_5
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (unified) to selected 1.250 (unified)

Note that `Dd' can be empty.  This found following a thread on discuss@
started by Sascha Wildner, 07/25/2010 06:30 AM.

Revision 1.113 / (download) - annotate - [select for diffs], Wed Jul 21 09:08:26 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_5_PREPDF
Changes since 1.112: +4 -2 lines
Diff to previous 1.112 (unified) to selected 1.250 (unified)

Finally make mdoc argv CPP-defines into a proper enum.

Revision 1.112 / (download) - annotate - [select for diffs], Tue Jul 20 14:56:42 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.111: +20 -20 lines
Diff to previous 1.111 (unified) to selected 1.250 (unified)

Strip non-graphable input characters from input.  The manuals
specifically say that this is not allowed, and were it allowed, output
would be inconsistent across output media (-Tps will puke,
non-your-charset terminals will puke, etc.).

With this done, simplify check_text() to only check escapes and for
tabs.  Add in a new tab warning, too.

Revision 1.111 / (download) - annotate - [select for diffs], Mon Jul 19 11:11:54 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.110: +1 -2 lines
Diff to previous 1.110 (unified) to selected 1.250 (unified)

Remove some FIXMEs: `Ms' accepts arbitrary text, so it can't/shouldn't
be converted into a symbol.

The `Pp' issue has also been fixed.

Revision 1.110 / (download) - annotate - [select for diffs], Tue Jul 13 23:53:20 2010 UTC (13 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +2 -2 lines
Diff to previous 1.109 (unified) to selected 1.250 (unified)

correct lots of copyright notices;
ok kristaps@

Revision 1.109 / (download) - annotate - [select for diffs], Sun Jul 4 21:59:30 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_4
Changes since 1.108: +12 -15 lines
Diff to previous 1.108 (unified) to selected 1.250 (unified)

Cache column sizes and char pointer into mdoc_bl.  Finally get rid of
the loops here and there to track down the MDOC_Column arguments.

Revision 1.108 / (download) - annotate - [select for diffs], Fri Jul 2 17:42:23 2010 UTC (13 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +4 -7 lines
Diff to previous 1.107 (unified) to selected 1.250 (unified)

Not only for -tag lists, but for -hang, -ohang, -inset, -diag,
and -item list as well, empty bodies are OK, they do not even
warrant a warning, much less the error they were throwing.
According to kristaps, joerg@ also brought this up some time ago.
ok kristaps@ jmc@

Revision 1.107 / (download) - annotate - [select for diffs], Fri Jul 2 15:03:14 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.106: +20 -15 lines
Diff to previous 1.106 (unified) to selected 1.250 (unified)

Cached `An' arguments in struct mdoc_an.  Note that this isn't a
pointer like the other data members, as there's no need to copy it around.

Revision 1.106 / (download) - annotate - [select for diffs], Fri Jul 2 13:12:47 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.105: +7 -5 lines
Diff to previous 1.105 (unified) to selected 1.250 (unified)

Fix: was checking HEAD for arguments.

Revision 1.105 / (download) - annotate - [select for diffs], Fri Jul 2 12:54:33 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.104: +57 -23 lines
Diff to previous 1.104 (unified) to selected 1.250 (unified)

Stash `Bf' parameters into struct mdoc_bf.

Revision 1.104 / (download) - annotate - [select for diffs], Thu Jul 1 22:56:17 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.103: +66 -53 lines
Diff to previous 1.103 (unified) to selected 1.250 (unified)

Make struct_bl and struct_bd into pointers.  This removes the need to do
copying on internals after modification.  Even more importantly, if an
ENDBODY token is provided, it would have been impossible for post-change
copying of the data to take place in the BLOCK.  This allows it to
happen by dint of pointers.

Also did some bikeshedding in mdoc_term.c: checking against enum type
and explicitly casting to the "post" function to void.  This is for my
own readability.

Revision 1.103 / (download) - annotate - [select for diffs], Thu Jul 1 21:44:47 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.102: +3 -1 lines
Diff to previous 1.102 (unified) to selected 1.250 (unified)

Prevent validator from puking on ENDBODY `Bl' nodes.

Revision 1.102 / (download) - annotate - [select for diffs], Mon Jun 28 14:39:17 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_3
Changes since 1.101: +6 -1 lines
Diff to previous 1.101 (unified) to selected 1.250 (unified)

Notes: this must be done later.  \b in the input will cause havoc.

Revision 1.101 / (download) - annotate - [select for diffs], Sun Jun 27 17:53:27 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +4 -4 lines
Diff to previous 1.100 (unified) to selected 1.250 (unified)

minor .Bk fixes:
* do not print invalid arguments verbatim (no groffs prints them, either)
* do not trigger TERMP_PREKEEP twice
* do not die from invlid arguments (groff won't die, either)
* continue to ignore even valid arguments (just like groff)
ok kristaps@ on the previous version, before removing my last bug ;)

Revision 1.100 / (download) - annotate - [select for diffs], Sun Jun 27 16:36:22 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.99: +3 -1 lines
Diff to previous 1.99 (unified) to selected 1.250 (unified)

Allow registers to be unset.  Implement and document the `.nr nS val'.

Revision 1.99 / (download) - annotate - [select for diffs], Sun Jun 13 21:02:49 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_2
Changes since 1.98: +14 -12 lines
Diff to previous 1.98 (unified) to selected 1.250 (unified)

Allow -width for lists to be cached in mdoc_bl.  This requires some
trickery because widths may be on-the-fly recalculated.  I don't like
how these are split between mdoc_action.c and mdoc_validate.c, but for
the time being, it'll do.

Revision 1.98 / (download) - annotate - [select for diffs], Sat Jun 12 12:38:01 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.97: +16 -7 lines
Diff to previous 1.97 (unified) to selected 1.250 (unified)

Cached `Bl -offset' into mdoc_bl.  Removed erroneous "-offset defaults
to 6n if no value is specified" and added regression tests for `Bl'
testing against the empty -offset argument.

Revision 1.97 / (download) - annotate - [select for diffs], Sat Jun 12 12:10:55 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.96: +14 -13 lines
Diff to previous 1.96 (unified) to selected 1.250 (unified)

Moved `Bl -compact' into cached data.  This allowed the removal of
scanning the argv list in print_bvspace(), and thus the parent pointer.

Revision 1.96 / (download) - annotate - [select for diffs], Sat Jun 12 11:58:22 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.95: +14 -13 lines
Diff to previous 1.95 (unified) to selected 1.250 (unified)

`Bl' is now using a struct instead of a single enum mdoc_list for its
cached values.  You can probably guess where this is going.

Revision 1.95 / (download) - annotate - [select for diffs], Sat Jun 12 11:41:50 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.94: +3 -18 lines
Diff to previous 1.94 (unified) to selected 1.250 (unified)

Removed stipulation that an empty `Bd -offset' will default to 6n.  Not
sure where this came about.  Added regression tests to convince myself
that this is so.  Also consolidated COMPATIBILITY notes regarding `Bd'.
Added COMPATIBILITY note to the effect that old groff pukes on `Bd
-compact -ragged' (regression test will fail on old groff).

Revision 1.94 / (download) - annotate - [select for diffs], Sat Jun 12 11:21:44 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.93: +60 -13 lines
Diff to previous 1.93 (unified) to selected 1.250 (unified)

Cache all of `Bd's resolved arguments into mdoc_bd, which is stashed in
the "data" union in mdoc_node.  Allows me to remove some ugly loops in
the front-end and duplicate tests in mdoc_action.c.  Add a regression
test to make sure we're not doing anything bad (more to come).

Revision 1.93 / (download) - annotate - [select for diffs], Sat Jun 12 10:09:19 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.92: +43 -21 lines
Diff to previous 1.92 (unified) to selected 1.250 (unified)

Added enum mdoc_disp (similar to enum mdoc_list).  Display types are now
only calculated once in mdoc_validate.c.

Noted that `Bd -file xxx' is not supported:  it now raises a fatal
warning.  This is noted in mdoc.7.

Empty `Bd' now defaults to LIST_ragged, which is not quite what groff
does, but close enough (gross just throws away the `Bd' and gets upset
when it encounters an `Ed').

Revision 1.92 / (download) - annotate - [select for diffs], Wed Jun 9 19:22:56 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.91: +8 -11 lines
Diff to previous 1.91 (unified) to selected 1.250 (unified)

Squash bug noted by Ulrich Spoerlein where "-" were being converted to
ASCII_HYPH, as per normal, but were screwing up mandoc_special().  Fixed
by making mandoc_special() first check isspace() instead of ! isgraph(),
then normalise its string as it passes out.  This require de-constifying
some validation routines not already de-constified (those in libman),
but that's ok, because I'd like to be pushing actions into validation
routines to save on space and redundant calculations.

Revision 1.91 / (download) - annotate - [select for diffs], Thu Jun 3 13:44:36 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_1
Changes since 1.90: +105 -63 lines
Diff to previous 1.90 (unified) to selected 1.250 (unified)

Consolidated list processing to a single loop in mdoc_validate.c.  This
relieves having to repeat running over the argument list in
mdoc_action.c and mdoc_validate.c.

Default to LIST_item for type-less lists (groff technically doesn't do
this: it just ignores the `It' lines altogether).

Make MANDOC_LISTTYPE be a recoverable error.

Revision 1.90 / (download) - annotate - [select for diffs], Mon May 31 23:40:25 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.89: +14 -11 lines
Diff to previous 1.89 (unified) to selected 1.250 (unified)

Cleanup post_bl_head() to use enum mdoc_list (avoid traversing that
list).

Reverted MANDOC_COLUMNS to be a bad-bad syntax error: we don't, and
apparently never have, allowed mixing of -column syntaxes.  This would
have segfaulted if encountered.

Revision 1.89 / (download) - annotate - [select for diffs], Mon May 31 23:10:51 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.88: +40 -72 lines
Diff to previous 1.88 (unified) to selected 1.250 (unified)

Clean up the validation code for `It' macros:  use enum mdoc_list
instead of iterating over arguments and only scan with `-column', which
needs the count of arguments.

Revision 1.88 / (download) - annotate - [select for diffs], Mon May 31 10:28:04 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.87: +2 -1 lines
Diff to previous 1.87 (unified) to selected 1.250 (unified)

Remove enum mdocargerr from phrase() (unused).

Add `Ta' macro, which is basically a NULL case everywhere but in
mdoc_macro.c, where it closes out an existing `It' body scope and opens
a new one, then continues parsing as in phrase() (TODO: merge these
two?).

Fix where scope-breaking was silently just dying instead of printing an
error.

Fix where trailing `Ta' or tab weren't creating a new MDOC_BODY context.

We now support arbitrarily complex `It' contents for `Bl -column'.

Revision 1.87 / (download) - annotate - [select for diffs], Sun May 30 22:56:02 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.86: +10 -8 lines
Diff to previous 1.86 (unified) to selected 1.250 (unified)

Migrate `Bl -column' phrases to be MDOC_BODY instead of MDOC_HEAD.  This
will make it easy for re-entrant parsing of `Ta' macros to fit in with
standard closure rules.

Added some more regressions for `Bl -column'.  Note that one should
fail, as documented in the TODO file.

Recorded change of AST BNF in mdoc.3.

Revision 1.86 / (download) - annotate - [select for diffs], Sun May 30 11:47:44 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.85: +2 -4 lines
Diff to previous 1.85 (unified) to selected 1.250 (unified)

Make check for case a little more intuitive (suggested by joerg@).

Revision 1.85 / (download) - annotate - [select for diffs], Sun May 30 11:00:53 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.84: +25 -4 lines
Diff to previous 1.84 (unified) to selected 1.250 (unified)

Made `Dt' default to LOCAL and UNKNOWN instead of local and unknown (note case).

Have `Dt' default to UNKNOWN if it's an empty string.

Raise a warning if `Dt' title isn't capitalised.

Sync'd `Dt' documentation with reality.

Revision 1.84 / (download) - annotate - [select for diffs], Wed May 26 10:39:35 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.83: +17 -6 lines
Diff to previous 1.83 (unified) to selected 1.250 (unified)

Documented `Ud'.

Proper EOS handling for `Rv', `Ex', `Ud', and `Bt'.

Both `Bt' and `Ud' now warn about and discard line arguments (reported
by Ulrich Spoerlein).

Collapsed posts_xr into posts_wtext (harmless: they're the same thing).

Added regressions for `Ud' and `Bt'.

Revision 1.83 / (download) - annotate - [select for diffs], Wed May 26 09:35:35 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.82: +2 -3 lines
Diff to previous 1.82 (unified) to selected 1.250 (unified)

Fixed `Lb' to be in_line (reported by Ulrich Spoerlein).

Added `Lb' documentation to mdoc.7.

Removed harmless but superfluous pre_lb check (was just NULL entries).

Added regressions for `Lb' (NOTE that these will only run on new groff,
as old groff doesn't support `Lb' at all).

Revision 1.82 / (download) - annotate - [select for diffs], Tue May 25 12:44:53 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.81: +2 -2 lines
Diff to previous 1.81 (unified) to selected 1.250 (unified)

Smarten BADCHAR check to allow ASCII_HYPH.
Fix index.sgml not to puke (the relevant section will be re-written for the release anyway, but I hate seeing errors).

Revision 1.81 / (download) - annotate - [select for diffs], Mon May 24 12:31:16 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.80: +5 -4 lines
Diff to previous 1.80 (unified) to selected 1.250 (unified)

Lifted 64-byte max width for Sh (now BUFSIZ).

Revision 1.80 / (download) - annotate - [select for diffs], Mon May 17 23:57:06 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.79: +11 -19 lines
Diff to previous 1.79 (unified) to selected 1.250 (unified)

Increase performance by stashing the list type in struct mdoc_node.
This will eventually be used so that mdoc_macro can known whether to
dump list line arguments into the body (`Bl -column' overflowing).

Remove a2list() and arg_listtype() because of this.

Revision 1.79 / (download) - annotate - [select for diffs], Mon May 17 22:11:42 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.78: +149 -99 lines
Diff to previous 1.78 (unified) to selected 1.250 (unified)

Enable the unified error/warning enumeration in mandoc.h that's
stringified in main.c.

Allow `An' to handle an argument and child (with a warning).

Allow `Rv' and `Ex' to work without a prior `Nm' as groff does (with a
warning).

Allow inconsistent column syntax to only raise a warning.

Revision 1.78 / (download) - annotate - [select for diffs], Sat May 15 16:24:38 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.77: +9 -10 lines
Diff to previous 1.77 (unified) to selected 1.250 (unified)

LIBRARY can also occur in section 9.
All manual sections (unknown, 3p, 3f, etc.) correctly handled by -mdoc.
Useful warning printed if unknown manual section.
Checking for manual sections (e.g., LIBRARY) checks only first character, so 3p, 3f, etc. are free.

Revision 1.77 / (download) - annotate - [select for diffs], Fri May 14 17:54:26 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.76: +4 -48 lines
Diff to previous 1.76 (unified) to selected 1.250 (unified)

Remove in-manual-section warnings for Fd and Lb (ok joerg@, schwarze@).

Revision 1.76 / (download) - annotate - [select for diffs], Fri May 14 17:31:25 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.75: +2 -36 lines
Diff to previous 1.75 (unified) to selected 1.250 (unified)

Backed out check for `Ex' manual sec (ok schwarze@, joerg@), in turn backing out check_msec() and deps.

Revision 1.75 / (download) - annotate - [select for diffs], Fri May 14 16:02:29 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.74: +2 -2 lines
Diff to previous 1.74 (unified) to selected 1.250 (unified)

"Warn on unknown argument for .At and print it like [new] groff." (patch by Joerg Sonnenberger, ed. Kristaps)
Keep short-log of commits in index.sgml.
Document compatibility with new/old groff in mdoc.7.

Revision 1.74 / (download) - annotate - [select for diffs], Fri May 14 15:26:39 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (unified) to selected 1.250 (unified)

"Invalid standard argument should be a warning. Just leak it into the
output." (patch by Joerg Sonnenberger)

Revision 1.73 / (download) - annotate - [select for diffs], Fri May 14 14:34:29 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (unified) to selected 1.250 (unified)

"If the last column wasn't specified, it is auto-sized." (patch by Joerg Sonnenberger)

Revision 1.72 / (download) - annotate - [select for diffs], Wed May 12 08:41:17 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_25
Changes since 1.71: +8 -5 lines
Diff to previous 1.71 (unified) to selected 1.250 (unified)

mdoc_atosec -> mdoc_str2sec (consistent with str2 being different from a2).
Changed ordering of sections (EXIT STATUS moved around), argued for by Ulrich Sporlein.
Fixed mdoc_str2sec not to use weird structure.

Revision 1.71 / (download) - annotate - [select for diffs], Sun May 9 21:19:42 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.70: +3 -14 lines
Diff to previous 1.70 (unified) to selected 1.250 (unified)

Remove -fno-ign-chars as well-argued by Ingo Schwarze.  Patch by Ingo Schwarze, too.

Revision 1.70 / (download) - annotate - [select for diffs], Sat May 8 07:30:19 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_24
Changes since 1.69: +2 -2 lines
Diff to previous 1.69 (unified) to selected 1.250 (unified)

Lint fixes (type-safety for enums via -cefuh).

Revision 1.69 / (download) - annotate - [select for diffs], Wed Apr 7 19:35:42 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.68: +2 -14 lines
Diff to previous 1.68 (unified) to selected 1.250 (unified)

Removed manual-section-calling restrictions for `Cd' and and `Ex' (requested by Joerg Sonnenberger).

Revision 1.68 / (download) - annotate - [select for diffs], Wed Apr 7 18:50:35 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (unified) to selected 1.250 (unified)

Allowing `Cd' to be in section 9 (noted by Joerg Sonnenberger).

Revision 1.67 / (download) - annotate - [select for diffs], Tue Apr 6 17:01:27 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_23
Changes since 1.66: +2 -11 lines
Diff to previous 1.66 (unified) to selected 1.250 (unified)

Removed warning for `Er' when not used in certain sections (pointed out by Joerg Sonnenberger).

Revision 1.66 / (download) - annotate - [select for diffs], Tue Apr 6 16:27:53 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.65: +4 -2 lines
Diff to previous 1.65 (unified) to selected 1.250 (unified)

Allow `Bd' to accept (warn about then ignore) in-line arguments.

Revision 1.65 / (download) - annotate - [select for diffs], Tue Apr 6 11:52:25 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.64: +13 -12 lines
Diff to previous 1.64 (unified) to selected 1.250 (unified)

Cleaned up post_bl_head() and fixed erroneous reporting of child nodes.

Revision 1.64 / (download) - annotate - [select for diffs], Tue Apr 6 11:28:17 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.63: +4 -3 lines
Diff to previous 1.63 (unified) to selected 1.250 (unified)

Let `Bl' accept arguments on the head line with a warning (these are ignored in the front-end device) (noted by Theo de Raadt).

Revision 1.63 / (download) - annotate - [select for diffs], Sat Apr 3 14:25:12 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (unified) to selected 1.250 (unified)

Merged patch by Ingo Schwarze allowing `Xr' to pass through with no arguments (emits warning of course).

Revision 1.62 / (download) - annotate - [select for diffs], Sat Apr 3 14:12:48 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.61: +3 -1 lines
Diff to previous 1.61 (unified) to selected 1.250 (unified)

Modified version of Ingo Schwarze's patch so that -man doesn't puke when a TH isn't specified.

Revision 1.61 / (download) - annotate - [select for diffs], Sat Apr 3 14:02:10 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.60: +14 -3 lines
Diff to previous 1.60 (unified) to selected 1.250 (unified)

Merged Ingo Schwarze's patch (plus documentation) for removing extraneous list types, which happens fairly often.

Revision 1.60 / (download) - annotate - [select for diffs], Sat Apr 3 13:02:35 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.59: +4 -3 lines
Diff to previous 1.59 (unified) to selected 1.250 (unified)

Merging patch by Ingo Schwarze.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Mar 31 07:13:53 2010 UTC (14 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_22
Changes since 1.58: +3 -3 lines
Diff to previous 1.58 (unified) to selected 1.250 (unified)

Macro types enum-ated (enum mdoct) (for easier debugging in gdb of "tok" values).
Initial check-in of Ingo Schwarze's patch for Xo/Xc handling (in blocks ifdef'd "UGLY").
Put Oc-close-Op parts into UGLY ifdef blocks.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Feb 17 19:28:11 2010 UTC (14 years, 1 month ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_21, VERSION_1_9_20, VERSION_1_9_19, VERSION_1_9_18, VERSION_1_9_17, VERSION_1_9_16, VERSION_1_9_15
Changes since 1.57: +2 -4 lines
Diff to previous 1.57 (unified) to selected 1.250 (unified)

Made `Xr' compatible with groff calling conventions where arguments following the
trailing section are implicitly `Ns'd.  Based on a patch submitted by Ingo Schwarze.

Revision 1.57 / (download) - annotate - [select for diffs], Sat Jan 30 08:42:21 2010 UTC (14 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.56: +30 -2 lines
Diff to previous 1.56 (unified) to selected 1.250 (unified)

Fix in handling Vt in SYNOPSIS with trailing punctuation.  Spotted by Joerg Sonnenberger.

Revision 1.56 / (download) - annotate - [select for diffs], Fri Jan 1 17:14:30 2010 UTC (14 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_15-pre2
Changes since 1.55: +5 -5 lines
Diff to previous 1.55 (unified) to selected 1.250 (unified)

Big check-in of compatibility layer.  This should work on most major architectures. Thanks to Joerg Sonnenberger.

Revision 1.55 / (download) - annotate - [select for diffs], Fri Jan 1 15:14:03 2010 UTC (14 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_15-pre1
Changes since 1.54: +11 -4 lines
Diff to previous 1.54 (unified) to selected 1.250 (unified)

`Bl' lets `Sm' slip by as a child.  Noted by Ingo Schwarze.

Revision 1.54 / (download) - annotate - [select for diffs], Mon Nov 2 06:22:46 2009 UTC (14 years, 4 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_14, VERSION_1_9_13
Changes since 1.53: +4 -2 lines
Diff to previous 1.53 (unified) to selected 1.250 (unified)

Added mandoc_a2time() for proper date conversion.
Fitted TH and Dd handlers to use mandoc_a2time().
Documented date syntax for -man, fixed documentation for -mdoc.

Revision 1.53 / (download) - annotate - [select for diffs], Sat Oct 31 08:34:12 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.52: +3 -1 lines
Diff to previous 1.52 (unified) to selected 1.250 (unified)

Fixed -Thtml printing of -ohang lists (-mdoc).
Fixed validation of -ohang lists as having no widths.

Revision 1.52 / (download) - annotate - [select for diffs], Sat Oct 31 06:10:58 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_12
Changes since 1.51: +1 -2 lines
Diff to previous 1.51 (unified) to selected 1.250 (unified)

Using perror() instead of fprintf for failure from library functions.

Revision 1.51 / (download) - annotate - [select for diffs], Mon Oct 26 04:09:46 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_11, VERSION_1_9_10
Changes since 1.50: +6 -7 lines
Diff to previous 1.50 (unified) to selected 1.250 (unified)

Full `%U' support.
`Lk' display fixed.
Renamed arg2xxxx as a2xxxx for consistency.
Renamed print_foot to print_man_foot for consistency.
Removed default printing of `~' when `Lk' not provided (not sure where I got that from).

Revision 1.50 / (download) - annotate - [select for diffs], Sat Oct 24 05:52:14 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.49: +4 -1 lines
Diff to previous 1.49 (unified) to selected 1.250 (unified)

Added `%U' to -mdoc (doesn't render in a nice way yet).

Revision 1.49 / (download) - annotate - [select for diffs], Thu Oct 22 10:35:33 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.48: +3 -1 lines
Diff to previous 1.48 (unified) to selected 1.250 (unified)

Fix adding -centred to `Bd' types (thanks to Joerg Sonnenberger).

Revision 1.48 / (download) - annotate - [select for diffs], Mon Oct 19 09:40:23 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_9
Changes since 1.47: +1 -3 lines
Diff to previous 1.47 (unified) to selected 1.250 (unified)

Fixed `-file' argument to `Bd', which is NOT a type, but instead just an argument.

Revision 1.47 / (download) - annotate - [select for diffs], Mon Oct 19 07:34:44 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.46: +3 -3 lines
Diff to previous 1.46 (unified) to selected 1.250 (unified)

Beginning of mdoc.7 full-reference in place.

Revision 1.46 / (download) - annotate - [select for diffs], Sun Oct 18 13:26:16 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.45: +4 -34 lines
Diff to previous 1.45 (unified) to selected 1.250 (unified)

Removed restrictions on `sp' (maybe a warning, someday, but for now be simple).

Revision 1.45 / (download) - annotate - [select for diffs], Thu Oct 15 02:56:51 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.44: +15 -7 lines
Diff to previous 1.44 (unified) to selected 1.250 (unified)

Added warning about specifying list arguments before type (suggested by Joerg Sonnenberg).

Revision 1.44 / (download) - annotate - [select for diffs], Thu Sep 24 15:08:41 2009 UTC (14 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_8, VERSION_1_9_7, VERSION_1_9_6
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (unified) to selected 1.250 (unified)

Fixed segfault in `Rs' empty block.

Revision 1.43 / (download) - annotate - [select for diffs], Thu Sep 24 15:01:06 2009 UTC (14 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.42: +49 -5 lines
Diff to previous 1.42 (unified) to selected 1.250 (unified)

Added EBADCHILD error (bad child of parent context).
`Rs' post-checks that all children are proper bibliographic elements.
`Rs' correctly re-orders its children as per groff's output (including %C).

Revision 1.42 / (download) - annotate - [select for diffs], Thu Aug 20 13:22:48 2009 UTC (14 years, 7 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_5, VERSION_1_9_2, VERSION_1_9_1
Changes since 1.41: +3 -16 lines
Diff to previous 1.41 (unified) to selected 1.250 (unified)

Updated manual structure in mdoc.7.
Synchronised mdoc.template and mdoc.7 manual structure.
`Rv' and `Ex' now accept multiple arguments (-std made standalone, terms as children).
`Rv' and `Ex' format correctly in -Tascii (plurals, commas, etc.).

Revision 1.41 / (download) - annotate - [select for diffs], Sat Jul 25 16:03:03 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_0, VERSION_1_8_5, VERSION_1_8_4
Changes since 1.40: +2 -1 lines
Diff to previous 1.40 (unified) to selected 1.250 (unified)

Patches and results of LLVM static analysis (thanks uqs@sporlein.net).

Revision 1.40 / (download) - annotate - [select for diffs], Fri Jul 24 12:09:37 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (unified) to selected 1.250 (unified)

`An' gives correct error message in encountering arguments/parameters.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Jul 23 08:36:32 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_8_3
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (unified) to selected 1.250 (unified)

Bl -column now accepts columns = (1 + stated columns), which covers all remaining column usage/abuse I can see.

Revision 1.38 / (download) - annotate - [select for diffs], Mon Jul 20 15:05:34 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_8_2
Changes since 1.37: +14 -5 lines
Diff to previous 1.37 (unified) to selected 1.250 (unified)

Undocumented behaviour in groff: `Bl -column' implies `-compact'.
mandoc now allows fewer columns than the -width specifies.

Revision 1.37 / (download) - annotate - [select for diffs], Sat Jul 18 23:31:04 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_8_1
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (unified) to selected 1.250 (unified)

More clarity fixes in mdoc.7.
Sm/Sy argument to `Bf' fixed (schwarze@openbsd).

Revision 1.36 / (download) - annotate - [select for diffs], Fri Jul 17 12:40:48 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.35: +4 -2 lines
Diff to previous 1.35 (unified) to selected 1.250 (unified)

`sp' documented: validates & produces correct output.

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jul 17 12:27:49 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.34: +35 -4 lines
Diff to previous 1.34 (unified) to selected 1.250 (unified)

Removed EARGVPARM (superfluous, overly error-generating).
Added `sp' handler.

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jul 17 12:08:08 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.33: +3 -4 lines
Diff to previous 1.33 (unified) to selected 1.250 (unified)

Documented `br' macro in mdoc.7.
Made `Pp' and `Lp' be inline_eoln() (not sure why they weren't before).

Revision 1.33 / (download) - annotate - [select for diffs], Fri Jul 17 10:56:57 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (unified) to selected 1.250 (unified)

Added `br' and `sp' macros (requested by joerg@netbsd.org, jmc@openbsd.org).

Revision 1.32 / (download) - annotate - [select for diffs], Mon Jul 13 07:23:07 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_8_0
Changes since 1.31: +111 -121 lines
Diff to previous 1.31 (unified) to selected 1.250 (unified)

Err/warn fix (schwarze@openbsd.org).
Lots of whitespace churn in getting functions aligned nicely.

Revision 1.31 / (download) - annotate - [select for diffs], Sun Jul 12 20:50:08 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.30: +14 -2 lines
Diff to previous 1.30 (unified) to selected 1.250 (unified)

Replacement of `Lb' in mdoc_action.c.
Added warning against bogus `Lb' (like groff does).
Added proper quotes around `Lb' in mdoc_term.c.
Moved mdoc_a2lib -> libmdoc (where it belongs).

Revision 1.30 / (download) - annotate - [select for diffs], Sun Jul 12 20:30:35 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (unified) to selected 1.250 (unified)

Moved mdoc_a2st() out of mdoc.h -> libmdoc.h (replacement in mdoc_action.c).
Made bad standards into an error (were a warning).

Revision 1.29 / (download) - annotate - [select for diffs], Sun Jul 12 16:41:33 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (unified) to selected 1.250 (unified)

Check for NAME sanity fixed (last named section -> last section).

Revision 1.28 / (download) - annotate - [select for diffs], Sun Jul 12 16:38:15 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.27: +3 -1 lines
Diff to previous 1.27 (unified) to selected 1.250 (unified)

Added back in MDOC_TEXT stipulation in NAME check (post-Nm punctuation, duh).

Revision 1.27 / (download) - annotate - [select for diffs], Sun Jul 12 16:34:16 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.26: +6 -5 lines
Diff to previous 1.26 (unified) to selected 1.250 (unified)

`Nd' is now a BFI (was an ELEM).  Noted by joerg@netbsd.org, behaviour ok jmc@openbsd.org, etc.

Revision 1.26 / (download) - annotate - [select for diffs], Sun Jul 12 09:13:21 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_24
Changes since 1.25: +5 -3 lines
Diff to previous 1.25 (unified) to selected 1.250 (unified)

Fixed mdoc_nwarn/mdoc_nerr considering themselves err/warn instead of warn/err (BIG mistake).  From suggestion by <joerg@netbsd.org>.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jul 7 11:47:17 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.24: +2 -4 lines
Diff to previous 1.24 (unified) to selected 1.250 (unified)

Made `In' handling work in new-groff style (see mdoc.samples).

Revision 1.24 / (download) - annotate - [select for diffs], Tue Jul 7 09:52:08 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_23
Changes since 1.23: +3 -5 lines
Diff to previous 1.23 (unified) to selected 1.250 (unified)

Small clean-ups in error message usage.
Version.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jul 6 13:04:52 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +74 -222 lines
Diff to previous 1.22 (unified) to selected 1.250 (unified)

Consolidated all err/warnings into mdoc.c via libmdoc.h.

Revision 1.22 / (download) - annotate - [select for diffs], Mon Jul 6 11:05:29 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (unified) to selected 1.250 (unified)

Fix in MDOC_IGN_CHARS ref.

Revision 1.21 / (download) - annotate - [select for diffs], Mon Jul 6 11:00:05 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +84 -110 lines
Diff to previous 1.20 (unified) to selected 1.250 (unified)

Consolidated mdoc_validate.c pwarn into perr (slowly phasing out per-file pre-formatted error strings).

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jul 6 09:21:24 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.19: +6 -12 lines
Diff to previous 1.19 (unified) to selected 1.250 (unified)

Initial removal of enum mdoc_warn from mdoc warnings (unnecessary complication).

Revision 1.19 / (download) - annotate - [select for diffs], Sat Jul 4 10:41:29 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_22, VERSION_1_7_21
Changes since 1.18: +1 -6 lines
Diff to previous 1.18 (unified) to selected 1.250 (unified)

Removed WDEPCOL (schwarze@openbsd.org).

Revision 1.18 / (download) - annotate - [select for diffs], Sat Jul 4 09:01:55 2009 UTC (14 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +7 -5 lines
Diff to previous 1.17 (unified) to selected 1.250 (unified)

Moved escape validation into libmandoc.h/mandoc.c (common between libman/libmdoc1).
libman supports MAN_IGN_ESCAPE (like MDOC_IGN_ESCAPE).
All popular escapes now handled consistently.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Jun 27 09:03:03 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.16: +1 -9 lines
Diff to previous 1.16 (unified) to selected 1.250 (unified)

Removed escape-deprecation note (better solution in progress, schwarze@openbsd.org).
Using EXIT_FAILURE for parse errors (nicm@openbsd.org).
Fixed use of warn/warnx (nicm@openbsd.org).
Fixed use of getsubopt (nicm@openbsd.org).

Revision 1.16 / (download) - annotate - [select for diffs], Thu Jun 18 20:46:19 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_20
Changes since 1.15: +3 -18 lines
Diff to previous 1.15 (unified) to selected 1.250 (unified)

Added nchild decrement in libman (not used, but better in than forgotten).
Added nchild to libmdoc, deprecated count() functions in validator.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jun 17 14:10:09 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_19
Changes since 1.14: +3 -4 lines
Diff to previous 1.14 (unified) to selected 1.250 (unified)

Lint fixes.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Jun 17 14:08:47 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +32 -18 lines
Diff to previous 1.13 (unified) to selected 1.250 (unified)

`Bl -column' now correctly handles tail entries (Bl -column -more... arg0...).

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jun 17 11:02:06 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +14 -19 lines
Diff to previous 1.12 (unified) to selected 1.250 (unified)

Cleaned up .Bf validator.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Jun 17 10:53:32 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.11: +26 -25 lines
Diff to previous 1.11 (unified) to selected 1.250 (unified)

Section orders are more elegantly handled (MDOC_PBODY is a flag).
Cleaned up string->enum conversion for section lookup.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Jun 17 09:41:00 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +9 -3 lines
Diff to previous 1.10 (unified) to selected 1.250 (unified)

Noted deprecation of \*( and \* special-character escapes.
Minor clean-ups.

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jun 16 19:45:51 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +2 -3 lines
Diff to previous 1.9 (unified) to selected 1.250 (unified)

Removed MDOC___: moved MDOC_Ap to its index (comments not passed into mdoc parser).

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jun 12 09:18:00 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_17, VERSION_1_7_16, VERSION_1_7_15
Changes since 1.8: +7 -5 lines
Diff to previous 1.8 (unified) to selected 1.250 (unified)

`Lk' is correctly handled as CALLABLE (note groff munges nested output).
`Mt' is now CALLABLE.
Fixed missing validate/action of zero-element, non-called inline elements.
Fixed missing validate/action of nested inline element re-calls.
Fixed bogus column argv index in validator.

Revision 1.8 / (download) - annotate - [select for diffs], Thu Jun 11 10:34:31 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_14
Changes since 1.7: +56 -29 lines
Diff to previous 1.7 (unified) to selected 1.250 (unified)

Clean up validation of field widths.
Pushed field-width warn/error into warn/error routine.
Removed superfluous space at output eoln.
Fixed overzealous line break in lists.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jun 10 20:18:43 2009 UTC (14 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (unified) to selected 1.250 (unified)

Fixed license email address.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Apr 12 19:49:35 2009 UTC (14 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_13
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (unified) to selected 1.250 (unified)

Version bumped.
`.Er' has more section restrictions (Joerg).

Revision 1.5 / (download) - annotate - [select for diffs], Sun Apr 12 19:45:26 2009 UTC (14 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +10 -12 lines
Diff to previous 1.4 (unified) to selected 1.250 (unified)

Using proper license template (const).

Revision 1.4 / (download) - annotate - [select for diffs], Sun Apr 12 19:19:57 2009 UTC (14 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +18 -3 lines
Diff to previous 1.3 (unified) to selected 1.250 (unified)

Manual .Dt fields CAPITALISED.
Indent set to 5 chars (nroff compat).
Half-indent set to 3 chars (nroff compat).
Default behaviour is loose-y (ignore macro/char/escape).
Added -fstrict.
Added unknown-character ignoring.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Apr 2 16:37:40 2009 UTC (14 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_12, VERSION_1_7_10, OPENBSD_CHECKIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (unified) to selected 1.250 (unified)

Added -p1003.1-2008 specification.
Fixed invalid memory accesses (concat()).
Made -fign-macro be the default for libman.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Mar 31 13:50:19 2009 UTC (15 years ago) by kristaps
Branch: MAIN
Changes since 1.1: +63 -52 lines
Diff to previous 1.1 (unified) to selected 1.250 (unified)

General clean-ups.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Mar 25 15:17:49 2009 UTC (15 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_7_5
Diff to selected 1.250 (unified)

Added man validator, renamed mdoc validator.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb