CVS log for mandoc/roff.c

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.375 / (download) - annotate - [select for diffs], Mon Aug 3 11:02:57 2020 UTC (3 days, 2 hours ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.374: +64 -59 lines
Diff to previous 1.374 (colored)

Put the code handling \} into a new function roff_cond_checkend()
and call that function not only from both places where copies
existed - when processing text lines and when processing request/macro
lines in conditional block scope - but also when closing a macro
definition request, such that this construction works:

.if n \{.de macroname
macro content
.. \} ignored arguments
.macroname

This fixes a bug reported by John Gardner <gardnerjohng at gmail dot com>.

While here, avoid a confusing decrement of the line scope counter
in roffnode_cleanscope() for conditional blocks that do not have
line scope in the first place (no functional change for this part).
Also improve validation of an internal invariant in roff_cblock()
and polish some comments.

Revision 1.374 / (download) - annotate - [select for diffs], Wed Apr 8 11:56:03 2020 UTC (3 months, 4 weeks ago) by schwarze
Branch: MAIN
Changes since 1.373: +2 -1 lines
Diff to previous 1.373 (colored)

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

Revision 1.373 / (download) - annotate - [select for diffs], Mon Apr 6 10:16:17 2020 UTC (4 months ago) by schwarze
Branch: MAIN
Changes since 1.372: +8 -2 lines
Diff to previous 1.372 (colored)

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

Revision 1.372 / (download) - annotate - [select for diffs], Fri Apr 3 11:35:01 2020 UTC (4 months ago) by schwarze
Branch: MAIN
Changes since 1.371: +5 -3 lines
Diff to previous 1.371 (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.371 / (download) - annotate - [select for diffs], Thu Feb 27 21:43:44 2020 UTC (5 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.370: +2 -2 lines
Diff to previous 1.370 (colored)

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

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

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

Revision 1.370 / (download) - annotate - [select for diffs], Thu Feb 27 01:43:52 2020 UTC (5 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.369: +54 -1 lines
Diff to previous 1.369 (colored)

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

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

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

Revision 1.369 / (download) - annotate - [select for diffs], Sun Jan 19 18:02:00 2020 UTC (6 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.368: +3 -3 lines
Diff to previous 1.368 (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.368 / (download) - annotate - [select for diffs], Thu Dec 26 19:51:51 2019 UTC (7 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.367: +14 -2 lines
Diff to previous 1.367 (colored)

Do not fail an assertion when a high level macro occurs in the body
of a conditional inside a .ce request block.  Instead, abort the .ce
block just like when there is no conditional in between.

Bug found by espie@ working on the textproc/fstrcmp port.

Revision 1.367 / (download) - annotate - [select for diffs], Sat Nov 9 14:39:49 2019 UTC (8 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.366: +8 -4 lines
Diff to previous 1.366 (colored)

In the past, generating comment nodes stopped at the .TH or .Dd
macro, which is usually close to the beginning of the file, right
after the Copyright header comments.  But espie@ found horrible
input files in the textproc/fstrcmp port that generate lots of parse
nodes before even getting to the header macro.  In some formatters,
comment nodes after some kinds of real content triggered assertions.

So make sure generation of comment nodes stops once real content is
encountered.

Revision 1.366 / (download) - annotate - [select for diffs], Mon Jul 1 22:56:24 2019 UTC (13 months ago) by schwarze
Branch: MAIN
Changes since 1.365: +3 -3 lines
Diff to previous 1.365 (colored)

delete trailing whitespace and space-tab sequences; no code change;
patch from Michal Nowak <mnowak at startmail dot com>
who found these with git pbchk in the illumos tree

Revision 1.365 / (download) - annotate - [select for diffs], Sun Apr 21 23:51:21 2019 UTC (15 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.364: +7 -2 lines
Diff to previous 1.364 (colored)

When calling an empty macro, do not clobber existing arguments.
Fixing a bug found with the groffer(1) version 1.19 manual page
following a report from Jan Stary.

Revision 1.364 / (download) - annotate - [select for diffs], Sun Apr 21 22:48:58 2019 UTC (15 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.363: +46 -9 lines
Diff to previous 1.363 (colored)

Implement the roff .break request (break out of a .while loop).
Jan Stary <hans at stare dot cz> found it in an ancient groffer(1)
manual page (version 1.19) on MacOS X Mojave.
Having .break not implemented wasn't a particularly bright idea
because obviously, it tended to cause infinite loops.

Revision 1.363 / (download) - annotate - [select for diffs], Wed Feb 6 21:11:43 2019 UTC (17 months, 4 weeks ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.362: +19 -8 lines
Diff to previous 1.362 (colored)

Let roff_getname() end the roff identifier at a tab character
and audit all its callers whether termination is handled correctly.

Resulting improvements:
* An escape or tab ending the macro name in a macro invocation
is discarded, and argument processing is started after it.
* An escape or tab ending a name in ".if d" and ".if r" is preserved.
* An escape ending a name in ".ds" causes the whole request to be ignored.
* A tab ending a name in ".ds" becomes part of the string.
* An escape or tab ending a name in ".rm"
causes the rest of the line to be ignored.
* An escape or tab ending the first name in ".als", ".rn", or ".nr"
causes the whole request to be ignored.

Kurt Jaeger <pi at FreeBSD> made me aware of
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235456#c0
and in that bug report, comment 0 item (3) is a special case
of this class of issues.

Yes, the "mh" manual pages are no doubt among the worst on the planet.

Revision 1.362 / (download) - annotate - [select for diffs], Wed Feb 6 17:40:13 2019 UTC (17 months, 4 weeks ago) by schwarze
Branch: MAIN
Changes since 1.361: +15 -12 lines
Diff to previous 1.361 (colored)

adjust style and comments in roff_getname(); no functional change

Revision 1.361 / (download) - annotate - [select for diffs], Sat Jan 5 09:10:32 2019 UTC (19 months ago) by schwarze
Branch: MAIN
Changes since 1.360: +3 -1 lines
Diff to previous 1.360 (colored)

no-fill mode has to be suspended during tbl(7) rendering, too

Revision 1.360 / (download) - annotate - [select for diffs], Sat Jan 5 00:36:50 2019 UTC (19 months ago) by schwarze
Branch: MAIN
Changes since 1.359: +3 -3 lines
Diff to previous 1.359 (colored)

Some high-level block macros have an effect similar to temporarily
suspending no-fill mode during their head.  Model this with an
additional roff parser state flag ROFF_NONOFILL.  That is much
simpler than it would be to save and restore the ROFF_NOFILL flag
itself, in particular since the latter can be switched (with lasting
effect) by the .nf and .fi requests even while its effect is
temporarily suspended.

This commit does not change formatting yet, but prepares for future
formatting simplifications and improvements.

Revision 1.359 / (download) - annotate - [select for diffs], Mon Dec 31 08:18:12 2018 UTC (19 months ago) by schwarze
Branch: MAIN
Changes since 1.358: +5 -1 lines
Diff to previous 1.358 (colored)

Store the fill mode with a new flag NODE_NOFILL in every node,
like it is already done with NODE_SYNPRETTY, such that the fill
mode becomes more directly available to the formatters.
Not used yet, but will be used by upcoming commits.

Revision 1.358 / (download) - annotate - [select for diffs], Mon Dec 31 07:08:12 2018 UTC (19 months ago) by schwarze
Branch: MAIN
Changes since 1.357: +29 -21 lines
Diff to previous 1.357 (colored)

Move parsing of the .nf and .fi (fill mode) requests from the man(7)
parser to the roff(7) parser.  As a side effect, .nf and .fi are
now also parsed in mdoc(7) input, though the mdoc(7) formatters
still ignore most of their effect.

Revision 1.357 / (download) - annotate - [select for diffs], Mon Dec 31 04:55:47 2018 UTC (19 months ago) by schwarze
Branch: MAIN
Changes since 1.356: +13 -6 lines
Diff to previous 1.356 (colored)

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

Revision 1.356 / (download) - annotate - [select for diffs], Sun Dec 30 00:49:56 2018 UTC (19 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.355: +14 -17 lines
Diff to previous 1.355 (colored)

Cleanup, no functional change:

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

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

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

Revision 1.355 / (download) - annotate - [select for diffs], Fri Dec 21 17:15:19 2018 UTC (19 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.354: +54 -21 lines
Diff to previous 1.354 (colored)

Rename mandoc_getarg() to roff_getarg() and pass it the roff parser
struct as an argument such that after copy-in, it can call roff_expand()
once again, which used to be called roff_res() before this.  This
fixes a subtle low-level roff(7) parsing bug reported by Fabio
Scotoni <fabio at esse dot ch> in the 4.4BSD-Lite2 mdoc.samples(7)
manual page, because that page used an escaped escape sequence in
a macro argument.

To expand escaped escape sequences in quoted mdoc(7) arguments, too,
stop bypassing the call to roff_getarg() in mdoc_argv.c, function args()
for this case.  This does not solve the case of escaped escape sequences
in quoted .Bl -column phrases yet.

Because roff_expand() can make the string longer, roff_getarg() can no
longer operate in-place but needs to malloc(3) the returned string.
In the high-level parsers, free(3) that string after processing it.

Revision 1.354 / (download) - annotate - [select for diffs], Thu Dec 20 03:41:54 2018 UTC (19 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.353: +2 -2 lines
Diff to previous 1.353 (colored)

Bugfix:
When after a \\, \t, or \a, another \t or \a had to be resolved
in copy mode within the same argument, the argument got corrupted.
Found while working on a loosely related bug report
from Fabio Scotoni <fabio at esse dot ch>.

Revision 1.353 / (download) - annotate - [select for diffs], Tue Dec 18 22:00:02 2018 UTC (19 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.352: +98 -1 lines
Diff to previous 1.352 (colored)

As a first step towards making roff_res() callable from mandoc_getarg(),
move the function mandoc_getarg() from mandoc.c to roff.c.  It was
misplaced in mandoc.c in the first place; that file is intended for
utilities needed both by parsers and by formatters, while reading
macro arguments in copy mode is purely a task of the roff(7) parser.
Needed as a preliminary for an upcoming bugfix.
No code change.

Revision 1.352 / (download) - annotate - [select for diffs], Sat Dec 15 19:30:26 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.351: +34 -15 lines
Diff to previous 1.351 (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.351 / (download) - annotate - [select for diffs], Fri Dec 14 06:33:14 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.350: +6 -10 lines
Diff to previous 1.350 (colored)

Cleanup, no functional change:
Now that message handling is properly encapsulated,
remove struct mparse pointers from four structs (roff, roff_man,
tbl_node, eqn_node) and from the argument lists of five functions
(roff_alloc, roff_man_alloc, mandoc_getarg, tbl_alloc, eqn_alloc).
Except for being passed to the main program as an opaque object,
it now only occurs in read.c, as it should, and not across 15 files
like in the past.

Revision 1.350 / (download) - annotate - [select for diffs], Fri Dec 14 05:18:03 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.349: +77 -92 lines
Diff to previous 1.349 (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.349 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:47 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.348: +2 -1 lines
Diff to previous 1.348 (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.348 / (download) - annotate - [select for diffs], Thu Dec 13 05:23:38 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.347: +2 -3 lines
Diff to previous 1.347 (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.347 / (download) - annotate - [select for diffs], Thu Dec 13 03:40:13 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.346: +4 -6 lines
Diff to previous 1.346 (colored)

Cleanup, no functional change:
In libroff.h, nothing was left except the eqn(7) parser interface, which
isn't really part of the roff(7) parser, so rename it to eqn_parse.h.

While here, move struct eqn_def to eqn.c because that's the only
file using it, and let eqn_box_free() and eqn_free() handle NULL.

Revision 1.346 / (download) - annotate - [select for diffs], Thu Dec 13 02:06:07 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.345: +14 -22 lines
Diff to previous 1.345 (colored)

Cleanup, no functional change:
Move tbl(7)-specific parser internals out of libroff.h.
Move some tbl(7)-internal processing from roff.c to tbl.c.

Revision 1.345 / (download) - annotate - [select for diffs], Wed Dec 12 21:54:35 2018 UTC (19 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.344: +3 -2 lines
Diff to previous 1.344 (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.344 / (download) - annotate - [select for diffs], Tue Dec 4 02:53:51 2018 UTC (20 months ago) by schwarze
Branch: MAIN
Changes since 1.343: +9 -1 lines
Diff to previous 1.343 (colored)

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

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

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

Revision 1.343 / (download) - annotate - [select for diffs], Mon Nov 26 17:44:34 2018 UTC (20 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.342: +29 -7 lines
Diff to previous 1.342 (colored)

When a conditional block is closed by putting "\}" on a text line
by itself (which is somewhat unusual but not invalid; most authors
use the empty macro line ".\}" instead), agree more closely with
groff and do not produce a double space in the output.

Quirk reported by millert@.

While here, tweak the rest of the function body of roff_cond_text()
to more closely match roff_cond_sub().  The subtly different handling
could make people (including myself) wonder whether there is any
point in being different.  Testing shows there is not.

Revision 1.342 / (download) - annotate - [select for diffs], Thu Oct 25 01:32:40 2018 UTC (21 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.341: +2 -1 lines
Diff to previous 1.341 (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.341 / (download) - annotate - [select for diffs], Sat Aug 25 16:53:39 2018 UTC (23 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.340: +73 -2 lines
Diff to previous 1.340 (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.340 / (download) - annotate - [select for diffs], Fri Aug 24 23:12:33 2018 UTC (23 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.339: +146 -125 lines
Diff to previous 1.339 (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.339 / (download) - annotate - [select for diffs], Thu Aug 23 14:29:39 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.338: +205 -179 lines
Diff to previous 1.338 (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.338 / (download) - annotate - [select for diffs], Tue Aug 21 18:15:22 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.337: +19 -5 lines
Diff to previous 1.337 (colored)

Implement the \\$@ escape sequence (insert all macro arguments,
quoted) in addition to the already supported \\$* (similar, but
unquoted).  Then use \\$@ to improve the implementation of
the .als request (macro alias).

Needed by groff_hdtbl(7).
Gosh, it feels like the manual pages of the groff package are
exercising every bloody roff(7) feature under the sun.  In the
manual page source code itself, not merely in the implementation
of the used macro packages, that is.

Revision 1.337 / (download) - annotate - [select for diffs], Mon Aug 20 17:25:09 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.336: +35 -8 lines
Diff to previous 1.336 (colored)

Expand \n(.$ (the number of macro arguments) right in roff_userdef(),
before even reparsing the expanded macro.
That is the least dirty way to fix the bug that \(.$ remained set
after execution of the user-defined macro ended.  Any other way
to fix it would probably require changes to read.c, which really
shouldn't be bothered with such roff(7) internals.

Revision 1.336 / (download) - annotate - [select for diffs], Sun Aug 19 17:46:14 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.335: +44 -5 lines
Diff to previous 1.335 (colored)

Mostly complete implementation of the 'c' (character available)
roff conditional, except that the .char request still isn't supported
and that behaviour differs from groff in many edge cases.
But at least valid character names and numbers are now distinguished
from invalid ones.
This also fixes the bug that parsing of the 'c' conditional was
incomplete, which resulted in leaking the tested character to the
input parser at the beginning of the body when the condition was
inverted.

Revision 1.335 / (download) - annotate - [select for diffs], Sat Aug 18 22:05:43 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.334: +3 -2 lines
Diff to previous 1.334 (colored)

Bugfix: When a line ends with '\ \"', don't strip the trailing space
because that turned it into a bogus line continuation.

Revision 1.334 / (download) - annotate - [select for diffs], Sat Aug 18 21:37:01 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.333: +9 -2 lines
Diff to previous 1.333 (colored)

support the highly surprising escape sequence \# (line continuation
with comment); used for example by gropdf(1)

Revision 1.333 / (download) - annotate - [select for diffs], Sat Aug 18 02:08:27 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.332: +3 -2 lines
Diff to previous 1.332 (colored)

implement the GNU man-ext .SY/.YS (synopsis block) macro in man(7),
used in most manual pages of the groff package

Revision 1.332 / (download) - annotate - [select for diffs], Thu Aug 16 23:43:37 2018 UTC (23 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.331: +2 -1 lines
Diff to previous 1.331 (colored)

implement the GNU man-ext .TQ macro in man(7),
used for example by groff_diff(7)

Revision 1.331 / (download) - annotate - [select for diffs], Thu Aug 16 13:54:06 2018 UTC (23 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.330: +14 -1 lines
Diff to previous 1.330 (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.330 / (download) - annotate - [select for diffs], Fri Aug 10 04:41:25 2018 UTC (23 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.329: +12 -2 lines
Diff to previous 1.329 (colored)

Implement the roff(7) .nop (no operation) request.
Examples of manual pages (ab)using it
include groff(7), chem(1), groff_mom(7), and groff_hdtbl(7).

Revision 1.329 / (download) - annotate - [select for diffs], Wed Aug 1 15:40:17 2018 UTC (2 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4
Changes since 1.328: +4 -1 lines
Diff to previous 1.328 (colored)

After rewriting the parse buffer from scratch, we also have to reset
the parse point to the beginning of the new buffer or we risk out
of bounds accesses.  Bug found by Leah Neukirchen <leah at vuxu dot
org> with valgrind on Void Linux.

Revision 1.328 / (download) - annotate - [select for diffs], Wed Apr 11 17:11:13 2018 UTC (2 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.327: +30 -7 lines
Diff to previous 1.327 (colored)

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

Revision 1.327 / (download) - annotate - [select for diffs], Tue Apr 10 00:52:30 2018 UTC (2 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.326: +44 -15 lines
Diff to previous 1.326 (colored)

Two new low-level roff(7) features:
* .nr optional third argument (auto-increment step size)
* \n+ and \n- numerical register auto-increment and -decrement
bentley@ reported on Dec 9, 2013 that lang/sbcl(1) uses these.

Revision 1.326 / (download) - annotate - [select for diffs], Mon Apr 9 22:27:04 2018 UTC (2 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.325: +20 -24 lines
Diff to previous 1.325 (colored)

When accessing an undefined number register, define it to be zero, like
the previous commit for strings and macros, only technically simpler.
Desired behaviour also mentioned by Werner Lemberg in 2011.
This diff adds functionality but is -21 +19 LOC.  :-)

Revision 1.325 / (download) - annotate - [select for diffs], Mon Apr 9 02:31:42 2018 UTC (2 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.324: +82 -43 lines
Diff to previous 1.324 (colored)

Using an undefined string or macro will cause it to be defined as empty.
Observed by Werner Lemberg on Nov 14, 2011
and rotting on my TODO list ever since.

Revision 1.324 / (download) - annotate - [select for diffs], Fri Jul 14 17:16:16 2017 UTC (3 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3, VERSION_1_14_2
Changes since 1.323: +3 -2 lines
Diff to previous 1.323 (colored)

The .Dd and .TH macros must interrupt .ce, too;
fixing tree corruption and assertion failure found by jsg@ with afl(1)

Revision 1.323 / (download) - annotate - [select for diffs], Fri Jul 14 16:49:39 2017 UTC (3 years ago) by schwarze
Branch: MAIN
Changes since 1.322: +7 -6 lines
Diff to previous 1.322 (colored)

Explicitly initialize a variable where the compiler is (understandably)
unable to figure out that it is never used uninitialized.
While here, tweak the content of the variable to make its usage
easier to understand.  No functional change.

Revision 1.322 / (download) - annotate - [select for diffs], Thu Jul 13 15:13:18 2017 UTC (3 years ago) by schwarze
Branch: MAIN
Changes since 1.321: +3 -1 lines
Diff to previous 1.321 (colored)

eqn(7) .EQ has to break man(7) next-line scope, or tree corruption
and use after free many ensue; again found by jsg@ with afl(1)

Revision 1.321 / (download) - annotate - [select for diffs], Sat Jul 8 17:52:50 2017 UTC (3 years ago) by schwarze
Branch: MAIN
Changes since 1.320: +37 -37 lines
Diff to previous 1.320 (colored)

Simplify by creating struct roff_node syntax tree nodes for tbl(7)
right from roff_parseln() rather than delegating to read.c,
similar to what i just did for eqn(7).

The interface function roff_span() becomes obsolete and is deleted,
the former interface function roff_addtbl() becomes static,
the interface functions tbl_read() and tbl_cdata() become void,
and minus twelve linus of code.

No functional change.

Revision 1.320 / (download) - annotate - [select for diffs], Sat Jul 8 15:28:09 2017 UTC (3 years ago) by schwarze
Branch: MAIN
Changes since 1.319: +3 -2 lines
Diff to previous 1.319 (colored)

fix an assertion failure triggered by .ce in next-line scope;
found by jsg@ with afl(1)

Revision 1.319 / (download) - annotate - [select for diffs], Sat Jul 8 14:51:04 2017 UTC (3 years ago) by schwarze
Branch: MAIN
Changes since 1.318: +38 -48 lines
Diff to previous 1.318 (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.318 / (download) - annotate - [select for diffs], Tue Jul 4 22:52:00 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.317: +22 -16 lines
Diff to previous 1.317 (colored)

Fix handling of \} on roff request lines.
Cures bogus error messages in pages generated with pod2man(1).

Revision 1.317 / (download) - annotate - [select for diffs], Sun Jun 25 11:42:02 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.316: +2 -2 lines
Diff to previous 1.316 (colored)

add support for the MT and ME mailto macros, used for example in wg(8);
patch from bentley@

Revision 1.316 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:33 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.315: +6 -6 lines
Diff to previous 1.315 (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.315 / (download) - annotate - [select for diffs], Sun Jun 18 17:36:03 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.314: +185 -135 lines
Diff to previous 1.314 (colored)

Implement appending to standard man(7) and mdoc(7) macros with .am.

With roff_getstrn(), provide finer control which definitions
can be used for what:
* All definitions can be used for .if d tests and .am appending.
* User-defined for \* expansion, .dei expansion, and macro calling.
* Predefined for \* expansion.
* Standard macros, original or renamed, for macro calling.

Several related improvements while here:
* Do not return string table entries that have explicitly been removed.
* Do not create a rentab entry when trying to rename a non-existent macro.
* Clear an existing rentab entry when the external interface
roff_setstr() is called with its name.
* Avoid trailing blanks in macro lines generated from renamed
and from aliased macros.
* Delete the duplicate __m*_reserved[] tables, just use roff_name[].

Revision 1.314 / (download) - annotate - [select for diffs], Sat Jun 17 23:07:00 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.313: +6 -2 lines
Diff to previous 1.313 (colored)

style message about duplicate RCS ids; inspired by mdoclint

Revision 1.313 / (download) - annotate - [select for diffs], Sat Jun 17 22:43:14 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.312: +19 -1 lines
Diff to previous 1.312 (colored)

style message about missing RCS ids; inspired by mdoclint

Revision 1.312 / (download) - annotate - [select for diffs], Wed Jun 14 22:51:25 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.311: +5 -5 lines
Diff to previous 1.311 (colored)

Naive implementation of the roff(7) .po (page offset) request.

This clearly works when .po is called on the top level, but might
not be sophisticated enough if people call .po inside indentation-changing
contexts, but i haven't seen that in manual pages (yet :).

Revision 1.311 / (download) - annotate - [select for diffs], Wed Jun 14 19:39:18 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.310: +36 -5 lines
Diff to previous 1.310 (colored)

simple implementation of the roff(7) .als (macro alias) request,
sufficient for pages using po4a(1)

Revision 1.310 / (download) - annotate - [select for diffs], Wed Jun 14 14:02:39 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.309: +12 -6 lines
Diff to previous 1.309 (colored)

implement the roff(7) d (macro or string defined) conditional

Revision 1.309 / (download) - annotate - [select for diffs], Wed Jun 14 13:00:31 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.308: +9 -9 lines
Diff to previous 1.308 (colored)

implement roff(7) .rj (right justify) request

Revision 1.308 / (download) - annotate - [select for diffs], Tue Jun 13 13:51:11 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.307: +4 -3 lines
Diff to previous 1.307 (colored)

Explicitly ignore .br, .ce, and .sp inside tbl(7) text blocks.
With the current code structure, they would appear at the wrong
place in the syntax tree, so it is better to not insert them
into the tree at all and issue an UNSUPP message instead.

Revision 1.307 / (download) - annotate - [select for diffs], Thu Jun 8 19:35:51 2017 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.306: +5 -1 lines
Diff to previous 1.306 (colored)

Properly reinitialize roffce_node between parses,
or this may crash with use-after-free in makewhatis(8);
reported by jmc@, thanks!

Revision 1.306 / (download) - annotate - [select for diffs], Wed Jun 7 00:50:34 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.305: +98 -6 lines
Diff to previous 1.305 (colored)

Implement the roff(7) .rn (rename macro or string) request.
Renaming a user-defined macro is very simple: just copy
the definition to the new name and delete the old name.
Renaming high-level macros is a bit tricky: use a dedicated
key-value-table, with non-standard names as keys and standard
names as values.  When a macro is found that is not user-defined,
look it up in the "renamed" table and translate it back to the
standard name before passing it on to the high-level parsers.

Revision 1.305 / (download) - annotate - [select for diffs], Tue Jun 6 15:01:04 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.304: +61 -10 lines
Diff to previous 1.304 (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.304 / (download) - annotate - [select for diffs], Sun Jun 4 22:44:15 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.303: +5 -5 lines
Diff to previous 1.303 (colored)

Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively.
Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf;
instead, implement a proper TERMP_BRNEVER flag.

Revision 1.303 / (download) - annotate - [select for diffs], Sun Jun 4 00:13:15 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.302: +100 -14 lines
Diff to previous 1.302 (colored)

Pure preprocessor implementation of the roff(7) .ec and .eo requests
(escape character control), touching nothing after the preprocessing
stage and keeping even the state variable local to the preprocessor.
Since the escape character is also used for line continuation, this
requires pulling the implementation of line continuation from the
input reader to the preprocessor, which also considerably shortens
the code required for that.

When the escape character is changed, simply let the preprocessor
replace bare by escaped backslashes and instances of the non-standard
escape character with bare backslashes - that's all we need.

Oh, and if anybody dares to use these requests in OpenBSD manuals,
sending a medium-sized pack of axe-murderers after them might be a
worthwhile part of the punishment, but probably insuffient on its own.

Revision 1.302 / (download) - annotate - [select for diffs], Mon May 8 20:33:53 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.301: +8 -2 lines
Diff to previous 1.301 (colored)

Line-breaking roff(7) requests also break man(7) next-line scope.
Considering that real roff implements next-line scope using input
line traps, that isn't all that surprising.
Issue found in the games/xbattle port.

Revision 1.301 / (download) - annotate - [select for diffs], Mon May 8 15:34:54 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.300: +4 -4 lines
Diff to previous 1.300 (colored)

Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).

Revision 1.300 / (download) - annotate - [select for diffs], Sun May 7 17:31:45 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.299: +28 -4 lines
Diff to previous 1.299 (colored)

Basic implementation of the roff(7) .ta (define tab stops) request.
This is the first feature made possible by the parser reorganization.
Improves the formatting of the SYNOPSIS in many Xenocara GL manuals.
Also important for ports, as reported by many, including naddy@.

Revision 1.299 / (download) - annotate - [select for diffs], Fri May 5 15:17:32 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.298: +7 -5 lines
Diff to previous 1.298 (colored)

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

Revision 1.298 / (download) - annotate - [select for diffs], Fri May 5 13:17:55 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.297: +5 -4 lines
Diff to previous 1.297 (colored)

move .ll to the roff modules

Revision 1.297 / (download) - annotate - [select for diffs], Fri May 5 02:06:19 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.296: +33 -3 lines
Diff to previous 1.296 (colored)

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

Revision 1.296 / (download) - annotate - [select for diffs], Thu May 4 17:48:29 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.295: +22 -11 lines
Diff to previous 1.295 (colored)

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

Revision 1.295 / (download) - annotate - [select for diffs], Sat Apr 29 12:45:42 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.294: +300 -306 lines
Diff to previous 1.294 (colored)

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

Revision 1.294 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:18 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.293: +132 -281 lines
Diff to previous 1.293 (colored)

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

Revision 1.293 / (download) - annotate - [select for diffs], Thu Mar 9 15:29:35 2017 UTC (3 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.292: +3 -1 lines
Diff to previous 1.292 (colored)

Fix blunder in previous:  we must keep the line parse buffer
consistent even when aborting the parsing of the line.  That buffer
is not our own, but owned and reused by mparse_buf_r(), read.c.
Returning without cleanup leaked memory and caused write overruns
of the old, typically much smaller buffer in mparse_buf_r().
Promptly noticed by tb@ with afl(1), using MALLOC_OPTIONS=C.

Revision 1.292 / (download) - annotate - [select for diffs], Wed Mar 8 13:18:10 2017 UTC (3 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.291: +16 -3 lines
Diff to previous 1.291 (colored)

prevent infinite recursion while expanding the arguments
of a user-defined macro; issue found by tb@ with afl(1)

Revision 1.291 / (download) - annotate - [select for diffs], Fri Mar 3 13:55:32 2017 UTC (3 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.290: +2 -2 lines
Diff to previous 1.290 (colored)

remove a few redundant conditions that jsg@ found with cppcheck

Revision 1.290 / (download) - annotate - [select for diffs], Fri Mar 3 11:50:49 2017 UTC (3 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13
Changes since 1.289: +2 -2 lines
Diff to previous 1.289 (colored)

Fix previous: do not access the byte before the string if the string
is empty; found by jsg@ with afl(1).

Revision 1.289 / (download) - annotate - [select for diffs], Fri Feb 17 03:03:03 2017 UTC (3 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1
Changes since 1.288: +12 -4 lines
Diff to previous 1.288 (colored)

Fix a read buffer overrun that copied random data from memory into
text nodes when a string passed to deroff() ended in a backslash
and the byte after the terminating NUL was non-NUL, found by tb@
with afl(1).

Invalid bytes so copied with the high bit set could later sometimes
trigger another out of bounds read access to static memory in
roff_strdup(), so add an assertion there to abort safely in case
of similar data corruption.

Revision 1.288 / (download) - annotate - [select for diffs], Thu Jan 12 18:02:20 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.287: +5 -9 lines
Diff to previous 1.287 (colored)

Skipping all escape sequences at the beginning of strings in deroff()
was too aggressive.  There are strings that legitimately begin with
an escape sequence.  Only skip leading escape sequences representing
whitespace.

Bug reported by martijn@.

Revision 1.287 / (download) - annotate - [select for diffs], Tue Jan 10 21:59:47 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.286: +7 -3 lines
Diff to previous 1.286 (colored)

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

Revision 1.286 / (download) - annotate - [select for diffs], Tue Jan 10 14:09:07 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.285: +3 -9 lines
Diff to previous 1.285 (colored)

simplify; NODE_ENDED does no harm in man(7)

Revision 1.285 / (download) - annotate - [select for diffs], Tue Jan 10 13:47:00 2017 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.284: +9 -9 lines
Diff to previous 1.284 (colored)

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

Revision 1.284 / (download) - annotate - [select for diffs], Fri Jan 8 17:48:10 2016 UTC (4 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.283: +1 -4 lines
Diff to previous 1.283 (colored)

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

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

Revision 1.283 / (download) - annotate - [select for diffs], Thu Oct 22 21:54:23 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.282: +3 -3 lines
Diff to previous 1.282 (colored)

move man(7) validation into the dedicated validation phase, too

Revision 1.282 / (download) - annotate - [select for diffs], Wed Oct 21 23:51:11 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.281: +13 -29 lines
Diff to previous 1.281 (colored)

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

Revision 1.281 / (download) - annotate - [select for diffs], Tue Oct 20 02:01:32 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.280: +9 -4 lines
Diff to previous 1.280 (colored)

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

Revision 1.280 / (download) - annotate - [select for diffs], Thu Oct 15 23:35:55 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.279: +1 -4 lines
Diff to previous 1.279 (colored)

Delete two preprocessor constants that are no longer used.
Patch from Michael Reed <m dot reed at mykolab dot com>.

Revision 1.279 / (download) - annotate - [select for diffs], Tue Oct 13 22:59:54 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.278: +3 -5 lines
Diff to previous 1.278 (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.278 / (download) - annotate - [select for diffs], Mon Oct 12 00:08:16 2015 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.277: +1 -25 lines
Diff to previous 1.277 (colored)

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

Revision 1.277 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:20 2015 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.276: +129 -129 lines
Diff to previous 1.276 (colored)

modernize style: "return" is not a function

Revision 1.276 / (download) - annotate - [select for diffs], Sat Sep 26 00:54:04 2015 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.275: +3 -4 lines
Diff to previous 1.275 (colored)

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

Revision 1.275 / (download) - annotate - [select for diffs], Sat Aug 29 23:56:01 2015 UTC (4 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.274: +18 -17 lines
Diff to previous 1.274 (colored)

If we have to reparse the text line because we spring an input line trap,
we must not escape breakable hyphens yet, or mparse_buf_r() in read.c
will complain and replace the escaped hyphens with question marks.
Bug found in ocserv(8) following a report from Kurt Jaeger <pi at FreeBSD>.

Revision 1.274 / (download) - annotate - [select for diffs], Sat Aug 29 21:37:20 2015 UTC (4 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.273: +27 -16 lines
Diff to previous 1.273 (colored)

Implement the escape sequence \\$*, expanding to all arguments
of the current user-defined macro.
This is another missing feature required for ocserv(8).
Problem reported by Kurt Jaeger <pi at FreeBSD>.

Revision 1.273 / (download) - annotate - [select for diffs], Sat Aug 29 20:26:04 2015 UTC (4 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.272: +19 -9 lines
Diff to previous 1.272 (colored)

Minimal implementation of the read-only number register \n(.$
which returns the number of arguments of the current macro.
This is one of the missing features required for ocserv(8).
Problem reported by Kurt Jaeger <pi at FreeBSD>.

Revision 1.272 / (download) - annotate - [select for diffs], Sat Jun 27 13:29:14 2015 UTC (5 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.271: +3 -1 lines
Diff to previous 1.271 (colored)

Ignore blank characters at the beginning of a conditional block,
that is, after "\{".
Issue found by Markus <Waldeck at gmx dot de> in bash(1).

Revision 1.271 / (download) - annotate - [select for diffs], Sun May 31 23:13:22 2015 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.270: +32 -6 lines
Diff to previous 1.270 (colored)

Implement the roff(7) `r' (register exists) conditional.
Missing feature found by Markus <Waldeck at gmx dot de>
in Debian's bash(1) manual page.

Revision 1.270 / (download) - annotate - [select for diffs], Fri May 1 16:02:47 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.269: +2 -1 lines
Diff to previous 1.269 (colored)

Setting the "last" member of struct roff_node was done at an extremely
weird place.  Move it to the obviously correct place.
Surprisingly, this didn't cause any misformatting in the test suite
or in any base system manuals, but i cannot believe the code was
really correct for all conceivable input, and it would be very hard
to verify.  At the very least, it cannot have worked for man(7).

Revision 1.269 / (download) - annotate - [select for diffs], Thu Apr 23 16:17:44 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.268: +47 -1 lines
Diff to previous 1.268 (colored)

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

Revision 1.268 / (download) - annotate - [select for diffs], Sun Apr 19 14:57:38 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.267: +22 -1 lines
Diff to previous 1.267 (colored)

Unify trickier node handling functions.
* man_elem_alloc() -> roff_elem_alloc()
* man_block_alloc() -> roff_block_alloc()
The functions mdoc_elem_alloc() and mdoc_block_alloc() remain for
now because they need to do mdoc(7)-specific argument processing.

Revision 1.267 / (download) - annotate - [select for diffs], Sun Apr 19 14:25:41 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.266: +62 -3 lines
Diff to previous 1.266 (colored)

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

Revision 1.266 / (download) - annotate - [select for diffs], Sun Apr 19 13:50:26 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.265: +205 -7 lines
Diff to previous 1.265 (colored)

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

Revision 1.265 / (download) - annotate - [select for diffs], Sat Apr 18 17:28:36 2015 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.264: +70 -2 lines
Diff to previous 1.264 (colored)

Unify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().
Minus 80 lines of code, no functional change.
Written on the train from Koeln to Wolfsburg returning from p2k15.

Revision 1.264 / (download) - annotate - [select for diffs], Sat Apr 4 13:53:42 2015 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.263: +3 -1 lines
Diff to previous 1.263 (colored)

Don't allow breaking the output line after hyphens following escape
sequences.  Improves tic(1), sxpm(1), and a few Perl manuals.
Quirk found by naddy@ in milter-greylist(8).

Revision 1.263 / (download) - annotate - [select for diffs], Sat Feb 21 14:46:58 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.262: +77 -17 lines
Diff to previous 1.262 (colored)

Escape quotes when expanding macro arguments.
This fixes a bug naddy@ found in plan9/rc(1).

Revision 1.262 / (download) - annotate - [select for diffs], Tue Feb 17 18:09:14 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.261: +12 -3 lines
Diff to previous 1.261 (colored)

Cope with another one of the many kinds of DocBook stupidity:

Instead of just using .br, DocBook sometimes fiddles with the
utterly unportable internal register \n[an-break-flag] that is
only available in the GNU implementation of man(7) and then arms
an input line trap to call the equally unportable internal macro
.an-trap that, in the GNU implementation, inspects that variable;
all the world is GNU, isn't it?

Since naddy@ reports that quite a few ports manuals suffer from
this insanity, let's just translate it to the intended .br.

Et ceterum censeo DocBookem esse delendam.

Revision 1.261 / (download) - annotate - [select for diffs], Tue Feb 17 17:16:52 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.260: +42 -37 lines
Diff to previous 1.260 (colored)

Let .it accept numerical expressions, not just numerical constants.
For .it, ignore scaling units in roff_getnum().
Inside parentheses, skip whitespace after a sign in roff_getnum().
Parse and ignore unary plus in roff_getnum().
As a bonus, get rid of the only call to mandoc_strntoi() in roff.c.

Revision 1.260 / (download) - annotate - [select for diffs], Fri Feb 6 16:06:25 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.259: +6 -5 lines
Diff to previous 1.259 (colored)

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

Revision 1.259 / (download) - annotate - [select for diffs], Fri Jan 30 00:19:46 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.258: +2 -2 lines
Diff to previous 1.258 (colored)

correctly handle table layout lines starting with a dot

Revision 1.258 / (download) - annotate - [select for diffs], Wed Jan 28 17:32:07 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.257: +7 -4 lines
Diff to previous 1.257 (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.257 / (download) - annotate - [select for diffs], Wed Jan 28 15:03:45 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.256: +8 -2 lines
Diff to previous 1.256 (colored)

For now, it can't be helped that mandoc tbl(7) ignores high-level macros,
but stop throwing away their arguments.  This fixes information loss in a
handful of Xenocara manuals, at the price of a small amount of formatting
noise creeping through.

Revision 1.256 / (download) - annotate - [select for diffs], Sat Jan 24 02:41:49 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.255: +3 -2 lines
Diff to previous 1.255 (colored)

Strangely, ignoring the roff(7) .na request was implemented in the man(7)
parser.  Simplify the code by moving it into the roff(7) parser, also
making it work for mdoc(7).

Revision 1.255 / (download) - annotate - [select for diffs], Fri Jan 23 20:18:40 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.254: +4 -4 lines
Diff to previous 1.254 (colored)

While ignoring the .ta (set tab stops) and .ti (temp indent) requests
is sometimes harmless, it often causes seriously ugly output,
so flag these requests as unsupported rather than ignoring them.
Discussed with naddy@.

Revision 1.254 / (download) - annotate - [select for diffs], Fri Jan 23 00:42:00 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.253: +41 -3 lines
Diff to previous 1.253 (colored)

Wonders of roff(7): Integer numbers in numerical expressions can carry
scaling units, and some manuals (e.g. in devel/grcs) actually use that,
so let's support it.  Missing feature reported by naddy@.

Revision 1.253 / (download) - annotate - [select for diffs], Thu Jan 22 22:51:43 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.252: +20 -2 lines
Diff to previous 1.252 (colored)

Slightly improve \w width measurements:
Count special characters with the same width as ASCII characters
and treat all other escape sequences as if they had a width of 0.
Certainly not perfect, but a bit better.
For example, GNU RCS ci(1) needs this; reported by naddy@.

Revision 1.252 / (download) - annotate - [select for diffs], Wed Jan 21 02:16:52 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.251: +10 -11 lines
Diff to previous 1.251 (colored)

pass empty request lines through to tbl(7); sometimes, they end a layout

Revision 1.251 / (download) - annotate - [select for diffs], Tue Jan 20 21:16:51 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.250: +457 -19 lines
Diff to previous 1.250 (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.250 / (download) - annotate - [select for diffs], Fri Jan 16 16:53:49 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.249: +3 -1 lines
Diff to previous 1.249 (colored)

Parse and ignore .IX (generate index entry) macros because pod2man(1)
emits them, by default without defining them, relying on the roff(7)
quirk that undefined macros have no effect.

Revision 1.249 / (download) - annotate - [select for diffs], Wed Jan 14 22:58:16 2015 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.248: +8 -3 lines
Diff to previous 1.248 (colored)

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

Revision 1.248 / (download) - annotate - [select for diffs], Wed Jan 7 12:19:46 2015 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.247: +2 -1 lines
Diff to previous 1.247 (colored)

Bugfix: When the invocation of a user-defined macro follows a roff
conditional request on the same input line, don't skip the first few
bytes of its content.

Revision 1.247 / (download) - annotate - [select for diffs], Thu Jan 1 19:28:49 2015 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.246: +7 -5 lines
Diff to previous 1.246 (colored)

Fix a buffer overrun triggered by a trailing backslash at EOF in
an unclosed conditional body.  If the memory contained the byte
sequence "\}" after the end of the buffer before the next NUL, this
could even write beyond the end of the buffer, specifically '&' to
the location of the '}'.  Found by jsg@ with afl.

Revision 1.246 / (download) - annotate - [select for diffs], Sun Dec 28 14:16:26 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.245: +5 -7 lines
Diff to previous 1.245 (colored)

improve previous: do the size check up front to avoid leaking memory

Revision 1.245 / (download) - annotate - [select for diffs], Thu Dec 25 17:23:32 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.244: +8 -1 lines
Diff to previous 1.244 (colored)

Reduce memory and time consumption on certain malformed input files
by limiting the length of expanded input lines during the
(usually recursive) expansion of user defined strings.
Resource hogging found by jsg@ with afl.

Revision 1.244 / (download) - annotate - [select for diffs], Thu Dec 18 17:43:41 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.243: +8 -2 lines
Diff to previous 1.243 (colored)

Don't let the modulo operator divide by zero.
Found by jsg@ with afl.

Revision 1.243 / (download) - annotate - [select for diffs], Tue Dec 16 23:44:41 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.242: +20 -5 lines
Diff to previous 1.242 (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.242 / (download) - annotate - [select for diffs], Tue Dec 16 03:53:43 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.241: +2 -2 lines
Diff to previous 1.241 (colored)

When a string comparison condition contains no mismatching character
but ends without the final delimiter, the parse point was advanced
one character too far and the invalid pointer returned to the
caller of roff_parseln().  Later use could potentially advance
the pointer even further and maybe even write to it.
Fixing a buffer overrun found by jsg@ with afl (the most severe so far).

Revision 1.241 / (download) - annotate - [select for diffs], Tue Dec 16 01:22:59 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.240: +6 -3 lines
Diff to previous 1.240 (colored)

When a numerical condition errors out after consuming at least one
character of input, treat it as false, do not retry it as a string
comparison condition.  This also fixes a read buffer overrun that
happened when the numerical condition advanced to the end of the
input line before erroring out, found by jsg@ with afl.

Revision 1.240 / (download) - annotate - [select for diffs], Mon Dec 15 23:43:26 2014 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.239: +3 -1 lines
Diff to previous 1.239 (colored)

Empty conditions count as false.
When negated, they still count as false.
Found when investigating crashes jsg@ found with afl.
Not completely fixing the crashes yet.

Revision 1.239 / (download) - annotate - [select for diffs], Wed Nov 19 01:20:25 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.238: +3 -1 lines
Diff to previous 1.238 (colored)

Support the ".if v" conditional operator (vroff mode, always false)
for groff compatibility because pod2man(1) uses it that way.
Weirdly, groff documents it as "for compatibility with other
troff versions" but neither Heirloom nor Plan 9 have it.
Issue reported by giovanni@ via sthen@.

Revision 1.238 / (download) - annotate - [select for diffs], Sat Nov 1 06:03:13 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.237: +165 -167 lines
Diff to previous 1.237 (colored)

Use struct buf in libroff, it is very natural there
and reduces the number of arguments of many functions.
While here, sprinkle some KNF.
No functional change.

Revision 1.237 / (download) - annotate - [select for diffs], Tue Oct 28 17:36:19 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.236: +10 -3 lines
Diff to previous 1.236 (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.236 / (download) - annotate - [select for diffs], Sat Oct 25 15:23:56 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.235: +3 -2 lines
Diff to previous 1.235 (colored)

With the current architecture, we can't support inline equations
inside tables, sorry.  So don't even try to parse tbl(7) blocks for
eqn(7) delimiters.
Broken table layout found in glPixelMap(3) while investigating
a bug report by Theo Buehler <theo at math dot ethz dot ch>.

Revision 1.235 / (download) - annotate - [select for diffs], Sat Oct 25 14:35:37 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.234: +10 -21 lines
Diff to previous 1.234 (colored)

Report arguments to .EQ as an error, and simplify the code:
* drop trivial wrapper function roff_openeqn()
* drop unused first arg of function eqn_alloc()
* drop usused member "name" of struct eqn_node
While here, sync to OpenBSD by killing some trailing blanks.

Revision 1.234 / (download) - annotate - [select for diffs], Mon Oct 20 19:04:45 2014 UTC (5 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.233: +25 -14 lines
Diff to previous 1.233 (colored)

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

Revision 1.233 / (download) - annotate - [select for diffs], Mon Oct 20 15:04:56 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.232: +37 -6 lines
Diff to previous 1.232 (colored)

correctly parse spacing around in-line equations
at the beginning and at the end of input lines;
issue reported by kristaps@

Revision 1.232 / (download) - annotate - [select for diffs], Mon Oct 20 02:33:06 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.231: +4 -12 lines
Diff to previous 1.231 (colored)

correct spacing before inline equations

Revision 1.231 / (download) - annotate - [select for diffs], Thu Oct 16 01:28:38 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.230: +3 -3 lines
Diff to previous 1.230 (colored)

oops, don't escape the first token of inline equations

Revision 1.230 / (download) - annotate - [select for diffs], Thu Oct 16 01:11:20 2014 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.229: +59 -12 lines
Diff to previous 1.229 (colored)

Implement in-line equations, much needed by Xenocara manuals.
Put the steering into the roff parser rather than into the mdoc
parser such that it works for all macro languages and on both text
and macro lines.
Line breaks and blank characters generated before and after in-line
equations are not perfect yet, but let's do one thing at a time.

Revision 1.229 / (download) - annotate - [select for diffs], Sun Sep 7 00:21:53 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.228: +3 -1 lines
Diff to previous 1.228 (colored)

Parse and ignore the .pl (page length) request;
Daniel Levai reports that Slackware Linux uses this.

Revision 1.228 / (download) - annotate - [select for diffs], Sat Sep 6 23:24:32 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.227: +10 -1 lines
Diff to previous 1.227 (colored)

Simplify by handling empty request lines at the one logical place
in the roff parser instead of in three other places in other parsers.
No functional change.

Revision 1.227 / (download) - annotate - [select for diffs], Sat Sep 6 22:39:36 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.226: +19 -3 lines
Diff to previous 1.226 (colored)

Move main format autodetection from the parser dispatcher to the
roff parser where .Dd and .TH are already detected, anyway.  This
improves robustness because it correctly handles whitespace or an
alternate control character before Dd.  In the parser dispatcher,
provide a fallback looking ahead in the input buffer instead of
always assuming man(7).  This corrects autodetection when Dd is
preceded by other macros or macro-like handled requests like .ll.

Triggered by reports from Daniel Levai about issues on Slackware Linux.

Revision 1.226 / (download) - annotate - [select for diffs], Tue Aug 19 16:52:32 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_4, VERSION_1_12
Changes since 1.225: +2 -2 lines
Diff to previous 1.225 (colored)

libroff depends on libmandoc and so libmandoc should be included first;
merge from OpenBSD, patch by daniel@

Revision 1.225 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.224: +3 -3 lines
Diff to previous 1.224 (colored)

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

Revision 1.224 / (download) - annotate - [select for diffs], Fri Aug 1 17:27:44 2014 UTC (6 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.223: +4 -3 lines
Diff to previous 1.223 (colored)

mention requests and macros in more messages

Revision 1.223 / (download) - annotate - [select for diffs], Fri Aug 1 15:08:46 2014 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.222: +18 -17 lines
Diff to previous 1.222 (colored)

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

Revision 1.222 / (download) - annotate - [select for diffs], Wed Jul 30 12:58:21 2014 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.221: +2 -2 lines
Diff to previous 1.221 (colored)

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

Revision 1.221 / (download) - annotate - [select for diffs], Mon Jul 7 21:36:20 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.220: +25 -16 lines
Diff to previous 1.220 (colored)

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

Revision 1.220 / (download) - annotate - [select for diffs], Mon Jul 7 11:35:06 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.219: +56 -34 lines
Diff to previous 1.219 (colored)

implement .dei and .ami

Revision 1.219 / (download) - annotate - [select for diffs], Sun Jul 6 19:09:00 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.218: +13 -13 lines
Diff to previous 1.218 (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.218 / (download) - annotate - [select for diffs], Sun Jul 6 18:46:55 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.217: +15 -8 lines
Diff to previous 1.217 (colored)

Fix expansion of escape sequences with incomplete arguments.
* For \* and \n, discard the incomplete arg, expand to empty string.
* For \B, discard the incomplete arg, expand to the digit 0.
* For \w, use the incomplete arg (behaviour unchanged).

Revision 1.217 / (download) - annotate - [select for diffs], Fri Jul 4 16:12:08 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.216: +5 -3 lines
Diff to previous 1.216 (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.216 / (download) - annotate - [select for diffs], Thu Jul 3 21:23:54 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.215: +5 -3 lines
Diff to previous 1.215 (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.215 / (download) - annotate - [select for diffs], Tue Jul 1 00:32:29 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.214: +4 -2 lines
Diff to previous 1.214 (colored)

The previous commit to this file broke the control flow keywords \{ and \}
when they immediately follow a request or macro name, without intervening
whitespace.  Minimal fix.

The lesson learnt here is that, despite their appearance, \{ and \} are
not escape sequences, so never skip them when parsing for names.

Revision 1.214 / (download) - annotate - [select for diffs], Sun Jun 29 23:26:00 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.213: +16 -17 lines
Diff to previous 1.213 (colored)

Use the freshly improved roff_getname() function
for the main roff request parsing routine, roff_parse().

In request or macro invocations, escape sequences now terminate the
request or macro name; what follows is treated as arguments.  Besides,
the names of user-defined macros can now contain backslashes (eek!).

Revision 1.213 / (download) - annotate - [select for diffs], Sun Jun 29 22:38:47 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.212: +19 -39 lines
Diff to previous 1.212 (colored)

Use the freshly improved roff_getname() function
for the .de parsing routine, roff_block(),
to correctly handle names terminated by escape sequences.
Besides, this saves us 20 lines of code.

Revision 1.212 / (download) - annotate - [select for diffs], Sun Jun 29 22:14:10 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.211: +52 -36 lines
Diff to previous 1.211 (colored)

Major roff_getname() cleanup.
* Return the name even if it is terminated by an escape sequence, not a blank.
* Skip the full escape sequence using mandoc_escape(), not just the first byte.
* Make it non-destructive, return the length instead of writing a '\0'.
* Let .ds and .as cope with the above changes to the internal interface.
* Fix .rm and .rr to accept an escape sequence as the end of a name.
* Fix .nr and .rr to not set/delete a register with an empty name.

Revision 1.211 / (download) - annotate - [select for diffs], Sun Jun 29 21:20:31 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.210: +3 -2 lines
Diff to previous 1.210 (colored)

Bugfix in roff_setstrn():
Do not call strcmp() on an array of char that might not be NUL-terminated.

Revision 1.210 / (download) - annotate - [select for diffs], Wed Jun 25 00:20:19 2014 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.209: +5 -4 lines
Diff to previous 1.209 (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.209 / (download) - annotate - [select for diffs], Wed Apr 23 16:08:33 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.208: +10 -20 lines
Diff to previous 1.208 (colored)

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

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

Revision 1.208 / (download) - annotate - [select for diffs], Sun Apr 20 19:40:13 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.207: +4 -4 lines
Diff to previous 1.207 (colored)

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

Revision 1.207 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:05 2014 UTC (6 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.206: +121 -163 lines
Diff to previous 1.206 (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.206 / (download) - annotate - [select for diffs], Tue Apr 8 01:37:27 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.205: +71 -28 lines
Diff to previous 1.205 (colored)

Fully implement the \B (validate numerical expression) and
partially implement the \w (measure text width) escape sequence
in a way that makes them usable in numerical expressions and in
conditional requests, similar to how \n (interpolate number register)
and \* (expand user-defined string) are implemented.

This lets mandoc(1) handle the baroque low-level roff code
found at the beginning of the ggrep(1) manual.
Thanks to pascal@ for the report.

Revision 1.205 / (download) - annotate - [select for diffs], Mon Apr 7 21:00:08 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.204: +45 -37 lines
Diff to previous 1.204 (colored)

We already supported (outer) user-defined strings containing references
to other (inner) user-defined strings in their values, such that the inner
ones get expanded at expansion time of the outer ones (delayed evaluation).
Now we also support specifying the name of an (outer) user-defined
string to expand using the expanded values of some other (inner)
user-defined strings (indirect reference).

Revision 1.204 / (download) - annotate - [select for diffs], Mon Apr 7 15:07:13 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.203: +208 -58 lines
Diff to previous 1.203 (colored)

Almost complete implementation of roff(7) numerical expressions.
Support all binary operators except ';' (scale conversion).
Fully support chained operations and nested parentheses.
Use this for the .nr, .if, and .ie requests.
While here, fix parsing of integer numbers in roff_getnum().

Revision 1.203 / (download) - annotate - [select for diffs], Sat Apr 5 20:34:57 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.202: +29 -1 lines
Diff to previous 1.202 (colored)

Implement the roff(7) .rr (remove register) request.
As reported by sthen@, the perl-5.18 pod2man(1) preamble
thinks cool kids use that in manuals.  I hope *you* know better.

Revision 1.202 / (download) - annotate - [select for diffs], Sun Mar 23 12:11:18 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.201: +2 -6 lines
Diff to previous 1.201 (colored)

avoid repetitive code for asprintf error handling

Revision 1.201 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.200: +2 -1 lines
Diff to previous 1.200 (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.200 / (download) - annotate - [select for diffs], Thu Mar 20 02:57:28 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.199: +17 -15 lines
Diff to previous 1.199 (colored)

Remove currently unimplemented macros from the lists of used-defined
macros to be cleared during .Dd and .TH because clearing them at that
point defeats the purpose of backup implementations provided in the
manual page itself, some of which _do_ work with mandoc(1).
While here, add the new .%C macro to the list to be cleared.

Revision 1.199 / (download) - annotate - [select for diffs], Wed Mar 19 21:51:20 2014 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.198: +6 -8 lines
Diff to previous 1.198 (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.198 / (download) - annotate - [select for diffs], Sat Mar 8 04:43:54 2014 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.197: +87 -56 lines
Diff to previous 1.197 (colored)

Improve .if/.ie condition handling.
* Support string comparisons.
* Support negation not only for numerical, but for all conditions.
* Switch the `o' condition from false to true.
* Handle the `c', `d', and `r' conditions as false for now.
* Use int for boolean data instead of rolling our own "enum roffrule";
needed such that we can use the standard ! and == operators.

Havard Eidnes reported via the NetBSD bug tracking system that some
Tcl*(3) manuals need this, and Thomas Klausner <wiz at NetBSD>
forwarded the report to me.  This doesn't make the crazy Tcl*(3)
macrology maze happy yet, but brings us a bit closer.

Revision 1.197 / (download) - annotate - [select for diffs], Fri Mar 7 18:37:37 2014 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.196: +13 -12 lines
Diff to previous 1.196 (colored)

In roff_cond_sub(), make sure that the incorrect input sequence `\\}',
when found on a macro line, does not close a conditional block.
The companion function roff_cond_text() already did this correctly,
but make the code more readable without functional change.
While here, report the correct column number in related error messages.

Revision 1.196 / (download) - annotate - [select for diffs], Fri Mar 7 18:30:11 2014 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.195: +11 -15 lines
Diff to previous 1.195 (colored)

Even on macro lines, \} must not cause whitespace.

Revision 1.195 / (download) - annotate - [select for diffs], Fri Mar 7 02:22:05 2014 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.194: +13 -26 lines
Diff to previous 1.194 (colored)

Three bugfixes related to the closing of conditional blocks:
1. Handle more than one `\}' on macro lines, as it was already done
for text lines.
2. Do not treat `\}' as a macro invocation after a dot at the beginning
of a line.  That allows more than one `\}' to work on lines starting
with `.\}'.  It also simplifies the code.
3. Do not complain about characters following `\}'.  Those are not lost,
but handled normally both on text and macro lines.

Revision 1.194 / (download) - annotate - [select for diffs], Fri Feb 14 23:24:26 2014 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.193: +3 -1 lines
Diff to previous 1.193 (colored)

Parse and ignore the roff(7) .ce request (center some lines).

We even parse and ignore the .ad request (adjustment mode),
and it doesn't make sense to more prominently warn about
temporary than about permanent adjustment changes.

Request found by naddy@ in xloadimage(1) and by juanfra@ in racket(1).

Revision 1.193 / (download) - annotate - [select for diffs], Fri Feb 14 23:05:20 2014 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.192: +16 -14 lines
Diff to previous 1.192 (colored)

Implement the roff(7) .as request (append to user-defined string).
Missing feature found by jca@ in ratpoison(1).
The ratpoison(1) manual still doesn't work because it uses .shift
and .while, too (apparently, ratpoison is so complex that it
needs a Turing-complete language to even format its manual :-).

Written at Christchurch International Airport.

Revision 1.192 / (download) - annotate - [select for diffs], Fri Feb 14 22:27:41 2014 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.191: +44 -1 lines
Diff to previous 1.191 (colored)

Handle some predefined read-only number registers, e.g. .H and .V.
In particular, this improves handling of the pod2man(1) preamble;
for examples of the effect, see some author names in perlthrtut(1).

Missing feature reported by Andreas Voegele <mail at andreasvoegele dot com>
more than two years ago.  Written at Christchurch International Airport.

Revision 1.191 / (download) - annotate - [select for diffs], Mon Jan 6 23:46:07 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.190: +7 -10 lines
Diff to previous 1.190 (colored)

Gprof(1) is fun.  You should use it more often.

Another 10% speedup for mandocdb(8) -Q, and even 3% without -Q.
With -Q, we are now at 41% of the time required by makewhatis(8).

Do not copy predefined strings into the dynamic string table, just
leave them in their own static table and use that one as a fallback
at lookup time.  This saves us copying and deleting them for each manual.
No functional change.

Revision 1.190 / (download) - annotate - [select for diffs], Mon Jan 6 21:34:31 2014 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.189: +7 -5 lines
Diff to previous 1.189 (colored)

Another 25% speedup for mandocdb(8) -Q mode, found with gprof(1).
For /usr/share/man, we only need 56% of the time of makewhatis(8) now.

In groff, user-defined macros clashing with mdoc(7) or man(7)
standard macros are cleared when parsing the .Dd or .TH macro,
respectively.  Of course, we continue doing that in standard mode
to assure full groff bug compatibility.

However, in -Q mode, full groff bug compatibility makes no sense
when it's unreasonably expensive, so skip this step in -Q mode.
Real-world manuals hardly ever redefine standard macros,
that's terrible style, and if they do, it's pointless to do so
before .Dd or .TH because it has no effect.  Even if someone does,
it's extremely unlikely to break mandocdb(8) -Q parsing because we
abort the parse sequence after the NAME section, anyway.

So if you manually redefine .Sh, .Nm, .Nd, or .SH in a way that doesn't
work at all and rely on .Dd or .TH to fix it up for you, your broken
manual will no longer get a perfect apropos(1) entry until you re-run
mandocdb(8) without -Q.  It think that consequence is acceptable
in order to get a 25% speedup for everyone else.

Revision 1.189 / (download) - annotate - [select for diffs], Mon Dec 30 18:44:06 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3
Changes since 1.188: +2 -3 lines
Diff to previous 1.188 (colored)

Oops, missed one:
Remove duplicate const specifier from a call to mandoc_escape().
Found by Thomas Klausner <wiz at NetBSD dot org> using clang.
No functional change.

Revision 1.188 / (download) - annotate - [select for diffs], Wed Dec 25 00:50:05 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.187: +2 -2 lines
Diff to previous 1.187 (colored)

s/[Nn]ull/NUL/ in comments where appropriate;
suggested by Thomas Klausner <wiz @ NetBSD dot org>.

Revision 1.187 / (download) - annotate - [select for diffs], Sun Dec 15 21:23:52 2013 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.186: +18 -5 lines
Diff to previous 1.186 (colored)

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

Reported by bentley@ on discuss@.

Revision 1.186 / (download) - annotate - [select for diffs], Tue Oct 22 20:38:00 2013 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.185: +3 -1 lines
Diff to previous 1.185 (colored)

Parse and ignore .hw (hyphenation points in words); this is safe because
we don't do hyphenation anyway, so there is no point in throwing an ERROR
when encountering .hw.
Real-world usage of the request found by naddy@ in sysutils/dwdiff(1).

Revision 1.185 / (download) - annotate - [select for diffs], Mon Oct 14 01:43:14 2013 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.184: +3 -1 lines
Diff to previous 1.184 (colored)

Parse and ignore the .fam (font family) request.
Fixes irunner(1) in devel/ipython and uim-xim(1) in inputmethods/uim.
Thanks to naddy@ for bringing these to my attention.

Revision 1.184 / (download) - annotate - [select for diffs], Sat Oct 5 22:25:12 2013 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.183: +92 -4 lines
Diff to previous 1.183 (colored)

Support simple numerical conditions.

Original code from Christos Zoulas, NetBSD rev. 1.11-1.13, April 3, 2013.

I tweaked the code as follows:
* In roff_getnum(), don't skip a minus that isn't followed by a digit.
* In roff_getop(), do not handle "!=", groff doesn't support it either.
* In roff_evalcond(), treat negative numbers as false, like groff.
Besides, make the interfaces of roff_getnum() and roff_getop() more
similar to each other and simplify parts of the code a bit.

Revision 1.183 / (download) - annotate - [select for diffs], Sat Oct 5 22:21:20 2013 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.182: +3 -3 lines
Diff to previous 1.182 (colored)

ROFFRULE_ALLOW = 0, ROFFRULE_DENY = 1 was confusing,
so exchange the two entries in enum roffrule; no functional change;
from Christos Zoulas, NetBSD rev. 1.11, April 4, 2013.

Revision 1.182 / (download) - annotate - [select for diffs], Sat Oct 5 22:19:10 2013 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.181: +6 -11 lines
Diff to previous 1.181 (colored)

Avoid code duplication in roff_parseln() as suggested by
Christos Zoulas in NetBSD rev. 1.11;
i'm even going a step further and making this yet a bit shorter.
No functional change.

Revision 1.181 / (download) - annotate - [select for diffs], Sat Oct 5 22:15:03 2013 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.180: +53 -32 lines
Diff to previous 1.180 (colored)

Expand references to number registers in exactly the same way as
references to user-defined strings.  While here, make number registers
signed int, like in groff.

Inspired by NetBSD roff.c rev. 1.8 and read.c rev. 1.7
written by Christos Zoulas on March 21, 2013, but implemented
in a completely different way, without hacking into read.c,
where this functionality really doesn't belong.

Revision 1.180 / (download) - annotate - [select for diffs], Sat Oct 5 22:08:12 2013 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.179: +57 -28 lines
Diff to previous 1.179 (colored)

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

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

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

Revision 1.179 / (download) - annotate - [select for diffs], Sat Oct 5 20:30:05 2013 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.178: +2 -2 lines
Diff to previous 1.178 (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.178 / (download) - annotate - [select for diffs], Sat Jul 13 12:52:07 2013 UTC (7 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_2
Changes since 1.177: +58 -11 lines
Diff to previous 1.177 (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.177 / (download) - annotate - [select for diffs], Thu Jun 27 09:49:47 2013 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.176: +32 -44 lines
Diff to previous 1.176 (colored)

Parse for the closing delimiter `\}' for conditionals
even when the conditional evaluated to false.

While here, reshuffle the code to reduce indentation and make it
more readable; that way, we can even trim down the comments because
it becomes obvious what the code does.

Found in zipinfo(1) - thanks to espie@ and naddy@
for making me look at that manual page.

Revision 1.176 / (download) - annotate - [select for diffs], Fri May 31 22:08:09 2013 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.175: +10 -10 lines
Diff to previous 1.175 (colored)

More cleanup: Consistently use the name "struct tbl_node *tbl"
that is already used almost everywhere instead of gratuitiously
inventing different names at four places.  No functional change.

Revision 1.175 / (download) - annotate - [select for diffs], Mon Nov 19 17:57:23 2012 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.174: +68 -3 lines
Diff to previous 1.174 (colored)

In groff, trying to redefine standard man(7) macros before .TH has no effect;
after .TH, it works.  Trying to redefine standard mdoc(7) macros before .Dd
works when calling groff with the -mdoc command line option, but does not
when calling groff with -mandoc; after .Dd, it always works.

Arguably, one might call that buggy behaviour in groff, but it is very
unlikely that anybody will change groff in this respect (certainly, i'm
not volunteering).  So let's be bug-compatible.

This fixes the vertical spacing in sox(1).

Merging from OpenBSD libmandoc.h 1.18, read.c 1.8, roff.c 1.47, June 2, 2012.

Revision 1.174 / (download) - annotate - [select for diffs], Tue Jun 12 20:21:04 2012 UTC (8 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.173: +59 -2 lines
Diff to previous 1.173 (colored)

Add `cc' support.
This was reported by espie@ and in the TODO.
Caveat: `cc' has buggy behaviour when invoked in groff(1) and followed
by a line-breaking control character macro, e.g., in a -man doc,

  .cc |
  .B foo
  'B foo
  |cc
  'B foo

will cause groff(1) to behave properly for `.B' but inline the macro
definition for `B' when invoked with the line-breaking macro.

Revision 1.173 / (download) - annotate - [select for diffs], Thu May 31 22:41:19 2012 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.172: +25 -34 lines
Diff to previous 1.172 (colored)

Fix blank line handling in .if.

In particular, two cases were wrong:
- single-line .if with trailing whitespace gave no blank line
- multiline .if with \{ but without \{\ gave no blank line

While here, simplify roff_cond() by partially reordering the code.

"good one" kristaps@

Revision 1.172 / (download) - annotate - [select for diffs], Mon Oct 24 21:41:45 2011 UTC (8 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.171: +13 -9 lines
Diff to previous 1.171 (colored)

Handle infinite recursion the same way as groff:
When string expansion exceeds the recursion limit, drop the whole
input line, instead of leaving just the string unexpanded.

ok kristaps@

Revision 1.171 / (download) - annotate - [select for diffs], Mon Sep 19 08:34:45 2011 UTC (8 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_0
Changes since 1.170: +3 -10 lines
Diff to previous 1.170 (colored)

Breaking the line at a hyphen is only allowed if the hyphen
is both preceded and followed by an alphabetic character.
ok kristaps@

Revision 1.170 / (download) - annotate - [select for diffs], Sun Sep 18 23:51:31 2011 UTC (8 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.169: +14 -3 lines
Diff to previous 1.169 (colored)

Fix another regression introduced in 1.11.7:
If a string is defined in terms of itself, the REPARSE_LIMIT in read.c
used to break the cycle.  This no longer works since all the work
is now done in the function roff_res(), looping indefinitely.

Make this loop finite by arbitrarily limiting the number of times one
string may be expanded; when that limit is reached, leave the remaining
string references unexpanded.

This changes behaviour compared to 1.11.5, where the whole line would
have been dropped.  The new behaviour is better because it loses less
information.  We don't want to imitate groff-1.20.1 behaviour anyway
because groff aborts parsing of the whole file.

ok kristaps@

Revision 1.169 / (download) - annotate - [select for diffs], Sun Sep 18 14:14:15 2011 UTC (8 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.168: +2 -2 lines
Diff to previous 1.168 (colored)

forgotten Copyright bumps; no code change
found while syncing to OpenBSD

Revision 1.168 / (download) - annotate - [select for diffs], Tue Aug 16 12:30:12 2011 UTC (8 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_7, VERSION_1_11_6
Changes since 1.167: +1 -8 lines
Diff to previous 1.167 (colored)

Lint check.

Revision 1.167 / (download) - annotate - [select for diffs], Fri Jul 29 10:16:59 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.166: +72 -43 lines
Diff to previous 1.166 (colored)

Use a character-table for quick per-character substitution in `tr'.  As
suggested by joerg@.

Revision 1.166 / (download) - annotate - [select for diffs], Fri Jul 29 09:19:48 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.165: +51 -44 lines
Diff to previous 1.165 (colored)

Renamed roffstr as roffkv (key-value) and split out char/size_t into
roffstr.

Revision 1.165 / (download) - annotate - [select for diffs], Thu Jul 28 14:53:22 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.164: +3 -2 lines
Diff to previous 1.164 (colored)

Fix border condition in `tr' grokking arguments.

Revision 1.164 / (download) - annotate - [select for diffs], Thu Jul 28 14:17:11 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.163: +177 -22 lines
Diff to previous 1.163 (colored)

An implementation of `tr'.  This routes allocations of TEXT nodes
through libroff, which does the appropriate translations of `tr'.  This
is SLOW: it uses the backend of `ds' and `de', which is a simple linear
list.  However, unlike `ds' and `de', it iterates over EACH CHARACTER of
the entire file looking for replacements.

Revision 1.163 / (download) - annotate - [select for diffs], Wed Jul 27 20:55:28 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.162: +4 -4 lines
Diff to previous 1.162 (colored)

Correctly set valsz this time.

Revision 1.162 / (download) - annotate - [select for diffs], Wed Jul 27 17:25:30 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.161: +10 -3 lines
Diff to previous 1.161 (colored)

Have roffstr keep track of string lengths.

Revision 1.161 / (download) - annotate - [select for diffs], Wed Jul 27 14:58:28 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.160: +2 -2 lines
Diff to previous 1.160 (colored)

Fix a memory-offset bug that was hell tracking down.

Revision 1.160 / (download) - annotate - [select for diffs], Wed Jul 27 14:23:27 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.159: +19 -19 lines
Diff to previous 1.159 (colored)

Rename some terms (incremental part of a larger set of check-ins).

Revision 1.159 / (download) - annotate - [select for diffs], Wed Jul 27 14:19:26 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.158: +6 -4 lines
Diff to previous 1.158 (colored)

Fix hyphen-replacement loop.

Revision 1.158 / (download) - annotate - [select for diffs], Wed Jul 27 13:47:26 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.157: +4 -2 lines
Diff to previous 1.157 (colored)

Critical fix to avoid looping forever.

Revision 1.157 / (download) - annotate - [select for diffs], Wed Jul 27 13:42:27 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.156: +6 -5 lines
Diff to previous 1.156 (colored)

Clean up roff_getstrn() function.

Revision 1.156 / (download) - annotate - [select for diffs], Wed Jul 27 12:41:02 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.155: +7 -3 lines
Diff to previous 1.155 (colored)

Disable in-line eqn processing for a bit.

Revision 1.155 / (download) - annotate - [select for diffs], Wed Jul 27 07:32:26 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.154: +32 -21 lines
Diff to previous 1.154 (colored)

Move mandoc_hyph() into roff_parsetext() as a single conditional.  While
here, do some function renames for clarity and make all function
prototypes be in one place.

Revision 1.154 / (download) - annotate - [select for diffs], Wed Jul 27 07:09:41 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.153: +47 -16 lines
Diff to previous 1.153 (colored)

First, roff_res() has no need to invoke ROFF_RERUN: since it's executed
before any other roff processing occurs, it's Ok to just let it do its
thing and pass through.  Also, make sure this function is ALWAYS called,
not just when first_string is defined.

Second, add a new function, roff_parsetext(), that post-processes
non-macro lines.  This, for the time being, amounts to detecting soft
hyphens.  This fixes a long-standing bug in that -man now has proper
hyphen breaking!

Revision 1.153 / (download) - annotate - [select for diffs], Tue Jul 26 14:24:06 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.152: +17 -11 lines
Diff to previous 1.152 (colored)

Use correct column of warning messages and make sure this function is
run even when `first_string' isn't defined.

Revision 1.152 / (download) - annotate - [select for diffs], Tue Jul 26 14:09:01 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.151: +14 -2 lines
Diff to previous 1.151 (colored)

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

Revision 1.151 / (download) - annotate - [select for diffs], Mon Jul 25 15:37:00 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.150: +38 -13 lines
Diff to previous 1.150 (colored)

Implement the first steps of equation parsing from within libmdoc.
This consists of a shim around the text parser that calls out to libroff
if equation components exist on the line.  Right now this will do
nothing, as the equation delimiter always returns nil.

Revision 1.150 / (download) - annotate - [select for diffs], Sat Jul 23 18:41:18 2011 UTC (9 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_5
Changes since 1.149: +2 -2 lines
Diff to previous 1.149 (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.149 / (download) - annotate - [select for diffs], Thu Jul 21 15:21:13 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.148: +2 -2 lines
Diff to previous 1.148 (colored)

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

Revision 1.148 / (download) - annotate - [select for diffs], Thu Jul 21 10:24:35 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.147: +2 -2 lines
Diff to previous 1.147 (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.147 / (download) - annotate - [select for diffs], Mon Jul 18 07:46:41 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.146: +38 -9 lines
Diff to previous 1.146 (colored)

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

Revision 1.146 / (download) - annotate - [select for diffs], Sun Jul 17 12:13:37 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.145: +4 -4 lines
Diff to previous 1.145 (colored)

Add initial `define' support for eqn(7).
This works by iterating over a simple list.  It's a slow, auditable
early implementation.  Data is read (the reading function will be
reused) then parsed, then the line re-run if remaining stuff exists.
Note this function isn't the same as mandoc_getarg(), as eqn(7) uses a
different system for reading quoted strings.
This doesn't actually use the defines.

Revision 1.145 / (download) - annotate - [select for diffs], Tue Jul 12 21:32:43 2011 UTC (9 years ago) by kristaps
Branch: MAIN
Changes since 1.144: +2 -2 lines
Diff to previous 1.144 (colored)

Have equation be allocated with mparse.  Will be needed for logging of
messages.

Revision 1.144 / (download) - annotate - [select for diffs], Fri Jul 8 09:28:33 2011 UTC (9 years, 1 month ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_4
Changes since 1.143: +26 -4 lines
Diff to previous 1.143 (colored)

Fix two issues: the first, where a `.\}' wasn't being interpreted as a
proper macro in some conditions, resulting in strange parse errors.  The
second, where `\}' was being re-written as `\&'.  Instead, we re-write
this as two spaces OR nothing at all, if at the end of line.  This isn't
exactly what groff does (who knows...) but is a much safer and better
way than how I was doing it before.

Revision 1.143 / (download) - annotate - [select for diffs], Thu Jun 30 08:05:13 2011 UTC (9 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.142: +5 -1 lines
Diff to previous 1.142 (colored)

Ouch: predefined strings moved into roff.c weren't being reinitalised
after the first parse.  Do this, but note there are more efficient ways
just waiting for a table of macros.

Revision 1.142 / (download) - annotate - [select for diffs], Thu May 26 11:58:25 2011 UTC (9 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_3
Changes since 1.141: +7 -6 lines
Diff to previous 1.141 (colored)

If a predefined string is missing, emit a warning and make it an empty
string instead of passing it along to libmdoc/libman (where it'll be
printed verbatim, now).  This is what groff seems to do, too (of course
without a warning).

Revision 1.141 / (download) - annotate - [select for diffs], Tue May 24 21:18:06 2011 UTC (9 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.140: +22 -3 lines
Diff to previous 1.140 (colored)

Most important move in getting predefined strings entirely contained
within roff.c.  These are now grokked from a table in the roff
allocation routine and rest in the newly-created predefs.in (for
consistency with chars.in).  This is a first implementation and will
likely be optimised along with the ds/de lookup table itself.

This allows mandoc-defined predefined strings to be correctly removed or
whatnot; earlier they couldn't.  What will follow is the stripping-away
of all predefined-string crud in the other parts of the system.

Revision 1.140 / (download) - annotate - [select for diffs], Tue May 24 15:22:14 2011 UTC (9 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.139: +12 -26 lines
Diff to previous 1.139 (colored)

Have conditional closure for both text and macro lines call through to
ccond().  Fix the text handler to behave like the macro handler
regarding escaped \}.  Make \} actually become a zero-width space, too,
and clean up the documentation in this regard.

Revision 1.139 / (download) - annotate - [select for diffs], Tue May 24 14:00:39 2011 UTC (9 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.138: +24 -10 lines
Diff to previous 1.138 (colored)

Fix a TODO to the effect that `.if n \{\ foo .br \}' was failing due to
the `\}' not being directly after the `.br'.  Now we check for `\}' in
arbitrary parts of the line, and account for if it's escaped in funny
ways.

This behaviour diverges somewhat from groff in that the text at and
following the `\}' is lost, while groff keeps it (sort-of).  I'll add a
COMPATIBILITY note to this effect.

Revision 1.138 / (download) - annotate - [select for diffs], Sat May 14 16:06:08 2011 UTC (9 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.137: +6 -28 lines
Diff to previous 1.137 (colored)

Move roff.c's strtol into libmandoc.h for use by other parts of the code
(which will come).

Revision 1.137 / (download) - annotate - [select for diffs], Sun Apr 24 23:51:17 2011 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_11_2
Changes since 1.136: +2 -3 lines
Diff to previous 1.136 (colored)

User defined macros may invoke high-level macros.
The latter got lost due to a regression in rev. 1.130.
ok kristaps@

Revision 1.136 / (download) - annotate - [select for diffs], Tue Apr 19 16:38:48 2011 UTC (9 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.135: +2 -2 lines
Diff to previous 1.135 (colored)

Clean up parsing of delimiters in -mdoc.  First, remove the "dowarn"
variable from mandoc_getarg() so that it prints the warning every time.
Then, remove the warning from args_checkpunct().  This way, warnings
are being posted at the correct time.  This makes the flag argument to
mdoc_zargs() superfluous, so make it be zero when it's invoked.  Finally,
move the args() flags into mdoc_argv.c and make them enums.

Revision 1.135 / (download) - annotate - [select for diffs], Sun Apr 17 09:08:19 2011 UTC (9 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.134: +2 -2 lines
Diff to previous 1.134 (colored)

Get mdoc_argv.c ready to use [some of] mandoc_getarg() by giving said
function a parameter to suppress warnings.

Revision 1.134 / (download) - annotate - [select for diffs], Wed Apr 13 16:26:11 2011 UTC (9 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.133: +25 -34 lines
Diff to previous 1.133 (colored)

Check in fix to roff conditional if/else stack running out of space.
This transforms the stack pop to occur prior to body execution, instead
of afterward.  Floated to tech@ without response, but it makes sense
that this is alright and doesn't cause problems during extensive
testing.

Revision 1.133 / (download) - annotate - [select for diffs], Wed Apr 13 10:01:27 2011 UTC (9 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.132: +33 -24 lines
Diff to previous 1.132 (colored)

Back out commit to roff.c that needs to go in on its own.

Revision 1.132 / (download) - annotate - [select for diffs], Wed Apr 13 09:57:41 2011 UTC (9 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.131: +25 -34 lines
Diff to previous 1.131 (colored)

Remove TODO from prior commit of lifting warnings from `Sh', `Ss', `SH',
and `SS' bodies.

Revision 1.131 / (download) - annotate - [select for diffs], Tue Apr 5 22:22:33 2011 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +4 -6 lines
Diff to previous 1.130 (colored)

On .de macro lines, after the macro name, space and tab are equivalent.
Bug reported by Tristan dot LeGuern at gmail dot com in fvwm2(1).
tweaks and ok kristaps@; earlier version looked good to espie@ as well

Revision 1.130 / (download) - annotate - [select for diffs], Tue Mar 29 09:00:48 2011 UTC (9 years, 4 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_1
Changes since 1.129: +22 -30 lines
Diff to previous 1.129 (colored)

Carefully let mandoc_getcontrol() handle libroff's detection of a macro
line.  Note that we now properly ignore \.", which earlier would have
been pushed through macro detection.  This required attention to all
entries of roff_parse().

This removes a TODO by schwarze@ to the effect that \. can be a control
character, which is now handled in mandoc_getcontrol().

Revision 1.129 / (download) - annotate - [select for diffs], Tue Mar 22 09:50:11 2011 UTC (9 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.128: +1 -2 lines
Diff to previous 1.128 (colored)

Step 2: blow away roff.h, as all of its functions have been moved into
libmandoc.h and there's nothing left.

Revision 1.128 / (download) - annotate - [select for diffs], Sun Mar 20 16:02:05 2011 UTC (9 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.127: +29 -31 lines
Diff to previous 1.127 (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.127 / (download) - annotate - [select for diffs], Tue Mar 15 16:23:51 2011 UTC (9 years, 4 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_10
Changes since 1.126: +5 -5 lines
Diff to previous 1.126 (colored)

Make lint shut up a little bit.

Revision 1.126 / (download) - annotate - [select for diffs], Wed Feb 9 09:05:52 2011 UTC (9 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.125: +2 -2 lines
Diff to previous 1.125 (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.125 / (download) - annotate - [select for diffs], Sun Feb 6 20:36:36 2011 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.124: +73 -10 lines
Diff to previous 1.124 (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.124 / (download) - annotate - [select for diffs], Tue Jan 25 01:12:02 2011 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +7 -1 lines
Diff to previous 1.123 (colored)

Ignore .ns (no-space mode), .ps (change point size), .ta (tab control)
for now.  All of these just cause a bit too much or too little
whitespace, but no serious formatting problems.
Triggered by reports from brad@.

Revision 1.123 / (download) - annotate - [select for diffs], Sat Jan 22 13:16:02 2011 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +6 -1 lines
Diff to previous 1.122 (colored)

When finding the roff .it request (line trap),
make it clear that you cannot use mandoc to format that page (yet).
Triggered by a report from brad@, ok kristaps@.

Revision 1.122 / (download) - annotate - [select for diffs], Sun Jan 16 04:00:34 2011 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.121: +19 -12 lines
Diff to previous 1.121 (colored)

Implement the roff .rm request (remove macro).
Using the new roff_getname() function, this is really simple.
Breaks mandoc of the habit of reporting an error in each pod2man(1) preamble.
Reminded by a report from brad@; ok kristaps@.

Revision 1.121 / (download) - annotate - [select for diffs], Tue Jan 11 00:11:45 2011 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +46 -39 lines
Diff to previous 1.120 (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.120 / (download) - annotate - [select for diffs], Mon Jan 3 23:24:16 2011 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_10_9
Changes since 1.119: +2 -2 lines
Diff to previous 1.119 (colored)

Calling a macro with fewer arguments than it is defined with is OK;
the remaining ones default to the empty string, not to NULL.
Regression reported and fix tested by kristaps@.

Revision 1.119 / (download) - annotate - [select for diffs], Mon Jan 3 22:42:37 2011 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +7 -44 lines
Diff to previous 1.118 (colored)

Unify roff macro argument parsing (in roff.c, roff_userdef()) and man macro
argument parsing (in man_argv.c, man_args()), both having different bugs,
to use one common macro argument parser (in mandoc.c, mandoc_getarg()),
because from the point of view of roff, man macros are just roff macros,
hence their arguments are parsed in exactly the same way.

While doing so, fix these bugs:
 * Escaped blanks (i.e. those preceded by an odd number of backslashes)
   were mishandled as argument separators in unquoted arguments to
   user-defined roff macros.
 * Unescaped blanks preceded by an even number of backslashes were not
   recognized as argument separators in unquoted arguments to man macros.
 * Escaped backslashes (i.e. pairs of backslashes) were not reduced
   to single backslashes both in unquoted and quoted arguments both
   to user-defined roff macros and to man macros.
 * Escaped quotes (i.e. pairs of quotes inside quoted arguments) were
   not reduced to single quotes in man macros.

OK kristaps@

Note that mdoc macro argument parsing is yet another beast for no good
reason and is probably afflicted by similar bugs.  But i don't attempt
to fix that right now because it is intricately entangled with lots of
unrelated high-level mdoc(7) functionality, like delimiter handling and
column list phrase handling.  Disentagling that would waste too much
time now.

Revision 1.118 / (download) - annotate - [select for diffs], Sun Jan 2 10:10:57 2011 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.117: +6 -6 lines
Diff to previous 1.117 (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.117 / (download) - annotate - [select for diffs], Sat Jan 1 16:18:39 2011 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.116: +9 -4 lines
Diff to previous 1.116 (colored)

More checks for proper table exit.

Revision 1.116 / (download) - annotate - [select for diffs], Sat Jan 1 16:10:40 2011 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.115: +2 -2 lines
Diff to previous 1.115 (colored)

Raise an error if a table is closed without data.

Revision 1.115 / (download) - annotate - [select for diffs], Sat Jan 1 15:45:18 2011 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.114: +7 -3 lines
Diff to previous 1.114 (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.114 / (download) - annotate - [select for diffs], Fri Dec 31 18:19:43 2010 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.113: +8 -1 lines
Diff to previous 1.113 (colored)

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

Revision 1.113 / (download) - annotate - [select for diffs], Fri Dec 31 14:52:41 2010 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.112: +21 -11 lines
Diff to previous 1.112 (colored)

Put parsed tables into a queue that's cleared at the end of parsing.
This completes the parsing phase of the new tbl implementation.

Revision 1.112 / (download) - annotate - [select for diffs], Wed Dec 29 14:53:31 2010 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.111: +17 -1 lines
Diff to previous 1.111 (colored)

Add handling for `T&', which restarts a table except for its options.

Revision 1.111 / (download) - annotate - [select for diffs], Wed Dec 29 01:16:57 2010 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.110: +2 -2 lines
Diff to previous 1.110 (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.110 / (download) - annotate - [select for diffs], Tue Dec 28 10:59:07 2010 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.109: +3 -2 lines
Diff to previous 1.109 (colored)

Temporarily remove check for r->tbl at end of parse since we need the
original parse point to generate a useful error message.

Revision 1.109 / (download) - annotate - [select for diffs], Tue Dec 28 10:51:03 2010 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.108: +66 -58 lines
Diff to previous 1.108 (colored)

Initial tbl framework.  Parse point is in libroff, which keeps a
reference to a current tbl parse and routes ALL text into the tbl parse
after stripping reserved words and making block-level pre-processing
(e.g., `ig').  This is consistent with an analysis of embedded `TS/TE'
in manuals with sprinkled -mdoc, roff, and -man macros.

Fact of a parse is exposed to main.c by a return value (ROFF_TBL), which
will trigger main.c to add a foreign parsed body to the -mdoc or -man
parse stream.  This interface isn't in yet, but will follow the
parse-text functions in both libraries.  I put this login in main.c
because I don't want libroff calling directly into libmdoc or libman.

As a consequence, a parsed row can be pushed directly into any -mdoc or
-man context (put a `Bd -literal -offset indent' into a `TE/TS' block to
see why this is necessary).  It will then absorb formatting cues in the
front-ends.

A note on naming.  I decided on libroff.h instead of tbl.h because this
is purely within the roff layer.  Separate tbl implementations will
need, then, to interface with libroff.  This is "how it should be"
because tbl is tightly linked with roff in terms of `ds' and other
formatting macros, as well as, of course, special characters and other
roffisms.

Revision 1.108 / (download) - annotate - [select for diffs], Tue Dec 21 01:46:44 2010 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_10_8
Changes since 1.107: +44 -12 lines
Diff to previous 1.107 (colored)

Sync to OpenBSD:
1) Now that growing buffers in main.c is safe, bring back the bugfix
distinguishing empty and undefined macros that was backed out in
the previous roff.c commit:  `de' initializes to "", not to NULL.
2) Roff only interpolates \* strings when the leading backslash is
not escaped; using optimizations suggested by joerg@ and kristaps@.
ok kristaps@

Revision 1.107 / (download) - annotate - [select for diffs], Mon Dec 6 13:25:25 2010 UTC (9 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_7
Changes since 1.106: +22 -10 lines
Diff to previous 1.106 (colored)

Track down a bug of empty `de XX' macros causing uncertain behaviour by
returning empty strings in roff_getstrn() instead of NULL.  This caused
maddeningly irregular segfaults in the pod2man preamble for `de IX'.
But only on DEC alpha.

Also integrate the kinda-probably-safe assertion relaxation in term.c,
field-tested by schwarze@.  This allows ALL [unpreprocessed] base and
xenocara manuals for all BSD systems to run without segfault.

Revision 1.106 / (download) - annotate - [select for diffs], Thu Dec 2 10:53:03 2010 UTC (9 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.105: +214 -73 lines
Diff to previous 1.105 (colored)

Merge schwarze@'s changes to allow for user-defined strings.  This
primarily adds a roff_userdef() function for parsing new defines and
modifies the look-up procedure.

NOTE: there is a bug hidden away in this update that causes an infinite
loop in some pages.  The cause is for the moment unknown.

Revision 1.105 / (download) - annotate - [select for diffs], Wed Dec 1 16:54:25 2010 UTC (9 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.104: +28 -1 lines
Diff to previous 1.104 (colored)

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

Revision 1.104 / (download) - annotate - [select for diffs], Wed Dec 1 10:31:35 2010 UTC (9 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.103: +13 -5 lines
Diff to previous 1.103 (colored)

Re-ordering of roff requests as per OpenBSD.

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

Revision 1.103 / (download) - annotate - [select for diffs], Wed Dec 1 10:21:25 2010 UTC (9 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.102: +13 -5 lines
Diff to previous 1.102 (colored)

Low-hanging fruit: add OpenBSD's `ad', `hy', `ne', and `nh' handling.

Rename roff_line() -> roff_line_ignore().

Revision 1.102 / (download) - annotate - [select for diffs], Sat Sep 4 20:18:53 2010 UTC (9 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_6
Changes since 1.101: +1 -3 lines
Diff to previous 1.101 (colored)

Churny commit to quiet lint.  No functional changes.

Revision 1.101 / (download) - annotate - [select for diffs], Sat Sep 4 18:31:44 2010 UTC (9 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.100: +4 -6 lines
Diff to previous 1.100 (colored)

Fix premature return from sub-conditional roff statements.  This fix
fully accomodates for the pod2man standard preamble!

Revision 1.100 / (download) - annotate - [select for diffs], Sun Aug 29 11:29:51 2010 UTC (9 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.99: +10 -3 lines
Diff to previous 1.99 (colored)

Allow `.xx\}' where xx is a macro (e.g., `.br\}') to close scope.  This is
experimental and hasn't been rigorously tested.  It's only implemented in
-mdoc for the time being.  This is absolutely required for pod2man.  It
does, however, make the pod2man preamble be processed in full.

Revision 1.99 / (download) - annotate - [select for diffs], Tue Aug 24 12:48:43 2010 UTC (9 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.98: +26 -3 lines
Diff to previous 1.98 (colored)

Have the `ds' processor strip out `\\' as stipulated in groff.7.  I only
care because pod2man uses this construct.

Revision 1.98 / (download) - annotate - [select for diffs], Fri Aug 20 01:02:07 2010 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.97: +9 -25 lines
Diff to previous 1.97 (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.97 / (download) - annotate - [select for diffs], Tue Jul 27 19:56:50 2010 UTC (10 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_5
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

No-op to shut up lint.

Revision 1.96 / (download) - annotate - [select for diffs], Tue Jul 27 13:16:00 2010 UTC (10 years ago) by kristaps
Branch: MAIN
Changes since 1.95: +24 -13 lines
Diff to previous 1.95 (colored)

Fix `ds' handling.  This was stripping characters from "val", when the
syntax of `ds' is such that ALL text following the first
non-space/non-double-quote is part of the value.  This also fixes the
warning of *(string++) = NULL report by kristaps@ and joerg@.

Revision 1.95 / (download) - annotate - [select for diffs], Wed Jul 21 09:15:48 2010 UTC (10 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_5_PREPDF
Changes since 1.94: +6 -6 lines
Diff to previous 1.94 (colored)

Lint-fixes (NetBSD).

Revision 1.94 / (download) - annotate - [select for diffs], Wed Jul 7 15:04:54 2010 UTC (10 years, 1 month ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_4
Changes since 1.93: +123 -64 lines
Diff to previous 1.93 (colored)

Re-constitution of `ds' symbol processing.  First, push the
roff_getstr() family of functions into roff.c with the "first_string"
directly in struct roff.  Second, pre-process each line for reserved
words in libroff, splicing and re-running a line if it has one (this
allows defined symbols to be macros).  Remove term.c's invocation of the
roff_getstrn() function.  Removed function documentation in roff.3 and
added roff.7 `ds' documentation.

Revision 1.93 / (download) - annotate - [select for diffs], Sun Jul 4 22:04:04 2010 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.92: +2 -1 lines
Diff to previous 1.92 (colored)

Assert my copyright, making it explicit that i'm granting the same license
on those parts of the code and text that i have written as Kristaps is.
"fine with me" kristaps@

Revision 1.92 / (download) - annotate - [select for diffs], Sat Jul 3 16:02:12 2010 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.91: +115 -2 lines
Diff to previous 1.91 (colored)

Rudimentary implementation of user-defined strings;
no time for more refinement right now.
In particular, fixes terminfo(3) and mdoc.samples(7).
ok kristaps@, who will add the HTML frontend bits

Revision 1.91 / (download) - annotate - [select for diffs], Sun Jun 27 16:36:22 2010 UTC (10 years, 1 month ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_3
Changes since 1.90: +12 -9 lines
Diff to previous 1.90 (colored)

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

Revision 1.90 / (download) - annotate - [select for diffs], Sun Jun 27 15:52:41 2010 UTC (10 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.89: +19 -18 lines
Diff to previous 1.89 (colored)

Downstream maintainers: this removes UGLY!  I don't want diverging
functionality and UGLY works quite well thanks to schwarze@'s careful
attention.

This also backs out function-prototype changes for struct regset,
instead stuffing a pointer to the regset directly into struct
mdoc/man/roff.

Revision 1.89 / (download) - annotate - [select for diffs], Sat Jun 26 15:22:19 2010 UTC (10 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.88: +80 -9 lines
Diff to previous 1.88 (colored)

First step of adding register support.  This is inspired by a significant
patch by schwarze@.  This commit adds support to libroff parsing `nr'
into register set defined in regs.h.  This will propogate into libmdoc
and libman in later commits.

Revision 1.88 / (download) - annotate - [select for diffs], Thu Jun 10 21:42:02 2010 UTC (10 years, 1 month ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_2
Changes since 1.87: +89 -34 lines
Diff to previous 1.87 (colored)

Fix adding some minimal intelligence to conditional parser.  See roff.7
for what's supported.  This simplified the roff_cond() function quite
nicely.  From a bug report by uqs@.

Added regression test based on bug-report example by uqs@.

Also added ROFF_DEBUG to see what the hell the parser is actually doing.
Obviously turned off by default.

Revision 1.87 / (download) - annotate - [select for diffs], Wed Jun 9 20:00:38 2010 UTC (10 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.86: +12 -2 lines
Diff to previous 1.86 (colored)

Make "sub" for conditionals run roffnode_cleanscope() before calling
down to sub-arguments.  From a bug report by Ulrich Spoerlein.

Revision 1.86 / (download) - annotate - [select for diffs], Tue Jun 1 11:47:28 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_1
Changes since 1.85: +2 -4 lines
Diff to previous 1.85 (colored)

Fixed condition of `\}' closing a conditional at the start of the line.

Fixed flushed-out condition of \} causing subsequent arguments to be
truncated, when in fact the whole line should be passed through (if the
conditional succeeds) to the front-end and the \} ignored there.

Added regression test of this behaviour.

Revision 1.85 / (download) - annotate - [select for diffs], Sat May 29 19:41:47 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.84: +73 -23 lines
Diff to previous 1.84 (colored)

Give libroff an extremely simple table-lookup instead of iterating over
each and every macro.  The table keys on the first character then walks
a chain.  Good enough for now.

Revision 1.84 / (download) - annotate - [select for diffs], Mon May 24 23:54:18 2010 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +17 -6 lines
Diff to previous 1.83 (colored)

recognize ".if n" as true;
nothing fancy yet, no negation, no grammer, just that one letter;
from OpenBSD;
"looks fine" kristaps@

Revision 1.83 / (download) - annotate - [select for diffs], Mon May 24 22:25:58 2010 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +17 -1 lines
Diff to previous 1.82 (colored)

provide stubs to ignore .ds, .rm and .tr,
which occur in the standard pod2man preamble;
from OpenBSD;
"sounds good" joerg@, "can be checked in" kristaps@

Revision 1.82 / (download) - annotate - [select for diffs], Mon May 17 02:01:05 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.81: +115 -61 lines
Diff to previous 1.81 (colored)

Full support for ie/el.  This completes the initial roff support.
Added test files for ie/el.
Using `if 0' as a baseline for "false" roff instructions instead of `if t'.

Revision 1.81 / (download) - annotate - [select for diffs], Mon May 17 00:46:35 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.80: +17 -2 lines
Diff to previous 1.80 (colored)

Oops: forgot to make roff_cblock() understand the new macros.

Revision 1.80 / (download) - annotate - [select for diffs], Mon May 17 00:37:26 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.79: +33 -14 lines
Diff to previous 1.79 (colored)

libroff now intelligently throws away `am', `ami', `am1', `de', `dei',
and `de1'.  This is also documented in roff.7.

Revision 1.79 / (download) - annotate - [select for diffs], Mon May 17 00:06:36 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.78: +144 -81 lines
Diff to previous 1.78 (colored)

libroff now is aware of which sub-nodes should be interpreted even in a
conditional-negative context so as to preserve structural integrity.
Initial "rules" (deny/allow) are now inherited for future work in
evaluating conditionals.

Lint-fix noted by Joerg.

Added regression tests for zany constructs.

Revision 1.78 / (download) - annotate - [select for diffs], Sun May 16 22:28:33 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.77: +125 -22 lines
Diff to previous 1.77 (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.77 / (download) - annotate - [select for diffs], Sun May 16 19:08:11 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.76: +30 -5 lines
Diff to previous 1.76 (colored)

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

Revision 1.76 / (download) - annotate - [select for diffs], Sun May 16 14:47:19 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.75: +72 -124 lines
Diff to previous 1.75 (colored)

Re-admit the simple case of `.ig' that works with groff's stranger invocations.

Revision 1.75 / (download) - annotate - [select for diffs], Sun May 16 13:49:23 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.74: +78 -50 lines
Diff to previous 1.74 (colored)

Support for the general case of `if', which will boil out into other
constructs: single-level and multi-level blocks; nested, varied-level
blocks; recalculating buffer (begin) boundaries pushed correctly into
the back-ends, and so on.  This will allow, once conditions are turned
on, for things like `.ie n .TH FOO 1' then `.el .Dd Mdocdate'.  Read
it and weep.

Revision 1.74 / (download) - annotate - [select for diffs], Sun May 16 10:59:36 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.73: +109 -32 lines
Diff to previous 1.73 (colored)

Allow roff_parseln() to be re-run.
Allow roff_parseln() to manipulate the line buffer offset.  This is used
in situations like `.ie n .TH FOO 1' or `.ie n .ie n', where the line
buffer offset is recalculated then the roff parser re-run.
Fix mdoc_parseln() and man_parseln() to accept the initial line offset.
WARNING: backed-out ALL roff macros whilst accomodating for how roff
handles multi-line conditionals (in short, re-running the parser).

Revision 1.73 / (download) - annotate - [select for diffs], Sat May 15 22:28:22 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored)

Backed-out warning messages (lots).

Revision 1.72 / (download) - annotate - [select for diffs], Sat May 15 22:22:51 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.71: +24 -36 lines
Diff to previous 1.71 (colored)

The `am', `ami', `de', and holy `dei' are all being properly ignored.

Revision 1.71 / (download) - annotate - [select for diffs], Sat May 15 21:53:11 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.70: +74 -9 lines
Diff to previous 1.70 (colored)

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

Revision 1.70 / (download) - annotate - [select for diffs], Sat May 15 20:51:40 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.69: +1 -11 lines
Diff to previous 1.69 (colored)

Pull `ig' out of -man and leave it the roff preparser.

Revision 1.69 / (download) - annotate - [select for diffs], Sat May 15 18:48:32 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

Magic fix for bogus manuals making -man puke: I don't care if it's magic because roff instructions will be nixed from the underlying systems anyway.

Revision 1.68 / (download) - annotate - [select for diffs], Sat May 15 18:43:59 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.67: +5 -3 lines
Diff to previous 1.67 (colored)

Segfault fix and letting warnings slip through for now.

Revision 1.67 / (download) - annotate - [select for diffs], Sat May 15 18:35:14 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.66: +306 -2 lines
Diff to previous 1.66 (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.

Revision 1.66 / (download) - annotate - [select for diffs], Sat May 15 07:52:11 2010 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.65: +14 -1714 lines
Diff to previous 1.65 (colored)

Initial roff shim skeleton in place.

Revision 1.65, Mon Dec 15 02:29:44 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_5, VERSION_1_8_5, VERSION_1_8_1, VERSION_1_7_16, VERSION_1_7_15, VERSION_1_6_5, VERSION_1_5_1, VERSION_1_3_6, VERSION_1_3_15, VERSION_1_2_0, OPENBSD_CHECKIN
Changes since 1.64: +1 -1 lines
FILE REMOVED

More file pruning.

Revision 1.64 / (download) - annotate - [select for diffs], Fri Dec 12 10:11:10 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.63: +93 -1 lines
Diff to previous 1.63 (colored)

*** empty log message ***

Revision 1.63 / (download) - annotate - [select for diffs], Wed Dec 10 16:03:12 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.62: +4 -4 lines
Diff to previous 1.62 (colored)

Ready for looking over by people.

Revision 1.62 / (download) - annotate - [select for diffs], Wed Dec 10 13:41:59 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.61: +7 -4 lines
Diff to previous 1.61 (colored)

Sx to Sh anchors work.

Revision 1.61 / (download) - annotate - [select for diffs], Wed Dec 10 13:15:55 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.60: +43 -66 lines
Diff to previous 1.60 (colored)

Put prelude checking into asec.

Revision 1.60 / (download) - annotate - [select for diffs], Wed Dec 10 12:09:47 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_0_2
Changes since 1.59: +16 -17 lines
Diff to previous 1.59 (colored)

Linted on NetBSD side.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Dec 10 12:05:33 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.58: +4 -2 lines
Diff to previous 1.58 (colored)

Versioning up.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Dec 10 10:43:57 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.57: +40 -6 lines
Diff to previous 1.57 (colored)

*** empty log message ***

Revision 1.57 / (download) - annotate - [select for diffs], Wed Dec 10 00:52:46 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.56: +3 -4 lines
Diff to previous 1.56 (colored)

*** empty log message ***

Revision 1.56 / (download) - annotate - [select for diffs], Tue Dec 9 19:57:26 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.55: +2 -2 lines
Diff to previous 1.55 (colored)

*** empty log message ***

Revision 1.55 / (download) - annotate - [select for diffs], Tue Dec 9 17:09:12 2008 UTC (11 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.54: +223 -296 lines
Diff to previous 1.54 (colored)

Considerable clean-ups.

Revision 1.54 / (download) - annotate - [select for diffs], Tue Dec 9 00:27:17 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.53: +45 -59 lines
Diff to previous 1.53 (colored)

*** empty log message ***

Revision 1.53 / (download) - annotate - [select for diffs], Mon Dec 8 20:32:49 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.52: +31 -18 lines
Diff to previous 1.52 (colored)

*** empty log message ***

Revision 1.52 / (download) - annotate - [select for diffs], Mon Dec 8 16:29:57 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.51: +228 -17 lines
Diff to previous 1.51 (colored)

*** empty log message ***

Revision 1.51 / (download) - annotate - [select for diffs], Mon Dec 8 12:46:28 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_0_1
Changes since 1.50: +92 -25 lines
Diff to previous 1.50 (colored)

Added warnings for using macros in the wrong sections.

Revision 1.50 / (download) - annotate - [select for diffs], Sun Dec 7 22:40:18 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.49: +22 -12 lines
Diff to previous 1.49 (colored)

*** empty log message ***

Revision 1.49 / (download) - annotate - [select for diffs], Sun Dec 7 16:41:04 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.48: +25 -2 lines
Diff to previous 1.48 (colored)

*** empty log message ***

Revision 1.48 / (download) - annotate - [select for diffs], Sun Dec 7 14:38:57 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.47: +8 -7 lines
Diff to previous 1.47 (colored)

*** empty log message ***

Revision 1.47 / (download) - annotate - [select for diffs], Sat Dec 6 21:10:31 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.46: +17 -10 lines
Diff to previous 1.46 (colored)

.St macros in place.

Revision 1.46 / (download) - annotate - [select for diffs], Sat Dec 6 19:41:41 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.45: +28 -25 lines
Diff to previous 1.45 (colored)

*** empty log message ***

Revision 1.45 / (download) - annotate - [select for diffs], Sat Dec 6 16:50:18 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.44: +11 -3 lines
Diff to previous 1.44 (colored)

*** empty log message ***

Revision 1.44 / (download) - annotate - [select for diffs], Sat Dec 6 13:18:44 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.43: +65 -77 lines
Diff to previous 1.43 (colored)

*** empty log message ***

Revision 1.43 / (download) - annotate - [select for diffs], Fri Dec 5 22:54:44 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.42: +4 -266 lines
Diff to previous 1.42 (colored)

*** empty log message ***

Revision 1.42 / (download) - annotate - [select for diffs], Fri Dec 5 22:34:30 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.41: +90 -23 lines
Diff to previous 1.41 (colored)

Nm works properly, many other changes, etc.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Dec 5 11:28:17 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.40: +2 -1 lines
Diff to previous 1.40 (colored)

*** empty log message ***

Revision 1.40 / (download) - annotate - [select for diffs], Thu Dec 4 23:10:51 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.39: +99 -28 lines
Diff to previous 1.39 (colored)

*** empty log message ***

Revision 1.39 / (download) - annotate - [select for diffs], Thu Dec 4 19:31:57 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.38: +1 -15 lines
Diff to previous 1.38 (colored)

Moved charset recognition into the filter.

Revision 1.38 / (download) - annotate - [select for diffs], Thu Dec 4 16:34:59 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.37: +10 -2 lines
Diff to previous 1.37 (colored)

Character-set validation fixes.

Revision 1.37 / (download) - annotate - [select for diffs], Thu Dec 4 16:19:52 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.36: +80 -41 lines
Diff to previous 1.36 (colored)

Character-encoding tests.

Revision 1.36 / (download) - annotate - [select for diffs], Thu Dec 4 11:25:29 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.35: +5 -2 lines
Diff to previous 1.35 (colored)

More html-css.

Revision 1.35 / (download) - annotate - [select for diffs], Wed Dec 3 19:21:58 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.34: +24 -87 lines
Diff to previous 1.34 (colored)

Major update.

Revision 1.34 / (download) - annotate - [select for diffs], Tue Dec 2 18:26:57 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.33: +3 -3 lines
Diff to previous 1.33 (colored)

Transition to splitting xml/ml.

Revision 1.33 / (download) - annotate - [select for diffs], Tue Dec 2 13:20:24 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.32: +197 -104 lines
Diff to previous 1.32 (colored)

Added `Sm' functionality.

Revision 1.32 / (download) - annotate - [select for diffs], Tue Dec 2 00:15:41 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.31: +27 -46 lines
Diff to previous 1.31 (colored)

Lint fixes and prettiness.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Dec 2 00:10:37 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.30: +103 -42 lines
Diff to previous 1.30 (colored)

Improvements to the xml part.

Revision 1.30 / (download) - annotate - [select for diffs], Mon Dec 1 21:25:48 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.29: +116 -13 lines
Diff to previous 1.29 (colored)

No more segfaults when run over openbsd sources.

Revision 1.29 / (download) - annotate - [select for diffs], Mon Dec 1 16:14:34 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.28: +4 -5 lines
Diff to previous 1.28 (colored)

Better Oo/Oc support.

Revision 1.28 / (download) - annotate - [select for diffs], Mon Dec 1 16:01:28 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.27: +35 -17 lines
Diff to previous 1.27 (colored)

Considerable scoping fixes.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Dec 1 15:32:36 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.26: +155 -155 lines
Diff to previous 1.26 (colored)

Considerably improved roff_text parser.
Consolidated noop roff macros.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Dec 1 09:25:18 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.25: +100 -54 lines
Diff to previous 1.25 (colored)

*** empty log message ***

Revision 1.25 / (download) - annotate - [select for diffs], Sun Nov 30 23:05:57 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.24: +8 -4 lines
Diff to previous 1.24 (colored)

Small fixes to output.

Revision 1.24 / (download) - annotate - [select for diffs], Sun Nov 30 21:41:35 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

Preliminary xml output filter (validate-renamed) done.

Revision 1.23 / (download) - annotate - [select for diffs], Sun Nov 30 20:53:34 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +9 -4 lines
Diff to previous 1.22 (colored)

Cleaned up presentation with mbuf_putstring & al.

Revision 1.22 / (download) - annotate - [select for diffs], Sun Nov 30 18:53:11 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Small error fixed.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Nov 30 18:50:44 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +96 -21 lines
Diff to previous 1.20 (colored)

Fixed spacing (almost there).

Revision 1.20 / (download) - annotate - [select for diffs], Sun Nov 30 12:41:45 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.19: +91 -41 lines
Diff to previous 1.19 (colored)

Backed out PUNCT changes (again).

Revision 1.19 / (download) - annotate - [select for diffs], Sat Nov 29 16:23:22 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.18: +30 -29 lines
Diff to previous 1.18 (colored)

Annotated omit-punctuation macros.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Nov 29 16:11:42 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +29 -32 lines
Diff to previous 1.17 (colored)

Validation presentation (html-like).
Fixed newlining for data.
Moved roffhead/rofftail to roff_Os.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Nov 29 14:14:21 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.16: +22 -18 lines
Diff to previous 1.16 (colored)

Inclusion of "real" validation code.

Revision 1.16 / (download) - annotate - [select for diffs], Fri Nov 28 18:15:29 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.15: +33 -11 lines
Diff to previous 1.15 (colored)

Cleaned up exit routine.
Added roffhead and rofftail call.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Nov 28 15:25:49 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.14: +48 -93 lines
Diff to previous 1.14 (colored)

Removed superfluous structures from rofftree.
Added roffdata for generalised text processing.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Nov 28 11:21:12 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +74 -39 lines
Diff to previous 1.13 (colored)

Initial pushing to mbuf.

Revision 1.13 / (download) - annotate - [select for diffs], Thu Nov 27 17:27:50 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +12 -12 lines
Diff to previous 1.12 (colored)

*** empty log message ***

Revision 1.12 / (download) - annotate - [select for diffs], Thu Nov 27 16:54:58 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.11: +174 -224 lines
Diff to previous 1.11 (colored)

Considerable fixes.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Nov 27 14:02:41 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +18 -5 lines
Diff to previous 1.10 (colored)

Added "special" macros.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Nov 27 13:29:44 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +84 -50 lines
Diff to previous 1.9 (colored)

More fixes and work-ness.

Revision 1.9 / (download) - annotate - [select for diffs], Thu Nov 27 11:23:51 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +160 -85 lines
Diff to previous 1.8 (colored)

Mainly quotes.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Nov 26 22:27:08 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +88 -191 lines
Diff to previous 1.7 (colored)

Various fixes.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Nov 26 21:42:59 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +139 -63 lines
Diff to previous 1.6 (colored)

Considerable fixes.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Nov 26 16:50:34 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +295 -252 lines
Diff to previous 1.5 (colored)

Added regression tests.
Considerable fixes... blah blah blah...

Revision 1.5 / (download) - annotate - [select for diffs], Tue Nov 25 16:49:57 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +377 -81 lines
Diff to previous 1.4 (colored)

Imported all macros from mdoc(7).
Put all names into roff.c with extern access from private.h.
Annotated list of changes that must occur for end-game (scope, nests, etc.).

Revision 1.4 / (download) - annotate - [select for diffs], Tue Nov 25 12:14:02 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +126 -95 lines
Diff to previous 1.3 (colored)

Single call-back for filters.
Removed verbose flag.
Added more macros and arguments.

Revision 1.3 / (download) - annotate - [select for diffs], Mon Nov 24 18:34:50 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.2: +3 -1 lines
Diff to previous 1.2 (colored)

Annotated todo for prologue/text tokens.

Revision 1.2 / (download) - annotate - [select for diffs], Mon Nov 24 18:32:39 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +117 -160 lines
Diff to previous 1.1 (colored)

Generic roff_layout for layout tokens.

Revision 1.1 / (download) - annotate - [select for diffs], Mon Nov 24 14:24:55 2008 UTC (11 years, 8 months ago) by kristaps
Branch: MAIN

Split roff engine into roff.c.
Re-worked calling convention for md_*.

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