OpenBSD CVS

CVS log for src/usr.bin/mandoc/mandoc.h


[BACK] Up to [local] / src / usr.bin / mandoc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.224 / (download) - annotate - [select for diffs], Sat Oct 21 17:10:12 2023 UTC (6 months, 4 weeks ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.223: +1 -2 lines
Diff to previous 1.223 (colored)

When parsing a macro argument results in delayed escape sequence
expansion, re-check for all contained escape sequences whether they
need delayed expansion, not just for the particular escape sequences
that triggered delayed expansion in the first place.  This is needed
because delayed expansion can result in strings containing nested
escape sequences recursively needing delayed expansion, too.

This fixes an assertion failure in krb5_openlog(3), see:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266882

Thanks to Wolfram Schneider <wosch at FreeBSD> for reporting the bug
and to Baptiste Daroussin <bapt at FreeBSD> for forwarding the report.

Revision 1.223 / (download) - annotate - [select for diffs], Tue Aug 16 17:29:18 2022 UTC (21 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.222: +3 -1 lines
Diff to previous 1.222 (colored)

Even though the constant ASCII_ESC is only used in the roff pre-parser roff.c,
move it to the top level include file mandoc.h to reduce the risk of causing
clashes when introducing new ASCII_* constants in the future.

Revision 1.222 / (download) - annotate - [select for diffs], Mon Aug 15 17:59:00 2022 UTC (21 months ago) by schwarze
Branch: MAIN
Changes since 1.221: +4 -3 lines
Diff to previous 1.221 (colored)

Distinguish between escape sequences that produce no output
whatsoever (for example \fR) and escape sequences that produce
invisible zero-width output (for example \&).  No, i'm not joking,
groff does make that distinction, and it has consequences in some
situations, for example for vertical spacing in no-fill mode.
Heirloom and Plan 9 behaviour is subtly different, but in case of
doubt, we want to follow groff.

While this fixes the behaviour for the majority of escape sequences,
in particular for those most likely to occur in practice, it is not
perfect yet because some of the more exotic ESCAPE_IGNORE sequences
are actually of the "no output whatsoever" type but treated
as "invisible zero-width" for now.  With the new ASCII_NBRZW mechanism
in place, switching them over one by one when the need arises will
no longer be very difficult.

Revision 1.221 / (download) - annotate - [select for diffs], Tue Jun 7 09:51:03 2022 UTC (23 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.220: +3 -2 lines
Diff to previous 1.220 (colored)

Split the excessively generic diagnostic message "invalid escape sequence"
into the more specific messages "invalid escape argument delimiter"
and "invalid escape sequence argument".

Revision 1.220 / (download) - annotate - [select for diffs], Sun Jun 5 13:42:49 2022 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.219: +6 -1 lines
Diff to previous 1.219 (colored)

With the improved escape sequence parser, it becomes easy to also improve
diagnostics.  Distinguish "incomplete escape sequence", "invalid special
character", and "unknown special character" from the generic "invalid
escape sequence", also promoting them from WARNING to ERROR because
incomplete escape sequences are severe syntax violations and because
encountering an invalid or unknown special character makes it likely
that part of the document content intended by the authors gets lost.

Revision 1.219 / (download) - annotate - [select for diffs], Thu May 19 15:17:50 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.218: +7 -6 lines
Diff to previous 1.218 (colored)

Make roff_expand() parse left-to-right rather than right-to-left.
Some escape sequences have side effects on global state, implying
that the order of evaluation matters.  For example, this fixes the
long-standing bug that "\n+x\n+x\n+x" after ".nr x 0 1" used to
print "321"; now it correctly prints "123".

Right-to-left parsing was convenient because it implicitly handled
nested escape sequences.  With correct left-to-right parsing, nesting
now requires an explicit implementation, here solved as follows:
1. Handle nested expanding escape sequences iteratively.
When finding one, expand it, then retry parsing the enclosing escape
sequence from the beginning, which will ultimately succeed as soon
as it no longer contains any nested expanding escape sequences.
2. Handle nested non-expanding escape sequences recursively.
When finding one, the escape sequence parser calls itself to find
the end of the inner sequence, then continues parsing the outer
sequence after that point.

This requires the mandoc_escape() function to operate in two different
modes.  The roff(7) parser uses it in a mode where it generates
diagnostics and may return an expansion request instead of a parse
result.  All other callers, in particular the formatters, use it
in a simpler mode that never generates diagnostics and always returns
a definite parsing result, but that requires all expanding escape
sequences to already have been expanded earlier.  The bulk of the
code is the same for both modes.
Since this required a major rewrite of the function anyway, move
it into its own new file roff_escape.c and out of the file mandoc.c,
which was misnamed in the first place and lacks a clear focus.

As a side benefit, this also fixes a number of assertion failures
that tb@ found with afl(1), for example "\n\\\\*0", "\v\-\\*0",
and "\w\-\\\\\$0*0".

As another side benefit, it also resolves some code duplication
between mandoc_escape() and roff_expand() and centralizes all
handling of escape sequences (except for expansion) in roff_escape.c,
hopefully easing maintenance and feature improvements in the future.

While here, also move end-of-input handling out of the complicated
function roff_expand() and into the simpler function roff_parse_comment(),
making the logic easier to understand.

Since this is a major reorganization of a central component of
mandoc(1), stability of the program might slightly suffer for a few
weeks, but i believe that's not a problem at this point of the
release cycle.  The new code already satisfies the regression suite,
but more tweaking and regression testing to further improve the
handling of various escape sequences will likely follow in the near
future.

Revision 1.218 / (download) - annotate - [select for diffs], Thu Apr 28 16:16:46 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.217: +3 -1 lines
Diff to previous 1.217 (colored)

The syntax of the roff(7) .mc request is quite special
and the roff_onearg() parsing function is too generic,
so provide a dedicated parsing function instead.

This fixes an assertion failure when an \o escape sequence is
passed as the argument; the bug was found by tb@ using afl(1).
It also makes mandoc output more similar to groff in various cases.

Revision 1.217 / (download) - annotate - [select for diffs], Sun Apr 24 13:34:53 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.216: +3 -2 lines
Diff to previous 1.216 (colored)

If a .shift request has a negative argument, do not use a negative array
index but use 0 instead of the argument, just like groff.
Warn about the invalid argument.
While here, fix the column number in another warning message.

Segfault reported by tb@, found with afl(1).

Revision 1.216 / (download) - annotate - [select for diffs], Sat Aug 14 13:51:46 2021 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.215: +2 -1 lines
Diff to previous 1.215 (colored)

print a BAGARG message if -T markdown is requested on man(7) input;
suggested by Michael Stapelberg at debian dot org

Revision 1.215 / (download) - annotate - [select for diffs], Tue Aug 10 12:36:42 2021 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.214: +4 -2 lines
Diff to previous 1.214 (colored)

Support two-character font names (BI, CW, CR, CB, CI)
in the tbl(7) layout font modifier.

Get rid of the TBL_CELL_BOLD and TBL_CELL_ITALIC flags and use
the usual ESCAPE_FONT* enum mandoc_esc members from mandoc.h instead,
which simplifies and unifies some code.

While here, also support CB and CI in roff(7) \f escape sequences
and in roff(7) .ft requests for all output modes.  Using those is
certainly not recommended because portability is limited even with
groff, but supporting them makes some existing third-party manual
pages look better, in particular in HTML output mode.

Bug-compatible with groff as far as i'm aware, except that i consider
font names starting with the '\n' (ASCII 0x0a line feed) character
so insane that i decided to not support them.

Missing feature reported by nabijaczleweli dot xyz in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992002.
I used none of the code from the initial patch submitted by
nabijaczleweli, but some of their ideas.
Final patch tested by them, too.

Revision 1.214 / (download) - annotate - [select for diffs], Sun Jul 4 15:38:08 2021 UTC (2 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.213: +4 -2 lines
Diff to previous 1.213 (colored)

The mandoc(1) manual already mentions that -T man output mode
neither supports tbl(7) nor eqn(7) input.
If an input file contains such code anyway, tell the user
rather than failing an assert(3)ion.

Fixing a crash reported by Bjarni Ingi Gislason <bjarniig at rhi dot hi dot is>
in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901636 which the
Debian maintainer of mandoc, Michael at Stapelberg dot ch, forwarded to me.

Revision 1.213 / (download) - annotate - [select for diffs], Sun Jun 27 17:57:13 2021 UTC (2 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.212: +2 -1 lines
Diff to previous 1.212 (colored)

add a style message about overlong text lines,
trying very hard to avoid false positives,
not at all trying to catch as many cases as possible;

feature originally suggested by tb@,
OK tb@ kn@ jmc@

Revision 1.212 / (download) - annotate - [select for diffs], Wed Jun 2 18:27:37 2021 UTC (2 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.211: +2 -2 lines
Diff to previous 1.211 (colored)

In -W style mode, check .Xr links along the full manpath because
that is more useful for validating manuals of non-base software.
Nothing changes in -W all mode: by default for -T lint, we still
assume we want to check base system conventions, including usually
not wanting to link to non-base manual pages.

The use case, a partial idea how to handle it, and a preliminary
patch was originally presented by kn@, then refined by me.
Final patch tested and OK'ed by kn@.

Revision 1.211 / (download) - annotate - [select for diffs], Tue Sep 1 18:24:09 2020 UTC (3 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.210: +2 -1 lines
Diff to previous 1.210 (colored)

Ignore unreasonably large spacing modifiers in tbl layouts.

Jan Schreiber <jes at posteo dot de> ran afl on mandoc and it turned
out mandoc tried to use spacing modifiers so large that they would
trigger assertion failures in term_ascii.c, function locale_advance().

Revision 1.210 / (download) - annotate - [select for diffs], Fri Apr 24 11:58:02 2020 UTC (4 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.209: +2 -1 lines
Diff to previous 1.209 (colored)

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.209 / (download) - annotate - [select for diffs], Fri Apr 3 11:34:19 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.208: +4 -3 lines
Diff to previous 1.208 (colored)

Remove some stray argument names from function prototypes,
for consistency with the dominant style used in mandoc.
No functional change.
Patch from Martin Vahlensieck <academicsolutions dot ch>.

Revision 1.208 / (download) - annotate - [select for diffs], Sun Jan 19 17:59:01 2020 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.207: +2 -1 lines
Diff to previous 1.207 (colored)

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.207 / (download) - annotate - [select for diffs], Sun Jan 19 16:16:33 2020 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.206: +3 -3 lines
Diff to previous 1.206 (colored)

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.206 / (download) - annotate - [select for diffs], Sun Jul 14 18:14:27 2019 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.205: +2 -1 lines
Diff to previous 1.205 (colored)

If messages are shown and output is printed without a pager, display
a heads-up on stderr at the end because otherwise, users may easily
miss the messages: because messages typically occur while parsing,
they typically preceed the output.  This is most useful with flag
combinations like "-c -W all" but may also help in some unusual
error scenarios.
Inconvenient ordering of output originally pointed out by espie@
for the example situation that /tmp/ is not writeable.

Revision 1.205 / (download) - annotate - [select for diffs], Wed Jul 10 19:38:56 2019 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.204: +31 -3 lines
Diff to previous 1.204 (colored)

Some time ago, i simplified mandoc_msg() such that it can be used
everywhere and not only in the parsers.
For more uniform messages, use it at more places instead of err(3),
in particular in the main program.
While here, integrate a few trivial functions called at exactly one
place into the main option parser, and let a few more functions use
the normal convention of returning 0 for success and -1 for error.

Revision 1.204 / (download) - annotate - [select for diffs], Sat Dec 15 23:33:20 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.203: +2 -1 lines
Diff to previous 1.203 (colored)

Yet another round of improvements to manual font selection.

Unify handling of \f and .ft.
Support \f4 (bold+italic).
Support ".ft BI" and ".ft CW" for terminal output.
Support the .ft request in HTML output.
Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP.

Revision 1.203 / (download) - annotate - [select for diffs], Sat Dec 15 19:30:19 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.202: +5 -1 lines
Diff to previous 1.202 (colored)

Several improvements to escape sequence handling.

* Add the missing special character \_ (underscore).
* Partial implementations of \a (leader character)
and \E (uninterpreted escape character).
* Parse and ignore \r (reverse line feed).
* Add a WARNING message about undefined escape sequences.
* Add an UNSUPP message about unsupported escape sequences.
* Mark \! and \? (transparent throughput)
and \O (suppress output) as unsupported.
* Treat the various variants of zero-width spaces as one-byte escape
sequences rather than as special characters, to avoid defining bogus
forms with square brackets.
* For special characters with one-byte names, do not define bogus
forms with square brackets, except for \[-], which is valid.
* In the form with square brackets, undefined special characters do not
fall back to printing the name verbatim, not even for one-byte names.
* Starting a special character name with a blank is an error.
* Undefined escape sequences never abort formatting of the input
string, not even in HTML output mode.
* Document the newly handled escapes, and a few that were missing.
* Regression tests for most of the above.

Revision 1.202 / (download) - annotate - [select for diffs], Fri Dec 14 05:17:45 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.201: +3 -5 lines
Diff to previous 1.201 (colored)

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.201 / (download) - annotate - [select for diffs], Fri Dec 14 01:17:46 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.200: +12 -4 lines
Diff to previous 1.200 (colored)

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback.  It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.

Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.

Revision 1.200 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:14 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.199: +4 -33 lines
Diff to previous 1.199 (colored)

Cleanup, no functional change:
Split the top level parser interface out of the utility header
mandoc.h, into a new header mandoc_parse.h, for use in the main
program and in the main parser only.
Move enum mandoc_os into roff.h because struct roff_man is the
place where it is stored.
This allows removal of mandoc.h from seven files in low-level
parsers and in formatters.

Revision 1.199 / (download) - annotate - [select for diffs], Thu Dec 13 05:13:15 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.198: +1 -69 lines
Diff to previous 1.198 (colored)

Cleanup, no functional change:
No need to expose the eqn(7) syntax tree data structures everywhere.
Move them to their own include file, "eqn.h".
While here, delete the unused enum eqn_pilet.

Revision 1.198 / (download) - annotate - [select for diffs], Wed Dec 12 21:54:30 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.197: +2 -107 lines
Diff to previous 1.197 (colored)

Cleanup, no functional change:
No need to expose the tbl(7) syntax tree data structures everywhere.
Move them to their own include file, "tbl.h", and improve comments.

Revision 1.197 / (download) - annotate - [select for diffs], Sun Nov 25 19:23:59 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.196: +3 -2 lines
Diff to previous 1.196 (colored)

In tbl(7) -T html output,
span cells horizontally and vertically as requested by the layout.
Does not handle spans requested in the data section yet.

To be able to do this, record the number of rows spanned
in the first data cell (struct tbl_dat) of a vertical span.

Missing feature reported by Pali dot Rohar at gmail dot com.

Revision 1.196 / (download) - annotate - [select for diffs], Thu Oct 25 01:21:30 2018 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.195: +2 -1 lines
Diff to previous 1.195 (colored)

Implement the \f(CW and \f(CR (constant width font) escape sequences
for HTML output.  Somewhat relevant because pod2man(1) relies on this.
Missing feature reported by Pali dot Rohar at gmail dot com.

Note that constant width font was already correctly selected before
this when required by semantic markup.  Only attempting physical
markup with the low-level escape sequence was ineffective.

Revision 1.195 / (download) - annotate - [select for diffs], Sat Aug 25 16:43:52 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.194: +3 -1 lines
Diff to previous 1.194 (colored)

Rudimentary implementation of the roff(7) .char (output glyph
definition) request, used for example by groff_hdtbl(7).

This simplistic implementation may interact incorrectly
with the .tr (input character translation) request.
But come on, you are not only using .char *and* .tr, but you do so
with respect to the same character in the same manual page?

Revision 1.194 / (download) - annotate - [select for diffs], Fri Aug 24 22:56:37 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.193: +5 -1 lines
Diff to previous 1.193 (colored)

Rudimentary implementation of the roff(7) .while request.
Needed for example by groff_hdtbl(7).

There are two limitations:
It does not support nested .while requests yet,
and each .while loop must start and end in the same scope.

The roff_parseln() return codes are now more flexible
and allow OR'ing options.

Revision 1.193 / (download) - annotate - [select for diffs], Thu Aug 23 19:32:03 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.192: +2 -3 lines
Diff to previous 1.192 (colored)

The upcoming .while request will have to re-execute roff(7) lines
parsed earlier, so they will have to be saved for reuse - but the
read.c preparser does not know yet whether a line contains a .while
request before passing it to the roff parser.  To cope with that,
save all parsed lines for now.  Even shortens the code by 20 lines.

Revision 1.192 / (download) - annotate - [select for diffs], Thu Aug 23 14:16:12 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.191: +5 -1 lines
Diff to previous 1.191 (colored)

Implement the roff(7) .shift and .return requests,
for example used by groff_hdtbl(7) and groff_mom(7).

Also correctly interpolate arguments during nested macro execution
even after .shift and .return, implemented using a stack of argument
arrays.

Note that only read.c, but not roff.c can detect the end of a macro
execution, and the existence of .shift implies that arguments cannot
be interpolated up front, so unfortunately, this includes a partial
revert of roff.c rev. 1.209, moving argument interpolation back into
the function roff_res().

Revision 1.191 / (download) - annotate - [select for diffs], Thu Aug 16 13:49:40 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.190: +2 -1 lines
Diff to previous 1.190 (colored)

Implement the \*(.T predefined string (interpolate device name)
by allowing the preprocessor to pass it through to the formatters.
Used for example by the groff_char(7) manual page.

Revision 1.190 / (download) - annotate - [select for diffs], Sat Jul 28 18:32:30 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.189: +3 -2 lines
Diff to previous 1.189 (colored)

Issue a STYLE message when normalizing the date format in .Dd/.TH.
Leah Neukirchen pointed out that mdoclint(1) used to warn about a
leading zero before the day number, so we know that both NetBSD and
Void Linux want the message.  It does no harm on OpenBSD because
Mdocdate always does the right thing anyway.
jmc@ agrees that it makes sense in contexts not using Mdocdate.

Revision 1.189 / (download) - annotate - [select for diffs], Fri Mar 16 15:05:33 2018 UTC (6 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.188: +2 -1 lines
Diff to previous 1.188 (colored)

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.188 / (download) - annotate - [select for diffs], Fri Nov 10 22:48:05 2017 UTC (6 years, 6 months ago) by jca
Branch: MAIN
Changes since 1.187: +2 -2 lines
Diff to previous 1.187 (colored)

Be less assertive when warning about a possible typo.

ok schwarze@ "good compromise" jmc@

Revision 1.187 / (download) - annotate - [select for diffs], Sat Jul 8 14:51:01 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.186: +1 -12 lines
Diff to previous 1.186 (colored)

1. Eliminate struct eqn, instead use the existing members
of struct roff_node which is allocated for each equation anyway.
2. Do not keep a list of equation parsers, one parser is enough.
Minus fifty lines of code, no functional change.

Revision 1.186 / (download) - annotate - [select for diffs], Fri Jul 7 19:39:17 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.185: +1 -2 lines
Diff to previous 1.185 (colored)

garbage collect unused enum member EQN_ROOT

Revision 1.185 / (download) - annotate - [select for diffs], Thu Jul 6 22:58:44 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.184: +9 -9 lines
Diff to previous 1.184 (colored)

Now that we have the -Wstyle message level, downgrade six warnings
that are not syntax mistakes and that do not cause wrong formatting
or content to style suggestions.
Also upgrade two warnings that may cause information loss to errors.

Revision 1.184 / (download) - annotate - [select for diffs], Wed Jul 5 15:03:20 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.183: +1 -2 lines
Diff to previous 1.183 (colored)

The EQN_LISTONE box type is pointless.
Simplify by just using EQN_LIST with expectargs = 1.
Noticed while investigating a bug report from bentley@.
No functional change.

Revision 1.183 / (download) - annotate - [select for diffs], Mon Jul 3 17:33:01 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.182: +3 -3 lines
Diff to previous 1.182 (colored)

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.182 / (download) - annotate - [select for diffs], Mon Jul 3 13:40:00 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.181: +2 -1 lines
Diff to previous 1.181 (colored)

warn about time machines; suggested by Thomas Klausner <wiz @ NetBSD>

Revision 1.181 / (download) - annotate - [select for diffs], Sun Jul 2 15:31:48 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.180: +2 -1 lines
Diff to previous 1.180 (colored)

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

Revision 1.180 / (download) - annotate - [select for diffs], Sat Jul 1 09:47:23 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.179: +2 -1 lines
Diff to previous 1.179 (colored)

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.179 / (download) - annotate - [select for diffs], Thu Jun 29 15:21:46 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.178: +3 -1 lines
Diff to previous 1.178 (colored)

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

Revision 1.178 / (download) - annotate - [select for diffs], Sun Jun 25 17:42:37 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.177: +2 -1 lines
Diff to previous 1.177 (colored)

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.177 / (download) - annotate - [select for diffs], Sat Jun 24 18:58:09 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.176: +2 -1 lines
Diff to previous 1.176 (colored)

operating system dependent message about unknown architecture;
inspired by mdoclint

Revision 1.176 / (download) - annotate - [select for diffs], Sat Jun 24 15:59:28 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.175: +2 -1 lines
Diff to previous 1.175 (colored)

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

Revision 1.175 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:27 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.174: +14 -4 lines
Diff to previous 1.174 (colored)

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.174 / (download) - annotate - [select for diffs], Sat Jun 17 23:06:43 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.173: +2 -1 lines
Diff to previous 1.173 (colored)

style message about duplicate RCS ids; inspired by mdoclint

Revision 1.173 / (download) - annotate - [select for diffs], Sat Jun 17 22:40:27 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.172: +2 -1 lines
Diff to previous 1.172 (colored)

style message about missing RCS ids; inspired by mdoclint

Revision 1.172 / (download) - annotate - [select for diffs], Wed Jun 14 01:31:19 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.171: +2 -1 lines
Diff to previous 1.171 (colored)

implement the roff(7) \p (break output line) escape sequence

Revision 1.171 / (download) - annotate - [select for diffs], Sun Jun 11 19:36:31 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.170: +4 -1 lines
Diff to previous 1.170 (colored)

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.170 / (download) - annotate - [select for diffs], Sun Jun 11 17:16:36 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.169: +2 -1 lines
Diff to previous 1.169 (colored)

style message about missing .Fn markup; inspired by mdoclint

Revision 1.169 / (download) - annotate - [select for diffs], Sat Jun 10 01:48:31 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.168: +2 -1 lines
Diff to previous 1.168 (colored)

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

Revision 1.168 / (download) - annotate - [select for diffs], Thu Jun 8 18:11:15 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.167: +7 -4 lines
Diff to previous 1.167 (colored)

Implement w layout specifier (minimum column width).
Improve width calculation of text blocks.
Reduces the groff/mandoc diff in Base+Xenocara by about 800 lines.

Revision 1.167 / (download) - annotate - [select for diffs], Thu Jun 8 00:21:23 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.166: +2 -1 lines
Diff to previous 1.166 (colored)

Portable mandoc just got a warning about unknown .Lb names
which we don't want in OpenBSD, but let's keep the message table
and the manual page in sync.

Revision 1.166 / (download) - annotate - [select for diffs], Wed Jun 7 23:29:31 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.165: +3 -1 lines
Diff to previous 1.165 (colored)

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

Revision 1.165 / (download) - annotate - [select for diffs], Tue Jun 6 15:00:56 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.164: +2 -1 lines
Diff to previous 1.164 (colored)

Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.

Revision 1.164 / (download) - annotate - [select for diffs], Sat Jun 3 15:54:09 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.163: +2 -1 lines
Diff to previous 1.163 (colored)

ignore blank lines in man(7) next line scope;
strange groff edge case behaviour found in multimedia/mjpegtools

Revision 1.163 / (download) - annotate - [select for diffs], Fri Jun 2 19:21:03 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.162: +2 -1 lines
Diff to previous 1.162 (colored)

Partial implementation of \h (horizontal line drawing function).
A full implementation would require access to output device properties
and state variables (both only available after the main parser has
finalized the parse tree) before numerical expansions in the roff
preprocessor (i.e., before the main parser is even started).

Not trying to pull that stunt right now because the static-width
implementation committed here is sufficient for tcl-style manual pages
and already more complicated than i would have suspected.

Revision 1.162 / (download) - annotate - [select for diffs], Thu Jun 1 19:05:15 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.161: +2 -1 lines
Diff to previous 1.161 (colored)

Minimal implementation of the \h (horizontal motion) escape sequence.
Good enough to cope with the average DocBook insanity.

Revision 1.161 / (download) - annotate - [select for diffs], Thu Jun 1 15:24:41 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.160: +2 -1 lines
Diff to previous 1.160 (colored)

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

Revision 1.160 / (download) - annotate - [select for diffs], Wed May 31 15:30:12 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.159: +2 -1 lines
Diff to previous 1.159 (colored)

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

Revision 1.159 / (download) - annotate - [select for diffs], Tue May 30 19:29:31 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.158: +3 -1 lines
Diff to previous 1.158 (colored)

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

Revision 1.158 / (download) - annotate - [select for diffs], Tue May 16 19:05:36 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.157: +4 -2 lines
Diff to previous 1.157 (colored)

Introduce a new mandoc(1) message level, -W style, below -W warning.
Switch -W all from meaning -W warning to meaning -W style.
The meaning of -T lint does *not* change, it still implies -W warning.
No messages on the new level yet, but they will come.

Usually, i do not lightly make the user interface larger.
But this has been planned for years, and EXIT STATUS 1
was reserved for it all the time.  The message system
is now stable enough to finally implement it.

jmc@ regarding the concept: "really good idea"

Revision 1.157 / (download) - annotate - [select for diffs], Mon Mar 6 17:25:24 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.156: +2 -1 lines
Diff to previous 1.156 (colored)

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.156 / (download) - annotate - [select for diffs], Sat Jan 28 23:26:56 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.155: +2 -1 lines
Diff to previous 1.155 (colored)

Add a warning "new sentence, new line".
This does not attempt to pinpoint each and every offender, but
instead tries very hard to avoid false positives: Currently, there
are only two false positives in the whole OpenBSD base system.
Only do this in mdoc(7), not in man(7), because manuals written
in man(7) typically have much worse problems than this.
OK jmc@ on a previous version of the patch

Revision 1.155 / (download) - annotate - [select for diffs], Mon Jan 9 01:36:22 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.154: +2 -1 lines
Diff to previous 1.154 (colored)

Warnings and errors that occur during mdoc_validate()
or during man_validate() have to affect the mandoc(1) EXIT STATUS.
Many thanks to <Yuri dot Pankov at gmail dot com> (illumos developer)
for reporting this regression.

Revision 1.154 / (download) - annotate - [select for diffs], Sun Jan 8 00:10:22 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.153: +4 -3 lines
Diff to previous 1.153 (colored)

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.153 / (download) - annotate - [select for diffs], Wed Dec 28 17:21:17 2016 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.152: +2 -1 lines
Diff to previous 1.152 (colored)

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.152 / (download) - annotate - [select for diffs], Sun Oct 9 18:16:46 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.151: +2 -2 lines
Diff to previous 1.151 (colored)

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.151 / (download) - annotate - [select for diffs], Fri Jan 8 02:53:09 2016 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.150: +3 -3 lines
Diff to previous 1.150 (colored)

Simplify the mparse_open() interface.
Just return the file descriptor or -1 on error;
there is just one kind of error anyway.
Suggested by Christos Zoulas (NetBSD).

Revision 1.150 / (download) - annotate - [select for diffs], Sat Nov 7 13:57:55 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.149: +1 -4 lines
Diff to previous 1.149 (colored)

In private header files, __BEGIN_DECLS and __END_DECLS are pointless.
Because these work slightly differently on different systems,
they are becoming a maintenance burden in the portable version,
so delete them.

Besides, one of the chief design goals of the mandoc toolbox is to
make sure that nothing related to documentation requires C++.
Consequently, linking mandoc against any kind of C++ program would
defeat the purpose and is not supported.
I don't understand why kristaps@ added them in the first place.

Revision 1.149 / (download) - annotate - [select for diffs], Fri Oct 30 19:03:36 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.148: +2 -1 lines
Diff to previous 1.148 (colored)

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.148 / (download) - annotate - [select for diffs], Tue Oct 13 22:57:49 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.147: +6 -10 lines
Diff to previous 1.147 (colored)

Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table.
* Make the character table static in the chars.c module:
There is no need to pass a pointer around, we most certainly
never want to use two different character tables concurrently.
* No need to keep the characters in a separate file chars.in;
that merely encourages downstream porters to mess with them.
* Sort the characters to agree with the mandoc_chars(7) manual page.
* Specify Unicode codepoints in hex, not decimal (that's the detail
that originally triggered this patch).
No functional change, minus 100 LOC, and i don't see a performance change.

Revision 1.147 / (download) - annotate - [select for diffs], Mon Sep 14 15:35:47 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.146: +1 -2 lines
Diff to previous 1.146 (colored)

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.146 / (download) - annotate - [select for diffs], Sun Jul 19 05:59:07 2015 UTC (8 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.145: +1 -2 lines
Diff to previous 1.145 (colored)

Do not fork and exec gunzip(1), just link with libz instead.
As discussed with deraadt@, that's cleaner and will help tame(2).
Something like this was also suggested earlier by bapt at FreeBSD.
Minus 50 lines of code, deleting one interface function (mparse_wait),
no functional change intended.

Revision 1.145 / (download) - annotate - [select for diffs], Sat Apr 18 16:34:03 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.144: +2 -2 lines
Diff to previous 1.144 (colored)

Profit from the unified struct roff_man and reduce the number of
arguments of mparse_result() by one.  No functional change.
Written on the ICE Bruxelles-Koeln on the way back from p2k15.

Revision 1.144 / (download) - annotate - [select for diffs], Sat Apr 18 16:04:40 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.143: +6 -7 lines
Diff to previous 1.143 (colored)

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.143 / (download) - annotate - [select for diffs], Mon Feb 23 13:30:02 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.142: +5 -2 lines
Diff to previous 1.142 (colored)

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

Revision 1.142 / (download) - annotate - [select for diffs], Fri Feb 6 16:05:51 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.141: +3 -2 lines
Diff to previous 1.141 (colored)

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

Revision 1.141 / (download) - annotate - [select for diffs], Fri Feb 6 11:54:03 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.140: +3 -1 lines
Diff to previous 1.140 (colored)

better error reporting regarding .OP .RS .UR .TH arguments

Revision 1.140 / (download) - annotate - [select for diffs], Fri Feb 6 07:12:34 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.139: +2 -2 lines
Diff to previous 1.139 (colored)

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.139 / (download) - annotate - [select for diffs], Fri Feb 6 03:31:11 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.138: +2 -1 lines
Diff to previous 1.138 (colored)

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

Revision 1.138 / (download) - annotate - [select for diffs], Wed Feb 4 18:03:28 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.137: +2 -1 lines
Diff to previous 1.137 (colored)

discard .Rs head arguments and improve .Rs diagnostics

Revision 1.137 / (download) - annotate - [select for diffs], Wed Feb 4 16:38:31 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.136: +2 -1 lines
Diff to previous 1.136 (colored)

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

Revision 1.136 / (download) - annotate - [select for diffs], Fri Jan 30 17:31:20 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +1 -4 lines
Diff to previous 1.135 (colored)

Delete the redundant tbl span flags, just inspect the actual data
where needed, which is less fragile.
This fixes a subtle NULL pointer access to tp->tbl.cols:
Due to a bug in the man(7) parser, the first span of a table can
end up in a .TP head, in which case tblcalc() was never called.
Found by jsg@ with afl.

Revision 1.135 / (download) - annotate - [select for diffs], Fri Jan 30 04:08:37 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.134: +2 -14 lines
Diff to previous 1.134 (colored)

Abolish struct tbl_head and replace it by an "int col" member in
struct tbl_cell.  No functional change, minus 40 lines of code.

Revision 1.134 / (download) - annotate - [select for diffs], Wed Jan 28 21:10:28 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.133: +1 -7 lines
Diff to previous 1.133 (colored)

Clean up eqn(7) error handling:
* When "define" fails, do not drop the whole equation.
* Free memory after "undef".
* Use standard mandoc error types instead of rolling our own.
* Delete obfuscating EQN_MSG() macro.
* Add function prototypes while here.

Revision 1.133 / (download) - annotate - [select for diffs], Wed Jan 28 17:30:37 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +8 -8 lines
Diff to previous 1.132 (colored)

* Polish tbl(7) error reporting.
* Do not print out macro names in tbl(7) data blocks.
* Like with GNU tbl, let empty tables cause a blank line.
* Avoid producing empty tables in -Tman.

Revision 1.132 / (download) - annotate - [select for diffs], Tue Jan 27 05:20:30 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.131: +7 -5 lines
Diff to previous 1.131 (colored)

Multiple parser and formatter fixes for line drawing in tbl(7).
* Allow mixing vertical line bars with the layout options
of the preceding layout cell.
* Correctly combine box options with layout lines.
* Correctly print vertical lines in data rows, with the right spacing.
* Correctly print cross markers and left and right ends of
horizontal lines even if vertical lines differ above and below.
* Avoid the bogus error message "no table data cells"
when a table data section starts with a horizontal line.
No increase in code size.

Revision 1.131 / (download) - annotate - [select for diffs], Mon Jan 26 18:41:45 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +10 -3 lines
Diff to previous 1.130 (colored)

Rework tbl(7) layout parsing:
* Continue parsing even if part of the input is invalid.
* Do not require whitespace between cell specifications.
* Allow tabs as well as blanks between modifiers.
* Mark the 'm' modifier as unsupported.
* Parse and ignore the 'p' and 'v' modifiers.
* Better warning and error messages.
* Get rid of a static buffer.
Improved functionality but minus 50 lines of code.

Revision 1.130 / (download) - annotate - [select for diffs], Mon Jan 26 13:02:53 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.129: +3 -1 lines
Diff to previous 1.129 (colored)

More improvements regarding tbl(7) options.
* Treat "allbox" as an alias for "box" for now.
* Parse and ignore the GNU tbl "nowarn" option.
* For separation, allow spaces, tabs, and commas only.
* Mark eqn(7) within tbl(7) as unsupported.
* Simplify the option table.
* Improve and sort documentation.

Revision 1.129 / (download) - annotate - [select for diffs], Mon Jan 26 00:54:09 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.128: +5 -4 lines
Diff to previous 1.128 (colored)

Improve (or rather, rewrite) tbl(7) option parsing.
* Allow the layout to start after the semicolon on the options line.
* Ignore leading commas.
* Option arguments cannot contain closing parentheses.
* Avoid needless UNSUPP messages.
* Better ERROR reporting.
* Delete unused "linesize" field in struct tbl_opts.
* No need for static buffers.
* Garbage collect one almost empty wrapper function.
Improved functionality, but minus 40 lines of code.

Revision 1.128 / (download) - annotate - [select for diffs], Sat Jan 24 01:59:40 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.127: +2 -1 lines
Diff to previous 1.127 (colored)

Support .RE with an argument; needed for audio/pms(1).

Revision 1.127 / (download) - annotate - [select for diffs], Thu Jan 22 21:36:44 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +3 -2 lines
Diff to previous 1.126 (colored)

Traditional roff(7) explicitly allows certain control characters
in the input stream (SOH, STX, ETX, ENQ, ACK, BEL, BS) for specific
purposes (leaders, backspace, delimiters, .tr), but making sure
these don't leak through to the output is tricky, so mark them as
unsupported for now.

Revision 1.126 / (download) - annotate - [select for diffs], Wed Jan 21 20:20:49 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.125: +3 -2 lines
Diff to previous 1.125 (colored)

Rudimentary implementation of the roff(7) \o escape sequence (overstrike).
This is of some relevance because the pod2man(1) preamble abuses it
for the icelandic letter Thorn, instead of simply using \(TP and \(Tp.
Missing feature found by sthen@ in DateTime::Locale::is_IS(3p).

Revision 1.125 / (download) - annotate - [select for diffs], Tue Jan 20 21:12:46 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.124: +13 -8 lines
Diff to previous 1.124 (colored)

Split the -Werror message level into -Werror (broken manual, probably
using mandoc is better than using groff) and -Wunsupp (manual using
unsupported low-level roff(7) feature, probably using groff is better
than using mandoc).  Once this feature is complete, it is intended
to help porting, making the decision whether to USE_GROFF easier.

As a first step, distinguish four classes of roff(7) requests:
1. Supported (currently 24 requests)
2. Currently ignored because unimportant (120)  ->  no message
3. Ignored for good because insecure (14)  ->  -Werror
4. Currently unsupported (68)  ->  these trigger the new -Wunsupp messages

Revision 1.124 / (download) - annotate - [select for diffs], Thu Jan 15 04:26:06 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +2 -5 lines
Diff to previous 1.123 (colored)

Fatal errors no longer exist.
If a file can be opened, mandoc will produce some output;
at worst, the output may be almost empty.
Simplifies error handling and frees a message type for future use.

Revision 1.123 / (download) - annotate - [select for diffs], Thu Jan 15 02:29:07 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +2 -2 lines
Diff to previous 1.122 (colored)

downgrade .so failure from FATAL to ERROR

Revision 1.122 / (download) - annotate - [select for diffs], Wed Jan 14 22:57:57 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.121: +2 -2 lines
Diff to previous 1.121 (colored)

downgrade ".so with absolute path" from FATAL to ERROR;
allows to get rid of ROFF_ERR

Revision 1.121 / (download) - annotate - [select for diffs], Wed Jan 14 22:02:00 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +2 -7 lines
Diff to previous 1.120 (colored)

To get rid of SYSERR entries in enum mandocerr, downgrade problems with
missing and unreadable files from SYSERR to ERROR.
Needed for upcoming work.
As a bonus, this minimally simplifies code and documentation.

Revision 1.120 / (download) - annotate - [select for diffs], Wed Jan 14 17:45:25 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +1 -8 lines
Diff to previous 1.119 (colored)

Simplify handling of system errors: just exit(3).
We already do the same for malloc(3) failure.
The is no virtue in trying to survive failure of fork(2) and the like.

Revision 1.119 / (download) - annotate - [select for diffs], Tue Dec 16 23:44:16 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +2 -1 lines
Diff to previous 1.118 (colored)

Ignore mdoc(7) and man(7) macros inside tbl(7) code because they
would abort the table in an unclean way, causing assertion failures
found by jsg@.

Revision 1.118 / (download) - annotate - [select for diffs], Mon Dec 1 08:05:02 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.117: +3 -3 lines
Diff to previous 1.117 (colored)

header cleanup:
* add missing forward declarations
* remove needless header inclusions
* some style unification

Revision 1.117 / (download) - annotate - [select for diffs], Sun Nov 30 05:28:00 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.116: +2 -1 lines
Diff to previous 1.116 (colored)

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.116 / (download) - annotate - [select for diffs], Sun Nov 30 02:31:32 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.115: +2 -1 lines
Diff to previous 1.115 (colored)

warn about attempts to call non-callable macros;
inspired by a similar warning in the groff_mdoc(7) macros

Revision 1.115 / (download) - annotate - [select for diffs], Fri Nov 28 18:07:38 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +1 -2 lines
Diff to previous 1.114 (colored)

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.114 / (download) - annotate - [select for diffs], Thu Nov 27 23:35:03 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored)

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.113 / (download) - annotate - [select for diffs], Thu Nov 27 14:31:29 2014 UTC (9 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.112: +1 -5 lines
Diff to previous 1.112 (colored)

remove unneccessary inclusion protection; ok schwarze

Revision 1.112 / (download) - annotate - [select for diffs], Wed Nov 26 21:40:11 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.111: +3 -4 lines
Diff to previous 1.111 (colored)

Simplify the mparse_open()/mparse_wait() interface.
Don't bother the user with the PID of the child process,
store it inside the opaque mparse handle.

Revision 1.111 / (download) - annotate - [select for diffs], Thu Oct 30 00:05:02 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +3 -1 lines
Diff to previous 1.110 (colored)

support UTF-8 and ISO-8859-1 input by integrating modified parts
of kristaps@' version of the preconv(1) utility into mandoc(1);
positive feedback from bentley@ and no concern raised when shown on tech@

Revision 1.110 / (download) - annotate - [select for diffs], Wed Oct 29 00:17:01 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +2 -2 lines
Diff to previous 1.109 (colored)

In terminal output, unify handling of Unicode and numbered character
escape sequences just like it was earlier implemented for -Thtml.
Do not let control characters other than ASCII 9 (horizontal tab)
propagate to the output, even though groff allows them; but that
really doesn't look like a great idea.

Let mchars_num2char() return int such that we can distinguish invalid \N
syntax from \N'0'.  This also reduces the danger of signed char issues
popping up.

Revision 1.109 / (download) - annotate - [select for diffs], Tue Oct 28 17:35:42 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +2 -2 lines
Diff to previous 1.108 (colored)

Make the character table available to libroff so it can check the
validity of character escape names and warn about unknown ones.
This requires mchars_spec2cp() to report unknown names again.
Fortunately, that doesn't require changing the calling code because
according to groff, invalid character escapes should not produce
output anyway, and now that we warn about them, that's fine.

Revision 1.108 / (download) - annotate - [select for diffs], Sun Oct 26 18:06:28 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +2 -1 lines
Diff to previous 1.107 (colored)

In -Tascii mode, provide approximations even for some Unicode escape
sequences above codepoint 512 by doing a reverse lookup in the
existing mandoc_char(7) character table.

Again, groff isn't smart enough to do this and silently discards such
escape sequences without printing anything.

Revision 1.107 / (download) - annotate - [select for diffs], Mon Oct 20 19:21:31 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.106: +2 -1 lines
Diff to previous 1.106 (colored)

protect the roff parser from dividing by zero;
issue found and patch written by kristaps@

Revision 1.106 / (download) - annotate - [select for diffs], Tue Oct 14 02:16:02 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.105: +2 -1 lines
Diff to previous 1.105 (colored)

Rudimentary implementation of the e, x, and z table layout modifiers
to equalize, maximize, and ignore the width of columns.
Does not yet take vertical rulers into account,
and does not do line breaks within table cells.
Considerably improves the lftp(1) manual; issue noticed by sthen@.

Revision 1.105 / (download) - annotate - [select for diffs], Sun Oct 12 19:10:56 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.104: +2 -2 lines
Diff to previous 1.104 (colored)

Improve error handling in the eqn(7) parser.
Get rid of the first fatal error, MANDOCERR_EQNSYNT.
In eqn(7), there is no need to be bug-compatible with groff, so there
is no need to abondon the whole equation in case of a syntax error.

In particular:
* Skip "back", "delim", "down", "fwd", "gfont", "gsize", "left",
  "right", "size", and "up" without arguments.
* Skip "gsize" and "size" with a non-numeric argument.
* Skip closing delimiters that are not open.
* Skip "above" outside piles.
* For diacritic marks and binary operators without a left operand,
  default to an empty box.
* Let piles and matrices take one argument rather than insisting
  on a braced list.  Let HTML output handle that, too.
* When rewinding, if the root box is guaranteed to match
  the termination condition, no error handling is needed.

Revision 1.104 / (download) - annotate - [select for diffs], Sat Oct 11 21:14:11 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.103: +2 -1 lines
Diff to previous 1.103 (colored)

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.103 / (download) - annotate - [select for diffs], Fri Oct 10 15:25:06 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +13 -20 lines
Diff to previous 1.102 (colored)

Partial eqn(7) rewrite by kristaps@ in order to get operator precedence right.

Revision 1.102 / (download) - annotate - [select for diffs], Thu Oct 9 15:59:08 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +3 -2 lines
Diff to previous 1.101 (colored)

parse and render "from" and "to" clauses in eqn, and render matrices;
written by kristaps@ during EuroBSDCon

Revision 1.101 / (download) - annotate - [select for diffs], Thu Oct 9 15:21:46 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +3 -1 lines
Diff to previous 1.100 (colored)

parse simultaneous sub- and superscripts
and make the eqn_box list doubly linked;
written by kristaps@ during EuroBSDCon

Revision 1.100 / (download) - annotate - [select for diffs], Fri Sep 12 00:53:21 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +2 -1 lines
Diff to previous 1.99 (colored)

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

Revision 1.99 / (download) - annotate - [select for diffs], Thu Sep 11 23:52:47 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +3 -1 lines
Diff to previous 1.98 (colored)

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

Revision 1.98 / (download) - annotate - [select for diffs], Sun Sep 7 23:24:33 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.97: +2 -1 lines
Diff to previous 1.97 (colored)

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

Revision 1.97 / (download) - annotate - [select for diffs], Wed Sep 3 23:20:33 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +12 -2 lines
Diff to previous 1.96 (colored)

Add *.gz support to apropos(1) -a, manm(1), and even mandoc(1).
Implemented by moving the zip code from makewhatis(8) to the parser lib.

Revision 1.96 / (download) - annotate - [select for diffs], Fri Aug 8 16:17:09 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +8 -5 lines
Diff to previous 1.95 (colored)

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.95 / (download) - annotate - [select for diffs], Fri Aug 8 15:54:10 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.94: +30 -30 lines
Diff to previous 1.94 (colored)

mention requests and macros in more messages

Revision 1.94 / (download) - annotate - [select for diffs], Fri Aug 8 15:48:43 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.93: +1 -2 lines
Diff to previous 1.93 (colored)

Dynamically allocate the stack of roff(7) .ie condition values
and thus get rid of the last useless fatal error.

Revision 1.93 / (download) - annotate - [select for diffs], Fri Aug 8 15:45:58 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +3 -2 lines
Diff to previous 1.92 (colored)

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

Revision 1.92 / (download) - annotate - [select for diffs], Fri Aug 8 15:42:39 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.91: +1 -2 lines
Diff to previous 1.91 (colored)

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 bsd.lv 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.91 / (download) - annotate - [select for diffs], Fri Aug 8 15:38:46 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +1 -2 lines
Diff to previous 1.90 (colored)

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.90 / (download) - annotate - [select for diffs], Fri Aug 8 15:26:28 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +2 -2 lines
Diff to previous 1.89 (colored)

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.89 / (download) - annotate - [select for diffs], Fri Aug 8 15:21:17 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +1 -3 lines
Diff to previous 1.88 (colored)

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.88 / (download) - annotate - [select for diffs], Fri Aug 8 15:15:27 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +4 -4 lines
Diff to previous 1.87 (colored)

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

Revision 1.87 / (download) - annotate - [select for diffs], Fri Aug 8 15:10:14 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +3 -2 lines
Diff to previous 1.86 (colored)

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.86 / (download) - annotate - [select for diffs], Wed Jul 9 11:30:07 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.85: +3 -2 lines
Diff to previous 1.85 (colored)

mark defos as const; nobody needs to change it,
and it is occasionally useful to be able to pass literal strings

Revision 1.85 / (download) - annotate - [select for diffs], Mon Jul 7 21:35:42 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.84: +11 -8 lines
Diff to previous 1.84 (colored)

Clean up ERROR messages related to document structure and macros:
Hierarchical naming and mention macro names in messages.

Revision 1.84 / (download) - annotate - [select for diffs], Mon Jul 7 16:12:06 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (colored)

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

Revision 1.83 / (download) - annotate - [select for diffs], Mon Jul 7 15:03:24 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +1 -2 lines
Diff to previous 1.82 (colored)

no need to skip content before first section header

Revision 1.82 / (download) - annotate - [select for diffs], Mon Jul 7 11:34:41 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +1 -2 lines
Diff to previous 1.81 (colored)

implement .dei and .ami

Revision 1.81 / (download) - annotate - [select for diffs], Sun Jul 6 19:08:56 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +9 -8 lines
Diff to previous 1.80 (colored)

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

Revision 1.80 / (download) - annotate - [select for diffs], Sat Jul 5 12:33:54 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.79: +9 -10 lines
Diff to previous 1.79 (colored)

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.79 / (download) - annotate - [select for diffs], Sat Jul 5 01:11:33 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +3 -2 lines
Diff to previous 1.78 (colored)

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.78 / (download) - annotate - [select for diffs], Fri Jul 4 16:11:41 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +5 -4 lines
Diff to previous 1.77 (colored)

Clean up messages regarding excess arguments:
* Downgrade ".Bf -emphasis Em" from FATAL to WARNING.
* Mention the macros, the arguments, and the fallbacks.
* Hierarchical naming.
Also fix the handling of excess .It head arguments in -Tman.

Revision 1.77 / (download) - annotate - [select for diffs], Fri Jul 4 01:50:03 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.76: +8 -9 lines
Diff to previous 1.76 (colored)

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.76 / (download) - annotate - [select for diffs], Thu Jul 3 23:23:45 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

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.75 / (download) - annotate - [select for diffs], Thu Jul 3 21:23:08 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +4 -2 lines
Diff to previous 1.74 (colored)

MANDOCERR_NOARGS reported three completely unrelated classes of problems.
Split the roff(7) parts out of it and report the request names for these cases.

Revision 1.74 / (download) - annotate - [select for diffs], Wed Jul 2 20:18:42 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

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

Revision 1.73 / (download) - annotate - [select for diffs], Wed Jul 2 13:10:15 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +4 -2 lines
Diff to previous 1.72 (colored)

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.72 / (download) - annotate - [select for diffs], Wed Jul 2 11:42:56 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +7 -7 lines
Diff to previous 1.71 (colored)

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.71 / (download) - annotate - [select for diffs], Wed Jul 2 05:51:49 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +3 -3 lines
Diff to previous 1.70 (colored)

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

Revision 1.70 / (download) - annotate - [select for diffs], Wed Jul 2 03:47:07 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.69: +2 -2 lines
Diff to previous 1.69 (colored)

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.69 / (download) - annotate - [select for diffs], Tue Jul 1 22:36:35 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +18 -18 lines
Diff to previous 1.68 (colored)

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.68 / (download) - annotate - [select for diffs], Mon Jun 30 23:45:03 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +6 -10 lines
Diff to previous 1.67 (colored)

garbage collect two unused enum mandocerr items
and fix a couple of comments while here

Revision 1.67 / (download) - annotate - [select for diffs], Wed Jun 25 00:19:17 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +3 -2 lines
Diff to previous 1.66 (colored)

Improve messages related to the roff(7) .so request.

In all these messages, show the filename argument that was passed
to the .so request.

In case of failure, show an additional message reporting the file
and the line number where the failing request was found.
The existing message reporting the reason for the failure -
for example, "Permission denied" - is left in place, unchanged.

Inspired by a question asked by Nick@ after he saw the
confusing old messages that used to be emitted in this area.

Revision 1.66 / (download) - annotate - [select for diffs], Fri Jun 20 22:58:41 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +3 -2 lines
Diff to previous 1.65 (colored)

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.65 / (download) - annotate - [select for diffs], Fri Jun 20 17:23:09 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +11 -11 lines
Diff to previous 1.64 (colored)

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.64 / (download) - annotate - [select for diffs], Sun Apr 20 16:44:44 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.63: +6 -6 lines
Diff to previous 1.63 (colored)

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

Revision 1.63 / (download) - annotate - [select for diffs], Fri Mar 28 23:25:54 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.62: +2 -1 lines
Diff to previous 1.62 (colored)

Allow leading and trailing vertical lines,
and format them in the same way as groff.
While here, do not require whitespace before vertical lines
in layout specifications.
Issues found by bentley@ in mpv(1).

Revision 1.62 / (download) - annotate - [select for diffs], Fri Mar 21 22:17:01 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +2 -7 lines
Diff to previous 1.61 (colored)

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.61 / (download) - annotate - [select for diffs], Wed Mar 19 22:20:36 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

Without the MPARSE_SO option, if the file contains nothing but a
single .so request, do not read the file pointed to, but instead
let mparse_result() provide the file name pointed to as a return
value.  To be used by makewhatis(8) in the future.

Revision 1.60 / (download) - annotate - [select for diffs], Wed Mar 19 21:50:59 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +8 -12 lines
Diff to previous 1.59 (colored)

Generalize the mparse_alloc() and roff_alloc() functions by giving
them an "options" argument, replacing the existing "inttype" and
"quick" arguments, preparing for a future MPARSE_SO option.
Store this argument in struct mparse and struct roff, replacing the
existing "inttype", "parsetype", and "quick" members.
No functional change except one tiny cosmetic fix in roff_TH().

Revision 1.59 / (download) - annotate - [select for diffs], Wed Jan 22 20:58:35 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.58: +2 -1 lines
Diff to previous 1.58 (colored)

Implement the \: (optional line break) escape sequence,
documented in the Ossanna-Kernighan-Ritter troff manual
and also supported by groff.

Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.

Revision 1.58 / (download) - annotate - [select for diffs], Sun Jan 5 20:26:27 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +2 -2 lines
Diff to previous 1.57 (colored)

Add an option -Q (quick) to mandocdb(8)
for accelerated generation of reduced-size databases.

Implement this by allowing the parsers to optionally
abort the parse sequence after the NAME section.

While here, garbage collect the unused void *arg attribute
of struct mparse and mparse_alloc().

This reduces the processing time of mandocdb(8) on /usr/share/man
by a factor of 2 and the database size by a factor of 4.
However, it still takes 5 times the time and 6 times the space
of makewhatis(8), so more work is clearly needed.

Revision 1.57 / (download) - annotate - [select for diffs], Thu Jan 2 16:29:46 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +10 -2 lines
Diff to previous 1.56 (colored)

Since the functions in read.c are part of the mandoc(3) library,
do not print to stderr.  Instead, properly use the mmsg callback.
Issue noticed by Abhinav Upadhyay <er dot abhinav dot upadhyay
at gmail dot com> and Thomas Klausner <wiz at NetBSD>.

Revision 1.56 / (download) - annotate - [select for diffs], Mon Dec 30 18:27:15 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +2 -3 lines
Diff to previous 1.55 (colored)

Remove duplicate const specifiers from the declaration of mandoc_escape().
Found by Thomas Klausner <wiz at NetBSD dot org> using clang.
No functional change.

Revision 1.55 / (download) - annotate - [select for diffs], Sat Oct 5 21:17:29 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.54: +3 -2 lines
Diff to previous 1.54 (colored)

Cleanup suggested by gcc-4.8.1, following hints by Christos Zoulas:
- avoid bad qualifier casting in roff.c, roff_parsetext()
  by changing the mandoc_escape arguments to "const char const **"
- avoid bad qualifier casting in mandocdb.c, index_merge()
- garbage collect a few unused variables elsewhere

Revision 1.54 / (download) - annotate - [select for diffs], Mon Sep 16 00:25:06 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +2 -2 lines
Diff to previous 1.53 (colored)

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.53 / (download) - annotate - [select for diffs], Thu Aug 8 20:07:24 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +2 -1 lines
Diff to previous 1.52 (colored)

Implement the roff(7) font-escape sequence \f(BI "bold+italic".
This improves the formatting of about 40 base manuals
and reduces groff-mandoc formatting differences in base by about 5%.

Revision 1.52 / (download) - annotate - [select for diffs], Sat Jul 13 12:51:37 2013 UTC (10 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.51: +3 -2 lines
Diff to previous 1.51 (colored)

Rudimentary implementation of the .it request (input line trap).
As with any low-level roff request involving subtle interactions
with macro internals, this implementation is not exact, but it
does handle the simplest cases.

This request occurs in man(7) code generated from DocBook,
for example mysql(1) and yasm_arch(7).
Thanks to brad@ for reporting the issue back in January 2011.

Revision 1.51 / (download) - annotate - [select for diffs], Fri May 31 21:37:08 2013 UTC (10 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +3 -3 lines
Diff to previous 1.50 (colored)

The name "struct tbl" was badly misleading for two reasons:
1) This struct almost exclusively contains the table options.
2) Information about the table as a whole is actually in "struct tbl_node".
Besides, "struct tbl" was almost impossible to search for.
So rename it to "struct tbl_opts".  No functional change.

Revision 1.50 / (download) - annotate - [select for diffs], Mon Nov 19 22:28:35 2012 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.49: +3 -1 lines
Diff to previous 1.49 (colored)

Do not crash on stray .Ta macros found outside column lists.
Problem reported by jmc@, thanks.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Nov 16 22:20:40 2012 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +2 -1 lines
Diff to previous 1.48 (colored)

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

Revision 1.48 / (download) - annotate - [select for diffs], Wed Jul 18 11:09:30 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.47: +2 -1 lines
Diff to previous 1.47 (colored)

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.

Improves formatting of 40 pages, e.g. grep(1), ksh(1), netstat(1),
ath(4), bsd.port.mk(5), pf.conf(5), mount(8), crypto(9).

Revision 1.47 / (download) - annotate - [select for diffs], Thu Jul 12 15:09:50 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

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.

Revision 1.46 / (download) - annotate - [select for diffs], Mon May 28 13:00:51 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.45: +3 -2 lines
Diff to previous 1.45 (colored)

Implement the roff \z escape sequence, intended to output the next
character without advancing the cursor position; implement it to
simply skip the next character, as it will usually be overwritten.

With this change, the pod2man(1) preamble user-defined string \*:,
intended to render as a diaeresis or umlaut diacritic above the
preceding character, is rendered in a slightly less ugly way,
though still not correctly.  It was rendered as "z.." and is now
rendered as ".".

Given that the definition of \*: uses elaborate manual \h positioning,
there is little chance for mandoc(1) to ever render it correctly,
but at least we can refrain from printing out a spurious "z", and
we can make the \z do something semi-reasonable for easier cases.

Revision 1.45 / (download) - annotate - [select for diffs], Sat May 26 20:03:34 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +3 -10 lines
Diff to previous 1.44 (colored)

Do not handle vertical lines as additional tbl(7) columns,
instead save their properties with the following column.
This simplifies layout parsing and saves a lot of code
related to column handling.

At output time, print all white space and vertical lines
separating columns before printing the following column,
and none after printing the preceding column, considerably
simplifying white space handling and width calculations.

No functional change, but it saves 150 lines of code,
and it allows the next patch to tbl_term.c, tbl_literal().

Revision 1.44 / (download) - annotate - [select for diffs], Thu May 24 23:33:23 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

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.

Revision 1.43 / (download) - annotate - [select for diffs], Sat Nov 12 22:43:18 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.42: +3 -3 lines
Diff to previous 1.42 (colored)

mark some arguments "const" that will not be changed; from kristaps@

Revision 1.42 / (download) - annotate - [select for diffs], Sat Nov 5 16:02:18 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +1 -2 lines
Diff to previous 1.41 (colored)

When the HEAD scope of .TP is broken by another block macro,
do not abort with a FATAL error, but report a regular ERROR,
remove the broken .TP from the syntax tree, and prod on.
Reported repeatedly by ports people, at least by brad@ and jeremy@.
Also fixes rendition(4) in Xenocara.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Oct 9 17:59:56 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +18 -17 lines
Diff to previous 1.40 (colored)

Sync to version 1.12.0; all code by kristaps@:
Implement .Rv in -Tman.
Let -man -Tman work a bit like cat(1).
Add the -Ofragment option to -T[x]html.
Minor fixes in -T[x]html.
Lots of apropos(1) and -Tman code cleanup.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Sep 18 10:25:28 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +93 -4 lines
Diff to previous 1.39 (colored)

sync to version 1.11.5:
adding an implementation of the eqn(7) language
by kristaps@

So far, only .EQ/.EN blocks are handled, in-line equations are not, and
rendering is not yet very pretty, but the parser is fairly complete.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Sep 17 13:45:28 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored)

Change the mandocdb(8) interface to better agree with makewhatis(8);
in particular, allow recursing multiple directories and create
multiple databases in one call.
This commit includes some reorganization, and exposing mandoc_strdup
as a utility function in mandoc.h.
written by kristaps@

Revision 1.38 / (download) - annotate - [select for diffs], Sun May 29 21:22:18 2011 UTC (12 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.37: +26 -1 lines
Diff to previous 1.37 (colored)

Merge release 1.11.3, almost all code by kristaps@:
* Unicode output support (no Unicode input yet, though).
* Refactoring: completely handle predefined strings in roff.c.
- New function mandoc_escape() replaces a2roffdeco() and mandoc_special().
- Start using mandoc_getarg() in mdoc_argv.c.
- Clean up parsing of delimiters in mdoc(7).
* And many minor fixes and lots of cleanup.

Revision 1.37 / (download) - annotate - [select for diffs], Sun Apr 24 16:22:02 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.36: +28 -57 lines
Diff to previous 1.36 (colored)

Merge version 1.11.1:
Again lots of cleanup and maintenance work by kristaps@.
- simplify error reporting: less function pointers, more mandoc_[v]msg
- main: split document parsing out of main.c into read.c
- roff, mdoc, man: improved recognition of control characters
- roff: better handling of if/else stack overflows
- roff: add some predefined strings for backward compatibility
- mdoc, man: empty sections are not errors
- mdoc: move delimiter handling to libmdoc
- some header restructuring and some minor features and fixes
This merge causes two minor regressions
that i will fix in separate commits right afterwards.

Revision 1.36 / (download) - annotate - [select for diffs], Thu Apr 21 22:59:54 2011 UTC (13 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.35: +25 -7 lines
Diff to previous 1.35 (colored)

Merge version 1.10.10:
lots of cleanup and maintenance work by kristaps@.
- move some main.c globals into struct curparse
- move mandoc_*alloc to mandoc.h such that all code can use them
- make mandoc_isdelim available to formatting frontends
- dissolve mdoc_strings.c, move the code where it is used
- make all error reporting functions void, their return values were useless
- and various minor cleanups and fixes

Revision 1.35 / (download) - annotate - [select for diffs], Sun Mar 20 23:36:42 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +8 -1 lines
Diff to previous 1.34 (colored)

Import the foundation for eqn(7) support.
Written by kristaps@.

For now, i'm adding one line to each of the four frontends
to just pass the input text through to the output,
not yet interpreting any of then eqn keywords.

Revision 1.34 / (download) - annotate - [select for diffs], Mon Mar 7 01:35:33 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +3 -2 lines
Diff to previous 1.33 (colored)

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.33 / (download) - annotate - [select for diffs], Thu Feb 10 00:06:30 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.32: +2 -1 lines
Diff to previous 1.32 (colored)

Tbl code maintenance by kristaps@.
- Remember the line-number of a tbl_span, and use it in messages.
- Put *_span_alloc() functions right into the *_addspan() ones,
  since these are the only places they are called from.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Feb 6 17:33:20 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +2 -1 lines
Diff to previous 1.31 (colored)

If .Ns is specified on its own line, ignore it, like groff does;
from kristaps@.

Revision 1.31 / (download) - annotate - [select for diffs], Sun Jan 16 19:27:25 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +2 -1 lines
Diff to previous 1.30 (colored)

Some improvements to error handling from kristaps@:
* Make out-of-context .fi invocations not cause an error, but just a warning.
* Downgrade -man message about ignored empty paragraph to MANDOC_IGNPAR.
* Avoid syntax tree corruption when removing empty block macros.
Triggered by some reports from brad@.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Jan 16 01:11:50 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +13 -14 lines
Diff to previous 1.29 (colored)

Various tbl improvements from kristaps@:
* horizontal lines do not consume layout lines
* skip excessive data cells
* prepare rendering of spanned cells
* support vertical spans

Revision 1.29 / (download) - annotate - [select for diffs], Mon Jan 10 23:53:32 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +2 -1 lines
Diff to previous 1.28 (colored)

Refactoring in preparation for .rm support:
Unify parsing of names given as roff request arguments into a new
function roff_getname(), which is rather different from the parsing
function for normal arguments, mandoc_getarg(), because names cannot
be quoted and cannot contain whitespace or escaped characters.
The new function now throws an ERROR when finding escaped characters
in a name.
"I'm fine with this." kristaps@

Revision 1.28 / (download) - annotate - [select for diffs], Sun Jan 9 14:30:48 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.27: +1 -2 lines
Diff to previous 1.27 (colored)

Sync tbl handling to bsd.lv release 1.10.9:
* .T} can be followed by a delimiter, then more data.
* Do not limit table column widths (improves terminfo(5)).
* Let numerical cells respect explicitly specified minimum cell widths.
* Let terminal output survive missing data cells.
* Parse and ignore arguments in parentheses on layout cell specifications.
* Move tbl_calc() into out.c such that it can be used by all frontends.
* Give tables an HTML class.
* Some cleanup in tbl -Thtml code.
All code by kristaps@.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Jan 4 22:28:17 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +132 -3 lines
Diff to previous 1.26 (colored)

Merge kristaps@' cleaner tbl integration, removing mine;
there are still a few bugs, but fixing these will be easier in tree.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jan 3 23:39:27 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored)

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.25 / (download) - annotate - [select for diffs], Thu Dec 9 23:01:18 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.24: +2 -1 lines
Diff to previous 1.24 (colored)

Abort endless loops during roff macro and string expansion.
For now, use the simplest conceivable approach, like groff does:
Just a fixed, ugly input stack limit.
Kristaps@ agrees.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Dec 7 00:08:52 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +3 -1 lines
Diff to previous 1.23 (colored)

Complete the merge of bsd.lv version 1.10.7:
No more functional changes, just sync ordering, comments and white space.

Revision 1.23 / (download) - annotate - [select for diffs], Wed Dec 1 22:02:29 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.22: +1 -2 lines
Diff to previous 1.22 (colored)

Merge mdoc_action.c into mdoc_validate.c, because having two places to do
basically the same things just causes code duplication and confusion.
Work by kristaps@, including a few bugfixes he found during the merge,
and reapplying OpenBSD changes on top.

Revision 1.22 / (download) - annotate - [select for diffs], Mon Nov 29 00:12:02 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +2 -1 lines
Diff to previous 1.21 (colored)

Implement the roff .ft (change font) request for man(7).
Of course, we don't want to encourage low-level physical markup,
but pod2man(1) writes such requests, so Perl manuals contain them,
and some Xenocara and lots and lots of ports manuals use them as well.
In base and Xenocara, this will reduce mandoc -Tlint ERROR noise;
in ports, it will improve rendering of many manuals.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Nov 28 19:35:33 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +4 -3 lines
Diff to previous 1.20 (colored)

To avoid FATAL errors, we have been parsing and ignoring the roff
requests .am, .ami, .am1, .dei, and .rm for a long time.
Since ignoring them can (rarely) cause information loss and serious
misformatting, throw an ERROR: NOT IMPLEMENTED when finding them.
Implementing them would not be too difficult, but they are so rare
in practice that i can find better use for my time right now.

In this context,
- Put the string "NOT IMPLEMENTED" into two other error messages
as well, to distinguish them from those caused by broken input.
- Print the string "unknown macro" once, not twice in the error message
associated with MANDOCERR_MACRO, and begin printing the buffer at the
point where the unknown macro really is, not at the start of line.

Revision 1.20 / (download) - annotate - [select for diffs], Tue Oct 26 23:34:38 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +2 -1 lines
Diff to previous 1.19 (colored)

Warn developers that .so is fragile and suggest using ln(1) instead;
throwing a warning here was suggested by Joerg Sonnenberger.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Oct 26 22:48:07 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +53 -43 lines
Diff to previous 1.18 (colored)

Downgrade nearly 20 ERRORS to WARNINGS.
All these indicate problems in the mdoc(7) or man(7) source code,
but they can't cause relevant information loss or clobbered formatting.
While here, error message improve wording and make it more uniform,
don't throw MANDOCERR_NOWIDTHARG twice when there is one single issue,
and consolidate MANDOCERR_WIDTHARG into MANDOCERR_IGNARGV.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Oct 26 22:28:57 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +2 -1 lines
Diff to previous 1.17 (colored)

Support .so (low-level roff "switch source file"),
needed for Xenocara and various ports.
Accept only relative paths and no ascension to the parent directory
as suggested by Joerg Sonnenberger; code looked over by Joerg, too.
Useful discussions with various people, among others espie@.

Revision 1.17 / (download) - annotate - [select for diffs], Sun Oct 24 18:15:43 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +4 -6 lines
Diff to previous 1.16 (colored)

Do not throw FATAL errors when there is no need to:
 - when encountering nested displays (.Bd containing .Bd, .D1, .D1)
 - when a block end macro was forgotten
 - when ending a block that was never started
 - when the uname(3) system call failed
along with a little related cleanup

Revision 1.16 / (download) - annotate - [select for diffs], Sat Oct 23 15:49:30 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +34 -23 lines
Diff to previous 1.15 (colored)

sync comments to bsd.lv; no functional change

Revision 1.15 / (download) - annotate - [select for diffs], Sat Oct 16 20:49:37 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +2 -1 lines
Diff to previous 1.14 (colored)

Do not abort() on tbl errors, reduce the risk that tbl stuff kills a build,
and provide more useful tbl error messages in a non-intrusive way.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Sep 27 21:25:28 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +2 -1 lines
Diff to previous 1.13 (colored)

Merge the last bits of 1.10.6 (released today), most were already in:
* ignore double-.Pp
* ignore .Pp before .Bd and .Bl (unless -compact in specified)
* avoid double blank line upon .Pp, .br and friends in literal context
* cast enums to int when passing them to exit(3) to please lint(1)
While merging, fix a regression introduced by kristaps@:
Outside literal mode, double blank lines must both be printed.
To achieve this again after kristaps@ improvements in 1.10.6,
treat such blank lines as .sp (instead of .Pp as in 1.10.5)
and drop .Pp before .sp just like dropping .Pp before .Pp.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Sep 26 20:19:58 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +2 -3 lines
Diff to previous 1.12 (colored)

If an explicit scope is still open at the end of an input file,
report an ERROR:  We can still render the page by just closing
the open scope, but it is likely that information will be missing
or document structure mangled.
Before, man(7) only reported a WARNING (which is dangerous because
we cannot be sure rendering is correct) and mdoc(7) ran into FATAL
(which is too drastic, there is no reason not to show what we have).
While here, add a few explicit casts to appease lint.
"looks good" kristaps@

Revision 1.12 / (download) - annotate - [select for diffs], Fri Aug 20 00:53:35 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +13 -2 lines
Diff to previous 1.11 (colored)

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.11 / (download) - annotate - [select for diffs], Sun Jul 25 18:05:54 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored)

Sync to bsd.lv; in particular, pull in lots of bug fixes.
new features:
* support the .in macro in man(7)
* support minimal PDF output
* support .Sm in mdoc(7) HTML output
* support .Vb and .nf in man(7) HTML output
* complete the mdoc(7) manual
bug fixes:
* do not let mdoc(7) .Pp produce a newline before/after .Sh; reported by jmc@
* avoid double blank lines related to man(7) .sp and .br
* let man(7) .nf and .fi flush the line; reported by jsg@ and naddy@
* let "\ " produce a non-breaking space; reported by deraadt@
* discard \m colour escape sequences; reported by J.C. Roberts
* map undefined 1-character-escapes to the literal character itself
maintenance:
* express mdoc(7) arguments in terms of an enum for additional type-safety
* simplify mandoc_special() and a2roffdeco()
* use strcspn in term_word() in place of a manual loop
* minor optimisations in the -Tps and -Thtml formatting frontends

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jul 13 01:09:13 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.9: +39 -6 lines
Diff to previous 1.9 (colored)

Merge release 1.10.4 (all code by kristaps@), providing four new features:
1) Proper .Bk support: allow output line breaks at input line breaks,
but keep input lines together in the output, finally fixing
synopses like aucat(1), mail(1) and tmux(1).
2) Mostly finished -Tps (PostScript) output.
3) Implement -Thtml output for .Nm blocks and .Bk -words.
4) Allow iterative interpolation of user-defined roff(7) strings.
Also contains some minor bugfixes and some performance improvements.

Revision 1.9 / (download) - annotate - [select for diffs], Thu Jul 1 15:36:59 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.8: +4 -3 lines
Diff to previous 1.8 (colored)

Improve .Nm indentation in the SYNOPSIS;
kristaps@ will do the missing HTML part soon.
"looks nicer" jmc@
"seems perfect to me" sobrado@
"slap it in" kristaps@

Revision 1.8 / (download) - annotate - [select for diffs], Wed Jun 30 20:29:44 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +11 -7 lines
Diff to previous 1.7 (colored)

improve error reporting:
* avoid error exit code after mere warnings
* add ERROR: and FATAL: to messages when appropriate
* sort the code in mmsg() to make it easier on the eye
* make the mandocerrs[] list easier to maintain
* update a few comments in mandoc.h
ok kristaps@

Revision 1.7 / (download) - annotate - [select for diffs], Sat Jun 26 17:56:43 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +5 -3 lines
Diff to previous 1.6 (colored)

merge release 1.10.2
* bug fixes:
- interaction of ASCII_HYPH with special chars (found by Ulrich Spoerlein)
- handling of roff conditionals (found by Ulrich Spoerlein)
- .Bd -offset will no more default to 6n
* maintenance:
- more caching of .Bd and .Bl arguments for efficiency
- deconstify man(7) validation routines
- add FreeBSD library names (provided by Ulrich Spoerlein)
* start PostScript font-switching

Revision 1.6 / (download) - annotate - [select for diffs], Sun Jun 6 20:30:08 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +5 -6 lines
Diff to previous 1.5 (colored)

Merge bsd.lv version 1.10.1 (to be released soon).

The main step forward is that this now has *much* better .Bl -column
support, now supporting many manuals that previously errored out
without producing any output.

Other fixes include:
* do not die from multiple list types, use the first and warn
* in .Bl without a type, default to -item
* various tweaks to .Dt
* fix .In, .Fd, .Ft, .Fn and .Fo formatting
* some documentation fixes and additions
* and fix a couple of bugs reported by Ulrich Spoerlein:
* better support for roff block-end "\}" without a preceding dot
* .In must not break the line outside SYNOPSIS
* spelling in some error messages

While merging, fix one regression in .In spacing
that needs to go to bsd.lv, too.

Revision 1.5 / (download) - annotate - [select for diffs], Wed May 26 02:39:58 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.4: +5 -1 lines
Diff to previous 1.4 (colored)

When a word does not fully fit onto the output line, but it contains
at least one hyphen, we already had support for breaking the line a the
last fitting hyphen.  This patch improves this functionality by only
breaking at hyphens in free-form text, and by not breaking at hyphens
* at the beginning or end of a word   or
* immediately preceded or followed by another hyphen   or
* escaped by a preceding backslash.

Before this patch, differences in break-at-hyphen support were one
of the major sources of noise in automatic comparisons to mdoc(7)
groff output.  Now, the remaining differences are hard to find among
the noise coming from other sources.

Where there are still differences, what we do seems to be better than
what groff does, see e.g. the chio(1) exchange and position commands
for one of the now rare examples.

idea and coding by kristaps@

Besides, this was the last substantial code difference left
between bsd.lv and openbsd.org.  We are now in full sync.

Revision 1.4 / (download) - annotate - [select for diffs], Sun May 23 23:35:26 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

fix the build (oops, sorry!):
sigvec(3) triggers MANDOCERR_BODYLOST, which must not be fatal

Revision 1.3 / (download) - annotate - [select for diffs], Sun May 23 22:45:00 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.2: +65 -3 lines
Diff to previous 1.2 (colored)

Unified error and warning message system for all of mandoc,
featuring three message levels, as agreed during the mandoc hackathon:
* FATAL parser failure, cannot produce any output from this input file:
  eventually, we hope to convert most of these to ERRORs.
* ERROR, meaning mandoc cannot cope fully with the input syntax and will
  probably lose information or produce structurally garbled output;
  it will try to produce output anyway but exit non-zero at the end,
  which is eventually intended to make the ports infrastructure happy.
* WARNING, meaning you should clean up the input file, but output
  is probably mostly OK, so this will not cause error-exit at the end.
This commit is mostly just converting the old system to the new one; before
the classification will become really reliable, we must check all messages.

In particular,
* set up a new central message string table in main.c
* drop the old message string tables from man.c and mdoc.c
* get rid of the piece-meal merr enums in libman and libmdoc
* reduce number of error/warning functions from 16 to 6 (still a lot...)

While here, handle a few problems more gracefully:
* allow .Rv and .Ex to work without a prior .Nm
* allow .An to ignore extra arguments
* allow undeclared columns in .Bl -column

Written by kristaps@.

Revision 1.2 / (download) - annotate - [select for diffs], Thu May 20 00:58:02 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.1: +3 -2 lines
Diff to previous 1.1 (colored)

Support nested roff instructions:
* allow roff_parseln() to be re-run
* allow roff_parseln() to manipulate the line buffer offset
* support the offset in the man and mdoc libraries
* adapt .if, .ie, .el, .ig, .am* and .de* support
* interpret some instructions even in conditional-negative context
Coded by kristaps during the last day of the mandoc hackathon.

To avoid regressions in the OpenBSD tree, commit this together
with some small local additions:
* detect roff block end "\}" even on macro lines
* actually implement the ".if n" conditional
* ignore .ds, .rm and .tr in libroff

Also back my old .if/.ie/.el-handling out of libman, reverting:
man.h 1.15 man.c 1.25 man_macro.c 1.15 man_validate.c 1.19
man_action.c 1.15 man_term.c 1.28 man_html.c 1.9.

Revision 1.1 / (download) - annotate - [select for diffs], Sun May 16 01:46:39 2010 UTC (14 years ago) by schwarze
Branch: MAIN

add forgotten header file, duh...
this is needed by Makefile rev. 1.37

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.