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 mdocml 1.10.4
details: https://anonhg.NetBSD.org/src/rev/2f65b5dbd25c
branches: trunk
changeset: 756592:2f65b5dbd25c
user: joerg <joerg%NetBSD.org@localhost>
date: Sun Jul 25 19:12:40 2010 +0000
description:
Merge mdocml 1.10.4
diffstat:
external/bsd/mdocml/dist/man_term.c | 80 +++----
external/bsd/mdocml/dist/mdoc_action.c | 56 +++--
external/bsd/mdocml/dist/mdoc_term.c | 322 +++++++++++++++++++-------------
3 files changed, 265 insertions(+), 193 deletions(-)
diffs (truncated from 1096 to 300 lines):
diff -r 47fa8b1d4c53 -r 2f65b5dbd25c external/bsd/mdocml/dist/man_term.c
--- a/external/bsd/mdocml/dist/man_term.c Sun Jul 25 19:10:40 2010 +0000
+++ b/external/bsd/mdocml/dist/man_term.c Sun Jul 25 19:12:40 2010 +0000
@@ -1,4 +1,4 @@
-/* $Vendor-Id: man_term.c,v 1.76 2010/06/19 20:46:28 kristaps Exp $ */
+/* $Vendor-Id: man_term.c,v 1.79 2010/07/07 15:04:54 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
*
@@ -70,8 +70,8 @@
#define MAN_NOTEXT (1 << 0) /* Never has text children. */
};
-static int a2width(const struct man_node *);
-static int a2height(const struct man_node *);
+static int a2width(const struct termp *, const char *);
+static size_t a2height(const struct termp *, const char *);
static void print_man_nodelist(DECL_ARGS);
static void print_man_node(DECL_ARGS);
@@ -158,7 +158,7 @@
p->overstep = 0;
p->maxrmargin = p->defrmargin;
- p->tabwidth = 5;
+ p->tabwidth = term_len(p, 5);
if (NULL == p->symtab)
switch (p->enc) {
@@ -177,8 +177,8 @@
p->flags |= TERMP_NOSPACE;
mt.fl = 0;
- mt.lmargin = INDENT;
- mt.offset = INDENT;
+ mt.lmargin = term_len(p, INDENT);
+ mt.offset = term_len(p, INDENT);
if (n->child)
print_man_nodelist(p, &mt, n->child, m);
@@ -187,31 +187,27 @@
}
-static int
-a2height(const struct man_node *n)
+static size_t
+a2height(const struct termp *p, const char *cp)
{
struct roffsu su;
- assert(MAN_TEXT == n->type);
- assert(n->string);
- if ( ! a2roffsu(n->string, &su, SCALE_VS))
- SCALE_VS_INIT(&su, strlen(n->string));
+ if ( ! a2roffsu(cp, &su, SCALE_VS))
+ SCALE_VS_INIT(&su, term_strlen(p, cp));
- return((int)term_vspan(&su));
+ return(term_vspan(p, &su));
}
static int
-a2width(const struct man_node *n)
+a2width(const struct termp *p, const char *cp)
{
struct roffsu su;
- assert(MAN_TEXT == n->type);
- assert(n->string);
- if ( ! a2roffsu(n->string, &su, SCALE_BU))
+ if ( ! a2roffsu(cp, &su, SCALE_BU))
return(-1);
- return((int)term_hspan(&su));
+ return((int)term_hspan(p, &su));
}
@@ -359,9 +355,10 @@
static int
pre_sp(DECL_ARGS)
{
- int i, len;
+ size_t i, len;
- len = n->child ? a2height(n->child) : 1;
+ len = n->child ?
+ a2height(p, n->child->string) : term_len(p, 1);
if (0 == len)
term_newln(p);
@@ -408,11 +405,11 @@
/* Calculate offset. */
if (NULL != (nn = n->parent->head->child))
- if ((ival = a2width(nn)) >= 0)
+ if ((ival = a2width(p, nn->string)) >= 0)
len = (size_t)ival;
if (0 == len)
- len = 1;
+ len = term_len(p, 1);
p->offset = mt->offset;
p->rmargin = mt->offset + len;
@@ -453,7 +450,7 @@
switch (n->type) {
case (MAN_BLOCK):
- mt->lmargin = INDENT;
+ mt->lmargin = term_len(p, INDENT);
print_bvspace(p, n);
break;
default:
@@ -497,7 +494,7 @@
if (NULL != (nn = nn->next)) {
for ( ; nn->next; nn = nn->next)
/* Do nothing. */ ;
- if ((ival = a2width(nn)) >= 0)
+ if ((ival = a2width(p, nn->string)) >= 0)
len = (size_t)ival;
}
@@ -505,7 +502,7 @@
case (MAN_HEAD):
/* Handle zero-width lengths. */
if (0 == len)
- len = 1;
+ len = term_len(p, 1);
p->offset = mt->offset;
p->rmargin = mt->offset + len;
@@ -585,7 +582,7 @@
while (nn && MAN_TEXT != nn->type)
nn = nn->next;
if (nn && nn->next)
- if ((ival = a2width(nn)) >= 0)
+ if ((ival = a2width(p, nn->string)) >= 0)
len = (size_t)ival;
}
@@ -593,7 +590,7 @@
case (MAN_HEAD):
/* Handle zero-length properly. */
if (0 == len)
- len = 1;
+ len = term_len(p, 1);
p->offset = mt->offset;
p->rmargin = mt->offset + len;
@@ -648,8 +645,8 @@
switch (n->type) {
case (MAN_BLOCK):
- mt->lmargin = INDENT;
- mt->offset = INDENT;
+ mt->lmargin = term_len(p, INDENT);
+ mt->offset = term_len(p, INDENT);
/* If following a prior empty `SS', no vspace. */
if (n->prev && MAN_SS == n->prev->tok)
if (NULL == n->prev->body->child)
@@ -660,7 +657,7 @@
break;
case (MAN_HEAD):
term_fontrepl(p, TERMFONT_BOLD);
- p->offset = HALFINDENT;
+ p->offset = term_len(p, HALFINDENT);
break;
case (MAN_BODY):
p->offset = mt->offset;
@@ -698,8 +695,8 @@
switch (n->type) {
case (MAN_BLOCK):
- mt->lmargin = INDENT;
- mt->offset = INDENT;
+ mt->lmargin = term_len(p, INDENT);
+ mt->offset = term_len(p, INDENT);
/* If following a prior empty `SH', no vspace. */
if (n->prev && MAN_SH == n->prev->tok)
if (NULL == n->prev->body->child)
@@ -760,15 +757,15 @@
}
if (NULL == (nn = n->parent->head->child)) {
- mt->offset = mt->lmargin + INDENT;
+ mt->offset = mt->lmargin + term_len(p, INDENT);
p->offset = mt->offset;
return(1);
}
- if ((ival = a2width(nn)) < 0)
+ if ((ival = a2width(p, nn->string)) < 0)
return(1);
- mt->offset = INDENT + (size_t)ival;
+ mt->offset = term_len(p, INDENT) + (size_t)ival;
p->offset = mt->offset;
return(1);
@@ -782,13 +779,13 @@
switch (n->type) {
case (MAN_BLOCK):
- mt->offset = mt->lmargin = INDENT;
+ mt->offset = mt->lmargin = term_len(p, INDENT);
break;
case (MAN_HEAD):
break;
default:
term_newln(p);
- p->offset = INDENT;
+ p->offset = term_len(p, INDENT);
break;
}
}
@@ -877,7 +874,7 @@
term_vspace(p);
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
- p->rmargin = p->maxrmargin - strlen(buf);
+ p->rmargin = p->maxrmargin - term_strlen(p, buf);
p->offset = 0;
if (meta->source)
@@ -918,14 +915,15 @@
if (m->vol)
strlcpy(buf, m->vol, BUFSIZ);
- buflen = strlen(buf);
+ buflen = term_strlen(p, buf);
snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec);
- titlen = strlen(title);
+ titlen = term_strlen(p, title);
p->offset = 0;
p->rmargin = 2 * (titlen+1) + buflen < p->maxrmargin ?
- (p->maxrmargin - strlen(buf) + 1) / 2 :
+ (p->maxrmargin -
+ term_strlen(p, buf) + term_len(p, 1)) / 2 :
p->maxrmargin - buflen;
p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
diff -r 47fa8b1d4c53 -r 2f65b5dbd25c external/bsd/mdocml/dist/mdoc_action.c
--- a/external/bsd/mdocml/dist/mdoc_action.c Sun Jul 25 19:10:40 2010 +0000
+++ b/external/bsd/mdocml/dist/mdoc_action.c Sun Jul 25 19:12:40 2010 +0000
@@ -1,4 +1,4 @@
-/* $Vendor-Id: mdoc_action.c,v 1.71 2010/06/19 20:46:28 kristaps Exp $ */
+/* $Vendor-Id: mdoc_action.c,v 1.75 2010/07/04 21:59:30 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
*
@@ -32,6 +32,11 @@
#include "libmdoc.h"
#include "libmandoc.h"
+/*
+ * FIXME: this file is deprecated. All future "actions" should be
+ * pushed into mdoc_validate.c.
+ */
+
#define POST_ARGS struct mdoc *m, struct mdoc_node *n
#define PRE_ARGS struct mdoc *m, struct mdoc_node *n
@@ -452,6 +457,17 @@
if (SEC_NONE == m->lastnamed || SEC_CUSTOM != sec)
m->lastnamed = sec;
+ /*
+ * Switch the parser's SYNOPSIS mode, to be copied
+ * into individual nodes when creating them.
+ * Note that this mode can also be set and unset
+ * using the roff nS register.
+ */
+ if (SEC_SYNOPSIS == sec)
+ m->flags |= MDOC_SYNOPSIS;
+ else
+ m->flags &= ~MDOC_SYNOPSIS;
+
/* Some sections only live in certain manual sections. */
switch ((m->lastsec = sec)) {
@@ -680,7 +696,7 @@
n->args->argv[i].value[0] = mandoc_strdup(buf);
/* Set our width! */
- n->data.Bl.width = n->args->argv[i].value[0];
+ n->data.Bl->width = n->args->argv[i].value[0];
return(1);
}
@@ -703,9 +719,9 @@
* the macro's width as set in share/tmac/mdoc/doc-common.
*/
- if (0 == strcmp(n->data.Bl.width, "Ds"))
+ if (0 == strcmp(n->data.Bl->width, "Ds"))
Home |
Main Index |
Thread Index |
Old Index