OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.65 / (download) - annotate - [select for diffs], Sun Jun 27 17:57:13 2021 UTC (2 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, HEAD
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

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

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

Revision 1.64 / (download) - annotate - [select for diffs], Fri Apr 3 11:34:19 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.63: +6 -3 lines
Diff to previous 1.63 (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.63 / (download) - annotate - [select for diffs], Sun Jan 19 16:16:32 2020 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +4 -3 lines
Diff to previous 1.62 (colored)

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

Revision 1.62 / (download) - annotate - [select for diffs], Fri Dec 21 16:58:49 2018 UTC (5 years, 4 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.61: +2 -2 lines
Diff to previous 1.61 (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.61 / (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.60: +4 -6 lines
Diff to previous 1.60 (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.60 / (download) - annotate - [select for diffs], Fri Dec 14 01:17:46 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +1 -6 lines
Diff to previous 1.59 (colored)

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

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

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

Revision 1.59 / (download) - annotate - [select for diffs], Fri Aug 24 22:56:37 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.58: +23 -12 lines
Diff to previous 1.58 (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.58 / (download) - annotate - [select for diffs], Thu Aug 23 19:32:03 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +4 -3 lines
Diff to previous 1.57 (colored)

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

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

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

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

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

Revision 1.56 / (download) - annotate - [select for diffs], Mon Apr 9 22:26:25 2018 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.55: +2 -2 lines
Diff to previous 1.55 (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.55 / (download) - annotate - [select for diffs], Sat Jul 8 17:52:42 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.54: +2 -6 lines
Diff to previous 1.54 (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.54 / (download) - annotate - [select for diffs], Sat Jul 8 14:51:01 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +1 -4 lines
Diff to previous 1.53 (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.53 / (download) - annotate - [select for diffs], Sun Jun 11 19:36:31 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored)

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

Revision 1.52 / (download) - annotate - [select for diffs], Sat Apr 29 12:43:55 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.51: +1 -3 lines
Diff to previous 1.51 (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.51 / (download) - annotate - [select for diffs], Sat Feb 18 13:43:34 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.50: +2 -2 lines
Diff to previous 1.50 (colored)

preconv_encode() can take a const input buffer;
diff from <christos at NetBSD>

Revision 1.50 / (download) - annotate - [select for diffs], Thu Feb 9 17:19:07 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

Be consistent in protecting __attribute__ attributes with __;
from Christos Zoulas <christos @ NetBSD>.

Revision 1.49 / (download) - annotate - [select for diffs], Tue Jul 19 13:30:16 2016 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.48: +3 -3 lines
Diff to previous 1.48 (colored)

Use __attribute__((__format__ throughout.
Triggered by a smaller patch from Christos Zoulas.

Revision 1.48 / (download) - annotate - [select for diffs], Sat Nov 7 13:57:55 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.47: +1 -4 lines
Diff to previous 1.47 (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.47 / (download) - annotate - [select for diffs], Tue Oct 13 22:57:49 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +2 -3 lines
Diff to previous 1.46 (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.46 / (download) - annotate - [select for diffs], Sun Apr 19 14:25:05 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.45: +1 -5 lines
Diff to previous 1.45 (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.45 / (download) - annotate - [select for diffs], Sun Apr 19 13:50:10 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.44: +1 -3 lines
Diff to previous 1.44 (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.44 / (download) - annotate - [select for diffs], Sat Apr 18 17:28:08 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.43: +8 -9 lines
Diff to previous 1.43 (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.43 / (download) - annotate - [select for diffs], Sat Apr 18 17:01:28 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.42: +3 -1 lines
Diff to previous 1.42 (colored)

Move mdoc_hash_init() and man_hash_init() to libmandoc.h
and call them from mparse_alloc() and choose_parser(),
preparing unified allocation of struct roff_man.

Revision 1.42 / (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.41: +19 -20 lines
Diff to previous 1.41 (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.41 / (download) - annotate - [select for diffs], Thu Jan 15 04:26:06 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.40: +3 -3 lines
Diff to previous 1.40 (colored)

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

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

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

Revision 1.39 / (download) - annotate - [select for diffs], Sun Dec 28 14:39:08 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +3 -2 lines
Diff to previous 1.38 (colored)

mdoc(7) already uses the mandoc(1) -Ios argument in the footer line
when .Os has no argument, so do the same for man(7) when .TH has less
than four arguments; there is no reason to treat both differently.
Issue found following a question from Thomas Klausner <wiz at NetBSD>.

Revision 1.38 / (download) - annotate - [select for diffs], Sun Dec 21 00:17:24 2014 UTC (9 years, 5 months ago) by daniel
Branch: MAIN
Changes since 1.37: +1 -2 lines
Diff to previous 1.37 (colored)

Fix build with -Werror -std=c99 -pedantic.

ok schwarze@

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

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

Revision 1.36 / (download) - annotate - [select for diffs], Fri Nov 28 06:26:46 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +5 -5 lines
Diff to previous 1.35 (colored)

Simplify by making the eqn and tbl steering functions void;
no functional change, minus 15 lines of code.

Revision 1.35 / (download) - annotate - [select for diffs], Thu Nov 27 14:31:29 2014 UTC (9 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +1 -5 lines
Diff to previous 1.34 (colored)

remove unneccessary inclusion protection; ok schwarze

Revision 1.34 / (download) - annotate - [select for diffs], Sat Nov 1 06:02:43 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +2 -3 lines
Diff to previous 1.33 (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.33 / (download) - annotate - [select for diffs], Sat Nov 1 04:07:25 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +4 -4 lines
Diff to previous 1.32 (colored)

Refactor, no functional change: Remove the parse point from struct buf.
Some functions need multiple parse points, some none at all,
and it varies whether any of them need to be passed around.
So better pass them as a separate argument, and only when needed.

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

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

Revision 1.31 / (download) - annotate - [select for diffs], Tue Oct 28 17:35:42 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (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.30 / (download) - annotate - [select for diffs], Thu Oct 16 01:10:06 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +1 -7 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Sat Sep 6 22:38:35 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +2 -1 lines
Diff to previous 1.28 (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.28 / (download) - annotate - [select for diffs], Wed Jul 9 11:30:07 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.27: +3 -2 lines
Diff to previous 1.27 (colored)

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

Revision 1.27 / (download) - annotate - [select for diffs], Sun Apr 20 16:44:44 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.26: +11 -11 lines
Diff to previous 1.26 (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.26 / (download) - annotate - [select for diffs], Wed Mar 19 21:50:59 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Mon Jan 6 21:33:00 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (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.24 / (download) - annotate - [select for diffs], Sun Jan 5 20:26:27 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

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

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

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

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

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

Simplify: Remove an unused argument from the mandoc_eos() function.
No functional change.

Revision 1.22 / (download) - annotate - [select for diffs], Sun Dec 15 21:18:00 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (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 at mdocml.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Oct 3 22:04:08 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (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.20 / (download) - annotate - [select for diffs], Thu Oct 3 19:32:25 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +4 -9 lines
Diff to previous 1.19 (colored)

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

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.19 / (download) - annotate - [select for diffs], Sat Jul 7 18:27:36 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.18: +4 -3 lines
Diff to previous 1.18 (colored)

Support the .cc request; code by kristaps@, tests by me.
Needed for sqlite3(1) as reported by espie@.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Jun 2 23:18:30 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (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).

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

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

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

Revision 1.16 / (download) - annotate - [select for diffs], Fri Dec 2 01:45:43 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.15: +2 -1 lines
Diff to previous 1.15 (colored)

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

ok kristaps@

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

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

sync to version 1.11.7 from kristaps@
main new feature: support the roff(7) .tr request
plus various bugfixes and some refactoring

regressions are so minor that it's better to get this in
and fix them in the tree

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

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

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

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

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

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

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

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

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

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

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

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

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

Revision 1.8 / (download) - annotate - [select for diffs], Mon Jan 3 22:27:21 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.7: +2 -1 lines
Diff to previous 1.7 (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.7 / (download) - annotate - [select for diffs], Fri Jul 16 00:34:33 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

Text ending in a full stop, exclamation mark or question mark
should not flag the end of a sentence if:

1) The punctuation is followed by closing delimiters
and not preceded by alphanumeric characters, like in
"There is no full stop (.) in this sentence"

or

2) The punctuation is a child of a macro
and not preceded by alphanumeric characters, like in
"There is no full stop
.Pq \&.
in this sentence"

jmc@ and sobrado@ like this

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

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

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

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

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

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

idea and coding by kristaps@

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

Revision 1.4 / (download) - annotate - [select for diffs], Fri May 14 19:52:43 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.3: +2 -1 lines
Diff to previous 1.3 (colored)

Integrate kristaps@' end-of-sentence (EOS) framework
which is simpler and more powerful than mine, and remove mine.

* man(7) now has EOS handling, too
* put EOS detection into its own function in libmandoc
* use node and termp flags to communicate the EOS condition
* no more EOS pseudo-macro
* no more non-printable EOS marker character on the formatter level

This slightly breaks EOS detection after trailing punctuation
in mdoc(7) macros, but that will be restored soon.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Dec 23 22:30:17 2009 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.2: +6 -1 lines
Diff to previous 1.2 (colored)

sync to 1.9.13: minor fixes:

correctness/functionality:
 - bugfix: properly ignore lines with only a dot in -man
 - bugfix: .Bl -ohang doesn't allow -width, warn about this
 - improve date string handling by new function mandoc_a2time
 - some HTML improvements
 - significant documentation additions in man.7 and mdoc.7

portability:
 - replace __dead by __attribute__((noreturn))
 - bugfix: correct .Dx rendering
 - some more library names for NetBSD

simplicity:
 - replace hand-rolled putchar(3)-loops by fwrite(3)
 - replace single-character printf(3) by putchar(3)

Revision 1.2 / (download) - annotate - [select for diffs], Tue Dec 22 23:58:00 2009 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.1: +5 -1 lines
Diff to previous 1.1 (colored)

sync to 1.9.12, mostly portability and refactoring:

correctness/functionality:
- bugfix: do not die when overstep hits the right margin
- new option: -fign-escape
- and various HTML features

portability:
- replace bzero(3) by memset(3), which is ANSI C
- replace err(3)/warn(3) by perror(3)/exit(3), which is ANSI C
- iuse argv[0] instead of __progname
- add time.h to various files for FreeBSD compilation

simplicity:
- do not allocate header/footer data dynamically in *_term.c
- provide and use malloc frontends that error out on failure

for full changelogs, see http://bsd.lv/cgi-bin/cvsweb.cgi/

Revision 1.1 / (download) - annotate - [select for diffs], Wed Jul 8 00:04:10 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN

sync to 1.7.21: unified escape sequence validation for mdoc and man
checking is still incomplete, but a bit better, in particular for man
now in sync with 1.7.22: the only 1.7.22 diff was already in

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.