summaryrefslogtreecommitdiffstats
path: root/libroff.h
Commit message (Collapse)AuthorAgeFilesLines
* Abolish struct tbl_head and replace it by an "int col" member inIngo Schwarze2015-01-301-2/+0
| | | | struct tbl_cell. No functional change, minus 40 lines of code.
* * Polish tbl(7) error reporting.Ingo Schwarze2015-01-281-1/+1
| | | | | | * 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.
* For now, it can't be helped that mandoc tbl(7) ignores high-level macros,Ingo Schwarze2015-01-281-5/+5
| | | | | | 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.
* blank lines in tables do not need special handling; simplifies codeIngo Schwarze2015-01-211-1/+1
| | | | and reduces groff/mandoc differences in OpenBSD base by about 1%
* simplify by getting rid of ROFF_ERR in tbl(7) parsing; no functional changeIngo Schwarze2015-01-141-2/+2
|
* header cleanup:Ingo Schwarze2014-12-011-2/+2
| | | | | | * add missing forward declarations * remove needless header inclusions * some style unification
* remove unneccessary inclusion protection; patch from deraadt@Ingo Schwarze2014-12-011-4/+0
|
* Report arguments to .EQ as an error, and simplify the code:Ingo Schwarze2014-10-251-1/+1
| | | | | | | * 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.
* Implement in-line equations, much needed by Xenocara manuals.Ingo Schwarze2014-10-161-10/+14
| | | | | | | | 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.
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-2/+2
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* The name "struct tbl" was badly misleading for two reasons:Ingo Schwarze2013-05-311-1/+1
| | | | | | | 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.
* Implement the first steps of equation parsing from within libmdoc.Kristaps Dzonsons2011-07-251-2/+2
| | | | | | 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.
* Add support for tdefine and ndefine. Consolidate some error messages. AddKristaps Dzonsons2011-07-231-1/+1
| | | | somem more version notes (getting there). Have the equation nanme be captured.
* Add support for `gsize' eqn token (introduced in second-edition troff).Kristaps Dzonsons2011-07-221-0/+1
|
* Complete eqn.7 parsing. Features all productions from the original 1975Kristaps Dzonsons2011-07-211-0/+1
| | | | | | | | 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.
* Finish the eqn syntactic parser. This correctly parses terms and doesKristaps Dzonsons2011-07-211-8/+11
| | | | | | | 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.
* Add initial `define' support for eqn(7).Kristaps Dzonsons2011-07-171-2/+12
| | | | | | | | | 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.
* Have equation be allocated with mparse. Will be needed for logging ofKristaps Dzonsons2011-07-121-1/+2
| | | | messages.
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-6/+2
| | | | | | | | | 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.
* Allow EQN data to be pushed down into libmdoc via mdoc_addeqn(). OnlyKristaps Dzonsons2011-02-091-2/+0
| | | | the adding itself is implemented; equation data is not yet shown.
* Add initial EQN support to mandoc. This parses, then throws away, dataKristaps Dzonsons2011-02-061-0/+11
| | | | | | | | 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.
* Since tbl_data() can now produce multiple spans, let parsebuf()Ingo Schwarze2011-01-251-2/+3
| | | | | | | 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@
* Support `T{' and `T}' data blocks. When a standalone `T{' isKristaps Dzonsons2011-01-041-1/+3
| | | | | | | 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.
* Churn to get parts of 'struct tbl' visible from mandoc.h: rename theKristaps Dzonsons2011-01-021-25/+14
| | | | | | | 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-0/+2
| | | | | | | | | | 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@).
* Raise an error if a table is closed without data.Kristaps Dzonsons2011-01-011-1/+1
|
* Add documentation bits for libroff's new roff_span().Kristaps Dzonsons2011-01-011-1/+4
| | | | | | Add bits to remember tbl's invocation point. Add ERROR class message if no data's in the table.
* Expose the parsed table API to the world and add accessors through theKristaps Dzonsons2010-12-311-56/+1
| | | | roff.h interface.
* Put parsed tables into a queue that's cleared at the end of parsing.Kristaps Dzonsons2010-12-311-0/+1
| | | | This completes the parsing phase of the new tbl implementation.
* Assign layout cells to parsed data. This follows primarily fromKristaps Dzonsons2010-12-301-0/+2
| | | | tbl.bsd.lv, although it has been reimplemented.
* Move clean-up of parsed tbl nodes into the tbl_clear() function, calledKristaps Dzonsons2010-12-301-3/+6
| | | | once per invocation.
* Initial check-in of table data-row processing. For the time being, thisKristaps Dzonsons2010-12-291-0/+19
| | | | | | 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.
* Add handling for `T&', which restarts a table except for its options.Kristaps Dzonsons2010-12-291-0/+1
|
* Merge, with considerable changes, tbl.bsd.lv's layout-handling code.Kristaps Dzonsons2010-12-291-2/+40
|
* Whack removed function from libroff.Kristaps Dzonsons2010-12-291-1/+0
|
* Significant update to options handling, which now departs almostKristaps Dzonsons2010-12-291-14/+7
| | | | | | | | | | | | | 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.
* Adding initial options processing (not hooked into parse yet). This isKristaps Dzonsons2010-12-281-1/+35
| | | | | more or less copied from tbl.bsd.lv and still needs integration with the general mandoc framework, e.g., with error messages.
* Initial tbl framework. Parse point is in libroff, which keeps aKristaps Dzonsons2010-12-281-0/+31
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.