aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_argv.c
Commit message (Collapse)AuthorAgeFilesLines
* Decouple the token code for "no request or macro" from the individualIngo Schwarze2015-04-191-2/+2
| | | | | | 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.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-10/+10
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Second step towards parser unification:Ingo Schwarze2015-04-021-4/+4
| | | | | | | | | 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-6/+7
| | | | | | 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.
* fix column numbers of macro arguments in messagesIngo Schwarze2015-02-041-2/+2
|
* Provide a helper function macro_or_word() and use it to prune theIngo Schwarze2014-11-291-11/+6
| | | | | | | | | | same chunk of argument parsing code out of five of the eight callback functions. The other three have too much special handling to participate. As a bonus, let lookup() and mdoc_args() deal with line macros and retire the lookup_raw() helper and the mdoc_zargs() internal interface function. No functional change, minus 40 lines of code.
* Fold the loop around mdoc_argv() into the function itself,Ingo Schwarze2014-11-281-70/+77
| | | | | | it was the same in all four cases. As a bonus, get rid of one enum type that was used for internal communication. No functional change, minus 40 lines of code.
* Simplify the code by making various mdoc parser helper functions void.Ingo Schwarze2014-11-281-22/+12
| | | | No functional change, minus 130 lines of code.
* 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.
* Clean up messages related to plain text and to escape sequences.Ingo Schwarze2014-07-061-5/+9
| | | | | * Mention invalid escape sequences and string names, and fallbacks. * Hierarchical naming.
* Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,Ingo Schwarze2014-07-021-4/+4
| | | | | since this is hardly more complicated than explicitly ignoring them as we did in the past. Of course, do not use them!
* Audit malloc(3)/calloc(3)/realloc(3) usage.Ingo Schwarze2014-04-231-5/+5
| | | | | | | * Change eight reallocs to reallocarray to be safe from overflows. * Change one malloc to reallocarray to be safe from overflows. * Change one calloc to reallocarray, no zeroing needed. * Change the order of arguments of three callocs (aesthetical).
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-46/+46
| | | | | 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.
* The files mandoc.c and mandoc.h contained both specialised low-levelIngo Schwarze2014-03-231-1/+2
| | | | | | | functions used for multiple languages (mdoc, man, roff), for example mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary functions. Split the auxiliaries out into their own file and header. While here, do some #include cleanup.
* s/[Nn]ull/NUL/ in comments where appropriate;Ingo Schwarze2013-12-251-4/+4
| | | | suggested by Thomas Klausner <wiz @ NetBSD dot org>.
* Fix end-of-sentence spacing after the DragonFly text production macro.Ingo Schwarze2013-12-221-2/+2
| | | | Patch from Franco Fichtner <franco at lastsummer dot de>.
* In quoted macro arguments, double quotes can be quoted by doubling them.Ingo Schwarze2013-12-151-1/+13
| | | | | | | | | For a long time, we handle this in roff(7) and man(7) macros. Now add correct handling for the mdoc(7) case, too. Closely based on a patch by Tsugutomo dot ENAMI at jp dot sony dot com, see http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=48438 received via Thomas Klausner (wiz@), slightly tweaked by me.
* Fix four small whitespace issues related to trailing punctuationIngo Schwarze2012-11-181-4/+4
| | | | | | | | | reported by Nicolas Joly <njoly at pasteur dot fr>: - add EOS spacing after trailing punctuation after .Cd, .Fc, and .Lb - suppress spacing before trailing punctuation after .Fd Add the remaining issues from the same report to the TODO file.
* Cleanup naming of local variables to make the code easier on the eye:Ingo Schwarze2012-11-171-30/+30
| | | | | | | | 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
* Two more macros (.Ap and .In) do trailing delimiter handling.Ingo Schwarze2012-11-161-3/+4
| | | | | | | This fixes the end of sentence spacing in OpenBSD open(2) and in about 150 pages in the NetBSD base system. Reported by Nicolas Joly <njoly a pasteur point fr>, merci!
* The -width and -offset macro arguments consume the next argumentIngo Schwarze2012-04-151-39/+5
| | | | | even if it starts with a dash. ok kristaps@
* Make the `-width' field to `Bl' not puke if it doesn't have an argument.Kristaps Dzonsons2012-03-231-2/+2
| | | | This makes mandoc work much, much nicer with Mac OSX manpages.
* forgotten Copyright bumps; no code changeIngo Schwarze2011-09-181-2/+2
| | | | found while syncing to OpenBSD
* Add back in a check that the leading `-' exists for arguments. ThisKristaps Dzonsons2011-06-181-7/+6
| | | | | mysteriously disappeared in 1.14. No idea why. While here, remove an unnecessary header and order the function prototypes.
* Clean-up: remove a function only called once.Kristaps Dzonsons2011-06-181-38/+17
|
* Fix an assertion failure raised by the following interesting scenario: aKristaps Dzonsons2011-06-181-192/+164
| | | | | | | | | | | | | | auto-opened `It' (i.e., a column list with a free-text first line) with leading spaces in the line triggering assertion when searching for arguments. This led to a fix giving a nice performance speed-ups (a few percent, with some quick trials): the search for flags immediately exits if the macro has no flags, instead of having to first parse the leading word then look it up. I also cleaned up the argv parsing stuff a little bit and added more documentation. This comes from a TODO by joerg@.
* Lint fixes: remove unused function variables and pass in proper enumKristaps Dzonsons2011-05-121-8/+7
| | | | values instead of ints.
* Clean up parsing of delimiters in -mdoc. First, remove the "dowarn"Kristaps Dzonsons2011-04-191-171/+157
| | | | | | | | variable from mandoc_getarg() so that it prints the warning every time. Then, remove the warning from args_checkpunct(). This way, warnings are being posted at the correct time. This makes the flag argument to mdoc_zargs() superfluous, so make it be zero when it's invoked. Finally, move the args() flags into mdoc_argv.c and make them enums.
* Use mandoc_getarg() for the regular case of processing unquotedKristaps Dzonsons2011-04-171-20/+4
| | | | arguments in -mdoc documents.
* Don't shadow global identifiers.Joerg Sonnenberger2011-04-071-13/+13
|
* As per joerg@'s suggestion, use const arrays when looking up mdoc argvs.Kristaps Dzonsons2011-03-231-38/+69
|
* libmdoc.h and libman.h were including mdoc.h and man.h, respectively.Kristaps Dzonsons2011-03-221-1/+2
| | | | | Don't have them do that (includes in header files = faugh), and have individual files directly include these files.
* mdoc_argn_free is only used local to mdoc_argv.c, so make it static.Kristaps Dzonsons2011-03-221-4/+5
|
* Move mandoc_isdelim() back into libmdoc.h. This fixes an unreportedKristaps Dzonsons2011-03-221-3/+3
| | | | | | | | | error where (1) -man pages were punctuating delimiters (e.g., `.B a ;') and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its own line) would also be punctuated. This introduces a small amount of complexity of mdoc_{html,term}.c must manage their own spacing with running print_word() or print_text(). The check for delimiting now happens in mdoc_macro.c's dword().
* Clean-up in mdoc_argv.c args_checkpunct().Kristaps Dzonsons2011-03-171-28/+22
|
* Clean-up in mdoc_argv.c: make CPP-defines into an enum, document, makeKristaps Dzonsons2011-03-171-34/+18
| | | | | static arrays const, properly abort() for bogus switch cases, and be obsessive about spacing and (void)-casting.
* Clean up mdoc_pmsg invocations to make them not check the return value.Kristaps Dzonsons2011-03-171-14/+7
|
* Move mdoc_isdelim() into mandoc.h as mandoc_isdelim(). This allows theKristaps Dzonsons2011-03-171-3/+3
| | | | | | removal of manual delimiter checks in html.c and term.c. Finally, add the escaped period as a closing delimiter, removing a TODO to this effect.
* Make args_checkpunct() use mdoc_isdelim() instead of mdoc_iscdelim(),Kristaps Dzonsons2011-03-171-19/+34
| | | | which is wrong. Then remove mdoc_iscdelim() alltogether.
* Move check for closing punctuation into its own function. This willKristaps Dzonsons2011-03-171-25/+42
| | | | | | later be modified to remove the need for iscdelim(), which will be used to unify delimiter checks, which will then allow for the simple removal of a TODO regarding escaped periods.
* Instead of a series of hard-coded strcmps, make argv_a2arg() iterateKristaps Dzonsons2011-03-161-74/+43
| | | | | | over an array of possible argument types, hooking in to mdoc_argnames[]. This knocks off bytes for the duplicated strings and cleans up code readability.
* As per schwarze@'s suggestions, roll back the refcount structure inKristaps Dzonsons2010-12-241-2/+2
| | | | | | | | favour of a simpler shim for normalised data in the node allocation and free routines. This removes the need to bump and copy references within validator handlers, removes a pointer redirect, and also kills the refcount structure itself. Data is assumed to "live" either in a MDOC_BLOCK or MDOC_ELEM and is copied accordingly.
* Implement reference-counted version of original union mdoc_data. ThisKristaps Dzonsons2010-12-221-3/+2
| | | | | | | simplifies clean-up and allows for more types without extra hassle. Also made in-line literal types in -T[x]html use CODE instead of SPAN to match how literal blocks use PRE.
* Prevent .Lp from looping endlessly on punctuation.Ingo Schwarze2010-09-131-2/+2
| | | | Same fix as the previous one.
* Prevent `Pp' from looping endlessly on punctuation. Bug reported byKristaps Dzonsons2010-09-131-2/+2
| | | | Marc Espie.
* Nit-picking assign in decl.Kristaps Dzonsons2010-07-211-2/+4
|
* Finally make mdoc argv CPP-defines into a proper enum.Kristaps Dzonsons2010-07-211-4/+4
|
* correct lots of copyright notices;Ingo Schwarze2010-07-131-2/+2
| | | | ok kristaps@
* Make struct_bl and struct_bd into pointers. This removes the need to doKristaps Dzonsons2010-07-011-2/+3
| | | | | | | | | | | copying on internals after modification. Even more importantly, if an ENDBODY token is provided, it would have been impossible for post-change copying of the data to take place in the BLOCK. This allows it to happen by dint of pointers. Also did some bikeshedding in mdoc_term.c: checking against enum type and explicitly casting to the "post" function to void. This is for my own readability.