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 Import mdocml-1.9.10:



details:   https://anonhg.NetBSD.org/src/rev/55d1af6249d2
branches:  trunk
changeset: 748532:55d1af6249d2
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Oct 26 14:54:01 2009 +0000

description:
Import mdocml-1.9.10:
- allow compile-time override for the OS name
- added support for .PD and .%U
- extend mdoc.7
- switch option select to -O, so that -o can be used for the output
format
- improve portability

diffstat:

 external/bsd/mdocml/dist/html.c          |  30 ++++-----
 external/bsd/mdocml/dist/html.h          |  16 +++--
 external/bsd/mdocml/dist/libman.h        |   3 +-
 external/bsd/mdocml/dist/main.c          |  16 +++--
 external/bsd/mdocml/dist/man.7           |   7 ++-
 external/bsd/mdocml/dist/man.c           |  24 +++++--
 external/bsd/mdocml/dist/man.h           |   5 +-
 external/bsd/mdocml/dist/man_action.c    |   3 +-
 external/bsd/mdocml/dist/man_html.c      |  15 ++---
 external/bsd/mdocml/dist/man_macro.c     |   3 +-
 external/bsd/mdocml/dist/man_term.c      |  71 ++++++++++++------------
 external/bsd/mdocml/dist/man_validate.c  |   3 +-
 external/bsd/mdocml/dist/mandoc.1        |  14 ++--
 external/bsd/mdocml/dist/mdoc.7          |  24 +++++++-
 external/bsd/mdocml/dist/mdoc.c          |   7 +-
 external/bsd/mdocml/dist/mdoc.h          |   7 +-
 external/bsd/mdocml/dist/mdoc_action.c   |  22 ++++++-
 external/bsd/mdocml/dist/mdoc_argv.c     |   3 +-
 external/bsd/mdocml/dist/mdoc_html.c     |  67 +++++++++++++----------
 external/bsd/mdocml/dist/mdoc_macro.c    |   3 +-
 external/bsd/mdocml/dist/mdoc_strings.c  |   3 +-
 external/bsd/mdocml/dist/mdoc_term.c     |  92 +++++++++++++++----------------
 external/bsd/mdocml/dist/mdoc_validate.c |  16 +++--
 external/bsd/mdocml/dist/out.c           |  51 +++++++++++++++++-
 external/bsd/mdocml/dist/out.h           |   5 +-
 external/bsd/mdocml/dist/term.c          |  23 +++----
 26 files changed, 323 insertions(+), 210 deletions(-)

diffs (truncated from 1650 to 300 lines):

diff -r 2dabc4ecfa9d -r 55d1af6249d2 external/bsd/mdocml/dist/html.c
--- a/external/bsd/mdocml/dist/html.c   Mon Oct 26 14:50:45 2009 +0000
+++ b/external/bsd/mdocml/dist/html.c   Mon Oct 26 14:54:01 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: html.c,v 1.65 2009/10/20 05:45:21 kristaps Exp $ */
+/*     $Vendor-Id: html.c,v 1.66 2009/10/26 08:18:15 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -15,7 +15,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include <sys/types.h>
-#include <sys/queue.h>
 
 #include <assert.h>
 #include <err.h>
@@ -102,8 +101,8 @@
        if (NULL == (h = calloc(1, sizeof(struct html))))
                return(NULL);
 
-       SLIST_INIT(&h->tags);
-       SLIST_INIT(&h->ords);
+       h->tags.head = NULL;
+       h->ords.head = NULL;
 
        if (NULL == (h->symtab = chars_init(CHARS_HTML))) {
                free(h);
@@ -138,15 +137,13 @@
 
        h = (struct html *)p;
 
-       while ( ! SLIST_EMPTY(&h->ords)) {
-               ord = SLIST_FIRST(&h->ords);
-               SLIST_REMOVE_HEAD(&h->ords, entry);
+       while ((ord = h->ords.head) != NULL) { 
+               h->ords.head = ord->next;
                free(ord);
        }
 
-       while ( ! SLIST_EMPTY(&h->tags)) {
-               tag = SLIST_FIRST(&h->tags);
-               SLIST_REMOVE_HEAD(&h->tags, entry);
+       while ((tag = h->tags.head) != NULL) {
+               h->tags.head = tag->next;       
                free(tag);
        }
        
@@ -358,7 +355,8 @@
                if (NULL == (t = malloc(sizeof(struct tag))))
                        err(EXIT_FAILURE, "malloc");
                t->tag = tag;
-               SLIST_INSERT_HEAD(&h->tags, t, entry);
+               t->next = h->tags.head;
+               h->tags.head = t;
        } else
                t = NULL;
 
@@ -468,10 +466,9 @@
 {
        struct tag      *tag;
 
-       while ( ! SLIST_EMPTY(&h->tags)) {
-               tag = SLIST_FIRST(&h->tags);
+       while ((tag = h->tags.head) != NULL) {
                print_ctag(h, tag->tag);
-               SLIST_REMOVE_HEAD(&h->tags, entry);
+               h->tags.head = tag->next;
                free(tag);
                if (until && tag == until)
                        return;
@@ -484,12 +481,11 @@
 {
        struct tag      *tag;
 
-       while ( ! SLIST_EMPTY(&h->tags)) {
-               tag = SLIST_FIRST(&h->tags);
+       while ((tag = h->tags.head) != NULL) {
                if (suntil && tag == suntil)
                        return;
                print_ctag(h, tag->tag);
-               SLIST_REMOVE_HEAD(&h->tags, entry);
+               h->tags.head = tag->next;
                free(tag);
        }
 }
diff -r 2dabc4ecfa9d -r 55d1af6249d2 external/bsd/mdocml/dist/html.h
--- a/external/bsd/mdocml/dist/html.h   Mon Oct 26 14:50:45 2009 +0000
+++ b/external/bsd/mdocml/dist/html.h   Mon Oct 26 14:54:01 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: html.h,v 1.13 2009/10/13 10:21:24 kristaps Exp $ */
+/*     $Vendor-Id: html.h,v 1.14 2009/10/26 08:18:16 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -62,18 +62,22 @@
 };
 
 struct tag {
+       struct tag       *next;
        enum htmltag      tag;
-       SLIST_ENTRY(tag)  entry;
 };
 
 struct ord {
-       int               pos;
+       struct ord       *next;
        const void       *cookie;
-       SLIST_ENTRY(ord)  entry;
+       int               pos;
 };
 
-SLIST_HEAD(tagq, tag);
-SLIST_HEAD(ordq, ord);
+struct tagq {
+       struct tag       *head;
+};
+struct ordq {
+       struct ord       *head;
+};
 
 struct htmlpair {
        enum htmlattr     key;
diff -r 2dabc4ecfa9d -r 55d1af6249d2 external/bsd/mdocml/dist/libman.h
--- a/external/bsd/mdocml/dist/libman.h Mon Oct 26 14:50:45 2009 +0000
+++ b/external/bsd/mdocml/dist/libman.h Mon Oct 26 14:54:01 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: libman.h,v 1.21 2009/09/16 14:40:56 kristaps Exp $ */
+/*     $Vendor-Id: libman.h,v 1.22 2009/10/26 07:11:06 kristaps Exp $ */
 /*
  * Copyright (c) 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -54,7 +54,6 @@
        WHEADARGS,
        WBODYARGS,
        WNHEADARGS,
-       WMACRO,
        WMACROFORM,
        WEXITSCOPE,
        WNOSCOPE,
diff -r 2dabc4ecfa9d -r 55d1af6249d2 external/bsd/mdocml/dist/main.c
--- a/external/bsd/mdocml/dist/main.c   Mon Oct 26 14:50:45 2009 +0000
+++ b/external/bsd/mdocml/dist/main.c   Mon Oct 26 14:54:01 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: main.c,v 1.46 2009/10/13 10:57:25 kristaps Exp $ */
+/*     $Vendor-Id: main.c,v 1.49 2009/10/26 08:42:37 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -35,6 +35,7 @@
 
 #ifdef __linux__
 extern int               getsubopt(char **, char * const *, char **);
+extern size_t            strlcat(char *, const char *, size_t);
 # ifndef __dead
 #  define __dead __attribute__((__noreturn__))
 # endif
@@ -88,7 +89,7 @@
        out_man           outman;
        out_free          outfree;
        void             *outdata;
-       char             *outopts;
+       char              outopts[BUFSIZ];
 };
 
 static int               foptions(int *, char *);
@@ -124,7 +125,7 @@
        curp.outtype = OUTT_ASCII;
 
        /* LINTED */
-       while (-1 != (c = getopt(argc, argv, "f:m:o:T:VW:")))
+       while (-1 != (c = getopt(argc, argv, "f:m:O:T:VW:")))
                switch (c) {
                case ('f'):
                        if ( ! foptions(&curp.fflags, optarg))
@@ -134,8 +135,9 @@
                        if ( ! moptions(&curp.inttype, optarg))
                                return(EXIT_FAILURE);
                        break;
-               case ('o'):
-                       curp.outopts = optarg;
+               case ('O'):
+                       (void)strlcat(curp.outopts, optarg, BUFSIZ);
+                       (void)strlcat(curp.outopts, ",", BUFSIZ);
                        break;
                case ('T'):
                        if ( ! toptions(&curp.outtype, optarg))
@@ -221,8 +223,8 @@
 {
 
        (void)fprintf(stderr, "usage: %s [-V] [-foption...] "
-                       "[-mformat] [-Toutput] [-Werr...]\n", 
-                       __progname);
+                       "[-mformat] [-Ooption] [-Toutput] "
+                       "[-Werr...]\n", __progname);
        exit(EXIT_FAILURE);
 }
 
diff -r 2dabc4ecfa9d -r 55d1af6249d2 external/bsd/mdocml/dist/man.7
--- a/external/bsd/mdocml/dist/man.7    Mon Oct 26 14:50:45 2009 +0000
+++ b/external/bsd/mdocml/dist/man.7    Mon Oct 26 14:54:01 2009 +0000
@@ -1,4 +1,4 @@
-.\"    $Vendor-Id: man.7,v 1.39 2009/10/19 07:44:30 kristaps Exp $
+.\"    $Vendor-Id: man.7,v 1.40 2009/10/24 05:45:04 kristaps Exp $
 .\"
 .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
 .\"
@@ -290,6 +290,7 @@
 .It Sx \&I   Ta    n         Ta    next-line
 .It Sx \&IB  Ta    n         Ta    current
 .It Sx \&IR  Ta    n         Ta    current
+.It Sx \&PD  Ta    n         Ta    current
 .It Sx \&R   Ta    n         Ta    next-line
 .It Sx \&RB  Ta    n         Ta    current
 .It Sx \&RI  Ta    n         Ta    current
@@ -308,6 +309,7 @@
 .
 .Pp
 The
+.Sx \&PD ,
 .Sx \&RS ,
 .Sx \&RE ,
 .Sx \&UC ,
@@ -370,6 +372,7 @@
 If a block macro is next-line scoped, it may only be followed by in-line
 macros (excluding
 .Sx \&DT ,
+.Sx \&PD ,
 .Sx \&TH ,
 .Sx \&UC ,
 .Sx \&br ,
@@ -525,6 +528,8 @@
 .Va width
 is specified, it's saved for later paragraph left-margins; if
 unspecified, the saved or default width is used.
+.Ss \&PD
+Has no effect.  Included for compatibility.
 .Ss \&UC
 Has no effect.  Included for compatibility.
 .Ss \&br
diff -r 2dabc4ecfa9d -r 55d1af6249d2 external/bsd/mdocml/dist/man.c
--- a/external/bsd/mdocml/dist/man.c    Mon Oct 26 14:50:45 2009 +0000
+++ b/external/bsd/mdocml/dist/man.c    Mon Oct 26 14:54:01 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: man.c,v 1.41 2009/09/23 11:53:45 kristaps Exp $ */
+/*     $Vendor-Id: man.c,v 1.43 2009/10/26 07:11:06 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -40,7 +40,6 @@
        "expected block head arguments", /* WHEADARGS */
        "expected block body arguments", /* WBODYARGS */
        "expected empty block head", /* WNHEADARGS */
-       "unknown macro", /* WMACRO */
        "ill-formed macro", /* WMACROFORM */
        "scope open on exit", /* WEXITSCOPE */
        "no scope context", /* WNOSCOPE */
@@ -56,7 +55,7 @@
        "R",            "B",            "I",            "IR",
        "RI",           "na",           "i",            "sp",
        "nf",           "fi",           "r",            "RE",
-       "RS",           "DT",           "UC"
+       "RS",           "DT",           "UC",           "PD"
        };
 
 const  char * const *man_macronames = __man_macronames;
@@ -71,6 +70,7 @@
 static int              man_alloc1(struct man *);
 static int              pstring(struct man *, int, int, 
                                const char *, size_t);
+static int              macrowarn(struct man *, int, const char *);
 
 #ifdef __linux__
 extern size_t            strlcpy(char *, const char *, size_t);
@@ -456,6 +456,18 @@
 }
 
 
+static int
+macrowarn(struct man *m, int ln, const char *buf)
+{
+       if ( ! (MAN_IGN_MACRO & m->pflags))
+               return(man_verr(m, ln, 0, 
+                               "unknown macro: %s%s", 
+                               buf, strlen(buf) > 3 ? "..." : ""));
+       return(man_vwarn(m, ln, 0, "unknown macro: %s%s",
+                               buf, strlen(buf) > 3 ? "..." : ""));
+}
+
+
 int
 man_pmacro(struct man *m, int ln, char *buf)
 {
@@ -510,11 +522,7 @@
        }
        
        if (MAN_MAX == (c = man_hash_find(mac))) {
-               if ( ! (MAN_IGN_MACRO & m->pflags)) {
-                       (void)man_perr(m, ln, ppos, WMACRO);
-                       goto err;



Home | Main Index | Thread Index | Old Index