summaryrefslogtreecommitdiffstats
path: root/main.h
Commit message (Collapse)AuthorAgeFilesLines
* Reset HTML formatter state, in particular the id_unique hash,Ingo Schwarze2019-03-031-1/+2
| | | | | | | | after processing each manual page, such that the next page starts from a clean state and doesn't continue suffix numbering. Issue found while looking at https://github.com/Debian/debiman/issues/48 which was brought up by Orestis Ioannou <oorestisime at github>.
* Cleanup, no functional change:Ingo Schwarze2018-12-301-9/+9
| | | | | | | | | | | | | | The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters.
* The upcoming .while request will have to re-execute roff(7) linesIngo Schwarze2018-08-231-1/+0
| | | | | | | parsed earlier, so they will have to be saved for reuse - but the read.c preparser does not know yet whether a line contains a .while request before passing it to the roff parser. To cope with that, save all parsed lines for now. Even shortens the code by 20 lines.
* new -mdoc -Tmarkdown output mode; OK millert@ reyk@ tb@;Ingo Schwarze2017-03-031-0/+2
| | | | thanks to reyk@ and to Vsevolod at FreeBSD for suggesting it
* To remove the const qualifier from a pointer to an object - eitherIngo Schwarze2016-07-151-2/+0
| | | | | | | | | because we know it is actually mutable or because we are passing it to a function that doesn't accept a const object but won't actually attempt to modify it - simply casting from (const type *) to (type *) is legal C and clearly expresses the intent. So get rid of the obfuscating UNCONST macro. Basic idea discussed with guenther@.
* ISO C99 7.19.2.5 doesn't like mixing putchar(3) and putwchar(3) onIngo Schwarze2016-07-081-1/+1
| | | | | | the same stream, and actually, it fails spectacularly on glibc. Portability issue pointed out by Svyatoslav Mishyn <juef at openmailbox dot org> after testing on Void Linux.
* In private header files, __BEGIN_DECLS and __END_DECLS are pointless.Ingo Schwarze2015-11-071-4/+0
| | | | | | | | | | | | Because these work slightly differently on different systems, they are becoming a maintenance burden in the portable version, so delete them. Besides, one of the chief design goals of the mandoc toolbox is to make sure that nothing related to documentation requires C++. Consequently, linking mandoc against any kind of C++ program would defeat the purpose and is not supported. I don't understand why kristaps@ added them in the first place.
* Major character table cleanup:Ingo Schwarze2015-10-131-13/+6
| | | | | | | | | | | | | * Use ohash(3) rather than a hand-rolled hash table. * Make the character table static in the chars.c module: There is no need to pass a pointer around, we most certainly never want to use two different character tables concurrently. * No need to keep the characters in a separate file chars.in; that merely encourages downstream porters to mess with them. * Sort the characters to agree with the mandoc_chars(7) manual page. * Specify Unicode codepoints in hex, not decimal (that's the detail that originally triggered this patch). No functional change, minus 100 LOC, and i don't see a performance change.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-10/+9
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Actually use the new man.conf(5) "output" directive.Ingo Schwarze2015-03-271-9/+16
| | | | Additional functionality, yet minus 45 lines of code.
* When showing more than one formatted manual page, insert horizontal linesIngo Schwarze2014-12-311-0/+2
| | | | | | between pages. Suggested by Theo Buehler <theo at math dot ethz dot ch>. Even in UTF-8 output mode, do not use fancy line drawing characters such that you can easily use /^--- to skip to the next manual in your pager.
* header cleanup:Ingo Schwarze2014-12-011-3/+3
| | | | | | * add missing forward declarations * remove needless header inclusions * some style unification
* remove unneccessary inclusion protection; patch from deraadt@Ingo Schwarze2014-12-011-4/+0
|
* Make the character table available to libroff so it can check theIngo Schwarze2014-10-281-7/+6
| | | | | | | | validity of character escape names and warn about unknown ones. This requires mchars_spec2cp() to report unknown names again. Fortunately, that doesn't require changing the calling code because according to groff, invalid character escapes should not produce output anyway, and now that we warn about them, that's fine.
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-1/+1
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* If -Tman is specified and input is -man, echo the preprocessed (`so'Kristaps Dzonsons2011-10-061-0/+1
| | | | | | | | | | | | | | 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.
* forgotten Copyright bumps; no code changeIngo Schwarze2011-09-181-1/+1
| | | | found while syncing to OpenBSD
* Initial, incomplete support for -TmanIngo Schwarze2011-09-171-0/+2
| | | | | | | | 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@
* Flip on -Tutf8 backend support. This forces the UTF-8 LC_CTYPE and doesKristaps Dzonsons2011-05-201-0/+1
| | | | | | little else. Also remove the check for __STDC_ISO_10646__. It turns out that very few systems---even those that support it---actually declare this and it's just causing problems instead of being useful.
* Add mode for -Tlocale. This mode, with this commit, behaves exactlyKristaps Dzonsons2011-05-171-0/+1
| | | | | | | 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().
* Sync to OpenBSD: add missing Copyright years.Ingo Schwarze2010-07-311-1/+1
| | | | | I checked that substantial changes were committed to these files during these years.
* Initial PDF shim over PS. This produces working PDF output with -Tpdf.Kristaps Dzonsons2010-07-251-1/+2
| | | | | | | | | | 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!).
* Add in -Opaper=xxx support for -Tps postscript. This doesn't have anyKristaps Dzonsons2010-06-291-1/+1
| | | | | | 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).
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-1/+1
|
* No functionality changes: just restructuring. DeprecatedKristaps Dzonsons2010-06-081-1/+4
| | | | | 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-0/+1
| | | | | | 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-1/+4
| | | | thousand years ago. Note that this is normalised to >=60.
* Make the output width an option for ascii_alloc and use that to computeJoerg Sonnenberger2010-05-151-1/+1
| | | | the default margin. Hard-code 80 chars/line for now.
* Fixed Makefile for `make lint' dep. on config.hKristaps Dzonsons2010-01-291-0/+1
| | | | Added -Txhtml for XHTML output (minimal increase to programme logic). Because groff has it and it bothers me that we don't.
* Moved output definitions into main.h.Kristaps Dzonsons2009-10-131-0/+47
Pushed terminal_{mdoc,man} into {mdoc,man}_term.c.