CVS log for mandoc/Attic/libroff.h

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

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.44, Thu Dec 13 03:40:13 2018 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.43: +1 -1 lines
FILE REMOVED

Cleanup, no functional change:
In libroff.h, nothing was left except the eqn(7) parser interface, which
isn't really part of the roff(7) parser, so rename it to eqn_parse.h.

While here, move struct eqn_def to eqn.c because that's the only
file using it, and let eqn_box_free() and eqn_free() handle NULL.

Revision 1.43 / (download) - annotate - [select for diffs], Thu Dec 13 02:06:07 2018 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.42: +3 -35 lines
Diff to previous 1.42 (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.42 / (download) - annotate - [select for diffs], Sat Jul 8 17:52:49 2017 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4, VERSION_1_14_3, VERSION_1_14_2
Changes since 1.41: +5 -5 lines
Diff to previous 1.41 (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], Sat Jul 8 14:51:04 2017 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +7 -7 lines
Diff to previous 1.40 (colored)

1. Eliminate struct eqn, instead use the existing members
of struct roff_node which is allocated for each equation anyway.
2. Do not keep a list of equation parsers, one parser is enough.
Minus fifty lines of code, no functional change.

Revision 1.40 / (download) - annotate - [select for diffs], Mon Jun 26 20:09:04 2017 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +4 -3 lines
Diff to previous 1.39 (colored)

Complete rewrite of the lexer in a single function with four operation
modes instead of four functions, resulting in considerable
simplification, fifty lines less of code, fifteen fewer automatic
variables, and several bug fixes, for example:

1. The delim control statement consumes exactly two bytes of input,
requires no whitespace after these two bytes, and does not treat
quotes in any special way.
2. If the argument of left, right, gfont, gsize, or size is defined
as an alias, only the first word of the value is used as the
delimiter, font name, or font size.
3. If a back, fwd, down, or up keyword is followed by another keyword
instead of the required number, GNU eqn does nothing useful, but
typically errors out.  So no need to have special handling (with
an ugly goto!) for it in mandoc.

Also getting rid of one pointless static buffer and twelve redundant
calls to strlcpy(3).

Revision 1.39 / (download) - annotate - [select for diffs], Sat Nov 7 14:01:16 2015 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1, VERSION_1_13_4, VERSION_1_13
Changes since 1.38: +1 -4 lines
Diff to previous 1.38 (colored)

In private header files, __BEGIN_DECLS and __END_DECLS are pointless.
Because these work slightly differently on different systems,
they are becoming a maintenance burden in the portable version,
so delete them.

Besides, one of the chief design goals of the mandoc toolbox is to
make sure that nothing related to documentation requires C++.
Consequently, linking mandoc against any kind of C++ program would
defeat the purpose and is not supported.
I don't understand why kristaps@ added them in the first place.

Revision 1.38 / (download) - annotate - [select for diffs], Fri Jan 30 04:11:50 2015 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.37: +1 -3 lines
Diff to previous 1.37 (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], Wed Jan 28 17:32:07 2015 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (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.36 / (download) - annotate - [select for diffs], Wed Jan 28 15:03:45 2015 UTC (6 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +6 -6 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Wed Jan 21 00:47:04 2015 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Wed Jan 14 22:44:55 2015 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +3 -3 lines
Diff to previous 1.33 (colored)

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

Revision 1.33 / (download) - annotate - [select for diffs], Mon Dec 1 08:05:52 2014 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

header cleanup:
* add missing forward declarations
* remove needless header inclusions
* some style unification

Revision 1.32 / (download) - annotate - [select for diffs], Mon Dec 1 04:05:32 2014 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +1 -5 lines
Diff to previous 1.31 (colored)

remove unneccessary inclusion protection; patch from deraadt@

Revision 1.31 / (download) - annotate - [select for diffs], Sat Oct 25 14:35:37 2014 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Report arguments to .EQ as an error, and simplify the code:
* drop trivial wrapper function roff_openeqn()
* drop unused first arg of function eqn_alloc()
* drop usused member "name" of struct eqn_node
While here, sync to OpenBSD by killing some trailing blanks.

Revision 1.30 / (download) - annotate - [select for diffs], Thu Oct 16 01:11:20 2014 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +15 -11 lines
Diff to previous 1.29 (colored)

Implement in-line equations, much needed by Xenocara manuals.
Put the steering into the roff parser rather than into the mdoc
parser such that it works for all macro languages and on both text
and macro lines.
Line breaks and blank characters generated before and after in-line
equations are not perfect yet, but let's do one thing at a time.

Revision 1.29 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:04 2014 UTC (7 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1, VERSION_1_12_4, VERSION_1_12
Changes since 1.28: +3 -3 lines
Diff to previous 1.28 (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], Fri May 31 21:37:17 2013 UTC (8 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3, VERSION_1_12_2
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (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.27 / (download) - annotate - [select for diffs], Mon Jul 25 15:37:00 2011 UTC (10 years, 2 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.26: +3 -3 lines
Diff to previous 1.26 (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.26 / (download) - annotate - [select for diffs], Sat Jul 23 18:41:18 2011 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_5
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

Add support for tdefine and ndefine.  Consolidate some error messages.  Add
somem more version notes (getting there).  Have the equation nanme be captured.

Revision 1.25 / (download) - annotate - [select for diffs], Fri Jul 22 14:55:07 2011 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.24: +2 -1 lines
Diff to previous 1.24 (colored)

Add support for `gsize' eqn token (introduced in second-edition troff).

Revision 1.24 / (download) - annotate - [select for diffs], Thu Jul 21 23:30:39 2011 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.23: +2 -1 lines
Diff to previous 1.23 (colored)

Complete eqn.7 parsing.  Features all productions from the original 1975
CACM paper in an LR(1) parse (1 -> eqn_rewind()).  Right now the code is
a little jungly, but will clear up as I consolidate parse components.
The AST structure will also be cleaned up, as right now it's pretty ad
hoc (this won't change the parse itself).  I added the mandoc_strndup()
function will here.

Revision 1.23 / (download) - annotate - [select for diffs], Thu Jul 21 10:24:35 2011 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +12 -9 lines
Diff to previous 1.22 (colored)

Finish the eqn syntactic parser.  This correctly parses terms and does
the proper `define' dance, which amounts to pure word-replace (you can,
say, define `foo' as `define' then define `define' as something else).
eqn.c is now ready for some semantic parsing of `box' and `eqn'
productions as defined by the grammar.

Revision 1.22 / (download) - annotate - [select for diffs], Sun Jul 17 12:13:37 2011 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +13 -3 lines
Diff to previous 1.21 (colored)

Add initial `define' support for eqn(7).
This works by iterating over a simple list.  It's a slow, auditable
early implementation.  Data is read (the reading function will be
reused) then parsed, then the line re-run if remaining stuff exists.
Note this function isn't the same as mandoc_getarg(), as eqn(7) uses a
different system for reading quoted strings.
This doesn't actually use the defines.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jul 12 21:32:43 2011 UTC (10 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +3 -2 lines
Diff to previous 1.20 (colored)

Have equation be allocated with mparse.  Will be needed for logging of
messages.

Revision 1.20 / (download) - annotate - [select for diffs], Sun Mar 20 16:02:05 2011 UTC (10 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_4, VERSION_1_11_3, VERSION_1_11_2, VERSION_1_11_1
Changes since 1.19: +3 -7 lines
Diff to previous 1.19 (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.19 / (download) - annotate - [select for diffs], Wed Feb 9 09:05:52 2011 UTC (10 years, 7 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_10
Changes since 1.18: +1 -3 lines
Diff to previous 1.18 (colored)

Allow EQN data to be pushed down into libmdoc via mdoc_addeqn().  Only
the adding itself is implemented; equation data is not yet shown.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Feb 6 20:36:36 2011 UTC (10 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +12 -1 lines
Diff to previous 1.17 (colored)

Add initial EQN support to mandoc.  This parses, then throws away, data
between EQ and EN roff blocks.  EQN is different from TBL in that data
after .EQ is unilaterally considered an equation until an .EN.  Thus,
there's no need to jump through hoops in having table spans and so on.
This is ONLY the parse code framework in libroff.  EQN is not yet passed
into the backends.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jan 25 12:24:27 2011 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +4 -3 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Tue Jan 4 15:02:00 2011 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_9
Changes since 1.15: +4 -2 lines
Diff to previous 1.15 (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.15 / (download) - annotate - [select for diffs], Sun Jan 2 10:10:57 2011 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.14: +15 -26 lines
Diff to previous 1.14 (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.14 / (download) - annotate - [select for diffs], Sat Jan 1 22:19:15 2011 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +3 -1 lines
Diff to previous 1.13 (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.13 / (download) - annotate - [select for diffs], Sat Jan 1 16:10:40 2011 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

Raise an error if a table is closed without data.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Jan 1 15:45:18 2011 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.11: +5 -2 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Fri Dec 31 18:19:43 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +2 -57 lines
Diff to previous 1.10 (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 (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (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 10:26:00 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +3 -1 lines
Diff to previous 1.8 (colored)

Assign layout cells to parsed data.  This follows primarily from
tbl.bsd.lv, although it has been reimplemented.

Revision 1.8 / (download) - annotate - [select for diffs], Thu Dec 30 09:34:06 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +7 -4 lines
Diff to previous 1.7 (colored)

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

Revision 1.7 / (download) - annotate - [select for diffs], Wed Dec 29 16:44:23 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +20 -1 lines
Diff to previous 1.6 (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.6 / (download) - annotate - [select for diffs], Wed Dec 29 14:53:31 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +2 -1 lines
Diff to previous 1.5 (colored)

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

Revision 1.5 / (download) - annotate - [select for diffs], Wed Dec 29 14:38:14 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +41 -3 lines
Diff to previous 1.4 (colored)

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

Revision 1.4 / (download) - annotate - [select for diffs], Wed Dec 29 01:18:23 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +1 -2 lines
Diff to previous 1.3 (colored)

Whack removed function from libroff.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Dec 29 01:16:57 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.2: +8 -15 lines
Diff to previous 1.2 (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.2 / (download) - annotate - [select for diffs], Tue Dec 28 13:46:07 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +36 -2 lines
Diff to previous 1.1 (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.1 / (download) - annotate - [select for diffs], Tue Dec 28 10:51:03 2010 UTC (10 years, 8 months ago) by kristaps
Branch: MAIN

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