OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.58 / (download) - annotate - [select for diffs], Tue Oct 24 20:30:49 2023 UTC (6 months, 3 weeks ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.57: +2 -1 lines
Diff to previous 1.57 (colored)

Implement the man(7) .MR macro, a 2023 GNU extension.
The syntax and semantics is almost identical to mdoc(7) .Xr.

This will be needed for reading the groff manual pages once our port
will be updated to 1.23, and the Linux Manual Pages Project is also
determined to start using it sooner or later.  I did not advocate for
this new macro, but since we want to remain able to read all manual
pages found in the wild, there is little choice but to support it.
At least it is easy to do, they basically copied .Xr.

Revision 1.57 / (download) - annotate - [select for diffs], Sat Apr 30 15:08:56 2022 UTC (2 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.56: +13 -13 lines
Diff to previous 1.56 (colored)

Add comments to some of the enum roff_tok values;
particularly useful for values that have non-obvious semantics
like ROFF_MAX, ROFF_cblock, ROFF_RENAMED, and TOKEN_NONE;
no code change.

Revision 1.56 / (download) - annotate - [select for diffs], Wed Apr 8 11:54:14 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.55: +2 -1 lines
Diff to previous 1.55 (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.55 / (download) - annotate - [select for diffs], Mon Apr 6 09:55:49 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.54: +3 -2 lines
Diff to previous 1.54 (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.54 / (download) - annotate - [select for diffs], Thu Feb 27 21:38:27 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +3 -1 lines
Diff to previous 1.53 (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.53 / (download) - annotate - [select for diffs], Thu Feb 27 01:25:58 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +7 -3 lines
Diff to previous 1.52 (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.52 / (download) - annotate - [select for diffs], Sun Jan 19 17:59:01 2020 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +3 -2 lines
Diff to previous 1.51 (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.51 / (download) - annotate - [select for diffs], Mon Mar 4 13:01:52 2019 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.50: +3 -2 lines
Diff to previous 1.50 (colored)

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

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

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

Revision 1.50 / (download) - annotate - [select for diffs], Mon Dec 31 08:17:58 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +9 -8 lines
Diff to previous 1.49 (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.49 / (download) - annotate - [select for diffs], Mon Dec 31 07:07:43 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +3 -5 lines
Diff to previous 1.48 (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.48 / (download) - annotate - [select for diffs], Sun Dec 30 00:48:48 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +5 -40 lines
Diff to previous 1.47 (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.47 / (download) - annotate - [select for diffs], Fri Dec 14 06:33:03 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +1 -2 lines
Diff to previous 1.46 (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.46 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:14 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.45: +7 -1 lines
Diff to previous 1.45 (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.45 / (download) - annotate - [select for diffs], Thu Dec 13 06:17:17 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +3 -4 lines
Diff to previous 1.44 (colored)

Cleanup, no functional change:
Move the roffhash_*() functions from roff.h to roff_int.h
because they are only intended for use by parsers,
neither by main programs nor by formatters.

Revision 1.44 / (download) - annotate - [select for diffs], Thu Dec 13 02:05:57 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (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.43 / (download) - annotate - [select for diffs], Sat Aug 18 02:03:41 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.42: +4 -2 lines
Diff to previous 1.42 (colored)

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

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

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

Revision 1.41 / (download) - annotate - [select for diffs], Wed Apr 11 17:10:35 2018 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.40: +2 -1 lines
Diff to previous 1.40 (colored)

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

Revision 1.40 / (download) - annotate - [select for diffs], Sat Jul 8 14:51:01 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (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.39 / (download) - annotate - [select for diffs], Sun Jun 25 07:23:53 2017 UTC (6 years, 10 months ago) by bentley
Branch: MAIN
Changes since 1.38: +3 -1 lines
Diff to previous 1.38 (colored)

Add support for the MT and ME mailto macros, used for example in wg(8).

feedback and ok schwarze@

Revision 1.38 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:28 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +4 -10 lines
Diff to previous 1.37 (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.37 / (download) - annotate - [select for diffs], Sat Jun 17 22:40:27 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +2 -1 lines
Diff to previous 1.36 (colored)

style message about missing RCS ids; inspired by mdoclint

Revision 1.36 / (download) - annotate - [select for diffs], Wed Jun 14 22:50:37 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Wed Jun 14 13:00:13 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

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

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

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

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jun 7 00:50:30 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +2 -1 lines
Diff to previous 1.32 (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.32 / (download) - annotate - [select for diffs], Tue Jun 6 15:00:56 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (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.31 / (download) - annotate - [select for diffs], Sun Jun 4 22:43:50 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (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.30 / (download) - annotate - [select for diffs], Mon May 8 15:33:43 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Sun May 7 17:30:58 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (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.28 / (download) - annotate - [select for diffs], Fri May 5 15:16:26 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.27: +2 -4 lines
Diff to previous 1.27 (colored)

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

Revision 1.27 / (download) - annotate - [select for diffs], Fri May 5 13:17:04 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.26: +2 -4 lines
Diff to previous 1.26 (colored)

move .ll to the roff modules

Revision 1.26 / (download) - annotate - [select for diffs], Fri May 5 02:06:17 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Thu May 4 17:48:24 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.24: +4 -5 lines
Diff to previous 1.24 (colored)

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

Revision 1.24 / (download) - annotate - [select for diffs], Sat Apr 29 12:43:55 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.23: +8 -1 lines
Diff to previous 1.23 (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.23 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:09 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.22: +413 -3 lines
Diff to previous 1.22 (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.22 / (download) - annotate - [select for diffs], Thu Feb 16 02:59:42 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.21: +2 -3 lines
Diff to previous 1.21 (colored)

Remove the ENDBODY_NOSPACE flag, simplifying the code.

Comparing to groff output, it appears that all cases where it was used
and made a difference actually require the opposite, ENDBODY_SPACE.

I have no idea why i added it back in 2010; maybe to compensate for
some other bug that has long been fixed.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jan 10 13:46:53 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +9 -12 lines
Diff to previous 1.20 (colored)

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

Revision 1.20 / (download) - annotate - [select for diffs], Tue Jan 10 12:54:28 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +4 -2 lines
Diff to previous 1.19 (colored)

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

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

Revision 1.19 / (download) - annotate - [select for diffs], Fri Jan 8 17:48:04 2016 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.18: +1 -2 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Sat Nov 7 13:57:55 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +1 -4 lines
Diff to previous 1.17 (colored)

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

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

Revision 1.17 / (download) - annotate - [select for diffs], Sat Oct 17 00:19:58 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +6 -3 lines
Diff to previous 1.16 (colored)

Very tricky diff to fix macro interpretation and spacing around tabs
in .Bl -column; it took me more than a day to get this right.
Triggered by a loosely related bug report from tim@.

The lesson for you is:  Use .Ta macros in .Bl -column, avoid tabs,
or you are in for surprises:  The last word before a tab is not
interpreted as a macro (unless there is a blank in between), the
first word after a tab isn't either (unless there is a blank in
between), and a blank after a tab causes a leading blank in the
respective output cell.  Yes, "blank", "tab", "blank tab" and "tab
blank" all have different semantics; if you write code relying on
that, good luck maintaining it afterwards...

Revision 1.16 / (download) - annotate - [select for diffs], Thu Apr 23 16:17:04 2015 UTC (9 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.15: +7 -1 lines
Diff to previous 1.15 (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.15 / (download) - annotate - [select for diffs], Sun Apr 19 13:59:37 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.14: +2 -1 lines
Diff to previous 1.14 (colored)

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

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

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

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

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

Revision 1.12 / (download) - annotate - [select for diffs], Thu Apr 2 23:47:43 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.11: +12 -1 lines
Diff to previous 1.11 (colored)

Third step towards parser unification:
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta.
Written of the train from London to Exeter on the way to p2k15.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Apr 2 22:06:17 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.10: +78 -1 lines
Diff to previous 1.10 (colored)

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

Revision 1.10 / (download) - annotate - [select for diffs], Thu Apr 2 21:03:18 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.9: +15 -33 lines
Diff to previous 1.9 (colored)

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

Revision 1.9, Sun Apr 24 16:22:02 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.8: +1 -1 lines
FILE REMOVED

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

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

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

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

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jan 4 22:28:17 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.6: +4 -2 lines
Diff to previous 1.6 (colored)

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

Revision 1.6 / (download) - annotate - [select for diffs], Thu Nov 25 22:23:31 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +3 -1 lines
Diff to previous 1.5 (colored)

Implement the .de (define macro) roff instruction.
This fixes various Xenocara manuals.
Do not define your own macros in new manuals, though:
this code exists purely to cope with existing and old stuff.

Like in both traditional and GNU roff, the .de and .ds (define string)
roff instructions share the same string table, so one can abuse strings
as macros and vice versa.  This implementation supports multi-line
user-defined macros and user-defined macros taking up to 9 arguments.

Project started near the end of p2k10, now mature for production,
but there is still room for future improvements in various respects.

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

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

Revision 1.4 / (download) - annotate - [select for diffs], Fri Aug 20 00:53:35 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (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.3 / (download) - annotate - [select for diffs], Sun Jun 27 21:54:42 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

Full .nr nS support, unbreaking the kernel manuals.

Kristaps coded this from scratch after reading my .nr patch;
it is simpler and more powerful.

Registers live in struct regset in regs.h, struct man and struct mdoc
contain pointers to it.  The nS register is cleared when parsing .Sh.
Frontends respect the MDOC_SYNPRETTY flag set in mdoc node_alloc.

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

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

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

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

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

In theory, Kristaps never intended to write a roff parser,
but in practice, most real legacy man(7)uals are using so much
low level roff that we can't really get away without at least
partially handling some roff instructions.

As doing this in man(7) only has become messy and as even some
mdoc(7) pages need it, start a minimal partial roff preprocessor.
As a first step, move handling of .am[i], .de[i] and .ig there.
Do not use the roff preprocessor for new manuals!

Now that we have three main parser libraries - roff, man and mdoc -
each one having its own error handling is becoming messy, too.
Thus, start unifying message handling in one central place,
introducing a new generic function mmsg().

coded by kristaps@

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.