CVS log for mandoc/tbl_layout.c

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

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.50 / (download) - annotate - [select for diffs], Tue Aug 10 12:55:04 2021 UTC (2 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6, HEAD
Changes since 1.49: +27 -29 lines
Diff to previous 1.49 (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.49 / (download) - annotate - [select for diffs], Tue Sep 1 18:25:28 2020 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +7 -2 lines
Diff to previous 1.48 (colored)

Ignore unreasonably large spacing modifiers in tbl layouts.

Jan Schreiber <jes at posteo dot de> ran afl on mandoc and it turned
out mandoc tried to use spacing modifiers so large that they would
trigger assertion failures in term_ascii.c, function locale_advance().

Revision 1.48 / (download) - annotate - [select for diffs], Fri Dec 14 05:18:03 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.47: +12 -16 lines
Diff to previous 1.47 (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.47 / (download) - annotate - [select for diffs], Fri Dec 14 01:18:26 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +2 -1 lines
Diff to previous 1.46 (colored)

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

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

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

Revision 1.46 / (download) - annotate - [select for diffs], Thu Dec 13 02:06:07 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

Cleanup, no functional change:
Move tbl(7)-specific parser internals out of libroff.h.
Move some tbl(7)-internal processing from roff.c to tbl.c.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Dec 12 21:54:35 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +3 -2 lines
Diff to previous 1.44 (colored)

Cleanup, no functional change:
No need to expose the tbl(7) syntax tree data structures everywhere.
Move them to their own include file, "tbl.h", and improve comments.

Revision 1.44 / (download) - annotate - [select for diffs], Tue Jun 27 18:25:02 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4, VERSION_1_14_3, VERSION_1_14_2
Changes since 1.43: +3 -1 lines
Diff to previous 1.43 (colored)

Implement spacing of columns as defined in the table layout;
this is for example used by lftp(1)
and, ironically, misused by our very own tbl(7) manual...

Revision 1.43 / (download) - annotate - [select for diffs], Tue Jun 13 16:12:01 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.42: +3 -1 lines
Diff to previous 1.42 (colored)

If the layout is empty except for requesting a left vertical frame,
record that detail in struct tbl_opts, such that term_tbl() can do
correct column calculations and doesn't prematurely break lines.
Fixes the tbl/layout/empty regression test that got broken when
line breaking in text block cells was implemented.

Revision 1.42 / (download) - annotate - [select for diffs], Thu Jun 8 18:11:22 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +19 -3 lines
Diff to previous 1.41 (colored)

Implement w layout specifier (minimum column width).
Improve width calculation of text blocks.
Reduces the groff/mandoc diff in Base+Xenocara by about 800 lines.

Revision 1.41 / (download) - annotate - [select for diffs], Mon Oct 12 00:08:16 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1, VERSION_1_13_4, VERSION_1_13
Changes since 1.40: +1 -5 lines
Diff to previous 1.40 (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.40 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:20 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

modernize style: "return" is not a function

Revision 1.39 / (download) - annotate - [select for diffs], Wed Apr 29 12:44:58 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored)

When the last line of a table layout turns out to be empty, it is deleted.
Do not just free the struct tbl_row but also make sure that no pointer
to it remains.  Fixing a use after free found by jsg@ with afl.

Revision 1.38 / (download) - annotate - [select for diffs], Tue Feb 10 11:03:13 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.37: +27 -11 lines
Diff to previous 1.37 (colored)

Do not read past the end of the buffer if an "f" layout font modifier
is followed by the end of the input line instead of a font specifier.
Found by jsg@ with afl, test case #591.

While here, improve functionality as well:
* There is no "r" font modifier.
* Font specifiers (as opposed to font modifiers) are case sensitive.
* One-character font specifiers require trailing whitespace.
* Ignore parenthised and two-letter font specifiers.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Jan 30 04:11:50 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.36: +7 -26 lines
Diff to previous 1.36 (colored)

Abolish struct tbl_head and replace it by an "int col" member in
struct tbl_cell.  No functional change, minus 40 lines of code.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Jan 30 02:09:04 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.35: +6 -6 lines
Diff to previous 1.35 (colored)

Auditing the tbl(7) code for more NULL pointer accesses, i came out
empty-handed; so this is just KNF and some code simplifications,
no functional change.

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jan 30 00:29:30 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.34: +31 -11 lines
Diff to previous 1.34 (colored)

Make sure every layout line contains at least one cell;
fixing a NULL pointer access in term_tbl() that jsg@ found with afl.

Revision 1.34 / (download) - annotate - [select for diffs], Wed Jan 28 15:03:45 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +2 -5 lines
Diff to previous 1.33 (colored)

For now, it can't be helped that mandoc tbl(7) ignores high-level macros,
but stop throwing away their arguments.  This fixes information loss in a
handful of Xenocara manuals, at the price of a small amount of formatting
noise creeping through.

Revision 1.33 / (download) - annotate - [select for diffs], Tue Jan 27 05:21:45 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +47 -24 lines
Diff to previous 1.32 (colored)

Multiple parser and formatter fixes for line drawing in tbl(7).
* Allow mixing vertical line bars with the layout options
of the preceding layout cell.
* Correctly combine box options with layout lines.
* Correctly print vertical lines in data rows, with the right spacing.
* Correctly print cross markers and left and right ends of
horizontal lines even if vertical lines differ above and below.
* Avoid the bogus error message "no table data cells"
when a table data section starts with a horizontal line.
No increase in code size.

Revision 1.32 / (download) - annotate - [select for diffs], Mon Jan 26 18:42:30 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +83 -155 lines
Diff to previous 1.31 (colored)

Rework tbl(7) layout parsing:
* Continue parsing even if part of the input is invalid.
* Do not require whitespace between cell specifications.
* Allow tabs as well as blanks between modifiers.
* Mark the 'm' modifier as unsupported.
* Parse and ignore the 'p' and 'v' modifiers.
* Better warning and error messages.
* Get rid of a static buffer.
Improved functionality but minus 50 lines of code.

Revision 1.31 / (download) - annotate - [select for diffs], Wed Jan 14 22:44:55 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +6 -6 lines
Diff to previous 1.30 (colored)

simplify by getting rid of ROFF_ERR in tbl(7) parsing; no functional change

Revision 1.30 / (download) - annotate - [select for diffs], Tue Nov 25 21:41:47 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.29: +41 -56 lines
Diff to previous 1.29 (colored)

Completely rewrite the top level of the layout parser.
* Do not allocate lines unless there are cells.
* Make the MANDOCERR_TBLNOLAYOUT message actually work.
Also get rid of one static function and two goto statements.

Revision 1.29 / (download) - annotate - [select for diffs], Tue Oct 14 02:16:06 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +4 -1 lines
Diff to previous 1.28 (colored)

Rudimentary implementation of the e, x, and z table layout modifiers
to equalize, maximize, and ignore the width of columns.
Does not yet take vertical rulers into account,
and does not do line breaks within table cells.
Considerably improves the lftp(1) manual; issue noticed by sthen@.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Oct 7 14:07:03 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.27: +6 -1 lines
Diff to previous 1.27 (colored)

If a tbl(7) layout contains unknown font modifiers, fall back to the
default font rather than failing the whole table.
Needed by some pages in books/man-pages-posix.
Written on the plane back from EuroBSDCon in Sofia.

Revision 1.27 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_4, VERSION_1_12
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
Include <sys/types.h> where needed, it does not belong in config.h.
Remove <stdio.h> from config.h; if it is missing somewhere, it should
be added, but i cannot find a *.c file where it is missing.

Revision 1.26 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:05 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.25: +50 -49 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Fri Mar 28 23:26:25 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.24: +11 -2 lines
Diff to previous 1.24 (colored)

Allow leading and trailing vertical lines,
and format them in the same way as groff.
While here, do not require whitespace before vertical lines
in layout specifications.
Issues found by bentley@ in mpv(1).

Revision 1.24 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (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.23 / (download) - annotate - [select for diffs], Sun May 27 17:54:54 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3, VERSION_1_12_2
Changes since 1.22: +36 -118 lines
Diff to previous 1.22 (colored)

Do not handle vertical lines as additional tbl(7) columns,
instead save their properties with the following column.
This simplifies layout parsing and saves a lot of code
related to column handling.

At output time, print all white space and vertical lines
separating columns before printing the following column,
and none after printing the preceding column, considerably
simplifying white space handling and width calculations.

No functional change, but it saves 150 lines of code,
and it allows the next patch to tbl_term.c, tbl_literal().

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

Revision 1.22 / (download) - annotate - [select for diffs], Sun Sep 18 14:14:15 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_1, VERSION_1_12_0
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

forgotten Copyright bumps; no code change
found while syncing to OpenBSD

Revision 1.21 / (download) - annotate - [select for diffs], Sat Sep 3 00:29:21 2011 UTC (12 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +11 -1 lines
Diff to previous 1.20 (colored)

Fix handling of font modifiers in tables.  Noted by Brad Smith.

Revision 1.20 / (download) - annotate - [select for diffs], Tue May 17 13:11:40 2011 UTC (12 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_7, VERSION_1_11_6, VERSION_1_11_5, VERSION_1_11_4, VERSION_1_11_3
Changes since 1.19: +18 -1 lines
Diff to previous 1.19 (colored)

In tbl layouts, we puked if a space didn't followed a vertical bar
(found by Yuri Pankov).  This was due to looking for modifiers for the
vertical bar.  This has been fixed, along with other special-key layout
types.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Apr 7 01:08:42 2011 UTC (12 years, 11 months ago) by joerg
Branch: MAIN
CVS Tags: VERSION_1_11_2
Changes since 1.18: +6 -6 lines
Diff to previous 1.18 (colored)

Don't shadow global identifiers.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Apr 4 23:04:38 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +5 -1 lines
Diff to previous 1.17 (colored)

Add config.h Glue for OpenIndiana (and older OpenSolaris) to build.
From a patch by Yuri Pankov, thanks!

Revision 1.17 / (download) - annotate - [select for diffs], Sun Mar 20 16:02:05 2011 UTC (13 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_1
Changes since 1.16: +19 -11 lines
Diff to previous 1.16 (colored)

Consolidate messages.  Have all parse-time messages (in libmdoc,
libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the
time being in libmandoc.h.  This requires struct mparse to be passed
into the allocation routines instead of mandocmsg and a void pointer.
Then, move some of the functionality of the old mmsg() into read.c's
mparse_mmsg() (check against wlevel and setting of file_status) and use
main.c's mmsg() as simply a printing tool.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Jan 11 14:12:01 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_10
Changes since 1.15: +11 -1 lines
Diff to previous 1.15 (colored)

Add support for "^" vertical spanners.  Unlike GNU tbl, raise
error-class messages when data is being ignored by specifying it in "^"
cells (either as-is or in blocks).

Also note again that horizontal spanners aren't really supported...

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jan 10 15:31:00 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Clarify what members may be NULL or not in calculating widths.  Make
sure signedness is correct.  Verify that layouts MUST exit for data
cells.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Jan 10 14:40:30 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +20 -5 lines
Diff to previous 1.13 (colored)

First, make extra data cells be thrown away.  This makes "dp->layout"
always hold, which cleans up the table stuff a bit.

Second, set a "spans" value per data cell consisting of the number of
skipped TBL_CELL_SPAN layout cells.

Third, make tbl_term.c understand how to skip over spanned sections when
iterating over the header queue.

What remains is to calculate the widths of spanned cells.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jan 9 05:38:23 2011 UTC (13 years, 2 months ago) by joerg
Branch: MAIN
Changes since 1.12: +4 -4 lines
Diff to previous 1.12 (colored)

Add some unsigned char casts for tolower() usage

Revision 1.12 / (download) - annotate - [select for diffs], Fri Jan 7 14:59:52 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_9
Changes since 1.11: +15 -1 lines
Diff to previous 1.11 (colored)

Fixes: T} can be followed by a delimiter then more data.  Make this
work and add documentation for it.

Also make tbl_term() not puke if the number of data cells is less than
the number of layout cells (which happens from time to time).  This
still needs work because we should pad out empty cells so that the
borders all work out.

Revision 1.11 / (download) - annotate - [select for diffs], Fri Jan 7 13:03:48 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +19 -2 lines
Diff to previous 1.10 (colored)

Tiny bits in place for tbl horizontal spans.  This will wait for the next
release to be implemented in full.

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jan 4 23:48:39 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.9: +3 -1 lines
Diff to previous 1.9 (colored)

Merge from OpenBSD (similar to my original fix committed on Oct 15, 2010):
For now, parse and ignore minimal column width specifications.
First step to get terminfo(5) to build.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Jan 3 13:59:21 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +3 -1 lines
Diff to previous 1.8 (colored)

Make width calculations occur within tbl_term.c, not tbl.c.  This allows
for front-ends to make decisions about widths, not the back-end.

To pull this off, first make each tbl_head contain a unique index value
(0 <= index < total tbl_head elements) and remove the tbl_calc() routine
from the back-end.

Then, when encountering the first tbl_span in the front-end, dynamically
create an array of configurations (termp_tbl) keyed on each tbl_head's
unique index value.  Construct the decimals and widths at this time,
then continue parsing as before.

The termp_tbl and indexes are required because we pass a const tbl AST
into the front-end.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jan 2 20:34:05 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

Fix table to print nicely (merging error).  Also have -Ttree push out some
header stuff.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jan 2 12:04:23 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +3 -1 lines
Diff to previous 1.6 (colored)

Add some final bits necessary in the upcoming -Tascii tbl stuff.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Jan 2 10:10:57 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +10 -10 lines
Diff to previous 1.5 (colored)

Churn to get parts of 'struct tbl' visible from mandoc.h: rename the
existing 'struct tbl' as 'struct tbl_node', then move all option stuff
into a 'struct tbl' in mandoc.h.

This conflicted with a structure in chars.c, which was renamed.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Jan 1 22:19:15 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +122 -18 lines
Diff to previous 1.4 (colored)

Plug in the "head" concept for tables.  A tbl_head specifies the full
layout for each row, including vertical spacers.  One grabs the tbl_head
for a row and iterates through each entry, plugging data from the
tbl_span into the header as appropriate.

This is pulled in more or less verbatim from tbl.bsd.lv.  In fact, this
is verbatim except that lists macros are made into hard-coded lists (for
compatibility, as long-ago noted by joerg@).

Revision 1.4 / (download) - annotate - [select for diffs], Sat Jan 1 21:23:01 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +2 -1 lines
Diff to previous 1.3 (colored)

Add bits for compilation on Mac.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Dec 30 09:34:07 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.2: +6 -6 lines
Diff to previous 1.2 (colored)

Move clean-up of parsed tbl nodes into the tbl_clear() function, called
once per invocation.

Revision 1.2 / (download) - annotate - [select for diffs], Wed Dec 29 15:21:34 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +7 -30 lines
Diff to previous 1.1 (colored)

Update (still-commented) manual bits for tbl.

Also removed lots of superfluous switch cases by using tolower() and
handling only the lowercase keys.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Dec 29 14:38:14 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN

Merge, with considerable changes, tbl.bsd.lv's layout-handling code.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb