[BACK]Return to mdocml.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/Attic/mdocml.c between version 1.23 and 1.26

version 1.23, 2008/12/17 17:18:38 version 1.26, 2008/12/28 21:25:09
Line 181  buf_begin(struct md_parse *p)
Line 181  buf_begin(struct md_parse *p)
 static void  static void
 print_node(const struct mdoc_node *n, int indent)  print_node(const struct mdoc_node *n, int indent)
 {  {
         const char      *p, *t;          const char       *p, *t;
         int              i;          int               i, j;
           size_t            argc, sz;
           char            **params;
           struct mdoc_arg  *argv;
   
           argv = NULL;
           argc = 0;
           params = NULL;
           sz = 0;
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_TEXT):          case (MDOC_TEXT):
                 assert(NULL == n->child);                  assert(NULL == n->child);
                 p = "<text>";                  p = n->data.text.string;
                 t = "text";                  t = "text";
                 break;                  break;
         case (MDOC_BODY):          case (MDOC_BODY):
Line 197  print_node(const struct mdoc_node *n, int indent)
Line 205  print_node(const struct mdoc_node *n, int indent)
         case (MDOC_HEAD):          case (MDOC_HEAD):
                 p = mdoc_macronames[n->data.head.tok];                  p = mdoc_macronames[n->data.head.tok];
                 t = "block-head";                  t = "block-head";
                   params = n->data.head.args;
                   sz = n->data.head.sz;
                 break;                  break;
         case (MDOC_ELEM):          case (MDOC_ELEM):
                 assert(NULL == n->child);                  assert(NULL == n->child);
                 p = mdoc_macronames[n->data.elem.tok];                  p = mdoc_macronames[n->data.elem.tok];
                 t = "element";                  t = "element";
                   argv = n->data.elem.argv;
                   argc = n->data.elem.argc;
                   params = n->data.elem.args;
                   sz = n->data.elem.sz;
                 break;                  break;
         case (MDOC_BLOCK):          case (MDOC_BLOCK):
                 p = mdoc_macronames[n->data.block.tok];                  p = mdoc_macronames[n->data.block.tok];
                 t = "block";                  t = "block";
                   argv = n->data.block.argv;
                   argc = n->data.block.argc;
                 break;                  break;
         default:          default:
                 abort();                  abort();
Line 214  print_node(const struct mdoc_node *n, int indent)
Line 230  print_node(const struct mdoc_node *n, int indent)
   
         for (i = 0; i < indent; i++)          for (i = 0; i < indent; i++)
                 (void)printf("    ");                  (void)printf("    ");
         (void)printf("%s (%s)\n", p, t);          (void)printf("%s (%s)", p, t);
   
           for (i = 0; i < (int)argc; i++) {
                   (void)printf(" -%s", mdoc_argnames[argv[i].arg]);
                   for (j = 0; j < (int)argv[i].sz; j++)
                           (void)printf(" \"%s\"", argv[i].value[j]);
           }
   
           for (i = 0; i < (int)sz; i++)
                   (void)printf(" \"%s\"", params[i]);
   
           (void)printf("\n");
   
         if (n->child)          if (n->child)
                 print_node(n->child, indent + 1);                  print_node(n->child, indent + 1);
         if (n->next)          if (n->next)
Line 301  msg_err(void *arg, int tok, int col, enum mdoc_err typ
Line 328  msg_err(void *arg, int tok, int col, enum mdoc_err typ
   
         switch (type) {          switch (type) {
         case (ERR_SYNTAX_QUOTE):          case (ERR_SYNTAX_QUOTE):
                   lit = "syntax: disallowed argument quotation";
                   break;
           case (ERR_SYNTAX_UNQUOTE):
                 lit = "syntax: unterminated quotation";                  lit = "syntax: unterminated quotation";
                 break;                  break;
         case (ERR_SYNTAX_WS):          case (ERR_SYNTAX_WS):
                 lit = "syntax: whitespace in argument";                  lit = "syntax: whitespace in argument";
                 break;                  break;
         case (ERR_SYNTAX_ARGS):          case (ERR_SYNTAX_ARGFORM):
                 fmt = "syntax: macro `%s' arguments malformed";                  fmt = "syntax: macro `%s' arguments malformed";
                 break;                  break;
           case (ERR_SYNTAX_ARG):
                   fmt = "syntax: unknown argument for macro `%s'";
                   break;
         case (ERR_SCOPE_BREAK):          case (ERR_SCOPE_BREAK):
                 /* Which scope is broken? */                  /* Which scope is broken? */
                 fmt = "macro `%s' breaks prior explicit scope";                  fmt = "scope: macro `%s' breaks prior explicit scope";
                 break;                  break;
           case (ERR_SCOPE_NOCTX):
                   fmt = "scope: closure macro `%s' has no context";
                   break;
           case (ERR_SCOPE_NONEST):
                   fmt = "scope: macro `%s' may not be nested in the current context";
                   break;
         case (ERR_MACRO_NOTSUP):          case (ERR_MACRO_NOTSUP):
                 fmt = "macro `%s' not supported";                  fmt = "macro `%s' not supported";
                 break;                  break;
Line 340  msg_err(void *arg, int tok, int col, enum mdoc_err typ
Line 379  msg_err(void *arg, int tok, int col, enum mdoc_err typ
         case (ERR_SEC_NAME):          case (ERR_SEC_NAME):
                 lit = "`NAME' section must be first";                  lit = "`NAME' section must be first";
                 break;                  break;
           case (ERR_SYNTAX_ARGVAL):
                   lit = "syntax: expected value for macro argument";
                   break;
           case (ERR_SYNTAX_ARGBAD):
                   lit = "syntax: invalid value for macro argument";
                   break;
           case (ERR_SYNTAX_ARGMANY):
                   lit = "syntax: too many values for macro argument";
                   break;
         default:          default:
                 abort();                  abort();
                 /* NOTREACHED */                  /* NOTREACHED */
Line 419  msg_warn(void *arg, int tok, int col, enum mdoc_warn t
Line 467  msg_warn(void *arg, int tok, int col, enum mdoc_warn t
         case (WARN_SYNTAX_WS_EOLN):          case (WARN_SYNTAX_WS_EOLN):
                 lit = "syntax: whitespace at end-of-line";                  lit = "syntax: whitespace at end-of-line";
                 break;                  break;
           case (WARN_SYNTAX_QUOTED):
                   lit = "syntax: quotation mark starting string";
                   break;
         case (WARN_SYNTAX_MACLIKE):          case (WARN_SYNTAX_MACLIKE):
                 lit = "syntax: macro-like argument";                  lit = "syntax: macro-like argument";
                 break;                  break;
           case (WARN_SYNTAX_ARGLIKE):
                   lit = "syntax: argument-like value";
                   break;
         case (WARN_SEC_OO):          case (WARN_SEC_OO):
                 lit = "section is out of conventional order";                  lit = "section is out of conventional order";
                 break;                  break;
         case (WARN_ARGS_GE1):          case (WARN_ARGS_GE1):
                 fmt = "macro `%s' suggests one or more arguments";                  fmt = "macro `%s' suggests one or more arguments";
                   break;
           case (WARN_ARGS_EQ0):
                   fmt = "macro `%s' suggests zero arguments";
                   break;
           case (WARN_IGN_AFTER_BLK):
                   fmt = "ignore: macro `%s' ignored after block macro";
                   break;
           case (WARN_IGN_BEFORE_BLK):
                   fmt = "ignore: macro before block macro `%s' ignored";
                 break;                  break;
         default:          default:
                 abort();                  abort();

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.26

CVSweb