aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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@
* Churny commit to quiet lint. No functional changes.Kristaps Dzonsons2010-09-041-8/+9
|
* fix previous: when bailing out due to -Wstop,Ingo Schwarze2010-08-201-9/+9
| | | | | skip output functions, but not *_endparse; problem reported by kristaps@
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-230/+137
| | | | | | | | | | | | | | | | | 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-3/+4
| | | | | | 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-1/+5
|
* Initial PDF shim over PS. This produces working PDF output with -Tpdf.Kristaps Dzonsons2010-07-251-3/+12
| | | | | | | | | | 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!).
* Strip non-graphable input characters from input. The manualsKristaps Dzonsons2010-07-201-1/+23
| | | | | | | | | specifically say that this is not allowed, and were it allowed, output would be inconsistent across output media (-Tps will puke, non-your-charset terminals will puke, etc.). With this done, simplify check_text() to only check escapes and for tabs. Add in a new tab warning, too.
* Re-constitution of `ds' symbol processing. First, push theKristaps Dzonsons2010-07-071-2/+1
| | | | | | | | | roff_getstr() family of functions into roff.c with the "first_string" directly in struct roff. Second, pre-process each line for reserved words in libroff, splicing and re-running a line if it has one (this allows defined symbols to be macros). Remove term.c's invocation of the roff_getstrn() function. Removed function documentation in roff.3 and added roff.7 `ds' documentation.
* Assert my copyright, making it explicit that i'm granting the same licenseIngo Schwarze2010-07-041-2/+3
| | | | | on those parts of the code and text that i have written as Kristaps is. "fine with me" kristaps@
* Stash `Bf' parameters into struct mdoc_bf.Kristaps Dzonsons2010-07-021-2/+2
|
* Improve .Nm indentation in the SYNOPSIS;Ingo Schwarze2010-07-011-3/+4
| | | | | | | kristaps@ will do the missing HTML part soon. "looks nicer" jmc@ "seems perfect to me" sobrado@ "slap it in" kristaps@
* improve error reporting:Ingo Schwarze2010-06-301-28/+44
| | | | | | | | | * avoid error exit code after mere warnings * add ERROR: and FATAL: to messages when appropriate * sort the code in mmsg() to make it easier on the eye * make the mandocerrs[] list easier to maintain * update a few comments in mandoc.h ok kristaps@
* Add in -Opaper=xxx support for -Tps postscript. This doesn't have anyKristaps Dzonsons2010-06-291-2/+2
| | | | | | functional changes beyond the getsubopt() parse in term_ps.c. If you want to test this (it only does -Opaper=a4 and -Opaper=letter; adding more is trivial), make sure you specify (e.g.) -sPAPERSIZE=a4 to gs(1).
* Downstream maintainers: this removes UGLY! I don't want divergingKristaps Dzonsons2010-06-271-9/+10
| | | | | | | | | functionality and UGLY works quite well thanks to schwarze@'s careful attention. This also backs out function-prototype changes for struct regset, instead stuffing a pointer to the regset directly into struct mdoc/man/roff.
* Churn-ish check-in getting mdoc_parseln() and man_parseln() to accept aKristaps Dzonsons2010-06-261-3/+3
| | | | const struct regset pointer. No functionality.
* First step of adding register support. This is inspired by a significantKristaps Dzonsons2010-06-261-3/+6
| | | | | | patch by schwarze@. This commit adds support to libroff parsing `nr' into register set defined in regs.h. This will propogate into libmdoc and libman in later commits.
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-2/+2
|
* Removed stipulation that an empty `Bd -offset' will default to 6n. NotKristaps Dzonsons2010-06-121-1/+2
| | | | | | | sure where this came about. Added regression tests to convince myself that this is so. Also consolidated COMPATIBILITY notes regarding `Bd'. Added COMPATIBILITY note to the effect that old groff pukes on `Bd -compact -ragged' (regression test will fail on old groff).
* Added enum mdoc_disp (similar to enum mdoc_list). Display types are nowKristaps Dzonsons2010-06-121-2/+3
| | | | | | | | | | | only calculated once in mdoc_validate.c. Noted that `Bd -file xxx' is not supported: it now raises a fatal warning. This is noted in mdoc.7. Empty `Bd' now defaults to LIST_ragged, which is not quite what groff does, but close enough (gross just throws away the `Bd' and gets upset when it encounters an `Ed').
* No functionality changes: just restructuring. DeprecatedKristaps Dzonsons2010-06-081-2/+3
| | | | | terminal_free() in favour of ps_free() and ascii_free(). Moved ps_*() functions into term_ps.c so that they don't clutter up term.c.
* First check-in of PostScript output. This does not change any logicKristaps Dzonsons2010-06-071-9/+25
| | | | | | within term.c, but does add a small shim over putchar() that switches on the output engine. Prints, for this initial version, only monospace and without font decorations. It's a start.
* Add -Owidth=width option to mandoc -Tascii. Asked for by joerg@ about aKristaps Dzonsons2010-06-071-2/+2
| | | | thousand years ago. Note that this is normalised to >=60.
* Add MAP_SHARED for mmap, at least NetBSD with DIAGNOSTIC is quite noisyJoerg Sonnenberger2010-06-061-2/+2
| | | | otherwise.
* Consolidated list processing to a single loop in mdoc_validate.c. ThisKristaps Dzonsons2010-06-031-2/+2
| | | | | | | | | | relieves having to repeat running over the argument list in mdoc_action.c and mdoc_validate.c. Default to LIST_item for type-less lists (groff technically doesn't do this: it just ignores the `It' lines altogether). Make MANDOC_LISTTYPE be a recoverable error.
* Spelling patches provided by Ulrich Spoerlein.Kristaps Dzonsons2010-06-011-3/+3
|
* Cleanup post_bl_head() to use enum mdoc_list (avoid traversing thatKristaps Dzonsons2010-05-311-2/+2
| | | | | | | | list). Reverted MANDOC_COLUMNS to be a bad-bad syntax error: we don't, and apparently never have, allowed mixing of -column syntaxes. This would have segfaulted if encountered.
* Enable the unified error/warning enumeration in mandoc.h that'sKristaps Dzonsons2010-05-171-79/+95
| | | | | | | | | | | stringified in main.c. Allow `An' to handle an argument and child (with a warning). Allow `Rv' and `Ex' to work without a prior `Nm' as groff does (with a warning). Allow inconsistent column syntax to only raise a warning.
* `ig' support in all its glory. TryKristaps Dzonsons2010-05-161-3/+3
| | | | | | | | | | | | | | | | | | .ig ig asdf .ig fdsa .. or .ig if asdf .if n \ foo for a laugh. It all works. Lots of regression tests supporting this and documentation for the same.