summaryrefslogtreecommitdiffstats
path: root/out.c
Commit message (Collapse)AuthorAgeFilesLines
* Do alignment of non-numeric strings in numeric cells the same wayIngo Schwarze2018-08-191-33/+51
| | | | | | as groff, and also honour the explicit alignment indicator "\&". This required an almost complete rewrite of both the measurement function and the formatter function for numeric cells.
* If a tbl(7) column contains both text cells and numeric cells,Ingo Schwarze2018-08-181-3/+8
| | | | horizontally align the numbers in the same way as groff does.
* Do not allocate a column for decimal points if all numbers are integers.Ingo Schwarze2018-08-181-6/+4
|
* Implement spacing of columns as defined in the table layout;Ingo Schwarze2017-06-271-2/+9
| | | | | this is for example used by lftp(1) and, ironically, misused by our very own tbl(7) manual...
* round default width of tbl(7) text blocks in the same way as groffIngo Schwarze2017-06-151-1/+2
|
* let \l use the right fill characterIngo Schwarze2017-06-141-3/+1
|
* If a tbl(7) layout contains a 'w' (minimum width) modifier for aIngo Schwarze2017-06-121-2/+3
| | | | | | | given column, that column contains no literal or numeric cell of larger width, and all text block cells in that column can be line wrapped to fit into that minimum width, groff does not increase that column width beyond the specified minimum: so do the same.
* fix column width calculation for text block cellsIngo Schwarze2017-06-121-11/+18
|
* Implement w layout specifier (minimum column width).Ingo Schwarze2017-06-081-14/+38
| | | | | Improve width calculation of text blocks. Reduces the groff/mandoc diff in Base+Xenocara by about 800 lines.
* make the internal a2roffsu() interface more powerful by returningIngo Schwarze2017-06-081-7/+6
| | | | | a pointer to the end of the parsed data, making it easier to parse subsequent bytes
* When trying to expand some columns in a table where the sum of theIngo Schwarze2017-05-011-2/+5
| | | | | | | widths of the remaining columns is already wider than the line length, underflowing size_t and dying from ENOMEM is the wrong plan. Instead, simply refrain from expanding anything in such a situation, avoiding a crash that tb@ found with afl.
* To make the code more readable, delete 283 /* FALLTHROUGH */ commentsIngo Schwarze2015-10-121-4/+0
| | | | | | 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.
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-3/+3
|
* /* NOTREACHED */ after abort() is silly, delete itIngo Schwarze2015-09-261-1/+0
|
* Abolish struct tbl_head and replace it by an "int col" member inIngo Schwarze2015-01-301-1/+1
| | | | struct tbl_cell. No functional change, minus 40 lines of code.
* adjust formatting for the tbl(7) layout 'x' modifier (maximize column)Ingo Schwarze2015-01-281-6/+30
| | | | to match groff for up to six maximized columns
* support negative horizontal widths in man(7);Ingo Schwarze2014-12-231-3/+0
| | | | minus twenty lines of code in spite of enhanced functionality
* some scaling unit fixes:Ingo Schwarze2014-12-231-33/+32
| | | | | - .sp with an invalid argument is .sp 1v, not .sp 0v - in man(1), trailing garbage doesn't make scaling units invalid
* In a2roffsu(), do not parse the number twice.Ingo Schwarze2014-12-231-43/+12
| | | | | Gets rid of 25 lines of code and one static buffer. No functional change for numbers shorter than BUFSIZ characters.
* fix handling of roff requests having a default scale other than "n",Ingo Schwarze2014-12-041-1/+1
| | | | | in particular .sp which uses "v", when the scale is not specified; cures groff-mandoc differences in about a dozen Xenocara manuals
* even if a table has zero columns, do not segfault in the formatter;Ingo Schwarze2014-10-141-1/+1
| | | | bug reported by bentley@
* Rudimentary implementation of the e, x, and z table layout modifiersIngo Schwarze2014-10-141-5/+69
| | | | | | | 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@.
* In mdoc(7) and man(7), if a width is given as a bare number withoutIngo Schwarze2014-08-121-1/+1
| | | | | | | specifying a unit, the implied unit is 'n' (on the terminal, one character position; in PostScript, half of the current font size in points), not 'u' (roff output device basic unit). No functional change right now, but important for the upcoming scaling unit fixes.
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-2/+0
| | | | | | 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.
* Clarity with respect to floating point handling:Ingo Schwarze2014-08-011-2/+2
| | | | | | Write double constants as double rather than integer literals. Remove useless explicit (double) cast done at one place and nowhere else. No functional change.
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-25/+26
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* The files mandoc.c and mandoc.h contained both specialised low-levelIngo Schwarze2014-03-231-0/+1
| | | | | | | 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.
* Cleanup suggested by gcc-4.8.1, following hints by Christos Zoulas:Ingo Schwarze2013-10-051-3/+0
| | | | | | | | - avoid bad qualifier casting in roff.c, roff_parsetext() by changing the mandoc_escape arguments to "const char const **" - avoid bad qualifier casting in mandocdb.c, index_merge() - do not complain about unused variables in test-*.c - garbage collect a few unused variables elsewhere
* The name "struct tbl" was badly misleading for two reasons:Ingo Schwarze2013-05-311-9/+9
| | | | | | | 1) This struct almost exclusively contains the table options. 2) Information about the table as a whole is actually in "struct tbl_node". Besides, "struct tbl" was almost impossible to search for. So rename it to "struct tbl_opts". No functional change.
* Do not handle vertical lines as additional tbl(7) columns,Ingo Schwarze2012-05-271-19/+0
| | | | | | | | | | | | | | | | 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@
* Major rewrite of the horizontal spacing of tablesIngo Schwarze2011-09-201-41/+10
| | | | | to work both with and without frames and rulers. ok kristaps@
* Scary-looking but otherwise harmless changes allow me to build for Windows.Kristaps Dzonsons2011-07-241-1/+1
| | | | | | | | | | | | That is to say, with mingw32. This amounts to the following: (1) break compat.c into compat_strlcpy.c and compat_strlcat.c (2) add compat_getsubopt.c (from OpenBSD) and test-getsubopt.c (3) add test-strptime.c for HAVE_STRPTIME (4) add ifdef bits here and there, where necessary (5) remove some harmless unportable stuff (u_char, localtime_r) I've added the appropriate mdocml.zip target to the Makefile, too.
* Remove unused function.Kristaps Dzonsons2011-07-171-42/+0
|
* Remove a2roffdeco() and mandoc_special() functions and replace them withKristaps Dzonsons2011-04-091-237/+0
| | | | | | | | | | | | | | | | | | a public (mandoc.h) function mandoc_escape(), which merges the functionality of both prior functions. Reason: code duplication. The a2roffdeco() and mandoc_special() functions were pretty much the same thing and both quite complex. This allows one function to receive improvements in (e.g.) subexpression handling and performance, instead of having to replicate functionality. As such, the mandoc_escape() function already handles a superset of the escapes handled in previous versions and has improvements in performance (using strcspn(), for example) and reliable handling of subexpressions. This code Works For Me, but may need work to catch any regressions. Since the benefits are great (leaner code, simpler API), I'd rather have it in-tree than floating as a patch.
* Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.hKristaps Dzonsons2011-03-171-1/+1
| | | | | | | | so that everybody can use them. This follows the convention of libXXXX.h being internal to a library and XXXX.h being the external interface. Not only does this allow the removal of lots of redundant NULL-checking code, it also sets the tone for adding new mandoc-global routines.
* Make lint shut up a little bit.Kristaps Dzonsons2011-03-151-1/+2
|
* Implement the \N'number' (numbered character) roff escape sequence.Ingo Schwarze2011-01-301-0/+44
| | | | | | | 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@ jmc@ and tested by Matthieu Herrb (matthieu at openbsd dot org)
* correct horizontal spacing of data cellsIngo Schwarze2011-01-251-2/+2
| | | | | | correct alignment of centered cells adjust horizontal rule width to the new spacing ok kristaps@
* Add support for "^" vertical spanners. Unlike GNU tbl, raiseKristaps Dzonsons2011-01-111-0/+2
| | | | | | | 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-10/+13
| | | | | 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-2/+1
| | | | | | | | | | | | 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.
* The numerical column type centres on the *last* decimal point.Kristaps Dzonsons2011-01-081-1/+1
|
* Give the "n" cell type knowledge of its spacing.Kristaps Dzonsons2011-01-081-6/+8
|
* Stuff tbl_calc() into out.c so that it can be shared by all output modesKristaps Dzonsons2011-01-051-0/+202
| | | | | | | | | | | | | | | | (isn't now, but will need to be, used by -T[x]html also). Necessitated a lot of churn in getting tbl_calc* code out of tbl_term.c and into out.c, including renaming some structures and so on. The abstraction is in having a pointer to a wrapper function for calculating string widths. The char devices use term_strlen and term_len; the others will probably just use strlen(). While at it, remove some superfluous assertions in the tbl code. This allows all tbl manuals to clear. Lastly, set the right-margin to be the maximum margin for each table span. This allows big, complicated tbl-pages like terminfo to be displayed. They're ugly, but they work.
* Remove overstrike `\o'. This isn't the best solution because we reallyKristaps Dzonsons2010-08-291-0/+2
| | | | | should be printing the contents, but for the time being, this is good enough.
* Handle nested, recursive mathematical subexpressions. This isKristaps Dzonsons2010-08-241-0/+20
| | | | | definitely not general, but it's good enough for pod2man definitions (after I clean up the roff, which will be addressed in later fixes).
* Strip out `\k' escape.Kristaps Dzonsons2010-08-241-0/+2
|
* Stripping out of `\w' groff escape. Yet another for pod2man...Kristaps Dzonsons2010-08-241-0/+6
|
* Strip out the `\z' escape. This is the first recursive sequence,Kristaps Dzonsons2010-08-241-1/+10
| | | | getting mandoc ready to handle pod2man's complex escapes.
* Add \v and \h to ignored escapes. These are in the category of \s.Kristaps Dzonsons2010-08-161-7/+10
| | | | | | Also made sign-less \s-style escapes be ok (this is technically against what's in the groff.7 manual, but seems pretty widespread). Noted by Thomas Jeunet as uglifying the gcc.1 manual.