CVS log for mandoc/mandoc.h

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

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.282 / (download) - annotate - [select for diffs], Sat Oct 21 17:10:17 2023 UTC (5 months, 1 week ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.281: +1 -2 lines
Diff to previous 1.281 (colored) to selected 1.172 (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.281 / (download) - annotate - [select for diffs], Tue Aug 16 17:30:11 2022 UTC (19 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.280: +3 -1 lines
Diff to previous 1.280 (colored) to selected 1.172 (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.280 / (download) - annotate - [select for diffs], Mon Aug 15 18:12:30 2022 UTC (19 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.279: +4 -3 lines
Diff to previous 1.279 (colored) to selected 1.172 (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.279 / (download) - annotate - [select for diffs], Tue Jun 7 09:54:40 2022 UTC (21 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.278: +3 -2 lines
Diff to previous 1.278 (colored) to selected 1.172 (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.278 / (download) - annotate - [select for diffs], Sun Jun 5 13:54:09 2022 UTC (21 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.277: +6 -1 lines
Diff to previous 1.277 (colored) to selected 1.172 (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.277 / (download) - annotate - [select for diffs], Thu May 19 15:37:47 2022 UTC (22 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.276: +7 -6 lines
Diff to previous 1.276 (colored) to selected 1.172 (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.276 / (download) - annotate - [select for diffs], Thu Apr 28 16:21:09 2022 UTC (23 months ago) by schwarze
Branch: MAIN
Changes since 1.275: +3 -1 lines
Diff to previous 1.275 (colored) to selected 1.172 (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.275 / (download) - annotate - [select for diffs], Sun Apr 24 13:38:46 2022 UTC (23 months ago) by schwarze
Branch: MAIN
Changes since 1.274: +3 -2 lines
Diff to previous 1.274 (colored) to selected 1.172 (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.274 / (download) - annotate - [select for diffs], Sat Aug 14 13:53:08 2021 UTC (2 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6
Changes since 1.273: +2 -1 lines
Diff to previous 1.273 (colored) to selected 1.172 (colored)

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

Revision 1.273 / (download) - annotate - [select for diffs], Tue Aug 10 12:55:03 2021 UTC (2 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.272: +4 -2 lines
Diff to previous 1.272 (colored) to selected 1.172 (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.272 / (download) - annotate - [select for diffs], Sun Jul 4 15:38:26 2021 UTC (2 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.271: +4 -2 lines
Diff to previous 1.271 (colored) to selected 1.172 (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.271 / (download) - annotate - [select for diffs], Sun Jun 27 17:57:54 2021 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.270: +2 -1 lines
Diff to previous 1.270 (colored) to selected 1.172 (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.270 / (download) - annotate - [select for diffs], Wed Jun 2 18:28:19 2021 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.269: +2 -2 lines
Diff to previous 1.269 (colored) to selected 1.172 (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.269 / (download) - annotate - [select for diffs], Tue Sep 1 18:25:27 2020 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.268: +2 -1 lines
Diff to previous 1.268 (colored) to selected 1.172 (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.268 / (download) - annotate - [select for diffs], Fri Apr 24 12:02:33 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.267: +2 -1 lines
Diff to previous 1.267 (colored) to selected 1.172 (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.267 / (download) - annotate - [select for diffs], Fri Apr 3 11:35:01 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.266: +4 -3 lines
Diff to previous 1.266 (colored) to selected 1.172 (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.266 / (download) - annotate - [select for diffs], Sun Jan 19 18:02:00 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.265: +2 -1 lines
Diff to previous 1.265 (colored) to selected 1.172 (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.265 / (download) - annotate - [select for diffs], Sun Jan 19 16:44:50 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.264: +3 -3 lines
Diff to previous 1.264 (colored) to selected 1.172 (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.264 / (download) - annotate - [select for diffs], Sun Jul 14 18:16:13 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.263: +2 -1 lines
Diff to previous 1.263 (colored) to selected 1.172 (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.263 / (download) - annotate - [select for diffs], Wed Jul 10 19:39:01 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.262: +31 -3 lines
Diff to previous 1.262 (colored) to selected 1.172 (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.262 / (download) - annotate - [select for diffs], Sun Dec 16 00:17:02 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.261: +2 -1 lines
Diff to previous 1.261 (colored) to selected 1.172 (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.
In regress.pl, only strip leading whitespace in math mode.

Revision 1.261 / (download) - annotate - [select for diffs], Sat Dec 15 19:30:26 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.260: +5 -1 lines
Diff to previous 1.260 (colored) to selected 1.172 (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.260 / (download) - annotate - [select for diffs], Fri Dec 14 05:18:02 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.259: +3 -5 lines
Diff to previous 1.259 (colored) to selected 1.172 (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.259 / (download) - annotate - [select for diffs], Fri Dec 14 01:18:25 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.258: +12 -4 lines
Diff to previous 1.258 (colored) to selected 1.172 (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.258 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:46 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.257: +4 -35 lines
Diff to previous 1.257 (colored) to selected 1.172 (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.257 / (download) - annotate - [select for diffs], Thu Dec 13 05:23:38 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.256: +1 -69 lines
Diff to previous 1.256 (colored) to selected 1.172 (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.256 / (download) - annotate - [select for diffs], Wed Dec 12 21:54:35 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.255: +2 -107 lines
Diff to previous 1.255 (colored) to selected 1.172 (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.255 / (download) - annotate - [select for diffs], Sun Nov 25 19:24:20 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.254: +3 -2 lines
Diff to previous 1.254 (colored) to selected 1.172 (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.254 / (download) - annotate - [select for diffs], Thu Oct 25 01:32:40 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.253: +2 -1 lines
Diff to previous 1.253 (colored) to selected 1.172 (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.253 / (download) - annotate - [select for diffs], Sat Aug 25 16:53:39 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.252: +3 -1 lines
Diff to previous 1.252 (colored) to selected 1.172 (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.252 / (download) - annotate - [select for diffs], Fri Aug 24 23:12:33 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.251: +5 -1 lines
Diff to previous 1.251 (colored) to selected 1.172 (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.251 / (download) - annotate - [select for diffs], Thu Aug 23 19:33:27 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.250: +2 -3 lines
Diff to previous 1.250 (colored) to selected 1.172 (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.250 / (download) - annotate - [select for diffs], Thu Aug 23 14:29:38 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.249: +5 -1 lines
Diff to previous 1.249 (colored) to selected 1.172 (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.337, moving argument interpolation back into
the function roff_res().

Revision 1.249 / (download) - annotate - [select for diffs], Thu Aug 16 13:54:06 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.248: +2 -1 lines
Diff to previous 1.248 (colored) to selected 1.172 (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.248 / (download) - annotate - [select for diffs], Sat Jul 28 18:34:15 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4
Changes since 1.247: +3 -2 lines
Diff to previous 1.247 (colored) to selected 1.172 (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.247 / (download) - annotate - [select for diffs], Fri Mar 16 15:05:44 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.246: +2 -1 lines
Diff to previous 1.246 (colored) to selected 1.172 (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.246 / (download) - annotate - [select for diffs], Fri Nov 10 23:32:40 2017 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.245: +2 -2 lines
Diff to previous 1.245 (colored) to selected 1.172 (colored)

be less assertive when warning about a possible typo;
from jca@, ok jmc@

Revision 1.245 / (download) - annotate - [select for diffs], Sat Jul 8 14:51:04 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3, VERSION_1_14_2
Changes since 1.244: +1 -12 lines
Diff to previous 1.244 (colored) to selected 1.172 (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.244 / (download) - annotate - [select for diffs], Fri Jul 7 19:39:30 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.243: +1 -2 lines
Diff to previous 1.243 (colored) to selected 1.172 (colored)

garbage collect unused enum member EQN_ROOT

Revision 1.243 / (download) - annotate - [select for diffs], Thu Jul 6 22:59:48 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.242: +9 -9 lines
Diff to previous 1.242 (colored) to selected 1.172 (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.242 / (download) - annotate - [select for diffs], Wed Jul 5 15:03:27 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.241: +1 -2 lines
Diff to previous 1.241 (colored) to selected 1.172 (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.241 / (download) - annotate - [select for diffs], Mon Jul 3 17:33:05 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.240: +3 -3 lines
Diff to previous 1.240 (colored) to selected 1.172 (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.240 / (download) - annotate - [select for diffs], Mon Jul 3 13:40:19 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.239: +2 -1 lines
Diff to previous 1.239 (colored) to selected 1.172 (colored)

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

Revision 1.239 / (download) - annotate - [select for diffs], Sun Jul 2 15:31:59 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.238: +2 -1 lines
Diff to previous 1.238 (colored) to selected 1.172 (colored)

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

Revision 1.238 / (download) - annotate - [select for diffs], Sat Jul 1 09:47:30 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.237: +2 -1 lines
Diff to previous 1.237 (colored) to selected 1.172 (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.237 / (download) - annotate - [select for diffs], Thu Jun 29 15:22:17 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.236: +3 -1 lines
Diff to previous 1.236 (colored) to selected 1.172 (colored)

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

Revision 1.236 / (download) - annotate - [select for diffs], Sun Jun 25 17:43:45 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.235: +2 -1 lines
Diff to previous 1.235 (colored) to selected 1.172 (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.235 / (download) - annotate - [select for diffs], Sat Jun 24 18:58:33 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.234: +2 -1 lines
Diff to previous 1.234 (colored) to selected 1.172 (colored)

operating system dependent message about unknown architecture;
inspired by mdoclint

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

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

Revision 1.233 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:32 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.232: +14 -4 lines
Diff to previous 1.232 (colored) to selected 1.172 (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.232 / (download) - annotate - [select for diffs], Sat Jun 17 23:07:00 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.231: +2 -1 lines
Diff to previous 1.231 (colored) to selected 1.172 (colored)

style message about duplicate RCS ids; inspired by mdoclint

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

style message about missing RCS ids; inspired by mdoclint

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

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

Revision 1.229 / (download) - annotate - [select for diffs], Sun Jun 11 19:37:01 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.228: +4 -1 lines
Diff to previous 1.228 (colored) to selected 1.172 (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.228 / (download) - annotate - [select for diffs], Sun Jun 11 17:16:51 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.227: +2 -1 lines
Diff to previous 1.227 (colored) to selected 1.172 (colored)

style message about missing .Fn markup; inspired by mdoclint

Revision 1.227 / (download) - annotate - [select for diffs], Sat Jun 10 01:48:53 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.226: +2 -1 lines
Diff to previous 1.226 (colored) to selected 1.172 (colored)

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

Revision 1.226 / (download) - annotate - [select for diffs], Thu Jun 8 18:11:22 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.225: +7 -4 lines
Diff to previous 1.225 (colored) to selected 1.172 (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.225 / (download) - annotate - [select for diffs], Thu Jun 8 00:23:30 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.224: +2 -1 lines
Diff to previous 1.224 (colored) to selected 1.172 (colored)

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

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

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

Revision 1.223 / (download) - annotate - [select for diffs], Tue Jun 6 15:01:04 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.222: +2 -1 lines
Diff to previous 1.222 (colored) to selected 1.172 (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.222 / (download) - annotate - [select for diffs], Sat Jun 3 15:55:24 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.221: +2 -1 lines
Diff to previous 1.221 (colored) to selected 1.172 (colored)

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

Revision 1.221 / (download) - annotate - [select for diffs], Fri Jun 2 19:21:23 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.220: +2 -1 lines
Diff to previous 1.220 (colored) to selected 1.172 (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.220 / (download) - annotate - [select for diffs], Thu Jun 1 19:05:37 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.219: +2 -1 lines
Diff to previous 1.219 (colored) to selected 1.172 (colored)

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

Revision 1.219 / (download) - annotate - [select for diffs], Thu Jun 1 15:25:39 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.218: +2 -1 lines
Diff to previous 1.218 (colored) to selected 1.172 (colored)

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

Revision 1.218 / (download) - annotate - [select for diffs], Wed May 31 15:31:00 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.217: +2 -1 lines
Diff to previous 1.217 (colored) to selected 1.172 (colored)

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

Revision 1.217 / (download) - annotate - [select for diffs], Tue May 30 19:30:38 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.216: +3 -1 lines
Diff to previous 1.216 (colored) to selected 1.172 (colored)

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

Revision 1.216 / (download) - annotate - [select for diffs], Tue May 16 19:06:30 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.215: +4 -2 lines
Diff to previous 1.215 (colored) to selected 1.172 (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.215 / (download) - annotate - [select for diffs], Mon Mar 6 17:26:04 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.214: +2 -1 lines
Diff to previous 1.214 (colored) to selected 1.172 (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.214 / (download) - annotate - [select for diffs], Sat Jan 28 23:30:08 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1, VERSION_1_13
Changes since 1.213: +2 -1 lines
Diff to previous 1.213 (colored) to selected 1.172 (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.213 / (download) - annotate - [select for diffs], Mon Jan 9 01:37:03 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.212: +2 -1 lines
Diff to previous 1.212 (colored) to selected 1.172 (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.212 / (download) - annotate - [select for diffs], Sun Jan 8 00:11:23 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.211: +4 -3 lines
Diff to previous 1.211 (colored) to selected 1.172 (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.211 / (download) - annotate - [select for diffs], Wed Dec 28 17:34:18 2016 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.210: +2 -1 lines
Diff to previous 1.210 (colored) to selected 1.172 (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.210 / (download) - annotate - [select for diffs], Sun Oct 9 18:16:56 2016 UTC (7 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.209: +2 -2 lines
Diff to previous 1.209 (colored) to selected 1.172 (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.209 / (download) - annotate - [select for diffs], Fri Jan 8 02:53:13 2016 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.208: +3 -3 lines
Diff to previous 1.208 (colored) to selected 1.172 (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.208 / (download) - annotate - [select for diffs], Sat Nov 7 14:01:16 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.207: +1 -4 lines
Diff to previous 1.207 (colored) to selected 1.172 (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.207 / (download) - annotate - [select for diffs], Fri Oct 30 19:04:16 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.206: +2 -1 lines
Diff to previous 1.206 (colored) to selected 1.172 (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.206 / (download) - annotate - [select for diffs], Tue Oct 13 22:59:54 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.205: +6 -10 lines
Diff to previous 1.205 (colored) to selected 1.172 (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.205 / (download) - annotate - [select for diffs], Mon Sep 14 15:36:14 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.204: +1 -2 lines
Diff to previous 1.204 (colored) to selected 1.172 (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.204 / (download) - annotate - [select for diffs], Sun Jul 19 06:05:16 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.203: +1 -2 lines
Diff to previous 1.203 (colored) to selected 1.172 (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.203 / (download) - annotate - [select for diffs], Sat Apr 18 16:34:25 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.202: +2 -2 lines
Diff to previous 1.202 (colored) to selected 1.172 (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.202 / (download) - annotate - [select for diffs], Sat Apr 18 16:06:40 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.201: +6 -7 lines
Diff to previous 1.201 (colored) to selected 1.172 (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.201 / (download) - annotate - [select for diffs], Mon Feb 23 13:31:04 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.200: +5 -2 lines
Diff to previous 1.200 (colored) to selected 1.172 (colored)

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

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

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

Revision 1.199 / (download) - annotate - [select for diffs], Fri Feb 6 11:54:36 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.198: +3 -1 lines
Diff to previous 1.198 (colored) to selected 1.172 (colored)

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

Revision 1.198 / (download) - annotate - [select for diffs], Fri Feb 6 07:13:14 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.197: +2 -2 lines
Diff to previous 1.197 (colored) to selected 1.172 (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.197 / (download) - annotate - [select for diffs], Fri Feb 6 03:38:45 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.196: +2 -1 lines
Diff to previous 1.196 (colored) to selected 1.172 (colored)

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

Revision 1.196 / (download) - annotate - [select for diffs], Wed Feb 4 18:03:47 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.195: +2 -1 lines
Diff to previous 1.195 (colored) to selected 1.172 (colored)

discard .Rs head arguments and improve .Rs diagnostics

Revision 1.195 / (download) - annotate - [select for diffs], Wed Feb 4 16:38:56 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.194: +2 -1 lines
Diff to previous 1.194 (colored) to selected 1.172 (colored)

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

Revision 1.194 / (download) - annotate - [select for diffs], Fri Jan 30 17:32:16 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.193: +1 -4 lines
Diff to previous 1.193 (colored) to selected 1.172 (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.193 / (download) - annotate - [select for diffs], Fri Jan 30 04:11:50 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.192: +2 -14 lines
Diff to previous 1.192 (colored) to selected 1.172 (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.192 / (download) - annotate - [select for diffs], Wed Jan 28 21:11:53 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.191: +1 -7 lines
Diff to previous 1.191 (colored) to selected 1.172 (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.191 / (download) - annotate - [select for diffs], Wed Jan 28 17:32:07 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.190: +8 -8 lines
Diff to previous 1.190 (colored) to selected 1.172 (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.190 / (download) - annotate - [select for diffs], Tue Jan 27 05:21:44 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.189: +7 -5 lines
Diff to previous 1.189 (colored) to selected 1.172 (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.189 / (download) - annotate - [select for diffs], Mon Jan 26 18:42:30 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.188: +10 -3 lines
Diff to previous 1.188 (colored) to selected 1.172 (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.188 / (download) - annotate - [select for diffs], Mon Jan 26 13:03:48 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.187: +3 -1 lines
Diff to previous 1.187 (colored) to selected 1.172 (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.187 / (download) - annotate - [select for diffs], Mon Jan 26 00:57:22 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.186: +5 -4 lines
Diff to previous 1.186 (colored) to selected 1.172 (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.186 / (download) - annotate - [select for diffs], Sat Jan 24 01:58:33 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.185: +2 -1 lines
Diff to previous 1.185 (colored) to selected 1.172 (colored)

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

Revision 1.185 / (download) - annotate - [select for diffs], Thu Jan 22 21:38:16 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.184: +3 -2 lines
Diff to previous 1.184 (colored) to selected 1.172 (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.184 / (download) - annotate - [select for diffs], Wed Jan 21 20:33:25 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.183: +3 -2 lines
Diff to previous 1.183 (colored) to selected 1.172 (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.183 / (download) - annotate - [select for diffs], Tue Jan 20 21:16:51 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.182: +13 -8 lines
Diff to previous 1.182 (colored) to selected 1.172 (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.182 / (download) - annotate - [select for diffs], Thu Jan 15 04:26:40 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.181: +2 -5 lines
Diff to previous 1.181 (colored) to selected 1.172 (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.181 / (download) - annotate - [select for diffs], Thu Jan 15 02:29:26 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.180: +2 -2 lines
Diff to previous 1.180 (colored) to selected 1.172 (colored)

downgrade .so failure from FATAL to ERROR

Revision 1.180 / (download) - annotate - [select for diffs], Wed Jan 14 22:58:16 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.179: +2 -2 lines
Diff to previous 1.179 (colored) to selected 1.172 (colored)

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

Revision 1.179 / (download) - annotate - [select for diffs], Wed Jan 14 22:02:50 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.178: +2 -7 lines
Diff to previous 1.178 (colored) to selected 1.172 (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.178 / (download) - annotate - [select for diffs], Wed Jan 14 17:49:15 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.177: +1 -8 lines
Diff to previous 1.177 (colored) to selected 1.172 (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.177 / (download) - annotate - [select for diffs], Tue Dec 16 23:44:41 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.176: +2 -1 lines
Diff to previous 1.176 (colored) to selected 1.172 (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.176 / (download) - annotate - [select for diffs], Mon Dec 1 08:05:52 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.175: +3 -3 lines
Diff to previous 1.175 (colored) to selected 1.172 (colored)

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

Revision 1.175 / (download) - annotate - [select for diffs], Mon Dec 1 04:14:14 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.174: +2 -2 lines
Diff to previous 1.174 (colored) to selected 1.172 (colored)

The file read.c is part of the parser, so it cannot include main.h,
which is not part of the parser.  Besides, the parser *does* modify
the input buffer, so marking it "const" in the mparse_readmem()
interface is an outright lie.  Fix all this by killing the const,
the UNCONST, and the bogus inclusion.

Revision 1.174 / (download) - annotate - [select for diffs], Mon Dec 1 04:05:32 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.173: +1 -5 lines
Diff to previous 1.173 (colored) to selected 1.172 (colored)

remove unneccessary inclusion protection; patch from deraadt@

Revision 1.173 / (download) - annotate - [select for diffs], Sun Nov 30 05:29:00 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.172: +2 -1 lines
Diff to previous 1.172 (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.172 / (download) - annotate - [selected], Sun Nov 30 02:36:38 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.171: +2 -1 lines
Diff to previous 1.171 (colored)

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

Revision 1.171 / (download) - annotate - [select for diffs], Fri Nov 28 18:09:01 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.170: +1 -2 lines
Diff to previous 1.170 (colored) to selected 1.172 (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.170 / (download) - annotate - [select for diffs], Thu Nov 27 23:40:19 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.169: +2 -2 lines
Diff to previous 1.169 (colored) to selected 1.172 (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.169 / (download) - annotate - [select for diffs], Wed Nov 26 21:40:17 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.168: +3 -4 lines
Diff to previous 1.168 (colored) to selected 1.172 (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.168 / (download) - annotate - [select for diffs], Wed Oct 29 00:17:43 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored) to selected 1.172 (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.167 / (download) - annotate - [select for diffs], Tue Oct 28 17:36:19 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.166: +2 -2 lines
Diff to previous 1.166 (colored) to selected 1.172 (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.166 / (download) - annotate - [select for diffs], Sun Oct 26 18:07:28 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.165: +2 -1 lines
Diff to previous 1.165 (colored) to selected 1.172 (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.165 / (download) - annotate - [select for diffs], Sat Oct 25 01:03:52 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.164: +3 -1 lines
Diff to previous 1.164 (colored) to selected 1.172 (colored)

integrate preconv(1) into mandoc(1);
enhances functionality and reduces code and docs by more than 300 lines

Revision 1.164 / (download) - annotate - [select for diffs], Mon Oct 20 19:04:45 2014 UTC (9 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.163: +2 -1 lines
Diff to previous 1.163 (colored) to selected 1.172 (colored)

Protect the roff parser from dividing by zero.  ok schwarze@

Revision 1.163 / (download) - annotate - [select for diffs], Tue Oct 14 02:16:06 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.162: +2 -1 lines
Diff to previous 1.162 (colored) to selected 1.172 (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.162 / (download) - annotate - [select for diffs], Sun Oct 12 19:31:41 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.161: +2 -2 lines
Diff to previous 1.161 (colored) to selected 1.172 (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.161 / (download) - annotate - [select for diffs], Sat Oct 11 21:14:16 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.160: +2 -1 lines
Diff to previous 1.160 (colored) to selected 1.172 (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.160 / (download) - annotate - [select for diffs], Fri Oct 10 15:26:29 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.159: +2 -2 lines
Diff to previous 1.159 (colored) to selected 1.172 (colored)

sync Copyright years after merge to OpenBSD; no code change

Revision 1.159 / (download) - annotate - [select for diffs], Fri Oct 10 08:44:24 2014 UTC (9 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.158: +13 -20 lines
Diff to previous 1.158 (colored) to selected 1.172 (colored)

Re-write of eqn(7) parser and MathML output.
This adds parser-level support for the grammar described by the eqn
second-edition technical paper, "Typesetting Mathematics — User's Guide"
(Kernighan, Cherry).
The reason for this re-write is the grouping rules, which were not
possible given the existing implementation.
The re-write has also considerably simplified the HTML (and, if it ever
is completed, terminal) front-end.

Revision 1.158 / (download) - annotate - [select for diffs], Sun Sep 28 14:05:11 2014 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.157: +2 -1 lines
Diff to previous 1.157 (colored) to selected 1.172 (colored)

Parse from/to clauses in eqn.

Revision 1.157 / (download) - annotate - [select for diffs], Sun Sep 28 11:32:08 2014 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.156: +3 -1 lines
Diff to previous 1.156 (colored) to selected 1.172 (colored)

Add support for EQNPOS_SUBSUP and a doubly-linked eqn_box list.

Revision 1.156 / (download) - annotate - [select for diffs], Fri Sep 12 00:54:10 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.155: +2 -1 lines
Diff to previous 1.155 (colored) to selected 1.172 (colored)

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

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

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

Revision 1.154 / (download) - annotate - [select for diffs], Sun Sep 7 23:25:01 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.153: +2 -1 lines
Diff to previous 1.153 (colored) to selected 1.172 (colored)

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

Revision 1.153 / (download) - annotate - [select for diffs], Wed Sep 3 23:21:47 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.152: +12 -2 lines
Diff to previous 1.152 (colored) to selected 1.172 (colored)

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

Revision 1.152 / (download) - annotate - [select for diffs], Wed Aug 6 15:09:05 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1, VERSION_1_12_4, VERSION_1_12
Changes since 1.151: +8 -5 lines
Diff to previous 1.151 (colored) to selected 1.172 (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.151 / (download) - annotate - [select for diffs], Fri Aug 1 17:27:44 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.150: +30 -30 lines
Diff to previous 1.150 (colored) to selected 1.172 (colored)

mention requests and macros in more messages

Revision 1.150 / (download) - annotate - [select for diffs], Fri Aug 1 15:08:46 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.149: +1 -2 lines
Diff to previous 1.149 (colored) to selected 1.172 (colored)

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

Revision 1.149 / (download) - annotate - [select for diffs], Thu Jul 31 09:22:21 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.148: +3 -2 lines
Diff to previous 1.148 (colored) to selected 1.172 (colored)

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

Revision 1.148 / (download) - annotate - [select for diffs], Thu Jul 31 00:41:10 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14
Changes since 1.147: +1 -2 lines
Diff to previous 1.147 (colored) to selected 1.172 (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 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.147 / (download) - annotate - [select for diffs], Wed Jul 30 23:38:52 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.146: +1 -2 lines
Diff to previous 1.146 (colored) to selected 1.172 (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.146 / (download) - annotate - [select for diffs], Wed Jul 30 17:06:26 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.145: +2 -2 lines
Diff to previous 1.145 (colored) to selected 1.172 (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.145 / (download) - annotate - [select for diffs], Wed Jul 30 14:50:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.144: +1 -3 lines
Diff to previous 1.144 (colored) to selected 1.172 (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.144 / (download) - annotate - [select for diffs], Wed Jul 30 12:58:21 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.143: +4 -4 lines
Diff to previous 1.143 (colored) to selected 1.172 (colored)

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

Revision 1.143 / (download) - annotate - [select for diffs], Wed Jul 30 00:19:16 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.142: +3 -2 lines
Diff to previous 1.142 (colored) to selected 1.172 (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.142 / (download) - annotate - [select for diffs], Wed Jul 9 11:31:43 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.141: +3 -2 lines
Diff to previous 1.141 (colored) to selected 1.172 (colored)

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

Revision 1.141 / (download) - annotate - [select for diffs], Mon Jul 7 21:36:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.140: +11 -8 lines
Diff to previous 1.140 (colored) to selected 1.172 (colored)

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

Revision 1.140 / (download) - annotate - [select for diffs], Mon Jul 7 16:12:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.139: +2 -2 lines
Diff to previous 1.139 (colored) to selected 1.172 (colored)

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

Revision 1.139 / (download) - annotate - [select for diffs], Mon Jul 7 15:03:43 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.138: +1 -2 lines
Diff to previous 1.138 (colored) to selected 1.172 (colored)

no need to skip content before first section header

Revision 1.138 / (download) - annotate - [select for diffs], Mon Jul 7 11:35:06 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.137: +1 -2 lines
Diff to previous 1.137 (colored) to selected 1.172 (colored)

implement .dei and .ami

Revision 1.137 / (download) - annotate - [select for diffs], Sun Jul 6 19:09:00 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.136: +9 -8 lines
Diff to previous 1.136 (colored) to selected 1.172 (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.136 / (download) - annotate - [select for diffs], Sat Jul 5 12:34:17 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +9 -10 lines
Diff to previous 1.135 (colored) to selected 1.172 (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.135 / (download) - annotate - [select for diffs], Sat Jul 5 01:12:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.134: +3 -2 lines
Diff to previous 1.134 (colored) to selected 1.172 (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.134 / (download) - annotate - [select for diffs], Fri Jul 4 16:12:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.133: +5 -4 lines
Diff to previous 1.133 (colored) to selected 1.172 (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.

Revision 1.133 / (download) - annotate - [select for diffs], Fri Jul 4 01:50:06 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +8 -9 lines
Diff to previous 1.132 (colored) to selected 1.172 (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.132 / (download) - annotate - [select for diffs], Thu Jul 3 23:24:56 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.131: +2 -2 lines
Diff to previous 1.131 (colored) to selected 1.172 (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.131 / (download) - annotate - [select for diffs], Thu Jul 3 21:23:54 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +4 -2 lines
Diff to previous 1.130 (colored) to selected 1.172 (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.130 / (download) - annotate - [select for diffs], Wed Jul 2 20:19:11 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.129: +2 -2 lines
Diff to previous 1.129 (colored) to selected 1.172 (colored)

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

Revision 1.129 / (download) - annotate - [select for diffs], Wed Jul 2 13:10:45 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.128: +4 -2 lines
Diff to previous 1.128 (colored) to selected 1.172 (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.128 / (download) - annotate - [select for diffs], Wed Jul 2 11:43:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.127: +7 -7 lines
Diff to previous 1.127 (colored) to selected 1.172 (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.127 / (download) - annotate - [select for diffs], Wed Jul 2 05:52:25 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +3 -3 lines
Diff to previous 1.126 (colored) to selected 1.172 (colored)

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

Revision 1.126 / (download) - annotate - [select for diffs], Wed Jul 2 03:48:07 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.125: +2 -2 lines
Diff to previous 1.125 (colored) to selected 1.172 (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.125 / (download) - annotate - [select for diffs], Tue Jul 1 22:37:15 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.124: +18 -18 lines
Diff to previous 1.124 (colored) to selected 1.172 (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.124 / (download) - annotate - [select for diffs], Mon Jun 30 23:45:07 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +6 -10 lines
Diff to previous 1.123 (colored) to selected 1.172 (colored)

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

Revision 1.123 / (download) - annotate - [select for diffs], Wed Jun 25 00:20:19 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +3 -2 lines
Diff to previous 1.122 (colored) to selected 1.172 (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.122 / (download) - annotate - [select for diffs], Fri Jun 20 23:02:31 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.121: +3 -2 lines
Diff to previous 1.121 (colored) to selected 1.172 (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.121 / (download) - annotate - [select for diffs], Fri Jun 20 17:24:00 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +11 -11 lines
Diff to previous 1.120 (colored) to selected 1.172 (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.120 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:04 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +6 -6 lines
Diff to previous 1.119 (colored) to selected 1.172 (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.119 / (download) - annotate - [select for diffs], Fri Mar 28 23:26:25 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.118: +2 -1 lines
Diff to previous 1.118 (colored) to selected 1.172 (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.118 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.117: +2 -7 lines
Diff to previous 1.117 (colored) to selected 1.172 (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.117 / (download) - annotate - [select for diffs], Wed Mar 19 22:20:43 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.116: +2 -2 lines
Diff to previous 1.116 (colored) to selected 1.172 (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.116 / (download) - annotate - [select for diffs], Wed Mar 19 21:51:20 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.115: +8 -12 lines
Diff to previous 1.115 (colored) to selected 1.172 (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.115 / (download) - annotate - [select for diffs], Wed Jan 22 20:58:39 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +2 -1 lines
Diff to previous 1.114 (colored) to selected 1.172 (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.114 / (download) - annotate - [select for diffs], Sun Jan 5 20:26:36 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored) to selected 1.172 (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() and fix some errors in mandoc(3).

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.113 / (download) - annotate - [select for diffs], Thu Jan 2 16:29:55 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +10 -2 lines
Diff to previous 1.112 (colored) to selected 1.172 (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.112 / (download) - annotate - [select for diffs], Mon Dec 30 18:30:32 2013 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3
Changes since 1.111: +2 -3 lines
Diff to previous 1.111 (colored) to selected 1.172 (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.111 / (download) - annotate - [select for diffs], Sat Oct 5 20:30:05 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +3 -2 lines
Diff to previous 1.110 (colored) to selected 1.172 (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()
- do not complain about unused variables in test-*.c
- garbage collect a few unused variables elsewhere

Revision 1.110 / (download) - annotate - [select for diffs], Mon Sep 16 00:25:07 2013 UTC (10 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_2
Changes since 1.109: +2 -2 lines
Diff to previous 1.109 (colored) to selected 1.172 (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.109 / (download) - annotate - [select for diffs], Thu Aug 8 20:07:47 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +2 -1 lines
Diff to previous 1.108 (colored) to selected 1.172 (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.108 / (download) - annotate - [select for diffs], Sat Jul 13 12:52:07 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +3 -2 lines
Diff to previous 1.107 (colored) to selected 1.172 (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.107 / (download) - annotate - [select for diffs], Fri May 31 21:37:17 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.106: +3 -3 lines
Diff to previous 1.106 (colored) to selected 1.172 (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.106 / (download) - annotate - [select for diffs], Mon Nov 19 22:30:58 2012 UTC (11 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.105: +3 -1 lines
Diff to previous 1.105 (colored) to selected 1.172 (colored)

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

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

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

Revision 1.104 / (download) - annotate - [select for diffs], Wed Jul 18 11:11:12 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.103: +2 -1 lines
Diff to previous 1.103 (colored) to selected 1.172 (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.

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

Revision 1.103 / (download) - annotate - [select for diffs], Thu Jul 12 15:11:14 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +2 -2 lines
Diff to previous 1.102 (colored) to selected 1.172 (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.
OpenBSD rev. 1.105

Revision 1.102 / (download) - annotate - [select for diffs], Thu May 31 22:29:13 2012 UTC (11 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +3 -2 lines
Diff to previous 1.101 (colored) to selected 1.172 (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.

"just commit" kristaps@

Revision 1.101 / (download) - annotate - [select for diffs], Sun May 27 17:54:54 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +3 -10 lines
Diff to previous 1.100 (colored) to selected 1.172 (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().

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

Revision 1.100 / (download) - annotate - [select for diffs], Sun May 27 17:48:57 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +3 -3 lines
Diff to previous 1.99 (colored) to selected 1.172 (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.

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

Revision 1.99 / (download) - annotate - [select for diffs], Thu Feb 16 20:51:31 2012 UTC (12 years, 1 month ago) by joerg
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.98: +3 -1 lines
Diff to previous 1.98 (colored) to selected 1.172 (colored)

Add mparse_readmem, which allows application to run the parser directly
from memory, e.g. after de-compressing a document.

Revision 1.98 / (download) - annotate - [select for diffs], Tue Nov 8 00:15:23 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.97: +3 -3 lines
Diff to previous 1.97 (colored) to selected 1.172 (colored)

Const-ify some mchars arguments.  I think these are non-const for historical
dumbness on my part.

Revision 1.97 / (download) - annotate - [select for diffs], Mon Nov 7 01:24:40 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +1 -2 lines
Diff to previous 1.96 (colored) to selected 1.172 (colored)

When the HEAD scope of .TP is broken by another block macro,
do not abort with a FATAL error, but report a report a WARNING,
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.
ok kristaps@

Revision 1.96 / (download) - annotate - [select for diffs], Thu Oct 6 22:29:12 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_0
Changes since 1.95: +18 -17 lines
Diff to previous 1.95 (colored) to selected 1.172 (colored)

If -Tman is specified and input is -man, echo the preprocessed (`so'
replaced by file) input.  This replaces earlier behaviour of doing
nothing, which I found unexpected (mandoc should always output).

This requires a buffer in read.c that saves the input lines before being
parsed, with a special hook if `so' is invoked.  This buffer is just
flushed to output if -mman is the input.

While mucking around doing this, I also alpha-ordered the mandoc.h
functions.

Ok schwarze@, with no screaming when the polished patch was published.

Revision 1.95 / (download) - annotate - [select for diffs], Sat Jul 23 18:44:42 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_7, VERSION_1_11_6, VERSION_1_11_5
Changes since 1.94: +3 -1 lines
Diff to previous 1.94 (colored) to selected 1.172 (colored)

Note GNU extensions in eqn.7.  Also add `col' and `pile', which are
mentioned briefly in the eqn User's Manual, but otherwise are
unspecified.

Revision 1.94 / (download) - annotate - [select for diffs], Sat Jul 23 18:41:18 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored) to selected 1.172 (colored)

Add support for tdefine and ndefine.  Consolidate some error messages.  Add
somem more version notes (getting there).  Have the equation nanme be captured.

Revision 1.93 / (download) - annotate - [select for diffs], Sat Jul 23 12:10:16 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.92: +2 -1 lines
Diff to previous 1.92 (colored) to selected 1.172 (colored)

Add `fat' font.  This pretty much brings us in line with the second
edition of eqn.

Revision 1.92 / (download) - annotate - [select for diffs], Sat Jul 23 12:01:54 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.91: +6 -3 lines
Diff to previous 1.91 (colored) to selected 1.172 (colored)

Add matrix support.  Also remove "above" notion, as all elements in a
list are delimited by their "aboveness" and it's superfluous.

Revision 1.91 / (download) - annotate - [select for diffs], Fri Jul 22 14:55:07 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.90: +1 -2 lines
Diff to previous 1.90 (colored) to selected 1.172 (colored)

Add support for `gsize' eqn token (introduced in second-edition troff).

Revision 1.90 / (download) - annotate - [select for diffs], Fri Jul 22 09:57:04 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.89: +3 -2 lines
Diff to previous 1.89 (colored) to selected 1.172 (colored)

Give lists their own eqn function.

Revision 1.89 / (download) - annotate - [select for diffs], Thu Jul 21 23:30:39 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.88: +22 -5 lines
Diff to previous 1.88 (colored) to selected 1.172 (colored)

Complete eqn.7 parsing.  Features all productions from the original 1975
CACM paper in an LR(1) parse (1 -> eqn_rewind()).  Right now the code is
a little jungly, but will clear up as I consolidate parse components.
The AST structure will also be cleaned up, as right now it's pretty ad
hoc (this won't change the parse itself).  I added the mandoc_strndup()
function will here.

Revision 1.88 / (download) - annotate - [select for diffs], Thu Jul 21 15:21:13 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.87: +3 -1 lines
Diff to previous 1.87 (colored) to selected 1.172 (colored)

Support `size' constructs in eqn.7.  Generalise mandoc_strontou to this
effect.

Revision 1.87 / (download) - annotate - [select for diffs], Thu Jul 21 14:13:00 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.86: +17 -1 lines
Diff to previous 1.86 (colored) to selected 1.172 (colored)

Full support for eqn positionals (above, over, sup, sub, etc.).

Revision 1.86 / (download) - annotate - [select for diffs], Thu Jul 21 13:37:04 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.85: +12 -3 lines
Diff to previous 1.85 (colored) to selected 1.172 (colored)

Add eqn subexpression fonts.

Revision 1.85 / (download) - annotate - [select for diffs], Thu Jul 21 13:18:24 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.84: +15 -1 lines
Diff to previous 1.84 (colored) to selected 1.172 (colored)

Add support for markers.  These decorate the last box: see eqn.7.

Revision 1.84 / (download) - annotate - [select for diffs], Thu Jul 21 12:30:44 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.83: +15 -8 lines
Diff to previous 1.83 (colored) to selected 1.172 (colored)

Support nested `{, }' subexpressions in eqn.  Document in code.

Revision 1.83 / (download) - annotate - [select for diffs], Thu Jul 21 11:34:53 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.82: +14 -3 lines
Diff to previous 1.82 (colored) to selected 1.172 (colored)

Flip eqn into using parsed nodes.  I've temporarily disabled printing
these in the front-ends except for -Ttree, which will display the parsed
tree.

While here, fix that quoted strings aren't scanned for replacement parts.

Revision 1.82 / (download) - annotate - [select for diffs], Thu Jul 21 10:24:35 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.81: +2 -2 lines
Diff to previous 1.81 (colored) to selected 1.172 (colored)

Finish the eqn syntactic parser.  This correctly parses terms and does
the proper `define' dance, which amounts to pure word-replace (you can,
say, define `foo' as `define' then define `define' as something else).
eqn.c is now ready for some semantic parsing of `box' and `eqn'
productions as defined by the grammar.

Revision 1.81 / (download) - annotate - [select for diffs], Mon Jul 18 14:30:51 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.80: +2 -1 lines
Diff to previous 1.80 (colored) to selected 1.172 (colored)

Forgot to add these bits to the last commit.

Revision 1.80 / (download) - annotate - [select for diffs], Sun Jul 17 14:08:49 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.79: +4 -1 lines
Diff to previous 1.79 (colored) to selected 1.172 (colored)

Provide implementations of `define', `set', and `unset'.
Tie them into the stream of data.
Document these appropriate, bringing in the grammar as defined by the
original eqn manual (Kernighan/Richie).

Revision 1.79 / (download) - annotate - [select for diffs], Sun Jul 17 12:52:54 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.78: +4 -1 lines
Diff to previous 1.78 (colored) to selected 1.172 (colored)

Warn if equation `define' key is quoted (groff-ism).

Revision 1.78 / (download) - annotate - [select for diffs], Fri Jul 15 10:14:12 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.77: +2 -1 lines
Diff to previous 1.77 (colored) to selected 1.172 (colored)

Expose mandoc_strdup() to the outside world.

Revision 1.77 / (download) - annotate - [select for diffs], Tue May 24 21:31:23 2011 UTC (12 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_4, VERSION_1_11_3
Changes since 1.76: +1 -4 lines
Diff to previous 1.76 (colored) to selected 1.172 (colored)

Remove all references to ESCAPE_PREDEF, which is now not exposed passed
the libroff point.  This clears up a nice chunk of code.

Revision 1.76 / (download) - annotate - [select for diffs], Tue May 17 11:50:20 2011 UTC (12 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.75: +2 -1 lines
Diff to previous 1.75 (colored) to selected 1.172 (colored)

Flip on unicode output (via \[uNNNN]) in -T[x]html.  Here we go!

Revision 1.75 / (download) - annotate - [select for diffs], Sun May 15 15:30:33 2011 UTC (12 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.74: +2 -1 lines
Diff to previous 1.74 (colored) to selected 1.172 (colored)

Support groff's escape for Unicode input.  See

  http://mdocml.bsd.lv/archives/tech/0368.html

For the time being, we just throw it away.

Revision 1.74 / (download) - annotate - [select for diffs], Sat Apr 30 22:24:31 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_2
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored) to selected 1.172 (colored)

Make mchars_num2char() return a char like it says.

Revision 1.73 / (download) - annotate - [select for diffs], Sat Apr 30 22:14:42 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored) to selected 1.172 (colored)

Rename mchars_init() -> mchars_alloc() for consistency.

Revision 1.72 / (download) - annotate - [select for diffs], Sat Apr 30 22:14:02 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.71: +2 -7 lines
Diff to previous 1.71 (colored) to selected 1.172 (colored)

Remove enum mcharst, which hasn't been used in quite some time.

Revision 1.71 / (download) - annotate - [select for diffs], Fri Apr 29 22:18:12 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.70: +16 -1 lines
Diff to previous 1.70 (colored) to selected 1.172 (colored)

Move "chars" interface out of out.h and into mandoc.h.  This doesn't
change any code but for renaming functions and types to be consistent
with other mandoc.h stuff.  The reason for moving into libmandoc is that
the rendering of special characters is part of mandoc itself---not an
external part.  From mandoc(1)'s perspective, this changes nothing, but
for other utilities, it's important to have these part of libmandoc.
Note this isn't documented [yet] in mandoc.3 because there are some
parts I'd like to change around beforehand.

Revision 1.70 / (download) - annotate - [select for diffs], Sat Apr 9 15:29:40 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.69: +17 -1 lines
Diff to previous 1.69 (colored) to selected 1.172 (colored)

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

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

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

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

Revision 1.69 / (download) - annotate - [select for diffs], Mon Mar 28 21:49:42 2011 UTC (13 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_1
Changes since 1.68: +3 -1 lines
Diff to previous 1.68 (colored) to selected 1.172 (colored)

Put mandocerrs and mandoclevels arrays into libmandoc with accessors
mparse_strerror() and mparse_strlevel().

Revision 1.68 / (download) - annotate - [select for diffs], Wed Mar 23 09:47:13 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (colored) to selected 1.172 (colored)

Make (e.g.) `SM' before `B' be only a warning.  In reality, this refers
to ELINE macros ("next-line", but not unbreakable like the next-line
paragraph macros) followed by other macros.  This addresses a report by
Christian Weisgerber, posted in the TODO by schwarze@, and aired on
discuss@ (22/03/2011) for whether a fix is warranted.

Revision 1.67 / (download) - annotate - [select for diffs], Tue Mar 22 14:05:45 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.66: +1 -19 lines
Diff to previous 1.66 (colored) to selected 1.172 (colored)

Move mandoc_isdelim() back into libmdoc.h.  This fixes an unreported
error where (1) -man pages were punctuating delimiters (e.g., `.B a ;')
and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its
own line) would also be punctuated.  This introduces a small amount of
complexity of mdoc_{html,term}.c must manage their own spacing with
running print_word() or print_text().  The check for delimiting now
happens in mdoc_macro.c's dword().

Revision 1.66 / (download) - annotate - [select for diffs], Tue Mar 22 10:35:26 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.65: +2 -1 lines
Diff to previous 1.65 (colored) to selected 1.172 (colored)

Add a FATAL error for when no manual type was assigned (you can repeat
this for yourself by having a file consisting only of comments).

Revision 1.65 / (download) - annotate - [select for diffs], Tue Mar 22 09:48:13 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.64: +1 -37 lines
Diff to previous 1.64 (colored) to selected 1.172 (colored)

Step 1 of restructuring: libmandoc.h.  Move all compiler-set-specific
stuff into libmandoc.h, including old mdoc.h/man.h/roff.h functions now
used by read.c.  The motivation behind this is to tighten the
relationship between the underlying compilers while keeping parse data
hidden from general callers (e.g., main.c).

While here, also move register values from mandoc.h into libmandoc.h as
noted by schwarze@.  See above for explanation.

Revision 1.64 / (download) - annotate - [select for diffs], Sun Mar 20 16:05:21 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.63: +2 -5 lines
Diff to previous 1.63 (colored) to selected 1.172 (colored)

Let read.c worry about the currently-open file instead of having this
information duplicated in main.c.  For the time being, remove evt_close
and evt_open, as the only known mparse interface (main.c) doesn't need
them.

Revision 1.63 / (download) - annotate - [select for diffs], Sun Mar 20 16:02:05 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.62: +5 -5 lines
Diff to previous 1.62 (colored) to selected 1.172 (colored)

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

Revision 1.62 / (download) - annotate - [select for diffs], Sun Mar 20 11:41:24 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.61: +26 -1 lines
Diff to previous 1.61 (colored) to selected 1.172 (colored)

Split the document parsing sequence out of main.c and into read.c,
putting the interface into mandoc.h.  This effectively makes the
function of main.c be command-line handling, invoking the parser, and
sending its output to the output handler.  The sequence of parsing
(pfile(), pdesc(), etc.) has changed very little but for clean-up of
some state variables (curp->fd, etc.).

Revision 1.61 / (download) - annotate - [select for diffs], Thu Mar 17 12:08:01 2011 UTC (13 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_10
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored) to selected 1.172 (colored)

mandocmsg finally has no return value.

Revision 1.60 / (download) - annotate - [select for diffs], Thu Mar 17 09:16:38 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.59: +19 -1 lines
Diff to previous 1.59 (colored) to selected 1.172 (colored)

Move mdoc_isdelim() into mandoc.h as mandoc_isdelim().  This allows the
removal of manual delimiter checks in html.c and term.c.  Finally, add
the escaped period as a closing delimiter, removing a TODO to this
effect.

Revision 1.59 / (download) - annotate - [select for diffs], Thu Mar 17 08:49:34 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.58: +7 -7 lines
Diff to previous 1.58 (colored) to selected 1.172 (colored)

Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.h
so that everybody can use them.  This follows the convention of
libXXXX.h being internal to a library and XXXX.h being the external
interface.  Not only does this allow the removal of lots of redundant
NULL-checking code, it also sets the tone for adding new mandoc-global
routines.

Revision 1.58 / (download) - annotate - [select for diffs], Mon Mar 7 01:35:51 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.57: +3 -2 lines
Diff to previous 1.57 (colored) to selected 1.172 (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.57 / (download) - annotate - [select for diffs], Wed Feb 9 09:05:52 2011 UTC (13 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.56: +3 -1 lines
Diff to previous 1.56 (colored) to selected 1.172 (colored)

Allow EQN data to be pushed down into libmdoc via mdoc_addeqn().  Only
the adding itself is implemented; equation data is not yet shown.

Revision 1.56 / (download) - annotate - [select for diffs], Sun Feb 6 22:02:58 2011 UTC (13 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.55: +2 -1 lines
Diff to previous 1.55 (colored) to selected 1.172 (colored)

Let the line-number of a tbl_span be remembered.

Revision 1.55 / (download) - annotate - [select for diffs], Sun Feb 6 20:36:36 2011 UTC (13 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.54: +6 -1 lines
Diff to previous 1.54 (colored) to selected 1.172 (colored)

Add initial EQN support to mandoc.  This parses, then throws away, data
between EQ and EN roff blocks.  EQN is different from TBL in that data
after .EQ is unilaterally considered an equation until an .EN.  Thus,
there's no need to jump through hoops in having table spans and so on.
This is ONLY the parse code framework in libroff.  EQN is not yet passed
into the backends.

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

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

Revision 1.53 / (download) - annotate - [select for diffs], Wed Jan 12 15:50:42 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.52: +2 -1 lines
Diff to previous 1.52 (colored) to selected 1.172 (colored)

Make out-of-context `fi' invocations not cause an error, but just a
warning.  From a TODO by schwarze@, originally noted by Brad Smith.

Revision 1.52 / (download) - annotate - [select for diffs], Tue Jan 11 00:11:45 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +2 -1 lines
Diff to previous 1.51 (colored) to selected 1.172 (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.51 / (download) - annotate - [select for diffs], Mon Jan 10 15:31:00 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.50: +11 -11 lines
Diff to previous 1.50 (colored) to selected 1.172 (colored)

Clarify what members may be NULL or not in calculating widths.  Make
sure signedness is correct.  Verify that layouts MUST exit for data
cells.

Revision 1.50 / (download) - annotate - [select for diffs], Mon Jan 10 14:40:30 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.49: +3 -4 lines
Diff to previous 1.49 (colored) to selected 1.172 (colored)

First, make extra data cells be thrown away.  This makes "dp->layout"
always hold, which cleans up the table stuff a bit.

Second, set a "spans" value per data cell consisting of the number of
skipped TBL_CELL_SPAN layout cells.

Third, make tbl_term.c understand how to skip over spanned sections when
iterating over the header queue.

What remains is to calculate the widths of spanned cells.

Revision 1.49 / (download) - annotate - [select for diffs], Thu Jan 6 13:45:47 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_9
Changes since 1.48: +1 -2 lines
Diff to previous 1.48 (colored) to selected 1.172 (colored)

Remove delims from struct tbl (not used anywhere and never will be).

Revision 1.48 / (download) - annotate - [select for diffs], Tue Jan 4 15:02:00 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.47: +3 -1 lines
Diff to previous 1.47 (colored) to selected 1.172 (colored)

Support `T{' and `T}' data blocks.  When a standalone `T{' is
encountered as a line's last data cell, move into TBL_PART_CDATA mode
whilst leaving the cell's designation as TBL_DATA_NONE.  When new data
arrives that's not a standalone `T}', append it to the cell contends.
Close out and warn appropriately.

Revision 1.47 / (download) - annotate - [select for diffs], Tue Jan 4 12:06:21 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.46: +2 -1 lines
Diff to previous 1.46 (colored) to selected 1.172 (colored)

Fix to make horizontal spanners in the layout be properly printed.
mandoc also now warns (so does tbl(1)) if a horizontal spanner is
specified along with data.

While here, fix up some documentation and uncomment the tbl reference.

Revision 1.46 / (download) - annotate - [select for diffs], Mon Jan 3 23:53:51 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.45: +3 -2 lines
Diff to previous 1.45 (colored) to selected 1.172 (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.45 / (download) - annotate - [select for diffs], Mon Jan 3 13:59:21 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.44: +4 -4 lines
Diff to previous 1.44 (colored) to selected 1.172 (colored)

Make width calculations occur within tbl_term.c, not tbl.c.  This allows
for front-ends to make decisions about widths, not the back-end.

To pull this off, first make each tbl_head contain a unique index value
(0 <= index < total tbl_head elements) and remove the tbl_calc() routine
from the back-end.

Then, when encountering the first tbl_span in the front-end, dynamically
create an array of configurations (termp_tbl) keyed on each tbl_head's
unique index value.  Construct the decimals and widths at this time,
then continue parsing as before.

The termp_tbl and indexes are required because we pass a const tbl AST
into the front-end.

Revision 1.44 / (download) - annotate - [select for diffs], Sun Jan 2 12:04:23 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.43: +6 -1 lines
Diff to previous 1.43 (colored) to selected 1.172 (colored)

Add some final bits necessary in the upcoming -Tascii tbl stuff.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Jan 2 10:10:57 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.42: +16 -1 lines
Diff to previous 1.42 (colored) to selected 1.172 (colored)

Churn to get parts of 'struct tbl' visible from mandoc.h: rename the
existing 'struct tbl' as 'struct tbl_node', then move all option stuff
into a 'struct tbl' in mandoc.h.

This conflicted with a structure in chars.c, which was renamed.

Revision 1.42 / (download) - annotate - [select for diffs], Sat Jan 1 22:27:08 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.41: +6 -1 lines
Diff to previous 1.41 (colored) to selected 1.172 (colored)

Add a warning if a data cell has no layout.  Also make -Ttree show this
with a little star next to the entry (yeah, this is mostly for testing).

Revision 1.41 / (download) - annotate - [select for diffs], Sat Jan 1 22:19:15 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.40: +21 -1 lines
Diff to previous 1.40 (colored) to selected 1.172 (colored)

Plug in the "head" concept for tables.  A tbl_head specifies the full
layout for each row, including vertical spacers.  One grabs the tbl_head
for a row and iterates through each entry, plugging data from the
tbl_span into the header as appropriate.

This is pulled in more or less verbatim from tbl.bsd.lv.  In fact, this
is verbatim except that lists macros are made into hard-coded lists (for
compatibility, as long-ago noted by joerg@).

Revision 1.40 / (download) - annotate - [select for diffs], Sat Jan 1 17:10:20 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.39: +17 -9 lines
Diff to previous 1.39 (colored) to selected 1.172 (colored)

Make some bit-flags into enums as they should be.  Make printing of -Ttree
tables a little bit smarter.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Jan 1 15:45:18 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored) to selected 1.172 (colored)

Add documentation bits for libroff's new roff_span().

Add bits to remember tbl's invocation point.

Add ERROR class message if no data's in the table.

Revision 1.38 / (download) - annotate - [select for diffs], Fri Dec 31 18:19:43 2010 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.37: +70 -1 lines
Diff to previous 1.37 (colored) to selected 1.172 (colored)

Expose the parsed table API to the world and add accessors through the
roff.h interface.

Revision 1.37 / (download) - annotate - [select for diffs], Wed Dec 29 14:38:14 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.36: +3 -1 lines
Diff to previous 1.36 (colored) to selected 1.172 (colored)

Merge, with considerable changes, tbl.bsd.lv's layout-handling code.

Revision 1.36 / (download) - annotate - [select for diffs], Wed Dec 29 01:16:57 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.35: +3 -1 lines
Diff to previous 1.35 (colored) to selected 1.172 (colored)

Significant update to options handling, which now departs almost
completely with the BSD.lv code due to performance issues and flat-out
errors.

Performance issues: functions called per character.  Ugly.

Flat-out errors: disallowing "reserved" tokens as arguments to those
options accepting arguments.

Also added are two mandoc.h error codes for general tbl syntax errors
and for bad options.

Revision 1.35 / (download) - annotate - [select for diffs], Wed Dec 22 11:38:17 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_8
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored) to selected 1.172 (colored)

Revert IGNPAR to a warning after clue-stick applied by schwarze@:
although technically-speaking a lost macro is an error (e.g.,
MANDOCERR_MACRO), casting out some extra whitespace (note, IGNPAR only
happens in conditions where whitespace already exists!) is hardly an
error matter.

Revision 1.34 / (download) - annotate - [select for diffs], Wed Dec 15 23:39:40 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored) to selected 1.172 (colored)

Add a "last child" member of struct mdoc_node.

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

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

Revision 1.33 / (download) - annotate - [select for diffs], Fri Dec 10 20:58:56 2010 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +2 -1 lines
Diff to previous 1.32 (colored) to selected 1.172 (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.
"check it in" kristaps@

Revision 1.32 / (download) - annotate - [select for diffs], Mon Dec 6 16:55:35 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_7
Changes since 1.31: +55 -43 lines
Diff to previous 1.31 (colored) to selected 1.172 (colored)

Bring schwarze@'s mandoc.h and main.c errors and warnings entirely in sync,
except for the tbl one which will be the focus of later study.

Revision 1.31 / (download) - annotate - [select for diffs], Mon Dec 6 15:31:19 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.30: +2 -1 lines
Diff to previous 1.30 (colored) to selected 1.172 (colored)

Add support for `ft' macro found in groff(7).  Based on a patch by
schwarze@, but without the -T[x]html handling, which structurally does
not work.  Also add man.7 documentation (not in original patch).

Revision 1.30 / (download) - annotate - [select for diffs], Mon Dec 6 11:01:19 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.29: +2 -1 lines
Diff to previous 1.29 (colored) to selected 1.172 (colored)

Merge schwarze@'s relaxation of scope-breaking rules: allow implicit
ending of scopes and drop stray scope-endings.

Revision 1.29 / (download) - annotate - [select for diffs], Sun Dec 5 15:55:01 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.28: +1 -3 lines
Diff to previous 1.28 (colored) to selected 1.172 (colored)

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

Revision 1.28 / (download) - annotate - [select for diffs], Sun Dec 5 15:49:37 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored) to selected 1.172 (colored)

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

Revision 1.27 / (download) - annotate - [select for diffs], Sun Dec 5 15:37:30 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.26: +2 -3 lines
Diff to previous 1.26 (colored) to selected 1.172 (colored)

Merge schwarze@'s changes allowing nested displays.  Tweak the patch by
making sure output doesn't add a superfluous newline with the nested displays.
Also add a COMPATIBILITY note.

Rename a macro (DATESIZ) to be in line with OpenBSD (DATESIZE).

Revision 1.26 / (download) - annotate - [select for diffs], Wed Dec 1 16:54:25 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.25: +3 -1 lines
Diff to previous 1.25 (colored) to selected 1.172 (colored)

Merge OpenBSD's `so' handling (plus some documentation).  Great work to
schwarze@ and joerg@ for his comments!

Revision 1.25 / (download) - annotate - [select for diffs], Wed Dec 1 10:31:35 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.24: +2 -1 lines
Diff to previous 1.24 (colored) to selected 1.172 (colored)

Re-ordering of roff requests as per OpenBSD.

Made `rm' be an error (again, OpenBSD...).

Revision 1.24 / (download) - annotate - [select for diffs], Mon Nov 29 15:45:15 2010 UTC (13 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.23: +2 -3 lines
Diff to previous 1.23 (colored) to selected 1.172 (colored)

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

Remove MANDOCERR_BADLIB (not used).

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

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

Revision 1.23 / (download) - annotate - [select for diffs], Mon Oct 11 15:46:19 2010 UTC (13 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored) to selected 1.172 (colored)

Use proper error for `An' multiple arguments.

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

Revision 1.22 / (download) - annotate - [select for diffs], Mon Oct 4 07:01:02 2010 UTC (13 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +29 -407 lines
Diff to previous 1.21 (colored) to selected 1.172 (colored)

Revert merging of {mdoc,man}.h -> mandoc.h.

While I'm add it, properly document all structures in these files.

Revision 1.21 / (download) - annotate - [select for diffs], Sat Oct 2 10:14:37 2010 UTC (13 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +401 -12 lines
Diff to previous 1.20 (colored) to selected 1.172 (colored)

Unify mdoc and man enums and structs into mandoc.h.  This is part of the
slow process of logically splitting formatting frontend and parser backend
without pollution.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Sep 27 09:26:27 2010 UTC (13 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_6
Changes since 1.19: +2 -1 lines
Diff to previous 1.19 (colored) to selected 1.172 (colored)

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

Revision 1.19 / (download) - annotate - [select for diffs], Sun Sep 26 20:22:28 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +2 -3 lines
Diff to previous 1.18 (colored) to selected 1.172 (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).
"looks good" kristaps@

Revision 1.18 / (download) - annotate - [select for diffs], Fri Aug 20 01:02:07 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +13 -2 lines
Diff to previous 1.17 (colored) to selected 1.172 (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.17 / (download) - annotate - [select for diffs], Tue Jul 20 14:56:42 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_5_PREPDF, VERSION_1_10_5
Changes since 1.16: +2 -1 lines
Diff to previous 1.16 (colored) to selected 1.172 (colored)

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

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

Revision 1.16 / (download) - annotate - [select for diffs], Mon Jul 5 20:10:22 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_4
Changes since 1.15: +38 -4 lines
Diff to previous 1.15 (colored) to selected 1.172 (colored)

Move register information into mandoc.h, which is where it should have
been in the first place (mandoc.h contains system-wide declarations).

Revision 1.15 / (download) - annotate - [select for diffs], Fri Jul 2 12:54:33 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.14: +2 -3 lines
Diff to previous 1.14 (colored) to selected 1.172 (colored)

Stash `Bf' parameters into struct mdoc_bf.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Jul 1 15:38:56 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +4 -3 lines
Diff to previous 1.13 (colored) to selected 1.172 (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.13 / (download) - annotate - [select for diffs], Wed Jun 30 20:32:15 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +11 -7 lines
Diff to previous 1.12 (colored) to selected 1.172 (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.12 / (download) - annotate - [select for diffs], Sat Jun 12 11:41:50 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_3, VERSION_1_10_2
Changes since 1.11: +3 -1 lines
Diff to previous 1.11 (colored) to selected 1.172 (colored)

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

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jun 12 10:09:19 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored) to selected 1.172 (colored)

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

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

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

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jun 3 13:44:36 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_1
Changes since 1.9: +2 -3 lines
Diff to previous 1.9 (colored) to selected 1.172 (colored)

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

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

Make MANDOC_LISTTYPE be a recoverable error.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jun 1 14:54:37 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (colored) to selected 1.172 (colored)

Spelling patches provided by Ulrich Spoerlein.

Revision 1.8 / (download) - annotate - [select for diffs], Mon May 31 23:40:25 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored) to selected 1.172 (colored)

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

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

Revision 1.7 / (download) - annotate - [select for diffs], Tue May 25 12:37:20 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +5 -1 lines
Diff to previous 1.6 (colored) to selected 1.172 (colored)

Modified version of Ingo Schwarze's patch for hyphen-breaking.
Breakable hyphens are cued in the back-ends (with ASCII_HYPH) and acted
upon in term.c or ignored in html.c.

Also cleaned up XML decl printing (no need for extra vars).

Revision 1.6 / (download) - annotate - [select for diffs], Mon May 24 01:41:31 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored) to selected 1.172 (colored)

fix an obvious oversight introduced in rev. 1.5:
MANDOCERR_BODYLOST is not intended to be fatal;
required to unbreak the OpenBSD build

Revision 1.5 / (download) - annotate - [select for diffs], Mon May 17 22:11:42 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +65 -3 lines
Diff to previous 1.4 (colored) to selected 1.172 (colored)

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

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

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

Allow inconsistent column syntax to only raise a warning.

Revision 1.4 / (download) - annotate - [select for diffs], Sun May 16 22:28:33 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored) to selected 1.172 (colored)

`ig' support in all its glory.  Try

  .ig ig
  asdf
  .ig
  fdsa
  ..

or

  .ig if
  asdf
  .if n \
  foo

for a laugh.  It all works.  Lots of regression tests supporting this
and documentation for the same.

Revision 1.3 / (download) - annotate - [select for diffs], Sun May 16 19:08:11 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored) to selected 1.172 (colored)

Regression tests in place for `.if' in libroff.
Check against some strange `.if' constructs I missed.
Added initial roff.7 manual.

Revision 1.2 / (download) - annotate - [select for diffs], Sat May 15 21:53:11 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +4 -1 lines
Diff to previous 1.1 (colored) to selected 1.172 (colored)

The `ig' now supports `ig end-macro'.
Initial warning/error messages in place (still experimental).

Revision 1.1 / (download) - annotate - [select for diffs], Sat May 15 18:35:14 2010 UTC (13 years, 10 months ago) by kristaps
Branch: MAIN
Diff to selected 1.172 (colored)

Add mandoc.h, which will eventually replace compilers' inner enum errors with unified ones.
Add initial roff pre-processor shim, a compiler sitting outside of the other compilers that processes pure roff instructions.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb