summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
Commit message (Collapse)AuthorAgeFilesLines
* Make -man check for tabs correctly print the column.VERSION.1.11.7Kristaps Dzonsons2011-09-021-1/+1
|
* Avoid incorrect casting by using an implicit cast. Reported by ThomasKristaps Dzonsons2011-08-191-2/+2
| | | | Klausner.
* Fixed mingw compatibility where the "z" printf() modifier isn'tKristaps Dzonsons2011-08-161-2/+2
| | | | | recognised. It's easier to make these u_int than to jump through hoops for a special formatter.
* Allow `Sx' and `Ss' to have child nodes. Fixes manuals in NetBSD.Kristaps Dzonsons2011-08-101-34/+41
| | | | | | Originally pointed out by joerg@ then again by Thomas Klausner by way of Nicolas Joy. Note: don't use these constructions as you can't link to the sections with `Sx'.
* Move checking of escapes into roff.c, where we're already steppingKristaps Dzonsons2011-07-261-31/+5
| | | | | through looking for user-defined escapes. This clears up a nice bit of validation code.
* Scary-looking but otherwise harmless changes allow me to build for Windows.Kristaps Dzonsons2011-07-241-1/+1
| | | | | | | | | | | | That is to say, with mingw32. This amounts to the following: (1) break compat.c into compat_strlcpy.c and compat_strlcat.c (2) add compat_getsubopt.c (from OpenBSD) and test-getsubopt.c (3) add test-strptime.c for HAVE_STRPTIME (4) add ifdef bits here and there, where necessary (5) remove some harmless unportable stuff (u_char, localtime_r) I've added the appropriate mdocml.zip target to the Makefile, too.
* Make `struct roff' be passed into libmdoc and libman upon creation.Kristaps Dzonsons2011-07-181-1/+1
| | | | | This is required for supporting in-line equations. While here, push registers properly into roff and add an set/get/mod interface.
* No code change: fixing spelling errors. From a patch by uqs@. Thanks!Kristaps Dzonsons2011-04-301-1/+1
|
* Remove the warning for empty bodies of `Sh', `Ss', `SH', and `SS'. ThisKristaps Dzonsons2011-04-131-2/+2
| | | | | | | | | | | prompted by a TODO by schwarze@, originally from Gleydson Soares, that an empty `SS' was raising an error (it hasn't for some time). It makes sense these shouldn't warn, as omitting their contents doesn't change anything in the structure of the document (groff and mandoc specifically account for the whitespace between empty sections). This doesn't change any manuals, which only refer to the line arguments (or possibly next-line, in the case of man(7) syntax).
* Remove a2roffdeco() and mandoc_special() functions and replace them withKristaps Dzonsons2011-04-091-11/+19
| | | | | | | | | | | | | | | | | | a public (mandoc.h) function mandoc_escape(), which merges the functionality of both prior functions. Reason: code duplication. The a2roffdeco() and mandoc_special() functions were pretty much the same thing and both quite complex. This allows one function to receive improvements in (e.g.) subexpression handling and performance, instead of having to replicate functionality. As such, the mandoc_escape() function already handles a superset of the escapes handled in previous versions and has improvements in performance (using strcspn(), for example) and reliable handling of subexpressions. This code Works For Me, but may need work to catch any regressions. Since the benefits are great (leaner code, simpler API), I'd rather have it in-tree than floating as a patch.
* Make uname have its return value checked for -1 (POSIX style), notKristaps Dzonsons2011-04-031-1/+1
| | | | non-zero. From a PR by Yuri Pankov, ok schwarze@.
* libmdoc.h and libman.h were including mdoc.h and man.h, respectively.Kristaps Dzonsons2011-03-221-0/+1
| | | | | Don't have them do that (includes in header files = faugh), and have individual files directly include these files.
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-10/+10
| | | | | | | | | libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the time being in libmandoc.h. This requires struct mparse to be passed into the allocation routines instead of mandocmsg and a void pointer. Then, move some of the functionality of the old mmsg() into read.c's mparse_mmsg() (check against wlevel and setting of file_status) and use main.c's mmsg() as simply a printing tool.
* Note that mdoc_valids[] is static.Kristaps Dzonsons2011-03-171-1/+1
|
* Clean-up in libmdoc: fix last checks for mdoc_*msg return value, thenKristaps Dzonsons2011-03-171-7/+6
| | | | | make mdoc_vmsg not return an int. libmdoc is now completely clean of return-value checks from the message subsystem.
* Move mdoc_macro2len() into mdoc_validate.c as macro2len(), as that's theKristaps Dzonsons2011-03-171-3/+96
| | | | only place that it's being used.
* Move mdoc_str2sec() into mdoc_validate.c as a2sec(), as that's the onlyKristaps Dzonsons2011-03-171-1/+38
| | | | place that it's being used.
* Make lint shut up a little bit.Kristaps Dzonsons2011-03-151-1/+2
|
* Clean up date handling,Ingo Schwarze2011-03-071-14/+12
| | | | | | | | | | | | as a first step to get rid of the frequent petty warnings in this area: - always store dates as strings, not as seconds since the Epoch - for input, try the three most common formats everywhere - for unrecognized format, just pass the date though verbatim - when there is no date at all, still use the current date Originally triggered by a one-line patch from Tim van der Molen, <tbvdm at xs4all dot nl>, which is included here. Feedback and OK on manual parts from jmc@. "please check this in" kristaps@
* Allow -man to process EQN as well. Also fix a segfault in missing caseKristaps Dzonsons2011-02-091-0/+2
| | | | statements in the post-handler for EQN in -mdoc and -man.
* Add initial libmdoc and libman top-most machinery for accepting TBLKristaps Dzonsons2011-02-061-0/+2
| | | | | directives. For now this will just ignore them (except for -Ttree, which just notes that an EQN's been accepted).
* If `Ns' is specified on its own line, it should be ignored. This isKristaps Dzonsons2011-02-021-1/+12
| | | | | shitty groff behaviour. Do the same, but raise a warning to this effect. This from a TODO noted by schwarze@.
* Push capitalisation of `Bx' second argument into validator, where it belongs.Kristaps Dzonsons2011-01-251-1/+21
|
* If %B is specified, quote %T. Noted by schwarze@ in the TODO.Kristaps Dzonsons2011-01-251-2/+2
|
* Check argument count validation for all in_line() macros.Ingo Schwarze2011-01-221-36/+20
| | | | | | | | Most empty in_line() macros are already removed by the parser, so there is no need to check again in mdoc_validate.c. This also downgrades almost all remaining argument count issues from ERROR to WARNING. ok kristaps@
* Partial cleanup of argument count validation in mdoc(7):Ingo Schwarze2011-01-031-65/+67
| | | | | | | | | | | | * Do not segfault on empty .Db, .Rs, .Sm, and .St. * Let check_count() really throw the requested level, not always ERROR. * Downgrade most bad argument counts from ERROR to WARNING. * And some related internal cleanup. Looks fine to kristaps@. Note that the macros using eerr_ge1() still need to be checked at a later time; but as all the others are done, let's use what we already have.
* Add table processing structures to -mdoc. This consists of anKristaps Dzonsons2011-01-011-3/+16
| | | | | | external-facing function mdoc_addspan(), then various bits to prohibit printing and scanning (this requires some if's to be converted into switch's).
* Implement schwarze@'s much more elegant version of my %T/%J fix.Kristaps Dzonsons2010-12-251-16/+3
|
* Specifying both %T and %J in an `Rs' block causes the title to be quotedKristaps Dzonsons2010-12-251-1/+16
| | | | | instead of underlined. This only happens in -Tascii, as -T[x]html both underlines and italicises.
* As per schwarze@'s suggestions, roll back the refcount structure inKristaps Dzonsons2010-12-241-78/+58
| | | | | | | | favour of a simpler shim for normalised data in the node allocation and free routines. This removes the need to bump and copy references within validator handlers, removes a pointer redirect, and also kills the refcount structure itself. Data is assumed to "live" either in a MDOC_BLOCK or MDOC_ELEM and is copied accordingly.
* At the beginning of .Bl, .Sm is allowed,Ingo Schwarze2010-12-221-3/+5
| | | | | and .Lp should cause a warning, not an error. "I don't suppose I mind this." kristaps@
* Implement reference-counted version of original union mdoc_data. ThisKristaps Dzonsons2010-12-221-74/+76
| | | | | | | simplifies clean-up and allows for more types without extra hassle. Also made in-line literal types in -T[x]html use CODE instead of SPAN to match how literal blocks use PRE.
* Migrate `An' to use a pointer in its data, like everybody else. This isKristaps Dzonsons2010-12-161-4/+7
| | | | | the first step to having a simpler ref-counted system for "data" associated with a node.
* Back out last: apparently `Bl', `It', and `Pp' need a little bit moreKristaps Dzonsons2010-12-161-17/+2
| | | | study to see exactly what's legal and what's not.
* Allow `It' to have a trailing paragraph if the surrounding list is inKristaps Dzonsons2010-12-161-2/+17
| | | | compact mode.
* First, make `Pp' (next to `Sm') be allowed as the first element of aKristaps Dzonsons2010-12-161-13/+15
| | | | | | | | | | | `Bl' (before any `It' have been invoked). Next, have the existence of either macro raise a warning, as it's technically not legal according to mdoc.7. Second, delete any `Pp' as the first element of a `Bl' (i.e., before an `It') ONLY when -compact has not been specified. This matches with the latest version of groff. This deletion happens prior to the above check, so double-warnings will not be issued.
* Add a "last child" member of struct mdoc_node.Kristaps Dzonsons2010-12-151-6/+26
| | | | | | | Remove `Pp' or `Lp' if it is the FIRST or LAST child of an `Sh' or `Sh' body. Make "skipping paragraph" be an error, not a warning, as information (an invoked macro) is ignored.
* Allow quote macros (`Op', `Aq', `Bq', `Dq', `Pq', `Ql', `Qq', `Sq', andKristaps Dzonsons2010-12-091-9/+9
| | | | | | | | | `Brq') to have zero arguments without warning. This makes sense because the multi-line quote macros (`Oo/Oc' etc.) allow zero children anyway. Furthermore, the documentation doesn't state that they're required to have children. Originally reported by Alex Kozlov, thanks!
* Remove repeat notification of -width omission. From a patch by schwarze@.Kristaps Dzonsons2010-12-051-6/+1
|
* Remove long-standing FIXME regarding the consolidation of WIDTHARG andKristaps Dzonsons2010-12-051-3/+2
| | | | NOARGV warnings. From patch by schwarze@.
* Merge schwarze@'s patch to allow uname() to fail without causing an exit.Kristaps Dzonsons2010-12-051-3/+6
|
* Merge schwarze@'s changes allowing nested displays. Tweak the patch byKristaps Dzonsons2010-12-051-10/+6
| | | | | | | making sure output doesn't add a superfluous newline with the nested displays. Also add a COMPATIBILITY note. Rename a macro (DATESIZ) to be in line with OpenBSD (DATESIZE).
* Fixed a goddamn subtle error causing MDOC_LITERAL to remain set after aKristaps Dzonsons2010-12-011-1/+1
| | | | call to `Dl' or `Bd -literal' or unfilled.
* Simplify the many if ( ! mdoc_nmsg()) return(0) etc. calls with just theKristaps Dzonsons2010-11-301-168/+157
| | | | | | | | | | error printing, as this is superseded by exit_status in main.c. Make check_argv() and check_text() return void. Make MDOC_Std test in check_argv() to pre_std(). Re-write post_root() to check more conditions before returning.
* Moved all prologue actions from mdoc_action.c into mdoc_validate.c. TheKristaps Dzonsons2010-11-301-74/+294
| | | | file is now ready for removal.
* Move post_bl() and subfunctions from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-301-0/+155
|
* Move -column list validation and normal-formisation from mdoc_action.cKristaps Dzonsons2010-11-301-11/+56
| | | | into mdoc_validate.c.
* Migrate `Nm' and `Pa' handling from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-291-6/+37
| | | | Document that `Pa' is replaced by a tilde, just like `Mt'.
* Remove left-over rsord[] in mdoc_actions.c.Kristaps Dzonsons2010-11-291-10/+73
| | | | | | | | | Remove MANDOCERR_BADLIB (not used). Moved `St' handling from mdoc_action.c into mdoc_validate.c. Moved relevant MDOC_LITERAL macros (`Dl', `Bd' subtypes) from mdoc_action.c into mdoc_validate.c.
* Move `Lb' handling from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-291-4/+25
|