summaryrefslogtreecommitdiffstats
path: root/demandoc.c
Commit message (Collapse)AuthorAgeFilesLines
* support for hunting memory leaks;Ingo Schwarze2022-04-141-1/+12
| | | | designed and written last autumn, polished today
* add forgotten mparse options to two rarely used programsIngo Schwarze2019-03-031-1/+2
|
* Cleanup, no functional change:Ingo Schwarze2018-12-301-12/+7
| | | | | | | | | | | | | | 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.
* Major cleanup; may imply minor changes in edge cases of error reporting.Ingo Schwarze2018-12-141-2/+1
| | | | | | | | | | | Finally, drop support for the run-time configurable mandocmsg() callback. It was over-engineered from the start, never used for anything in a decade, and repeatedly caused maintenance headaches. Consolidate reporting infrastructure into two files, mandoc.h and mandoc_msg.c, mopping up the bits and pieces that were scattered around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes of four parsing-related functions, and both parser structs.
* Cleanup, no functional change:Ingo Schwarze2018-12-131-0/+1
| | | | | | | | | | Split the top level parser interface out of the utility header mandoc.h, into a new header mandoc_parse.h, for use in the main program and in the main parser only. Move enum mandoc_os into roff.h because struct roff_man is the place where it is stored. This allows removal of mandoc.h from seven files in low-level parsers and in formatters.
* Split -Wstyle into -Wstyle and the even lower -Wbase, and addIngo Schwarze2017-06-241-2/+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@.
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-2/+2
|
* getopt(3) is declared in <unistd.h>, and <getopt.h> is not needed;Ingo Schwarze2016-07-091-1/+0
| | | | from Joerg Sonnenberger via Thomas Klausner, NetBSD.
* Simplify the mparse_open() interface.Ingo Schwarze2016-01-081-1/+1
| | | | | | Just return the file descriptor or -1 on error; there is just one kind of error anyway. Suggested by Christos Zoulas (NetBSD).
* It was very surprising that a function called mparse_readfd()Ingo Schwarze2016-01-081-0/+1
| | | | | | | | | | | | | closed the file descriptor passed to it after completing its work, in particular considering the fact that it required its callers to call open(2) or mparse_open() beforehand. Change mparse_readfd() to not call close(2) and change the callers to call close(2) afterwards, more or less bringing open and close to the same level of the code and making review easier. Note that man.cgi(8) already did that, even though it was wrong in the past. Small restructuring suggested by Christos Zoulas (NetBSD).
* use the new function man_validate() here, tooIngo Schwarze2015-10-221-1/+3
|
* In order to become able to generate syntax tree nodes on the roff(7)Ingo Schwarze2015-10-201-2/+3
| | | | | | | | level, validation must be separated from parsing and rewinding. This first big step moves calling of the mdoc(7) post_*() functions out of the parser loop into their own mdoc_validate() pass, while using a new mdoc_state() module to make syntax tree state handling available to both the parser loop and the validation pass.
* Major character table cleanup:Ingo Schwarze2015-10-131-4/+3
| | | | | | | | | | | | | * Use ohash(3) rather than a hand-rolled hash table. * Make the character table static in the chars.c module: There is no need to pass a pointer around, we most certainly never want to use two different character tables concurrently. * No need to keep the characters in a separate file chars.in; that merely encourages downstream porters to mess with them. * Sort the characters to agree with the mandoc_chars(7) manual page. * Specify Unicode codepoints in hex, not decimal (that's the detail that originally triggered this patch). No functional change, minus 100 LOC, and i don't see a performance change.
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-2/+2
|
* Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze2015-04-181-2/+2
| | | | | | 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.
* Profit from the unified struct roff_man and reduce the number ofIngo Schwarze2015-04-181-7/+6
| | | | | 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-2/+2
| | | | | 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-2/+3
| | | | | | 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.
* trim trailing white space, no code change;Ingo Schwarze2015-02-101-6/+6
| | | | from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux
* be more careful about argc == 0Ingo Schwarze2015-02-071-3/+4
|
* Fatal errors no longer exist.Ingo Schwarze2015-01-151-8/+8
| | | | | | 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.
* Make the character table available to libroff so it can check theIngo Schwarze2014-10-281-1/+4
| | | | | | | | validity of character escape names and warn about unknown ones. This requires mchars_spec2cp() to report unknown names again. Fortunately, that doesn't require changing the calling code because according to groff, invalid character escapes should not produce output anyway, and now that we warn about them, that's fine.
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-2/+2
| | | | | | 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.
* Without the MPARSE_SO option, if the file contains nothing but aIngo Schwarze2014-03-191-1/+1
| | | | | | single .so request, do not read the file pointed to, but instead let mparse_result() provide the file name pointed to as a return value. To be used by makewhatis(8) in the future.
* cope with mparse_alloc() interface changeIngo Schwarze2014-03-191-1/+1
|
* Cope with mparse_alloc() interface change.Ingo Schwarze2014-01-051-1/+1
|
* catch up with the changed interface of mparse_alloc(), see mandoc.h rev 1.100Ingo Schwarze2012-05-311-1/+1
|
* Finishing touches on demandoc. It now backs over ending punctuation asKristaps Dzonsons2011-09-011-3/+15
| | | | | | well as leading punctuation. Again, this isn't the same as deroff (which uses, I think, some punctuation as delimiters), but it's easier to explain and simpler to audit.
* Make `-w' mode work much better. This is INCREDIBLY poorly specified inKristaps Dzonsons2011-09-011-1/+56
| | | | | | any other deroff manual, and as I don't think anybody actually uses deroff, I don't feel compelled to research its behaviour too much and can just do what's logical.
* Have demandoc throw away deroff's flags.Kristaps Dzonsons2011-09-011-29/+39
|
* Lint checks over demandoc.Kristaps Dzonsons2011-09-011-3/+2
|
* Allow compilation on OpenBSD.Kristaps Dzonsons2011-09-011-0/+1
|
* Add demandoc utility, a replacement for deroff.Kristaps Dzonsons2011-09-011-0/+180