Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/mdocml/dist Merge changes for mdocml-1.12.0.
details: https://anonhg.NetBSD.org/src/rev/afb47574a0c7
branches: trunk
changeset: 770299:afb47574a0c7
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Oct 11 19:12:13 2011 +0000
description:
Merge changes for mdocml-1.12.0.
diffstat:
external/bsd/mdocml/dist/compat.c | 95 ----
external/bsd/mdocml/dist/lib.in | 5 +-
external/bsd/mdocml/dist/man_term.c | 192 ++++----
external/bsd/mdocml/dist/mandoc-db.1 | 132 ------
external/bsd/mdocml/dist/mandoc-db.c | 669 -------------------------------
external/bsd/mdocml/dist/mdoc_argv.c | 523 ++++++++++-------------
external/bsd/mdocml/dist/mdoc_term.c | 80 +--
external/bsd/mdocml/dist/mdoc_validate.c | 119 ++---
external/bsd/mdocml/dist/read.c | 93 +++-
external/bsd/mdocml/dist/roff.c | 668 +++++++++++++++++++++++-------
external/bsd/mdocml/dist/tbl.c | 8 +-
external/bsd/mdocml/dist/tbl_layout.c | 31 +-
external/bsd/mdocml/dist/tbl_opts.c | 4 +-
13 files changed, 1033 insertions(+), 1586 deletions(-)
diffs (truncated from 4033 to 300 lines):
diff -r 5cbf9ce97ddc -r afb47574a0c7 external/bsd/mdocml/dist/compat.c
--- a/external/bsd/mdocml/dist/compat.c Tue Oct 11 19:09:36 2011 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller%courtesan.com@localhost>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <sys/types.h>
-#include <string.h>
-
-int dummy; /* To prevent an empty object file */
-
-#ifndef HAVE_STRLCAT
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
- * Returns strlen(src) + MIN(siz, strlen(initial dst)).
- * If retval >= siz, truncation occurred.
- */
-size_t
-strlcat(char *dst, const char *src, size_t siz)
-{
- char *d = dst;
- const char *s = src;
- size_t n = siz;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (n-- != 0 && *d != '\0')
- d++;
- dlen = d - dst;
- n = siz - dlen;
-
- if (n == 0)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1) {
- *d++ = *s;
- n--;
- }
- s++;
- }
- *d = '\0';
-
- return(dlen + (s - src)); /* count does not include NUL */
-}
-#endif
-
-#ifndef HAVE_STRLCPY
-/*
- * Copy src to string dst of size siz. At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-size_t
-strlcpy(char *dst, const char *src, size_t siz)
-{
- char *d = dst;
- const char *s = src;
- size_t n = siz;
-
- /* Copy as many bytes as will fit */
- if (n != 0) {
- while (--n != 0) {
- if ((*d++ = *s++) == '\0')
- break;
- }
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0) {
- if (siz != 0)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
-#endif
diff -r 5cbf9ce97ddc -r afb47574a0c7 external/bsd/mdocml/dist/lib.in
--- a/external/bsd/mdocml/dist/lib.in Tue Oct 11 19:09:36 2011 +0000
+++ b/external/bsd/mdocml/dist/lib.in Tue Oct 11 19:12:13 2011 +0000
@@ -1,4 +1,4 @@
-/* $Vendor-Id: lib.in,v 1.9 2010/06/19 20:46:27 kristaps Exp $ */
+/* $Vendor-Id: lib.in,v 1.10 2011/09/20 23:36:24 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
*
@@ -40,8 +40,9 @@
LINE("libdevinfo", "Device and Resource Information Utility Library (libdevinfo, \\-ldevinfo)")
LINE("libdevstat", "Device Statistics Library (libdevstat, \\-ldevstat)")
LINE("libdisk", "Interface to Slice and Partition Labels Library (libdisk, \\-ldisk)")
+LINE("libdwarf", "DWARF Access Library (libdwarf, \\-ldwarf)")
LINE("libedit", "Command Line Editor Library (libedit, \\-ledit)")
-LINE("libelf", "ELF Parsing Library (libelf, \\-lelf)")
+LINE("libelf", "ELF Access Library (libelf, \\-lelf)")
LINE("libevent", "Event Notification Library (libevent, \\-levent)")
LINE("libfetch", "File Transfer Library for URLs (libfetch, \\-lfetch)")
LINE("libform", "Curses Form Library (libform, \\-lform)")
diff -r 5cbf9ce97ddc -r afb47574a0c7 external/bsd/mdocml/dist/man_term.c
--- a/external/bsd/mdocml/dist/man_term.c Tue Oct 11 19:09:36 2011 +0000
+++ b/external/bsd/mdocml/dist/man_term.c Tue Oct 11 19:12:13 2011 +0000
@@ -1,4 +1,4 @@
-/* $Vendor-Id: man_term.c,v 1.105 2011/03/22 10:13:01 kristaps Exp $ */
+/* $Vendor-Id: man_term.c,v 1.121 2011/09/21 09:57:13 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze%openbsd.org@localhost>
@@ -33,29 +33,19 @@
#include "term.h"
#include "main.h"
-#define INDENT 7
-#define HALFINDENT 3
+#define INDENT 7 /* fixed-width char full-indent */
+#define HALFINDENT 3 /* fixed-width char half-indent */
+#define MAXMARGINS 64 /* maximum number of indented scopes */
/* FIXME: have PD set the default vspace width. */
struct mtermp {
int fl;
#define MANT_LITERAL (1 << 0)
- /*
- * Default amount to indent the left margin after leading text
- * has been printed (e.g., `HP' left-indent, `TP' and `IP' body
- * indent). This needs to be saved because `HP' and so on, if
- * not having a specified value, must default.
- *
- * Note that this is the indentation AFTER the left offset, so
- * the total offset is usually offset + lmargin.
- */
- size_t lmargin;
- /*
- * The default offset, i.e., the amount between any text and the
- * page boundary.
- */
- size_t offset;
+ size_t lmargin[MAXMARGINS]; /* margins (incl. visible page) */
+ int lmargincur; /* index of current margin */
+ int lmarginsz; /* actual number of nested margins */
+ size_t offset; /* default offset to visible page */
};
#define DECL_ARGS struct termp *p, \
@@ -156,14 +146,7 @@
p->tabwidth = term_len(p, 5);
if (NULL == p->symtab)
- switch (p->enc) {
- case (TERMENC_ASCII):
- p->symtab = chars_init(CHARS_ASCII);
- break;
- default:
- abort();
- /* NOTREACHED */
- }
+ p->symtab = mchars_alloc();
n = man_node(man);
m = man_meta(man);
@@ -171,8 +154,9 @@
term_begin(p, print_man_head, print_man_foot, m);
p->flags |= TERMP_NOSPACE;
- mt.fl = 0;
- mt.lmargin = term_len(p, INDENT);
+ memset(&mt, 0, sizeof(struct mtermp));
+
+ mt.lmargin[mt.lmargincur] = term_len(p, INDENT);
mt.offset = term_len(p, INDENT);
if (n->child)
@@ -188,7 +172,7 @@
struct roffsu su;
if ( ! a2roffsu(cp, &su, SCALE_VS))
- SCALE_VS_INIT(&su, term_strlen(p, cp));
+ SCALE_VS_INIT(&su, atoi(cp));
return(term_vspan(p, &su));
}
@@ -205,27 +189,31 @@
return((int)term_hspan(p, &su));
}
-
+/*
+ * Printing leading vertical space before a block.
+ * This is used for the paragraph macros.
+ * The rules are pretty simple, since there's very little nesting going
+ * on here. Basically, if we're the first within another block (SS/SH),
+ * then don't emit vertical space. If we are (RS), then do. If not the
+ * first, print it.
+ */
static void
print_bvspace(struct termp *p, const struct man_node *n)
{
+
term_newln(p);
- if (n->body && n->body->child && MAN_TBL == n->body->child->type)
- return;
+ if (n->body && n->body->child)
+ if (MAN_TBL == n->body->child->type)
+ return;
- if (NULL == n->prev)
- return;
-
- if (MAN_SS == n->prev->tok)
- return;
- if (MAN_SH == n->prev->tok)
- return;
+ if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok)
+ if (NULL == n->prev)
+ return;
term_vspace(p);
}
-
/* ARGSUSED */
static int
pre_ign(DECL_ARGS)
@@ -257,6 +245,18 @@
else
mt->fl &= ~MANT_LITERAL;
+ /*
+ * Unlike .IP and .TP, .HP does not have a HEAD.
+ * So in case a second call to term_flushln() is needed,
+ * indentation has to be set up explicitly.
+ */
+ if (MAN_HP == n->parent->tok && p->rmargin < p->maxrmargin) {
+ p->offset = p->rmargin;
+ p->rmargin = p->maxrmargin;
+ p->flags &= ~(TERMP_NOBREAK | TERMP_TWOSPACE);
+ p->flags |= TERMP_NOSPACE;
+ }
+
return(0);
}
@@ -414,6 +414,13 @@
{
size_t i, len;
+ if ((NULL == n->prev && n->parent)) {
+ if (MAN_SS == n->parent->tok)
+ return(0);
+ if (MAN_SH == n->parent->tok)
+ return(0);
+ }
+
switch (n->tok) {
case (MAN_br):
len = 0;
@@ -436,7 +443,7 @@
static int
pre_HP(DECL_ARGS)
{
- size_t len;
+ size_t len, one;
int ival;
const struct man_node *nn;
@@ -452,7 +459,7 @@
return(0);
}
- len = mt->lmargin;
+ len = mt->lmargin[mt->lmargincur];
ival = -1;
/* Calculate offset. */
@@ -461,14 +468,15 @@
if ((ival = a2width(p, nn->string)) >= 0)
len = (size_t)ival;
Home |
Main Index |
Thread Index |
Old Index