summaryrefslogtreecommitdiffstats
path: root/libmandoc.h
Commit message (Collapse)AuthorAgeFilesLines
* An implementation of `tr'. This routes allocations of TEXT nodesKristaps Dzonsons2011-07-281-0/+1
| | | | | | | through libroff, which does the appropriate translations of `tr'. This is SLOW: it uses the backend of `ds' and `de', which is a simple linear list. However, unlike `ds' and `de', it iterates over EACH CHARACTER of the entire file looking for replacements.
* Disable in-line eqn processing for a bit.Kristaps Dzonsons2011-07-271-0/+2
|
* Move mandoc_hyph() into roff_parsetext() as a single conditional. WhileKristaps Dzonsons2011-07-271-1/+0
| | | | | here, do some function renames for clarity and make all function prototypes be in one place.
* Implement the first steps of equation parsing from within libmdoc.Kristaps Dzonsons2011-07-251-0/+4
| | | | | | This consists of a shim around the text parser that calls out to libroff if equation components exist on the line. Right now this will do nothing, as the equation delimiter always returns nil.
* Support `size' constructs in eqn.7. Generalise mandoc_strontou to thisKristaps Dzonsons2011-07-211-1/+1
| | | | effect.
* Make `struct roff' be passed into libmdoc and libman upon creation.Kristaps Dzonsons2011-07-181-32/+6
| | | | | This is required for supporting in-line equations. While here, push registers properly into roff and add an set/get/mod interface.
* Remove prototype since moved into mandoc.h.Kristaps Dzonsons2011-07-171-1/+0
|
* Move roff.c's strtol into libmandoc.h for use by other parts of the codeKristaps Dzonsons2011-05-141-0/+1
| | | | (which will come).
* Clean up parsing of delimiters in -mdoc. First, remove the "dowarn"Kristaps Dzonsons2011-04-191-2/+1
| | | | | | | | variable from mandoc_getarg() so that it prints the warning every time. Then, remove the warning from args_checkpunct(). This way, warnings are being posted at the correct time. This makes the flag argument to mdoc_zargs() superfluous, so make it be zero when it's invoked. Finally, move the args() flags into mdoc_argv.c and make them enums.
* Get mdoc_argv.c ready to use [some of] mandoc_getarg() by giving saidKristaps Dzonsons2011-04-171-1/+2
| | | | function a parameter to suppress warnings.
* Remove a2roffdeco() and mandoc_special() functions and replace them withKristaps Dzonsons2011-04-091-1/+0
| | | | | | | | | | | | | | | | | | a public (mandoc.h) function mandoc_escape(), which merges the functionality of both prior functions. Reason: code duplication. The a2roffdeco() and mandoc_special() functions were pretty much the same thing and both quite complex. This allows one function to receive improvements in (e.g.) subexpression handling and performance, instead of having to replicate functionality. As such, the mandoc_escape() function already handles a superset of the escapes handled in previous versions and has improvements in performance (using strcspn(), for example) and reliable handling of subexpressions. This code Works For Me, but may need work to catch any regressions. Since the benefits are great (leaner code, simpler API), I'd rather have it in-tree than floating as a patch.
* Have libman and libmdoc use mandoc_getcontrol() to determine whether aKristaps Dzonsons2011-03-281-0/+1
| | | | macro has been invoked. libroff is next.
* Move mandoc_isdelim() back into libmdoc.h. This fixes an unreportedKristaps Dzonsons2011-03-221-12/+9
| | | | | | | | | error where (1) -man pages were punctuating delimiters (e.g., `.B a ;') and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its own line) would also be punctuated. This introduces a small amount of complexity of mdoc_{html,term}.c must manage their own spacing with running print_word() or print_text(). The check for delimiting now happens in mdoc_macro.c's dword().
* Step 3: consolidate manuals. The parse functions in mdoc.h, roff.h, andKristaps Dzonsons2011-03-221-1/+1
| | | | | | | | man.h are now part of libmandoc.h, so remove these from their respective manuals (they're no longer public-facing and we don't need a libmandoc.3 (yet?)). Before that, move the juicy data (parse tree syntax) into new-born mandoc.3. Peck around in Makefile and index.sgml to reflect reality.
* Step 1 of restructuring: libmandoc.h. Move all compiler-set-specificKristaps Dzonsons2011-03-221-10/+89
| | | | | | | | | | stuff into libmandoc.h, including old mdoc.h/man.h/roff.h functions now used by read.c. The motivation behind this is to tighten the relationship between the underlying compilers while keeping parse data hidden from general callers (e.g., main.c). While here, also move register values from mandoc.h into libmandoc.h as noted by schwarze@. See above for explanation.
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-6/+10
| | | | | | | | | 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.
* Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.hKristaps Dzonsons2011-03-171-3/+0
| | | | | | | | 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.
* Clean up date handling,Ingo Schwarze2011-03-071-5/+1
| | | | | | | | | | | | 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@
* Unify roff macro argument parsing (in roff.c, roff_userdef()) and man macroIngo Schwarze2011-01-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | argument parsing (in man_argv.c, man_args()), both having different bugs, to use one common macro argument parser (in mandoc.c, mandoc_getarg()), because from the point of view of roff, man macros are just roff macros, hence their arguments are parsed in exactly the same way. While doing so, fix these bugs: * Escaped blanks (i.e. those preceded by an odd number of backslashes) were mishandled as argument separators in unquoted arguments to user-defined roff macros. * Unescaped blanks preceded by an even number of backslashes were not recognized as argument separators in unquoted arguments to man macros. * Escaped backslashes (i.e. pairs of backslashes) were not reduced to single backslashes both in unquoted and quoted arguments both to user-defined roff macros and to man macros. * Escaped quotes (i.e. pairs of quotes inside quoted arguments) were not reduced to single quotes in man macros. OK kristaps@ Note that mdoc macro argument parsing is yet another beast for no good reason and is probably afflicted by similar bugs. But i don't attempt to fix that right now because it is intricately entangled with lots of unrelated high-level mdoc(7) functionality, like delimiter handling and column list phrase handling. Disentagling that would waste too much time now.
* Text ending in a full stop, exclamation mark or question markIngo Schwarze2010-07-181-2/+2
| | | | | | | | | | | | | | | | | | should not flag the end of a sentence if: 1) The punctuation is followed by closing delimiters and not preceded by alphanumeric characters, like in "There is no full stop (.) in this sentence" or 2) The punctuation is a child of a macro and not preceded by alphanumeric characters, like in "There is no full stop .Pq \&. in this sentence" "looks fine" to kristaps@; tested by jmc@ and sobrado@
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-1/+1
|
* Squash bug noted by Ulrich Spoerlein where "-" were being converted toKristaps Dzonsons2010-06-091-1/+1
| | | | | | | | | ASCII_HYPH, as per normal, but were screwing up mandoc_special(). Fixed by making mandoc_special() first check isspace() instead of ! isgraph(), then normalise its string as it passes out. This require de-constifying some validation routines not already de-constified (those in libman), but that's ok, because I'd like to be pushing actions into validation routines to save on space and redundant calculations.
* Modified version of Ingo Schwarze's patch for hyphen-breaking.Kristaps Dzonsons2010-05-251-0/+1
| | | | | | | Breakable hyphens are cued in the back-ends (with ASCII_HYPH) and acted upon in term.c or ignored in html.c. Also cleaned up XML decl printing (no need for extra vars).
* Put the eos-checker into libmandoc.h.Kristaps Dzonsons2010-05-121-0/+1
| | | | Added bits in mdoc.7 and man.7 about EOS spacing.
* Added mandoc_a2time() for proper date conversion.Kristaps Dzonsons2009-11-021-0/+5
| | | | | Fitted TH and Dd handlers to use mandoc_a2time(). Documented date syntax for -man, fixed documentation for -mdoc.
* libmdoc and libman now using non-recoverable allocations (simpler code).Kristaps Dzonsons2009-10-301-1/+0
|
* Slow movement of internal allocations to fail completely.Kristaps Dzonsons2009-10-281-0/+5
|
* Moved escape validation into libmandoc.h/mandoc.c (common between ↵Kristaps Dzonsons2009-07-041-0/+26
libman/libmdoc1). libman supports MAN_IGN_ESCAPE (like MDOC_IGN_ESCAPE). All popular escapes now handled consistently.