aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
Commit message (Collapse)AuthorAgeFilesLines
* main.c doesn't need roff.h anymore.Kristaps Dzonsons2011-03-211-2/+1
|
* Let read.c worry about the currently-open file instead of having thisKristaps Dzonsons2011-03-201-22/+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-30/+9
| | | | | | | | | 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-606/+71
| | | | | | | | 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-6/+4
|
* Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.hKristaps Dzonsons2011-03-171-6/+2
| | | | | | | | 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.
* Push exit_status into struct curparse alongside file_status.Kristaps Dzonsons2011-03-161-7/+8
|
* Make lint shut up a little bit.Kristaps Dzonsons2011-03-151-2/+2
|
* Remove duplicate UNCONST definition.Kristaps Dzonsons2011-03-151-2/+1
|
* Clean-up: make file_status global be local to curparse. "I agree withKristaps Dzonsons2011-03-151-29/+28
| | | | the direction of this particular patch", schwarze@.
* 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@
* Consolidate "rc" value in main.c around addspan, addeqn, and parseln.Kristaps Dzonsons2011-02-091-14/+14
|
* Allow -man to process EQN as well. Also fix a segfault in missing caseKristaps Dzonsons2011-02-091-3/+6
| | | | statements in the post-handler for EQN in -mdoc and -man.
* Allow EQN data to be pushed down into libmdoc via mdoc_addeqn(). OnlyKristaps Dzonsons2011-02-091-1/+4
| | | | the adding itself is implemented; equation data is not yet shown.
* Add initial EQN support to mandoc. This parses, then throws away, dataKristaps Dzonsons2011-02-061-1/+3
| | | | | | | | 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@.
* Since tbl_data() can now produce multiple spans, let parsebuf()Ingo Schwarze2011-01-251-6/+8
| | | | | | | generate man(7) or mdoc(7) nodes for all these spans, not only for the last one. Restores the horizontal lines in the cpu(4/hppa) tables. ok kristaps@
* Skip carriage return before newline, if any.Ingo Schwarze2011-01-241-4/+21
| | | | | | As pointed out by Joerg Sonnenberger, this is useful because we use mmap(3) and look for '\n' by hand. "check it in" kristaps@
* When finding the roff .it request (line trap),Ingo Schwarze2011-01-221-2/+2
| | | | | make it clear that you cannot use mandoc to format that page (yet). Triggered by a report from brad@, ok kristaps@.
* 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@
* First, make extra data cells be thrown away. This makes "dp->layout"Kristaps Dzonsons2011-01-101-4/+2
| | | | | | | | | | | | 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.
* Support `T{' and `T}' data blocks. When a standalone `T{' isKristaps Dzonsons2011-01-041-1/+2
| | | | | | | 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/+3
| | | | | | | 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 sure we don't continue recursively parsing once we've exited withKristaps Dzonsons2011-01-031-1/+9
| | | | | failure (this had caused some segfaults with the new assert() call in MAN_HALT and MDOC_HALT).
* Add a warning if a data cell has no layout. Also make -Ttree show thisKristaps Dzonsons2011-01-011-1/+5
| | | | with a little star next to the entry (yeah, this is mostly for testing).
* More checks for proper table exit.Kristaps Dzonsons2011-01-011-5/+2
|
* 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.
* Switch on tbl rows being added to the parse stream. Here we go!Kristaps Dzonsons2011-01-011-3/+14
|
* 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.
* Sane behaviour for the growing of very small buffers:Ingo Schwarze2010-12-211-2/+2
| | | | | | | Always grow at least to the minimum requested size. Before this, a buffer of 1 byte was grown to 2 bytes, which was too small and sometimes caused segfaults. ok kristaps@
* 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-3/+12
| | | | | | 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-44/+53
| | | | 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-2/+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-2/+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).
* Track the parser status both per file (file_status), such thatIngo Schwarze2010-12-021-14/+19
| | | | | | | | we can for example skip rendering on FATAL parsing errors, and globally (exit_status), such that we know what to return. Without this, following files produced no rendered output once a single file suffered from a FATAL error. Bug reported by kristaps@, fix by me.
* Fix enum/int mixing.Kristaps Dzonsons2010-12-011-3/+4
|
* Merge OpenBSD's `so' handling (plus some documentation). Great work toKristaps Dzonsons2010-12-011-1/+3
| | | | schwarze@ and joerg@ for his comments!
* Fix a subtle error in the new main.c where the parse type (mdoc/man) wasKristaps Dzonsons2010-12-011-86/+157
| | | | | | | | | | | | | | | being inherited during the parse sequence, making pset() meaningless. Make sure that the mdoc/man curp pointer is set for each parse from a persistent object. This flushes out an obscure error where `man' pages called with `mdoc' will parse and segfault due to a missing title. Never happened earlier because `mdoc' pages were guaranteed to have a prologue. Fix this later. Also document the new main.c functions. Please make sure these sort of things are documented! Throw in some whitespace to make things a bit more readable.
* Merge restructuring of main.c code. This provided by schwarze@ and inspectedKristaps Dzonsons2010-12-011-130/+214
| | | | | | | | carefully by joerg@. Merge roff.h header for compilation's sake (this is not yet implemented in roff.c.). THIS IS A BUGGY CHECK-IN. The manual type is erroneously kept between runs of the compiler. This is a known bug.
* 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.