OpenBSD CVS

CVS log for src/usr.bin/mandoc/mdoc_argv.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.76 / (download) - annotate - [select for diffs], Thu Jul 11 16:56:52 2019 UTC (4 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, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, HEAD
Changes since 1.75: +3 -2 lines
Diff to previous 1.75 (colored)

When parsing a tab character that is not preceded by a space character
on an .It -column line, args() sets the MDOC_PHRASEQL flag to Quote
the Last word of the Phrase.  Even if it turns out this quoting is not
needed because the word is already quoted for other reasons, clear the
flag at the end of parsing the phrase, such that the flag does not leak
to the next phrase.

This patch fixes the bug that the trailing Macro on a line of the form
.It "word<tab>word" Ta word Macro<eol>
was incorrectly considered quoted and hence not parsed.

Bug found by Havard Eidnes (he@) with the NetBSD gettytab(5) manual page:
https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54361
Reported via Thomas Klausner (wiz@).

Revision 1.75 / (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_5_BASE, OPENBSD_6_5
Changes since 1.74: +19 -13 lines
Diff to previous 1.74 (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.74 / (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.73: +2 -2 lines
Diff to previous 1.73 (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.73 / (download) - annotate - [select for diffs], Fri Dec 14 05:17:45 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +5 -7 lines
Diff to previous 1.72 (colored)

Almost mechanical diff to remove the "struct mparse *" argument
from mandoc_msg(), where it is no longer used.
While here, rename mandoc_vmsg() to mandoc_msg() and retire the
old version:  There is really no point in having another function
merely to save "%s" in a few places.
Minus 140 lines of code.

Revision 1.72 / (download) - annotate - [select for diffs], Fri Aug 17 20:31:52 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.71: +6 -7 lines
Diff to previous 1.71 (colored)

Remove more pointer arithmetic passing via regions outside the array
that is undefined according to the C standard.  Robert Elz <kre at
munnari dot oz dot au> pointed out i wasn't quite done yet.

Revision 1.71 / (download) - annotate - [select for diffs], Tue May 30 16:21:07 2017 UTC (6 years, 11 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.70: +4 -4 lines
Diff to previous 1.70 (colored)

Macro argument quoting does not prevent recognition of punctuation
and of called macros.

This bug affects almost all macros, and fixing it simplifies the
code.  It is amazing that the bogus ARGS_QWORD feature got implemented
in the first place, and then carrier along for more than eight years
without anybody ever noticing that it was pointless.

Reported by Leah Neukirchen <leah at vuxu dot org>, found on Void Linux.

Revision 1.70 / (download) - annotate - [select for diffs], Fri May 5 15:16:25 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.69: +1 -2 lines
Diff to previous 1.69 (colored)

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

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

move .ll to the roff modules

Revision 1.68 / (download) - annotate - [select for diffs], Thu May 4 17:48:24 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.67: +1 -2 lines
Diff to previous 1.67 (colored)

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

Revision 1.67 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:09 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.66: +7 -5 lines
Diff to previous 1.66 (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.66 / (download) - annotate - [select for diffs], Fri Mar 3 15:04:51 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.65: +10 -9 lines
Diff to previous 1.65 (colored)

Markdown output mode helped us to find the first parser bug (as such,
this bug could cause wrong output in other modes as well):
Do not misinterpret tab characters as .Ta macros when they appear
on non-column .It lines in non-column .Bl lists that are nested
inside a parent .Bl -column list.  (Admittedly, such constructions
are not very useful; don't use them!)
Found by tb@ with afl(1) because the resulting tree corruption
triggered an assertion in the markdown output module.

Revision 1.65 / (download) - annotate - [select for diffs], Sun Aug 28 16:13:51 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

If a line inside .Bl -column starts with a tab character
and there was no preceding .It macro, do not read the byte
before the beginning of the line buffer.
Found by tb@ with afl@.

Revision 1.64 / (download) - annotate - [select for diffs], Fri Jul 15 18:02:32 2016 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.63: +2 -1 lines
Diff to previous 1.63 (colored)

add missing prototypes, no code change;
noticed by Christos Zoulas with -Wmissing-prototypes

Revision 1.63 / (download) - annotate - [select for diffs], Sat Oct 17 00:19:58 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.62: +46 -16 lines
Diff to previous 1.62 (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.62 / (download) - annotate - [select for diffs], Thu Oct 15 22:45:07 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +28 -73 lines
Diff to previous 1.61 (colored)

Simplify the part of args() that is handling .Bl -column phrases:
Delete manual "Ta" handling because macro handling should
not be done in an argument parser but should be left to the
macro parsers, which exist anyway and work well.
No functional change, minus 40 lines of code.

Confusing and redundant code found while investigating
an old bug report from tim@.

Revision 1.61 / (download) - annotate - [select for diffs], Tue Oct 6 18:30:44 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +17 -17 lines
Diff to previous 1.60 (colored)

modernize style: "return" is not a function; ok cmp(1)

Revision 1.60 / (download) - annotate - [select for diffs], Sun Apr 19 13:59:37 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.59: +2 -2 lines
Diff to previous 1.59 (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.59 / (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.58: +10 -10 lines
Diff to previous 1.58 (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.58 / (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.57: +4 -4 lines
Diff to previous 1.57 (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.57 / (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.56: +7 -6 lines
Diff to previous 1.56 (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.56 / (download) - annotate - [select for diffs], Wed Feb 4 18:58:09 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.55: +2 -2 lines
Diff to previous 1.55 (colored)

fix column numbers of macro arguments in messages

Revision 1.55 / (download) - annotate - [select for diffs], Sat Nov 29 03:37:28 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.54: +7 -12 lines
Diff to previous 1.54 (colored)

Provide a helper function macro_or_word() and use it to prune the
same chunk of argument parsing code out of five of the eight callback
functions.  The other three have too much special handling to
participate.
As a bonus, let lookup() and mdoc_args() deal with line macros and
retire the lookup_raw() helper and the mdoc_zargs() internal interface
function.
No functional change, minus 40 lines of code.

Revision 1.54 / (download) - annotate - [select for diffs], Fri Nov 28 23:20:55 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +82 -75 lines
Diff to previous 1.53 (colored)

Fold the loop around mdoc_argv() into the function itself,
it was the same in all four cases.  As a bonus, get rid
of one enum type that was used for internal communication.
No functional change, minus 40 lines of code.

Revision 1.53 / (download) - annotate - [select for diffs], Fri Nov 28 03:13:58 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +12 -22 lines
Diff to previous 1.52 (colored)

Simplify the code by making various mdoc parser helper functions void.
No functional change, minus 130 lines of code.

Revision 1.52 / (download) - annotate - [select for diffs], Sun Jul 6 19:08:56 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.51: +9 -5 lines
Diff to previous 1.51 (colored)

Clean up messages related to plain text and to escape sequences.
* Mention invalid escape sequences and string names, and fallbacks.
* Hierarchical naming.

Revision 1.51 / (download) - annotate - [select for diffs], Wed Jul 2 03:47:07 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +4 -4 lines
Diff to previous 1.50 (colored)

Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,
since this is hardly more complicated than explicitly ignoring them
as we did in the past.  Of course, do not use them!

Revision 1.50 / (download) - annotate - [select for diffs], Wed Apr 23 21:06:33 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.49: +5 -5 lines
Diff to previous 1.49 (colored)

Audit malloc(3)/calloc(3)/realloc(3) usage.
* Change eight reallocs to reallocarray to be safe from overflows.
* Change one malloc to reallocarray to be safe from overflows.
* Change one calloc to reallocarray, no zeroing needed.
* Change the order of arguments of three callocs (aesthetical).

Revision 1.49 / (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.48: +46 -46 lines
Diff to previous 1.48 (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.48 / (download) - annotate - [select for diffs], Sun Mar 30 19:47:32 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.47: +2 -1 lines
Diff to previous 1.47 (colored)

Implement the roff(7) .ll (line length) request.
Found by naddy@ in the textproc/enchant(1) port.
Of course, do not use this in new manuals.

Revision 1.47 / (download) - annotate - [select for diffs], Fri Mar 21 22:17:01 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +2 -1 lines
Diff to previous 1.46 (colored)

The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions.  Split the auxiliaries out into their own file and header.
While here, do some #include cleanup.

Revision 1.46 / (download) - annotate - [select for diffs], Wed Dec 25 00:50:03 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.45: +4 -4 lines
Diff to previous 1.45 (colored)

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

Revision 1.45 / (download) - annotate - [select for diffs], Sun Dec 22 14:06:29 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +2 -2 lines
Diff to previous 1.44 (colored)

Fix end-of-sentence spacing after the DragonFly text production macro.
Patch from Franco Fichtner <franco at lastsummer dot de>.

Revision 1.44 / (download) - annotate - [select for diffs], Sun Dec 15 23:56:21 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +13 -1 lines
Diff to previous 1.43 (colored)

In quoted macro arguments, double quotes can be quoted by doubling them.
For a long time, we handle this in roff(7) and man(7) macros.
Now add correct handling for the mdoc(7) case, too.

Closely based on a patch by Tsugutomo dot ENAMI at jp dot sony dot com,
see http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=48438
received via Thomas Klausner (wiz@), slightly tweaked by me.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Nov 18 00:05:28 2012 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.42: +4 -4 lines
Diff to previous 1.42 (colored)

Fix four small whitespace issues related to trailing punctuation
reported by Nicolas Joly <njoly at pasteur dot fr>:

- add EOS spacing after trailing punctuation after .Cd, .Fc, and .Lb
- suppress spacing before trailing punctuation after .Fd

Revision 1.42 / (download) - annotate - [select for diffs], Sat Nov 17 00:25:20 2012 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +30 -30 lines
Diff to previous 1.41 (colored)

Cleanup naming of local variables to make the code easier on the eye:
Settle for "struct man *man", "struct mdoc *mdoc", "struct meta *meta"
and avoid the confusing "*m" which was sometimes this, sometimes that.
No functional change.

ok kristaps@ some time ago

Revision 1.41 / (download) - annotate - [select for diffs], Fri Nov 16 18:40:39 2012 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +4 -3 lines
Diff to previous 1.40 (colored)

Two more macros (.Ap and .In) do trailing delimiter handling.
This fixes the end of sentence spacing in open(2)
and in about 150 pages in the NetBSD base system.

Reported by Nicolas Joly <njoly a pasteur point fr>, merci!

Revision 1.40 / (download) - annotate - [select for diffs], Sun Apr 15 10:31:00 2012 UTC (12 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.39: +4 -38 lines
Diff to previous 1.39 (colored)

Two bugfixes regarding the -width and -offset macro arguments:
1) They consume the next argument even if it starts with a dash.
2) When -width is the last argument on the line such that the
actual width argument is missing, downgrade from a fatal to a
non-fatal error, just like for -offset.  The formatting still
doesn't agree with groff, but at least we don't die any longer.

Item 2 was observed and that part of the patch coded by kristaps@,
who found lots of instances of this particular formatting error
in Mac OSX manuals.

Revision 1.39 / (download) - annotate - [select for diffs], Tue Jul 5 04:12:41 2011 UTC (12 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.38: +185 -235 lines
Diff to previous 1.38 (colored)

Sync to bsd.lv (all coded by kristaps@):
 - mdoc(7): fix an assertion if the first line after .Bd -column
   starts with a blank, and some simplifications in mdoc_argv.c
 - man(7): literal mode ends at .SH and .SS (bug reported by naddy@)
 - allow .RS/.RE blocks to nest (bug reported by dcoppa@ and gsoares@)
 - improve vertical spacing of man(7) blocks
 - roff(7): clear user-defined strings when starting a new file
 - correct ID tags in -T[x]html

Revision 1.38 / (download) - annotate - [select for diffs], Sun May 29 21:22:18 2011 UTC (12 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +186 -223 lines
Diff to previous 1.37 (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.37 / (download) - annotate - [select for diffs], Sun Apr 24 16:22:02 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.36: +77 -44 lines
Diff to previous 1.36 (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.36 / (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.35: +126 -148 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Wed Dec 29 00:47:31 2010 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.34: +2 -3 lines
Diff to previous 1.34 (colored)

Reorg by Kristaps:  In libmdoc, replace the union of pointers to structs
of macro-specific data by a pointer to a union of structs, which makes the
code simpler and more robust at the expense of a small memory overhead.
Merging was somewhat difficult because we mustn't break tbl(1) support
which the bsd.lv version does not yet have.

Revision 1.34 / (download) - annotate - [select for diffs], Mon Sep 13 20:10:11 2010 UTC (13 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +3 -3 lines
Diff to previous 1.33 (colored)

Prevent .Pp and .Lp from looping endlessly on punctuation.
Fix for .Pp from kristaps@, i applied the same to .Lp.
Bug reported by espie@.

Revision 1.33 / (download) - annotate - [select for diffs], Sun Jul 25 18:05:54 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.32: +6 -4 lines
Diff to previous 1.32 (colored)

Sync to bsd.lv; in particular, pull in lots of bug fixes.
new features:
* support the .in macro in man(7)
* support minimal PDF output
* support .Sm in mdoc(7) HTML output
* support .Vb and .nf in man(7) HTML output
* complete the mdoc(7) manual
bug fixes:
* do not let mdoc(7) .Pp produce a newline before/after .Sh; reported by jmc@
* avoid double blank lines related to man(7) .sp and .br
* let man(7) .nf and .fi flush the line; reported by jsg@ and naddy@
* let "\ " produce a non-breaking space; reported by deraadt@
* discard \m colour escape sequences; reported by J.C. Roberts
* map undefined 1-character-escapes to the literal character itself
maintenance:
* express mdoc(7) arguments in terms of an enum for additional type-safety
* simplify mandoc_special() and a2roffdeco()
* use strcspn in term_word() in place of a manual loop
* minor optimisations in the -Tps and -Thtml formatting frontends

Revision 1.32 / (download) - annotate - [select for diffs], Tue Jul 13 01:09:13 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +4 -3 lines
Diff to previous 1.31 (colored)

Merge release 1.10.4 (all code by kristaps@), providing four new features:
1) Proper .Bk support: allow output line breaks at input line breaks,
but keep input lines together in the output, finally fixing
synopses like aucat(1), mail(1) and tmux(1).
2) Mostly finished -Tps (PostScript) output.
3) Implement -Thtml output for .Nm blocks and .Bk -words.
4) Allow iterative interpolation of user-defined roff(7) strings.
Also contains some minor bugfixes and some performance improvements.

Revision 1.31 / (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.30: +3 -3 lines
Diff to previous 1.30 (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.30 / (download) - annotate - [select for diffs], Sun Jun 6 20:30:08 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +22 -27 lines
Diff to previous 1.29 (colored)

Merge bsd.lv version 1.10.1 (to be released soon).

The main step forward is that this now has *much* better .Bl -column
support, now supporting many manuals that previously errored out
without producing any output.

Other fixes include:
* do not die from multiple list types, use the first and warn
* in .Bl without a type, default to -item
* various tweaks to .Dt
* fix .In, .Fd, .Ft, .Fn and .Fo formatting
* some documentation fixes and additions
* and fix a couple of bugs reported by Ulrich Spoerlein:
* better support for roff block-end "\}" without a preceding dot
* .In must not break the line outside SYNOPSIS
* spelling in some error messages

While merging, fix one regression in .In spacing
that needs to go to bsd.lv, too.

Revision 1.29 / (download) - annotate - [select for diffs], Sun May 23 22:45:00 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +12 -10 lines
Diff to previous 1.28 (colored)

Unified error and warning message system for all of mandoc,
featuring three message levels, as agreed during the mandoc hackathon:
* FATAL parser failure, cannot produce any output from this input file:
  eventually, we hope to convert most of these to ERRORs.
* ERROR, meaning mandoc cannot cope fully with the input syntax and will
  probably lose information or produce structurally garbled output;
  it will try to produce output anyway but exit non-zero at the end,
  which is eventually intended to make the ports infrastructure happy.
* WARNING, meaning you should clean up the input file, but output
  is probably mostly OK, so this will not cause error-exit at the end.
This commit is mostly just converting the old system to the new one; before
the classification will become really reliable, we must check all messages.

In particular,
* set up a new central message string table in main.c
* drop the old message string tables from man.c and mdoc.c
* get rid of the piece-meal merr enums in libman and libmdoc
* reduce number of error/warning functions from 16 to 6 (still a lot...)

While here, handle a few problems more gracefully:
* allow .Rv and .Ex to work without a prior .Nm
* allow .An to ignore extra arguments
* allow undeclared columns in .Bl -column

Written by kristaps@.

Revision 1.28 / (download) - annotate - [select for diffs], Sat May 15 13:12:55 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.27: +39 -19 lines
Diff to previous 1.27 (colored)

proper handling of quoted tab-separated column lists
by kristaps@

Revision 1.27 / (download) - annotate - [select for diffs], Sat May 15 12:30:59 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.26: +4 -3 lines
Diff to previous 1.26 (colored)

Distinguish OPEN, MIDDLE and CLOSE delimiters (using an enum).
Only OPEN are drawn before the beginning of a macro;
this is new, before this, MIDDLE ('|') were drawn in front, too.
Only CLOSE are pushed after the end of a macro (as before).
ok kristaps@

This allows us to finally enable handling of leading punctuation
without regressions.

Revision 1.26 / (download) - annotate - [select for diffs], Fri May 14 19:52:43 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.25: +1 -2 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Fri May 14 14:47:44 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.24: +10 -7 lines
Diff to previous 1.24 (colored)

Merge 1.9.25, keeping local patches;
this does not merge kristaps' end-of-sentences handling yet,
i will check that separately.  This one includes:
* handle \*(Ba as a delimiter
* introduce ARGS_PEND for .Bl -column .It end-of-line special casing
* section ordering: expect EXIT STATUS at the right place
* line break fixes in SYNOPSIS
* allow literal contexts to have arbitrary line lengths
* the input file column number can not be used to identify the beginning
  of a line because white space is allowed after the initial '.'
* proper leading spaces in -man -Tascii mode
* do not let Lb break lines in -mdoc -Thtml LIBRARY

Revision 1.24 / (download) - annotate - [select for diffs], Fri May 14 01:54:37 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.23: +29 -22 lines
Diff to previous 1.23 (colored)

merge 1.9.24, keeping local patches; some changes:
* preserve multiple consecutive space characters in input
* do not restrict .Cd and .Rv to certain sections (requested by Joerg)
* do not run lookup() on quoted words
* enum return types for mdoc_args and mdoc_argv
* fix auto-closing of LINK tag in -Txhtml (from Daniel Friesel)
* various lint and manual fixes

Revision 1.23 / (download) - annotate - [select for diffs], Sat Apr 3 16:30:42 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.22: +21 -16 lines
Diff to previous 1.22 (colored)

When two conflicting list types are specified for the same list,
use the first, discard the second, and warn.  No need to bail out.

ok deraadt@

Revision 1.22 / (download) - annotate - [select for diffs], Fri Apr 2 12:39:47 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.21: +7 -7 lines
Diff to previous 1.21 (colored)

merge 1.9.22, keeping local patches
* convert mdoc tokens from #define to enum
* fix a segfault with .Xo/.Xc in explicit blocks
* Thorn is \*(Th, not \*(TH; noticed by Joerg Sonnenberger

Revision 1.21 / (download) - annotate - [select for diffs], Tue Mar 2 00:38:59 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.20: +1 -0 lines
Diff to previous 1.20 (colored)

Proper inter-sentence spacing for mdoc(7).
When a text line or a non-block macro line in the source code ends
in any of ".!?", consider that an end of sentence (EOS).
This makes Jason's rule "new sentence, new line" even more important.
Let the parser detect the EOS and insert a token into the AST.
Let the -Tascii frontend render the EOS token as a double space before
the next word.

Revision 1.20 / (download) - annotate - [select for diffs], Tue Mar 2 00:13:57 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored)

Distinguish opening and closing delimiters, and close out block
macros after closing delimiters only, not after opening ones.  Besides,
neither roff nor old nor new groff consider braces { } as delimiters.

This fixes some frequent misrenderings by mandoc,
for example ".Ql (" being rendered as "`'(" instead of "`('".

Revision 1.19 / (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.18: +14 -33 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Tue Oct 27 21:40:07 2009 UTC (14 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +2 -1 lines
Diff to previous 1.17 (colored)

sync to 1.9.11: adapt printing of dates to groff conventions,
NetBSD portability fixes and some minor bugfixes and feature enhancements;
also checked that my hyphenation code still works on top of this

Revision 1.17 / (download) - annotate - [select for diffs], Wed Oct 21 19:13:50 2009 UTC (14 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +4 -2 lines
Diff to previous 1.16 (colored)

sync to 1.9.9, featuring:
 * -Thtml output mode
 * roff scaling units
 * and some minor fixes
for full changelogs, see http://bsd.lv/cgi-bin/cvsweb.cgi/

Revision 1.16 / (download) - annotate - [select for diffs], Mon Oct 19 21:00:43 2009 UTC (14 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +31 -31 lines
Diff to previous 1.15 (colored)

sync to 1.9.7: avoid using the same identifier for a static function
and for a local variable in another function in the same compilation unit;
suggested by Ulrich Spoerlein, uqs at spoerlein dot net

Revision 1.15 / (download) - annotate - [select for diffs], Mon Oct 19 15:44:01 2009 UTC (14 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +7 -3 lines
Diff to previous 1.14 (colored)

sync to 1.9.6: do not die from .Bd -literal -offset w/o arg (and similar)
Actually, our ancient groff behaves slightly differently than this fix,
but not to die is already an improvement.  Needs a closer look later.

Revision 1.14 / (download) - annotate - [select for diffs], Sat Aug 22 22:50:17 2009 UTC (14 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

sync to 1.9.1: .Rv and .Ex accept multiple arguments

Revision 1.13 / (download) - annotate - [select for diffs], Sat Aug 22 22:39:55 2009 UTC (14 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +30 -13 lines
Diff to previous 1.12 (colored)

sync to 1.9.1: correctly flag delimiter whitespace

Revision 1.12 / (download) - annotate - [select for diffs], Sun Jul 26 22:48:41 2009 UTC (14 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +156 -201 lines
Diff to previous 1.11 (colored)

sync to 1.8.1: rewrite quoted literal handling correctly,
rewrite TABSEP handling in a simpler way,
and retire ECOLEMPTY, ARGS_QUOTED and ARGS_ARGVLIKE

Revision 1.11 / (download) - annotate - [select for diffs], Sun Jul 26 02:17:29 2009 UTC (14 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +3 -9 lines
Diff to previous 1.10 (colored)

sync to 1.8.1: removed excessively verbose EARGVPARM warning

Revision 1.10 / (download) - annotate - [select for diffs], Sun Jul 26 01:59:46 2009 UTC (14 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.9: +3 -1 lines
Diff to previous 1.9 (colored)

sync to 1.8.1: support .br and .sp

Revision 1.9 / (download) - annotate - [select for diffs], Sun Jul 12 23:26:08 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.8: +1 -2 lines
Diff to previous 1.8 (colored)

sync to 1.7.24: remove long-fixed FIXME

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jul 12 22:35:08 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +14 -51 lines
Diff to previous 1.7 (colored)

sync to 1.7.23: pass warning code to mdoc_pwarn() instead of warning message
define additional warning macro mdoc_nwarn()
remove obsolete warning functions mdoc_warn(), pwarn(), vwarn(), nwarn()
remove various now unused "enum mdoc_warn" and "enum mwarn"

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jul 12 21:45:44 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +3 -29 lines
Diff to previous 1.6 (colored)

sync to 1.7.23: pass error code to mdoc_perr() instead of error string
and use the so improved mdoc_nerr() at many places;
get rid of now unused static functions perr()

Revision 1.6 / (download) - annotate - [select for diffs], Sun Jul 12 21:08:29 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +19 -19 lines
Diff to previous 1.5 (colored)

sync to 1.7.23: pass error code to mdoc_nerr() instead of error string
and use the so improved mdoc_nerr() at many places

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jul 12 20:30:27 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.4: +1 -7 lines
Diff to previous 1.4 (colored)

sync to 1.7.23: unify the various "enum merr" into libman.h and libmdoc.h,
use it as a new argument to mdoc_err(), the same way as for for man_err(),
and use string tables instead of switch statements to select error messages

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jun 21 19:09:58 2009 UTC (14 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.3: +7 -9 lines
Diff to previous 1.3 (colored)

sync to 1.7.19: .Bl -column  now correctly handles tail entries,
for example:  .Bl -column -compact -offset ... args ...

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 18 23:34:53 2009 UTC (14 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.2: +2 -3 lines
Diff to previous 1.2 (colored)

sync to 1.7.19: improved comment handling

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jun 14 23:00:57 2009 UTC (14 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.1: +11 -13 lines
Diff to previous 1.1 (colored)

sync to 1.7.16: comments, whitespace and spelling fixes; no functional change

Revision 1.1 / (download) - annotate - [select for diffs], Mon Apr 6 20:30:40 2009 UTC (15 years, 1 month ago) by kristaps
Branch: MAIN

Initial check-in of mandoc for formatting manuals. ok deraadt@

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.