OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.151 / (download) - annotate - [select for diffs], Mon Dec 26 19:16:02 2022 UTC (16 months, 3 weeks ago) by jmc
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, HEAD
Changes since 1.150: +2 -2 lines
Diff to previous 1.150 (colored)

spelling fixes; from paul tagliamonte
amendments to his diff are noted on tech

Revision 1.150 / (download) - annotate - [select for diffs], Tue Aug 16 17:44:53 2022 UTC (21 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.149: +38 -7 lines
Diff to previous 1.149 (colored)

When starting a new input line, even when continuing the same output
line, use the current output position as the reference position
for tabs on that input line.  This brings mandoc in line with the
behaviour of GNU, Heirloom, and Plan 9 roff.

Revision 1.149 / (download) - annotate - [select for diffs], Mon Aug 15 17:59:00 2022 UTC (21 months ago) by schwarze
Branch: MAIN
Changes since 1.148: +17 -7 lines
Diff to previous 1.148 (colored)

Distinguish between escape sequences that produce no output
whatsoever (for example \fR) and escape sequences that produce
invisible zero-width output (for example \&).  No, i'm not joking,
groff does make that distinction, and it has consequences in some
situations, for example for vertical spacing in no-fill mode.
Heirloom and Plan 9 behaviour is subtly different, but in case of
doubt, we want to follow groff.

While this fixes the behaviour for the majority of escape sequences,
in particular for those most likely to occur in practice, it is not
perfect yet because some of the more exotic ESCAPE_IGNORE sequences
are actually of the "no output whatsoever" type but treated
as "invisible zero-width" for now.  With the new ASCII_NBRZW mechanism
in place, switching them over one by one when the need arises will
no longer be very difficult.

Revision 1.148 / (download) - annotate - [select for diffs], Mon Aug 15 13:01:40 2022 UTC (21 months ago) by schwarze
Branch: MAIN
Changes since 1.147: +11 -8 lines
Diff to previous 1.147 (colored)

In GNU, Heirloom, and Plan 9 roff, tab positions apply to *input* lines,
not to *output* lines.  In particular, if an input line gets broken in
fill mode and a tab occurs in the second output line, it advances to a
position of at least (width of the first output line) + (width of a
space character even though this is never printed) + (width of the part
of the second output line that precedes the tab).

Implement the same logic in mandoc.

Again, do not use tabs in filled text: they have surprising effects,
including this one.

Revision 1.147 / (download) - annotate - [select for diffs], Mon Aug 15 10:21:01 2022 UTC (21 months ago) by schwarze
Branch: MAIN
Changes since 1.146: +16 -20 lines
Diff to previous 1.146 (colored)

In GNU, Heirloom, and Plan 9 roff, literal tab characters are
non-breakable in exactly the same way as "\ ".  That is, the preceding
word, the tab character, and the following word are always kept
together on the same output line.  If filling is enabled and an
output line break is required before the end of the following word,
the break occurs before the beginning of the preceding word.

Make mandoc behave in the same way.

Of course, using literal tab characters in filled text remains a
bad idea, and the "WARNING: tab in filled text" remains unchanged.

Revision 1.146 / (download) - annotate - [select for diffs], Wed Apr 27 13:30:19 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.145: +18 -4 lines
Diff to previous 1.145 (colored)

Fix three bugs regarding the interaction of \z and \h:

1. The combination \z\h is a no-op whatever the argument may be.
In the past, the \z only affected the first space character generated
by the \h, which was wrong.

2. For the conbination \zX\h with a positive argument, the first
space resulting from the \h is not printed but consumed by the \z.

3. For the combination \zX\h with a negative argument, application
of the \z needs to be completed before the \h can be started.
In the past, if this combination occurred at the beginning of an
output line, the \h backed up to the beginning of the line and
after that, the \z attempted to back up even further, triggering
an assertion.

Bugs found during an audit of assignments to termp->col that i
started after the bugfix tbl_term.c rev. 1.65.  The assertion
triggered by bug 3 was *not* yet found by afl(1).

Revision 1.145 / (download) - annotate - [select for diffs], Mon Jan 10 17:59:45 2022 UTC (2 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.144: +8 -6 lines
Diff to previous 1.144 (colored)

When rendering the \h (horizontal motion) low-level roff(7) escape
sequence in -T ps and -T pdf output mode, use an appropriate
horizontal distance by correctly using the term_len() utility
function.  Output from the -T ascii, -T utf8, and -T html modes
was already correct and remains unchanged.

Lennart Jablonka <hummsmith42 at gmail dot com> found and reported
this unit conversion bug (misinterpreting AFM units as if they were
en units) when rendering scdoc-generated manuals (which is a low
quality generator, but that's no excuse for mandoc misformatting \h)
on Alpine Linux.  Lennart also tested this patch.

Revision 1.144 / (download) - annotate - [select for diffs], Mon Oct 4 18:56:24 2021 UTC (2 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.143: +3 -2 lines
Diff to previous 1.143 (colored)

Provide a cleanup function for the term_tab module, freeing memory
and resetting the internal state to the initial state.
Call this function from the proper place in term_free().

With the way the module is currently used, this does not imply any
functional change, but doing proper cleanup is more robust, makes
it easier during code review to understand what is going on, and
makes it explicit that there is no memory leak.

Revision 1.143 / (download) - annotate - [select for diffs], Tue Aug 10 12:36:42 2021 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.142: +4 -2 lines
Diff to previous 1.142 (colored)

Support two-character font names (BI, CW, CR, CB, CI)
in the tbl(7) layout font modifier.

Get rid of the TBL_CELL_BOLD and TBL_CELL_ITALIC flags and use
the usual ESCAPE_FONT* enum mandoc_esc members from mandoc.h instead,
which simplifies and unifies some code.

While here, also support CB and CI in roff(7) \f escape sequences
and in roff(7) .ft requests for all output modes.  Using those is
certainly not recommended because portability is limited even with
groff, but supporting them makes some existing third-party manual
pages look better, in particular in HTML output mode.

Bug-compatible with groff as far as i'm aware, except that i consider
font names starting with the '\n' (ASCII 0x0a line feed) character
so insane that i decided to not support them.

Missing feature reported by nabijaczleweli dot xyz in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992002.
I used none of the code from the initial patch submitted by
nabijaczleweli, but some of their ideas.
Final patch tested by them, too.

Revision 1.142 / (download) - annotate - [select for diffs], Wed Sep 2 16:36:48 2020 UTC (3 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.141: +9 -12 lines
Diff to previous 1.141 (colored)

Do not indent by SIZE_MAX/2 when .ce occurs inside explicit no-fill mode.
While here, drop two unused arguments from the function term_field();
the related work was already done by term_fill() before this commit.

I found the bug in an afl run
that was performed by Jan Schreiber <jes at posteo dot de>.

Revision 1.141 / (download) - annotate - [select for diffs], Mon Jun 3 20:23:39 2019 UTC (4 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.140: +3 -1 lines
Diff to previous 1.140 (colored)

Explicitly state that the cases in the inner switch in term_fill()
are exhaustive.  While there is no bug, being explicit has no downside
is is potentially safer for the future.

Michal Nowak <mnowak at startmail dot com> reported that gcc 4.4.4
and 7.4.0 on illumos throw -Wuninitialized false positives.

Revision 1.140 / (download) - annotate - [select for diffs], Tue Jan 15 12:15:52 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.139: +4 -3 lines
Diff to previous 1.139 (colored)

In PostScript and PDF output, one AFM unit is not nearly enough
inter-word spacing, let's try again with 250 AFM units.
Regression caused during my recent term_flushln() reorg in rev. 1.138,
reported by brynet@ (sorry and many thanks for reporting).

Revision 1.139 / (download) - annotate - [select for diffs], Fri Jan 4 03:20:44 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.138: +16 -2 lines
Diff to previous 1.138 (colored)

Implement centering and adjustment to the right margin directly in
the terminal filling routine, controlled by new flags TERMP_CENTER
and TERMP_RIGHT.
This became possible by the recent term_flushln() rewrite.
No functional change yet, but to be used by upcoming commits.

Revision 1.138 / (download) - annotate - [select for diffs], Thu Jan 3 19:59:11 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.137: +253 -179 lines
Diff to previous 1.137 (colored)

Rewrite the line filling function for terminal output yet again.
This function has always been among the most complicated parts of
mandoc, and it repeatedly needed substantial functional enhancements.
The present rewrite is required to prepare for the implementation
of simultaneous filling and centering of output lines.

The previous implementation looked at each word in turn and printed
it to the output stream as soon as it was found to still fit on the
current output line.  Obviously, that approach neither allows
centering nor adjustment to the right margin.

The new implementation first decides which part of the paragraph
to put onto the current output line, also measuring the display
width of that part, even if that part consists of multiple words
including intervening whitespace.  This will allow moving the whole
output line to the right as desired before printing it, for example
to center it or to adjust it to the right margin.

The function is split into three parts, each much shorter, solving a
better defined task, much easier to understand and better commented:
1. the steering function term_flushln() looping over output lines;
2. the calculation function term_fill() looping over input characters;
3. and the output function term_field() looping over printed characters.

No functional change yet.

Revision 1.137 / (download) - annotate - [select for diffs], Sat Dec 15 19:30:19 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.136: +11 -9 lines
Diff to previous 1.136 (colored)

Several improvements to escape sequence handling.

* Add the missing special character \_ (underscore).
* Partial implementations of \a (leader character)
and \E (uninterpreted escape character).
* Parse and ignore \r (reverse line feed).
* Add a WARNING message about undefined escape sequences.
* Add an UNSUPP message about unsupported escape sequences.
* Mark \! and \? (transparent throughput)
and \O (suppress output) as unsupported.
* Treat the various variants of zero-width spaces as one-byte escape
sequences rather than as special characters, to avoid defining bogus
forms with square brackets.
* For special characters with one-byte names, do not define bogus
forms with square brackets, except for \[-], which is valid.
* In the form with square brackets, undefined special characters do not
fall back to printing the name verbatim, not even for one-byte names.
* Starting a special character name with a blank is an error.
* Undefined escape sequences never abort formatting of the input
string, not even in HTML output mode.
* Document the newly handled escapes, and a few that were missing.
* Regression tests for most of the above.

Revision 1.136 / (download) - annotate - [select for diffs], Thu Oct 25 01:21:30 2018 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +2 -1 lines
Diff to previous 1.135 (colored)

Implement the \f(CW and \f(CR (constant width font) escape sequences
for HTML output.  Somewhat relevant because pod2man(1) relies on this.
Missing feature reported by Pali dot Rohar at gmail dot com.

Note that constant width font was already correctly selected before
this when required by semantic markup.  Only attempting physical
markup with the low-level escape sequence was ineffective.

Revision 1.135 / (download) - annotate - [select for diffs], Thu Aug 16 13:49:40 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.134: +27 -2 lines
Diff to previous 1.134 (colored)

Implement the \*(.T predefined string (interpolate device name)
by allowing the preprocessor to pass it through to the formatters.
Used for example by the groff_char(7) manual page.

Revision 1.134 / (download) - annotate - [select for diffs], Fri Jul 28 14:24:17 2017 UTC (6 years, 9 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.133: +2 -2 lines
Diff to previous 1.133 (colored)

use & to check if a bit is set in a flag; pointed out by clang
OK schwarze

Revision 1.133 / (download) - annotate - [select for diffs], Wed Jun 14 23:23:51 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +7 -2 lines
Diff to previous 1.132 (colored)

implement so-called absolute horizontal motion: \h'|...',
used for example by zoem(1)

Revision 1.132 / (download) - annotate - [select for diffs], Wed Jun 14 18:23:26 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.131: +6 -6 lines
Diff to previous 1.131 (colored)

let \l use the right fill character

Revision 1.131 / (download) - annotate - [select for diffs], Wed Jun 14 17:50:43 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +18 -4 lines
Diff to previous 1.130 (colored)

improve rounding rules for scaling units
in horizontal orientation in the terminal formatter

Revision 1.130 / (download) - annotate - [select for diffs], Wed Jun 14 01:31:19 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.129: +33 -1 lines
Diff to previous 1.129 (colored)

implement the roff(7) \p (break output line) escape sequence

Revision 1.129 / (download) - annotate - [select for diffs], Mon Jun 12 18:55:42 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.128: +40 -25 lines
Diff to previous 1.128 (colored)

Implement automatic line breaking
inside individual table cells that contain text blocks.
This cures overlong lines in various Xenocara manuals.

Revision 1.128 / (download) - annotate - [select for diffs], Thu Jun 8 12:54:40 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.127: +5 -14 lines
Diff to previous 1.127 (colored)

make the internal a2roffsu() interface more powerful by returning
a pointer to the end of the parsed data, making it easier to
parse subsequent bytes

Revision 1.127 / (download) - annotate - [select for diffs], Wed Jun 7 20:01:07 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +40 -25 lines
Diff to previous 1.126 (colored)

Prepare the terminal driver for filling multiple columns in parallel,
second step: make the per-column byte pointer persistent across
term_flushln() calls, such that a subsequent call can continue at
the point where the previous call left.  If more than one column
is in use, return from term_flushln() when the column is full,
rather than breaking the output line.

No functional change, because nothing sets up multiple columns yet.

Revision 1.126 / (download) - annotate - [select for diffs], Wed Jun 7 17:38:08 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.125: +70 -68 lines
Diff to previous 1.125 (colored)

Prepare the terminal driver for filling multiple columns in parallel,
first step: split column data out of the terminal state struct into
a new column state struct and use an array of such column state
structs.  No functional change.

Revision 1.125 / (download) - annotate - [select for diffs], Wed Jun 7 02:13:52 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.124: +28 -15 lines
Diff to previous 1.124 (colored)

The \h escape sequence provides another method for moving backwards,
and after that, previously written output gets overwritten, but
overwriting with blanks does *not* erase previously written content.
Yes, manual pages exist that are crazy enough to rely on that...

Revision 1.124 / (download) - annotate - [select for diffs], Sun Jun 4 22:43:50 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +61 -40 lines
Diff to previous 1.123 (colored)

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

Revision 1.123 / (download) - annotate - [select for diffs], Sun Jun 4 18:48:09 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +25 -62 lines
Diff to previous 1.122 (colored)

Make term_flushln() simpler and more robust:
Eliminate the "overstep" state variable.
The information is already contained in "viscol".
Minus 60 lines of code, no functional change intended.

Revision 1.122 / (download) - annotate - [select for diffs], Fri Jun 2 19:21:03 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.121: +58 -2 lines
Diff to previous 1.121 (colored)

Partial implementation of \h (horizontal line drawing function).
A full implementation would require access to output device properties
and state variables (both only available after the main parser has
finalized the parse tree) before numerical expansions in the roff
preprocessor (i.e., before the main parser is even started).

Not trying to pull that stunt right now because the static-width
implementation committed here is sufficient for tcl-style manual pages
and already more complicated than i would have suspected.

Revision 1.121 / (download) - annotate - [select for diffs], Thu Jun 1 19:05:15 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +23 -1 lines
Diff to previous 1.120 (colored)

Minimal implementation of the \h (horizontal motion) escape sequence.
Good enough to cope with the average DocBook insanity.

Revision 1.120 / (download) - annotate - [select for diffs], Sun May 7 17:30:58 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.119: +15 -12 lines
Diff to previous 1.119 (colored)

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

Revision 1.119 / (download) - annotate - [select for diffs], Sun Jan 8 18:08:44 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.118: +15 -3 lines
Diff to previous 1.118 (colored)

Fix an assertion failure caused by \z\[u00FF] with -Tps/-Tpdf.
Reported by jsg@ after an afl(1) run long ago.

Revision 1.118 / (download) - annotate - [select for diffs], Wed Aug 10 11:02:30 2016 UTC (7 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.117: +6 -4 lines
Diff to previous 1.117 (colored)

Fix assertion failures caused by whitespace inside \o'' (overstrike)
sequences that jsg@ found with afl(1):
* Avoid writing \t\b in term.c.
* Handle trailing \b in term_ps.c.

Revision 1.117 / (download) - annotate - [select for diffs], Sun Mar 20 16:50:30 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.116: +2 -2 lines
Diff to previous 1.116 (colored)

" the the " -> " the ", or in a couple of cases replace the superfluous
"the" with the obviously intended word.

Started with a "the the" spotted by Mihal Mazurek.

Revision 1.116 / (download) - annotate - [select for diffs], Thu Jan 7 21:03:23 2016 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.115: +2 -2 lines
Diff to previous 1.115 (colored)

This code wasted memory by allocating sizeof(enum termfont *)
where only sizeof(enum termfont) is needed.
Fixes CID 1288941.  From christos@ via wiz@, both at NetBSD.

Revision 1.115 / (download) - annotate - [select for diffs], Fri Oct 23 14:49:13 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +2 -2 lines
Diff to previous 1.114 (colored)

apply bold and italic to all non-ASCII Unicode codepoints,
fixing input like \fB\('e; issue reported by bentley@

Revision 1.114 / (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.113: +5 -8 lines
Diff to previous 1.113 (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.113 / (download) - annotate - [select for diffs], Mon Oct 12 00:07:27 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +1 -5 lines
Diff to previous 1.112 (colored)

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

Revision 1.112 / (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.111: +7 -7 lines
Diff to previous 1.111 (colored)

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

Revision 1.111 / (download) - annotate - [select for diffs], Sat Sep 26 00:53:15 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +1 -2 lines
Diff to previous 1.110 (colored)

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

Revision 1.110 / (download) - annotate - [select for diffs], Mon Sep 21 13:24:32 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +7 -1 lines
Diff to previous 1.109 (colored)

Trailing whitespace is significant when determining the width of a tag
in mdoc(7) .Bl -tag and man(7) .TP, but not in man(7) .IP.
Quirk reported by Jan Stary <hans at stare dot cz> on ports@.

Revision 1.109 / (download) - annotate - [select for diffs], Sun Aug 30 21:10:40 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +8 -2 lines
Diff to previous 1.108 (colored)

Drop leading, internal, and trailing blank characters in \o (overstrike)
escape sequences; that's cleaner for all output modes, and it's required
to prevent the PostScript/PDF formatter from dying on assertions.
Bug found by jsg@ with afl.

Revision 1.108 / (download) - annotate - [select for diffs], Wed Apr 29 18:32:57 2015 UTC (9 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.107: +27 -43 lines
Diff to previous 1.107 (colored)

Replace the kludge for the \z escape sequence by an actual
implementation.  As a side effect, minus ten lines of code.

As another side effect, this also fixes the assertion failure that
used to be triggered by "\z\o'ab'c" at the beginning of an output
line, found by jsg@ with afl (test case 022/Apr27).

Revision 1.107 / (download) - annotate - [select for diffs], Sat Apr 4 17:46:58 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.106: +6 -6 lines
Diff to previous 1.106 (colored)

Rounding rules for horizontal scaling widths are more complicated.
There is a first rounding to basic units on the input side.
After that, rounding rules differ between requests and macros.
Requests round to the nearest possible character position.
Macros round to the next character position to the left.

Implement that by changing the return value of term_hspan()
to basic units and leaving the second scaling and rounding stage
to the formatters instead of doing it in the terminal handler.

Improves for example argtable2(3).

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

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

Revision 1.105 / (download) - annotate - [select for diffs], Mon Mar 9 17:35:13 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.104: +2 -1 lines
Diff to previous 1.104 (colored)

prevent the skipvsp flag from creeping past actual text

Revision 1.104 / (download) - annotate - [select for diffs], Sat Jan 31 00:11:52 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.103: +7 -15 lines
Diff to previous 1.103 (colored)

Use relative offsets instead of absolute pointers for the terminal
font stack.  The latter fail after the stack is grown with realloc().
Fixing an assertion failure found by jsg@ with afl some time ago
(test case number 51).

Revision 1.103 / (download) - annotate - [select for diffs], Wed Jan 21 20:20:49 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +27 -2 lines
Diff to previous 1.102 (colored)

Rudimentary implementation of the roff(7) \o escape sequence (overstrike).
This is of some relevance because the pod2man(1) preamble abuses it
for the icelandic letter Thorn, instead of simply using \(TP and \(Tp.
Missing feature found by sthen@ in DateTime::Locale::is_IS(3p).

Revision 1.102 / (download) - annotate - [select for diffs], Wed Dec 24 23:31:59 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +2 -2 lines
Diff to previous 1.101 (colored)

Support negative indentations for mdoc(7) displays and lists.
Not exactly recommended for use, rather for groff compatibility.
While here, introduce similar SHRT_MAX limits as in man(7),
fixing a few cases of infinite output found by jsg@ with afl.

Revision 1.101 / (download) - annotate - [select for diffs], Wed Dec 24 09:57:41 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +4 -2 lines
Diff to previous 1.100 (colored)

When a man(7) document contains unreasonably large numbers for
indentations or paragraph distances, large output may be generated,
which is practically the same as an endless loop; found by jsg@
with afl.
Reject such unreasonably large numbers beyond arbitrary limits
similar to those used by groff (max. 65 blank lines between paragraphs
and max. SHRT_MAX characters per output line) and fall back to
defaults when exceeded.  Having the limits behave in exactly the
same way is not relevant.

Revision 1.100 / (download) - annotate - [select for diffs], Tue Dec 23 13:48:15 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +9 -15 lines
Diff to previous 1.99 (colored)

support negative horizontal widths in man(7);
minus twenty lines of code in spite of enhanced functionality

Revision 1.99 / (download) - annotate - [select for diffs], Tue Dec 23 06:16:21 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +19 -8 lines
Diff to previous 1.98 (colored)

Fix vertical scaling.  Obviously, nobody ever had a serious look at this.
Basic units, centimeters, points, ens, ems, and the rounding algorithm
were all wrong, only inches, pica, and the default vertical span worked.

Revision 1.98 / (download) - annotate - [select for diffs], Fri Dec 19 17:10:42 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.97: +19 -15 lines
Diff to previous 1.97 (colored)

Enforcing an arbitrary, implementation dependent, undocumented limit
by calling assert() when valid user input exceeds it is a bad idea.
Allocate the terminal font stack dynamically instead of crashing
above 10 entries.  Issue found by jsg@ with afl.

Revision 1.97 / (download) - annotate - [select for diffs], Tue Dec 2 10:07:17 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +3 -3 lines
Diff to previous 1.96 (colored)

Fix the implementation and documentation of \c (continue text input line).
In particular, make it work in no-fill mode, too.
Reminded by Carsten dot Kunze at arcor dot de (Heirloom roff).

Revision 1.96 / (download) - annotate - [select for diffs], Fri Nov 21 01:52:45 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +13 -9 lines
Diff to previous 1.95 (colored)

We repeatedly observed assertion crashes in the low-level terminal
output handler because the high level terminal formatters could be
tricked into setting the left margin further to the right than the
right margin.  Today, jsg@ found more of these with afl.

Change the internal interface between both levels, aiming for
simplicity and robustness of the code.  Treat both margins as
*independent* settings:  Now, termp.offset is the requested left
margin, and termp.rmargin is the available space.  Let the lower
level cope with that case of insufficient space.

Obviously, high level code that does centering or flush right
still has to do careful checks, so i did a full audit of margin
settings in the terminal formatters.

Fixes crashes caused by excessively long title or date strings in
the man(7) footer, operating system or date strings in the mdoc(7)
footer, volume strings in the man(7) or mdoc(7) header, and a few
cases related to some non-prologue macros.

Revision 1.95 / (download) - annotate - [select for diffs], Sun Nov 16 21:29:27 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.94: +4 -2 lines
Diff to previous 1.94 (colored)

When a line (in the sense of term_flushln()) contains white space only,
the `vbl' variable includes the left margin, but `vis' does not.
Prevent a `vis' underflow that caused a bogus blank line.
Bug reported by Carsten Kunze, found in less(1): .Bl -tag ... .It " "

Revision 1.94 / (download) - annotate - [select for diffs], Sat Nov 1 04:03:22 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

fix a typo causing crashes in Unicode string length measurement

Revision 1.93 / (download) - annotate - [select for diffs], Wed Oct 29 00:17:01 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +65 -39 lines
Diff to previous 1.92 (colored)

In terminal output, unify handling of Unicode and numbered character
escape sequences just like it was earlier implemented for -Thtml.
Do not let control characters other than ASCII 9 (horizontal tab)
propagate to the output, even though groff allows them; but that
really doesn't look like a great idea.

Let mchars_num2char() return int such that we can distinguish invalid \N
syntax from \N'0'.  This also reduces the danger of signed char issues
popping up.

Revision 1.92 / (download) - annotate - [select for diffs], Tue Oct 28 18:48:56 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.91: +4 -10 lines
Diff to previous 1.91 (colored)

In -Tascii mode, print "<?>" only for Unicode escapes of unknown
representation, not for character escapes with unknown names.
According to groff, the latter produce no output, and we now warn
about them.

Revision 1.91 / (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.90: +2 -6 lines
Diff to previous 1.90 (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.90 / (download) - annotate - [select for diffs], Mon Oct 27 13:29:30 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +5 -7 lines
Diff to previous 1.89 (colored)

Fix a regression in term.c rev. 1.89 reported by bentley@:
In UTF-8 output, do not print anything if mchars_spec2cp() returns 0.
In particular, this repairs handling of zero-width spaces (\&).

While here, let mchars_spec2cp() return 0xFFFD instead of -1
if the character is not found, simplifying the using code.
In HTML output, do not print obfuscated ASCII characters and
do not test for one-char escapes, mchars_spec2cp() already does that.

Revision 1.89 / (download) - annotate - [select for diffs], Sun Oct 26 17:11:18 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +40 -54 lines
Diff to previous 1.88 (colored)

Improve -Tascii output for Unicode escape sequences: For the first 512
code points, provide ASCII approximations.  This is already much better
than what groff does, which prints nothing for most code points.

A few minor fixes while here:
* Handle Unicode escape sequences in the ASCII range.
* In case of errors, use the REPLACEMENT CHARACTER U+FFFD for -Tutf8
and the string "<?>" for -Tascii output.
* Handle all one-character escape sequences in mchars_spec2{cp,str}()
and remove the workarounds on the higher level.

Revision 1.88 / (download) - annotate - [select for diffs], Mon Aug 18 22:21:52 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 (colored)

Fix read access to uninitialized memory found by kristaps@ with valgrind,
patch from kristaps@.
Theoretically, this could lead to a buffer overrun and segfault,
but only for very long output lines (about 1000 charecters) of
exactly the right length or if by ill chance, the complete unused,
uninitialized tail of the line output buffer (at least 1000 characters
total length) would contain all blank characters.  Anyway, the
uninitialized data read wasn't used for anything.

Revision 1.87 / (download) - annotate - [select for diffs], Fri Aug 8 16:02:55 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +3 -3 lines
Diff to previous 1.86 (colored)

Fix floating point handling: When converting double to size_t,
properly round to the nearest M (=0.001m), which is the smallest
available unit.

This avoids weirdness like (size_t)(0.6 * 10.0) == 5
by instead calculating (size_t)(0.6 * 10.0 + 0.0005) == 6,
and so it fixes the indentation of the readline(3) manual.

Revision 1.86 / (download) - annotate - [select for diffs], Fri Aug 8 16:00:23 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +7 -7 lines
Diff to previous 1.85 (colored)

Clarity with respect to floating point handling:
Write double constants as double rather than integer literals.
Remove useless explicit (double) cast done at one place and nowhere else.
No functional change.

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

After skipping an escape sequence with incomplete arguments,
do not throw away the rest of the string to be rendered.

Revision 1.84 / (download) - annotate - [select for diffs], Wed Apr 23 21:06:33 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (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.83 / (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.82: +48 -60 lines
Diff to previous 1.82 (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.82 / (download) - annotate - [select for diffs], Tue Apr 8 07:13:01 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.81: +21 -28 lines
Diff to previous 1.81 (colored)

Add a new term_flushln() flag TERMP_BRIND (if break, then indent)
to control indentation of continuation lines in TERMP_NOBREAK mode.
In the past, this was always on; continue using it
for .Bl, .Nm, .Fn, .Fo, and .HP, but no longer for .IP and .TP.

I looked at this because sthen@ reported the issue in a manual
of a Perl module from ports, but it affects base, too: This patch
reduces groff-mandoc differences in base by more than 15%.

Revision 1.81 / (download) - annotate - [select for diffs], Sat Apr 5 21:17:48 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.80: +6 -6 lines
Diff to previous 1.80 (colored)

bugfix: make sure all variables are properly initialized
when rendering .ll (line length) requests.  oops.

Revision 1.80 / (download) - annotate - [select for diffs], Sun Mar 30 21:27:59 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.79: +31 -1 lines
Diff to previous 1.79 (colored)

Support relative arguments to .ll (increase or decrease line length).

Revision 1.79 / (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.78: +2 -2 lines
Diff to previous 1.78 (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.78 / (download) - annotate - [select for diffs], Thu Mar 13 19:23:11 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +8 -7 lines
Diff to previous 1.77 (colored)

In -Tutf8 mode, make sure that hyphens get counted against the output line
length even when they are breakable.  Before this, a line containing N
breakable hyphens could get up to N characters wider than the right margin
in -Tutf8 output mode.
Issue reported by tedu@ on bugs@.

Revision 1.77 / (download) - annotate - [select for diffs], Wed Jan 22 20:58:35 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.76: +10 -4 lines
Diff to previous 1.76 (colored)

Implement the \: (optional line break) escape sequence,
documented in the Ossanna-Kernighan-Ritter troff manual
and also supported by groff.

Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.

Revision 1.76 / (download) - annotate - [select for diffs], Tue Dec 31 18:07:06 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +1 -2 lines
Diff to previous 1.75 (colored)

remove assignments that will be overwritten right afterwards,
and remove pointless local variables;
found in a clang output from Ulrich Spoerlein <uqs at FreeBSD>

Revision 1.75 / (download) - annotate - [select for diffs], Wed Dec 25 00:39:13 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +12 -2 lines
Diff to previous 1.74 (colored)

Do not break output lines in .Fn function arguments in SYNOPSIS mode.
Following an idea from Franco Fichtner, but implemented more cleanly.
This reduces groff-mandoc-differences in base by a fantastic 7.5%.

Revision 1.74 / (download) - annotate - [select for diffs], Tue Dec 24 23:04:29 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

Delete the unused flag TERMP_IGNDELIM
and the empty callback termp_igndelim_pre().
Sort the remaining termp flags.

Revision 1.73 / (download) - annotate - [select for diffs], Mon Dec 23 02:19:57 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +15 -4 lines
Diff to previous 1.72 (colored)

Implement a long-standing desideratum,
hanging indentation for .Fn in SYNOPSIS mode,
exploiting the new trailspace feature
by deliberately *NOT* using it.

Revision 1.72 / (download) - annotate - [select for diffs], Sun Dec 22 23:33:52 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +6 -8 lines
Diff to previous 1.71 (colored)

Polishing the worms in my favourite can, term_flushln().

The TERMP_TWOSPACE flag i introduced in August 2009 was idiosyncratic
and served only a very narrow purpose.  Replace it by a more intuitive
and more general termp attribute "trailspace", to be used together
with TERMP_NOBREAK, to request a minimum amount of whitespace at
the end of the current column.  Adapt all code to the new interface.

No functional change intended;
code reviews to confirm that are welcome *eg*.

Revision 1.71 / (download) - annotate - [select for diffs], Wed Aug 21 21:19:47 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +15 -19 lines
Diff to previous 1.70 (colored)

Move the last column-counting members of struct termp (col and maxcols)
from int to size_t, to match some existing ones (offset, *rmargin, viscol).
Move some related local variables from int to size_t as well.

Needed as a preparation to make a generalized adjbuf() function available
beyond the file term.c, i.e. in mandoc.c.
Also saves a couple of ugly casts.

Revision 1.70 / (download) - annotate - [select for diffs], Thu Aug 8 20:07:24 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.69: +23 -29 lines
Diff to previous 1.69 (colored)

Implement the roff(7) font-escape sequence \f(BI "bold+italic".
This improves the formatting of about 40 base manuals
and reduces groff-mandoc formatting differences in base by about 5%.

Revision 1.69 / (download) - annotate - [select for diffs], Mon Aug 5 23:35:02 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

After a leading blank on an output line, the first word was counted twice
against vend, causing a premature line break.  Fix that bug by reverting
revision 1.10 which Kristaps committed four years ago.  Kristaps patch is no
longer needed because the code below  /* Write out the [remaining] word. */
now handles leading blanks correctly, probably already for a long time.

This avoids premature line breaks in about a dozen base system manuals,
for example as(1) and gdb(1), and alignment issues in another twenty,
for example mount(2), ip6(4), pfctl(8), and crypto(9).

Revision 1.68 / (download) - annotate - [select for diffs], Wed May 29 15:15:49 2013 UTC (10 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.67: +3 -3 lines
Diff to previous 1.67 (colored)

In keep mode, if any text is printed (even in NOSPACE mode),
any text that follows must be kept on the same line.

I already found the issue and wrote the patch in April 2011,
but didn't come round to do proper testing and forgot about it.

Revision 1.67 / (download) - annotate - [select for diffs], Fri Nov 16 17:16:29 2012 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.66: +2 -2 lines
Diff to previous 1.66 (colored)

Improve formatting of badly nested font blocks.
The basic idea is to already pop the font at the end marker
instead of allowing it to linger until the final end of the block.

This requires a few preliminaries:
* For each block, save a pointer to the previous font
  to be used in case the block breaks another and gets extended.
* That requires making node information writable during rendering.
* Now fonts may get popped in the wrong order; hence, after the stack
  has already been rewound further by some block that began earlier,
  ignore popping a font that was put on the stack later.
* To be able to exploit all this for font blocks, tie processing
  to their body, not their block, which is more logical anyway.

Triggered by florian@ reporting vaguely similar issues with list blocks.

Revision 1.66 / (download) - annotate - [select for diffs], Mon Jul 16 21:28:12 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.65: +9 -1 lines
Diff to previous 1.65 (colored)

Release polishing: finally fix the perl(1) SYNOPSIS.
In flush-left mode of both man(7) and mdoc(7), when an output line is broken
at the position of a literal tab, the tab indents the following line.
Reminded by deraadt@ in Pest, Ujlipotvaros, Csanady utza.

Revision 1.65 / (download) - annotate - [select for diffs], Tue Jul 10 15:33:40 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +2 -7 lines
Diff to previous 1.64 (colored)

Remove a hack that was intended for groff-1.15 bug compatibility:
When the width of a tag in .Bl -hang was exactly one character
shorter than the maximum length that would fit, the following text
would have a negative hang of one character (i.e., hang to the left).
That bug is no longer present in groff-1.21, so relax mandoc, too.

Revision 1.64 / (download) - annotate - [select for diffs], Mon May 28 13:00:51 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +54 -14 lines
Diff to previous 1.63 (colored)

Implement the roff \z escape sequence, intended to output the next
character without advancing the cursor position; implement it to
simply skip the next character, as it will usually be overwritten.

With this change, the pod2man(1) preamble user-defined string \*:,
intended to render as a diaeresis or umlaut diacritic above the
preceding character, is rendered in a slightly less ugly way,
though still not correctly.  It was rendered as "z.." and is now
rendered as ".".

Given that the definition of \*: uses elaborate manual \h positioning,
there is little chance for mandoc(1) to ever render it correctly,
but at least we can refrain from printing out a spurious "z", and
we can make the \z do something semi-reasonable for easier cases.

Revision 1.63 / (download) - annotate - [select for diffs], Sun May 27 01:01:24 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +6 -3 lines
Diff to previous 1.62 (colored)

Fix the vertical spacing around tbl(7) instances in man(7).

Groff forces the document author to manually request sufficient spacing
after .TE - that is, at least .sp 1v after a table with the "box" option
and at least .sp 2v after a table with the "doublebox" option - or else
it clobbers the box.  I consider that insane, so i'm not imitating groff
in that respect.  Instead, i add at least as much vertical space as groff,
or more where required to avoid clobbering the box.

Consequently, output will be identical for input that looks sane with
groff, and mandoc will make output look better for input that looks bad
with groff.

As a side effect, having identical output for portable input
makes it possible to set up the first regression tests for tbl(7).

Revision 1.62 / (download) - annotate - [select for diffs], Wed Sep 21 09:57:11 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.61: +4 -6 lines
Diff to previous 1.61 (colored)

As noticed by kristaps@, when breaking an overflowing line,
forget about pending whitespace (vbl), or the next line would
be misaligned and potentially too long; but i'm fixing this
in a simpler way than he proposed.
Also remove the kludges in .HP that compensated for this bug.

Revision 1.61 / (download) - annotate - [select for diffs], Mon Sep 19 22:36:11 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +25 -34 lines
Diff to previous 1.60 (colored)

Remove the terminal frontend flag TERMP_NOLPAD.

In columnated contexts (.Bl -column, .Bl -tag, .IP, .TP, .HP etc.), do not
pad after writing a column.  Instead, always pad before writing content.

In itself, this change avoids:
 - writing trailing whitespace in some situations
 - with .fi/.nf in .HP, breaking lines that were already padded

It allows several bugfixes included in this patch:
 - Do not count backspace as a character with positive width.
 - Set up proper indentation when encountering .fi/.nf in .HP.
 - Adjust the .HP indentation width to what groff does.
 - Never unlimit the right margin unless in the final column.

This reduces the groff/mandoc-differences in base by nearly 20%,
from 89k to 72k lines of diffs.

ok kristaps@

Revision 1.60 / (download) - annotate - [select for diffs], Sun Sep 18 20:38:02 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +5 -2 lines
Diff to previous 1.59 (colored)

fix a regression introduced in 1.11.7:
even a breakable hyphen may be bold or underlined

With this fix, 1.11.7 reduces the groff/mandoc differences in
base by about 10% (100k -> 90k lines of diffs) with respect to 1.11.5.

Revision 1.59 / (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.58: +179 -138 lines
Diff to previous 1.58 (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.58 / (download) - annotate - [select for diffs], Sun Apr 24 16:22:02 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.57: +2 -12 lines
Diff to previous 1.57 (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.57 / (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.56: +9 -50 lines
Diff to previous 1.56 (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.56 / (download) - annotate - [select for diffs], Sun Jan 30 16:05:29 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.55: +16 -2 lines
Diff to previous 1.55 (colored)

Implement the \N'number' (numbered character) roff escape sequence.
Don't use it in new manuals, it is inherently non-portable, but we
need it for backward-compatibility with existing manuals, for example
in Xenocara driver pages.
ok kristaps@ matthieu@ jmc@

Revision 1.55 / (download) - annotate - [select for diffs], Tue Jan 4 22:28:17 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.54: +7 -1 lines
Diff to previous 1.54 (colored)

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

Revision 1.54 / (download) - annotate - [select for diffs], Wed Oct 27 19:27:30 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +2 -2 lines
Diff to previous 1.53 (colored)

Fix an off-by-one in an assertion, crashing the renderer on ".Os \&".
This bug was a living fossil, introduced on Feb 21, 2009.
Reported by joachimschipper dot nl, thanks.

Revision 1.53 / (download) - annotate - [select for diffs], Sat Oct 2 15:11:54 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +15 -23 lines
Diff to previous 1.52 (colored)

style cleanup, no functional change:
* make the initial maxvis/mmax calculation easier to understand
* where real, non-indexing casts happen, make them explicit
* avoid a few lint warnings that can easily be fixed
* remove one needless LINTED comment
"I like this" kristaps@

Revision 1.52 / (download) - annotate - [select for diffs], Fri Oct 1 21:38:26 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored)

* need a space before .No even if it starts with a closing delimiter
* slightly simplify .Pf *_IGNDELIM code, and share part of it with .No
* do not let opening delimiters fall out of the front of .Ns (from kristaps@)
This fixes a few spacing issues in csh(1) and ksh(1).
OK kristaps@

Revision 1.51 / (download) - annotate - [select for diffs], Thu Sep 23 20:22:31 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +4 -2 lines
Diff to previous 1.50 (colored)

Count trailing escaped blanks correctly;
those ruined the alignment of columns.
Tested by jmc@, and kristaps@ agrees with the direction.

Revision 1.50 / (download) - annotate - [select for diffs], Tue Sep 21 22:33:41 2010 UTC (13 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +45 -9 lines
Diff to previous 1.49 (colored)

When calculating string lengths, resolve escape sequences and use
their actual lengths.  Will improve vertical alignment in some
uncommon situations, for example when escape sequences occur in
list or column width strings or in .Nm block arguments in the SYNOPSIS.
From kristaps@.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Aug 20 23:34:00 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +4 -11 lines
Diff to previous 1.48 (colored)

Centralize handling of literal tabs in term_flushln() in one place,
making the code simpler and easier to understand.
No functional change.

Revision 1.48 / (download) - annotate - [select for diffs], Fri Aug 20 23:22:07 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +7 -1 lines
Diff to previous 1.47 (colored)

When a column contains trailing spaces, calculate the padding
to the start of the next column correctly.
Fixing a problem found by jmc@ in sysctl(3), reminded by kettenis@.

Revision 1.47 / (download) - annotate - [select for diffs], Fri Aug 20 00:53:35 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +3 -3 lines
Diff to previous 1.46 (colored)

Implement a simple, consistent user interface for error handling.
We now have sufficient practical experience to know what we want,
so this is intended to be final:
- provide -Wlevel (warning, error or fatal) to select what you care about
- provide -Wstop to stop after parsing a file with warnings you care about
- provide consistent exit status codes for those warnings you care about
- fully document what warnings, errors and fatal errors mean
- remove all other cruft from the user interface, less is more:
- remove all -f knobs along with the whole -f option
- remove the old -Werror because calling warnings "fatal" is silly
- always finish parsing each file, unless fatal errors prevent that
This commit also includes a couple of related simplifications behind
the scenes regarding error handling.
Feedback and OK  kristaps@;  Joerg Sonnenberger (NetBSD) and
Sascha Wildner (DragonFly BSD) agree with the general direction.

Revision 1.46 / (download) - annotate - [select for diffs], Sat Jul 31 21:43:07 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.45: +20 -23 lines
Diff to previous 1.45 (colored)

Merge bsd.lv version 1.10.5: last larger batch of bug fixes before release.
NOT including Kristaps' .Bd -literal changes which cause regressions.
Features:
* -Tpdf now fully working
Bugfixes:
* proper handling of quoted strings by .ds in roff(7)
* allow empty .Dd
* make .Sm start no-spacing after the first output word
* underline .Ad
* minor fixes in -Thtml
and some optimisations in terminal output.

Revision 1.45 / (download) - annotate - [select for diffs], Sun Jul 25 18:05:54 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +17 -13 lines
Diff to previous 1.44 (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.44 / (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.43: +10 -42 lines
Diff to previous 1.43 (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.43 / (download) - annotate - [select for diffs], Sat Jul 3 15:59:05 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.42: +7 -1 lines
Diff to previous 1.42 (colored)

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

Revision 1.42 / (download) - annotate - [select for diffs], Tue Jun 29 14:41:28 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +34 -27 lines
Diff to previous 1.41 (colored)

framework for glyph width encoding; from kristaps@

Revision 1.41 / (download) - annotate - [select for diffs], Sun Jun 27 21:54:42 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +1 -3 lines
Diff to previous 1.40 (colored)

Full .nr nS support, unbreaking the kernel manuals.

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

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

Revision 1.40 / (download) - annotate - [select for diffs], Sun Jun 27 01:24:02 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +8 -3 lines
Diff to previous 1.39 (colored)

Basic implementation of .Bk/.Ek.
OK and one stylistic tweak by kristaps@.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Jun 26 19:08:00 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +23 -5 lines
Diff to previous 1.38 (colored)

As a first step towards variable-width font support,
move all width calculations in term_*.c, *_width().
From kristaps.

Revision 1.38 / (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.37: +3 -6 lines
Diff to previous 1.37 (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.37 / (download) - annotate - [select for diffs], Thu Jun 10 22:50:10 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +36 -55 lines
Diff to previous 1.36 (colored)

minimal initial -Tps support, from kristaps@ GSOC
so far, monospace without font decoration,
but it already has page headers and footers

Revision 1.36 / (download) - annotate - [select for diffs], Tue Jun 8 00:11:47 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +25 -6 lines
Diff to previous 1.35 (colored)

Merge more bits that will be going into 1.10.1:

Clean up vertical spacing in the SYNOPSIS, making the code much more
systematic; this doesn't solve all SYNOPSIS problems yet, in particular
not those related to keeps, indentation and the low-level .nr roff
instruction, but it's a nice step forward and i couldn't find relevant
regressions.  (from kristaps)

Besides,
* make the output width configurable (default: -Owidth=80) (kristaps)
* use mmap with MAP_SHARED (from Joerg Sonnenberger)

Revision 1.35 / (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.34: +11 -7 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Sun May 23 22:45:01 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (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.33 / (download) - annotate - [select for diffs], Mon May 17 02:25:42 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.32: +40 -46 lines
Diff to previous 1.32 (colored)

The function term_flushln() had effectively forked wrt to bsd.lv.
This is the OpenBSD part of the main step to bring it back in sync.
At the same time, this prevents trailing whitespace in the output:
We delay writing blanks until we are sure printable characters follow.

This is achieved by
* not using vbl any longer for the control of line breaking
* such that vbl can sum up all kinds of white space
* before writing a word, printing all the blanks collected in vbl
* within the word, adding NBSP chars to vbl, then continuing with the word
* after the word, adding blanks to vbl, then starting the next word

Revision 1.32 / (download) - annotate - [select for diffs], Sat May 15 21:09:53 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.31: +9 -5 lines
Diff to previous 1.31 (colored)

More systematic output width handling by Joerg Sonnenberger:
* save and restore the output width when switching to MANT_LITERAL
* add an argument to ascii_alloc to specify the output width
* set the default output width to 80 minus 2 characters
* OpenBSD local: set the output width to 65 characters for -man

Revision 1.31 / (download) - annotate - [select for diffs], Fri May 14 19:52:43 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.30: +14 -13 lines
Diff to previous 1.30 (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.30 / (download) - annotate - [select for diffs], Fri Apr 23 00:23:47 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.29: +28 -4 lines
Diff to previous 1.29 (colored)

Handle literal tab characters both in literal context (.Bd -literal)
and outside.  In literal context, tab stops are at each eigth column;
outside, they are at each fifth column.

Use tabwidth = 5 as the default and temporarily switch to 8 in termp_bd_pre().
This requires to move the term_flushln() of the final line of a display from
termp_bd_post() to termp_bd_pre(); the former still needs term_newln()
to handle the final lines of non-literal displays.

Handling inside term_flushln() is tricky because a tab collapses with
inter-word spacing, but not with another tab.

Missing feature reported independently by jmc@ and deraadt@.

Revision 1.29 / (download) - annotate - [select for diffs], Tue Apr 13 22:41:48 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.28: +15 -5 lines
Diff to previous 1.28 (colored)

Fix rendering of multiple successive .It macros without intervening text;
another problem reported by jmc@.

The physical output line may contain output from more than one buffer.
Thus, to decide whether a line break is needed, it's insufficient to
only look at the number of bytes in the current output buffer.
Keep track of the number of characters already written, too.

Revision 1.28 / (download) - annotate - [select for diffs], Mon Apr 12 22:52:19 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.27: +2 -7 lines
Diff to previous 1.27 (colored)

Partial revert of term.c rev. 1.23
because jmc@ noticed that it broke blank lines in literal displays.

The original idea was to suppress stray blank lines.
But we don't want to suppress *all* blank lines,
instead just those caused by nested lists.
So do the check whether there was any output on this line,
i.e. whether or not to break the line,
at the right place, which is after processing the .It body.

Revision 1.27 / (download) - annotate - [select for diffs], Wed Apr 7 23:15:05 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.26: +4 -10 lines
Diff to previous 1.26 (colored)

Merge the good parts of 1.9.23,
avoid the bad parts of 1.9.23, and keep local patches.

Input in general:
 * Basic handling of roff-style font escapes \f, \F.
 * Quoted punctuation does not count as punctuation.

mdoc(7) parser:
 * Make .Pf callable; noted by Claus Assmann.
 * Let .Bd and .Bl ignore unknown arguments; noted by deraadt@.
 * Do not warn when .Er is used outside certain sections.
 * Replace mdoc_node_free[list] by mdoc_node_delete.
 * Replace #define by enum for rew*() return values.

man(7) parser:
 * When .TH is missing, use default section and date.

Output in general:
 * Curly braces do not count as punctuation.
 * No space after .Fl w/o args when a macro follows on the same line.

HTML output:
 * Unify PAIR_*_INIT macros, introduce new PAIR_ID_INIT().
 * Print whitespace after, not before .Vt .Fn .Ft .Fo.

Checked that all manuals in base still build.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Mar 26 01:22:07 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.25: +14 -16 lines
Diff to previous 1.25 (colored)

merge 1.9.17, keeping local patches

* much improved pod2man support and low-level roff robustness
* have -Tlint imply -Wall and -fstrict
* use fewer macros and more enum in libman
* and various bug fixes

Revision 1.25 / (download) - annotate - [select for diffs], Mon Mar 22 23:16:21 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

Only try to break the line at an existing hyphen
when there actually IS a hyphen.
Fixing an endless loop that broke the xenocara build.

Revision 1.24 / (download) - annotate - [select for diffs], Sat Mar 20 20:07:18 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

When the length of a single words exceeds the maximum acceptable line
length, rather ignore the right margin than entering an endless loop.
Found the hard way in /usr/xenocara/app/fvwm/modules/FvwmM4/FvwmM4.1.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Mar 6 11:27:55 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.22: +15 -13 lines
Diff to previous 1.22 (colored)

When the last field on an output line is empty, break the line
if and only if something was printed on that line.
This avoids double line breaks after nested lists
while still breaking lines after items with empty body.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Mar 5 20:46:48 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +33 -24 lines
Diff to previous 1.21 (colored)

At the end of lines, split words at existing hyphens:
Making pages look better and helping comparisons with groff output.

Note that proper hyphenation is postponed for now because it doesn't
really help the switch.

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
Changes since 1.20: +13 -7 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], Thu Dec 24 02:08:14 2009 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +174 -164 lines
Diff to previous 1.19 (colored)

sync to 1.9.14: rewrite escape sequence handling:
- new function a2roffdeco
- font modes (\f) only affect the current stack point
- implement scaling (\s)
- implement space suppression (\c)
- implement non-breaking space (\~) in -Tascii
- many manual improvements

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: +33 -21 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: +9 -7 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], Sat Oct 24 13:13:20 2009 UTC (14 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +5 -8 lines
Diff to previous 1.16 (colored)

simplify overstep handling, removing one local variable;
no functional change;
ok kristaps@ and merged as rev. 1.110

Revision 1.16 / (download) - annotate - [select for diffs], Wed Oct 21 19:13:51 2009 UTC (14 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +89 -32 lines
Diff to previous 1.15 (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.15 / (download) - annotate - [select for diffs], Mon Oct 19 09:16:58 2009 UTC (14 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +10 -9 lines
Diff to previous 1.14 (colored)

sync to 1.9.5: partial rewrite of special character and predefined string
tables and the supporting infrastructure, mostly in preparation for
HTML output support

Revision 1.14 / (download) - annotate - [select for diffs], Sun Oct 18 21:03:31 2009 UTC (14 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +41 -65 lines
Diff to previous 1.13 (colored)

sync to 1.9.5: integrate closedelim() and opendelim() into term_word(),
removing unnecessary extra functions

Revision 1.13 / (download) - annotate - [select for diffs], Mon Sep 21 20:57:57 2009 UTC (14 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +7 -7 lines
Diff to previous 1.12 (colored)

sync to 1.9.5: make terminal_*, tree_* and out_* functions return void,
making the code simpler

Revision 1.12 / (download) - annotate - [select for diffs], Mon Sep 21 20:28:43 2009 UTC (14 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +7 -7 lines
Diff to previous 1.11 (colored)

sync to 1.9.5: remove TERMP_STYLE bit field in favour of recursion-friendly
integer flags, simplifying and shortening the code

Revision 1.11 / (download) - annotate - [select for diffs], Sat Aug 22 17:04:48 2009 UTC (14 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +71 -48 lines
Diff to previous 1.10 (colored)

sync to 1.8.5: partial rewrite of the handling of escape sequences:
distinguish special characters and predefined strings,
and add and fix several escape sequences

Revision 1.10 / (download) - annotate - [select for diffs], Sun Aug 9 21:28:57 2009 UTC (14 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

sync to 1.8.4: preserve leading whitespace in literal text

Revision 1.9 / (download) - annotate - [select for diffs], Sun Aug 9 18:43:29 2009 UTC (14 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.8: +49 -35 lines
Diff to previous 1.8 (colored)

multiple spacing fixes for .Bl -hang, -tag, -inset and -diag
ok kristaps@ and included in 1.8.3

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jul 26 00:40:28 2009 UTC (14 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +7 -4 lines
Diff to previous 1.7 (colored)

sync to 1.8.1: correct vis count for erroneously-decorated whitespace;
while here, add a new FIXME wrt .Bl -diag

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jul 26 00:28:50 2009 UTC (14 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +65 -91 lines
Diff to previous 1.6 (colored)

sync to 1.8.1: word splitting now happens in libmdoc,
and remove costly, redundant calculations of string length

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jul 18 20:50:38 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +19 -6 lines
Diff to previous 1.5 (colored)

sync to 1.8.0: support .Bl -hang

Revision 1.5 / (download) - annotate - [select for diffs], Tue Jun 23 23:53:43 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.4: +30 -24 lines
Diff to previous 1.4 (colored)

fix three off-by-one errors in whitespace output
tweaked by and ok kristaps@  and included in 1.7.20

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jun 21 19:53:47 2009 UTC (14 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.3: +27 -53 lines
Diff to previous 1.3 (colored)

sync to 1.7.19: proper font decorations for special and .It characters

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

sync to 1.7.16: avoid trailing space in output

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.