]> git.cameronkatri.com Git - mandoc.git/blobdiff - mdoc.c
Added `%U' to -mdoc (doesn't render in a nice way yet).
[mandoc.git] / mdoc.c
diff --git a/mdoc.c b/mdoc.c
index 9b6e67241441b810be1d2b4dcb10dda7aee09e0d..e4f76c0334658a284cc0362fbf93d8dc98fb3439 100644 (file)
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/*     $Id: mdoc.c,v 1.104 2009/08/22 08:56:16 kristaps Exp $ */
+/*     $Id: mdoc.c,v 1.110 2009/10/24 05:52:13 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
  *
@@ -14,6 +14,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include <sys/types.h>
+
 #include <assert.h>
 #include <ctype.h>
 #include <stdarg.h>
@@ -74,7 +76,9 @@ const char *const __mdoc_merrnames[MERRMAX] = {
        "unclosed explicit scope", /* EOPEN */
        "unterminated quoted phrase", /* EQUOTPHR */
        "closure macro without prior context", /* ENOCTX */
-       "no description found for library" /* ELIB */
+       "no description found for library", /* ELIB */
+       "bad child for parent context", /* EBADCHILD */
+       "list arguments preceding type", /* ENOTYPE */
 };
 
 const  char *const __mdoc_macronames[MDOC_MAX] = {              
@@ -112,7 +116,9 @@ const       char *const __mdoc_macronames[MDOC_MAX] = {
        /* LINTED */
        "Brc",          "\%C",          "Es",           "En",
        /* LINTED */
-       "Dx",           "\%Q",          "br",           "sp"
+       "Dx",           "\%Q",          "br",           "sp",
+       /* LINTED */
+       "\%U"
        };
 
 const  char *const __mdoc_argnames[MDOC_ARG_MAX] = {            
@@ -124,7 +130,7 @@ const       char *const __mdoc_argnames[MDOC_ARG_MAX] = {
        "ohang",                "inset",                "column",        
        "width",                "compact",              "std",   
        "filled",               "words",                "emphasis",
-       "symbolic",             "nested"
+       "symbolic",             "nested",               "centered"
        };
 
 const  char * const *mdoc_macronames = __mdoc_macronames;
@@ -230,8 +236,6 @@ mdoc_free(struct mdoc *mdoc)
 {
 
        mdoc_free1(mdoc);
-       if (mdoc->htab)
-               mdoc_hash_free(mdoc->htab);
        free(mdoc);
 }
 
@@ -249,13 +253,12 @@ mdoc_alloc(void *data, int pflags, const struct mdoc_cb *cb)
        if (cb)
                (void)memcpy(&p->cb, cb, sizeof(struct mdoc_cb));
 
+       mdoc_hash_init();
+
        p->data = data;
        p->pflags = pflags;
 
-       if (NULL == (p->htab = mdoc_hash_alloc())) {
-               free(p);
-               return(NULL);
-       } else if (mdoc_alloc1(p))
+       if (mdoc_alloc1(p))
                return(p);
 
        free(p);
@@ -725,7 +728,7 @@ parsemacro(struct mdoc *m, int ln, char *buf)
                return(1);
        } 
        
-       if (MDOC_MAX == (c = mdoc_hash_find(m->htab, mac))) {
+       if (MDOC_MAX == (c = mdoc_hash_find(mac))) {
                if ( ! macrowarn(m, ln, mac))
                        goto err;
                return(1);