summaryrefslogtreecommitdiffstats
path: root/roff.h
Commit message (Collapse)AuthorAgeFilesLines
* preserve comments before .Dd when converting mdoc(7) to man(7)Ingo Schwarze2018-04-111-0/+1
| | | | with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
* 1. Eliminate struct eqn, instead use the existing membersIngo Schwarze2017-07-081-1/+1
| | | | | | 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.
* add support for the MT and ME mailto macros, used for example in wg(8);Ingo Schwarze2017-06-251-0/+2
| | | | patch from bentley@
* Split -Wstyle into -Wstyle and the even lower -Wbase, and addIngo Schwarze2017-06-241-9/+3
| | | | | | | | | | | | | | | -Wopenbsd and -Wnetbsd to check conventions for the base system of a specific operating system. Mark operating system specific messages with "(OpenBSD)" at the end. Please use just "-Tlint" to check base system manuals (defaulting to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the manuals of portable software projects you maintain that are not part of OpenBSD base, to avoid bogus recommendations about base system conventions that do not apply. Issue originally reported by semarie@, solution using an idea from tedu@, discussed with jmc@ and jca@.
* style message about missing RCS ids; inspired by mdoclintIngo Schwarze2017-06-171-0/+1
|
* Naive implementation of the roff(7) .po (page offset) request.Ingo Schwarze2017-06-141-1/+1
| | | | | | This clearly works when .po is called on the top level, but might not be sophisticated enough if people call .po inside indentation-changing contexts, but i haven't seen that in manual pages (yet :).
* implement roff(7) .rj (right justify) requestIngo Schwarze2017-06-141-1/+1
|
* style checks related to .Er; inspired by mdoclint(1)Ingo Schwarze2017-06-071-0/+7
|
* Implement the roff(7) .rn (rename macro or string) request.Ingo Schwarze2017-06-071-0/+1
| | | | | | | | | | Renaming a user-defined macro is very simple: just copy the definition to the new name and delete the old name. Renaming high-level macros is a bit tricky: use a dedicated key-value-table, with non-standard names as keys and standard names as values. When a macro is found that is not user-defined, look it up in the "renamed" table and translate it back to the standard name before passing it on to the high-level parsers.
* Minimal implementation of the roff(7) .ce request (center a numberIngo Schwarze2017-06-061-1/+1
| | | | | of input lines without filling). Contrary to groff, high-level macros abort .ce mode for now.
* Implement the roff(7) .mc (right margin character) request.Ingo Schwarze2017-06-041-1/+1
| | | | | | The Tcl/Tk manual pages use this extensively. Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf; instead, implement a proper TERMP_BRNEVER flag.
* Basic implementation of the roff(7) .ti (temporary indent) request.Ingo Schwarze2017-05-081-1/+1
| | | | Needed by about four dozen ports (thanks to naddy@ for the research).
* Basic implementation of the roff(7) .ta (define tab stops) request.Ingo Schwarze2017-05-071-1/+1
| | | | | | This is the first feature made possible by the parser reorganization. Improves the formatting of the SYNOPSIS in many Xenocara GL manuals. Also important for ports, as reported by many, including naddy@.
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-3/+1
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-3/+1
|
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-2/+2
| | | | | modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
* Parser reorg:Ingo Schwarze2017-05-041-4/+3
| | | | | Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
* Parser unification: use nice ohashes for all three request and macro tables;Ingo Schwarze2017-04-291-0/+7
| | | | no functional change, minus two source files, minus 200 lines of code.
* Continue parser unification:Ingo Schwarze2017-04-241-2/+412
| | | | | | | | * Make enum rofft an internal interface as enum roff_tok in "roff.h". * Represent mdoc and man macros in enum roff_tok. * Make TOKEN_NONE a proper enum value and use it throughout. * Put the prologue macros first in the macro tables. * Unify mdoc_macroname[] and man_macroname[] into roff_name[].
* 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
|