summaryrefslogtreecommitdiffstats
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* Make roff_expand() parse left-to-right rather than right-to-left.Ingo Schwarze2022-05-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some escape sequences have side effects on global state, implying that the order of evaluation matters. For example, this fixes the long-standing bug that "\n+x\n+x\n+x" after ".nr x 0 1" used to print "321"; now it correctly prints "123". Right-to-left parsing was convenient because it implicitly handled nested escape sequences. With correct left-to-right parsing, nesting now requires an explicit implementation, here solved as follows: 1. Handle nested expanding escape sequences iteratively. When finding one, expand it, then retry parsing the enclosing escape sequence from the beginning, which will ultimately succeed as soon as it no longer contains any nested expanding escape sequences. 2. Handle nested non-expanding escape sequences recursively. When finding one, the escape sequence parser calls itself to find the end of the inner sequence, then continues parsing the outer sequence after that point. This requires the mandoc_escape() function to operate in two different modes. The roff(7) parser uses it in a mode where it generates diagnostics and may return an expansion request instead of a parse result. All other callers, in particular the formatters, use it in a simpler mode that never generates diagnostics and always returns a definite parsing result, but that requires all expanding escape sequences to already have been expanded earlier. The bulk of the code is the same for both modes. Since this required a major rewrite of the function anyway, move it into its own new file roff_escape.c and out of the file mandoc.c, which was misnamed in the first place and lacks a clear focus. As a side benefit, this also fixes a number of assertion failures that tb@ found with afl(1), for example "\n\\\\*0", "\v\-\\*0", and "\w\-\\\\\$0*0". As another side benefit, it also resolves some code duplication between mandoc_escape() and roff_expand() and centralizes all handling of escape sequences (except for expansion) in roff_escape.c, hopefully easing maintenance and feature improvements in the future. While here, also move end-of-input handling out of the complicated function roff_expand() and into the simpler function roff_parse_comment(), making the logic easier to understand. Since this is a major reorganization of a central component of mandoc(1), stability of the program might slightly suffer for a few weeks, but i believe that's not a problem at this point of the release cycle. The new code already satisfies the regression suite, but more tweaking and regression testing to further improve the handling of various escape sequences will likely follow in the near future.
* support for hunting memory leaks;Ingo Schwarze2022-04-141-1/+6
| | | | designed and written last autumn, polished today
* POSIX make(1) does not support prerequisites on suffix rules.Ingo Schwarze2021-09-211-2/+2
| | | | | | | | | | | For HTML generation, the "mandoc" prerequisite isn't needed anyway because ${WWW_MANS} already explicitly depends on mandoc. Issue reported by Sevan Janiyan and Leah Neukirchen. This is not critical for release because it is only used for a maintainer target. While here, i also fixed the associated shell command to use the freshly built mandoc binary rather than whatever may be in the $PATH.
* make the path to ar(1) configurable, needed by NixOS;Ingo Schwarze2021-09-201-1/+1
| | | | suggested by Lukas Epple <sternenseemann at systemli dot org>
* Create the link from ./man to ./mandoc in the "all" target rather thanIngo Schwarze2021-09-201-2/+2
| | | | | | in the "regress" target. That makes manual "cd regress && ./regress.pl" a bit less fragile. The idea came up in a conversation with Thomas Klausner <wiz at NetBSD>.
* Test availability of mkstemps(3) and provide a fallback implementationIngo Schwarze2021-09-191-1/+4
| | | | in case it is missing; needed for SUN Solaris 10.
* bump VERSIONIngo Schwarze2021-09-191-1/+1
|
* Provide a real feature test for __attribute__().Ingo Schwarze2020-06-221-1/+2
| | | | | Looking at version numbers like __GNUC__ is always a bad idea. Believe it or not, this even makes ./configure shorter by one line.
* add missing compat_stringlist.o to ALL_COBJS, useful for make cleanIngo Schwarze2020-06-151-0/+1
|
* Only compile compat_*.c implementations that are actually needed.Ingo Schwarze2020-06-151-14/+7
| | | | | That's cleaner and it is supposed to fix compiler warnings with gcc 10 reported by Wynn Wolf Arbor <wolf at oriole dot systems> on discuss@.
* Make the "make depend" maintainer target more convenientIngo Schwarze2020-03-131-3/+6
| | | | by having it run ./configure with native fts and ohash disabled.
* Split tagging into a validation part including prioritizationIngo Schwarze2020-03-131-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in tag.{h,c} and {mdoc,man}_validate.c and into a formatting part including command line argument checking in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c. Immediate functional benefits include: * Improved prioritization of automatic tags for .Em and .Sy. * Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged. * Explicit tagging of .Er and .Fl now works in HTML output. * Automatic tagging of .IP and .TP now works in HTML output. But mainly, this patch provides clean earth to build further improvements on. Technical changes: * Main program: Write a tag file for ASCII and UTF-8 output only. * All formatters: There is no more need to delay writing the tags. * mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection. * HTML formatter: If available, use the "string" attribute as the tag. * HTML formatter: New function to write permalinks, to reduce code duplication. Style cleanup in the vicinity while here: * mdoc(7) terminal formatter: To set up bold font for children, defer to termp_bold_pre() rather than calling term_fontpush() manually. * mdoc(7) terminal formatter: Garbage collect some duplicate functions. * mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions. * Where possible, use switch statements rather than if cascades. * Get rid of some more Yoda notation. The necessity for such changes was first discussed with kn@, but i didn't bother him with a request to review the resulting -673/+782 line patch.
* new dist-install maintainer targetIngo Schwarze2019-03-061-0/+4
|
* work towards 1.14.5, mostly updating WWW_INCSIngo Schwarze2019-03-061-6/+9
|
* When the -S option is given to man(1) and the requested manual pageIngo Schwarze2019-03-041-2/+4
| | | | | | | | | | | | name is not found and the requested architecture is unknown, complain about the architecture rather than about the manual page name: $ man -S vax cpu man: Unknown architecture "vax". $ man -S sparc64 foobar man: No entry for foobar in the manual. Friendlier error message suggested by jmc@, who also OK'ed the patch.
* Major cleanup; may imply minor changes in edge cases of error reporting.Ingo Schwarze2018-12-141-0/+2
| | | | | | | | | | | 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-2/+5
| | | | | | | | | | 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.
* Cleanup, no functional change:Ingo Schwarze2018-12-131-1/+0
| | | | | | | Finally merge the pointless file st.in into st.c. Nobody should do operating systems dependent changes to standards: By definition, standards are the same for every operating system. While here, libmdoc.h no longer requires mdoc.h.
* Cleanup, no functional change:Ingo Schwarze2018-12-131-2/+5
| | | | | | No need to expose the eqn(7) syntax tree data structures everywhere. Move them to their own include file, "eqn.h". While here, delete the unused enum eqn_pilet.
* Cleanup, no functional change:Ingo Schwarze2018-12-131-1/+1
| | | | | | | | In libroff.h, nothing was left except the eqn(7) parser interface, which isn't really part of the roff(7) parser, so rename it to eqn_parse.h. While here, move struct eqn_def to eqn.c because that's the only file using it, and let eqn_box_free() and eqn_free() handle NULL.
* Cleanup, no functional change:Ingo Schwarze2018-12-131-0/+2
| | | | | Move tbl(7)-specific parser internals out of libroff.h. Move some tbl(7)-internal processing from roff.c to tbl.c.
* Cleanup, no functional change:Ingo Schwarze2018-12-121-2/+5
| | | | | No need to expose the tbl(7) syntax tree data structures everywhere. Move them to their own include file, "tbl.h", and improve comments.
* some fixes for the "www" and "www-install" maintainer targetsIngo Schwarze2018-08-091-8/+13
|
* more 1.14.4 release preparations:Ingo Schwarze2018-07-311-6/+7
| | | | | | autodetect whether the compiler can use -W and -static, clearer output from ./configure, and adjust some configuration instructions
* Add strndup(3) compat implementation.Ingo Schwarze2018-02-271-0/+3
| | | | Jan Stary reports that MacOS X Snow Leopard and older lacks it.
* release 1.14.3VERSION.1.14.3Ingo Schwarze2017-08-051-1/+1
|
* more renaming from mdocml to mandocIngo Schwarze2017-07-201-11/+11
|
* * clean catman.o which was missingIngo Schwarze2017-07-201-13/+5
| | | | | | * delete WWW_OBJS which i don't use * do not complain about *.out_markdown * bump VERSION to 1.14.2 (not released yet)
* Basic reporting of .Xrs to manual pages that don't existIngo Schwarze2017-07-011-0/+3
| | | | | | | | | | | | in the base system, inspired by mdoclint(1). We are able to do this because (1) the -mdoc parser, the -Tlint validator, and the man(1) manual page lookup code are all in the same program and (2) the mandoc.db(5) database format allows fast lookup. Feedback from, previous versions tested by, and OK jmc@. A few features will be added to this in the tree, step by step.
* Implement automatic line breakingIngo Schwarze2017-06-121-0/+3
| | | | | inside individual table cells that contain text blocks. This cures overlong lines in various Xenocara manuals.
* Basic implementation of the roff(7) .ta (define tab stops) request.Ingo Schwarze2017-05-071-0/+2
| | | | | | 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 handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-0/+2
| | | | | modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
* Start roff formatter modules for HTML and termininal output,Ingo Schwarze2017-05-041-0/+4
| | | | | | | used by both the mdoc and man formatters, with the ultimate goal of reducing code duplication between the two macro formatters. Made possible by the parser unification. Add the first formatting function (for the .br request).
* Parser unification: use nice ohashes for all three request and macro tables;Ingo Schwarze2017-04-291-4/+0
| | | | no functional change, minus two source files, minus 200 lines of code.
* Delete the manpage(1) utility.Ingo Schwarze2017-04-241-9/+0
| | | | | | | | It was never enabled in any release, nor was a manual ever written. In general, we want to simplify the user interface rather than succumb to featurism. Consequently, integrating manpage(1) into the main binary would seem like a dubious direction.
* Debian needs relative symlinks not only for manual pages,Ingo Schwarze2017-03-041-6/+6
| | | | | | but also for program files. Issue reported by Michael <Stapelberg at debian dot org> and by Markus <Waldeck at gmx dot de>.
* new -mdoc -Tmarkdown output mode; OK millert@ reyk@ tb@;Ingo Schwarze2017-03-031-2/+3
| | | | thanks to reyk@ and to Vsevolod at FreeBSD for suggesting it
* Debian wants relative, not absolute symlinks for man pages;Ingo Schwarze2017-02-221-2/+1
| | | | suggested by Michael Stapelberg
* add some regress targetsIngo Schwarze2017-02-181-0/+28
|
* Provide an uninstall target, to help cleaning up after installingIngo Schwarze2017-02-181-7/+50
| | | | with the wrong DESTDIR. Use with care.
* proper test for O_DIRECTORYIngo Schwarze2017-02-181-0/+1
|
* add $(LN) configuration variable; requested by Michael <Stapelberg@debian.org>Ingo Schwarze2017-02-161-5/+5
|
* Provide a variable BINM_CATMAN.Ingo Schwarze2017-02-161-2/+4
| | | | Suggested by Michael <Stapelberg@debian.org>.
* config glue for recvmsg(2) and CMSG_FIRSTHDR(3);Ingo Schwarze2017-02-081-0/+2
| | | | needed for Solaris 11
* even catman needs libmandoc on systems not having ftsIngo Schwarze2017-02-081-2/+2
|
* more 1.14.1 release preparationsIngo Schwarze2017-02-081-2/+6
|
* new manual pages for catman(8) and mandocd(8)Ingo Schwarze2017-02-061-1/+7
|
* add missing file man.options.1Ingo Schwarze2017-02-051-0/+1
|
* experimental mandocd(8) and catman(8)Ingo Schwarze2017-02-041-8/+23
| | | | for development in the tree, not yet ready for production
* Do not install libmandoc.a by default.Ingo Schwarze2016-11-191-8/+10
| | | | | | The only environment where it is ever needed is NetBSD base. Even NetBSD ports and pkgsrc should better not install it. Triggered by a question from bentley@.