aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_macro.c
Commit message (Collapse)AuthorAgeFilesLines
* Delete the redundant "nchild" member of struct roff_node, replacingIngo Schwarze2016-01-081-2/+2
| | | | | | | | 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.
* move man(7) validation into the dedicated validation phase, tooIngo Schwarze2015-10-221-19/+5
|
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-3/+3
|
* /* NOTREACHED */ after abort() is silly, delete itIngo Schwarze2015-09-261-2/+1
|
* Fill mode changes don't break next-line scope in all cases,Ingo Schwarze2015-09-041-3/+3
| | | | | | in particular not for tagged paragraphs. Issue found by Christian Neukirchen <chneukirchen at gmail dot com> in the exiv2(1) manual page.
* Get rid of two empty wrapper functions. No functional change.Ingo Schwarze2015-04-231-3/+2
|
* Unify trickier node handling functions.Ingo Schwarze2015-04-191-5/+4
| | | | | | | * man_elem_alloc() -> roff_elem_alloc() * man_block_alloc() -> roff_block_alloc() The functions mdoc_elem_alloc() and mdoc_block_alloc() remain for now because they need to do mdoc(7)-specific argument processing.
* Unify some node handling functions that use TOKEN_NONE.Ingo Schwarze2015-04-191-5/+5
| | | | | | | | * mdoc_word_alloc(), man_word_alloc() -> roff_word_alloc() * mdoc_word_append(), man_word_append() -> roff_word_append() * mdoc_addspan(), man_addspan() -> roff_addtbl() * mdoc_addeqn(), man_addeqn() -> roff_addeqn() Minus 50 lines of code, no functional change.
* Unify node handling functions:Ingo Schwarze2015-04-191-7/+9
| | | | | | | | | | | * node_alloc() for mdoc and man_node_alloc() -> roff_node_alloc() * node_append() for mdoc and man_node_append() -> roff_node_append() * mdoc_head_alloc() and man_head_alloc() -> roff_head_alloc() * mdoc_body_alloc() and man_body_alloc() -> roff_body_alloc() * mdoc_node_unlink() and man_node_unlink() -> roff_node_unlink() * mdoc_node_free() and man_node_free() -> roff_node_free() * mdoc_node_delete() and man_node_delete() -> roff_node_delete() Minus 130 lines of code, no functional change.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-9/+9
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Vastly simplify man(7) block unwinding, similar to mdoc_macro.c 1.171.Ingo Schwarze2015-04-031-119/+34
| | | | | Drop one enum type, two static functions, 70 lines of code. Also fixes the mpeg_encode(1) manual reported broken by naddy@.
* It turns out the man(7) parser suffers from unintelligible handlingIngo Schwarze2015-04-031-2/+2
| | | | | | | | of block rewinding, just like then mdoc(7) parser did. First step in getting rid of rew_scope(): Replace the only call where the target block is known. This commit is analogous to mdoc_macro.c rev. 1.167. One down, three to go.
* Second step towards parser unification:Ingo Schwarze2015-04-021-18/+17
| | | | | | | | | 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-29/+30
| | | | | | 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.
* The .PD macro can occur in next-line scope. Fixes zshmisc(1).Ingo Schwarze2015-03-201-2/+2
| | | | Issue reported by Christian Neukirchen <chneukirchen at gmail dot com>.
* Simplify by almost halving the number of macro flags:Ingo Schwarze2015-03-201-16/+18
| | | | | | | 1. MAN_EXPLICIT was used iff fp == blk_exp, so just test fp. 2. MAN_FSCOPED was used only for TP, so just test for TP. 3. MAN_NOCLOSE was completely unused. No functional change.
* better error reporting regarding .OP .RS .UR .TH argumentsIngo Schwarze2015-02-061-17/+11
|
* better diagnostics about excess arguments to .PD .ft .spIngo Schwarze2015-02-061-1/+8
|
* better error reporting for .br .fi .nf with argumentsIngo Schwarze2015-02-061-1/+8
|
* preserve .PP before .RE; effect found in audio/pms(1)Ingo Schwarze2015-01-241-2/+13
|
* Strangely, ignoring the roff(7) .na request was implemented in the man(7)Ingo Schwarze2015-01-241-2/+1
| | | | | parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
* Support .RE with an argument; needed for audio/pms(1).Ingo Schwarze2015-01-241-3/+23
|
* Explicit block closure macros clobber next-line block head scope,Ingo Schwarze2014-12-161-3/+3
| | | | | just like explicit block macros themselves. Fixing an assertion failure jsg@ found with afl.
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-281-87/+54
| | | | and some cleanup; no functional change, minus 70 lines.
* Allow the five man(7) font macros to concatenate their line arguments,Ingo Schwarze2014-11-031-8/+11
| | | | | | | the same way the mdoc(7) macros marked MDOC_JOIN do it. In -Thtml, this removes bogus <br/> when the font macros are used in no-fill mode; issue found by jsg@ in the Xcursor(3) SYNOPSIS. As a bonus, this slightly reduces the size of the syntax tree.
* When the first child of the node being validated gets deleted duringIngo Schwarze2014-08-181-2/+13
| | | | | | | | | | | | | | | validation, man_node_unlink() switches to MAN_NEXT_CHILD. After that, we have to switch back to MAN_NEXT_SIBLING after completing validation, or subsequent parsing would add content into an already closed node, clobbering potentially existing children, causing information loss and a memory leak. Bug found by kristaps@ with valgrind in groff(7) on Mac OS X. Note that the switch back must be conditional, for if the node being validated itself gets deleted, we must *not* go to MAN_NEXT_SIBLING, which would not only yield wrong results in general but also crash in malformed manuals having an empty paragraph before the first .SH, for example OpenBSD c++filt(1).
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-3/+3
| | | | | | 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.
* Improve handling of next-line scope broken by end of file.Ingo Schwarze2014-07-301-8/+30
| | | | | | Detect the condition earlier, report in the error message which block is broken, and delete the broken block. Consequently, empty section headers can no longer happen.
* garbage collect three unused global flags; no functional changeIngo Schwarze2014-07-301-8/+1
|
* delete forgotten, obsolete rew_warn() prototypeIngo Schwarze2014-07-091-3/+1
|
* Clean up ERROR messages related to document structure and macros:Ingo Schwarze2014-07-071-3/+4
| | | | Hierarchical naming and mention macro names in messages.
* Simplify man_unscope(), removing 18 lines of code, that is,Ingo Schwarze2014-07-071-46/+22
| | | | | | removing one function argument, one function definition, three function invocations and two pointless assert()s. No functional change.
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-37/+23
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Implement the roff(7) .ll (line length) request.Ingo Schwarze2014-03-301-1/+2
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* Simplify: Remove an unused argument from the mandoc_eos() function.Ingo Schwarze2013-12-311-2/+2
| | | | No functional change.
* s/[Nn]ull/NUL/ in comments where appropriate;Ingo Schwarze2013-12-251-1/+2
| | | | suggested by Thomas Klausner <wiz @ NetBSD dot org>.
* Implement end-of-sentence spacing at the end of man(7) macro lines.Ingo Schwarze2013-12-221-1/+10
| | | | Patch from Franco Fichtner <franco at lastsummer dot de> (DragonFly).
* In the parser, when closing an explicit block that is not open,Ingo Schwarze2013-11-111-5/+7
| | | | | | | | close below-subsection implicit scopes that may still be open. In the formatter, make sure indentation is reset when leaving a scope, not only when entering the next one. Improves the formatting of gpg(1); issue reported by jca on ports.
* Implement the .UR/.UE block (uniform resource identifier) introduced in theIngo Schwarze2013-10-171-1/+6
| | | | | | | | man-ext macros by Eric S. Raymond, enabled by default in groff_man(7). Usual disclaimer: You don't write new man(7) code, so you are not going to use these, either. Improves e.g. the bzr(1) and etherape(1) manuals. Thanks to naddy@ for bringing these to my attention.
* Cleanup naming of local variables to make the code easier on the eye:Ingo Schwarze2012-11-171-61/+61
| | | | | | | | Settle for "struct man *man", "struct mdoc *mdoc", "struct meta *meta" and avoid the confusing "*m" which was sometimes this, sometimes that. No functional change. ok kristaps@ some time ago
* Fix an assert() raised by `RS' when following `TP'.Kristaps Dzonsons2012-06-121-2/+2
| | | | | | The reason was that `RS' wasn't BSCOPE'd, so the next-line (BLINE) scope opened by `TP' would still be in the HEAD macro. This was from joerg@'s archive of failures.
* Close a preceding implicit block before opening an explicit block.Ingo Schwarze2012-06-031-17/+29
| | | | | | | | To allow doing so, no longer abuse rew_scope() to unwind explicit blocks; explicitly call man_unscope() instead. Fixing the indentation of slapd.conf(5) in the OpenLDAP port; thanks to guenther@ for the report.
* Minimal implementation of .EX and .EE for GNU compatibility.Ingo Schwarze2012-06-021-1/+3
| | | | | Do not use this, it is not portable and only defined in esr's man-ext. For example, sox(1) wants these macros.
* Add support for `OP', one of the extended man macros. This also requiresKristaps Dzonsons2012-01-031-1/+2
| | | | some man(7) changes to accomodate for the an-ext compatibility.
* Jumping out of man_unscope() for the root node is a bad ideaIngo Schwarze2011-12-041-3/+1
| | | | | | | | because that will skip root node validation, potentially entering rendering modules will NULL pointers lurking in the meta data. Instead, always validate the root node and (as suggested by joerg@) assert validity of the meta data before using it in the renderers. ok joerg@
* Fix condition. Not enough tea.Joerg Sonnenberger2011-11-181-2/+2
|
* Slightly adjust last: return successful as some times the correct errorJoerg Sonnenberger2011-11-181-2/+2
| | | | is raised later.
* Convert an assert into an explicit check. man_unscope can be triggeredJoerg Sonnenberger2011-11-181-2/+3
| | | | on unknown macros.
* When the HEAD scope of .TP is broken by another block macro,Ingo Schwarze2011-11-071-12/+12
| | | | | | | | do not abort with a FATAL error, but report a report a WARNING, remove the broken .TP from the syntax tree, and prod on. Reported repeatedly by ports people, at least by brad@ and jeremy@. Also fixes rendition(4) in Xenocara. ok kristaps@
* forgotten Copyright bumps; no code changeIngo Schwarze2011-09-181-2/+2
| | | | found while syncing to OpenBSD