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.5
details: https://anonhg.NetBSD.org/src/rev/85a8d11f07a0
branches: trunk
changeset: 756666:85a8d11f07a0
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Jul 27 22:40:24 2010 +0000
description:
Merge mdocml 1.10.5
diffstat:
external/bsd/mdocml/dist/man_term.c | 101 ++++++++++++++++++++++----------
external/bsd/mdocml/dist/mdoc_action.c | 9 ++-
external/bsd/mdocml/dist/mdoc_term.c | 30 +++++----
3 files changed, 94 insertions(+), 46 deletions(-)
diffs (283 lines):
diff -r c227238aaa06 -r 85a8d11f07a0 external/bsd/mdocml/dist/man_term.c
--- a/external/bsd/mdocml/dist/man_term.c Tue Jul 27 22:34:54 2010 +0000
+++ b/external/bsd/mdocml/dist/man_term.c Tue Jul 27 22:40:24 2010 +0000
@@ -1,6 +1,6 @@
-/* $Vendor-Id: man_term.c,v 1.79 2010/07/07 15:04:54 kristaps Exp $ */
+/* $Vendor-Id: man_term.c,v 1.84 2010/07/23 13:22:35 kristaps Exp $ */
/*
- * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
+ * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -92,10 +92,9 @@
static int pre_SH(DECL_ARGS);
static int pre_SS(DECL_ARGS);
static int pre_TP(DECL_ARGS);
-static int pre_br(DECL_ARGS);
-static int pre_fi(DECL_ARGS);
static int pre_ign(DECL_ARGS);
-static int pre_nf(DECL_ARGS);
+static int pre_in(DECL_ARGS);
+static int pre_literal(DECL_ARGS);
static int pre_sp(DECL_ARGS);
static void post_IP(DECL_ARGS);
@@ -106,7 +105,7 @@
static void post_TP(DECL_ARGS);
static const struct termact termacts[MAN_MAX] = {
- { pre_br, NULL, MAN_NOTEXT }, /* br */
+ { pre_sp, NULL, MAN_NOTEXT }, /* br */
{ NULL, NULL, 0 }, /* TH */
{ pre_SH, post_SH, 0 }, /* SH */
{ pre_SS, post_SS, 0 }, /* SS */
@@ -130,8 +129,8 @@
{ NULL, NULL, MAN_NOTEXT }, /* na */
{ pre_I, NULL, 0 }, /* i */
{ pre_sp, NULL, MAN_NOTEXT }, /* sp */
- { pre_nf, NULL, 0 }, /* nf */
- { pre_fi, NULL, 0 }, /* fi */
+ { pre_literal, NULL, 0 }, /* nf */
+ { pre_literal, NULL, 0 }, /* fi */
{ NULL, NULL, 0 }, /* r */
{ NULL, NULL, 0 }, /* RE */
{ pre_RS, post_RS, 0 }, /* RS */
@@ -139,9 +138,10 @@
{ pre_ign, NULL, 0 }, /* UC */
{ pre_ign, NULL, 0 }, /* PD */
{ pre_sp, NULL, MAN_NOTEXT }, /* Sp */
- { pre_nf, NULL, 0 }, /* Vb */
- { pre_fi, NULL, 0 }, /* Ve */
+ { pre_literal, NULL, 0 }, /* Vb */
+ { pre_literal, NULL, 0 }, /* Ve */
{ pre_ign, NULL, 0 }, /* AT */
+ { pre_in, NULL, MAN_NOTEXT }, /* in */
};
@@ -249,23 +249,25 @@
/* ARGSUSED */
static int
-pre_fi(DECL_ARGS)
+pre_literal(DECL_ARGS)
{
- mt->fl &= ~MANT_LITERAL;
+ term_newln(p);
+ switch (n->tok) {
+ case (MAN_Vb):
+ /* FALLTHROUGH */
+ case (MAN_nf):
+ mt->fl |= MANT_LITERAL;
+ return(MAN_Vb != n->tok);
+ default:
+ mt->fl &= ~MANT_LITERAL;
+ break;
+ }
+
return(1);
}
-/* ARGSUSED */
-static int
-pre_nf(DECL_ARGS)
-{
-
- mt->fl |= MANT_LITERAL;
- return(MAN_Vb != n->tok);
-}
-
/* ARGSUSED */
static int
@@ -353,17 +355,40 @@
/* ARGSUSED */
static int
-pre_sp(DECL_ARGS)
+pre_in(DECL_ARGS)
{
- size_t i, len;
+ int len, less;
+ size_t v;
+ const char *cp;
+
+ term_newln(p);
+
+ if (NULL == n->child) {
+ p->offset = mt->offset;
+ return(0);
+ }
+
+ cp = n->child->string;
+ less = 0;
- len = n->child ?
- a2height(p, n->child->string) : term_len(p, 1);
+ if ('-' == *cp)
+ less = -1;
+ else if ('+' == *cp)
+ less = 1;
+ else
+ cp--;
- if (0 == len)
- term_newln(p);
- for (i = 0; i <= len; i++)
- term_vspace(p);
+ if ((len = a2width(p, ++cp)) < 0)
+ return(0);
+
+ v = (size_t)len;
+
+ if (less < 0)
+ p->offset -= p->offset > v ? v : p->offset;
+ else if (less > 0)
+ p->offset += v;
+ else
+ p->offset = v;
return(0);
}
@@ -371,10 +396,24 @@
/* ARGSUSED */
static int
-pre_br(DECL_ARGS)
+pre_sp(DECL_ARGS)
{
+ size_t i, len;
- term_newln(p);
+ switch (n->tok) {
+ case (MAN_br):
+ len = 0;
+ break;
+ default:
+ len = n->child ? a2height(p, n->child->string) : 1;
+ break;
+ }
+
+ if (0 == len)
+ term_newln(p);
+ for (i = 0; i < len; i++)
+ term_vspace(p);
+
return(0);
}
diff -r c227238aaa06 -r 85a8d11f07a0 external/bsd/mdocml/dist/mdoc_action.c
--- a/external/bsd/mdocml/dist/mdoc_action.c Tue Jul 27 22:34:54 2010 +0000
+++ b/external/bsd/mdocml/dist/mdoc_action.c Tue Jul 27 22:40:24 2010 +0000
@@ -1,6 +1,6 @@
-/* $Vendor-Id: mdoc_action.c,v 1.75 2010/07/04 21:59:30 kristaps Exp $ */
+/* $Vendor-Id: mdoc_action.c,v 1.77 2010/07/26 13:45:49 kristaps Exp $ */
/*
- * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
+ * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -904,6 +904,11 @@
{
char buf[DATESIZ];
+ if (NULL == n->child) {
+ m->meta.date = time(NULL);
+ return(post_prol(m, n));
+ }
+
if ( ! concat(m, buf, n->child, DATESIZ))
return(0);
diff -r c227238aaa06 -r 85a8d11f07a0 external/bsd/mdocml/dist/mdoc_term.c
--- a/external/bsd/mdocml/dist/mdoc_term.c Tue Jul 27 22:34:54 2010 +0000
+++ b/external/bsd/mdocml/dist/mdoc_term.c Tue Jul 27 22:40:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $Vendor-Id: mdoc_term.c,v 1.173 2010/07/07 15:04:54 kristaps Exp $ */
+/* $Vendor-Id: mdoc_term.c,v 1.179 2010/07/27 08:38:04 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
* Copyright (c) 2010 Ingo Schwarze <schwarze%openbsd.org@localhost>
@@ -151,7 +151,7 @@
{ termp_bl_pre, termp_bl_post }, /* Bl */
{ NULL, NULL }, /* El */
{ termp_it_pre, termp_it_post }, /* It */
- { NULL, NULL }, /* Ad */
+ { termp_under_pre, NULL }, /* Ad */
{ termp_an_pre, termp_an_post }, /* An */
{ termp_under_pre, NULL }, /* Ar */
{ termp_cd_pre, NULL }, /* Cd */
@@ -208,7 +208,7 @@
{ termp_under_pre, NULL }, /* Em */
{ NULL, NULL }, /* Eo */
{ termp_xx_pre, NULL }, /* Fx */
- { termp_bold_pre, NULL }, /* Ms */ /* FIXME: convert to symbol? */
+ { termp_bold_pre, NULL }, /* Ms */
{ NULL, NULL }, /* No */
{ termp_ns_pre, NULL }, /* Ns */
{ termp_xx_pre, NULL }, /* Nx */
@@ -1026,7 +1026,8 @@
if (NULL == n->child && NULL == m->name)
return(0);
- synopsis_pre(p, n);
+ if (MDOC_HEAD == n->type)
+ synopsis_pre(p, n->parent);
if (MDOC_HEAD == n->type && n->next->child) {
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_HANG;
@@ -1620,8 +1621,7 @@
static int
termp_bd_pre(DECL_ARGS)
{
- size_t tabwidth;
- size_t rm, rmax;
+ size_t tabwidth, rm, rmax;
const struct mdoc_node *nn;
if (MDOC_BLOCK == n->type) {
@@ -1653,12 +1653,9 @@
p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
for (nn = n->child; nn; nn = nn->next) {
- p->flags |= TERMP_NOSPACE;
+ if (nn->prev && nn->prev->line < nn->line)
+ term_newln(p);
print_mdoc_node(p, pair, m, nn);
- if (NULL == nn->prev ||
- nn->prev->line < nn->line ||
- NULL == nn->next)
- term_flushln(p);
}
p->tabwidth = tabwidth;
@@ -1905,6 +1902,11 @@
len = 0;
break;
default:
+ assert(n->parent);
+ if ((NULL == n->next || NULL == n->prev) &&
+ (MDOC_Ss == n->parent->tok ||
+ MDOC_Sh == n->parent->tok))
+ return(0);
len = 1;
break;
}
@@ -2066,9 +2068,11 @@
{
assert(n->child && MDOC_TEXT == n->child->type);
- if (0 == strcmp("on", n->child->string))
+ if (0 == strcmp("on", n->child->string)) {
+ if (p->col)
+ p->flags &= ~TERMP_NOSPACE;
p->flags &= ~TERMP_NONOSPACE;
- else
+ } else
p->flags |= TERMP_NONOSPACE;
return(0);
Home |
Main Index |
Thread Index |
Old Index