aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandoc.h
Commit message (Collapse)AuthorAgeFilesLines
* Move mandoc_isdelim() back into libmdoc.h. This fixes an unreportedKristaps Dzonsons2011-03-221-19/+1
| | | | | | | | | error where (1) -man pages were punctuating delimiters (e.g., `.B a ;') and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its own line) would also be punctuated. This introduces a small amount of complexity of mdoc_{html,term}.c must manage their own spacing with running print_word() or print_text(). The check for delimiting now happens in mdoc_macro.c's dword().
* Add a FATAL error for when no manual type was assigned (you can repeatKristaps Dzonsons2011-03-221-1/+2
| | | | this for yourself by having a file consisting only of comments).
* Step 1 of restructuring: libmandoc.h. Move all compiler-set-specificKristaps Dzonsons2011-03-221-37/+1
| | | | | | | | | | stuff into libmandoc.h, including old mdoc.h/man.h/roff.h functions now used by read.c. The motivation behind this is to tighten the relationship between the underlying compilers while keeping parse data hidden from general callers (e.g., main.c). While here, also move register values from mandoc.h into libmandoc.h as noted by schwarze@. See above for explanation.
* Let read.c worry about the currently-open file instead of having thisKristaps Dzonsons2011-03-201-5/+2
| | | | | | information duplicated in main.c. For the time being, remove evt_close and evt_open, as the only known mparse interface (main.c) doesn't need them.
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-5/+5
| | | | | | | | | 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.
* Split the document parsing sequence out of main.c and into read.c,Kristaps Dzonsons2011-03-201-1/+26
| | | | | | | | putting the interface into mandoc.h. This effectively makes the function of main.c be command-line handling, invoking the parser, and sending its output to the output handler. The sequence of parsing (pfile(), pdesc(), etc.) has changed very little but for clean-up of some state variables (curp->fd, etc.).
* mandocmsg finally has no return value.Kristaps Dzonsons2011-03-171-2/+2
|
* Move mdoc_isdelim() into mandoc.h as mandoc_isdelim(). This allows theKristaps Dzonsons2011-03-171-1/+19
| | | | | | removal of manual delimiter checks in html.c and term.c. Finally, add the escaped period as a closing delimiter, removing a TODO to this effect.
* Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.hKristaps Dzonsons2011-03-171-7/+7
| | | | | | | | so that everybody can use them. This follows the convention of libXXXX.h being internal to a library and XXXX.h being the external interface. Not only does this allow the removal of lots of redundant NULL-checking code, it also sets the tone for adding new mandoc-global routines.
* Clean up date handling,Ingo Schwarze2011-03-071-2/+3
| | | | | | | | | | | | 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 EQN data to be pushed down into libmdoc via mdoc_addeqn(). OnlyKristaps Dzonsons2011-02-091-1/+3
| | | | the adding itself is implemented; equation data is not yet shown.
* Let the line-number of a tbl_span be remembered.Kristaps Dzonsons2011-02-061-1/+2
|
* Add initial EQN support to mandoc. This parses, then throws away, dataKristaps Dzonsons2011-02-061-1/+6
| | | | | | | | between EQ and EN roff blocks. EQN is different from TBL in that data after .EQ is unilaterally considered an equation until an .EN. Thus, there's no need to jump through hoops in having table spans and so on. This is ONLY the parse code framework in libroff. EQN is not yet passed into the backends.
* If `Ns' is specified on its own line, it should be ignored. This isKristaps Dzonsons2011-02-021-1/+2
| | | | | shitty groff behaviour. Do the same, but raise a warning to this effect. This from a TODO noted by schwarze@.
* Make out-of-context `fi' invocations not cause an error, but just aKristaps Dzonsons2011-01-121-1/+2
| | | | warning. From a TODO by schwarze@, originally noted by Brad Smith.
* Refactoring in preparation for .rm support:Ingo Schwarze2011-01-111-1/+2
| | | | | | | | | | 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@
* Clarify what members may be NULL or not in calculating widths. MakeKristaps Dzonsons2011-01-101-11/+11
| | | | | sure signedness is correct. Verify that layouts MUST exit for data cells.
* First, make extra data cells be thrown away. This makes "dp->layout"Kristaps Dzonsons2011-01-101-4/+3
| | | | | | | | | | | | always hold, which cleans up the table stuff a bit. Second, set a "spans" value per data cell consisting of the number of skipped TBL_CELL_SPAN layout cells. Third, make tbl_term.c understand how to skip over spanned sections when iterating over the header queue. What remains is to calculate the widths of spanned cells.
* Remove delims from struct tbl (not used anywhere and never will be).Kristaps Dzonsons2011-01-061-2/+1
|
* Support `T{' and `T}' data blocks. When a standalone `T{' isKristaps Dzonsons2011-01-041-1/+3
| | | | | | | encountered as a line's last data cell, move into TBL_PART_CDATA mode whilst leaving the cell's designation as TBL_DATA_NONE. When new data arrives that's not a standalone `T}', append it to the cell contends. Close out and warn appropriately.
* Fix to make horizontal spanners in the layout be properly printed.Kristaps Dzonsons2011-01-041-1/+2
| | | | | | | mandoc also now warns (so does tbl(1)) if a horizontal spanner is specified along with data. While here, fix up some documentation and uncomment the tbl reference.
* Partial cleanup of argument count validation in mdoc(7):Ingo Schwarze2011-01-031-2/+3
| | | | | | | | | | | | * 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.
* Make width calculations occur within tbl_term.c, not tbl.c. This allowsKristaps Dzonsons2011-01-031-4/+4
| | | | | | | | | | | | | | | | for front-ends to make decisions about widths, not the back-end. To pull this off, first make each tbl_head contain a unique index value (0 <= index < total tbl_head elements) and remove the tbl_calc() routine from the back-end. Then, when encountering the first tbl_span in the front-end, dynamically create an array of configurations (termp_tbl) keyed on each tbl_head's unique index value. Construct the decimals and widths at this time, then continue parsing as before. The termp_tbl and indexes are required because we pass a const tbl AST into the front-end.
* Add some final bits necessary in the upcoming -Tascii tbl stuff.Kristaps Dzonsons2011-01-021-1/+6
|
* Churn to get parts of 'struct tbl' visible from mandoc.h: rename theKristaps Dzonsons2011-01-021-1/+16
| | | | | | | existing 'struct tbl' as 'struct tbl_node', then move all option stuff into a 'struct tbl' in mandoc.h. This conflicted with a structure in chars.c, which was renamed.
* Add a warning if a data cell has no layout. Also make -Ttree show thisKristaps Dzonsons2011-01-011-1/+6
| | | | with a little star next to the entry (yeah, this is mostly for testing).
* Plug in the "head" concept for tables. A tbl_head specifies the fullKristaps Dzonsons2011-01-011-1/+21
| | | | | | | | | | layout for each row, including vertical spacers. One grabs the tbl_head for a row and iterates through each entry, plugging data from the tbl_span into the header as appropriate. This is pulled in more or less verbatim from tbl.bsd.lv. In fact, this is verbatim except that lists macros are made into hard-coded lists (for compatibility, as long-ago noted by joerg@).
* Make some bit-flags into enums as they should be. Make printing of -TtreeKristaps Dzonsons2011-01-011-9/+17
| | | | tables a little bit smarter.
* Add documentation bits for libroff's new roff_span().Kristaps Dzonsons2011-01-011-1/+2
| | | | | | Add bits to remember tbl's invocation point. Add ERROR class message if no data's in the table.
* Expose the parsed table API to the world and add accessors through theKristaps Dzonsons2010-12-311-1/+70
| | | | roff.h interface.
* Merge, with considerable changes, tbl.bsd.lv's layout-handling code.Kristaps Dzonsons2010-12-291-1/+3
|
* Significant update to options handling, which now departs almostKristaps Dzonsons2010-12-291-1/+3
| | | | | | | | | | | | | completely with the BSD.lv code due to performance issues and flat-out errors. Performance issues: functions called per character. Ugly. Flat-out errors: disallowing "reserved" tokens as arguments to those options accepting arguments. Also added are two mandoc.h error codes for general tbl syntax errors and for bad options.
* Revert IGNPAR to a warning after clue-stick applied by schwarze@:Kristaps Dzonsons2010-12-221-2/+2
| | | | | | | although technically-speaking a lost macro is an error (e.g., MANDOCERR_MACRO), casting out some extra whitespace (note, IGNPAR only happens in conditions where whitespace already exists!) is hardly an error matter.
* Add a "last child" member of struct mdoc_node.Kristaps Dzonsons2010-12-151-2/+2
| | | | | | | 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.
* Abort endless loops during roff macro and string expansion.Ingo Schwarze2010-12-101-1/+2
| | | | | | For now, use the simplest conceivable approach, like groff does: Just a fixed, ugly input stack limit. "check it in" kristaps@
* Bring schwarze@'s mandoc.h and main.c errors and warnings entirely in sync,Kristaps Dzonsons2010-12-061-43/+55
| | | | except for the tbl one which will be the focus of later study.
* Add support for `ft' macro found in groff(7). Based on a patch byKristaps Dzonsons2010-12-061-1/+2
| | | | | schwarze@, but without the -T[x]html handling, which structurally does not work. Also add man.7 documentation (not in original patch).
* Merge schwarze@'s relaxation of scope-breaking rules: allow implicitKristaps Dzonsons2010-12-061-1/+2
| | | | ending of scopes and drop stray scope-endings.
* Remove long-standing FIXME regarding the consolidation of WIDTHARG andKristaps Dzonsons2010-12-051-3/+1
| | | | NOARGV warnings. From patch by schwarze@.
* Merge schwarze@'s patch to allow uname() to fail without causing an exit.Kristaps Dzonsons2010-12-051-2/+2
|
* Merge schwarze@'s changes allowing nested displays. Tweak the patch byKristaps Dzonsons2010-12-051-3/+2
| | | | | | | 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).
* Merge OpenBSD's `so' handling (plus some documentation). Great work toKristaps Dzonsons2010-12-011-1/+3
| | | | schwarze@ and joerg@ for his comments!
* Re-ordering of roff requests as per OpenBSD.Kristaps Dzonsons2010-12-011-1/+2
| | | | Made `rm' be an error (again, OpenBSD...).
* Remove left-over rsord[] in mdoc_actions.c.Kristaps Dzonsons2010-11-291-3/+2
| | | | | | | | | 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.
* Use proper error for `An' multiple arguments.Kristaps Dzonsons2010-10-111-2/+2
| | | | Making IGNARGV be an ERROR, not a WARNING, as information is lost.
* Revert merging of {mdoc,man}.h -> mandoc.h.Kristaps Dzonsons2010-10-041-407/+29
| | | | While I'm add it, properly document all structures in these files.
* Unify mdoc and man enums and structs into mandoc.h. This is part of theKristaps Dzonsons2010-10-021-12/+401
| | | | | slow process of logically splitting formatting frontend and parser backend without pollution.
* Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless -compact isKristaps Dzonsons2010-09-271-1/+2
| | | | specified).
* If an explicit scope is still open at the end of an input file,Ingo Schwarze2010-09-261-3/+2
| | | | | | | | | | report an ERROR: We can still render the page by just closing the open scope, but it is likely that information will be missing or document structure mangled. Before, man(7) only reported a WARNING (which is dangerous because we cannot be sure rendering is correct) and mdoc(7) ran into FATAL (which is too drastic, there is no reason not to show what we have). "looks good" kristaps@
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-2/+13
| | | | | | | | | | | | | | | | | 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.