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

Diff for /mandoc/tree.c between version 1.63 and 1.71

version 1.63, 2015/04/02 21:36:51 version 1.71, 2017/01/10 13:47:00
Line 32 
Line 32 
 #include "main.h"  #include "main.h"
   
 static  void    print_box(const struct eqn_box *, int);  static  void    print_box(const struct eqn_box *, int);
 static  void    print_man(const struct man_node *, int);  static  void    print_man(const struct roff_node *, int);
 static  void    print_mdoc(const struct mdoc_node *, int);  static  void    print_mdoc(const struct roff_node *, int);
 static  void    print_span(const struct tbl_span *, int);  static  void    print_span(const struct tbl_span *, int);
   
   
 void  void
 tree_mdoc(void *arg, const struct mdoc *mdoc)  tree_mdoc(void *arg, const struct roff_man *mdoc)
 {  {
   
         print_mdoc(mdoc_node(mdoc)->child, 0);          print_mdoc(mdoc->first->child, 0);
 }  }
   
 void  void
 tree_man(void *arg, const struct man *man)  tree_man(void *arg, const struct roff_man *man)
 {  {
   
         print_man(man_node(man)->child, 0);          print_man(man->first->child, 0);
 }  }
   
 static void  static void
 print_mdoc(const struct mdoc_node *n, int indent)  print_mdoc(const struct roff_node *n, int indent)
 {  {
         const char       *p, *t;          const char       *p, *t;
         int               i, j;          int               i, j;
Line 74  print_mdoc(const struct mdoc_node *n, int indent)
Line 74  print_mdoc(const struct mdoc_node *n, int indent)
                 t = "block";                  t = "block";
                 break;                  break;
         case ROFFT_HEAD:          case ROFFT_HEAD:
                 t = "block-head";                  t = "head";
                 break;                  break;
         case ROFFT_BODY:          case ROFFT_BODY:
                 if (n->end)                  if (n->end)
                         t = "body-end";                          t = "body-end";
                 else                  else
                         t = "block-body";                          t = "body";
                 break;                  break;
         case ROFFT_TAIL:          case ROFFT_TAIL:
                 t = "block-tail";                  t = "tail";
                 break;                  break;
         case ROFFT_ELEM:          case ROFFT_ELEM:
                 t = "elem";                  t = "elem";
Line 98  print_mdoc(const struct mdoc_node *n, int indent)
Line 98  print_mdoc(const struct mdoc_node *n, int indent)
                 break;                  break;
         default:          default:
                 abort();                  abort();
                 /* NOTREACHED */  
         }          }
   
         switch (n->type) {          switch (n->type) {
Line 138  print_mdoc(const struct mdoc_node *n, int indent)
Line 137  print_mdoc(const struct mdoc_node *n, int indent)
                 break;                  break;
         default:          default:
                 abort();                  abort();
                 /* NOTREACHED */  
         }          }
   
         if (n->span) {          if (n->span) {
Line 161  print_mdoc(const struct mdoc_node *n, int indent)
Line 159  print_mdoc(const struct mdoc_node *n, int indent)
                 }                  }
   
                 putchar(' ');                  putchar(' ');
                 if (MDOC_LINE & n->flags)                  if (NODE_DELIMO & n->flags)
                           putchar('(');
                   if (NODE_LINE & n->flags)
                         putchar('*');                          putchar('*');
                 printf("%d:%d\n", n->line, n->pos + 1);                  printf("%d:%d", n->line, n->pos + 1);
                   if (NODE_DELIMC & n->flags)
                           putchar(')');
                   if (NODE_EOS & n->flags)
                           putchar('.');
                   if (NODE_NOSRC & n->flags)
                           printf(" NOSRC");
                   if (NODE_NOPRT & n->flags)
                           printf(" NOPRT");
                   putchar('\n');
         }          }
   
         if (n->eqn)          if (n->eqn)
Line 176  print_mdoc(const struct mdoc_node *n, int indent)
Line 185  print_mdoc(const struct mdoc_node *n, int indent)
 }  }
   
 static void  static void
 print_man(const struct man_node *n, int indent)  print_man(const struct roff_node *n, int indent)
 {  {
         const char       *p, *t;          const char       *p, *t;
         int               i;          int               i;
Line 200  print_man(const struct man_node *n, int indent)
Line 209  print_man(const struct man_node *n, int indent)
                 t = "block";                  t = "block";
                 break;                  break;
         case ROFFT_HEAD:          case ROFFT_HEAD:
                 t = "block-head";                  t = "head";
                 break;                  break;
         case ROFFT_BODY:          case ROFFT_BODY:
                 t = "block-body";                  t = "body";
                 break;                  break;
         case ROFFT_TBL:          case ROFFT_TBL:
                 break;                  break;
Line 212  print_man(const struct man_node *n, int indent)
Line 221  print_man(const struct man_node *n, int indent)
                 break;                  break;
         default:          default:
                 abort();                  abort();
                 /* NOTREACHED */  
         }          }
   
         switch (n->type) {          switch (n->type) {
Line 220  print_man(const struct man_node *n, int indent)
Line 228  print_man(const struct man_node *n, int indent)
                 p = n->string;                  p = n->string;
                 break;                  break;
         case ROFFT_ELEM:          case ROFFT_ELEM:
                 /* FALLTHROUGH */  
         case ROFFT_BLOCK:          case ROFFT_BLOCK:
                 /* FALLTHROUGH */  
         case ROFFT_HEAD:          case ROFFT_HEAD:
                 /* FALLTHROUGH */  
         case ROFFT_BODY:          case ROFFT_BODY:
                 p = man_macronames[n->tok];                  p = man_macronames[n->tok];
                 break;                  break;
Line 238  print_man(const struct man_node *n, int indent)
Line 243  print_man(const struct man_node *n, int indent)
                 break;                  break;
         default:          default:
                 abort();                  abort();
                 /* NOTREACHED */  
         }          }
   
         if (n->span) {          if (n->span) {
Line 248  print_man(const struct man_node *n, int indent)
Line 252  print_man(const struct man_node *n, int indent)
                 for (i = 0; i < indent; i++)                  for (i = 0; i < indent; i++)
                         putchar(' ');                          putchar(' ');
                 printf("%s (%s) ", p, t);                  printf("%s (%s) ", p, t);
                 if (MAN_LINE & n->flags)                  if (NODE_LINE & n->flags)
                         putchar('*');                          putchar('*');
                 printf("%d:%d\n", n->line, n->pos + 1);                  printf("%d:%d", n->line, n->pos + 1);
                   if (NODE_EOS & n->flags)
                           putchar('.');
                   putchar('\n');
         }          }
   
         if (n->eqn)          if (n->eqn)
Line 351  print_span(const struct tbl_span *sp, int indent)
Line 358  print_span(const struct tbl_span *sp, int indent)
         for (dp = sp->first; dp; dp = dp->next) {          for (dp = sp->first; dp; dp = dp->next) {
                 switch (dp->pos) {                  switch (dp->pos) {
                 case TBL_DATA_HORIZ:                  case TBL_DATA_HORIZ:
                         /* FALLTHROUGH */  
                 case TBL_DATA_NHORIZ:                  case TBL_DATA_NHORIZ:
                         putchar('-');                          putchar('-');
                         continue;                          continue;
                 case TBL_DATA_DHORIZ:                  case TBL_DATA_DHORIZ:
                         /* FALLTHROUGH */  
                 case TBL_DATA_NDHORIZ:                  case TBL_DATA_NDHORIZ:
                         putchar('=');                          putchar('=');
                         continue;                          continue;

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.71

CVSweb