summaryrefslogtreecommitdiffstats
path: root/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove duplicate UNCONST definition.Kristaps Dzonsons2011-03-151-1/+0
|
* Clean-up: make file_status global be local to curparse. "I agree withKristaps Dzonsons2011-03-151-28/+27
| | | | the direction of this particular patch", schwarze@.
* Clean up date handling,Ingo Schwarze2011-03-071-1/+2
| | | | | | | | | | | | 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-13/+13
|
* Allow -man to process EQN as well. Also fix a segfault in missing caseKristaps Dzonsons2011-02-091-2/+5
| | | | 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-0/+3
| | | | 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-0/+2
| | | | | | | | 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-0/+1
| | | | | 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-5/+7
| | | | | | | 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-3/+20
| | | | | | 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-1/+1
| | | | | 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-0/+1
| | | | warning. From a TODO by schwarze@, originally noted by Brad Smith.
* Refactoring in preparation for .rm support:Ingo Schwarze2011-01-111-0/+1
| | | | | | | | | | 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-3/+1
| | | | | | | | | | | | 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-0/+1
| | | | | | | 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-0/+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-1/+2
| | | | | | | | | | | | * 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-0/+8
| | | | | 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-0/+4
| | | | with a little star next to the entry (yeah, this is mostly for testing).
* More checks for proper table exit.Kristaps Dzonsons2011-01-011-4/+1
|
* Add documentation bits for libroff's new roff_span().Kristaps Dzonsons2011-01-011-0/+1
| | | | | | 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-2/+13
|
* Merge, with considerable changes, tbl.bsd.lv's layout-handling code.Kristaps Dzonsons2010-12-291-0/+2
|
* Significant update to options handling, which now departs almostKristaps Dzonsons2010-12-291-0/+2
| | | | | | | | | | | | | 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-1/+1
| | | | | | | 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-1/+1
| | | | | | | 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-1/+1
| | | | | | | 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-2/+11
| | | | | | 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/+52
| | | | 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-0/+1
| | | | | 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-0/+1
| | | | ending of scopes and drop stray scope-endings.
* Remove long-standing FIXME regarding the consolidation of WIDTHARG andKristaps Dzonsons2010-12-051-1/+0
| | | | NOARGV warnings. From patch by schwarze@.
* Merge schwarze@'s patch to allow uname() to fail without causing an exit.Kristaps Dzonsons2010-12-051-1/+1
|
* Merge schwarze@'s changes allowing nested displays. Tweak the patch byKristaps Dzonsons2010-12-051-1/+1
| | | | | | | 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-13/+18
| | | | | | | | 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-2/+3
|
* Merge OpenBSD's `so' handling (plus some documentation). Great work toKristaps Dzonsons2010-12-011-0/+2
| | | | 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-85/+156
| | | | | | | | | | | | | | | 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-129/+213
| | | | | | | | 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-0/+1
| | | | Made `rm' be an error (again, OpenBSD...).
* Remove left-over rsord[] in mdoc_actions.c.Kristaps Dzonsons2010-11-291-2/+1
| | | | | | | | | 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-1/+1
| | | | Making IGNARGV be an ERROR, not a WARNING, as information is lost.
* Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless -compact isKristaps Dzonsons2010-09-271-0/+1
| | | | specified).
* If an explicit scope is still open at the end of an input file,Ingo Schwarze2010-09-261-2/+1
| | | | | | | | | | 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@
* Churny commit to quiet lint. No functional changes.Kristaps Dzonsons2010-09-041-7/+8
|
* fix previous: when bailing out due to -Wstop,Ingo Schwarze2010-08-201-8/+8
| | | | | skip output functions, but not *_endparse; problem reported by kristaps@
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-229/+136
| | | | | | | | | | | | | | | | | 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.
* Make sure we really throw away non-ASCII characters.Ingo Schwarze2010-08-081-2/+3
| | | | | | For example, on OpenBSD without locale settings, isgraph(3) returns true for some eight-bit characters. ok kristaps@
* Use 0 for MAP_FILE if it doesn't exist. From Hans Rosenfeld.Joerg Sonnenberger2010-07-291-0/+4
|
* Initial PDF shim over PS. This produces working PDF output with -Tpdf.Kristaps Dzonsons2010-07-251-2/+11
| | | | | | | | | | It's currently missing the xref table, so you'll get a warning in most PDF viewers). It also produces lots of redundant output, which will go away once I get a better handle on the PDF spec. The code doesn't really touch any existing functionality; it's a bunch of conditionals atop the -Tps (term_ps.c) implementation. I'm checking it in now to have it exist and be auditable. It needs clean-up, polish, and general care (and xref!).