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

Diff for /mandoc/tree.c between version 1.1 and 1.2

version 1.1, 2009/01/16 15:58:50 version 1.2, 2009/01/17 14:04:25
Line 17 
Line 17 
  * PERFORMANCE OF THIS SOFTWARE.   * PERFORMANCE OF THIS SOFTWARE.
  */   */
 #include <stdlib.h>  #include <stdlib.h>
   #include <stdio.h>
   
 #include "mdoc.h"  #include "mdoc.h"
   
   #define xprintf         (void)printf
   
 #if 0  static  void     treeprint_r(const struct mdoc_node *, int);
 /* TODO: remove this to a print-tree output filter. */  
 static void  static void
 print_node(const struct mdoc_node *n, int indent)  treeprint_r(const struct mdoc_node *n, int indent)
 {  {
         const char       *p, *t;          const char       *p, *t;
         int               i, j;          int               i, j;
Line 36  print_node(const struct mdoc_node *n, int indent)
Line 38  print_node(const struct mdoc_node *n, int indent)
         argc = sz = 0;          argc = sz = 0;
         params = NULL;          params = NULL;
   
         t = mdoc_type2a(n->type);          switch (n->type) {
           case (MDOC_ROOT):
                   t = "root";
                   break;
           case (MDOC_BLOCK):
                   t = "block";
                   break;
           case (MDOC_HEAD):
                   t = "block-head";
                   break;
           case (MDOC_BODY):
                   t = "block-body";
                   break;
           case (MDOC_TAIL):
                   t = "block-tail";
                   break;
           case (MDOC_ELEM):
                   t = "elem";
                   break;
           case (MDOC_TEXT):
                   t = "text";
                   break;
           default:
                   abort();
                   /* NOTREACHED */
           }
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_TEXT):          case (MDOC_TEXT):
Line 89  print_node(const struct mdoc_node *n, int indent)
Line 116  print_node(const struct mdoc_node *n, int indent)
         xprintf(" %d:%d\n", n->line, n->pos);          xprintf(" %d:%d\n", n->line, n->pos);
   
         if (n->child)          if (n->child)
                 print_node(n->child, indent + 1);                  treeprint_r(n->child, indent + 1);
         if (n->next)          if (n->next)
                 print_node(n->next, indent);                  treeprint_r(n->next, indent);
 }  }
 #endif  
   
   
 int  int
 treeprint(const struct mdoc_node *node, const char *out)  treeprint(const struct mdoc_node *node)
 {  {
   
           treeprint_r(node, 0);
           return(1);
 }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

CVSweb