CVS log for mandoc/libmandoc.h

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.79 / (download) - annotate - [select for diffs], Fri Apr 3 11:35:01 2020 UTC (5 months, 2 weeks ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.78: +6 -3 lines
Diff to previous 1.78 (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.78 / (download) - annotate - [select for diffs], Sun Jan 19 16:44:50 2020 UTC (7 months, 4 weeks ago) by schwarze
Branch: MAIN
Changes since 1.77: +4 -3 lines
Diff to previous 1.77 (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.77 / (download) - annotate - [select for diffs], Fri Dec 21 17:15:18 2018 UTC (20 months, 4 weeks ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (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.76 / (download) - annotate - [select for diffs], Fri Dec 14 06:33:14 2018 UTC (21 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +4 -6 lines
Diff to previous 1.75 (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.75 / (download) - annotate - [select for diffs], Fri Dec 14 01:18:25 2018 UTC (21 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +1 -6 lines
Diff to previous 1.74 (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.74 / (download) - annotate - [select for diffs], Fri Aug 24 23:12:33 2018 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.73: +23 -12 lines
Diff to previous 1.73 (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.73 / (download) - annotate - [select for diffs], Thu Aug 23 19:33:27 2018 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.72: +4 -3 lines
Diff to previous 1.72 (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.72 / (download) - annotate - [select for diffs], Thu Aug 23 14:29:38 2018 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.71: +5 -2 lines
Diff to previous 1.71 (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.71 / (download) - annotate - [select for diffs], Mon Apr 9 22:27:04 2018 UTC (2 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (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.70 / (download) - annotate - [select for diffs], Sat Jul 8 17:52:49 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3, VERSION_1_14_2
Changes since 1.69: +2 -6 lines
Diff to previous 1.69 (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.69 / (download) - annotate - [select for diffs], Sat Jul 8 14:51:04 2017 UTC (3 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +1 -4 lines
Diff to previous 1.68 (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.68 / (download) - annotate - [select for diffs], Sun Jun 11 19:37:00 2017 UTC (3 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (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.67 / (download) - annotate - [select for diffs], Sat Apr 29 12:45:41 2017 UTC (3 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +1 -3 lines
Diff to previous 1.66 (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.66 / (download) - annotate - [select for diffs], Sat Feb 18 13:43:52 2017 UTC (3 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1, VERSION_1_13
Changes since 1.65: +2 -2 lines
Diff to previous 1.65 (colored)

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

Revision 1.65 / (download) - annotate - [select for diffs], Fri Feb 17 14:31:52 2017 UTC (3 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

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

Revision 1.64 / (download) - annotate - [select for diffs], Tue Jul 19 13:36:13 2016 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +3 -5 lines
Diff to previous 1.63 (colored)

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

While here, unify style, move several config tests to config.h,
and delete the useless MANDOC_CONFIG_H.

Revision 1.63 / (download) - annotate - [select for diffs], Thu Jul 7 19:19:01 2016 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.62: +1 -2 lines
Diff to previous 1.62 (colored)

update developer documentation

Revision 1.62 / (download) - annotate - [select for diffs], Sat Nov 7 14:01:16 2015 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +1 -4 lines
Diff to previous 1.61 (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.61 / (download) - annotate - [select for diffs], Tue Oct 13 22:59:54 2015 UTC (4 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +2 -3 lines
Diff to previous 1.60 (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.60 / (download) - annotate - [select for diffs], Sun Apr 19 14:25:41 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +1 -5 lines
Diff to previous 1.59 (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.59 / (download) - annotate - [select for diffs], Sun Apr 19 13:50:25 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +1 -3 lines
Diff to previous 1.58 (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.58 / (download) - annotate - [select for diffs], Sat Apr 18 17:28:36 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +8 -9 lines
Diff to previous 1.57 (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.57 / (download) - annotate - [select for diffs], Sat Apr 18 17:01:58 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +3 -1 lines
Diff to previous 1.56 (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.56 / (download) - annotate - [select for diffs], Sat Apr 18 16:06:39 2015 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +19 -20 lines
Diff to previous 1.55 (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.55 / (download) - annotate - [select for diffs], Thu Jan 15 04:26:39 2015 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.54: +3 -3 lines
Diff to previous 1.54 (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.54 / (download) - annotate - [select for diffs], Wed Jan 14 22:58:16 2015 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +2 -3 lines
Diff to previous 1.53 (colored)

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

Revision 1.53 / (download) - annotate - [select for diffs], Sun Dec 28 14:42:27 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +3 -2 lines
Diff to previous 1.52 (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.52 / (download) - annotate - [select for diffs], Sun Dec 21 14:14:35 2014 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +1 -2 lines
Diff to previous 1.51 (colored)

ISO C99 explicitly forbids forward references to enum types (6.7.2.3.3.);
patch from daniel@

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

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

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

remove unneccessary inclusion protection; patch from deraadt@

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

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

Revision 1.48 / (download) - annotate - [select for diffs], Sat Nov 1 06:03:13 2014 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +2 -3 lines
Diff to previous 1.47 (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.47 / (download) - annotate - [select for diffs], Sat Nov 1 04:08:43 2014 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +4 -4 lines
Diff to previous 1.46 (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.46 / (download) - annotate - [select for diffs], Tue Oct 28 17:36:19 2014 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (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.45 / (download) - annotate - [select for diffs], Sat Oct 25 01:03:52 2014 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +10 -1 lines
Diff to previous 1.44 (colored)

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

Revision 1.44 / (download) - annotate - [select for diffs], Thu Oct 16 01:11:20 2014 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +1 -7 lines
Diff to previous 1.43 (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.43 / (download) - annotate - [select for diffs], Sat Sep 6 22:39:36 2014 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.42: +2 -1 lines
Diff to previous 1.42 (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.42 / (download) - annotate - [select for diffs], Wed Jul 9 11:31:43 2014 UTC (6 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1, VERSION_1_12_4, VERSION_1_12
Changes since 1.41: +3 -2 lines
Diff to previous 1.41 (colored)

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

Revision 1.41 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:04 2014 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +11 -11 lines
Diff to previous 1.40 (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.40 / (download) - annotate - [select for diffs], Wed Mar 19 21:51:20 2014 UTC (6 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (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.39 / (download) - annotate - [select for diffs], Mon Jan 6 21:34:31 2014 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (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.38 / (download) - annotate - [select for diffs], Sun Jan 5 20:26:36 2014 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

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

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

While here, garbage collect the unused void *arg attribute of
struct mparse and mparse_alloc() and fix some errors in mandoc(3).

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

Revision 1.37 / (download) - annotate - [select for diffs], Sun Jan 5 19:10:56 2014 UTC (6 years, 8 months ago) by joerg
Branch: MAIN
Changes since 1.36: +4 -1 lines
Diff to previous 1.36 (colored)

Tag functions with format strings as arguments as printf-like.
Fix one case where a non-literal is used as format string.
Fix another case where a variable is formatted using the wrong type.

Revision 1.36 / (download) - annotate - [select for diffs], Tue Dec 31 23:23:10 2013 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

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

Revision 1.35 / (download) - annotate - [select for diffs], Sun Dec 15 21:23:52 2013 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Sat Oct 5 22:15:03 2013 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +3 -3 lines
Diff to previous 1.33 (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.33 / (download) - annotate - [select for diffs], Sat Oct 5 22:08:12 2013 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +4 -9 lines
Diff to previous 1.32 (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.32 / (download) - annotate - [select for diffs], Mon Nov 19 17:57:23 2012 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_2
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (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.31 / (download) - annotate - [select for diffs], Tue Jun 12 20:21:04 2012 UTC (8 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.30: +3 -2 lines
Diff to previous 1.30 (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.30 / (download) - annotate - [select for diffs], Sun May 27 17:48:57 2012 UTC (8 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

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

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

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

Revision 1.29 / (download) - annotate - [select for diffs], Fri Dec 2 01:37:14 2011 UTC (8 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.28: +2 -1 lines
Diff to previous 1.28 (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.28 / (download) - annotate - [select for diffs], Thu Jul 28 14:17:11 2011 UTC (9 years, 1 month ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_0, VERSION_1_11_7, VERSION_1_11_6
Changes since 1.27: +2 -1 lines
Diff to previous 1.27 (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.27 / (download) - annotate - [select for diffs], Wed Jul 27 12:41:02 2011 UTC (9 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.26: +3 -1 lines
Diff to previous 1.26 (colored)

Disable in-line eqn processing for a bit.

Revision 1.26 / (download) - annotate - [select for diffs], Wed Jul 27 07:32:26 2011 UTC (9 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.25: +1 -2 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Mon Jul 25 15:37:00 2011 UTC (9 years, 1 month ago) by kristaps
Branch: MAIN
Changes since 1.24: +5 -1 lines
Diff to previous 1.24 (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.24 / (download) - annotate - [select for diffs], Thu Jul 21 15:21:13 2011 UTC (9 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_5
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

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

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jul 18 07:46:41 2011 UTC (9 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +7 -33 lines
Diff to previous 1.22 (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.22 / (download) - annotate - [select for diffs], Sun Jul 17 11:14:53 2011 UTC (9 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +1 -2 lines
Diff to previous 1.21 (colored)

Remove prototype since moved into mandoc.h.

Revision 1.21 / (download) - annotate - [select for diffs], Sat May 14 16:06:09 2011 UTC (9 years, 4 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_4, VERSION_1_11_3
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

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

Revision 1.20 / (download) - annotate - [select for diffs], Tue Apr 19 16:38:48 2011 UTC (9 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_2
Changes since 1.19: +2 -3 lines
Diff to previous 1.19 (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.19 / (download) - annotate - [select for diffs], Sun Apr 17 09:08:19 2011 UTC (9 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.18: +3 -2 lines
Diff to previous 1.18 (colored)

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

Revision 1.18 / (download) - annotate - [select for diffs], Sat Apr 9 15:29:40 2011 UTC (9 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +1 -2 lines
Diff to previous 1.17 (colored)

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

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

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

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

Revision 1.17 / (download) - annotate - [select for diffs], Mon Mar 28 23:52:13 2011 UTC (9 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_1
Changes since 1.16: +2 -1 lines
Diff to previous 1.16 (colored)

Have libman and libmdoc use mandoc_getcontrol() to determine whether a
macro has been invoked.  libroff is next.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Mar 22 14:05:45 2011 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.15: +10 -13 lines
Diff to previous 1.15 (colored)

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

Revision 1.15 / (download) - annotate - [select for diffs], Tue Mar 22 10:02:50 2011 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Step 3: consolidate manuals.  The parse functions in mdoc.h, roff.h, and
man.h are now part of libmandoc.h, so remove these from their respective
manuals (they're no longer public-facing and we don't need a libmandoc.3
(yet?)).  Before that, move the juicy data (parse tree syntax) into
new-born mandoc.3.  Peck around in Makefile and index.sgml to reflect
reality.

Revision 1.14 / (download) - annotate - [select for diffs], Tue Mar 22 09:48:13 2011 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +90 -11 lines
Diff to previous 1.13 (colored)

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

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

Revision 1.13 / (download) - annotate - [select for diffs], Sun Mar 20 16:02:05 2011 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +11 -7 lines
Diff to previous 1.12 (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.12 / (download) - annotate - [select for diffs], Thu Mar 17 08:49:34 2011 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_10
Changes since 1.11: +1 -4 lines
Diff to previous 1.11 (colored)

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

Revision 1.11 / (download) - annotate - [select for diffs], Mon Mar 7 01:35:51 2011 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +2 -6 lines
Diff to previous 1.10 (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.10 / (download) - annotate - [select for diffs], Mon Jan 3 22:42:37 2011 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_10_9
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (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.9 / (download) - annotate - [select for diffs], Sun Jul 18 17:00:26 2010 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_10_8, VERSION_1_10_7, VERSION_1_10_6, VERSION_1_10_5_PREPDF, VERSION_1_10_5
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (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"

"looks fine" to kristaps@; tested by jmc@ and sobrado@

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jun 19 20:46:27 2010 UTC (10 years, 3 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_4, VERSION_1_10_3, VERSION_1_10_2
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

Churn as I finish email address migration kth.se -> bsd.lv.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jun 9 19:22:56 2010 UTC (10 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

Squash bug noted by Ulrich Spoerlein where "-" were being converted to
ASCII_HYPH, as per normal, but were screwing up mandoc_special().  Fixed
by making mandoc_special() first check isspace() instead of ! isgraph(),
then normalise its string as it passes out.  This require de-constifying
some validation routines not already de-constified (those in libman),
but that's ok, because I'd like to be pushing actions into validation
routines to save on space and redundant calculations.

Revision 1.6 / (download) - annotate - [select for diffs], Tue May 25 12:37:20 2010 UTC (10 years, 3 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_1
Changes since 1.5: +2 -1 lines
Diff to previous 1.5 (colored)

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

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

Revision 1.5 / (download) - annotate - [select for diffs], Wed May 12 17:08:03 2010 UTC (10 years, 4 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_25
Changes since 1.4: +2 -1 lines
Diff to previous 1.4 (colored)

Put the eos-checker into libmandoc.h.
Added bits in mdoc.7 and man.7 about EOS spacing.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Nov 2 06:22:45 2009 UTC (10 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_24, VERSION_1_9_23, VERSION_1_9_22, VERSION_1_9_21, VERSION_1_9_20, VERSION_1_9_19, VERSION_1_9_18, VERSION_1_9_17, VERSION_1_9_16, VERSION_1_9_15-pre2, VERSION_1_9_15-pre1, VERSION_1_9_15, VERSION_1_9_14, VERSION_1_9_13
Changes since 1.3: +6 -1 lines
Diff to previous 1.3 (colored)

Added mandoc_a2time() for proper date conversion.
Fitted TH and Dd handlers to use mandoc_a2time().
Documented date syntax for -man, fixed documentation for -mdoc.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Oct 30 05:58:37 2009 UTC (10 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_12
Changes since 1.2: +1 -2 lines
Diff to previous 1.2 (colored)

libmdoc and libman now using non-recoverable allocations (simpler code).

Revision 1.2 / (download) - annotate - [select for diffs], Wed Oct 28 19:21:59 2009 UTC (10 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +6 -1 lines
Diff to previous 1.1 (colored)

Slow movement of internal allocations to fail completely.

Revision 1.1 / (download) - annotate - [select for diffs], Sat Jul 4 09:01:55 2009 UTC (11 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_9, VERSION_1_9_8, VERSION_1_9_7, VERSION_1_9_6, VERSION_1_9_5, VERSION_1_9_2, VERSION_1_9_11, VERSION_1_9_10, VERSION_1_9_1, VERSION_1_9_0, VERSION_1_8_5, VERSION_1_8_4, VERSION_1_8_3, VERSION_1_8_2, VERSION_1_8_1, VERSION_1_8_0, VERSION_1_7_24, VERSION_1_7_23, VERSION_1_7_22, VERSION_1_7_21

Moved escape validation into libmandoc.h/mandoc.c (common between libman/libmdoc1).
libman supports MAN_IGN_ESCAPE (like MDOC_IGN_ESCAPE).
All popular escapes now handled consistently.

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