summaryrefslogtreecommitdiffstats
path: root/roff.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove the ENDBODY_NOSPACE flag, simplifying the code.Ingo Schwarze2017-02-161-2/+1
| | | | | | | | Comparing to groff output, it appears that all cases where it was used and made a difference actually require the opposite, ENDBODY_SPACE. I have no idea why i added it back in 2010; maybe to compensate for some other bug that has long been fixed.
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-11/+8
|
* Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.Ingo Schwarze2017-01-101-2/+4
| | | | | | | | | Use them to mark generated nodes and nodes that shall not produce output. Let -Ttree output mode display these new flags. Use NODE_NOSRC for .Ar, .Mt, and .Pa default arguments. Use NODE_NOPRT for .Dd, .Dt, and .Os. These will help to make handling of text production macros more rigorous.
* Delete the redundant "nchild" member of struct roff_node, replacingIngo Schwarze2016-01-081-1/+0
| | | | | | | | most uses by one, a few by two pointer checks, and only one by a tiny loop - not only making data smaller, but code shorter as well. This gets rid of an implicit invariant that confused both static analysis tools and human auditors. No functional change.
* In private header files, __BEGIN_DECLS and __END_DECLS are pointless.Ingo Schwarze2015-11-071-3/+0
| | | | | | | | | | | | 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.
* Very tricky diff to fix macro interpretation and spacing around tabsIngo Schwarze2015-10-171-2/+5
| | | | | | | | | | | | | | in .Bl -column; it took me more than a day to get this right. Triggered by a loosely related bug report from tim@. The lesson for you is: Use .Ta macros in .Bl -column, avoid tabs, or you are in for surprises: The last word before a tab is not interpreted as a macro (unless there is a blank in between), the first word after a tab isn't either (unless there is a blank in between), and a blank after a tab causes a leading blank in the respective output cell. Yes, "blank", "tab", "blank tab" and "tab blank" all have different semantics; if you write code relying on that, good luck maintaining it afterwards...
* Unify mdoc_deroff() and man_deroff() into a common function deroff().Ingo Schwarze2015-04-231-0/+6
| | | | | | | | No functional change except that for mdoc(7), it now skips leading escape sequences just like it already did for man(7). Escape sequences rarely occur in mdoc(7) code and if they do, skipping them is an improvement in this context. Minus 30 lines of code.
* Decouple the token code for "no request or macro" from the individualIngo Schwarze2015-04-191-0/+1
| | | | | | high-level parsers to allow further unification of functions that only need to recognize this code, but that don't care about different high-level macrosets beyond that.
* Profit from the unified struct roff_man and reduce the number ofIngo Schwarze2015-04-181-0/+7
| | | | | arguments of mparse_result() by one. No functional change. Written on the ICE Bruxelles-Koeln on the way back from p2k15.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-1/+35
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Third step towards parser unification:Ingo Schwarze2015-04-021-0/+11
| | | | | Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta. Written of the train from London to Exeter on the way to p2k15.
* Second step towards parser unification:Ingo Schwarze2015-04-021-0/+77
| | | | | | | | | Replace struct mdoc_node and struct man_node by a unified struct roff_node. To be able to use the tok member for both mdoc(7) and man(7) without defining all the macros in roff.h, sacrifice a tiny bit of type safety and make tok an int rather than an enum. Almost mechanical, no functional change. Written on the Eurostar from Bruxelles to London on the way to p2k15.
* First step towards parser unification:Ingo Schwarze2015-04-021-0/+29
| | | | | | Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
* Step 2: blow away roff.h, as all of its functions have been moved intoKristaps Dzonsons2011-03-221-24/+0
| | | | libmandoc.h and there's nothing left.
* Step 1 of restructuring: libmandoc.h. Move all compiler-set-specificKristaps Dzonsons2011-03-221-23/+0
| | | | | | | | | | stuff into libmandoc.h, including old mdoc.h/man.h/roff.h functions now used by read.c. The motivation behind this is to tighten the relationship between the underlying compilers while keeping parse data hidden from general callers (e.g., main.c). While here, also move register values from mandoc.h into libmandoc.h as noted by schwarze@. See above for explanation.
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-1/+1
| | | | | | | | | 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-0/+1
| | | | 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/+1
| | | | | | | | 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.
* More checks for proper table exit.Kristaps Dzonsons2011-01-011-1/+1
|
* Expose the parsed table API to the world and add accessors through theKristaps Dzonsons2010-12-311-0/+1
| | | | roff.h interface.
* Initial tbl framework. Parse point is in libroff, which keeps aKristaps Dzonsons2010-12-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge restructuring of main.c code. This provided by schwarze@ and inspectedKristaps Dzonsons2010-12-011-0/+3
| | | | | | | | carefully by joerg@. Merge roff.h header for compilation's sake (this is not yet implemented in roff.c.). THIS IS A BUGGY CHECK-IN. The manual type is erroneously kept between runs of the compiler. This is a known bug.
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-1/+1
| | | | | | | | | | | | | | | | | We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
* Downstream maintainers: this removes UGLY! I don't want divergingKristaps Dzonsons2010-06-271-3/+3
| | | | | | | | | functionality and UGLY works quite well thanks to schwarze@'s careful attention. This also backs out function-prototype changes for struct regset, instead stuffing a pointer to the regset directly into struct mdoc/man/roff.
* First step of adding register support. This is inspired by a significantKristaps Dzonsons2010-06-261-2/+2
| | | | | | patch by schwarze@. This commit adds support to libroff parsing `nr' into register set defined in regs.h. This will propogate into libmdoc and libman in later commits.
* libroff now is aware of which sub-nodes should be interpreted even in aKristaps Dzonsons2010-05-171-1/+1
| | | | | | | | | | conditional-negative context so as to preserve structural integrity. Initial "rules" (deny/allow) are now inherited for future work in evaluating conditionals. Lint-fix noted by Joerg. Added regression tests for zany constructs.
* Allow roff_parseln() to be re-run.Kristaps Dzonsons2010-05-161-4/+6
| | | | | | | | | Allow roff_parseln() to manipulate the line buffer offset. This is used in situations like `.ie n .TH FOO 1' or `.ie n .ie n', where the line buffer offset is recalculated then the roff parser re-run. Fix mdoc_parseln() and man_parseln() to accept the initial line offset. WARNING: backed-out ALL roff macros whilst accomodating for how roff handles multi-line conditionals (in short, re-running the parser).
* Add mandoc.h, which will eventually replace compilers' inner enum errors ↵Kristaps Dzonsons2010-05-151-5/+5
| | | | | | with unified ones. Add initial roff pre-processor shim, a compiler sitting outside of the other compilers that processes pure roff instructions.
* Initial roff shim skeleton in place.Kristaps Dzonsons2010-05-151-0/+38
|
* More file pruning.Kristaps Dzonsons2008-12-151-302/+0
|
* *** empty log message ***Kristaps Dzonsons2008-12-101-1/+1
|
* Added warnings for using macros in the wrong sections.Kristaps Dzonsons2008-12-081-122/+136
|
* *** empty log message ***Kristaps Dzonsons2008-12-071-1/+1
|
* *** empty log message ***Kristaps Dzonsons2008-12-071-21/+21
|
* *** empty log message ***Kristaps Dzonsons2008-12-071-1/+1
|
* .St macros in place.Kristaps Dzonsons2008-12-061-5/+5
|
* *** empty log message ***Kristaps Dzonsons2008-12-061-29/+28
|
* *** empty log message ***Kristaps Dzonsons2008-12-061-3/+3
|
* *** empty log message ***Kristaps Dzonsons2008-12-061-1/+1
|
* *** empty log message ***Kristaps Dzonsons2008-12-051-0/+289