CVS log for mandoc/out.c

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.85 / (download) - annotate - [select for diffs], Sun Oct 17 21:05:54 2021 UTC (2 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.84: +4 -6 lines
Diff to previous 1.84 (colored) to selected 1.66 (colored)

simplify a few accesses to fields of structs, using auxiliary pointer
variables that are already present (and used nearby) in the code;
no functional change

Revision 1.84 / (download) - annotate - [select for diffs], Sun Oct 17 20:48:28 2021 UTC (2 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +8 -7 lines
Diff to previous 1.83 (colored) to selected 1.66 (colored)

Simplify the code building lists of spans, no output change intended.

A comment in the code claimed that the list of spans would be sorted,
but the sorting did not actually work.  The layout "LSSS,LLSL" resulted
in the list "0-3, 1-2", whereas the layout "LLSL,LSSS" resulted
in the list "1-2, 0-3".  Since sorting serves no purpose, just leave
the list unsorted.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Sep 28 17:06:59 2021 UTC (2 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +18 -4 lines
Diff to previous 1.82 (colored) to selected 1.66 (colored)

Revert part of the previous diff to fix a regression (another endless loop)
reported by Michael <Stapelberg at Debian> in the Linux md(4) manual.

The reason the colwidth[] array is needed is not that it stores widths
different from those in tbl->cols[].width, but that only part of the
columns participate in the comparisons, i.e. only those intersecting
at least one span the still requires width distribution.

Revision 1.82 / (download) - annotate - [select for diffs], Tue Sep 7 17:07:58 2021 UTC (2 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6
Changes since 1.81: +10 -34 lines
Diff to previous 1.81 (colored) to selected 1.66 (colored)

Fix an infinite loop that could occur during some cases of horizontally
overlapping horizontal spans.  One span would calculate a desired
target width and start preparations for applying it to some columns,
then the other span would overwrite the target width with a different
value and also start preparations for applying that one to some
columns, which could sometimes confuse the code doing the final
distribution to the point of not doing anything at all before
entering the next iteration.

Fix this by making sure the distribution is done step by step, doing
one step at a time rather than allowing multiple steps to conflict.
Specifically, always do the smallest useful step first.  This change
also simplifies the code.  For example, the local "colwidth" array
is no longer needed.

Note that the algorithm still differs from the one implemented in
GNU tbl(1), which appears to not even try to harmonize column widths
but seems to simply distribute the same amount to all constituent
columns, no matter whether their intrinsic width is narrow or wide.
Adopting a GNU-compatible algorithm might allow further simplifiction
in addition to yielding even more similar output, but i do not want
to implement any major changes of the algorithm at this time.

The infinite loop was reported by <Oliver dot Corff at email dot de>.

Revision 1.81 / (download) - annotate - [select for diffs], Tue Sep 7 14:56:35 2021 UTC (2 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +5 -4 lines
Diff to previous 1.80 (colored) to selected 1.66 (colored)

Correctly calculate required column widths for tables containing
cells that horizontally span columns which contains "n" (number)
formatted cells on other rows.  This requires updating total column
widths from "n" formatted cells before starting width distribution
from the spanning cells to their constituent columns.

Revision 1.80 / (download) - annotate - [select for diffs], Tue Aug 10 12:55:03 2021 UTC (2 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.79: +3 -1 lines
Diff to previous 1.79 (colored) to selected 1.66 (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.79 / (download) - annotate - [select for diffs], Tue Dec 31 22:58:41 2019 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +18 -6 lines
Diff to previous 1.78 (colored) to selected 1.66 (colored)

When all cells in a tbl(1) column are empty, set the column width
to 1n rather than to 0n, in the same way as groff does.
This fixes misformatting reported by bentley@ in xkeyboard-config(7).

Revision 1.78 / (download) - annotate - [select for diffs], Fri Mar 29 21:27:06 2019 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.77: +2 -2 lines
Diff to previous 1.77 (colored) to selected 1.66 (colored)

Set the maximum column index in a tbl(7) to the maximum *right* edge
of any cell span, not to the maximum *left* edge, which may be smaller
if the last column of the table is only reached by horizontal spans,
but not by any regular cell in any row of the table.
Otherwise, the algorithm calculating column widths accessed memomy
after the end of the colwidth[] array, while it was trying to handle
the rightmost column(s).

Crash reported by Jason Thorpe <thorpej at NetBSD>
via https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54069
and via Thomas Klausner (wiz@).
Christos@ Zoulas sent a (correct, but slightly confusing) patch.
The patch i'm committing here is easier to understand.

Revision 1.77 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:47 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.76: +1 -2 lines
Diff to previous 1.76 (colored) to selected 1.66 (colored)

Cleanup, no functional change:
Split the top level parser interface out of the utility header
mandoc.h, into a new header mandoc_parse.h, for use in the main
program and in the main parser only.
Move enum mandoc_os into roff.h because struct roff_man is the
place where it is stored.
This allows removal of mandoc.h from seven files in low-level
parsers and in formatters.

Revision 1.76 / (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.75: +2 -1 lines
Diff to previous 1.75 (colored) to selected 1.66 (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.75 / (download) - annotate - [select for diffs], Thu Nov 29 01:55:02 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +206 -43 lines
Diff to previous 1.74 (colored) to selected 1.66 (colored)

Better handle automatic column width assignments in the presence of
horizontal spans, by implementing a moderately difficult iterative
algoritm.  The benefit is that spans containing long text no longer
cause an excessive width of their starting column.

The result is likely not optimal, in particular in the presence
of many spans overlapping in complicated ways nor when spans
interact with equalizing or maximizing colums.  But i doubt the
practical usefulness of making this more complicated.

Issue originally reported in synaptics(4), which now looks better,
by tedu@ three years ago, and reminded by Pali Rohar this summer.

Revision 1.74 / (download) - annotate - [select for diffs], Sun Nov 25 19:24:20 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +6 -6 lines
Diff to previous 1.73 (colored) to selected 1.66 (colored)

In tbl(7) -T html output,
span cells horizontally and vertically as requested by the layout.
Does not handle spans requested in the data section yet.

To be able to do this, record the number of rows spanned
in the first data cell (struct tbl_dat) of a vertical span.

Missing feature reported by Pali dot Rohar at gmail dot com.

Revision 1.73 / (download) - annotate - [select for diffs], Sun Aug 19 23:10:28 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +52 -34 lines
Diff to previous 1.72 (colored) to selected 1.66 (colored)

Do alignment of non-numeric strings in numeric cells the same way
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.

Revision 1.72 / (download) - annotate - [select for diffs], Sat Aug 18 20:18:14 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +9 -4 lines
Diff to previous 1.71 (colored) to selected 1.66 (colored)

If a tbl(7) column contains both text cells and numeric cells,
horizontally align the numbers in the same way as groff does.

Revision 1.71 / (download) - annotate - [select for diffs], Sat Aug 18 16:44:55 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +5 -7 lines
Diff to previous 1.70 (colored) to selected 1.66 (colored)

Do not allocate a column for decimal points if all numbers are integers.

Revision 1.70 / (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.69: +10 -3 lines
Diff to previous 1.69 (colored) to selected 1.66 (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.69 / (download) - annotate - [select for diffs], Thu Jun 15 00:27:52 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +3 -2 lines
Diff to previous 1.68 (colored) to selected 1.66 (colored)

round default width of tbl(7) text blocks in the same way as groff

Revision 1.68 / (download) - annotate - [select for diffs], Wed Jun 14 18:23:37 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +2 -4 lines
Diff to previous 1.67 (colored) to selected 1.66 (colored)

let \l use the right fill character

Revision 1.67 / (download) - annotate - [select for diffs], Mon Jun 12 22:05:57 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +4 -3 lines
Diff to previous 1.66 (colored)

If a tbl(7) layout contains a 'w' (minimum width) modifier for a
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.

Revision 1.66 / (download) - annotate - [selected], Mon Jun 12 20:14:18 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +19 -12 lines
Diff to previous 1.65 (colored)

fix column width calculation for text block cells

Revision 1.65 / (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.64: +39 -15 lines
Diff to previous 1.64 (colored) to selected 1.66 (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.64 / (download) - annotate - [select for diffs], Thu Jun 8 12:54:58 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +7 -8 lines
Diff to previous 1.63 (colored) to selected 1.66 (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.63 / (download) - annotate - [select for diffs], Mon May 1 20:54:59 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +6 -3 lines
Diff to previous 1.62 (colored) to selected 1.66 (colored)

When trying to expand some columns in a table where the sum of the
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.

Revision 1.62 / (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.61: +1 -5 lines
Diff to previous 1.61 (colored) to selected 1.66 (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.61 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:19 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +4 -4 lines
Diff to previous 1.60 (colored) to selected 1.66 (colored)

modernize style: "return" is not a function

Revision 1.60 / (download) - annotate - [select for diffs], Sat Sep 26 00:54:04 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +1 -2 lines
Diff to previous 1.59 (colored) to selected 1.66 (colored)

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

Revision 1.59 / (download) - annotate - [select for diffs], Fri Jan 30 04:11:50 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored) to selected 1.66 (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.58 / (download) - annotate - [select for diffs], Wed Jan 28 02:23:49 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +31 -7 lines
Diff to previous 1.57 (colored) to selected 1.66 (colored)

adjust formatting for the tbl(7) layout 'x' modifier (maximize column)
to match groff for up to six maximized columns

Revision 1.57 / (download) - annotate - [select for diffs], Tue Dec 23 13:48:57 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +1 -4 lines
Diff to previous 1.56 (colored) to selected 1.66 (colored)

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

Revision 1.56 / (download) - annotate - [select for diffs], Tue Dec 23 09:31:46 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +33 -34 lines
Diff to previous 1.55 (colored) to selected 1.66 (colored)

some scaling unit fixes:
- .sp with an invalid argument is .sp 1v, not .sp 0v
- in man(1), trailing garbage doesn't make scaling units invalid

Revision 1.55 / (download) - annotate - [select for diffs], Tue Dec 23 03:28:01 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.54: +13 -44 lines
Diff to previous 1.54 (colored) to selected 1.66 (colored)

In a2roffsu(), do not parse the number twice.
Gets rid of 25 lines of code and one static buffer.
No functional change for numbers shorter than BUFSIZ characters.

Revision 1.54 / (download) - annotate - [select for diffs], Thu Dec 4 02:05:42 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.53: +2 -2 lines
Diff to previous 1.53 (colored) to selected 1.66 (colored)

fix handling of roff requests having a default scale other than "n",
in particular .sp which uses "v", when the scale is not specified;
cures groff-mandoc differences in about a dozen Xenocara manuals

Revision 1.53 / (download) - annotate - [select for diffs], Tue Oct 14 18:18:05 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored) to selected 1.66 (colored)

even if a table has zero columns, do not segfault in the formatter;
bug reported by bentley@

Revision 1.52 / (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.51: +70 -6 lines
Diff to previous 1.51 (colored) to selected 1.66 (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.51 / (download) - annotate - [select for diffs], Tue Aug 12 19:28:16 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_4, VERSION_1_12
Changes since 1.50: +2 -2 lines
Diff to previous 1.50 (colored) to selected 1.66 (colored)

In mdoc(7) and man(7), if a width is given as a bare number without
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.

Revision 1.50 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +1 -3 lines
Diff to previous 1.49 (colored) to selected 1.66 (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.49 / (download) - annotate - [select for diffs], Fri Aug 1 19:25:52 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.48: +3 -3 lines
Diff to previous 1.48 (colored) to selected 1.66 (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.48 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:05 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +27 -26 lines
Diff to previous 1.47 (colored) to selected 1.66 (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.47 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.46: +2 -1 lines
Diff to previous 1.46 (colored) to selected 1.66 (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.46 / (download) - annotate - [select for diffs], Sat Oct 5 20:30:05 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3
Changes since 1.45: +1 -4 lines
Diff to previous 1.45 (colored) to selected 1.66 (colored)

Cleanup suggested by gcc-4.8.1, following hints by Christos Zoulas:
- 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

Revision 1.45 / (download) - annotate - [select for diffs], Fri May 31 21:37:17 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_2
Changes since 1.44: +10 -10 lines
Diff to previous 1.44 (colored) to selected 1.66 (colored)

The name "struct tbl" was badly misleading for two reasons:
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.

Revision 1.44 / (download) - annotate - [select for diffs], Sun May 27 17:54:54 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +1 -20 lines
Diff to previous 1.43 (colored) to selected 1.66 (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.43 / (download) - annotate - [select for diffs], Tue Sep 20 23:05:49 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_1, VERSION_1_12_0
Changes since 1.42: +11 -42 lines
Diff to previous 1.42 (colored) to selected 1.66 (colored)

Major rewrite of the horizontal spacing of tables
to work both with and without frames and rulers.
ok kristaps@

Revision 1.42 / (download) - annotate - [select for diffs], Sun Jul 24 18:15:14 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_7, VERSION_1_11_6, VERSION_1_11_5
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored) to selected 1.66 (colored)

Scary-looking but otherwise harmless changes allow me to build for Windows.
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.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Jul 17 15:24:25 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.40: +1 -43 lines
Diff to previous 1.40 (colored) to selected 1.66 (colored)

Remove unused function.

Revision 1.40 / (download) - annotate - [select for diffs], Sat Apr 9 15:29:40 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_4, VERSION_1_11_3, VERSION_1_11_2
Changes since 1.39: +1 -238 lines
Diff to previous 1.39 (colored) to selected 1.66 (colored)

Remove a2roffdeco() and mandoc_special() functions and replace them with
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.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Mar 17 08:49:34 2011 UTC (13 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_1, VERSION_1_10_10
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (colored) to selected 1.66 (colored)

Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.h
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.

Revision 1.38 / (download) - annotate - [select for diffs], Tue Mar 15 16:23:51 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.37: +3 -2 lines
Diff to previous 1.37 (colored) to selected 1.66 (colored)

Make lint shut up a little bit.

Revision 1.37 / (download) - annotate - [select for diffs], Sun Jan 30 16:05:37 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +45 -1 lines
Diff to previous 1.36 (colored) to selected 1.66 (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@ jmc@ and tested by Matthieu Herrb (matthieu at openbsd dot org)

Revision 1.36 / (download) - annotate - [select for diffs], Tue Jan 25 12:07:30 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +3 -3 lines
Diff to previous 1.35 (colored) to selected 1.66 (colored)

correct horizontal spacing of data cells
correct alignment of centered cells
adjust horizontal rule width to the new spacing
ok kristaps@

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jan 11 14:12:01 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.34: +3 -1 lines
Diff to previous 1.34 (colored) to selected 1.66 (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.34 / (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.33: +14 -11 lines
Diff to previous 1.33 (colored) to selected 1.66 (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.33 / (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.32: +2 -3 lines
Diff to previous 1.32 (colored) to selected 1.66 (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.32 / (download) - annotate - [select for diffs], Sat Jan 8 17:16:48 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored) to selected 1.66 (colored)

The numerical column type centres on the *last* decimal point.

Revision 1.31 / (download) - annotate - [select for diffs], Sat Jan 8 17:00:27 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.30: +9 -7 lines
Diff to previous 1.30 (colored) to selected 1.66 (colored)

Give the "n" cell type knowledge of its spacing.

Revision 1.30 / (download) - annotate - [select for diffs], Wed Jan 5 15:37:23 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_9
Changes since 1.29: +203 -1 lines
Diff to previous 1.29 (colored) to selected 1.66 (colored)

Stuff tbl_calc() into out.c so that it can be shared by all output modes
(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.

Revision 1.29 / (download) - annotate - [select for diffs], Sun Aug 29 11:28:09 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_8, VERSION_1_10_7, VERSION_1_10_6
Changes since 1.28: +3 -1 lines
Diff to previous 1.28 (colored) to selected 1.66 (colored)

Remove overstrike `\o'.  This isn't the best solution because we really
should be printing the contents, but for the time being, this is good
enough.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Aug 24 13:56:51 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.27: +21 -1 lines
Diff to previous 1.27 (colored) to selected 1.66 (colored)

Handle nested, recursive mathematical subexpressions.  This is
definitely not general, but it's good enough for pod2man definitions
(after I clean up the roff, which will be addressed in later fixes).

Revision 1.27 / (download) - annotate - [select for diffs], Tue Aug 24 13:39:37 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.26: +3 -1 lines
Diff to previous 1.26 (colored) to selected 1.66 (colored)

Strip out `\k' escape.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Aug 24 13:07:01 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.25: +7 -1 lines
Diff to previous 1.25 (colored) to selected 1.66 (colored)

Stripping out of `\w' groff escape.  Yet another for pod2man...

Revision 1.25 / (download) - annotate - [select for diffs], Tue Aug 24 12:18:49 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.24: +11 -2 lines
Diff to previous 1.24 (colored) to selected 1.66 (colored)

Strip out the `\z' escape.  This is the first recursive sequence,
getting mandoc ready to handle pod2man's complex escapes.

Revision 1.24 / (download) - annotate - [select for diffs], Mon Aug 16 09:37:58 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.23: +11 -8 lines
Diff to previous 1.23 (colored) to selected 1.66 (colored)

Add \v and \h to ignored escapes.  These are in the category of \s.
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.

Revision 1.23 / (download) - annotate - [select for diffs], Thu Jul 22 23:03:15 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_5_PREPDF, VERSION_1_10_5
Changes since 1.22: +2 -1 lines
Diff to previous 1.22 (colored) to selected 1.66 (colored)

Added `in' macro support for -man -Tascii.  This is not yet supported in
-Thtml (I'm surprised to note that neither is LITERAL mode).

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jul 22 14:03:50 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +4 -1 lines
Diff to previous 1.21 (colored) to selected 1.66 (colored)

Accept "\s0" (i.e., properly ignore it).  Found in the wild (e.g., gfdl.7).

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jul 21 20:35:03 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored) to selected 1.66 (colored)

Accomodate for groff's crappy behaviour wherein an unrecognised
single-character escape (and ONLY this type of escape) will map back
into itself:

       "If a backslash is followed by a character that does not
	constitute a defined escape sequence the backslash is silently
        ignored and the  character maps to itself."

(From groff.7.)

Found by Jason McIntyre.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jul 19 07:53:40 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.19: +6 -16 lines
Diff to previous 1.19 (colored) to selected 1.66 (colored)

Double-up DECO_RESERVED switch branch for colours.

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jul 18 23:06:18 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.18: +17 -1 lines
Diff to previous 1.18 (colored) to selected 1.66 (colored)

Properly discard \m colour escapes.  Noted by J.C. Roberts.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jul 18 22:55:06 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +91 -180 lines
Diff to previous 1.17 (colored) to selected 1.66 (colored)

Throw out a2roffdeco() in out.c for a readable version.  The prior one
was completely unmaintainable.  The new one is both readable and quite
similar to mandoc_special(), which in future versions will easily allow
throwing-away of unsupported escapes (such as \m).  It's also a fair bit
smaller.

DECO_SIZE has been removed: this crap, like colours, will not be
supported.

mandoc_special() also has #if 0'd switch branches for ALL groff.7
escapes and some lint fixes.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Jun 25 19:50:23 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_4, VERSION_1_10_3
Changes since 1.16: +1 -3 lines
Diff to previous 1.16 (colored) to selected 1.66 (colored)

Remove "pt" from struct roffsu, as CSS (the only reason it was there) is
unclear about which units accept floats/integers, which leads me to
assume that it handles either and rounds as appropriate.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jun 19 20:46:28 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_2
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored) to selected 1.66 (colored)

Churn as I finish email address migration kth.se -> bsd.lv.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Apr 7 11:29:55 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_25, VERSION_1_9_24, VERSION_1_9_23, VERSION_1_10_1
Changes since 1.14: +2 -3 lines
Diff to previous 1.14 (colored) to selected 1.66 (colored)

Lint fix.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Apr 7 11:25:38 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +95 -53 lines
Diff to previous 1.13 (colored) to selected 1.66 (colored)

Add support/ignoring of \f(xy, \f[X...], \F(xy, \FX, \F[X...] roff-style font escapes (noted by Frantisek Holop).

Revision 1.13 / (download) - annotate - [select for diffs], Wed Apr 7 07:49:38 2010 UTC (13 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +9 -7 lines
Diff to previous 1.12 (colored) to selected 1.66 (colored)

Bug in printing of reserved words with form \*[xxx] fixed (found by Joerg Sonnenberger).

Revision 1.12 / (download) - annotate - [select for diffs], Fri Jan 1 17:14:30 2010 UTC (14 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_22, VERSION_1_9_21, VERSION_1_9_20, VERSION_1_9_19, VERSION_1_9_18, VERSION_1_9_17, VERSION_1_9_16, VERSION_1_9_15-pre2, VERSION_1_9_15
Changes since 1.11: +5 -5 lines
Diff to previous 1.11 (colored) to selected 1.66 (colored)

Big check-in of compatibility layer.  This should work on most major architectures. Thanks to Joerg Sonnenberger.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Nov 12 08:21:05 2009 UTC (14 years, 4 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_15-pre1, VERSION_1_9_14
Changes since 1.10: +6 -1 lines
Diff to previous 1.10 (colored) to selected 1.66 (colored)

Fixed \c support for all input and output modes (documented in mandoc_char.7).

Revision 1.10 / (download) - annotate - [select for diffs], Sun Nov 8 09:23:35 2009 UTC (14 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +67 -75 lines
Diff to previous 1.9 (colored) to selected 1.66 (colored)

a2roffdeco() now supports \s escapes.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Nov 7 14:14:15 2009 UTC (14 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +2 -3 lines
Diff to previous 1.8 (colored) to selected 1.66 (colored)

Hooked up -Tascii to a2roffdeco backend.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Nov 7 08:26:45 2009 UTC (14 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +193 -1 lines
Diff to previous 1.7 (colored) to selected 1.66 (colored)

Initial abstraction of front-end decoration events (special characters, text decorations, etc.).

Revision 1.7 / (download) - annotate - [select for diffs], Thu Oct 22 18:59:00 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_13, VERSION_1_9_12, VERSION_1_9_11, VERSION_1_9_10
Changes since 1.6: +5 -1 lines
Diff to previous 1.6 (colored) to selected 1.66 (colored)

Linuxisms.

Revision 1.6 / (download) - annotate - [select for diffs], Thu Oct 22 18:55:32 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +46 -1 lines
Diff to previous 1.5 (colored) to selected 1.66 (colored)

Fixed maddening mismatch between groff and strftime mismatch of day ("%e").  Noted by Ulrich Sporlein.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Oct 18 19:02:10 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_9
Changes since 1.4: +13 -20 lines
Diff to previous 1.4 (colored) to selected 1.66 (colored)

Had out.h roff-scale converters accept default unit scale (because -mdoc and -man differ).

Revision 1.4 / (download) - annotate - [select for diffs], Fri Oct 9 06:54:11 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_8, VERSION_1_9_7
Changes since 1.3: +30 -6 lines
Diff to previous 1.3 (colored) to selected 1.66 (colored)

Scaling factor made floating point (as per groff.7) and, e.g., gnu/usr.bin/cvs/man/cvs.1.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Oct 7 12:35:24 2009 UTC (14 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.2: +69 -80 lines
Diff to previous 1.2 (colored) to selected 1.66 (colored)

Additions to -Tman -Thtml: all structural components tested & in place.
Fitted both -Thtml with handling of arbitrary vertical and horizontal scaling units (see groff(7)).  Undocumented until fitted into -Tascii (next release).

Revision 1.2, Mon Sep 21 13:06:13 2009 UTC (14 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_9_5
Changes since 1.1: +1 -1 lines
FILE REMOVED

Removed new-born out.{h,c} (not a good idea).
Removed if 0 for HTML-mode output (why not).
Added option -oxxxx for passing options to output devices.

Revision 1.1 / (download) - annotate - [select for diffs], Mon Sep 21 00:39:02 2009 UTC (14 years, 6 months ago) by kristaps
Branch: MAIN
Diff to selected 1.66 (colored)

Tentative addition of front-end utility functions (out.h) (not sure if it's necessary).
More -Thtml installments.

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