aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tbl_layout.c
Commit message (Collapse)AuthorAgeFilesLines
* When the last line of a table layout turns out to be empty, it is deleted.Ingo Schwarze2015-04-291-1/+2
| | | | | 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.
* Do not read past the end of the buffer if an "f" layout font modifierIngo Schwarze2015-02-101-11/+27
| | | | | | | | | | | 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.
* Abolish struct tbl_head and replace it by an "int col" member inIngo Schwarze2015-01-301-26/+7
| | | | struct tbl_cell. No functional change, minus 40 lines of code.
* Auditing the tbl(7) code for more NULL pointer accesses, i came outIngo Schwarze2015-01-301-6/+6
| | | | | empty-handed; so this is just KNF and some code simplifications, no functional change.
* Make sure every layout line contains at least one cell;Ingo Schwarze2015-01-301-11/+31
| | | | fixing a NULL pointer access in term_tbl() that jsg@ found with afl.
* For now, it can't be helped that mandoc tbl(7) ignores high-level macros,Ingo Schwarze2015-01-281-5/+2
| | | | | | 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.
* Multiple parser and formatter fixes for line drawing in tbl(7).Ingo Schwarze2015-01-271-24/+47
| | | | | | | | | | | | * 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.
* Rework tbl(7) layout parsing:Ingo Schwarze2015-01-261-155/+83
| | | | | | | | | | | * 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.
* simplify by getting rid of ROFF_ERR in tbl(7) parsing; no functional changeIngo Schwarze2015-01-141-6/+6
|
* Completely rewrite the top level of the layout parser.Ingo Schwarze2014-11-251-57/+42
| | | | | | * 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.
* Rudimentary implementation of the e, x, and z table layout modifiersIngo Schwarze2014-10-141-1/+4
| | | | | | | 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@.
* If a tbl(7) layout contains unknown font modifiers, fall back to theIngo Schwarze2014-10-071-1/+6
| | | | | | 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.
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-3/+3
| | | | | | 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.
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-49/+50
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Allow leading and trailing vertical lines,Ingo Schwarze2014-03-281-2/+11
| | | | | | | 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).
* The files mandoc.c and mandoc.h contained both specialised low-levelIngo Schwarze2014-03-231-2/+2
| | | | | | | 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.
* Do not handle vertical lines as additional tbl(7) columns,Ingo Schwarze2012-05-271-118/+36
| | | | | | | | | | | | | | | | 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@
* forgotten Copyright bumps; no code changeIngo Schwarze2011-09-181-2/+2
| | | | found while syncing to OpenBSD
* Fix handling of font modifiers in tables. Noted by Brad Smith.Kristaps Dzonsons2011-09-031-1/+11
|
* In tbl layouts, we puked if a space didn't followed a vertical barKristaps Dzonsons2011-05-171-1/+18
| | | | | | (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.
* Don't shadow global identifiers.Joerg Sonnenberger2011-04-071-6/+6
|
* Add config.h Glue for OpenIndiana (and older OpenSolaris) to build.Kristaps Dzonsons2011-04-041-1/+5
| | | | From a patch by Yuri Pankov, thanks!
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-11/+19
| | | | | | | | | 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.
* Add support for "^" vertical spanners. Unlike GNU tbl, raiseKristaps Dzonsons2011-01-111-1/+11
| | | | | | | 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...
* Clarify what members may be NULL or not in calculating widths. MakeKristaps Dzonsons2011-01-101-2/+2
| | | | | sure signedness is correct. Verify that layouts MUST exit for data cells.
* First, make extra data cells be thrown away. This makes "dp->layout"Kristaps Dzonsons2011-01-101-5/+20
| | | | | | | | | | | | 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.
* Add some unsigned char casts for tolower() usageJoerg Sonnenberger2011-01-091-4/+4
|
* Fixes: T} can be followed by a delimiter then more data. Make thisKristaps Dzonsons2011-01-071-1/+15
| | | | | | | | | 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.
* Tiny bits in place for tbl horizontal spans. This will wait for the nextKristaps Dzonsons2011-01-071-2/+19
| | | | release to be implemented in full.
* Merge from OpenBSD (similar to my original fix committed on Oct 15, 2010):Ingo Schwarze2011-01-041-1/+3
| | | | | For now, parse and ignore minimal column width specifications. First step to get terminfo(5) to build.
* Make width calculations occur within tbl_term.c, not tbl.c. This allowsKristaps Dzonsons2011-01-031-1/+3
| | | | | | | | | | | | | | | | 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.
* Fix table to print nicely (merging error). Also have -Ttree push out someKristaps Dzonsons2011-01-021-2/+2
| | | | header stuff.
* Add some final bits necessary in the upcoming -Tascii tbl stuff.Kristaps Dzonsons2011-01-021-1/+3
|
* Churn to get parts of 'struct tbl' visible from mandoc.h: rename theKristaps Dzonsons2011-01-021-10/+10
| | | | | | | 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.
* Plug in the "head" concept for tables. A tbl_head specifies the fullKristaps Dzonsons2011-01-011-18/+122
| | | | | | | | | | 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@).
* Add bits for compilation on Mac.Kristaps Dzonsons2011-01-011-1/+2
|
* Move clean-up of parsed tbl nodes into the tbl_clear() function, calledKristaps Dzonsons2010-12-301-6/+6
| | | | once per invocation.
* Update (still-commented) manual bits for tbl.Kristaps Dzonsons2010-12-291-30/+7
| | | | | Also removed lots of superfluous switch cases by using tolower() and handling only the lowercase keys.
* Merge, with considerable changes, tbl.bsd.lv's layout-handling code.Kristaps Dzonsons2010-12-291-0/+289