Fixed mingw compatibility where the "z" printf() modifier isn't
recognised. It's easier to make these u_int than to jump through hoops
for a special formatter.
Allow `Sx' and `Ss' to have child nodes. Fixes manuals in NetBSD.
Originally pointed out by joerg@ then again by Thomas Klausner by way of
Nicolas Joy. Note: don't use these constructions as you can't link to
the sections with `Sx'.
Ingo Schwarze [Wed, 3 Aug 2011 21:25:23 +0000 (21:25 +0000)]
Add small chunks of new text and better examples written from scratch,
filling gaps found by checking the MANUAL DOMAIN chapter in mdoc.samples(7).
While here, fix lots of minor issues.
feedback and ok jmc@
Ingo Schwarze [Tue, 2 Aug 2011 01:07:26 +0000 (01:07 +0000)]
The term "reserved terms" is too broad, so narrow it down
to "delimiters", and explain which special handling they get
as macro arguments. Move the text to a better place and remove
a few lies. Postpone figuring out the lists of macros causing
that special handling, it would cost too much time right now.
feedback and ok jmc@
This also brings the file back in sync with OpenBSD.
Ingo Schwarze [Mon, 1 Aug 2011 07:45:11 +0000 (07:45 +0000)]
Add some new text written from scratch after checking whether anything
explained in mdoc.samples(7) is missing from mdoc(7):
* Discourage trailing whitespace.
* Move all information about quoted arguments to the relevant
subsection, shortening it a bit, and adding an example.
* Mention that blanks can be quoted with a backslash.
* A better .Nd line in the template (verbatim from mdoc.samples(7)).
* Explain how to escape callable macro names, and provide examples.
ok jmc@
trivial fixes found while merging to OpenBSD:
* ellipsis is an argument to .Ar, not part of the preceding argument
* libz, libpam, on, off are not placeholders for arguments
* .Rv is not only relevant for system calls, see atexit(3), sem_init(3)
Make sure that in -Tascii mode, predefined strings render the same
way as in groff. With this fix, \*(If, \*(Pi and \*(Tm change in
other output modes, but -Tascii is what matters.
Found when merging 1.11.3 to OpenBSD; ok kristaps@.
Regression fixes after merging 1.11.3 to OpenBSD (rev. 1.20):
* Do not pass integers outside the ASCII range to isprint().
* Make sure escaped characters are really printed verbatim
when the escape sequence has no special meaning.
ok kristaps@
An implementation of `tr'. This routes allocations of TEXT nodes
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.
Move mandoc_hyph() into roff_parsetext() as a single conditional. While
here, do some function renames for clarity and make all function
prototypes be in one place.
First, roff_res() has no need to invoke ROFF_RERUN: since it's executed
before any other roff processing occurs, it's Ok to just let it do its
thing and pass through. Also, make sure this function is ALWAYS called,
not just when first_string is defined.
Second, add a new function, roff_parsetext(), that post-processes
non-macro lines. This, for the time being, amounts to detecting soft
hyphens. This fixes a long-standing bug in that -man now has proper
hyphen breaking!
Move checking of escapes into roff.c, where we're already stepping
through looking for user-defined escapes. This clears up a nice bit of
validation code.
Implement the first steps of equation parsing from within libmdoc.
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.
Scary-looking but otherwise harmless changes allow me to build for Windows.
That is to say, with mingw32. This amounts to the following:
(1) break compat.c into compat_strlcpy.c and compat_strlcat.c
(2) add compat_getsubopt.c (from OpenBSD) and test-getsubopt.c
(3) add test-strptime.c for HAVE_STRPTIME
(4) add ifdef bits here and there, where necessary
(5) remove some harmless unportable stuff (u_char, localtime_r)
I've added the appropriate mdocml.zip target to the Makefile, too.
Add support for tdefine and ndefine. Consolidate some error messages. Add
somem more version notes (getting there). Have the equation nanme be captured.
The circumflex is also a special space character.
Note this and clean up some documentation in eqn.7.
Also add some version notes, although I'm not ready for a release yet.
Add all rendered symbols used by eqn. I use the Second-Edition User's
Manual (1978) for this, so it should catch most of them. They just map
into the mandoc_char escaped characters.
Use a macro instead of doing a string-fragment compare. I just get
worried that I'm going to write the wrong size on both sides of the
equality (I've already done it a few times). This cleans up the code
readability a bit.
Accomodate for hard-spaces with tildes. For now, consider them regular
spaces. Also allow for tabs. Finally, have the parser correctly handle
open and close brackets smooshed against other terms. All of these
handle "details" noted in the CACM paper.
Complete eqn.7 parsing. Features all productions from the original 1975
CACM paper in an LR(1) parse (1 -> eqn_rewind()). Right now the code is
a little jungly, but will clear up as I consolidate parse components.
The AST structure will also be cleaned up, as right now it's pretty ad
hoc (this won't change the parse itself). I added the mandoc_strndup()
function will here.
Finish the eqn syntactic parser. This correctly parses terms and does
the proper `define' dance, which amounts to pure word-replace (you can,
say, define `foo' as `define' then define `define' as something else).
eqn.c is now ready for some semantic parsing of `box' and `eqn'
productions as defined by the grammar.
Make `struct roff' be passed into libmdoc and libman upon creation.
This is required for supporting in-line equations. While here, push
registers properly into roff and add an set/get/mod interface.
Provide implementations of `define', `set', and `unset'.
Tie them into the stream of data.
Document these appropriate, bringing in the grammar as defined by the
original eqn manual (Kernighan/Richie).
Add initial `define' support for eqn(7).
This works by iterating over a simple list. It's a slow, auditable
early implementation. Data is read (the reading function will be
reused) then parsed, then the line re-run if remaining stuff exists.
Note this function isn't the same as mandoc_getarg(), as eqn(7) uses a
different system for reading quoted strings.
This doesn't actually use the defines.
First step of making mandocdb a true makewhatis/mandb replacement:
accept a set of directories on the command line ("manpaths") that are
recursed for files. The databases are created in each manpath root.
This temporarily removes OP_UPDATE and OP_DELETE functionality, which
will be added back in.
Move parts of mandocdb that "do stuff" to the databases into their own
functions. This will make it easier to call repeatedly (for different
directoreis) as must be done with the new interfaces being developed.
Rename makewhatis [back] into mandocdb. This is to maintain consistency
with OpenBSD, which is sandboxing the code for merge. It makes sense
because it doesn't really make a `makewhatis' file in the traditional
sense, so it may be confusing.
Fairly straightforward patch adding basic update (-u) and remove (-r)
functionality to makewhatis. This is somewhat expensive (requiring the
index file to be trawled multiple times), but it's a good start.