Up to [local] / src / usr.bin / mandoc
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.272 / (download) - annotate - [select for diffs], Tue Oct 24 20:30:49 2023 UTC (7 months, 2 weeks ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE,
OPENBSD_7_5,
HEAD
Changes since 1.271: +3 -2 lines
Diff to previous 1.271 (colored) to selected 1.177 (colored)
Implement the man(7) .MR macro, a 2023 GNU extension. The syntax and semantics is almost identical to mdoc(7) .Xr. This will be needed for reading the groff manual pages once our port will be updated to 1.23, and the Linux Manual Pages Project is also determined to start using it sooner or later. I did not advocate for this new macro, but since we want to remain able to read all manual pages found in the wild, there is little choice but to support it. At least it is easy to do, they basically copied .Xr.
Revision 1.271 / (download) - annotate - [select for diffs], Mon Oct 23 20:07:18 2023 UTC (7 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.270: +31 -4 lines
Diff to previous 1.270 (colored) to selected 1.177 (colored)
Support some escape sequences, in particular character escape sequences, inside \w arguments, and skip most other escape sequences when measuring the output length in this way because most escape sequences contribute little or nothing to text width: for example, consider font escapes in terminal output. This implementation is very rudimentary. In particular, it assumes that every character has the same width. No attempt is made to detect double-width or zero-width Unicode characters or to take dependencies on output devices or fonts into account. These limitations are hard to avoid because mandoc has to interpolate \w at the parsing stage when the output device is not yet known. I really do not want the content of the syntax tree to depend on the output device. Feature requested by Paul <Eggert at cs dot ucla dot edu>, who also submitted a patch, but i chose to commit this very different patch with almost the same functionality. His input was still very valuable because complete support for \w is out of the question, and consequently, the main task is identifying subsets of the feature that are needed for real-world manual pages and can be supported without uprooting the whole forest.
Revision 1.270 / (download) - annotate - [select for diffs], Sun Oct 22 16:01:58 2023 UTC (7 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.269: +2 -2 lines
Diff to previous 1.269 (colored) to selected 1.177 (colored)
While doing delayed expansion of escape sequences in macro arguments, correctly check for failure of the in-place expansion function. If an argument not only does recursive delayed expansion but infinitely recursive delayed expansion, this bug could result in an ESCAPE_EXPAND assertion failure. Thanks to Eric van Gyzen <vangyzen at FreeBSD> for finding this bug by inspecting FreeBSD source code.
Revision 1.269 / (download) - annotate - [select for diffs], Sat Oct 21 17:10:12 2023 UTC (7 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.268: +4 -9 lines
Diff to previous 1.268 (colored) to selected 1.177 (colored)
When parsing a macro argument results in delayed escape sequence expansion, re-check for all contained escape sequences whether they need delayed expansion, not just for the particular escape sequences that triggered delayed expansion in the first place. This is needed because delayed expansion can result in strings containing nested escape sequences recursively needing delayed expansion, too. This fixes an assertion failure in krb5_openlog(3), see: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266882 Thanks to Wolfram Schneider <wosch at FreeBSD> for reporting the bug and to Baptiste Daroussin <bapt at FreeBSD> for forwarding the report.
Revision 1.268 / (download) - annotate - [select for diffs], Mon Dec 26 19:16:02 2022 UTC (17 months, 2 weeks ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE,
OPENBSD_7_4,
OPENBSD_7_3_BASE,
OPENBSD_7_3
Changes since 1.267: +4 -4 lines
Diff to previous 1.267 (colored) to selected 1.177 (colored)
spelling fixes; from paul tagliamonte amendments to his diff are noted on tech
Revision 1.267 / (download) - annotate - [select for diffs], Tue Aug 16 17:29:18 2022 UTC (21 months, 3 weeks ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE,
OPENBSD_7_2
Changes since 1.266: +7 -10 lines
Diff to previous 1.266 (colored) to selected 1.177 (colored)
Even though the constant ASCII_ESC is only used in the roff pre-parser roff.c, move it to the top level include file mandoc.h to reduce the risk of causing clashes when introducing new ASCII_* constants in the future.
Revision 1.266 / (download) - annotate - [select for diffs], Tue Jun 7 09:41:22 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.265: +3 -12 lines
Diff to previous 1.265 (colored) to selected 1.177 (colored)
Purge duplicate error reporting from the .tr request parser: the error was already reported earlier when roff_expand() called roff_escape().
Revision 1.265 / (download) - annotate - [select for diffs], Fri Jun 3 11:50:25 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.264: +49 -11 lines
Diff to previous 1.264 (colored) to selected 1.177 (colored)
During identifier parsing, handle undefined escape sequences in the same way as groff: * \\ is always reduced to \ * \. is always reduced to . * other undefined escape sequences are usually reduced to the escape name, for example \G to G, except during the expansion of expanding escape sequences having the standard argument form (in particular \* and \n), in which case the backslash is preserved literally. Yes, this is confusing indeed. For example, the following have the same meaning: * .ds \. and .ds . which is not the same as .ds \\. * \*[\.] and \*[.] which is not the same as \*[\\.] * .ds \G and .ds G which is not the same as .ds \\G * \*[\G] and \*[\\G] which is not the same as \*[G] <- sic! To feel less dirty, have a leaning toothpick, if you are so inclined. This patch also slightly improves the string shown by the "escaped character not allowed in a name" error message.
Revision 1.264 / (download) - annotate - [select for diffs], Thu Jun 2 11:28:16 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.263: +3 -12 lines
Diff to previous 1.263 (colored) to selected 1.177 (colored)
Avoid the layering violation of re-parsing for \E in roff_expand(). To that end, add another argument to roff_escape() returning the index of the escape name. This also makes the code in roff_escape() a bit more uniform in so far as it no longer needs the "char esc_name" local variable but now does everything with indices into buf[]. No functional change.
Revision 1.263 / (download) - annotate - [select for diffs], Tue May 31 20:21:40 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.262: +6 -1 lines
Diff to previous 1.262 (colored) to selected 1.177 (colored)
Rudimentary implementation of the \A escape sequence, following groff semantics (test identifier for syntactical validity), not at all following the completely unrelated Heirloom semantics (define hyperlink target position). The main motivation for providing this implementation is to get \A into the parsing class ESCAPE_EXPAND that corresponds to groff parsing behaviour, which is quite similar to the \B escape sequence (test numerical expression for syntactical validity). This is likely to improve parsing of nested escape sequences in the future. Validation isn't perfect yet. In particular, this implementation rejects \A arguments containing some escape sequences that groff allows to slip through. But that is unlikely to cause trouble even in documents using \A for non-trivial purposes. Rejecting the nested escapes in question might even improve robustnest because the rejected names are unlikely to really be usable for practical purposes - no matter that groff dubiously considers them syntactically valid.
Revision 1.262 / (download) - annotate - [select for diffs], Tue May 31 18:08:02 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.261: +3 -1 lines
Diff to previous 1.261 (colored) to selected 1.177 (colored)
Trivial patch to put the roff(7) \g (interpolate format of register) escape sequence into the correct parsing class, ESCAPE_EXPAND. Expansion of \g is supposed to work exactly like the expansion of the related escape sequence \n (interpolate register value), but since we ignore the .af (assign output format) request, we just interpolate an empty string to replace the \g sequence. Surprising as it may seem, this actually makes a formatting difference for deviate input like ".O\gNx" which used to raise bogus "escaped character not allowed in a name" and "skipping unknown macro" errors and printed nothing, whereas now it correctly prints "OpenBSD".
Revision 1.261 / (download) - annotate - [select for diffs], Mon May 30 22:50:40 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.260: +9 -4 lines
Diff to previous 1.260 (colored) to selected 1.177 (colored)
Dummy implementation of the roff(7) \V (interpolate environment variable) escape sequence. This is needed to get \V into the correct parsing class, ESCAPE_EXPAND. It is intentional that mandoc(1) output is *not* influenced by environment variables, so interpolate the name of the variable with some decorating punctuation rather than interpolating its value.
Revision 1.260 / (download) - annotate - [select for diffs], Thu May 19 15:17:51 2022 UTC (2 years ago) by schwarze
Branch: MAIN
Changes since 1.259: +182 -257 lines
Diff to previous 1.259 (colored) to selected 1.177 (colored)
Make roff_expand() parse left-to-right rather than right-to-left. 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.
Revision 1.259 / (download) - annotate - [select for diffs], Sun May 1 16:18:59 2022 UTC (2 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.258: +107 -97 lines
Diff to previous 1.258 (colored) to selected 1.177 (colored)
Split a new function roff_parse_comment() out of roff_expand() because this functionality is not needed when called from roff_getarg(). This makes the long and complicated function roff_expand() significantly shorter, and also simpler in so far as it no longer needs to return ROFF_APPEND. No functional change intended.
Revision 1.258 / (download) - annotate - [select for diffs], Sat Apr 30 18:46:16 2022 UTC (2 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.257: +35 -36 lines
Diff to previous 1.257 (colored) to selected 1.177 (colored)
Provide a new function roff_req_or_macro() to parse and handle a request or macro, including context-dependent error handling inside tbl(7) code and inside .ce/.rj blocks. Use it both in the top level roff(7) parser and inside conditional blocks. This fixes an assertion failure triggered by ".if 1 .ce" inside tbl(7) code, found by tb@ using afl(1). As a side benefit for readability, only one place remains in the code that calls the main handler functions for the various roff(7) requests. This patch also improves column numbers in some error messages and various comments.
Revision 1.257 / (download) - annotate - [select for diffs], Sat Apr 30 11:32:39 2022 UTC (2 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.256: +10 -17 lines
Diff to previous 1.256 (colored) to selected 1.177 (colored)
Refactor the handler function roff_block_sub() for clarity and simplicity. 1. Do not needlessly access the function pointer table roffs[]. Instead, simply call the block closing function directly. 2. Sort code: handle both cases of block closing at the beginning of the function rather than one at the beginning and one at the end. 3. Trim excessive, partially repetitive and obvious comments, also making the comments considerably more precise. No functional change.
Revision 1.256 / (download) - annotate - [select for diffs], Thu Apr 28 16:16:46 2022 UTC (2 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.255: +51 -2 lines
Diff to previous 1.255 (colored) to selected 1.177 (colored)
The syntax of the roff(7) .mc request is quite special and the roff_onearg() parsing function is too generic, so provide a dedicated parsing function instead. This fixes an assertion failure when an \o escape sequence is passed as the argument; the bug was found by tb@ using afl(1). It also makes mandoc output more similar to groff in various cases.
Revision 1.255 / (download) - annotate - [select for diffs], Sun Apr 24 17:39:31 2022 UTC (2 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.254: +5 -3 lines
Diff to previous 1.254 (colored) to selected 1.177 (colored)
When we open a new .while loop, let's not attempt to close out another enclosing .while loop at the same time. Instead, postpone the closing until the next iteration of ROFF_RERUN. This prevents one-line constructions like ".while 0 .while 0 something" and ".while rx .while rx .rr x" (which admittedly aren't particularly useful) from dying of abort(3), which was a bug tb@ found with afl(1).
Revision 1.254 / (download) - annotate - [select for diffs], Sun Apr 24 13:34:53 2022 UTC (2 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.253: +8 -3 lines
Diff to previous 1.253 (colored) to selected 1.177 (colored)
If a .shift request has a negative argument, do not use a negative array index but use 0 instead of the argument, just like groff. Warn about the invalid argument. While here, fix the column number in another warning message. Segfault reported by tb@, found with afl(1).
Revision 1.253 / (download) - annotate - [select for diffs], Wed Apr 13 13:11:33 2022 UTC (2 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.252: +3 -3 lines
Diff to previous 1.252 (colored) to selected 1.177 (colored)
Surprisingly, groff supports multiple copy mode escapes at the beginning of an escape sequence: \, \E, \EE, \EEE, and so on all do the same outside copy mode, so let them do the same in mandoc(1), too. This fixes an assertion failure triggered by \EE*X that tb@ found with afl(1). The first E was consumed by roff_expand(), but that function failed to recognize the escape sequence as the expansion of a user-defined string and handed it over to mandoc_escape(), which consumed the second E and then died on an assertion because it is not prepared to handle user-defined strings. Fix this by letting *both* functions handly arbitrary numbers of 'E's correctly.
Revision 1.252 / (download) - annotate - [select for diffs], Mon Oct 4 14:18:42 2021 UTC (2 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE,
OPENBSD_7_1
Changes since 1.251: +3 -2 lines
Diff to previous 1.251 (colored) to selected 1.177 (colored)
store the operating system name obtained from uname(3) in the adequate struct together with similar state date rather than in a function-scope static variable, such that it can be free(3)d in roff_man_free(); no functional change
Revision 1.251 / (download) - annotate - [select for diffs], Mon Oct 4 10:11:54 2021 UTC (2 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.250: +1 -3 lines
Diff to previous 1.250 (colored) to selected 1.177 (colored)
Do not leak 64 bytes of heap memory every time a manual page calls a user-defined macro. Calls of standard mdoc(7) and man(7) macros were unaffected, so the effect on OpenBSD manual pages was small, about 80 Kilobytes grand total for a full run of "makewhatis /usr/share/man". Argument expansion contexts for user-defined macros are stored on a stack that grows as needed if calls of user-defined macros are nested or recursive. Individual stack entries contain dynamically allocated arrays of pointers to arguments; these argument arrays also grow as needed if user-defined macros take more than eight arguments. The mistake was that argument arrays of already initialized expansion contexts were leaked rather than reused on subsequent macro calls. I found this issue in a systematic hunt for memory leaks after Michael <Stapelberg at Debian> reported memory exhaustion problems on the production server manpages.debian.org. This sub-Megabyte leak is not the cause of Michael's trouble, though, where Gigabytes of memory are being wasted. We are still investigating whether the original problem may be related to his supervisor process, which is written in Go, rather than to mandoc.
Revision 1.250 / (download) - annotate - [select for diffs], Tue Aug 10 12:36:42 2021 UTC (2 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE,
OPENBSD_7_0
Changes since 1.249: +4 -2 lines
Diff to previous 1.249 (colored) to selected 1.177 (colored)
Support two-character font names (BI, CW, CR, CB, CI) in the tbl(7) layout font modifier. Get rid of the TBL_CELL_BOLD and TBL_CELL_ITALIC flags and use the usual ESCAPE_FONT* enum mandoc_esc members from mandoc.h instead, which simplifies and unifies some code. While here, also support CB and CI in roff(7) \f escape sequences and in roff(7) .ft requests for all output modes. Using those is certainly not recommended because portability is limited even with groff, but supporting them makes some existing third-party manual pages look better, in particular in HTML output mode. Bug-compatible with groff as far as i'm aware, except that i consider font names starting with the '\n' (ASCII 0x0a line feed) character so insane that i decided to not support them. Missing feature reported by nabijaczleweli dot xyz in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992002. I used none of the code from the initial patch submitted by nabijaczleweli, but some of their ideas. Final patch tested by them, too.
Revision 1.249 / (download) - annotate - [select for diffs], Sun Jun 27 17:57:13 2021 UTC (2 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.248: +10 -2 lines
Diff to previous 1.248 (colored) to selected 1.177 (colored)
add a style message about overlong text lines, trying very hard to avoid false positives, not at all trying to catch as many cases as possible; feature originally suggested by tb@, OK tb@ kn@ jmc@
Revision 1.248 / (download) - annotate - [select for diffs], Thu Aug 27 12:58:00 2020 UTC (3 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE,
OPENBSD_6_9,
OPENBSD_6_8_BASE,
OPENBSD_6_8
Changes since 1.247: +4 -2 lines
Diff to previous 1.247 (colored) to selected 1.177 (colored)
Avoid artifacts in the most common case of closing conditional blocks when no arguments follow the closing brace, \}. For example, the line "'br\}" contained in the pod2man(1) preamble would throw a bogus "escaped character not allowed in a name" error. This issue was originally reported by Chris Bennett on ports@, and afresh1@ noticed it came from the pod2man(1) preamble.
Revision 1.247 / (download) - annotate - [select for diffs], Mon Aug 3 10:52:38 2020 UTC (3 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.246: +64 -59 lines
Diff to previous 1.246 (colored) to selected 1.177 (colored)
Put the code handling \} into a new function roff_cond_checkend() and call that function not only from both places where copies existed - when processing text lines and when processing request/macro lines in conditional block scope - but also when closing a macro definition request, such that this construction works: .if n \{.de macroname macro content .. \} ignored arguments .macroname This fixes a bug reported by John Gardner <gardnerjohng at gmail dot com>. While here, avoid a confusing decrement of the line scope counter in roffnode_cleanscope() for conditional blocks that do not have line scope in the first place (no functional change for this part). Also improve validation of an internal invariant in roff_cblock() and polish some comments.
Revision 1.246 / (download) - annotate - [select for diffs], Wed Apr 8 11:54:14 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE,
OPENBSD_6_7
Changes since 1.245: +2 -1 lines
Diff to previous 1.245 (colored) to selected 1.177 (colored)
Use a separate node->tag attribute rather than abusing the node->string attribute for the purpose. No functional change intended. The purpose is to make it possible to later attach tags to text nodes.
Revision 1.245 / (download) - annotate - [select for diffs], Mon Apr 6 09:55:49 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.244: +8 -2 lines
Diff to previous 1.244 (colored) to selected 1.177 (colored)
Support manual tagging of .Pp, .Bd, .D1, .Dl, .Bl, and .It. In HTML output, improve the logic for writing inside permalinks: skip them when there is no child content or when there is a risk that the children might contain flow content.
Revision 1.244 / (download) - annotate - [select for diffs], Fri Apr 3 11:34:19 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.243: +5 -3 lines
Diff to previous 1.243 (colored) to selected 1.177 (colored)
Remove some stray argument names from function prototypes, for consistency with the dominant style used in mandoc. No functional change. Patch from Martin Vahlensieck <academicsolutions dot ch>.
Revision 1.243 / (download) - annotate - [select for diffs], Thu Feb 27 21:38:27 2020 UTC (4 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.242: +2 -2 lines
Diff to previous 1.242 (colored) to selected 1.177 (colored)
Fully support explicit tagging of .Sh and .Ss. This fixes the offset of two lines in terminal output and this improves HTML output by putting the id= attribute and <a> element into the respective <h1> or <h2> element rather than writing an additional <mark> element. To that end, introduce node flags NODE_ID (to make the node a link target, for example by writing an HTML id= attribute or by calling tag_put()) and NODE_HREF (to make the node a link source, used only in HTML output, used only to write an <a class="permalink"> element). In particular: * In the validator, generalize the concept of the "next node" such that it also works before .Sh and .Ss. * If the first argument of .Tg is empty, don't forget to complain if there are additional arguments, which will be ignored. * In the terminal formatter, support writing of explicit tags for all kinds of nodes, not just for .Tg. * In deroff(), allow nodes to have an explicit string representation even when they aren't text nodes. Use this for explicitly tagged section headers. Suprisingly, this is sufficient to make HTML output work, without explicit code changes in the HTML formatter. * In syntax tree output, display NODE_ID and NODE_HREF.
Revision 1.242 / (download) - annotate - [select for diffs], Thu Feb 27 01:25:58 2020 UTC (4 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.241: +54 -1 lines
Diff to previous 1.241 (colored) to selected 1.177 (colored)
Introduce the concept of nodes that are semantically transparent: they are skipped when looking for previous or following high-level macros. Examples include roff(7) .ft, .ll, and .ta, mdoc(7) .Sm and .Tg, and man(7) .DT and .PD. Use this concept for a variety of improved decisions in various validators and formatters. While here, * remove a few const qualifiers on struct arguments that caused trouble; * get rid of some more Yoda notation in the vicinity; * and apply some other stylistic improvements in the vicinity. I found this class of issues while considering .Tg patches from kn@.
Revision 1.241 / (download) - annotate - [select for diffs], Sun Jan 19 17:59:01 2020 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.240: +3 -3 lines
Diff to previous 1.240 (colored) to selected 1.177 (colored)
Introduce a new mdoc(7) macro .Tg ("tag") to explicitly mark a place as defining a term. Please only use it when automatic tagging does not work. Manual page authors will not be required to add the new macro; using it remains optional. HTML output is still rudimentary in this version and will be polished later. Thanks to kn@ for reminding me that i have been considering since BSDCan 2014 whether something like this might be useful. Given that possibilities of making automatic tagging better are running out and there are still several situations where automatic tagging cannot do the job, i think the time is now ripe. Feedback and no objection from millert@; OK espie@ inoguchi@ kn@.
Revision 1.240 / (download) - annotate - [select for diffs], Thu Dec 26 19:51:47 2019 UTC (4 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.239: +14 -2 lines
Diff to previous 1.239 (colored) to selected 1.177 (colored)
Do not fail an assertion when a high level macro occurs in the body of a conditional inside a .ce request block. Instead, abort the .ce block just like when there is no conditional in between. Bug found by espie@ working on the textproc/fstrcmp port.
Revision 1.239 / (download) - annotate - [select for diffs], Sat Nov 9 14:39:42 2019 UTC (4 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.238: +8 -4 lines
Diff to previous 1.238 (colored) to selected 1.177 (colored)
In the past, generating comment nodes stopped at the .TH or .Dd macro, which is usually close to the beginning of the file, right after the Copyright header comments. But espie@ found horrible input files in the textproc/fstrcmp port that generate lots of parse nodes before even getting to the header macro. In some formatters, comment nodes after some kinds of real content triggered assertions. So make sure generation of comment nodes stops once real content is encountered.
Revision 1.238 / (download) - annotate - [select for diffs], Mon Jul 1 22:43:03 2019 UTC (4 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE,
OPENBSD_6_6
Changes since 1.237: +3 -3 lines
Diff to previous 1.237 (colored) to selected 1.177 (colored)
delete trailing whitespace and space-tab sequences; no code change; patch from Michal Nowak <mnowak at startmail dot com> who found these with git pbchk in the illumos tree
Revision 1.237 / (download) - annotate - [select for diffs], Sun Apr 21 23:45:50 2019 UTC (5 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.236: +7 -2 lines
Diff to previous 1.236 (colored) to selected 1.177 (colored)
When calling an empty macro, do not clobber existing arguments. Fixing a bug found with the groffer(1) version 1.19 manual page following a report from Jan Stary.
Revision 1.236 / (download) - annotate - [select for diffs], Sun Apr 21 22:43:00 2019 UTC (5 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.235: +46 -9 lines
Diff to previous 1.235 (colored) to selected 1.177 (colored)
Implement the roff .break request (break out of a .while loop). Jan Stary <hans at stare dot cz> found it in an ancient groffer(1) manual page (version 1.19) on MacOS X Mojave. Having .break not implemented wasn't a particularly bright idea because obviously, it tended to cause infinite loops.
Revision 1.235 / (download) - annotate - [select for diffs], Wed Feb 6 20:54:28 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE,
OPENBSD_6_5
Changes since 1.234: +19 -8 lines
Diff to previous 1.234 (colored) to selected 1.177 (colored)
Let roff_getname() end the roff identifier at a tab character and audit all its callers whether termination is handled correctly. Resulting improvements: * An escape or tab ending the macro name in a macro invocation is discarded, and argument processing is started after it. * An escape or tab ending a name in ".if d" and ".if r" is preserved. * An escape ending a name in ".ds" causes the whole request to be ignored. * A tab ending a name in ".ds" becomes part of the string. * An escape or tab ending a name in ".rm" causes the rest of the line to be ignored. * An escape or tab ending the first name in ".als", ".rn", or ".nr" causes the whole request to be ignored. Kurt Jaeger <pi at FreeBSD> made me aware of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235456#c0 and in that bug report, comment 0 item (3) is a special case of this class of issues. Yes, the "mh" manual pages are no doubt among the worst on the planet.
Revision 1.234 / (download) - annotate - [select for diffs], Wed Feb 6 17:39:57 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.233: +15 -12 lines
Diff to previous 1.233 (colored) to selected 1.177 (colored)
adjust style and comments in roff_getname(); no functional change
Revision 1.233 / (download) - annotate - [select for diffs], Sat Jan 5 09:10:24 2019 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.232: +3 -1 lines
Diff to previous 1.232 (colored) to selected 1.177 (colored)
no-fill mode has to be suspended during tbl(7) rendering, too
Revision 1.232 / (download) - annotate - [select for diffs], Sat Jan 5 00:36:46 2019 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.231: +3 -3 lines
Diff to previous 1.231 (colored) to selected 1.177 (colored)
Some high-level block macros have an effect similar to temporarily 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.
Revision 1.231 / (download) - annotate - [select for diffs], Mon Dec 31 08:17:58 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.230: +5 -1 lines
Diff to previous 1.230 (colored) to selected 1.177 (colored)
Store the fill mode with a new flag NODE_NOFILL in every node, like it is already done with NODE_SYNPRETTY, such that the fill mode becomes more directly available to the formatters. Not used yet, but will be used by upcoming commits.
Revision 1.230 / (download) - annotate - [select for diffs], Mon Dec 31 07:07:43 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.229: +29 -21 lines
Diff to previous 1.229 (colored) to selected 1.177 (colored)
Move parsing of the .nf and .fi (fill mode) requests from the man(7) 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.
Revision 1.229 / (download) - annotate - [select for diffs], Mon Dec 31 04:55:42 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.228: +13 -6 lines
Diff to previous 1.228 (colored) to selected 1.177 (colored)
Cleanup, minus 15 LOC, no functional change: 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.
Revision 1.228 / (download) - annotate - [select for diffs], Sun Dec 30 00:48:48 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.227: +14 -17 lines
Diff to previous 1.227 (colored) to selected 1.177 (colored)
Cleanup, no functional change: 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.
Revision 1.227 / (download) - annotate - [select for diffs], Fri Dec 21 16:58:49 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.226: +54 -21 lines
Diff to previous 1.226 (colored) to selected 1.177 (colored)
Rename mandoc_getarg() to roff_getarg() and pass it the roff parser struct as an argument such that after copy-in, it can call roff_expand() once again, which used to be called roff_res() before this. This fixes a subtle low-level roff(7) parsing bug reported by Fabio Scotoni <fabio at esse dot ch> in the 4.4BSD-Lite2 mdoc.samples(7) manual page, because that page used an escaped escape sequence in a macro argument. To expand escaped escape sequences in quoted mdoc(7) arguments, too, stop bypassing the call to roff_getarg() in mdoc_argv.c, function args() for this case. This does not solve the case of escaped escape sequences in quoted .Bl -column phrases yet. Because roff_expand() can make the string longer, roff_getarg() can no longer operate in-place but needs to malloc(3) the returned string. In the high-level parsers, free(3) that string after processing it.
Revision 1.226 / (download) - annotate - [select for diffs], Thu Dec 20 03:38:10 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.225: +2 -2 lines
Diff to previous 1.225 (colored) to selected 1.177 (colored)
Bugfix: When after a \\, \t, or \a, another \t or \a had to be resolved in copy mode within the same argument, the argument got corrupted. Found while working on a loosely related bug report from Fabio Scotoni <fabio at esse dot ch>.
Revision 1.225 / (download) - annotate - [select for diffs], Tue Dec 18 21:58:41 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.224: +98 -1 lines
Diff to previous 1.224 (colored) to selected 1.177 (colored)
As a first step towards making roff_res() callable from mandoc_getarg(), move the function mandoc_getarg() from mandoc.c to roff.c. It was misplaced in mandoc.c in the first place; that file is intended for utilities needed both by parsers and by formatters, while reading macro arguments in copy mode is purely a task of the roff(7) parser. Needed as a preliminary for an upcoming bugfix. No code change.
Revision 1.224 / (download) - annotate - [select for diffs], Sat Dec 15 19:30:19 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.223: +34 -15 lines
Diff to previous 1.223 (colored) to selected 1.177 (colored)
Several improvements to escape sequence handling. * Add the missing special character \_ (underscore). * Partial implementations of \a (leader character) and \E (uninterpreted escape character). * Parse and ignore \r (reverse line feed). * Add a WARNING message about undefined escape sequences. * Add an UNSUPP message about unsupported escape sequences. * Mark \! and \? (transparent throughput) and \O (suppress output) as unsupported. * Treat the various variants of zero-width spaces as one-byte escape sequences rather than as special characters, to avoid defining bogus forms with square brackets. * For special characters with one-byte names, do not define bogus forms with square brackets, except for \[-], which is valid. * In the form with square brackets, undefined special characters do not fall back to printing the name verbatim, not even for one-byte names. * Starting a special character name with a blank is an error. * Undefined escape sequences never abort formatting of the input string, not even in HTML output mode. * Document the newly handled escapes, and a few that were missing. * Regression tests for most of the above.
Revision 1.223 / (download) - annotate - [select for diffs], Fri Dec 14 06:33:03 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.222: +6 -10 lines
Diff to previous 1.222 (colored) to selected 1.177 (colored)
Cleanup, no functional change: Now that message handling is properly encapsulated, remove struct mparse pointers from four structs (roff, roff_man, tbl_node, eqn_node) and from the argument lists of five functions (roff_alloc, roff_man_alloc, mandoc_getarg, tbl_alloc, eqn_alloc). Except for being passed to the main program as an opaque object, it now only occurs in read.c, as it should, and not across 15 files like in the past.
Revision 1.222 / (download) - annotate - [select for diffs], Fri Dec 14 05:17:45 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.221: +77 -92 lines
Diff to previous 1.221 (colored) to selected 1.177 (colored)
Almost mechanical diff to remove the "struct mparse *" argument 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.
Revision 1.221 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:14 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.220: +2 -1 lines
Diff to previous 1.220 (colored) to selected 1.177 (colored)
Cleanup, no functional change: 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.
Revision 1.220 / (download) - annotate - [select for diffs], Thu Dec 13 05:13:15 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.219: +2 -3 lines
Diff to previous 1.219 (colored) to selected 1.177 (colored)
Cleanup, no functional change: 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.
Revision 1.219 / (download) - annotate - [select for diffs], Thu Dec 13 03:40:09 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.218: +4 -6 lines
Diff to previous 1.218 (colored) to selected 1.177 (colored)
Cleanup, no functional change: 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.
Revision 1.218 / (download) - annotate - [select for diffs], Thu Dec 13 02:05:57 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.217: +14 -22 lines
Diff to previous 1.217 (colored) to selected 1.177 (colored)
Cleanup, no functional change: Move tbl(7)-specific parser internals out of libroff.h. Move some tbl(7)-internal processing from roff.c to tbl.c.
Revision 1.217 / (download) - annotate - [select for diffs], Wed Dec 12 21:54:30 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.216: +3 -2 lines
Diff to previous 1.216 (colored) to selected 1.177 (colored)
Cleanup, no functional change: No need to expose the tbl(7) syntax tree data structures everywhere. Move them to their own include file, "tbl.h", and improve comments.
Revision 1.216 / (download) - annotate - [select for diffs], Tue Dec 4 02:53:45 2018 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.215: +9 -1 lines
Diff to previous 1.215 (colored) to selected 1.177 (colored)
Clean up the validation of .Pp, .PP, .sp, and .br. Make sure all combinations are handled, and are handled in a systematic manner. This resolves some erratic duplicate handling, handles a number of missing cases, and improves diagnostics in various respects. Move validation of .br and .sp to the roff validation module rather than doing that twice in the mdoc and man validation modules. Move the node relinking function to the roff library where it belongs. In validation functions, only look at the node itself, at previous nodes, and at descendants, not at following nodes or ancestors, such that only nodes are inspected which are already validated.
Revision 1.215 / (download) - annotate - [select for diffs], Mon Nov 26 17:44:29 2018 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.214: +29 -7 lines
Diff to previous 1.214 (colored) to selected 1.177 (colored)
When a conditional block is closed by putting "\}" on a text line by itself (which is somewhat unusual but not invalid; most authors use the empty macro line ".\}" instead), agree more closely with groff and do not produce a double space in the output. Quirk reported by millert@. While here, tweak the rest of the function body of roff_cond_text() to more closely match roff_cond_sub(). The subtly different handling could make people (including myself) wonder whether there is any point in being different. Testing shows there is not.
Revision 1.214 / (download) - annotate - [select for diffs], Thu Oct 25 01:21:30 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.213: +2 -1 lines
Diff to previous 1.213 (colored) to selected 1.177 (colored)
Implement the \f(CW and \f(CR (constant width font) escape sequences for HTML output. Somewhat relevant because pod2man(1) relies on this. Missing feature reported by Pali dot Rohar at gmail dot com. Note that constant width font was already correctly selected before this when required by semantic markup. Only attempting physical markup with the low-level escape sequence was ineffective.
Revision 1.213 / (download) - annotate - [select for diffs], Sat Aug 25 16:43:52 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE,
OPENBSD_6_4
Changes since 1.212: +73 -2 lines
Diff to previous 1.212 (colored) to selected 1.177 (colored)
Rudimentary implementation of the roff(7) .char (output glyph definition) request, used for example by groff_hdtbl(7). This simplistic implementation may interact incorrectly with the .tr (input character translation) request. But come on, you are not only using .char *and* .tr, but you do so with respect to the same character in the same manual page?
Revision 1.212 / (download) - annotate - [select for diffs], Fri Aug 24 22:56:37 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.211: +146 -125 lines
Diff to previous 1.211 (colored) to selected 1.177 (colored)
Rudimentary implementation of the roff(7) .while request. Needed for example by groff_hdtbl(7). There are two limitations: It does not support nested .while requests yet, and each .while loop must start and end in the same scope. The roff_parseln() return codes are now more flexible and allow OR'ing options.
Revision 1.211 / (download) - annotate - [select for diffs], Thu Aug 23 14:16:12 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.210: +205 -179 lines
Diff to previous 1.210 (colored) to selected 1.177 (colored)
Implement the roff(7) .shift and .return requests, for example used by groff_hdtbl(7) and groff_mom(7). Also correctly interpolate arguments during nested macro execution even after .shift and .return, implemented using a stack of argument arrays. Note that only read.c, but not roff.c can detect the end of a macro execution, and the existence of .shift implies that arguments cannot be interpolated up front, so unfortunately, this includes a partial revert of roff.c rev. 1.209, moving argument interpolation back into the function roff_res().
Revision 1.210 / (download) - annotate - [select for diffs], Tue Aug 21 18:15:16 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.209: +19 -5 lines
Diff to previous 1.209 (colored) to selected 1.177 (colored)
Implement the \\$@ escape sequence (insert all macro arguments, quoted) in addition to the already supported \\$* (similar, but unquoted). Then use \\$@ to improve the implementation of the .als request (macro alias). Needed by groff_hdtbl(7). Gosh, it feels like the manual pages of the groff package are exercising every bloody roff(7) feature under the sun. In the manual page source code itself, not merely in the implementation of the used macro packages, that is.
Revision 1.209 / (download) - annotate - [select for diffs], Mon Aug 20 17:31:44 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.208: +35 -8 lines
Diff to previous 1.208 (colored) to selected 1.177 (colored)
Expand \n(.$ (the number of macro arguments) right in roff_userdef(), before even reparsing the expanded macro. That is the least dirty way to fix the bug that \(.$ remained set after execution of the user-defined macro ended. Any other way to fix it would probably require changes to read.c, which really shouldn't be bothered with such roff(7) internals.
Revision 1.208 / (download) - annotate - [select for diffs], Sun Aug 19 17:43:39 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.207: +44 -5 lines
Diff to previous 1.207 (colored) to selected 1.177 (colored)
Mostly complete implementation of the 'c' (character available) roff conditional, except that the .char request still isn't supported and that behaviour differs from groff in many edge cases. But at least valid character names and numbers are now distinguished from invalid ones. This also fixes the bug that parsing of the 'c' conditional was incomplete, which resulted in leaking the tested character to the input parser at the beginning of the body when the condition was inverted.
Revision 1.207 / (download) - annotate - [select for diffs], Sat Aug 18 22:04:32 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.206: +3 -2 lines
Diff to previous 1.206 (colored) to selected 1.177 (colored)
Bugfix: When a line ends with '\ \"', don't strip the trailing space because that turned it into a bogus line continuation.
Revision 1.206 / (download) - annotate - [select for diffs], Sat Aug 18 21:36:53 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.205: +9 -2 lines
Diff to previous 1.205 (colored) to selected 1.177 (colored)
support the highly surprising escape sequence \# (line continuation with comment); used for example by gropdf(1)
Revision 1.205 / (download) - annotate - [select for diffs], Sat Aug 18 02:03:41 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.204: +3 -2 lines
Diff to previous 1.204 (colored) to selected 1.177 (colored)
implement the GNU man-ext .SY/.YS (synopsis block) macro in man, used in most manual pages of the groff package
Revision 1.204 / (download) - annotate - [select for diffs], Thu Aug 16 23:40:19 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.203: +2 -1 lines
Diff to previous 1.203 (colored) to selected 1.177 (colored)
implement the GNU man-ext .TQ macro in man(7), used for example by groff_diff(7)
Revision 1.203 / (download) - annotate - [select for diffs], Thu Aug 16 13:49:40 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.202: +14 -1 lines
Diff to previous 1.202 (colored) to selected 1.177 (colored)
Implement the \*(.T predefined string (interpolate device name) by allowing the preprocessor to pass it through to the formatters. Used for example by the groff_char(7) manual page.
Revision 1.202 / (download) - annotate - [select for diffs], Fri Aug 10 04:41:21 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.201: +12 -2 lines
Diff to previous 1.201 (colored) to selected 1.177 (colored)
Implement the roff(7) .nop (no operation) request. Examples of manual pages (ab)using it include groff(7), chem(1), groff_mom(7), and groff_hdtbl(7).
Revision 1.201 / (download) - annotate - [select for diffs], Wed Aug 1 15:39:47 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.200: +4 -1 lines
Diff to previous 1.200 (colored) to selected 1.177 (colored)
After rewriting the parse buffer from scratch, we also have to reset the parse point to the beginning of the new buffer or we risk out of bounds accesses. Bug found by Leah Neukirchen <leah at vuxu dot org> with valgrind on Void Linux.
Revision 1.200 / (download) - annotate - [select for diffs], Wed Apr 11 17:10:35 2018 UTC (6 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.199: +30 -7 lines
Diff to previous 1.199 (colored) to selected 1.177 (colored)
preserve comments before .Dd when converting mdoc(7) to man(7) with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
Revision 1.199 / (download) - annotate - [select for diffs], Tue Apr 10 00:52:21 2018 UTC (6 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.198: +44 -15 lines
Diff to previous 1.198 (colored) to selected 1.177 (colored)
Two new low-level roff(7) features: * .nr optional third argument (auto-increment step size) * \n+ and \n- numerical register auto-increment and -decrement bentley@ reported on Dec 9, 2013 that lang/sbcl(1) uses these.
Revision 1.198 / (download) - annotate - [select for diffs], Mon Apr 9 22:26:25 2018 UTC (6 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.197: +20 -24 lines
Diff to previous 1.197 (colored) to selected 1.177 (colored)
When accessing an undefined number register, define it to be zero, like the previous commit for strings and macros, only technically simpler. Desired behaviour also mentioned by Werner Lemberg in 2011. This diff adds functionality but is -21 +19 LOC. :-)
Revision 1.197 / (download) - annotate - [select for diffs], Mon Apr 9 02:31:37 2018 UTC (6 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.196: +82 -43 lines
Diff to previous 1.196 (colored) to selected 1.177 (colored)
Using an undefined string or macro will cause it to be defined as empty. Observed by Werner Lemberg on Nov 14, 2011 and rotting on my TODO list ever since.
Revision 1.196 / (download) - annotate - [select for diffs], Fri Jul 14 17:16:13 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE,
OPENBSD_6_3,
OPENBSD_6_2_BASE,
OPENBSD_6_2
Changes since 1.195: +3 -2 lines
Diff to previous 1.195 (colored) to selected 1.177 (colored)
The .Dd and .TH macros must interrupt .ce, too; fixing tree corruption and assertion failure found by jsg@ with afl(1)
Revision 1.195 / (download) - annotate - [select for diffs], Fri Jul 14 16:49:16 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.194: +7 -6 lines
Diff to previous 1.194 (colored) to selected 1.177 (colored)
Explicitly initialize a variable where the compiler is (understandably) unable to figure out that it is never used uninitialized. While here, tweak the content of the variable to make its usage easier to understand. No functional change.
Revision 1.194 / (download) - annotate - [select for diffs], Thu Jul 13 15:12:47 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.193: +3 -1 lines
Diff to previous 1.193 (colored) to selected 1.177 (colored)
eqn(7) .EQ has to break man(7) next-line scope, or tree corruption and use after free many ensue; again found by jsg@ with afl(1)
Revision 1.193 / (download) - annotate - [select for diffs], Sat Jul 8 17:52:42 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.192: +37 -37 lines
Diff to previous 1.192 (colored) to selected 1.177 (colored)
Simplify by creating struct roff_node syntax tree nodes for tbl(7) right from roff_parseln() rather than delegating to read.c, similar to what i just did for eqn(7). The interface function roff_span() becomes obsolete and is deleted, the former interface function roff_addtbl() becomes static, the interface functions tbl_read() and tbl_cdata() become void, and minus twelve linus of code. No functional change.
Revision 1.192 / (download) - annotate - [select for diffs], Sat Jul 8 15:28:05 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.191: +3 -2 lines
Diff to previous 1.191 (colored) to selected 1.177 (colored)
fix an assertion failure triggered by .ce in next-line scope; found by jsg@ with afl(1)
Revision 1.191 / (download) - annotate - [select for diffs], Sat Jul 8 14:51:01 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.190: +38 -48 lines
Diff to previous 1.190 (colored) to selected 1.177 (colored)
1. Eliminate struct eqn, instead use the existing members of struct roff_node which is allocated for each equation anyway. 2. Do not keep a list of equation parsers, one parser is enough. Minus fifty lines of code, no functional change.
Revision 1.190 / (download) - annotate - [select for diffs], Tue Jul 4 22:49:59 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.189: +22 -16 lines
Diff to previous 1.189 (colored) to selected 1.177 (colored)
Fix handling of \} on roff request lines. Cures bogus error messages in pages generated with pod2man(1).
Revision 1.189 / (download) - annotate - [select for diffs], Sun Jun 25 07:23:53 2017 UTC (6 years, 11 months ago) by bentley
Branch: MAIN
Changes since 1.188: +2 -2 lines
Diff to previous 1.188 (colored) to selected 1.177 (colored)
Add support for the MT and ME mailto macros, used for example in wg(8). feedback and ok schwarze@
Revision 1.188 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:28 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.187: +6 -6 lines
Diff to previous 1.187 (colored) to selected 1.177 (colored)
Split -Wstyle into -Wstyle and the even lower -Wbase, and add -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@.
Revision 1.187 / (download) - annotate - [select for diffs], Sun Jun 18 17:35:40 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.186: +185 -135 lines
Diff to previous 1.186 (colored) to selected 1.177 (colored)
Implement appending to standard man(7) and mdoc(7) macros with .am. With roff_getstrn(), provide finer control which definitions can be used for what: * All definitions can be used for .if d tests and .am appending. * User-defined for \* expansion, .dei expansion, and macro calling. * Predefined for \* expansion. * Standard macros, original or renamed, for macro calling. Several related improvements while here: * Do not return string table entries that have explicitly been removed. * Do not create a rentab entry when trying to rename a non-existent macro. * Clear an existing rentab entry when the external interface roff_setstr() is called with its name. * Avoid trailing blanks in macro lines generated from renamed and from aliased macros. * Delete the duplicate __m*_reserved[] tables, just use roff_name[].
Revision 1.186 / (download) - annotate - [select for diffs], Sat Jun 17 23:06:43 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.185: +6 -2 lines
Diff to previous 1.185 (colored) to selected 1.177 (colored)
style message about duplicate RCS ids; inspired by mdoclint
Revision 1.185 / (download) - annotate - [select for diffs], Sat Jun 17 22:40:27 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.184: +19 -1 lines
Diff to previous 1.184 (colored) to selected 1.177 (colored)
style message about missing RCS ids; inspired by mdoclint
Revision 1.184 / (download) - annotate - [select for diffs], Wed Jun 14 22:50:37 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.183: +5 -5 lines
Diff to previous 1.183 (colored) to selected 1.177 (colored)
Naive implementation of the roff(7) .po (page offset) request. This clearly works when .po is called on the top level, but might not be sophisticated enough if people call .po inside indentation-changing contexts, but i haven't seen that in manual pages (yet :).
Revision 1.183 / (download) - annotate - [select for diffs], Wed Jun 14 19:39:05 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.182: +36 -5 lines
Diff to previous 1.182 (colored) to selected 1.177 (colored)
simple implementation of the roff(7) .als (macro alias) request, sufficient for pages using po4a(1)
Revision 1.182 / (download) - annotate - [select for diffs], Wed Jun 14 14:01:34 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.181: +12 -6 lines
Diff to previous 1.181 (colored) to selected 1.177 (colored)
implement the roff(7) d (macro or string defined) conditional
Revision 1.181 / (download) - annotate - [select for diffs], Wed Jun 14 13:00:13 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.180: +9 -9 lines
Diff to previous 1.180 (colored) to selected 1.177 (colored)
implement roff(7) .rj (right justify) request
Revision 1.180 / (download) - annotate - [select for diffs], Tue Jun 13 13:50:17 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.179: +4 -3 lines
Diff to previous 1.179 (colored) to selected 1.177 (colored)
Explicitly ignore .br, .ce, and .sp inside tbl(7) text blocks. With the current code structure, they would appear at the wrong place in the syntax tree, so it is better to not insert them into the tree at all and issue an UNSUPP message instead.
Revision 1.179 / (download) - annotate - [select for diffs], Thu Jun 8 19:35:34 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.178: +5 -1 lines
Diff to previous 1.178 (colored) to selected 1.177 (colored)
Properly reinitialize roffce_node between parses, or this may crash with use-after-free in makewhatis(8); reported by jmc@, thanks!
Revision 1.178 / (download) - annotate - [select for diffs], Wed Jun 7 00:50:30 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.177: +98 -6 lines
Diff to previous 1.177 (colored)
Implement the roff(7) .rn (rename macro or string) request. Renaming a user-defined macro is very simple: just copy the definition to the new name and delete the old name. Renaming high-level macros is a bit tricky: use a dedicated key-value-table, with non-standard names as keys and standard names as values. When a macro is found that is not user-defined, look it up in the "renamed" table and translate it back to the standard name before passing it on to the high-level parsers.
Revision 1.177 / (download) - annotate - [selected], Tue Jun 6 15:00:56 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.176: +61 -10 lines
Diff to previous 1.176 (colored)
Minimal implementation of the roff(7) .ce request (center a number of input lines without filling). Contrary to groff, high-level macros abort .ce mode for now.
Revision 1.176 / (download) - annotate - [select for diffs], Sun Jun 4 22:43:50 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.175: +5 -5 lines
Diff to previous 1.175 (colored) to selected 1.177 (colored)
Implement the roff(7) .mc (right margin character) request. The Tcl/Tk manual pages use this extensively. Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf; instead, implement a proper TERMP_BRNEVER flag.
Revision 1.175 / (download) - annotate - [select for diffs], Sun Jun 4 00:08:56 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.174: +100 -14 lines
Diff to previous 1.174 (colored) to selected 1.177 (colored)
Pure preprocessor implementation of the roff(7) .ec and .eo requests (escape character control), touching nothing after the preprocessing stage and keeping even the state variable local to the preprocessor. Since the escape character is also used for line continuation, this requires pulling the implementation of line continuation from the input reader to the preprocessor, which also considerably shortens the code required for that. When the escape character is changed, simply let the preprocessor replace bare by escaped backslashes and instances of the non-standard escape character with bare backslashes - that's all we need. Oh, and if anybody dares to use these requests in OpenBSD manuals, sending a medium-sized pack of axe-murderes after them might be a worthwhile part of the punishment, but probably insuffient on its own.
Revision 1.174 / (download) - annotate - [select for diffs], Mon May 8 20:33:40 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.173: +8 -2 lines
Diff to previous 1.173 (colored) to selected 1.177 (colored)
Line-breaking roff(7) requests also break man(7) next-line scope. 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.
Revision 1.173 / (download) - annotate - [select for diffs], Mon May 8 15:33:43 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.172: +4 -4 lines
Diff to previous 1.172 (colored) to selected 1.177 (colored)
Basic implementation of the roff(7) .ti (temporary indent) request. Needed by about four dozen ports (thanks to naddy@ for the research).
Revision 1.172 / (download) - annotate - [select for diffs], Sun May 7 17:30:58 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.171: +28 -4 lines
Diff to previous 1.171 (colored) to selected 1.177 (colored)
Basic implementation of the roff(7) .ta (define tab stops) request. 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@.
Revision 1.171 / (download) - annotate - [select for diffs], Fri May 5 15:16:25 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.170: +7 -5 lines
Diff to previous 1.170 (colored) to selected 1.177 (colored)
Move .sp to the roff modules. Enough infrastructure is in place now that this actually saves code: -70 LOC.
Revision 1.170 / (download) - annotate - [select for diffs], Fri May 5 13:17:04 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.169: +5 -4 lines
Diff to previous 1.169 (colored) to selected 1.177 (colored)
move .ll to the roff modules
Revision 1.169 / (download) - annotate - [select for diffs], Fri May 5 02:06:17 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.168: +33 -3 lines
Diff to previous 1.168 (colored) to selected 1.177 (colored)
Move handling of the roff(7) .ft request from the man(7) modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
Revision 1.168 / (download) - annotate - [select for diffs], Thu May 4 17:48:24 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.167: +22 -11 lines
Diff to previous 1.167 (colored) to selected 1.177 (colored)
Parser reorg: Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
Revision 1.167 / (download) - annotate - [select for diffs], Sat Apr 29 12:43:55 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.166: +300 -306 lines
Diff to previous 1.166 (colored) to selected 1.177 (colored)
Parser unification: use nice ohashes for all three request and macro tables; no functional change, minus two source files, minus 200 lines of code.
Revision 1.166 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:09 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.165: +132 -281 lines
Diff to previous 1.165 (colored) to selected 1.177 (colored)
Continue parser unification: * 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[].
Revision 1.165 / (download) - annotate - [select for diffs], Thu Mar 9 15:27:52 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE,
OPENBSD_6_1
Changes since 1.164: +3 -1 lines
Diff to previous 1.164 (colored) to selected 1.177 (colored)
Fix blunder in previous: we must keep the line parse buffer consistent even when aborting the parsing of the line. That buffer is not our own, but owned and reused by mparse_buf_r(), read.c. Returning without cleanup leaked memory and caused write overruns of the old, typically much smaller buffer in mparse_buf_r(). Promptly noticed by tb@ with afl(1), using MALLOC_OPTIONS=C.
Revision 1.164 / (download) - annotate - [select for diffs], Wed Mar 8 13:17:28 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.163: +16 -3 lines
Diff to previous 1.163 (colored) to selected 1.177 (colored)
prevent infinite recursion while expanding the arguments of a user-defined macro; issue found by tb@ with afl(1)
Revision 1.163 / (download) - annotate - [select for diffs], Fri Mar 3 13:55:06 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.162: +2 -2 lines
Diff to previous 1.162 (colored) to selected 1.177 (colored)
remove a few redundant conditions that jsg@ found with cppcheck
Revision 1.162 / (download) - annotate - [select for diffs], Fri Mar 3 11:49:33 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.161: +2 -2 lines
Diff to previous 1.161 (colored) to selected 1.177 (colored)
Fix previous: do not access the byte before the string if the string is empty; found by jsg@ with afl(1).
Revision 1.161 / (download) - annotate - [select for diffs], Fri Feb 17 03:01:39 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.160: +12 -4 lines
Diff to previous 1.160 (colored) to selected 1.177 (colored)
Fix a read buffer overrun that copied random data from memory into text nodes when a string passed to deroff() ended in a backslash and the byte after the terminating NUL was non-NUL, found by tb@ with afl(1). Invalid bytes so copied with the high bit set could later sometimes trigger another out of bounds read access to static memory in roff_strdup(), so add an assertion there to abort safely in case of similar data corruption.
Revision 1.160 / (download) - annotate - [select for diffs], Thu Jan 12 18:02:24 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.159: +5 -9 lines
Diff to previous 1.159 (colored) to selected 1.177 (colored)
Skipping all escape sequences at the beginning of strings in deroff() was too aggressive. There are strings that legitimately begin with an escape sequence. Only skip leading escape sequences representing whitespace. Bug reported by martijn@.
Revision 1.159 / (download) - annotate - [select for diffs], Tue Jan 10 21:54:34 2017 UTC (7 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.158: +7 -3 lines
Diff to previous 1.158 (colored) to selected 1.177 (colored)
For the .Ux/.Ox family of macros, do text production at the validation stage rather than in each and every individual formatter, using the new NODE_NOSRC flag. More rigorous and also ten lines less code.
Revision 1.158 / (download) - annotate - [select for diffs], Tue Jan 10 14:09:03 2017 UTC (7 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.157: +3 -9 lines
Diff to previous 1.157 (colored) to selected 1.177 (colored)
simplify; NODE_ENDED does no harm in man(7)
Revision 1.157 / (download) - annotate - [select for diffs], Tue Jan 10 13:46:53 2017 UTC (7 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.156: +9 -9 lines
Diff to previous 1.156 (colored) to selected 1.177 (colored)
unify names of AST node flags; no change of cpp output
Revision 1.156 / (download) - annotate - [select for diffs], Fri Jan 8 17:48:04 2016 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE,
OPENBSD_6_0,
OPENBSD_5_9_BASE,
OPENBSD_5_9
Changes since 1.155: +1 -4 lines
Diff to previous 1.155 (colored) to selected 1.177 (colored)
Delete the redundant "nchild" member of struct roff_node, replacing 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.
Revision 1.155 / (download) - annotate - [select for diffs], Thu Oct 22 21:53:49 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.154: +3 -3 lines
Diff to previous 1.154 (colored) to selected 1.177 (colored)
move man(7) validation into the dedicated validation phase, too
Revision 1.154 / (download) - annotate - [select for diffs], Wed Oct 21 23:49:05 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.153: +13 -29 lines
Diff to previous 1.153 (colored) to selected 1.177 (colored)
Move all mdoc(7) node validation done before child parsing to the new separate validation pass, except for a tiny bit needed by the parser which goes to the new mdoc_state() module; cleaner, simpler, and surprisingly also shorter by 15 lines.
Revision 1.153 / (download) - annotate - [select for diffs], Tue Oct 20 02:00:50 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.152: +9 -4 lines
Diff to previous 1.152 (colored) to selected 1.177 (colored)
In order to become able to generate syntax tree nodes on the roff(7) 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.
Revision 1.152 / (download) - annotate - [select for diffs], Thu Oct 15 23:35:38 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.151: +1 -4 lines
Diff to previous 1.151 (colored) to selected 1.177 (colored)
Delete two preprocessor constants that are no longer used. Patch from Michael Reed <m dot reed at mykolab dot com>.
Revision 1.151 / (download) - annotate - [select for diffs], Tue Oct 13 22:57:49 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.150: +3 -5 lines
Diff to previous 1.150 (colored) to selected 1.177 (colored)
Major character table cleanup: * 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.
Revision 1.150 / (download) - annotate - [select for diffs], Mon Oct 12 00:07:27 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.149: +1 -25 lines
Diff to previous 1.149 (colored) to selected 1.177 (colored)
To make the code more readable, delete 283 /* FALLTHROUGH */ comments that were right between two adjacent case statement. Keep only those 24 where the first case actually executes some code before falling through to the next case.
Revision 1.149 / (download) - annotate - [select for diffs], Tue Oct 6 18:30:44 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.148: +129 -129 lines
Diff to previous 1.148 (colored) to selected 1.177 (colored)
modernize style: "return" is not a function; ok cmp(1)
Revision 1.148 / (download) - annotate - [select for diffs], Sat Sep 26 00:53:15 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.147: +3 -4 lines
Diff to previous 1.147 (colored) to selected 1.177 (colored)
/* NOTREACHED */ after abort() is silly, delete it
Revision 1.147 / (download) - annotate - [select for diffs], Sat Aug 29 23:55:53 2015 UTC (8 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.146: +18 -17 lines
Diff to previous 1.146 (colored) to selected 1.177 (colored)
If we have to reparse the text line because we spring an input line trap, we must not escape breakable hyphens yet, or mparse_buf_r() in read.c will complain and replace the escaped hyphens with question marks. Bug found in ocserv(8) following a report from Kurt Jaeger <pi at FreeBSD>.
Revision 1.146 / (download) - annotate - [select for diffs], Sat Aug 29 21:37:11 2015 UTC (8 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.145: +27 -16 lines
Diff to previous 1.145 (colored) to selected 1.177 (colored)
Implement the escape sequence \\$*, expanding to all arguments of the current user-defined macro. This is another missing feature required for ocserv(8). Problem reported by Kurt Jaeger <pi at FreeBSD>.
Revision 1.145 / (download) - annotate - [select for diffs], Sat Aug 29 20:24:34 2015 UTC (8 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.144: +19 -9 lines
Diff to previous 1.144 (colored) to selected 1.177 (colored)
Minimal implementation of the read-only number register \n(.$ which returns the number of arguments of the current macro. This is one of the missing features required for ocserv(8). Problem reported by Kurt Jaeger <pi at FreeBSD>.
Revision 1.144 / (download) - annotate - [select for diffs], Sat Jun 27 13:25:30 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE,
OPENBSD_5_8
Changes since 1.143: +3 -1 lines
Diff to previous 1.143 (colored) to selected 1.177 (colored)
Ignore blank characters at the beginning of a conditional block, that is, after "\{". Issue found by Markus <Waldeck at gmx dot de> in bash(1).
Revision 1.143 / (download) - annotate - [select for diffs], Sun May 31 23:12:16 2015 UTC (9 years ago) by schwarze
Branch: MAIN
Changes since 1.142: +32 -6 lines
Diff to previous 1.142 (colored) to selected 1.177 (colored)
Implement the roff(7) `r' (register exists) conditional. Missing feature found by Markus <Waldeck at gmx dot de> in Debian's bash(1) manual page.
Revision 1.142 / (download) - annotate - [select for diffs], Fri May 1 16:01:53 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.141: +2 -1 lines
Diff to previous 1.141 (colored) to selected 1.177 (colored)
Setting the "last" member of struct roff_node was done at an extremely weird place. Move it to the obviously correct place. Surprisingly, this didn't cause any misformatting in the test suite or in any base system manuals, but i cannot believe the code was really correct for all conceivable input, and it would be very hard to verify. At the very least, it cannot have worked for man(7).
Revision 1.141 / (download) - annotate - [select for diffs], Thu Apr 23 16:17:04 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.140: +47 -1 lines
Diff to previous 1.140 (colored) to selected 1.177 (colored)
Unify mdoc_deroff() and man_deroff() into a common function deroff(). 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.
Revision 1.140 / (download) - annotate - [select for diffs], Sun Apr 19 14:57:16 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.139: +22 -1 lines
Diff to previous 1.139 (colored) to selected 1.177 (colored)
Unify trickier node handling functions. * 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.
Revision 1.139 / (download) - annotate - [select for diffs], Sun Apr 19 14:25:05 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.138: +62 -3 lines
Diff to previous 1.138 (colored) to selected 1.177 (colored)
Unify some node handling functions that use TOKEN_NONE. * 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.
Revision 1.138 / (download) - annotate - [select for diffs], Sun Apr 19 13:50:10 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.137: +205 -7 lines
Diff to previous 1.137 (colored) to selected 1.177 (colored)
Unify node handling functions: * 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.
Revision 1.137 / (download) - annotate - [select for diffs], Sat Apr 18 17:28:08 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.136: +70 -2 lines
Diff to previous 1.136 (colored) to selected 1.177 (colored)
Unify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}(). Minus 80 lines of code, no functional change. Written on the train from Koeln to Wolfsburg returning from p2k15.
Revision 1.136 / (download) - annotate - [select for diffs], Sat Apr 4 13:52:59 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +3 -1 lines
Diff to previous 1.135 (colored) to selected 1.177 (colored)
Don't allow breaking the output line after hyphens following escape sequences. Improves tic(1), sxpm(1), and a few Perl manuals. Quirk found by naddy@ in milter-greylist(8).
Revision 1.135 / (download) - annotate - [select for diffs], Sat Feb 21 14:46:33 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE,
OPENBSD_5_7
Changes since 1.134: +77 -17 lines
Diff to previous 1.134 (colored) to selected 1.177 (colored)
Escape quotes when expanding macro arguments. This fixes a bug naddy@ found in plan9/rc(1).
Revision 1.134 / (download) - annotate - [select for diffs], Tue Feb 17 17:55:12 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.133: +12 -3 lines
Diff to previous 1.133 (colored) to selected 1.177 (colored)
Cope with another one of the many kinds of DocBook stupidity: Instead of just using .br, DocBook sometimes fiddles with the utterly unportable internal register \n[an-break-flag] that is only available in the GNU implementation of man(7) and then arms an input line trap to call the equally unportable internal macro .an-trap that, in the GNU implementation, inspects that variable; all the world is GNU, isn't it? Since naddy@ reports that quite a few ports manuals suffer from this insanity, let's just translate it to the intended .br. Et ceterum censeo DocBookem esse delendam.
Revision 1.133 / (download) - annotate - [select for diffs], Tue Feb 17 17:16:12 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +42 -37 lines
Diff to previous 1.132 (colored) to selected 1.177 (colored)
Let .it accept numerical expressions, not just numerical constants. For .it, ignore scaling units in roff_getnum(). Inside parentheses, skip whitespace after a sign in roff_getnum(). Parse and ignore unary plus in roff_getnum(). As a bonus, get rid of the only call to mandoc_strntoi() in roff.c.
Revision 1.132 / (download) - annotate - [select for diffs], Fri Feb 6 16:05:51 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.131: +6 -5 lines
Diff to previous 1.131 (colored) to selected 1.177 (colored)
replace the last legacy generic message type, "argument count wrong", by more specific messages, improving diagnostics for .cc .tr .Bl -column
Revision 1.131 / (download) - annotate - [select for diffs], Fri Jan 30 00:19:26 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (colored) to selected 1.177 (colored)
correctly handle table layout lines starting with a dot
Revision 1.130 / (download) - annotate - [select for diffs], Wed Jan 28 17:30:37 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.129: +7 -4 lines
Diff to previous 1.129 (colored) to selected 1.177 (colored)
* Polish tbl(7) error reporting. * Do not print out macro names in tbl(7) data blocks. * Like with GNU tbl, let empty tables cause a blank line. * Avoid producing empty tables in -Tman.
Revision 1.129 / (download) - annotate - [select for diffs], Wed Jan 28 15:02:25 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.128: +8 -2 lines
Diff to previous 1.128 (colored) to selected 1.177 (colored)
For now, it can't be helped that mandoc tbl(7) ignores high-level macros, but stop throwing away their arguments. This fixes information loss in a handful of Xenocara manuals, at the price of a small amount of formatting noise creeping through.
Revision 1.128 / (download) - annotate - [select for diffs], Sat Jan 24 02:41:32 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.127: +3 -2 lines
Diff to previous 1.127 (colored) to selected 1.177 (colored)
Strangely, ignoring the roff(7) .na request was implemented in the man(7) parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
Revision 1.127 / (download) - annotate - [select for diffs], Fri Jan 23 20:17:25 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +4 -4 lines
Diff to previous 1.126 (colored) to selected 1.177 (colored)
While ignoring the .ta (set tab stops) and .ti (temp indent) requests is sometimes harmless, it often causes seriously ugly output, so flag these requests as unsupported rather than ignoring them. Discussed with naddy@.
Revision 1.126 / (download) - annotate - [select for diffs], Fri Jan 23 00:38:42 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.125: +41 -3 lines
Diff to previous 1.125 (colored) to selected 1.177 (colored)
Wonders of roff(7): Integer numbers in numerical expressions can carry scaling units, and some manuals (e.g. in devel/grcs) actually use that, so let's support it. Missing feature reported by naddy@.
Revision 1.125 / (download) - annotate - [select for diffs], Thu Jan 22 22:50:31 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.124: +20 -2 lines
Diff to previous 1.124 (colored) to selected 1.177 (colored)
Slightly improve \w width measurements: Count special characters with the same width as ASCII characters and treat all other escape sequences as if they had a width of 0. Certainly not perfect, but a bit better. For example, GNU RCS ci(1) needs this; reported by naddy@.
Revision 1.124 / (download) - annotate - [select for diffs], Wed Jan 21 02:16:11 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +10 -11 lines
Diff to previous 1.123 (colored) to selected 1.177 (colored)
pass empty request lines through to tbl(7); sometimes, they end a layout
Revision 1.123 / (download) - annotate - [select for diffs], Tue Jan 20 21:12:46 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +457 -19 lines
Diff to previous 1.122 (colored) to selected 1.177 (colored)
Split the -Werror message level into -Werror (broken manual, probably using mandoc is better than using groff) and -Wunsupp (manual using unsupported low-level roff(7) feature, probably using groff is better than using mandoc). Once this feature is complete, it is intended to help porting, making the decision whether to USE_GROFF easier. As a first step, distinguish four classes of roff(7) requests: 1. Supported (currently 24 requests) 2. Currently ignored because unimportant (120) -> no message 3. Ignored for good because insecure (14) -> -Werror 4. Currently unsupported (68) -> these trigger the new -Wunsupp messages
Revision 1.122 / (download) - annotate - [select for diffs], Fri Jan 16 16:52:39 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.121: +3 -1 lines
Diff to previous 1.121 (colored) to selected 1.177 (colored)
Parse and ignore .IX (generate index entry) macros because pod2man(1) emits them, by default without defining them, relying on the roff(7) quirk that undefined macros have no effect. This cures 1996 mandoc ERRORs in src/gnu.
Revision 1.121 / (download) - annotate - [select for diffs], Wed Jan 14 22:57:57 2015 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +8 -3 lines
Diff to previous 1.120 (colored) to selected 1.177 (colored)
downgrade ".so with absolute path" from FATAL to ERROR; allows to get rid of ROFF_ERR
Revision 1.120 / (download) - annotate - [select for diffs], Wed Jan 7 12:19:17 2015 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +2 -1 lines
Diff to previous 1.119 (colored) to selected 1.177 (colored)
Bugfix: When the invocation of a user-defined macro follows a roff conditional request on the same input line, don't skip the first few bytes of its content.
Revision 1.119 / (download) - annotate - [select for diffs], Thu Jan 1 19:28:29 2015 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +7 -5 lines
Diff to previous 1.118 (colored) to selected 1.177 (colored)
Fix a buffer overrun triggered by a trailing backslash at EOF in an unclosed conditional body. If the memory contained the byte sequence "\}" after the end of the buffer before the next NUL, this could even write beyond the end of the buffer, specifically '&' to the location of the '}'. Found by jsg@ with afl.
Revision 1.118 / (download) - annotate - [select for diffs], Sun Dec 28 14:16:07 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.117: +5 -7 lines
Diff to previous 1.117 (colored) to selected 1.177 (colored)
improve previous: do the size check up front to avoid leaking memory
Revision 1.117 / (download) - annotate - [select for diffs], Thu Dec 25 17:18:40 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.116: +8 -1 lines
Diff to previous 1.116 (colored) to selected 1.177 (colored)
Reduce memory and time consumption on certain malformed input files by limiting the length of expanded input lines during the (usually recursive) expansion of user defined strings. Resource hogging found by jsg@ with afl.
Revision 1.116 / (download) - annotate - [select for diffs], Thu Dec 18 17:43:07 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.115: +8 -2 lines
Diff to previous 1.115 (colored) to selected 1.177 (colored)
Don't let the modulo operator divide by zero. Found by jsg@ with afl.
Revision 1.115 / (download) - annotate - [select for diffs], Tue Dec 16 23:44:16 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +20 -5 lines
Diff to previous 1.114 (colored) to selected 1.177 (colored)
Ignore mdoc(7) and man(7) macros inside tbl(7) code because they would abort the table in an unclean way, causing assertion failures found by jsg@.
Revision 1.114 / (download) - annotate - [select for diffs], Tue Dec 16 03:52:31 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored) to selected 1.177 (colored)
When a string comparison condition contains no mismatching character but ends without the final delimiter, the parse point was advanced one character too far and the invalid pointer returned to the caller of roff_parseln(). Later use could potentially advance the pointer even further and maybe even write to it. Fixing a buffer overrun found by jsg@ with afl (the most severe so far).
Revision 1.113 / (download) - annotate - [select for diffs], Tue Dec 16 01:21:37 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +6 -3 lines
Diff to previous 1.112 (colored) to selected 1.177 (colored)
When a numerical condition errors out after consuming at least one character of input, treat it as false, do not retry it as a string comparison condition. This also fixes a read buffer overrun that happened when the numerical condition advanced to the end of the input line before erroring out, found by jsg@ with afl.
Revision 1.112 / (download) - annotate - [select for diffs], Mon Dec 15 23:42:31 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.111: +3 -1 lines
Diff to previous 1.111 (colored) to selected 1.177 (colored)
Empty conditions count as false. When negated, they still count as false. Found when investigating crashes jsg@ found with afl. Not completely fixing the crashes yet.
Revision 1.111 / (download) - annotate - [select for diffs], Wed Nov 19 01:20:18 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +3 -1 lines
Diff to previous 1.110 (colored) to selected 1.177 (colored)
Support the ".if v" conditional operator (vroff mode, always false) for groff compatibility because pod2man(1) uses it that way. Weirdly, groff documents it as "for compatibility with other troff versions" but neither Heirloom nor Plan 9 have it. Issue reported by giovanni@ via sthen@.
Revision 1.110 / (download) - annotate - [select for diffs], Sat Nov 1 06:02:43 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +165 -167 lines
Diff to previous 1.109 (colored) to selected 1.177 (colored)
Use struct buf in libroff, it is very natural there and reduces the number of arguments of many functions. While here, sprinkle some KNF. No functional change.
Revision 1.109 / (download) - annotate - [select for diffs], Tue Oct 28 17:35:42 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +10 -3 lines
Diff to previous 1.108 (colored) to selected 1.177 (colored)
Make the character table available to libroff so it can check the 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.
Revision 1.108 / (download) - annotate - [select for diffs], Sat Oct 25 15:23:25 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +3 -2 lines
Diff to previous 1.107 (colored) to selected 1.177 (colored)
With the current architecture, we can't support inline equations inside tables, sorry. So don't even try to parse tbl(7) blocks for eqn(7) delimiters. Broken table layout found in glPixelMap(3) while investigating a bug report by Theo Buehler <theo at math dot ethz dot ch>.
Revision 1.107 / (download) - annotate - [select for diffs], Sat Oct 25 14:32:07 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.106: +7 -18 lines
Diff to previous 1.106 (colored) to selected 1.177 (colored)
Report arguments to .EQ as an error, and simplify the code: * drop trivial wrapper function roff_openeqn() * drop unused first arg of function eqn_alloc() * drop usused member "name" of struct eqn_node
Revision 1.106 / (download) - annotate - [select for diffs], Mon Oct 20 19:21:31 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.105: +25 -14 lines
Diff to previous 1.105 (colored) to selected 1.177 (colored)
protect the roff parser from dividing by zero; issue found and patch written by kristaps@
Revision 1.105 / (download) - annotate - [select for diffs], Mon Oct 20 15:04:37 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.104: +37 -6 lines
Diff to previous 1.104 (colored) to selected 1.177 (colored)
correctly parse spacing around in-line equations at the beginning and at the end of input lines; issue reported by kristaps@
Revision 1.104 / (download) - annotate - [select for diffs], Mon Oct 20 02:31:44 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.103: +4 -12 lines
Diff to previous 1.103 (colored) to selected 1.177 (colored)
correct spacing before inline equations
Revision 1.103 / (download) - annotate - [select for diffs], Thu Oct 16 01:27:48 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +3 -3 lines
Diff to previous 1.102 (colored) to selected 1.177 (colored)
oops, don't escape the first token of inline equations
Revision 1.102 / (download) - annotate - [select for diffs], Thu Oct 16 01:10:06 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +59 -12 lines
Diff to previous 1.101 (colored) to selected 1.177 (colored)
Implement in-line equations, much needed by Xenocara manuals. Put the steering into the roff parser rather than into the mdoc parser such that it works for all macro languages and on both text and macro lines. Line breaks and blank characters generated before and after in-line equations are not perfect yet, but let's do one thing at a time.
Revision 1.101 / (download) - annotate - [select for diffs], Sun Sep 7 00:21:23 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +3 -1 lines
Diff to previous 1.100 (colored) to selected 1.177 (colored)
Parse and ignore the .pl (page length) request; Daniel Levai reports that Slackware Linux uses this.
Revision 1.100 / (download) - annotate - [select for diffs], Sat Sep 6 23:24:27 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +10 -1 lines
Diff to previous 1.99 (colored) to selected 1.177 (colored)
Simplify by handling empty request lines at the one logical place in the roff parser instead of in three other places in other parsers. No functional change.
Revision 1.99 / (download) - annotate - [select for diffs], Sat Sep 6 22:38:35 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +21 -3 lines
Diff to previous 1.98 (colored) to selected 1.177 (colored)
Move main format autodetection from the parser dispatcher to the roff parser where .Dd and .TH are already detected, anyway. This improves robustness because it correctly handles whitespace or an alternate control character before Dd. In the parser dispatcher, provide a fallback looking ahead in the input buffer instead of always assuming man(7). This corrects autodetection when Dd is preceded by other macros or macro-like handled requests like .ll. Triggered by reports from Daniel Levai about issues on Slackware Linux.
Revision 1.98 / (download) - annotate - [select for diffs], Tue Aug 19 05:18:16 2014 UTC (9 years, 9 months ago) by daniel
Branch: MAIN
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored) to selected 1.177 (colored)
libroff depends on libmandoc and so libmandoc should be included first. this change makes the code slightly more portable by removing a gcc extension (incomplete enum types) which is not part of ISO C. ok schwarze@
Revision 1.97 / (download) - annotate - [select for diffs], Fri Aug 8 15:54:10 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +4 -3 lines
Diff to previous 1.96 (colored) to selected 1.177 (colored)
mention requests and macros in more messages
Revision 1.96 / (download) - annotate - [select for diffs], Fri Aug 8 15:48:43 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +18 -17 lines
Diff to previous 1.95 (colored) to selected 1.177 (colored)
Dynamically allocate the stack of roff(7) .ie condition values and thus get rid of the last useless fatal error.
Revision 1.95 / (download) - annotate - [select for diffs], Fri Aug 8 15:15:27 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.94: +2 -2 lines
Diff to previous 1.94 (colored) to selected 1.177 (colored)
better name and wording for the last two non-generic errors
Revision 1.94 / (download) - annotate - [select for diffs], Mon Jul 7 21:35:42 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE,
OPENBSD_5_6
Changes since 1.93: +25 -16 lines
Diff to previous 1.93 (colored) to selected 1.177 (colored)
Clean up ERROR messages related to document structure and macros: Hierarchical naming and mention macro names in messages.
Revision 1.93 / (download) - annotate - [select for diffs], Mon Jul 7 11:34:41 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +56 -34 lines
Diff to previous 1.92 (colored) to selected 1.177 (colored)
implement .dei and .ami
Revision 1.92 / (download) - annotate - [select for diffs], Sun Jul 6 19:08:56 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.91: +13 -13 lines
Diff to previous 1.91 (colored) to selected 1.177 (colored)
Clean up messages related to plain text and to escape sequences. * Mention invalid escape sequences and string names, and fallbacks. * Hierarchical naming.
Revision 1.91 / (download) - annotate - [select for diffs], Sun Jul 6 18:46:51 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +15 -8 lines
Diff to previous 1.90 (colored) to selected 1.177 (colored)
Fix expansion of escape sequences with incomplete arguments. * For \* and \n, discard the incomplete arg, expand to empty string. * For \B, discard the incomplete arg, expand to the digit 0. * For \w, use the incomplete arg (behaviour unchanged).
Revision 1.90 / (download) - annotate - [select for diffs], Fri Jul 4 16:11:41 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +5 -3 lines
Diff to previous 1.89 (colored) to selected 1.177 (colored)
Clean up messages regarding excess arguments: * Downgrade ".Bf -emphasis Em" from FATAL to WARNING. * Mention the macros, the arguments, and the fallbacks. * Hierarchical naming. Also fix the handling of excess .It head arguments in -Tman.
Revision 1.89 / (download) - annotate - [select for diffs], Thu Jul 3 21:23:08 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +5 -3 lines
Diff to previous 1.88 (colored) to selected 1.177 (colored)
MANDOCERR_NOARGS reported three completely unrelated classes of problems. Split the roff(7) parts out of it and report the request names for these cases.
Revision 1.88 / (download) - annotate - [select for diffs], Tue Jul 1 00:32:02 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +4 -2 lines
Diff to previous 1.87 (colored) to selected 1.177 (colored)
The previous commit to this file broke the control flow keywords \{ and \} when they immediately follow a request or macro name, without intervening whitespace. Minimal fix. The lesson learnt here is that, despite their appearance, \{ and \} are not escape sequences, so never skip them when parsing for names.
Revision 1.87 / (download) - annotate - [select for diffs], Sun Jun 29 23:23:16 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +16 -17 lines
Diff to previous 1.86 (colored) to selected 1.177 (colored)
Use the freshly improved roff_getname() function for the main roff request parsing routine, roff_parse(). In request or macro invocations, escape sequences now terminate the request or macro name; what follows is treated as arguments. Besides, the names of user-defined macros can now contain backslashes (eek!).
Revision 1.86 / (download) - annotate - [select for diffs], Sun Jun 29 22:38:41 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +19 -39 lines
Diff to previous 1.85 (colored) to selected 1.177 (colored)
Use the freshly improved roff_getname() function for the .de parsing routine, roff_block(), to correctly handle names terminated by escape sequences. Besides, this saves us 20 lines of code.
Revision 1.85 / (download) - annotate - [select for diffs], Sun Jun 29 22:12:54 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.84: +52 -36 lines
Diff to previous 1.84 (colored) to selected 1.177 (colored)
Major roff_getname() cleanup. * Return the name even if it is terminated by an escape sequence, not a blank. * Skip the full escape sequence using mandoc_escape(), not just the first byte. * Make it non-destructive, return the length instead of writing a '\0'. * Let .ds and .as cope with the above changes to the internal interface. * Fix .rm and .rr to accept an escape sequence as the end of a name. * Fix .nr and .rr to not set/delete a register with an empty name.
Revision 1.84 / (download) - annotate - [select for diffs], Sun Jun 29 21:19:34 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +3 -2 lines
Diff to previous 1.83 (colored) to selected 1.177 (colored)
Bugfix in roff_setstrn(): Do not call strcmp() on an array of char that might not be NUL-terminated.
Revision 1.83 / (download) - annotate - [select for diffs], Wed Jun 25 00:19:17 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +5 -4 lines
Diff to previous 1.82 (colored) to selected 1.177 (colored)
Improve messages related to the roff(7) .so request. In all these messages, show the filename argument that was passed to the .so request. In case of failure, show an additional message reporting the file and the line number where the failing request was found. The existing message reporting the reason for the failure - for example, "Permission denied" - is left in place, unchanged. Inspired by a question asked by Nick@ after he saw the confusing old messages that used to be emitted in this area.
Revision 1.82 / (download) - annotate - [select for diffs], Wed Apr 23 16:07:06 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.81: +10 -20 lines
Diff to previous 1.81 (colored) to selected 1.177 (colored)
Audit strlcpy(3)/strlcat(3) usage. * Repair three instances of silent truncation, use asprintf(3). * Change two instances of strlen(3)+malloc(3)+strlcpy(3)+strlcat(3)+... to use asprintf(3) instead to make them less error prone. * Cast the return value of four instances where the destination buffer is known to be large enough to (void). * Completely remove three useless instances of strlcpy(3)/strlcat(3). * Mark two places in -Thtml with XXX that can cause information loss and crashes but are not easy to fix, requiring design changes of some internal interfaces. * The file mandocdb.c remains to be audited.
Revision 1.81 / (download) - annotate - [select for diffs], Sun Apr 20 19:39:35 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.80: +4 -4 lines
Diff to previous 1.80 (colored) to selected 1.177 (colored)
make sure static buffers for snprintf(3) are large enough and cast snprintf return value to (void) where they are
Revision 1.80 / (download) - annotate - [select for diffs], Sun Apr 20 16:44:44 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.79: +121 -163 lines
Diff to previous 1.79 (colored) to selected 1.177 (colored)
KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */, remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
Revision 1.79 / (download) - annotate - [select for diffs], Tue Apr 8 01:36:50 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +71 -28 lines
Diff to previous 1.78 (colored) to selected 1.177 (colored)
Fully implement the \B (validate numerical expression) and partially implement the \w (measure text width) escape sequence in a way that makes them usable in numerical expressions and in conditional requests, similar to how \n (interpolate number register) and \* (expand user-defined string) are implemented. This lets mandoc(1) handle the baroque low-level roff code found at the beginning of the ggrep(1) manual. Thanks to pascal@ for the report.
Revision 1.78 / (download) - annotate - [select for diffs], Mon Apr 7 21:00:00 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +45 -37 lines
Diff to previous 1.77 (colored) to selected 1.177 (colored)
We already supported (outer) user-defined strings containing references to other (inner) user-defined strings in their values, such that the inner ones get expanded at expansion time of the outer ones (delayed evaluation). Now we also support specifying the name of an (outer) user-defined string to expand using the expanded values of some other (inner) user-defined strings (indirect reference).
Revision 1.77 / (download) - annotate - [select for diffs], Mon Apr 7 15:05:12 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.76: +208 -58 lines
Diff to previous 1.76 (colored) to selected 1.177 (colored)
Almost complete implementation of roff(7) numerical expressions. Support all binary operators except ';' (scale conversion). Fully support chained operations and nested parentheses. Use this for the .nr, .if, and .ie requests. While here, fix parsing of integer numbers in roff_getnum().
Revision 1.76 / (download) - annotate - [select for diffs], Sat Apr 5 20:33:38 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +29 -1 lines
Diff to previous 1.75 (colored) to selected 1.177 (colored)
Implement the roff(7) .rr (remove register) request. As reported by sthen@, the perl-5.18 pod2man(1) preamble thinks cool kids use that in manuals. I hope *you* know better.
Revision 1.75 / (download) - annotate - [select for diffs], Fri Mar 21 22:52:21 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +2 -6 lines
Diff to previous 1.74 (colored) to selected 1.177 (colored)
avoid repetitive code for asprintf error handling
Revision 1.74 / (download) - annotate - [select for diffs], Fri Mar 21 22:17:01 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +2 -1 lines
Diff to previous 1.73 (colored) to selected 1.177 (colored)
The files mandoc.c and mandoc.h contained both specialised low-level 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.
Revision 1.73 / (download) - annotate - [select for diffs], Thu Mar 20 02:57:13 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +17 -15 lines
Diff to previous 1.72 (colored) to selected 1.177 (colored)
Remove currently unimplemented macros from the lists of used-defined macros to be cleared during .Dd and .TH because clearing them at that point defeats the purpose of backup implementations provided in the manual page itself, some of which _do_ work with mandoc(1). While here, add the new .%C macro to the list to be cleared.
Revision 1.72 / (download) - annotate - [select for diffs], Wed Mar 19 21:50:59 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +6 -8 lines
Diff to previous 1.71 (colored) to selected 1.177 (colored)
Generalize the mparse_alloc() and roff_alloc() functions by giving them an "options" argument, replacing the existing "inttype" and "quick" arguments, preparing for a future MPARSE_SO option. Store this argument in struct mparse and struct roff, replacing the existing "inttype", "parsetype", and "quick" members. No functional change except one tiny cosmetic fix in roff_TH().
Revision 1.71 / (download) - annotate - [select for diffs], Sat Mar 8 04:43:39 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +87 -56 lines
Diff to previous 1.70 (colored) to selected 1.177 (colored)
Improve .if/.ie condition handling. * Support string comparisons. * Support negation not only for numerical, but for all conditions. * Switch the `o' condition from false to true. * Handle the `c', `d', and `r' conditions as false for now. * Use int for boolean data instead of rolling our own "enum roffrule"; needed such that we can use the standard ! and == operators. Havard Eidnes reported via the NetBSD bug tracking system that some Tcl*(3) manuals need this, and Thomas Klausner <wiz at NetBSD> forwarded the report to me. This doesn't make the crazy Tcl*(3) macrology maze happy yet, but brings us a bit closer.
Revision 1.70 / (download) - annotate - [select for diffs], Fri Mar 7 18:37:32 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.69: +13 -12 lines
Diff to previous 1.69 (colored) to selected 1.177 (colored)
In roff_cond_sub(), make sure that the incorrect input sequence `\\}', when found on a macro line, does not close a conditional block. The companion function roff_cond_text() already did this correctly, but make the code more readable without functional change. While here, report the correct column number in related error messages.
Revision 1.69 / (download) - annotate - [select for diffs], Fri Mar 7 17:57:28 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +11 -15 lines
Diff to previous 1.68 (colored) to selected 1.177 (colored)
Even on macro lines, \} must not cause whitespace.
Revision 1.68 / (download) - annotate - [select for diffs], Fri Mar 7 02:21:55 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +13 -26 lines
Diff to previous 1.67 (colored) to selected 1.177 (colored)
Three bugfixes related to the closing of conditional blocks: 1. Handle more than one `\}' on macro lines, as it was already done for text lines. 2. Do not treat `\}' as a macro invocation after a dot at the beginning of a line. That allows more than one `\}' to work on lines starting with `.\}'. It also simplifies the code. 3. Do not complain about characters following `\}'. Those are not lost, but handled normally both on text and macro lines.
Revision 1.67 / (download) - annotate - [select for diffs], Fri Feb 14 23:24:17 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE,
OPENBSD_5_5
Changes since 1.66: +3 -1 lines
Diff to previous 1.66 (colored) to selected 1.177 (colored)
Parse and ignore the roff(7) .ce request (center some lines). We even parse and ignore the .ad request (adjustment mode), and it doesn't make sense to more prominently warn about temporary than about permanent adjustment changes. Request found by naddy@ in xloadimage(1) and by juanfra@ in racket(1).
Revision 1.66 / (download) - annotate - [select for diffs], Fri Feb 14 23:05:08 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +16 -14 lines
Diff to previous 1.65 (colored) to selected 1.177 (colored)
Implement the roff(7) .as request (append to user-defined string). Missing feature found by jca@ in ratpoison(1). The ratpoison(1) manual still doesn't work because it uses .shift and .while, too (apparently, ratpoison is so complex that it needs a Turing-complete language to even format its manual :-). Written at Christchurch International Airport.
Revision 1.65 / (download) - annotate - [select for diffs], Fri Feb 14 22:27:32 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +44 -1 lines
Diff to previous 1.64 (colored) to selected 1.177 (colored)
Handle some predefined read-only number registers, e.g. .H and .V. In particular, this improves handling of the pod2man(1) preamble; for examples of the effect, see some author names in perlthrtut(1). Missing feature reported by Andreas Voegele <mail at andreasvoegele dot com> more than two years ago. Written at Christchurch International Airport.
Revision 1.64 / (download) - annotate - [select for diffs], Mon Jan 6 23:46:01 2014 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +7 -10 lines
Diff to previous 1.63 (colored) to selected 1.177 (colored)
Gprof(1) is fun. You should use it more often. Another 10% speedup for mandocdb(8) -Q, and even 3% without -Q. With -Q, we are now at 41% of the time required by makewhatis(8). Do not copy predefined strings into the dynamic string table, just leave them in their own static table and use that one as a fallback at lookup time. This saves us copying and deleting them for each manual. No functional change.
Revision 1.63 / (download) - annotate - [select for diffs], Mon Jan 6 21:33:00 2014 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +7 -5 lines
Diff to previous 1.62 (colored) to selected 1.177 (colored)
Another 25% speedup for mandocdb(8) -Q mode, found with gprof(1). For /usr/share/man, we only need 56% of the time of makewhatis(8) now. In groff, user-defined macros clashing with mdoc(7) or man(7) standard macros are cleared when parsing the .Dd or .TH macro, respectively. Of course, we continue doing that in standard mode to assure full groff bug compatibility. However, in -Q mode, full groff bug compatibility makes no sense when it's unreasonably expensive, so skip this step in -Q mode. Real-world manuals hardly ever redefine standard macros, that's terrible style, and if they do, it's pointless to do so before .Dd or .TH because it has no effect. Even if someone does, it's extremely unlikely to break mandocdb(8) -Q parsing because we abort the parse sequence after the NAME section, anyway. So if you manually redefine .Sh, .Nm, .Nd, or .SH in a way that doesn't work at all and rely on .Dd or .TH to fix it up for you, your broken manual will no longer get a perfect apropos(1) entry until you re-run mandocdb(8) without -Q. It think that consequence is acceptable in order to get a 25% speedup for everyone else.
Revision 1.62 / (download) - annotate - [select for diffs], Mon Dec 30 18:42:55 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +2 -3 lines
Diff to previous 1.61 (colored) to selected 1.177 (colored)
Oops, missed one: Remove duplicate const specifier from a call to mandoc_escape(). Found by Thomas Klausner <wiz at NetBSD dot org> using clang. No functional change.
Revision 1.61 / (download) - annotate - [select for diffs], Wed Dec 25 00:50:03 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored) to selected 1.177 (colored)
s/[Nn]ull/NUL/ in comments where appropriate; suggested by Thomas Klausner <wiz @ NetBSD dot org>.
Revision 1.60 / (download) - annotate - [select for diffs], Sun Dec 15 21:18:00 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +18 -5 lines
Diff to previous 1.59 (colored) to selected 1.177 (colored)
The "value" argument to the roff(7) .nr requests ends right before the first non-digit character. While here, implement and document an optional sign, requesting increment or decrement, as documented in the Ossanna/Kernighan/Ritter troff manual and supported by groff. Reported by bentley@ on discuss at mdocml.
Revision 1.59 / (download) - annotate - [select for diffs], Tue Oct 22 20:37:54 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +3 -1 lines
Diff to previous 1.58 (colored) to selected 1.177 (colored)
Parse and ignore .hw (hyphenation points in words); this is safe because we don't do hyphenation anyway, so there is no point in throwing an ERROR when encountering .hw. Real-world usage of the request found by naddy@ in sysutils/dwdiff(1).
Revision 1.58 / (download) - annotate - [select for diffs], Mon Oct 14 01:42:26 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +3 -1 lines
Diff to previous 1.57 (colored) to selected 1.177 (colored)
Parse and ignore the .fam (font family) request. Fixes irunner(1) in devel/ipython and uim-xim(1) in inputmethods/uim. Thanks to naddy@ for bringing these to my attention.
Revision 1.57 / (download) - annotate - [select for diffs], Sat Oct 5 21:17:29 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +2 -2 lines
Diff to previous 1.56 (colored) to selected 1.177 (colored)
Cleanup suggested by gcc-4.8.1, following hints by Christos Zoulas: - avoid bad qualifier casting in roff.c, roff_parsetext() by changing the mandoc_escape arguments to "const char const **" - avoid bad qualifier casting in mandocdb.c, index_merge() - garbage collect a few unused variables elsewhere
Revision 1.56 / (download) - annotate - [select for diffs], Fri Oct 4 02:01:58 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +92 -4 lines
Diff to previous 1.55 (colored) to selected 1.177 (colored)
Support simple numerical conditions. Original code from Christos Zoulas, NetBSD rev. 1.11-1.13, April 3, 2013. I tweaked the code as follows: * In roff_getnum(), don't skip a minus that isn't followed by a digit. * In roff_getop(), do not handle "!=", groff doesn't support it either. * In roff_evalcond(), treat negative numbers as false, like groff. Besides, make the interfaces of roff_getnum() and roff_getop() more similar to each other and simplify parts of the code a bit.
Revision 1.55 / (download) - annotate - [select for diffs], Thu Oct 3 22:56:18 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.54: +3 -3 lines
Diff to previous 1.54 (colored) to selected 1.177 (colored)
ROFFRULE_ALLOW = 0, ROFFRULE_DENY = 1 was confusing, so exchange the two entries in enum roffrule; no functional change. From Christos Zoulas, NetBSD rev. 1.11, April 4, 2013.
Revision 1.54 / (download) - annotate - [select for diffs], Thu Oct 3 22:50:02 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +6 -11 lines
Diff to previous 1.53 (colored) to selected 1.177 (colored)
Avoid code duplication in roff_parseln() as suggested by Christos Zoulas in NetBSD rev. 1.11; i'm even going a step further and making this yet a bit shorter. No functional change.
Revision 1.53 / (download) - annotate - [select for diffs], Thu Oct 3 22:04:08 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +53 -32 lines
Diff to previous 1.52 (colored) to selected 1.177 (colored)
Expand references to number registers in exactly the same way as references to user-defined strings. While here, make number registers signed int, like in groff. Inspired by NetBSD roff.c rev. 1.8 and read.c rev. 1.7 written by Christos Zoulas on March 21, 2013, but implemented in a completely different way, without hacking into read.c, where this functionality really doesn't belong.
Revision 1.52 / (download) - annotate - [select for diffs], Thu Oct 3 19:32:25 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +57 -28 lines
Diff to previous 1.51 (colored) to selected 1.177 (colored)
Support setting arbitrary roff(7) number registers, preserving read support for the ".nr nS" SYNOPSIS state register; read support for arbitrary registers is still not available. Inspired by NetBSD roff.c rev. 1.18 (Christos Zoulas, March 21, 2013), but implemented differently. I don't want to have yet another different implementation of a hash table in mandoc - it would be the second one in roff.c alone and the fifth one in mandoc grand total. Instead, i designed and implemented roff_setreg() and roff_getreg() to be similar to roff_setstrn() and roff_getstrn(). Once we feel the need to optimize, we can introduce one common hash table implementation for everything in mandoc.
Revision 1.51 / (download) - annotate - [select for diffs], Sat Jul 13 12:51:38 2013 UTC (10 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE,
OPENBSD_5_4
Changes since 1.50: +58 -11 lines
Diff to previous 1.50 (colored) to selected 1.177 (colored)
Rudimentary implementation of the .it request (input line trap). As with any low-level roff request involving subtle interactions with macro internals, this implementation is not exact, but it does handle the simplest cases. This request occurs in man(7) code generated from DocBook, for example mysql(1) and yasm_arch(7). Thanks to brad@ for reporting the issue back in January 2011.
Revision 1.50 / (download) - annotate - [select for diffs], Thu Jun 27 09:48:22 2013 UTC (10 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +32 -44 lines
Diff to previous 1.49 (colored) to selected 1.177 (colored)
Parse for the closing delimiter `\}' for conditionals even when the conditional evaluated to false. While here, reshuffle the code to reduce indentation and make it more readable; that way, we can even trim down the comments because it becomes obvious what the code does. Found in zipinfo(1) - thanks to espie@ and naddy@ for making me look at that manual page.
Revision 1.49 / (download) - annotate - [select for diffs], Fri May 31 22:08:03 2013 UTC (11 years ago) by schwarze
Branch: MAIN
Changes since 1.48: +10 -10 lines
Diff to previous 1.48 (colored) to selected 1.177 (colored)
More cleanup: Consistently use the name "struct tbl_node *tbl" that is already used almost everywhere instead of gratuitiously inventing different names at four places. No functional change.
Revision 1.48 / (download) - annotate - [select for diffs], Sat Jul 7 18:27:36 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE,
OPENBSD_5_3,
OPENBSD_5_2_BASE,
OPENBSD_5_2
Changes since 1.47: +60 -3 lines
Diff to previous 1.47 (colored) to selected 1.177 (colored)
Support the .cc request; code by kristaps@, tests by me. Needed for sqlite3(1) as reported by espie@.
Revision 1.47 / (download) - annotate - [select for diffs], Sat Jun 2 23:18:30 2012 UTC (12 years ago) by schwarze
Branch: MAIN
Changes since 1.46: +67 -2 lines
Diff to previous 1.46 (colored) to selected 1.177 (colored)
In groff, trying to redefine standard man(7) macros before .TH has no effect; after .TH, it works. Trying to redefine standard mdoc(7) macros before .Dd works when calling groff with the -mdoc command line option, but does not when calling groff with -mandoc; after .Dd, it always works. Arguably, one might call that buggy behaviour in groff, but it is very unlikely that anybody will change groff in this respect (certainly, i'm not volunteering). So let's be bug-compatible. This fixes the vertical spacing in sox(1).
Revision 1.46 / (download) - annotate - [select for diffs], Thu May 31 01:36:56 2012 UTC (12 years ago) by schwarze
Branch: MAIN
Changes since 1.45: +25 -34 lines
Diff to previous 1.45 (colored) to selected 1.177 (colored)
Fix blank line handling in .if. In particular, two cases were wrong: - single-line .if with trailing whitespace gave no blank line - multiline .if with \{ but without \{\ gave no blank line While here, simplify roff_cond() by partially reordering the code.
Revision 1.45 / (download) - annotate - [select for diffs], Mon Oct 24 21:38:56 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE,
OPENBSD_5_1
Changes since 1.44: +13 -9 lines
Diff to previous 1.44 (colored) to selected 1.177 (colored)
Handle infinite recursion the same way as groff: When string expansion exceeds the recursion limit, drop the whole input line, instead of leaving just the string unexpanded. This fixes src/regress/usr.bin/mandoc/roff/string/infinite.in. ok kristaps@
Revision 1.44 / (download) - annotate - [select for diffs], Mon Sep 19 07:53:54 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +3 -10 lines
Diff to previous 1.43 (colored) to selected 1.177 (colored)
Breaking the line at a hyphen is only allowed if the hyphen is both preceded and followed by an alphabetic character. This fixes about a dozen places in base.
Revision 1.43 / (download) - annotate - [select for diffs], Sun Sep 18 23:26:18 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.42: +14 -3 lines
Diff to previous 1.42 (colored) to selected 1.177 (colored)
Fix another regression introduced in 1.11.7: If a string is defined in terms of itself, the REPARSE_LIMIT in read.c used to break the cycle. This no longer works since all the work is now done in the function roff_res(), looping indefinitely. Make this loop finite by arbitrarily limiting the number of times one string may be expanded; when that limit is reached, leave the remaining string references unexpanded. This changes behaviour compared to 1.11.5, where the whole line would have been dropped. The new behaviour is better because it loses less information. We don't want to imitate groff-1.20.1 behaviour anyway because groff aborts parsing of the whole file.
Revision 1.42 / (download) - annotate - [select for diffs], Sun Sep 18 15:54:48 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +345 -87 lines
Diff to previous 1.41 (colored) to selected 1.177 (colored)
sync to version 1.11.7 from kristaps@ main new feature: support the roff(7) .tr request plus various bugfixes and some refactoring regressions are so minor that it's better to get this in and fix them in the tree
Revision 1.41 / (download) - annotate - [select for diffs], Sun Sep 18 10:25:28 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +77 -26 lines
Diff to previous 1.40 (colored) to selected 1.177 (colored)
sync to version 1.11.5: adding an implementation of the eqn(7) language by kristaps@ So far, only .EQ/.EN blocks are handled, in-line equations are not, and rendering is not yet very pretty, but the parser is fairly complete.
Revision 1.40 / (download) - annotate - [select for diffs], Sun Jul 31 14:11:48 2011 UTC (12 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE,
OPENBSD_5_0
Changes since 1.39: +7 -1 lines
Diff to previous 1.39 (colored) to selected 1.177 (colored)
Workaround to prevent misrendering of \*(-- as "O-" in pod2man(1)- generated manuals; this fixes more than 500 manuals in base alone. As a real fix, .tr will be supported after unlock. OK kristaps@ to put in the workaround for now
Revision 1.39 / (download) - annotate - [select for diffs], Thu Jul 7 20:07:38 2011 UTC (12 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +26 -4 lines
Diff to previous 1.38 (colored) to selected 1.177 (colored)
Fix a bogus "unknown macro" error reported in the pod2man(1) preamble: - Actually let roff_parse() recognize ".\}" as a cond block end request. - Do not rewrite "\}" to the zero-width space "\&" because that prevents recognition of immediately preceding macros; use normal blanks instead. - To avoid a vertical spacing regression in pod2man(1) manuals, drop one vertical spacing request just before NAME. From kristaps@.
Revision 1.38 / (download) - annotate - [select for diffs], Tue Jul 5 04:12:41 2011 UTC (12 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +5 -1 lines
Diff to previous 1.37 (colored) to selected 1.177 (colored)
Sync to bsd.lv (all coded by kristaps@): - mdoc(7): fix an assertion if the first line after .Bd -column starts with a blank, and some simplifications in mdoc_argv.c - man(7): literal mode ends at .SH and .SS (bug reported by naddy@) - allow .RS/.RE blocks to nest (bug reported by dcoppa@ and gsoares@) - improve vertical spacing of man(7) blocks - roff(7): clear user-defined strings when starting a new file - correct ID tags in -T[x]html
Revision 1.37 / (download) - annotate - [select for diffs], Sun May 29 21:22:18 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.36: +61 -63 lines
Diff to previous 1.36 (colored) to selected 1.177 (colored)
Merge release 1.11.3, almost all code by kristaps@: * Unicode output support (no Unicode input yet, though). * Refactoring: completely handle predefined strings in roff.c. - New function mandoc_escape() replaces a2roffdeco() and mandoc_special(). - Start using mandoc_getarg() in mdoc_argv.c. - Clean up parsing of delimiters in mdoc(7). * And many minor fixes and lots of cleanup.
Revision 1.36 / (download) - annotate - [select for diffs], Sun Apr 24 16:28:48 2011 UTC (13 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.35: +2 -3 lines
Diff to previous 1.35 (colored) to selected 1.177 (colored)
User defined macros may invoke high-level macros. The latter got lost due to a regression in bsd.lv rev. 1.130.
Revision 1.35 / (download) - annotate - [select for diffs], Sun Apr 24 16:22:02 2011 UTC (13 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.34: +73 -93 lines
Diff to previous 1.34 (colored) to selected 1.177 (colored)
Merge version 1.11.1: Again lots of cleanup and maintenance work by kristaps@. - simplify error reporting: less function pointers, more mandoc_[v]msg - main: split document parsing out of main.c into read.c - roff, mdoc, man: improved recognition of control characters - roff: better handling of if/else stack overflows - roff: add some predefined strings for backward compatibility - mdoc, man: empty sections are not errors - mdoc: move delimiter handling to libmdoc - some header restructuring and some minor features and fixes This merge causes two minor regressions that i will fix in separate commits right afterwards.
Revision 1.34 / (download) - annotate - [select for diffs], Thu Apr 21 22:59:54 2011 UTC (13 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.33: +5 -5 lines
Diff to previous 1.33 (colored) to selected 1.177 (colored)
Merge version 1.10.10: lots of cleanup and maintenance work by kristaps@. - move some main.c globals into struct curparse - move mandoc_*alloc to mandoc.h such that all code can use them - make mandoc_isdelim available to formatting frontends - dissolve mdoc_strings.c, move the code where it is used - make all error reporting functions void, their return values were useless - and various minor cleanups and fixes
Revision 1.33 / (download) - annotate - [select for diffs], Tue Apr 5 22:19:11 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +4 -6 lines
Diff to previous 1.32 (colored) to selected 1.177 (colored)
On .de macro lines, after the new macro name, space and tab are equivalent. Bug reported by Tristan dot LeGuern at gmail dot com in fvwm(1). tweaks and ok kristaps@; earlier version looked good to espie@ as well
Revision 1.32 / (download) - annotate - [select for diffs], Sun Mar 20 23:36:42 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +73 -10 lines
Diff to previous 1.31 (colored) to selected 1.177 (colored)
Import the foundation for eqn(7) support. Written by kristaps@. For now, i'm adding one line to each of the four frontends to just pass the input text through to the output, not yet interpreting any of then eqn keywords.
Revision 1.31 / (download) - annotate - [select for diffs], Tue Jan 25 00:23:23 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE,
OPENBSD_4_9
Changes since 1.30: +7 -1 lines
Diff to previous 1.30 (colored) to selected 1.177 (colored)
Ignore .ns (no-space mode), .ps (change point size), .ta (tab control) for now. All of these just cause a bit too much or too little whitespace, but no serious formatting problems.
Revision 1.30 / (download) - annotate - [select for diffs], Thu Jan 20 21:33:11 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +6 -1 lines
Diff to previous 1.29 (colored) to selected 1.177 (colored)
When finding the roff .it request (line trap), make it clear that you cannot use mandoc to format that page (yet). Triggered by a report from brad@.
Revision 1.29 / (download) - annotate - [select for diffs], Wed Jan 12 20:56:40 2011 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +19 -12 lines
Diff to previous 1.28 (colored) to selected 1.177 (colored)
Implement the roff .rm request (remove macro). Using the new roff_getname() function, this is really simple. Breaks mandoc of the habit of reporting an error in each pod2man(1) preamble. Reminded by a report from brad@.
Revision 1.28 / (download) - annotate - [select for diffs], Mon Jan 10 23:53:32 2011 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.27: +45 -38 lines
Diff to previous 1.27 (colored) to selected 1.177 (colored)
Refactoring in preparation for .rm support: Unify parsing of names given as roff request arguments into a new function roff_getname(), which is rather different from the parsing function for normal arguments, mandoc_getarg(), because names cannot be quoted and cannot contain whitespace or escaped characters. The new function now throws an ERROR when finding escaped characters in a name. "I'm fine with this." kristaps@
Revision 1.27 / (download) - annotate - [select for diffs], Tue Jan 4 22:28:17 2011 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +110 -30 lines
Diff to previous 1.26 (colored) to selected 1.177 (colored)
Merge kristaps@' cleaner tbl integration, removing mine; there are still a few bugs, but fixing these will be easier in tree.
Revision 1.26 / (download) - annotate - [select for diffs], Mon Jan 3 23:19:33 2011 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored) to selected 1.177 (colored)
Calling a macro with fewer arguments than it is defined with is OK; the remaining ones default to the empty string, not to NULL. Regression reported and fix tested by kristaps@.
Revision 1.25 / (download) - annotate - [select for diffs], Mon Jan 3 22:27:21 2011 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.24: +6 -43 lines
Diff to previous 1.24 (colored) to selected 1.177 (colored)
Unify roff macro argument parsing (in roff.c, roff_userdef()) and man macro argument parsing (in man_argv.c, man_args()), both having different bugs, to use one common macro argument parser (in mandoc.c, mandoc_getarg()), because from the point of view of roff, man macros are just roff macros, hence their arguments are parsed in exactly the same way. While doing so, fix these bugs: * Escaped blanks (i.e. those preceded by an odd number of backslashes) were mishandled as argument separators in unquoted arguments to user-defined roff macros. * Unescaped blanks preceded by an even number of backslashes were not recognized as argument separators in unquoted arguments to man macros. * Escaped backslashes (i.e. pairs of backslashes) were not reduced to single backslashes both in unquoted and quoted arguments both to user-defined roff macros and to man macros. * Escaped quotes (i.e. pairs of quotes inside quoted arguments) were not reduced to single quotes in man macros. OK kristaps@ Note that mdoc macro argument parsing is yet another beast for no good reason and is probably afflicted by similar bugs. But i don't attempt to fix that right now because it is intricately entangled with lots of unrelated high-level mdoc(7) functionality, like delimiter handling and column list phrase handling. Disentagling that would waste too much time now.
Revision 1.24 / (download) - annotate - [select for diffs], Tue Dec 21 01:30:58 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +11 -14 lines
Diff to previous 1.23 (colored) to selected 1.177 (colored)
Kristaps questioned the efficiency of the algorithm used in roff.c r1.23. An indeed, this optimization (using suggestions by Joerg Sonnenberger) saves about 40% of the processing time needed for the roff_res() function when processing typical manuals. No functional change, and the new code is not harder to understand. ok kristaps@
Revision 1.23 / (download) - annotate - [select for diffs], Thu Dec 9 20:56:30 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.22: +46 -11 lines
Diff to previous 1.22 (colored) to selected 1.177 (colored)
Roff only interpolates \* strings when the leading backslash is not escaped. Kristaps@ agrees with the idea, even though he didn't review the final patch.
Revision 1.22 / (download) - annotate - [select for diffs], Tue Dec 7 00:08:52 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +24 -12 lines
Diff to previous 1.21 (colored) to selected 1.177 (colored)
Complete the merge of bsd.lv version 1.10.7: No more functional changes, just sync ordering, comments and white space.
Revision 1.21 / (download) - annotate - [select for diffs], Sun Nov 28 19:35:33 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +23 -9 lines
Diff to previous 1.20 (colored) to selected 1.177 (colored)
To avoid FATAL errors, we have been parsing and ignoring the roff requests .am, .ami, .am1, .dei, and .rm for a long time. Since ignoring them can (rarely) cause information loss and serious misformatting, throw an ERROR: NOT IMPLEMENTED when finding them. Implementing them would not be too difficult, but they are so rare in practice that i can find better use for my time right now. In this context, - Put the string "NOT IMPLEMENTED" into two other error messages as well, to distinguish them from those caused by broken input. - Print the string "unknown macro" once, not twice in the error message associated with MANDOCERR_MACRO, and begin printing the buffer at the point where the unknown macro really is, not at the start of line.
Revision 1.20 / (download) - annotate - [select for diffs], Sun Nov 28 01:00:40 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +9 -1 lines
Diff to previous 1.19 (colored) to selected 1.177 (colored)
Parse and ignore the .ad, .hy, .nh, and .ne roff requests. Ignoring these can neither cause information loss nor serious formatting issues. As they are frequently used by pod2man(1), this considerably reduces ERROR noise from mandoc -Tlint for the Perl manuals.
Revision 1.19 / (download) - annotate - [select for diffs], Sat Nov 27 20:52:34 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored) to selected 1.177 (colored)
Two related bugfixes: 1) When using a user-defined string of length 0 as a macro, do not access memory before the start of the string (segfault). 2) When beginning to define a user-defined macro, initialize the string representing the macro to the empty string, not to the NULL pointer, such that, in case the macro turns out to not have any content, like in .de IX .. the macro will be defined and empty instead of undefined. This avoids large numbers of bogus mandoc ERROR messages about undefined macros (which are actually defined and empty), in particular in man(7) code generated from pod2man(1), for example in Perl and OpenSSL.
Revision 1.18 / (download) - annotate - [select for diffs], Thu Nov 25 23:07:58 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored) to selected 1.177 (colored)
Make .de1 a symnonym for .de, not .ig as it was before. The .de1 instructions is a GNU extension not found in traditional roff and not even in old groff, defined as "define a macro that will be executed with traditional roff compatibility mode switched off during macro execution". Since we ran into it in the wild, we have been parsing and ignoring it for a long time. Now that we have proper .de support, we can as well use the contents, even though we don't implement compatibility mode at all.
Revision 1.17 / (download) - annotate - [select for diffs], Thu Nov 25 22:41:51 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +34 -4 lines
Diff to previous 1.16 (colored) to selected 1.177 (colored)
Support quoting of arguments passed to user-defined macros, such that arguments can contain blank characters. Also support escaping of quote characters by doubling them. For example, the argument "a""b c." resolves to: a"b c.
Revision 1.16 / (download) - annotate - [select for diffs], Thu Nov 25 22:23:31 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +178 -69 lines
Diff to previous 1.15 (colored) to selected 1.177 (colored)
Implement the .de (define macro) roff instruction. This fixes various Xenocara manuals. Do not define your own macros in new manuals, though: this code exists purely to cope with existing and old stuff. Like in both traditional and GNU roff, the .de and .ds (define string) roff instructions share the same string table, so one can abuse strings as macros and vice versa. This implementation supports multi-line user-defined macros and user-defined macros taking up to 9 arguments. Project started near the end of p2k10, now mature for production, but there is still room for future improvements in various respects.
Revision 1.15 / (download) - annotate - [select for diffs], Tue Oct 26 23:34:38 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +3 -1 lines
Diff to previous 1.14 (colored) to selected 1.177 (colored)
Warn developers that .so is fragile and suggest using ln(1) instead; throwing a warning here was suggested by Joerg Sonnenberger.
Revision 1.14 / (download) - annotate - [select for diffs], Tue Oct 26 22:28:57 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.13: +23 -3 lines
Diff to previous 1.13 (colored) to selected 1.177 (colored)
Support .so (low-level roff "switch source file"), needed for Xenocara and various ports. Accept only relative paths and no ascension to the parent directory as suggested by Joerg Sonnenberger; code looked over by Joerg, too. Useful discussions with various people, among others espie@.
Revision 1.13 / (download) - annotate - [select for diffs], Mon Sep 27 21:25:28 2010 UTC (13 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.12: +4 -4 lines
Diff to previous 1.12 (colored) to selected 1.177 (colored)
Merge the last bits of 1.10.6 (released today), most were already in: * ignore double-.Pp * ignore .Pp before .Bd and .Bl (unless -compact in specified) * avoid double blank line upon .Pp, .br and friends in literal context * cast enums to int when passing them to exit(3) to please lint(1) While merging, fix a regression introduced by kristaps@: Outside literal mode, double blank lines must both be printed. To achieve this again after kristaps@ improvements in 1.10.6, treat such blank lines as .sp (instead of .Pp as in 1.10.5) and drop .Pp before .sp just like dropping .Pp before .Pp.
Revision 1.12 / (download) - annotate - [select for diffs], Mon Sep 13 22:04:01 2010 UTC (13 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +31 -6 lines
Diff to previous 1.11 (colored) to selected 1.177 (colored)
Parse and ignore the \k, \o, \w, and \z roff escapes, and recursively ignore embedded escapes and mathematical roff subexpressions. In roff copy mode, resolve "\\" to '\'. Allow ".xx\}" where xx is a macro to close roff conditional scope. Mandoc now handles the special character definitions in the pod2man(1) preamble, so remove the explicit redefinitions in chars.c/chars.in. From kristaps@. I have checked that this causes no relevant change to the Perl manuals. The only change introduced is that some non-ASCII characters rendered incorrectly before are now rendered incorrectly in a different way. For example, e accent aigu was "e", now is "e'" and c cedille was "c", now is "c,".
Revision 1.11 / (download) - annotate - [select for diffs], Fri Aug 20 00:53:35 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +9 -25 lines
Diff to previous 1.10 (colored) to selected 1.177 (colored)
Implement a simple, consistent user interface for error handling. We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
Revision 1.10 / (download) - annotate - [select for diffs], Sat Jul 31 21:43:07 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE,
OPENBSD_4_8
Changes since 1.9: +24 -14 lines
Diff to previous 1.9 (colored) to selected 1.177 (colored)
Merge bsd.lv version 1.10.5: last larger batch of bug fixes before release. NOT including Kristaps' .Bd -literal changes which cause regressions. Features: * -Tpdf now fully working Bugfixes: * proper handling of quoted strings by .ds in roff(7) * allow empty .Dd * make .Sm start no-spacing after the first output word * underline .Ad * minor fixes in -Thtml and some optimisations in terminal output.
Revision 1.9 / (download) - annotate - [select for diffs], Sun Jul 25 18:05:54 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.8: +6 -6 lines
Diff to previous 1.8 (colored) to selected 1.177 (colored)
Sync to bsd.lv; in particular, pull in lots of bug fixes. new features: * support the .in macro in man(7) * support minimal PDF output * support .Sm in mdoc(7) HTML output * support .Vb and .nf in man(7) HTML output * complete the mdoc(7) manual bug fixes: * do not let mdoc(7) .Pp produce a newline before/after .Sh; reported by jmc@ * avoid double blank lines related to man(7) .sp and .br * let man(7) .nf and .fi flush the line; reported by jsg@ and naddy@ * let "\ " produce a non-breaking space; reported by deraadt@ * discard \m colour escape sequences; reported by J.C. Roberts * map undefined 1-character-escapes to the literal character itself maintenance: * express mdoc(7) arguments in terms of an enum for additional type-safety * simplify mandoc_special() and a2roffdeco() * use strcspn in term_word() in place of a manual loop * minor optimisations in the -Tps and -Thtml formatting frontends
Revision 1.8 / (download) - annotate - [select for diffs], Tue Jul 13 01:09:13 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +126 -59 lines
Diff to previous 1.7 (colored) to selected 1.177 (colored)
Merge release 1.10.4 (all code by kristaps@), providing four new features: 1) Proper .Bk support: allow output line breaks at input line breaks, but keep input lines together in the output, finally fixing synopses like aucat(1), mail(1) and tmux(1). 2) Mostly finished -Tps (PostScript) output. 3) Implement -Thtml output for .Nm blocks and .Bk -words. 4) Allow iterative interpolation of user-defined roff(7) strings. Also contains some minor bugfixes and some performance improvements.
Revision 1.7 / (download) - annotate - [select for diffs], Sat Jul 3 15:59:05 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +115 -2 lines
Diff to previous 1.6 (colored) to selected 1.177 (colored)
Rudimentary implementation of user-defined strings; no time for more refinement right now. In particular, fixes terminfo(3) and mdoc.samples(7). ok kristaps@, who will add the HTML frontend bits
Revision 1.6 / (download) - annotate - [select for diffs], Sun Jun 27 21:54:42 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +78 -10 lines
Diff to previous 1.5 (colored) to selected 1.177 (colored)
Full .nr nS support, unbreaking the kernel manuals. Kristaps coded this from scratch after reading my .nr patch; it is simpler and more powerful. Registers live in struct regset in regs.h, struct man and struct mdoc contain pointers to it. The nS register is cleared when parsing .Sh. Frontends respect the MDOC_SYNPRETTY flag set in mdoc node_alloc.
Revision 1.5 / (download) - annotate - [select for diffs], Sat Jun 26 17:56:43 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.4: +66 -31 lines
Diff to previous 1.4 (colored) to selected 1.177 (colored)
merge release 1.10.2 * bug fixes: - interaction of ASCII_HYPH with special chars (found by Ulrich Spoerlein) - handling of roff conditionals (found by Ulrich Spoerlein) - .Bd -offset will no more default to 6n * maintenance: - more caching of .Bd and .Bl arguments for efficiency - deconstify man(7) validation routines - add FreeBSD library names (provided by Ulrich Spoerlein) * start PostScript font-switching
Revision 1.4 / (download) - annotate - [select for diffs], Sun Jun 6 20:30:08 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.3: +2 -4 lines
Diff to previous 1.3 (colored) to selected 1.177 (colored)
Merge bsd.lv version 1.10.1 (to be released soon). The main step forward is that this now has *much* better .Bl -column support, now supporting many manuals that previously errored out without producing any output. Other fixes include: * do not die from multiple list types, use the first and warn * in .Bl without a type, default to -item * various tweaks to .Dt * fix .In, .Fd, .Ft, .Fn and .Fo formatting * some documentation fixes and additions * and fix a couple of bugs reported by Ulrich Spoerlein: * better support for roff block-end "\}" without a preceding dot * .In must not break the line outside SYNOPSIS * spelling in some error messages While merging, fix one regression in .In spacing that needs to go to bsd.lv, too.
Revision 1.3 / (download) - annotate - [select for diffs], Sun Jun 6 18:08:41 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.2: +73 -23 lines
Diff to previous 1.2 (colored) to selected 1.177 (colored)
Merge bsd.lv release 1.10.0, which is mostly the post-hackathon release, bringing in the OpenBSD changes to bsd.lv, but which also has a few additional minor fixes: * .Lb is an in-line macro, not in_line_eoln * .Bt, .Ud now warn when discarding arguments * allow bad -man dates to flow verbatim into the front-ends - so far all reported by Ulrich Spoerlein * .Ar, .Fl and .Li starting with closing punctuation emit an empty element * empty .Li macros print nothing, but may cause spacing * proper EOS handling for .Bt, .Ex, .Rv, and .Ud. * cleanup: collapse posts_xr into posts_wtext (which is the same) * efficiency: very simple table lookup for roff.c
Revision 1.2 / (download) - annotate - [select for diffs], Thu May 20 00:58:02 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.1: +455 -96 lines
Diff to previous 1.1 (colored) to selected 1.177 (colored)
Support nested roff instructions: * allow roff_parseln() to be re-run * allow roff_parseln() to manipulate the line buffer offset * support the offset in the man and mdoc libraries * adapt .if, .ie, .el, .ig, .am* and .de* support * interpret some instructions even in conditional-negative context Coded by kristaps during the last day of the mandoc hackathon. To avoid regressions in the OpenBSD tree, commit this together with some small local additions: * detect roff block end "\}" even on macro lines * actually implement the ".if n" conditional * ignore .ds, .rm and .tr in libroff Also back my old .if/.ie/.el-handling out of libman, reverting: man.h 1.15 man.c 1.25 man_macro.c 1.15 man_validate.c 1.19 man_action.c 1.15 man_term.c 1.28 man_html.c 1.9.
Revision 1.1 / (download) - annotate - [select for diffs], Sun May 16 00:54:03 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Diff to selected 1.177 (colored)
In theory, Kristaps never intended to write a roff parser, but in practice, most real legacy man(7)uals are using so much low level roff that we can't really get away without at least partially handling some roff instructions. As doing this in man(7) only has become messy and as even some mdoc(7) pages need it, start a minimal partial roff preprocessor. As a first step, move handling of .am[i], .de[i] and .ig there. Do not use the roff preprocessor for new manuals! Now that we have three main parser libraries - roff, man and mdoc - each one having its own error handling is becoming messy, too. Thus, start unifying message handling in one central place, introducing a new generic function mmsg(). coded by kristaps@