CVS log for mandoc/tbl.c

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

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.46 / (download) - annotate - [select for diffs], Fri Dec 14 06:33:14 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6, VERSION_1_14_5, HEAD
Changes since 1.45: +2 -3 lines
Diff to previous 1.45 (colored) to selected 1.18 (colored)

Cleanup, no functional change:
Now that message handling is properly encapsulated,
remove struct mparse pointers from four structs (roff, roff_man,
tbl_node, eqn_node) and from the argument lists of five functions
(roff_alloc, roff_man_alloc, mandoc_getarg, tbl_alloc, eqn_alloc).
Except for being passed to the main program as an opaque object,
it now only occurs in read.c, as it should, and not across 15 files
like in the past.

Revision 1.45 / (download) - annotate - [select for diffs], Fri Dec 14 05:18:03 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +5 -9 lines
Diff to previous 1.44 (colored) to selected 1.18 (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.44 / (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.43: +36 -28 lines
Diff to previous 1.43 (colored) to selected 1.18 (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.43 / (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.42: +3 -2 lines
Diff to previous 1.42 (colored) to selected 1.18 (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.42 / (download) - annotate - [select for diffs], Sat Jul 8 17:52:50 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4, VERSION_1_14_3, VERSION_1_14_2
Changes since 1.41: +8 -13 lines
Diff to previous 1.41 (colored) to selected 1.18 (colored)

Simplify by creating struct roff_node syntax tree nodes for tbl(7)
right from roff_parseln() rather than delegating to read.c,
similar to what i just did for eqn(7).

The interface function roff_span() becomes obsolete and is deleted,
the former interface function roff_addtbl() becomes static,
the interface functions tbl_read() and tbl_cdata() become void,
and minus twelve linus of code.

No functional change.

Revision 1.41 / (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.40: +2 -1 lines
Diff to previous 1.40 (colored) to selected 1.18 (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.40 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:20 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.39: +9 -9 lines
Diff to previous 1.39 (colored) to selected 1.18 (colored)

modernize style: "return" is not a function

Revision 1.39 / (download) - annotate - [select for diffs], Fri Jan 30 17:32:16 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.38: +1 -5 lines
Diff to previous 1.38 (colored) to selected 1.18 (colored)

Delete the redundant tbl span flags, just inspect the actual data
where needed, which is less fragile.
This fixes a subtle NULL pointer access to tp->tbl.cols:
Due to a bug in the man(7) parser, the first span of a table can
end up in a .TP head, in which case tblcalc() was never called.
Found by jsg@ with afl.

Revision 1.38 / (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.37: +1 -7 lines
Diff to previous 1.37 (colored) to selected 1.18 (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.37 / (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.36: +8 -9 lines
Diff to previous 1.36 (colored) to selected 1.18 (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.36 / (download) - annotate - [select for diffs], Wed Jan 28 17:32:07 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +15 -15 lines
Diff to previous 1.35 (colored) to selected 1.18 (colored)

* Polish tbl(7) error reporting.
* Do not print out macro names in tbl(7) data blocks.
* Like with GNU tbl, let empty tables cause a blank line.
* Avoid producing empty tables in -Tman.

Revision 1.35 / (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.34: +8 -8 lines
Diff to previous 1.34 (colored) to selected 1.18 (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.34 / (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.33: +6 -2 lines
Diff to previous 1.33 (colored) to selected 1.18 (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.33 / (download) - annotate - [select for diffs], Mon Jan 26 00:57:22 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +33 -18 lines
Diff to previous 1.32 (colored) to selected 1.18 (colored)

Improve (or rather, rewrite) tbl(7) option parsing.
* Allow the layout to start after the semicolon on the options line.
* Ignore leading commas.
* Option arguments cannot contain closing parentheses.
* Avoid needless UNSUPP messages.
* Better ERROR reporting.
* Delete unused "linesize" field in struct tbl_opts.
* No need for static buffers.
* Garbage collect one almost empty wrapper function.
Improved functionality, but minus 40 lines of code.

Revision 1.32 / (download) - annotate - [select for diffs], Wed Jan 21 00:47:04 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +3 -6 lines
Diff to previous 1.31 (colored) to selected 1.18 (colored)

blank lines in tables do not need special handling; simplifies code
and reduces groff/mandoc differences in OpenBSD base by about 1%

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: +5 -3 lines
Diff to previous 1.30 (colored) to selected 1.18 (colored)

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

Revision 1.30 / (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_13_2, VERSION_1_12_4, VERSION_1_12
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored) to selected 1.18 (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.29 / (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.28: +12 -12 lines
Diff to previous 1.28 (colored) to selected 1.18 (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.28 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.27: +2 -1 lines
Diff to previous 1.27 (colored) to selected 1.18 (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.27 / (download) - annotate - [select for diffs], Fri May 31 22:08:09 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3, VERSION_1_12_2
Changes since 1.26: +19 -19 lines
Diff to previous 1.26 (colored) to selected 1.18 (colored)

More cleanup: Consistently use the name "struct tbl_node *tbl"
that is already used almost everywhere instead of gratuitiously
inventing different names at four places.  No functional change.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jul 25 15:37:00 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_1, VERSION_1_12_0, VERSION_1_11_7, VERSION_1_11_6
Changes since 1.25: +6 -2 lines
Diff to previous 1.25 (colored) to selected 1.18 (colored)

Implement the first steps of equation parsing from within libmdoc.
This consists of a shim around the text parser that calls out to libroff
if equation components exist on the line.  Right now this will do
nothing, as the equation delimiter always returns nil.

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

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

Revision 1.24 / (download) - annotate - [select for diffs], Tue Mar 22 09:48:13 2011 UTC (13 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_1
Changes since 1.23: +1 -2 lines
Diff to previous 1.23 (colored) to selected 1.18 (colored)

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

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

Revision 1.23 / (download) - annotate - [select for diffs], Sun Mar 20 16:02:05 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.22: +11 -8 lines
Diff to previous 1.22 (colored) to selected 1.18 (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.22 / (download) - annotate - [select for diffs], Tue Jan 25 12:24:27 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_10_10
Changes since 1.21: +10 -4 lines
Diff to previous 1.21 (colored) to selected 1.18 (colored)

Since tbl_data() can now produce multiple spans, let parsebuf()
generate man(7) or mdoc(7) nodes for all these spans,
not only for the last one.
Restores the horizontal lines in the cpu(4/hppa) tables.
ok kristaps@

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jan 4 15:02:00 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_9
Changes since 1.20: +9 -2 lines
Diff to previous 1.20 (colored) to selected 1.18 (colored)

Support `T{' and `T}' data blocks.  When a standalone `T{' is
encountered as a line's last data cell, move into TBL_PART_CDATA mode
whilst leaving the cell's designation as TBL_DATA_NONE.  When new data
arrives that's not a standalone `T}', append it to the cell contends.
Close out and warn appropriately.

Revision 1.20 / (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.19: +1 -161 lines
Diff to previous 1.19 (colored) to selected 1.18 (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.19 / (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.18: +1 -6 lines
Diff to previous 1.18 (colored)

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

Revision 1.18 / (download) - annotate - [selected], Sun Jan 2 12:04:23 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +4 -1 lines
Diff to previous 1.17 (colored)

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

Revision 1.17 / (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.16: +19 -19 lines
Diff to previous 1.16 (colored) to selected 1.18 (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.16 / (download) - annotate - [select for diffs], Sat Jan 1 23:00:46 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.15: +166 -1 lines
Diff to previous 1.15 (colored) to selected 1.18 (colored)

Merge in the width, decimal, and positioning code for individual data rows
from tbl.bsd.lv.  This is more or less verbatim, less queue macros and also
a check for NULL layout.

This concludes the back-end parsing for a little while, as the front-end
display may now be configured.

Revision 1.15 / (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.14: +9 -5 lines
Diff to previous 1.14 (colored) to selected 1.18 (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.14 / (download) - annotate - [select for diffs], Sat Jan 1 16:10:40 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +8 -2 lines
Diff to previous 1.13 (colored) to selected 1.18 (colored)

Raise an error if a table is closed without data.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Jan 1 15:45:18 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +12 -2 lines
Diff to previous 1.12 (colored) to selected 1.18 (colored)

Add documentation bits for libroff's new roff_span().

Add bits to remember tbl's invocation point.

Add ERROR class message if no data's in the table.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Jan 1 13:37:40 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.11: +5 -5 lines
Diff to previous 1.11 (colored) to selected 1.18 (colored)

Switch on tbl rows being added to the parse stream.  Here we go!

Revision 1.11 / (download) - annotate - [select for diffs], Fri Dec 31 18:19:43 2010 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +8 -1 lines
Diff to previous 1.10 (colored) to selected 1.18 (colored)

Expose the parsed table API to the world and add accessors through the
roff.h interface.

Revision 1.10 / (download) - annotate - [select for diffs], Fri Dec 31 14:52:41 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +32 -60 lines
Diff to previous 1.9 (colored) to selected 1.18 (colored)

Put parsed tables into a queue that's cleared at the end of parsing.
This completes the parsing phase of the new tbl implementation.

Revision 1.9 / (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.8: +27 -20 lines
Diff to previous 1.8 (colored) to selected 1.18 (colored)

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

Revision 1.8 / (download) - annotate - [select for diffs], Wed Dec 29 16:44:23 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +15 -2 lines
Diff to previous 1.7 (colored) to selected 1.18 (colored)

Initial check-in of table data-row processing.  For the time being, this
parses table data then throws it away immediately.  It does not yet try
to cross-check data rows against layout or anything.  This copied more
or less completely from tbl.bsd.lv.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Dec 29 14:53:31 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +9 -1 lines
Diff to previous 1.6 (colored) to selected 1.18 (colored)

Add handling for `T&', which restarts a table except for its options.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Dec 29 14:38:14 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +18 -2 lines
Diff to previous 1.5 (colored) to selected 1.18 (colored)

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

Revision 1.5 / (download) - annotate - [select for diffs], Wed Dec 29 01:16:57 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +24 -63 lines
Diff to previous 1.4 (colored) to selected 1.18 (colored)

Significant update to options handling, which now departs almost
completely with the BSD.lv code due to performance issues and flat-out
errors.

Performance issues: functions called per character.  Ugly.

Flat-out errors: disallowing "reserved" tokens as arguments to those
options accepting arguments.

Also added are two mandoc.h error codes for general tbl syntax errors
and for bad options.

Revision 1.4 / (download) - annotate - [select for diffs], Tue Dec 28 13:47:38 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored) to selected 1.18 (colored)

Fix copyright email.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Dec 28 13:46:07 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.2: +61 -10 lines
Diff to previous 1.2 (colored) to selected 1.18 (colored)

Adding initial options processing (not hooked into parse yet).  This is
more or less copied from tbl.bsd.lv and still needs integration with the
general mandoc framework, e.g., with error messages.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Dec 28 10:55:24 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored) to selected 1.18 (colored)

Fixed enum rofferr return value in tbl_read() (oops).

Revision 1.1 / (download) - annotate - [select for diffs], Tue Dec 28 10:51:03 2010 UTC (13 years, 3 months ago) by kristaps
Branch: MAIN
Diff to selected 1.18 (colored)

Initial tbl framework.  Parse point is in libroff, which keeps a
reference to a current tbl parse and routes ALL text into the tbl parse
after stripping reserved words and making block-level pre-processing
(e.g., `ig').  This is consistent with an analysis of embedded `TS/TE'
in manuals with sprinkled -mdoc, roff, and -man macros.

Fact of a parse is exposed to main.c by a return value (ROFF_TBL), which
will trigger main.c to add a foreign parsed body to the -mdoc or -man
parse stream.  This interface isn't in yet, but will follow the
parse-text functions in both libraries.  I put this login in main.c
because I don't want libroff calling directly into libmdoc or libman.

As a consequence, a parsed row can be pushed directly into any -mdoc or
-man context (put a `Bd -literal -offset indent' into a `TE/TS' block to
see why this is necessary).  It will then absorb formatting cues in the
front-ends.

A note on naming.  I decided on libroff.h instead of tbl.h because this
is purely within the roff layer.  Separate tbl implementations will
need, then, to interface with libroff.  This is "how it should be"
because tbl is tightly linked with roff in terms of `ds' and other
formatting macros, as well as, of course, special characters and other
roffisms.

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