aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
Commit message (Collapse)AuthorAgeFilesLines
* sync usage(), and tidy up the output a little; from jmc@Ingo Schwarze2012-11-191-4/+4
|
* Support -Ios='OpenBSD 5.1' to override uname(3) as the source of theIngo Schwarze2012-05-271-4/+20
| | | | | | | | | | default value for the mdoc(7) .Os macro. Needed for man.cgi on the OpenBSD website. Problem with man.cgi first noticed by deraadt@; beck@ and deraadt@ agree with the way to solve the issue. "Please check them in and I'll look into them later!" kristaps@
* If -Tman is specified and input is -man, echo the preprocessed (`so'Kristaps Dzonsons2011-10-061-1/+8
| | | | | | | | | | | | | | replaced by file) input. This replaces earlier behaviour of doing nothing, which I found unexpected (mandoc should always output). This requires a buffer in read.c that saves the input lines before being parsed, with a special hook if `so' is invoked. This buffer is just flushed to output if -mman is the input. While mucking around doing this, I also alpha-ordered the mandoc.h functions. Ok schwarze@, with no screaming when the polished patch was published.
* Initial, incomplete support for -TmanIngo Schwarze2011-09-171-1/+7
| | | | | | | | to convert mdoc(7) documents to the man(7) language. This is work in progress and will be developed in tree. It does already handle the cat(1) manual, but will hardly handle all your fancy manuals yet. go ahead kristaps@ jmc@ millert@ deraadt@
* Turn on -Tutf8 in the frontend. Here we go!Kristaps Dzonsons2011-05-201-1/+10
|
* Add mode for -Tlocale. This mode, with this commit, behaves exactlyKristaps Dzonsons2011-05-171-2/+12
| | | | | | | like -Tascii. While adding this, inline term_alloc() (was a one-liner), remove some switches around the terminal encoding for the symbol table (unnecessary), and split out ascii_alloc() into ascii_init(), which is also called from locale_init().
* Make -Werr be -Wlevel, keeping it in sync with mandoc.1. Noted byKristaps Dzonsons2011-03-311-2/+2
| | | | Alexander Schrijver---thanks!
* Put mandocerrs and mandoclevels arrays into libmandoc with accessorsKristaps Dzonsons2011-03-281-120/+3
| | | | mparse_strerror() and mparse_strlevel().
* Make (e.g.) `SM' before `B' be only a warning. In reality, this refersKristaps Dzonsons2011-03-231-2/+2
| | | | | | | to ELINE macros ("next-line", but not unbreakable like the next-line paragraph macros) followed by other macros. This addresses a report by Christian Weisgerber, posted in the TODO by schwarze@, and aired on discuss@ (22/03/2011) for whether a fix is warranted.
* 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).
* 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@.