aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man.c
Commit message (Collapse)AuthorAgeFilesLines
* Some high-level block macros have an effect similar to temporarilyIngo Schwarze2019-01-051-6/+6
| | | | | | | | | | | | suspending no-fill mode during their head. Model this with an additional roff parser state flag ROFF_NONOFILL. That is much simpler than it would be to save and restore the ROFF_NOFILL flag itself, in particular since the latter can be switched (with lasting effect) by the .nf and .fi requests even while its effect is temporarily suspended. This commit does not change formatting yet, but prepares for future formatting simplifications and improvements.
* Cleanup, no functional change:Ingo Schwarze2018-12-311-20/+1
| | | | | | Since the man(7) and roff(7) validators no longer use the parser state flag ROFF_NOFILL, we can finally get rid of the function man_state(), resulting in a better separation of parsing and validation.
* Use the new flag NODE_NOFILL in the validators, which is sometimesIngo Schwarze2018-12-311-6/+1
| | | | | | simpler and always more robust. In particular, move the nesting warnings for .EX and .EE from man_state(), where they were misplaced, to the man(7) validator.
* Move parsing of the .nf and .fi (fill mode) requests from the man(7)Ingo Schwarze2018-12-311-12/+12
| | | | | | parser to the roff(7) parser. As a side effect, .nf and .fi are now also parsed in mdoc(7) input, though the mdoc(7) formatters still ignore most of their effect.
* Cleanup, minus 15 LOC, no functional change:Ingo Schwarze2018-12-311-10/+1
| | | | | | | | | Simplify the way the man(7) and mdoc(7) validators are called. Reset the parser state with a common function before calling them. There is no need to again reset the parser state afterwards, the parsers are no longer used after validation. This allows getting rid of man_node_validate() and mdoc_node_validate() as separate functions.
* Cleanup, no functional change:Ingo Schwarze2018-12-301-2/+2
| | | | | | | | | | | | | | The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters.
* Almost mechanical diff to remove the "struct mparse *" argumentIngo Schwarze2018-12-141-19/+11
| | | | | | | | from mandoc_msg(), where it is no longer used. While here, rename mandoc_vmsg() to mandoc_msg() and retire the old version: There is really no point in having another function merely to save "%s" in a few places. Minus 140 lines of code.
* Support nesting of elements with next-line scope.Ingo Schwarze2018-08-261-20/+18
| | | | For example, ksh93(1) needs this for .B\n.SM.
* If man(7) next-line scope is open and the line ends with \c,Ingo Schwarze2018-08-251-18/+31
| | | | the scope remains open. Needed for example for groff_man(7).
* The upcoming .while request will have to re-execute roff(7) linesIngo Schwarze2018-08-231-9/+1
| | | | | | | parsed earlier, so they will have to be saved for reuse - but the read.c preparser does not know yet whether a line contains a .while request before passing it to the roff parser. To cope with that, save all parsed lines for now. Even shortens the code by 20 lines.
* Remove more pointer arithmetic passing via regions outside the arrayIngo Schwarze2018-08-171-10/+10
| | | | | that is undefined according to the C standard. Robert Elz <kre at munnari dot oz dot au> pointed out i wasn't quite done yet.
* fix incomplete handling of roff(7) nodes in man(7) block next-line scope;Ingo Schwarze2017-06-281-4/+7
| | | | assertion failure in tclsh(1) reported by deraadt@ via bentley@
* correct handling of blank lines after \cIngo Schwarze2017-06-171-8/+27
|
* ignore blank lines in man(7) next line scope;Ingo Schwarze2017-06-031-6/+7
| | | | strange groff edge case behaviour found in multimedia/mjpegtools
* Line-breaking roff(7) requests also break man(7) next-line scope.Ingo Schwarze2017-05-081-7/+6
| | | | | | Considering that real roff implements next-line scope using input line traps, that isn't all that surprising. Issue found in the games/xbattle port.
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-2/+2
| | | | now that this actually saves code: -70 LOC.
* A few days ago, a patch from <G dot Branden dot Robinson at gmail dot com>Ingo Schwarze2017-05-011-2/+16
| | | | | | | | | got committed to groff which changed .TP from using .it to using .itc, such that groff now supports more than one man(7) macro line in the .TP head if all but the last line in the head end with \c. Of course, relying on that behaviour is utterly non-portable, but if authors are reckless enough to use that idiom, let's do what they want.
* Parser unification: use nice ohashes for all three request and macro tables;Ingo Schwarze2017-04-291-18/+11
| | | | no functional change, minus two source files, minus 200 lines of code.
* Continue parser unification:Ingo Schwarze2017-04-241-20/+5
| | | | | | | | * 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 a few redundant conditions that jsg@ found with cppcheckIngo Schwarze2017-03-031-2/+2
|
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-5/+5
|
* move man(7) validation into the dedicated validation phase, tooIngo Schwarze2015-10-221-1/+36
|
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-11/+11
|
* Fill mode changes don't break next-line scope in all cases,Ingo Schwarze2015-09-041-1/+15
| | | | | | in particular not for tagged paragraphs. Issue found by Christian Neukirchen <chneukirchen at gmail dot com> in the exiv2(1) manual page.
* Unify mdoc_deroff() and man_deroff() into a common function deroff().Ingo Schwarze2015-04-231-47/+1
| | | | | | | | 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.
* Get rid of two empty wrapper functions. No functional change.Ingo Schwarze2015-04-231-8/+1
|
* Unify trickier node handling functions.Ingo Schwarze2015-04-191-22/+2
| | | | | | | * 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-59/+3
| | | | | | | | * 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.
* Decouple the token code for "no request or macro" from the individualIngo Schwarze2015-04-191-11/+11
| | | | | | 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.
* Unify node handling functions:Ingo Schwarze2015-04-191-180/+18
| | | | | | | | | | | * 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.
* Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze2015-04-181-15/+1
| | | | | | man_node() from the mandoc(3) semi-public interface and the internal wrapper functions print_mdoc() and print_man() from the HTML formatters. Minus 60 lines of code, no functional change.
* Unify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().Ingo Schwarze2015-04-181-63/+1
| | | | | Minus 80 lines of code, no functional change. Written on the train from Koeln to Wolfsburg returning from p2k15.
* Move mdoc_hash_init() and man_hash_init() to libmandoc.hIngo Schwarze2015-04-181-3/+1
| | | | | and call them from mparse_alloc() and choose_parser(), preparing unified allocation of struct roff_man.
* Profit from the unified struct roff_man and reduce the number ofIngo Schwarze2015-04-181-1/+2
| | | | | 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-52/+54
| | | | | 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-4/+4
| | | | | 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-35/+34
| | | | | | | | | 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-31/+32
| | | | | | 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.
* starting a tbl(7) breaks man(7) next-line scope;Ingo Schwarze2015-01-301-59/+66
| | | | triggered by a bug report from jsg@
* Strangely, ignoring the roff(7) .na request was implemented in the man(7)Ingo Schwarze2015-01-241-2/+2
| | | | | parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
* Fatal errors no longer exist.Ingo Schwarze2015-01-151-3/+2
| | | | | | If a file can be opened, mandoc will produce some output; at worst, the output may be almost empty. Simplifies error handling and frees a message type for future use.
* mdoc(7) already uses the mandoc(1) -Ios argument in the footer lineIngo Schwarze2014-12-281-2/+4
| | | | | | when .Os has no argument, so do the same for man(7) when .TH has less than four arguments; there is no reason to treat both differently. Issue found following a question from Thomas Klausner <wiz at NetBSD>.
* Simplify by making the eqn and tbl steering functions void;Ingo Schwarze2014-11-281-5/+3
| | | | no functional change, minus 15 lines of code.
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-281-118/+70
| | | | and some cleanup; no functional change, minus 70 lines.
* Escape sequences terminate high-level macro names, and when doing so,Ingo Schwarze2014-11-191-7/+22
| | | | | | they are ignored, just in the same way as for request names and for low-level macro names. This also cures a warning in the pod2man(1) preamble.
* Allow the five man(7) font macros to concatenate their line arguments,Ingo Schwarze2014-11-031-1/+16
| | | | | | | 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.
* correct the spacing after in-line equationsIngo Schwarze2014-10-201-2/+3
| | | | | that start at the beginning of an input line but end before the end of an input line
* correct spacing before inline equationsIngo Schwarze2014-10-201-1/+3
|
* Simplify by handling empty request lines at the one logical placeIngo Schwarze2014-09-061-8/+1
| | | | | in the roff parser instead of in three other places in other parsers. No functional change.
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-3/+1
| | | | | | 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.