aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
Commit message (Collapse)AuthorAgeFilesLines
* Temporarily remove check for r->tbl at end of parse since we need theKristaps Dzonsons2010-12-281-2/+3
| | | | original parse point to generate a useful error message.
* Initial tbl framework. Parse point is in libroff, which keeps aKristaps Dzonsons2010-12-281-58/+66
| | | | | | | | | | | | | | | | | | | | | | | | | reference to a current tbl parse and routes ALL text into the tbl parse after stripping reserved words and making block-level pre-processing (e.g., `ig'). This is consistent with an analysis of embedded `TS/TE' in manuals with sprinkled -mdoc, roff, and -man macros. Fact of a parse is exposed to main.c by a return value (ROFF_TBL), which will trigger main.c to add a foreign parsed body to the -mdoc or -man parse stream. This interface isn't in yet, but will follow the parse-text functions in both libraries. I put this login in main.c because I don't want libroff calling directly into libmdoc or libman. As a consequence, a parsed row can be pushed directly into any -mdoc or -man context (put a `Bd -literal -offset indent' into a `TE/TS' block to see why this is necessary). It will then absorb formatting cues in the front-ends. A note on naming. I decided on libroff.h instead of tbl.h because this is purely within the roff layer. Separate tbl implementations will need, then, to interface with libroff. This is "how it should be" because tbl is tightly linked with roff in terms of `ds' and other formatting macros, as well as, of course, special characters and other roffisms.
* Sync to OpenBSD:Ingo Schwarze2010-12-211-12/+44
| | | | | | | | | 1) Now that growing buffers in main.c is safe, bring back the bugfix distinguishing empty and undefined macros that was backed out in the previous roff.c commit: `de' initializes to "", not to NULL. 2) Roff only interpolates \* strings when the leading backslash is not escaped; using optimizations suggested by joerg@ and kristaps@. ok kristaps@
* Track down a bug of empty `de XX' macros causing uncertain behaviour byKristaps Dzonsons2010-12-061-10/+22
| | | | | | | | | | returning empty strings in roff_getstrn() instead of NULL. This caused maddeningly irregular segfaults in the pod2man preamble for `de IX'. But only on DEC alpha. Also integrate the kinda-probably-safe assertion relaxation in term.c, field-tested by schwarze@. This allows ALL [unpreprocessed] base and xenocara manuals for all BSD systems to run without segfault.
* Merge schwarze@'s changes to allow for user-defined strings. ThisKristaps Dzonsons2010-12-021-73/+214
| | | | | | | | primarily adds a roff_userdef() function for parsing new defines and modifies the look-up procedure. NOTE: there is a bug hidden away in this update that causes an infinite loop in some pages. The cause is for the moment unknown.
* Merge OpenBSD's `so' handling (plus some documentation). Great work toKristaps Dzonsons2010-12-011-1/+28
| | | | schwarze@ and joerg@ for his comments!
* Re-ordering of roff requests as per OpenBSD.Kristaps Dzonsons2010-12-011-5/+13
| | | | Made `rm' be an error (again, OpenBSD...).
* Low-hanging fruit: add OpenBSD's `ad', `hy', `ne', and `nh' handling.Kristaps Dzonsons2010-12-011-5/+13
| | | | Rename roff_line() -> roff_line_ignore().
* Churny commit to quiet lint. No functional changes.Kristaps Dzonsons2010-09-041-3/+1
|
* Fix premature return from sub-conditional roff statements. This fixKristaps Dzonsons2010-09-041-6/+4
| | | | fully accomodates for the pod2man standard preamble!
* Allow `.xx\}' where xx is a macro (e.g., `.br\}') to close scope. This isKristaps Dzonsons2010-08-291-3/+10
| | | | | | experimental and hasn't been rigorously tested. It's only implemented in -mdoc for the time being. This is absolutely required for pod2man. It does, however, make the pod2man preamble be processed in full.
* Have the `ds' processor strip out `\\' as stipulated in groff.7. I onlyKristaps Dzonsons2010-08-241-3/+26
| | | | care because pod2man uses this construct.
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-25/+9
| | | | | | | | | | | | | | | | | 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.
* No-op to shut up lint.Kristaps Dzonsons2010-07-271-2/+2
|
* Fix `ds' handling. This was stripping characters from "val", when theKristaps Dzonsons2010-07-271-13/+24
| | | | | | syntax of `ds' is such that ALL text following the first non-space/non-double-quote is part of the value. This also fixes the warning of *(string++) = NULL report by kristaps@ and joerg@.
* Lint-fixes (NetBSD).Kristaps Dzonsons2010-07-211-6/+6
|
* Re-constitution of `ds' symbol processing. First, push theKristaps Dzonsons2010-07-071-64/+123
| | | | | | | | | 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-1/+2
| | | | | on those parts of the code and text that i have written as Kristaps is. "fine with me" kristaps@
* Rudimentary implementation of user-defined strings;Ingo Schwarze2010-07-031-2/+115
| | | | | | no time for more refinement right now. In particular, fixes terminfo(3) and mdoc.samples(7). ok kristaps@, who will add the HTML frontend bits
* Allow registers to be unset. Implement and document the `.nr nS val'.Kristaps Dzonsons2010-06-271-9/+12
|
* Downstream maintainers: this removes UGLY! I don't want divergingKristaps Dzonsons2010-06-271-18/+19
| | | | | | | | | 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.
* First step of adding register support. This is inspired by a significantKristaps Dzonsons2010-06-261-9/+80
| | | | | | 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.
* Fix adding some minimal intelligence to conditional parser. See roff.7Kristaps Dzonsons2010-06-101-34/+89
| | | | | | | | | | for what's supported. This simplified the roff_cond() function quite nicely. From a bug report by uqs@. Added regression test based on bug-report example by uqs@. Also added ROFF_DEBUG to see what the hell the parser is actually doing. Obviously turned off by default.
* Make "sub" for conditionals run roffnode_cleanscope() before callingKristaps Dzonsons2010-06-091-2/+12
| | | | down to sub-arguments. From a bug report by Ulrich Spoerlein.
* Fixed condition of `\}' closing a conditional at the start of the line.Kristaps Dzonsons2010-06-011-4/+2
| | | | | | | | Fixed flushed-out condition of \} causing subsequent arguments to be truncated, when in fact the whole line should be passed through (if the conditional succeeds) to the front-end and the \} ignored there. Added regression test of this behaviour.
* Give libroff an extremely simple table-lookup instead of iterating overKristaps Dzonsons2010-05-291-22/+72
| | | | | each and every macro. The table keys on the first character then walks a chain. Good enough for now.
* recognize ".if n" as true;Ingo Schwarze2010-05-241-6/+17
| | | | | | nothing fancy yet, no negation, no grammer, just that one letter; from OpenBSD; "looks fine" kristaps@
* provide stubs to ignore .ds, .rm and .tr,Ingo Schwarze2010-05-241-1/+17
| | | | | | which occur in the standard pod2man preamble; from OpenBSD; "sounds good" joerg@, "can be checked in" kristaps@
* Full support for ie/el. This completes the initial roff support.Kristaps Dzonsons2010-05-171-61/+115
| | | | | Added test files for ie/el. Using `if 0' as a baseline for "false" roff instructions instead of `if t'.
* Oops: forgot to make roff_cblock() understand the new macros.Kristaps Dzonsons2010-05-171-2/+17
|
* libroff now intelligently throws away `am', `ami', `am1', `de', `dei',Kristaps Dzonsons2010-05-171-14/+33
| | | | and `de1'. This is also documented in roff.7.
* libroff now is aware of which sub-nodes should be interpreted even in aKristaps Dzonsons2010-05-171-81/+144
| | | | | | | | | | conditional-negative context so as to preserve structural integrity. Initial "rules" (deny/allow) are now inherited for future work in evaluating conditionals. Lint-fix noted by Joerg. Added regression tests for zany constructs.
* `ig' support in all its glory. TryKristaps Dzonsons2010-05-161-22/+125
| | | | | | | | | | | | | | | | | | .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.
* Regression tests in place for `.if' in libroff.Kristaps Dzonsons2010-05-161-5/+30
| | | | | Check against some strange `.if' constructs I missed. Added initial roff.7 manual.
* Re-admit the simple case of `.ig' that works with groff's stranger invocations.Kristaps Dzonsons2010-05-161-124/+72
|
* Support for the general case of `if', which will boil out into otherKristaps Dzonsons2010-05-161-50/+78
| | | | | | | | constructs: single-level and multi-level blocks; nested, varied-level blocks; recalculating buffer (begin) boundaries pushed correctly into the back-ends, and so on. This will allow, once conditions are turned on, for things like `.ie n .TH FOO 1' then `.el .Dd Mdocdate'. Read it and weep.
* Allow roff_parseln() to be re-run.Kristaps Dzonsons2010-05-161-32/+109
| | | | | | | | | Allow roff_parseln() to manipulate the line buffer offset. This is used in situations like `.ie n .TH FOO 1' or `.ie n .ie n', where the line buffer offset is recalculated then the roff parser re-run. Fix mdoc_parseln() and man_parseln() to accept the initial line offset. WARNING: backed-out ALL roff macros whilst accomodating for how roff handles multi-line conditionals (in short, re-running the parser).
* Backed-out warning messages (lots).Kristaps Dzonsons2010-05-151-4/+4
|
* The `am', `ami', `de', and holy `dei' are all being properly ignored.Kristaps Dzonsons2010-05-151-36/+24
|
* The `ig' now supports `ig end-macro'.Kristaps Dzonsons2010-05-151-8/+73
| | | | Initial warning/error messages in place (still experimental).
* Pull `ig' out of -man and leave it the roff preparser.Kristaps Dzonsons2010-05-151-11/+1
|
* Magic fix for bogus manuals making -man puke: I don't care if it's magic ↵Kristaps Dzonsons2010-05-151-2/+2
| | | | because roff instructions will be nixed from the underlying systems anyway.
* Segfault fix and letting warnings slip through for now.Kristaps Dzonsons2010-05-151-3/+5
|
* Add mandoc.h, which will eventually replace compilers' inner enum errors ↵Kristaps Dzonsons2010-05-151-2/+306
| | | | | | with unified ones. Add initial roff pre-processor shim, a compiler sitting outside of the other compilers that processes pure roff instructions.
* Initial roff shim skeleton in place.Kristaps Dzonsons2010-05-151-0/+24
|
* More file pruning.Kristaps Dzonsons2008-12-151-1724/+0
|
* *** empty log message ***Kristaps Dzonsons2008-12-121-3/+95
|
* Ready for looking over by people.Kristaps Dzonsons2008-12-101-4/+4
|
* Sx to Sh anchors work.Kristaps Dzonsons2008-12-101-4/+7
|
* Put prelude checking into asec.Kristaps Dzonsons2008-12-101-66/+43
|