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

Diff for /mandoc/tree.c between version 1.44 and 1.51

version 1.44, 2011/07/21 23:30:39 version 1.51, 2014/03/08 15:50:41
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
    * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 58  print_mdoc(const struct mdoc_node *n, int indent)
Line 59  print_mdoc(const struct mdoc_node *n, int indent)
 {  {
         const char       *p, *t;          const char       *p, *t;
         int               i, j;          int               i, j;
         size_t            argc, sz;          size_t            argc;
         char            **params;  
         struct mdoc_argv *argv;          struct mdoc_argv *argv;
   
         argv = NULL;          argv = NULL;
         argc = sz = 0;          argc = 0;
         params = NULL;  
         t = p = NULL;          t = p = NULL;
   
         switch (n->type) {          switch (n->type) {
Line 161  print_mdoc(const struct mdoc_node *n, int indent)
Line 160  print_mdoc(const struct mdoc_node *n, int indent)
                         if (argv[i].sz > 0)                          if (argv[i].sz > 0)
                                 printf(" ]");                                  printf(" ]");
                 }                  }
   
                 for (i = 0; i < (int)sz; i++)  
                         printf(" [%s]", params[i]);  
   
                 printf(" %d:%d\n", n->line, n->pos);                  putchar(' ');
                   if (MDOC_LINE & n->flags)
                           putchar('*');
                   printf("%d:%d", n->line, n->pos);
                   if (n->lastline != n->line)
                           printf("-%d", n->lastline);
                   putchar('\n');
         }          }
   
         if (n->child)          if (n->child)
Line 250  print_man(const struct man_node *n, int indent)
Line 252  print_man(const struct man_node *n, int indent)
         } else {          } else {
                 for (i = 0; i < indent; i++)                  for (i = 0; i < indent; i++)
                         putchar('\t');                          putchar('\t');
                 printf("%s (%s) %d:%d\n", p, t, n->line, n->pos);                  printf("%s (%s) ", p, t);
                   if (MAN_LINE & n->flags)
                           putchar('*');
                   printf("%d:%d\n", n->line, n->pos);
         }          }
   
         if (n->child)          if (n->child)
Line 263  static void
Line 268  static void
 print_box(const struct eqn_box *ep, int indent)  print_box(const struct eqn_box *ep, int indent)
 {  {
         int              i;          int              i;
           const char      *t;
   
         if (NULL == ep)          if (NULL == ep)
                 return;                  return;
         for (i = 0; i < indent; i++)          for (i = 0; i < indent; i++)
                 putchar('\t');                  putchar('\t');
   
           t = NULL;
         switch (ep->type) {          switch (ep->type) {
         case (EQN_ROOT):          case (EQN_ROOT):
                 printf("eqn-root(%d, %d, %d, %d)\n",                  t = "eqn-root";
                         EQN_DEFSIZE == ep->size ? 0 : ep->size,  
                         ep->pos, ep->font, ep->mark);  
                 print_box(ep->first, indent + 1);  
                 break;                  break;
           case (EQN_LIST):
                   t = "eqn-list";
                   break;
         case (EQN_SUBEXPR):          case (EQN_SUBEXPR):
                 printf("eqn-subxpr(%d, %d, %d, %d, %d, %d, \"%s\", \"%s\")\n",                  t = "eqn-expr";
                         EQN_DEFSIZE == ep->size ? 0 : ep->size,  
                         ep->pos, ep->font, ep->mark,  
                         ep->pile, ep->above,  
                         ep->left ? ep->left : "",  
                         ep->right ? ep->right : "");  
                 print_box(ep->first, indent + 1);  
                 break;                  break;
         case (EQN_TEXT):          case (EQN_TEXT):
                 printf("eqn-text(%d, %d, %d, %d): [%s]\n",                  t = "eqn-text";
                         EQN_DEFSIZE == ep->size ? 0 : ep->size,  
                         ep->pos, ep->font, ep->mark, ep->text);  
                 break;                  break;
         default:          case (EQN_MATRIX):
                   t = "eqn-matrix";
                 break;                  break;
         }          }
   
           assert(t);
           printf("%s(%d, %d, %d, %d, %d, \"%s\", \"%s\") %s\n",
                   t, EQN_DEFSIZE == ep->size ? 0 : ep->size,
                   ep->pos, ep->font, ep->mark, ep->pile,
                   ep->left ? ep->left : "",
                   ep->right ? ep->right : "",
                   ep->text ? ep->text : "");
   
           print_box(ep->first, indent + 1);
         print_box(ep->next, indent);          print_box(ep->next, indent);
 }  }
   

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.51

CVSweb