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

Diff for /mandoc/mdoc_man.c between version 1.41 and 1.42

version 1.41, 2012/07/16 10:45:41 version 1.42, 2012/11/17 00:26:33
Line 28 
Line 28 
 #include "mdoc.h"  #include "mdoc.h"
 #include "main.h"  #include "main.h"
   
 #define DECL_ARGS const struct mdoc_meta *m, \  #define DECL_ARGS const struct mdoc_meta *meta, \
                   const struct mdoc_node *n                    const struct mdoc_node *n
   
 struct  manact {  struct  manact {
Line 471  man_man(void *arg, const struct man *man)
Line 471  man_man(void *arg, const struct man *man)
 void  void
 man_mdoc(void *arg, const struct mdoc *mdoc)  man_mdoc(void *arg, const struct mdoc *mdoc)
 {  {
         const struct mdoc_meta *m;          const struct mdoc_meta *meta;
         const struct mdoc_node *n;          const struct mdoc_node *n;
   
         m = mdoc_meta(mdoc);          meta = mdoc_meta(mdoc);
         n = mdoc_node(mdoc);          n = mdoc_node(mdoc);
   
         printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",          printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
                         m->title, m->msec, m->date, m->os, m->vol);                          meta->title, meta->msec, meta->date,
                           meta->os, meta->vol);
   
         outflags = MMAN_nl | MMAN_Sm;          outflags = MMAN_nl | MMAN_Sm;
         if (0 == fontqueue.size) {          if (0 == fontqueue.size) {
Line 486  man_mdoc(void *arg, const struct mdoc *mdoc)
Line 487  man_mdoc(void *arg, const struct mdoc *mdoc)
                 fontqueue.head = fontqueue.tail = mandoc_malloc(8);                  fontqueue.head = fontqueue.tail = mandoc_malloc(8);
                 *fontqueue.tail = 'R';                  *fontqueue.tail = 'R';
         }          }
         print_node(m, n);          print_node(meta, n);
         putchar('\n');          putchar('\n');
 }  }
   
Line 527  print_node(DECL_ARGS)
Line 528  print_node(DECL_ARGS)
                  * node.                   * node.
                  */                   */
                 act = manacts + n->tok;                  act = manacts + n->tok;
                 cond = NULL == act->cond || (*act->cond)(m, n);                  cond = NULL == act->cond || (*act->cond)(meta, n);
                 if (cond && act->pre)                  if (cond && act->pre)
                         do_sub = (*act->pre)(m, n);                          do_sub = (*act->pre)(meta, n);
         }          }
   
         /*          /*
Line 539  print_node(DECL_ARGS)
Line 540  print_node(DECL_ARGS)
          */           */
         if (do_sub)          if (do_sub)
                 for (sub = n->child; sub; sub = sub->next)                  for (sub = n->child; sub; sub = sub->next)
                         print_node(m, sub);                          print_node(meta, sub);
   
         /*          /*
          * Lastly, conditionally run the post-node handler.           * Lastly, conditionally run the post-node handler.
          */           */
         if (cond && act->post)          if (cond && act->post)
                 (*act->post)(m, n);                  (*act->post)(meta, n);
 }  }
   
 static int  static int
Line 636  post__t(DECL_ARGS)
Line 637  post__t(DECL_ARGS)
                 putchar('\"');                  putchar('\"');
         } else          } else
                 font_pop();                  font_pop();
         post_percent(m, n);          post_percent(meta, n);
 }  }
   
 /*  /*
Line 939  pre_fa(DECL_ARGS)
Line 940  pre_fa(DECL_ARGS)
   
         while (NULL != n) {          while (NULL != n) {
                 font_push('I');                  font_push('I');
                 print_node(m, n);                  print_node(meta, n);
                 font_pop();                  font_pop();
                 if (NULL != (n = n->next))                  if (NULL != (n = n->next))
                         print_word(",");                          print_word(",");
Line 1003  pre_fn(DECL_ARGS)
Line 1004  pre_fn(DECL_ARGS)
                 return(0);                  return(0);
   
         font_push('B');          font_push('B');
         print_node(m, n);          print_node(meta, n);
         font_pop();          font_pop();
         outflags &= ~MMAN_spc;          outflags &= ~MMAN_spc;
         print_word("(");          print_word("(");
Line 1011  pre_fn(DECL_ARGS)
Line 1012  pre_fn(DECL_ARGS)
   
         n = n->next;          n = n->next;
         if (NULL != n)          if (NULL != n)
                 pre_fa(m, n);                  pre_fa(meta, n);
         return(0);          return(0);
 }  }
   
Line 1057  post_fo(DECL_ARGS)
Line 1058  post_fo(DECL_ARGS)
                 font_pop();                  font_pop();
                 break;                  break;
         case (MDOC_BODY):          case (MDOC_BODY):
                 post_fn(m, n);                  post_fn(meta, n);
                 break;                  break;
         default:          default:
                 break;                  break;
Line 1256  pre_nm(DECL_ARGS)
Line 1257  pre_nm(DECL_ARGS)
                 pre_syn(n);                  pre_syn(n);
         if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)          if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)
                 return(1);                  return(1);
         name = n->child ? n->child->string : m->name;          name = n->child ? n->child->string : meta->name;
         if (NULL == name)          if (NULL == name)
                 return(0);                  return(0);
         if (MDOC_HEAD == n->type) {          if (MDOC_HEAD == n->type) {
Line 1268  pre_nm(DECL_ARGS)
Line 1269  pre_nm(DECL_ARGS)
         }          }
         font_push('B');          font_push('B');
         if (NULL == n->child)          if (NULL == n->child)
                 print_word(m->name);                  print_word(meta->name);
         return(1);          return(1);
 }  }
   
Line 1400  pre_xr(DECL_ARGS)
Line 1401  pre_xr(DECL_ARGS)
         n = n->child;          n = n->child;
         if (NULL == n)          if (NULL == n)
                 return(0);                  return(0);
         print_node(m, n);          print_node(meta, n);
         n = n->next;          n = n->next;
         if (NULL == n)          if (NULL == n)
                 return(0);                  return(0);
         outflags &= ~MMAN_spc;          outflags &= ~MMAN_spc;
         print_word("(");          print_word("(");
         print_node(m, n);          print_node(meta, n);
         print_word(")");          print_word(")");
         return(0);          return(0);
 }  }

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

CVSweb