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

Diff for /mandoc/mdoc_term.c between version 1.367 and 1.368

version 1.367, 2018/04/11 17:11:13 version 1.368, 2018/08/17 20:33:38
Line 47  struct termpair {
Line 47  struct termpair {
                   const struct roff_meta *meta, \                    const struct roff_meta *meta, \
                   struct roff_node *n                    struct roff_node *n
   
 struct  termact {  struct  mdoc_term_act {
         int     (*pre)(DECL_ARGS);          int     (*pre)(DECL_ARGS);
         void    (*post)(DECL_ARGS);          void    (*post)(DECL_ARGS);
 };  };
Line 124  static int   termp_vt_pre(DECL_ARGS);
Line 124  static int   termp_vt_pre(DECL_ARGS);
 static  int       termp_xr_pre(DECL_ARGS);  static  int       termp_xr_pre(DECL_ARGS);
 static  int       termp_xx_pre(DECL_ARGS);  static  int       termp_xx_pre(DECL_ARGS);
   
 static  const struct termact __termacts[MDOC_MAX - MDOC_Dd] = {  static const struct mdoc_term_act mdoc_term_acts[MDOC_MAX - MDOC_Dd] = {
         { NULL, NULL }, /* Dd */          { NULL, NULL }, /* Dd */
         { NULL, NULL }, /* Dt */          { NULL, NULL }, /* Dt */
         { NULL, NULL }, /* Os */          { NULL, NULL }, /* Os */
Line 246  static const struct termact __termacts[MDOC_MAX - MDOC
Line 246  static const struct termact __termacts[MDOC_MAX - MDOC
         { NULL, termp____post }, /* %U */          { NULL, termp____post }, /* %U */
         { NULL, NULL }, /* Ta */          { NULL, NULL }, /* Ta */
 };  };
 static  const struct termact *const termacts = __termacts - MDOC_Dd;  
   
 static  int      fn_prio;  static  int      fn_prio;
   
Line 310  print_mdoc_nodelist(DECL_ARGS)
Line 309  print_mdoc_nodelist(DECL_ARGS)
 static void  static void
 print_mdoc_node(DECL_ARGS)  print_mdoc_node(DECL_ARGS)
 {  {
         int              chld;          const struct mdoc_term_act *act;
         struct termpair  npair;          struct termpair  npair;
         size_t           offset, rmargin;          size_t           offset, rmargin;
           int              chld;
   
         if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT)          if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT)
                 return;                  return;
Line 370  print_mdoc_node(DECL_ARGS)
Line 370  print_mdoc_node(DECL_ARGS)
                         return;                          return;
                 }                  }
                 assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);                  assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
                 if (termacts[n->tok].pre != NULL &&                  act = mdoc_term_acts + (n->tok - MDOC_Dd);
                   if (act->pre != NULL &&
                     (n->end == ENDBODY_NOT || n->child != NULL))                      (n->end == ENDBODY_NOT || n->child != NULL))
                         chld = (*termacts[n->tok].pre)                          chld = (*act->pre)(p, &npair, meta, n);
                                 (p, &npair, meta, n);  
                 break;                  break;
         }          }
   
Line 391  print_mdoc_node(DECL_ARGS)
Line 391  print_mdoc_node(DECL_ARGS)
         case ROFFT_EQN:          case ROFFT_EQN:
                 break;                  break;
         default:          default:
                 if (termacts[n->tok].post == NULL || n->flags & NODE_ENDED)                  if (act->post == NULL || n->flags & NODE_ENDED)
                         break;                          break;
                 (void)(*termacts[n->tok].post)(p, &npair, meta, n);                  (void)(*act->post)(p, &npair, meta, n);
   
                 /*                  /*
                  * Explicit end tokens not only call the post                   * Explicit end tokens not only call the post

Legend:
Removed from v.1.367  
changed lines
  Added in v.1.368

CVSweb