[BACK]Return to mdoc_term.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Diff for /src/usr.bin/mandoc/mdoc_term.c between version 1.165 and 1.166

version 1.165, 2014/04/08 07:13:01 version 1.166, 2014/04/20 16:44:44
Line 38 
Line 38 
   
 #define DECL_ARGS struct termp *p, \  #define DECL_ARGS struct termp *p, \
                   struct termpair *pair, \                    struct termpair *pair, \
                   const struct mdoc_meta *meta, \                    const struct mdoc_meta *meta, \
                   struct mdoc_node *n                    struct mdoc_node *n
   
 struct  termact {  struct  termact {
Line 53 
Line 53 
 static  void      print_bvspace(struct termp *,  static  void      print_bvspace(struct termp *,
                         const struct mdoc_node *,                          const struct mdoc_node *,
                         const struct mdoc_node *);                          const struct mdoc_node *);
 static  void      print_mdoc_node(DECL_ARGS);  static  void      print_mdoc_node(DECL_ARGS);
 static  void      print_mdoc_nodelist(DECL_ARGS);  static  void      print_mdoc_nodelist(DECL_ARGS);
 static  void      print_mdoc_head(struct termp *, const void *);  static  void      print_mdoc_head(struct termp *, const void *);
 static  void      print_mdoc_foot(struct termp *, const void *);  static  void      print_mdoc_foot(struct termp *, const void *);
 static  void      synopsis_pre(struct termp *,  static  void      synopsis_pre(struct termp *,
                         const struct mdoc_node *);                          const struct mdoc_node *);
   
 static  void      termp____post(DECL_ARGS);  static  void      termp____post(DECL_ARGS);
Line 124 
Line 124 
         { NULL, NULL }, /* Dt */          { NULL, NULL }, /* Dt */
         { NULL, NULL }, /* Os */          { NULL, NULL }, /* Os */
         { termp_sh_pre, termp_sh_post }, /* Sh */          { termp_sh_pre, termp_sh_post }, /* Sh */
         { termp_ss_pre, termp_ss_post }, /* Ss */          { termp_ss_pre, termp_ss_post }, /* Ss */
         { termp_sp_pre, NULL }, /* Pp */          { termp_sp_pre, NULL }, /* Pp */
         { termp_d1_pre, termp_bl_post }, /* D1 */          { termp_d1_pre, termp_bl_post }, /* D1 */
         { termp_d1_pre, termp_bl_post }, /* Dl */          { termp_d1_pre, termp_bl_post }, /* Dl */
         { termp_bd_pre, termp_bd_post }, /* Bd */          { termp_bd_pre, termp_bd_post }, /* Bd */
Line 133 
Line 133 
         { termp_bl_pre, termp_bl_post }, /* Bl */          { termp_bl_pre, termp_bl_post }, /* Bl */
         { NULL, NULL }, /* El */          { NULL, NULL }, /* El */
         { termp_it_pre, termp_it_post }, /* It */          { termp_it_pre, termp_it_post }, /* It */
         { termp_under_pre, NULL }, /* Ad */          { termp_under_pre, NULL }, /* Ad */
         { termp_an_pre, termp_an_post }, /* An */          { termp_an_pre, termp_an_post }, /* An */
         { termp_under_pre, NULL }, /* Ar */          { termp_under_pre, NULL }, /* Ar */
         { termp_cd_pre, NULL }, /* Cd */          { termp_cd_pre, NULL }, /* Cd */
         { termp_bold_pre, NULL }, /* Cm */          { termp_bold_pre, NULL }, /* Cm */
         { NULL, NULL }, /* Dv */          { NULL, NULL }, /* Dv */
         { NULL, NULL }, /* Er */          { NULL, NULL }, /* Er */
         { NULL, NULL }, /* Ev */          { NULL, NULL }, /* Ev */
         { termp_ex_pre, NULL }, /* Ex */          { termp_ex_pre, NULL }, /* Ex */
         { termp_fa_pre, NULL }, /* Fa */          { termp_fa_pre, NULL }, /* Fa */
         { termp_fd_pre, termp_fd_post }, /* Fd */          { termp_fd_pre, termp_fd_post }, /* Fd */
         { termp_fl_pre, NULL }, /* Fl */          { termp_fl_pre, NULL }, /* Fl */
         { termp_fn_pre, NULL }, /* Fn */          { termp_fn_pre, NULL }, /* Fn */
         { termp_ft_pre, NULL }, /* Ft */          { termp_ft_pre, NULL }, /* Ft */
         { termp_bold_pre, NULL }, /* Ic */          { termp_bold_pre, NULL }, /* Ic */
         { termp_in_pre, termp_in_post }, /* In */          { termp_in_pre, termp_in_post }, /* In */
         { termp_li_pre, NULL }, /* Li */          { termp_li_pre, NULL }, /* Li */
         { termp_nd_pre, NULL }, /* Nd */          { termp_nd_pre, NULL }, /* Nd */
         { termp_nm_pre, termp_nm_post }, /* Nm */          { termp_nm_pre, termp_nm_post }, /* Nm */
         { termp_quote_pre, termp_quote_post }, /* Op */          { termp_quote_pre, termp_quote_post }, /* Op */
         { NULL, NULL }, /* Ot */          { NULL, NULL }, /* Ot */
         { termp_under_pre, NULL }, /* Pa */          { termp_under_pre, NULL }, /* Pa */
         { termp_rv_pre, NULL }, /* Rv */          { termp_rv_pre, NULL }, /* Rv */
         { NULL, NULL }, /* St */          { NULL, NULL }, /* St */
         { termp_under_pre, NULL }, /* Va */          { termp_under_pre, NULL }, /* Va */
         { termp_vt_pre, NULL }, /* Vt */          { termp_vt_pre, NULL }, /* Vt */
         { termp_xr_pre, NULL }, /* Xr */          { termp_xr_pre, NULL }, /* Xr */
Line 176 
Line 176 
         { termp_quote_pre, termp_quote_post }, /* Aq */          { termp_quote_pre, termp_quote_post }, /* Aq */
         { NULL, NULL }, /* At */          { NULL, NULL }, /* At */
         { NULL, NULL }, /* Bc */          { NULL, NULL }, /* Bc */
         { termp_bf_pre, NULL }, /* Bf */          { termp_bf_pre, NULL }, /* Bf */
         { termp_quote_pre, termp_quote_post }, /* Bo */          { termp_quote_pre, termp_quote_post }, /* Bo */
         { termp_quote_pre, termp_quote_post }, /* Bq */          { termp_quote_pre, termp_quote_post }, /* Bq */
         { termp_xx_pre, NULL }, /* Bsx */          { termp_xx_pre, NULL }, /* Bsx */
Line 187 
Line 187 
         { termp_quote_pre, termp_quote_post }, /* Dq */          { termp_quote_pre, termp_quote_post }, /* Dq */
         { NULL, NULL }, /* Ec */ /* FIXME: no space */          { NULL, NULL }, /* Ec */ /* FIXME: no space */
         { NULL, NULL }, /* Ef */          { NULL, NULL }, /* Ef */
         { termp_under_pre, NULL }, /* Em */          { termp_under_pre, NULL }, /* Em */
         { termp_quote_pre, termp_quote_post }, /* Eo */          { termp_quote_pre, termp_quote_post }, /* Eo */
         { termp_xx_pre, NULL }, /* Fx */          { termp_xx_pre, NULL }, /* Fx */
         { termp_bold_pre, NULL }, /* Ms */          { termp_bold_pre, NULL }, /* Ms */
Line 215 
Line 215 
         { termp_xx_pre, NULL }, /* Ux */          { termp_xx_pre, NULL }, /* Ux */
         { NULL, NULL }, /* Xc */          { NULL, NULL }, /* Xc */
         { NULL, NULL }, /* Xo */          { NULL, NULL }, /* Xo */
         { termp_fo_pre, termp_fo_post }, /* Fo */          { termp_fo_pre, termp_fo_post }, /* Fo */
         { NULL, NULL }, /* Fc */          { NULL, NULL }, /* Fc */
         { termp_quote_pre, termp_quote_post }, /* Oo */          { termp_quote_pre, termp_quote_post }, /* Oo */
         { NULL, NULL }, /* Oc */          { NULL, NULL }, /* Oc */
         { termp_bk_pre, termp_bk_post }, /* Bk */          { termp_bk_pre, termp_bk_post }, /* Bk */
Line 226 
Line 226 
         { NULL, NULL }, /* Fr */          { NULL, NULL }, /* Fr */
         { termp_ud_pre, NULL }, /* Ud */          { termp_ud_pre, NULL }, /* Ud */
         { NULL, termp_lb_post }, /* Lb */          { NULL, termp_lb_post }, /* Lb */
         { termp_sp_pre, NULL }, /* Lp */          { termp_sp_pre, NULL }, /* Lp */
         { termp_lk_pre, NULL }, /* Lk */          { termp_lk_pre, NULL }, /* Lk */
         { termp_under_pre, NULL }, /* Mt */          { termp_under_pre, NULL }, /* Mt */
         { termp_quote_pre, termp_quote_post }, /* Brq */          { termp_quote_pre, termp_quote_post }, /* Brq */
         { termp_quote_pre, termp_quote_post }, /* Bro */          { termp_quote_pre, termp_quote_post }, /* Bro */
         { NULL, NULL }, /* Brc */          { NULL, NULL }, /* Brc */
         { NULL, termp____post }, /* %C */          { NULL, termp____post }, /* %C */
         { NULL, NULL }, /* Es */ /* TODO */          { NULL, NULL }, /* Es */ /* TODO */
         { NULL, NULL }, /* En */ /* TODO */          { NULL, NULL }, /* En */ /* TODO */
         { termp_xx_pre, NULL }, /* Dx */          { termp_xx_pre, NULL }, /* Dx */
         { NULL, termp____post }, /* %Q */          { NULL, termp____post }, /* %Q */
         { termp_sp_pre, NULL }, /* br */          { termp_sp_pre, NULL }, /* br */
         { termp_sp_pre, NULL }, /* sp */          { termp_sp_pre, NULL }, /* sp */
         { NULL, termp____post }, /* %U */          { NULL, termp____post }, /* %U */
         { NULL, NULL }, /* Ta */          { NULL, NULL }, /* Ta */
         { termp_ll_pre, NULL }, /* ll */          { termp_ll_pre, NULL }, /* ll */
 };  };
   
Line 275 
Line 275 
         term_end(p);          term_end(p);
 }  }
   
   
 static void  static void
 print_mdoc_nodelist(DECL_ARGS)  print_mdoc_nodelist(DECL_ARGS)
 {  {
Line 285 
Line 284 
                 print_mdoc_nodelist(p, pair, meta, n->next);                  print_mdoc_nodelist(p, pair, meta, n->next);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 print_mdoc_node(DECL_ARGS)  print_mdoc_node(DECL_ARGS)
 {  {
Line 321 
Line 318 
          */           */
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_TEXT):          case MDOC_TEXT:
                 if (' ' == *n->string && MDOC_LINE & n->flags)                  if (' ' == *n->string && MDOC_LINE & n->flags)
                         term_newln(p);                          term_newln(p);
                 if (MDOC_DELIMC & n->flags)                  if (MDOC_DELIMC & n->flags)
Line 330 
Line 327 
                 if (MDOC_DELIMO & n->flags)                  if (MDOC_DELIMO & n->flags)
                         p->flags |= TERMP_NOSPACE;                          p->flags |= TERMP_NOSPACE;
                 break;                  break;
         case (MDOC_EQN):          case MDOC_EQN:
                 term_eqn(p, n->eqn);                  term_eqn(p, n->eqn);
                 break;                  break;
         case (MDOC_TBL):          case MDOC_TBL:
                 term_tbl(p, n->span);                  term_tbl(p, n->span);
                 break;                  break;
         default:          default:
Line 350 
Line 347 
             (ENDBODY_NOT == n->end ? n : n->pending)->prev_font);              (ENDBODY_NOT == n->end ? n : n->pending)->prev_font);
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_TEXT):          case MDOC_TEXT:
                 break;                  break;
         case (MDOC_TBL):          case MDOC_TBL:
                 break;                  break;
         case (MDOC_EQN):          case MDOC_EQN:
                 break;                  break;
         default:          default:
                 if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags)                  if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags)
Line 388 
Line 385 
         }          }
 }  }
   
   
 static void  static void
 print_mdoc_foot(struct termp *p, const void *arg)  print_mdoc_foot(struct termp *p, const void *arg)
 {  {
Line 398 
Line 394 
   
         term_fontrepl(p, TERMFONT_NONE);          term_fontrepl(p, TERMFONT_NONE);
   
         /*          /*
          * Output the footer in new-groff style, that is, three columns           * Output the footer in new-groff style, that is, three columns
          * with the middle being the manual date and flanking columns           * with the middle being the manual date and flanking columns
          * being the operating system:           * being the operating system:
Line 409 
Line 405 
         term_vspace(p);          term_vspace(p);
   
         p->offset = 0;          p->offset = 0;
         p->rmargin = (p->maxrmargin -          p->rmargin = (p->maxrmargin -
                         term_strlen(p, meta->date) + term_len(p, 1)) / 2;              term_strlen(p, meta->date) + term_len(p, 1)) / 2;
         p->trailspace = 1;          p->trailspace = 1;
         p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;          p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
   
Line 438 
Line 434 
         p->flags = 0;          p->flags = 0;
 }  }
   
   
 static void  static void
 print_mdoc_head(struct termp *p, const void *arg)  print_mdoc_head(struct termp *p, const void *arg)
 {  {
Line 511 
Line 506 
         p->rmargin = p->maxrmargin;          p->rmargin = p->maxrmargin;
 }  }
   
   
 static size_t  static size_t
 a2height(const struct termp *p, const char *v)  a2height(const struct termp *p, const char *v)
 {  {
Line 525 
Line 519 
         return(term_vspan(p, &su));          return(term_vspan(p, &su));
 }  }
   
   
 static size_t  static size_t
 a2width(const struct termp *p, const char *v)  a2width(const struct termp *p, const char *v)
 {  {
Line 538 
Line 531 
         return(term_hspan(p, &su));          return(term_hspan(p, &su));
 }  }
   
   
 static size_t  static size_t
 a2offs(const struct termp *p, const char *v)  a2offs(const struct termp *p, const char *v)
 {  {
Line 558 
Line 550 
         return(term_hspan(p, &su));          return(term_hspan(p, &su));
 }  }
   
   
 /*  /*
  * Determine how much space to print out before block elements of `It'   * Determine how much space to print out before block elements of `It'
  * (and thus `Bl') and `Bd'.  And then go ahead and print that space,   * (and thus `Bl') and `Bd'.  And then go ahead and print that space,
  * too.   * too.
  */   */
 static void  static void
 print_bvspace(struct termp *p,  print_bvspace(struct termp *p,
                 const struct mdoc_node *bl,          const struct mdoc_node *bl,
                 const struct mdoc_node *n)          const struct mdoc_node *n)
 {  {
         const struct mdoc_node  *nn;          const struct mdoc_node  *nn;
   
Line 613 
Line 604 
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_ll_pre(DECL_ARGS)  termp_ll_pre(DECL_ARGS)
 {  {
Line 622 
Line 612 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_it_pre(DECL_ARGS)  termp_it_pre(DECL_ARGS)
 {  {
         const struct mdoc_node *bl, *nn;          const struct mdoc_node *bl, *nn;
         char                    buf[7];          char                    buf[7];
         int                     i;          int                     i;
         size_t                  width, offset, ncols, dcol;          size_t                  width, offset, ncols, dcol;
         enum mdoc_list          type;          enum mdoc_list          type;
   
         if (MDOC_BLOCK == n->type) {          if (MDOC_BLOCK == n->type) {
Line 641 
Line 629 
         bl = n->parent->parent->parent;          bl = n->parent->parent->parent;
         type = bl->norm->Bl.type;          type = bl->norm->Bl.type;
   
         /*          /*
          * First calculate width and offset.  This is pretty easy unless           * First calculate width and offset.  This is pretty easy unless
          * we're a -column list, in which case all prior columns must           * we're a -column list, in which case all prior columns must
          * be accounted for.           * be accounted for.
Line 653 
Line 641 
                 offset = a2offs(p, bl->norm->Bl.offs);                  offset = a2offs(p, bl->norm->Bl.offs);
   
         switch (type) {          switch (type) {
         case (LIST_column):          case LIST_column:
                 if (MDOC_HEAD == n->type)                  if (MDOC_HEAD == n->type)
                         break;                          break;
   
Line 667 
Line 655 
                  * - For more than 5 columns, add only one column.                   * - For more than 5 columns, add only one column.
                  */                   */
                 ncols = bl->norm->Bl.ncols;                  ncols = bl->norm->Bl.ncols;
                   dcol = ncols < 5 ? term_len(p, 4) :
                       ncols == 5 ? term_len(p, 3) : term_len(p, 1);
   
                 /* LINTED */  
                 dcol = ncols < 5 ? term_len(p, 4) :  
                         ncols == 5 ? term_len(p, 3) : term_len(p, 1);  
   
                 /*                  /*
                  * Calculate the offset by applying all prior MDOC_BODY,                   * Calculate the offset by applying all prior MDOC_BODY,
                  * so we stop at the MDOC_HEAD (NULL == nn->prev).                   * so we stop at the MDOC_HEAD (NULL == nn->prev).
                  */                   */
   
                 for (i = 0, nn = n->prev;                  for (i = 0, nn = n->prev;
                                 nn->prev && i < (int)ncols;                      nn->prev && i < (int)ncols;
                                 nn = nn->prev, i++)                      nn = nn->prev, i++)
                         offset += dcol + a2width                          offset += dcol + a2width(p,
                                 (p, bl->norm->Bl.cols[i]);                              bl->norm->Bl.cols[i]);
   
                 /*                  /*
                  * When exceeding the declared number of columns, leave                   * When exceeding the declared number of columns, leave
Line 702 
Line 688 
                 if (NULL == bl->norm->Bl.width)                  if (NULL == bl->norm->Bl.width)
                         break;                          break;
   
                 /*                  /*
                  * Note: buffer the width by 2, which is groff's magic                   * Note: buffer the width by 2, which is groff's magic
                  * number for buffering single arguments.  See the above                   * number for buffering single arguments.  See the above
                  * handling for column for how this changes.                   * handling for column for how this changes.
Line 712 
Line 698 
                 break;                  break;
         }          }
   
         /*          /*
          * List-type can override the width in the case of fixed-head           * List-type can override the width in the case of fixed-head
          * values (bullet, dash/hyphen, enum).  Tags need a non-zero           * values (bullet, dash/hyphen, enum).  Tags need a non-zero
          * offset.           * offset.
          */           */
   
         switch (type) {          switch (type) {
         case (LIST_bullet):          case LIST_bullet:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_dash):          case LIST_dash:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_hyphen):          case LIST_hyphen:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_enum):          case LIST_enum:
                 if (width < term_len(p, 2))                  if (width < term_len(p, 2))
                         width = term_len(p, 2);                          width = term_len(p, 2);
                 break;                  break;
         case (LIST_hang):          case LIST_hang:
                 if (0 == width)                  if (0 == width)
                         width = term_len(p, 8);                          width = term_len(p, 8);
                 break;                  break;
         case (LIST_column):          case LIST_column:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_tag):          case LIST_tag:
                 if (0 == width)                  if (0 == width)
                         width = term_len(p, 10);                          width = term_len(p, 10);
                 break;                  break;
Line 743 
Line 729 
                 break;                  break;
         }          }
   
         /*          /*
          * Whitespace control.  Inset bodies need an initial space,           * Whitespace control.  Inset bodies need an initial space,
          * while diagonal bodies need two.           * while diagonal bodies need two.
          */           */
Line 751 
Line 737 
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
   
         switch (type) {          switch (type) {
         case (LIST_diag):          case LIST_diag:
                 if (MDOC_BODY == n->type)                  if (MDOC_BODY == n->type)
                         term_word(p, "\\ \\ ");                          term_word(p, "\\ \\ ");
                 break;                  break;
         case (LIST_inset):          case LIST_inset:
                 if (MDOC_BODY == n->type)                  if (MDOC_BODY == n->type)
                         term_word(p, "\\ ");                          term_word(p, "\\ ");
                 break;                  break;
         default:          default:
Line 766 
Line 752 
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
   
         switch (type) {          switch (type) {
         case (LIST_diag):          case LIST_diag:
                 if (MDOC_HEAD == n->type)                  if (MDOC_HEAD == n->type)
                         term_fontpush(p, TERMFONT_BOLD);                          term_fontpush(p, TERMFONT_BOLD);
                 break;                  break;
Line 782 
Line 768 
          */           */
   
         switch (type) {          switch (type) {
         case (LIST_enum):          case LIST_enum:
                 /*                  /*
                  * Weird special case.                   * Weird special case.
                  * Very narrow enum lists actually hang.                   * Very narrow enum lists actually hang.
Line 790 
Line 776 
                 if (width == term_len(p, 2))                  if (width == term_len(p, 2))
                         p->flags |= TERMP_HANG;                          p->flags |= TERMP_HANG;
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_bullet):          case LIST_bullet:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_dash):          case LIST_dash:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_hyphen):          case LIST_hyphen:
                 if (MDOC_HEAD != n->type)                  if (MDOC_HEAD != n->type)
                         break;                          break;
                 p->flags |= TERMP_NOBREAK;                  p->flags |= TERMP_NOBREAK;
                 p->trailspace = 1;                  p->trailspace = 1;
                 break;                  break;
         case (LIST_hang):          case LIST_hang:
                 if (MDOC_HEAD != n->type)                  if (MDOC_HEAD != n->type)
                         break;                          break;
   
Line 810 
Line 796 
                  * the "overstep" effect in term_flushln() and treat                   * the "overstep" effect in term_flushln() and treat
                  * this as a `-ohang' list instead.                   * this as a `-ohang' list instead.
                  */                   */
                 if (n->next->child &&                  if (n->next->child &&
                                 (MDOC_Bl == n->next->child->tok ||                      (MDOC_Bl == n->next->child->tok ||
                                  MDOC_Bd == n->next->child->tok))                       MDOC_Bd == n->next->child->tok))
                         break;                          break;
   
                 p->flags |= TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG;                  p->flags |= TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG;
                 p->trailspace = 1;                  p->trailspace = 1;
                 break;                  break;
         case (LIST_tag):          case LIST_tag:
                 if (MDOC_HEAD != n->type)                  if (MDOC_HEAD != n->type)
                         break;                          break;
   
Line 828 
Line 814 
                 if (NULL == n->next || NULL == n->next->child)                  if (NULL == n->next || NULL == n->next->child)
                         p->flags |= TERMP_DANGLE;                          p->flags |= TERMP_DANGLE;
                 break;                  break;
         case (LIST_column):          case LIST_column:
                 if (MDOC_HEAD == n->type)                  if (MDOC_HEAD == n->type)
                         break;                          break;
   
Line 841 
Line 827 
                 }                  }
   
                 break;                  break;
         case (LIST_diag):          case LIST_diag:
                 if (MDOC_HEAD != n->type)                  if (MDOC_HEAD != n->type)
                         break;                          break;
                 p->flags |= TERMP_NOBREAK | TERMP_BRIND;                  p->flags |= TERMP_NOBREAK | TERMP_BRIND;
Line 851 
Line 837 
                 break;                  break;
         }          }
   
         /*          /*
          * Margin control.  Set-head-width lists have their right           * Margin control.  Set-head-width lists have their right
          * margins shortened.  The body for these lists has the offset           * margins shortened.  The body for these lists has the offset
          * necessarily lengthened.  Everybody gets the offset.           * necessarily lengthened.  Everybody gets the offset.
Line 860 
Line 846 
         p->offset += offset;          p->offset += offset;
   
         switch (type) {          switch (type) {
         case (LIST_hang):          case LIST_hang:
                 /*                  /*
                  * Same stipulation as above, regarding `-hang'.  We                   * Same stipulation as above, regarding `-hang'.  We
                  * don't want to recalculate rmargin and offsets when                   * don't want to recalculate rmargin and offsets when
                  * using `Bd' or `Bl' within `-hang' overstep lists.                   * using `Bd' or `Bl' within `-hang' overstep lists.
                  */                   */
                 if (MDOC_HEAD == n->type && n->next->child &&                  if (MDOC_HEAD == n->type && n->next->child &&
                                 (MDOC_Bl == n->next->child->tok ||                      (MDOC_Bl == n->next->child->tok ||
                                  MDOC_Bd == n->next->child->tok))                       MDOC_Bd == n->next->child->tok))
                         break;                          break;
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_bullet):          case LIST_bullet:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_dash):          case LIST_dash:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_enum):          case LIST_enum:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_hyphen):          case LIST_hyphen:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_tag):          case LIST_tag:
                 assert(width);                  assert(width);
                 if (MDOC_HEAD == n->type)                  if (MDOC_HEAD == n->type)
                         p->rmargin = p->offset + width;                          p->rmargin = p->offset + width;
Line 889 
Line 875 
                                 p->rmargin = p->offset;                                  p->rmargin = p->offset;
                 }                  }
                 break;                  break;
         case (LIST_column):          case LIST_column:
                 assert(width);                  assert(width);
                 p->rmargin = p->offset + width;                  p->rmargin = p->offset + width;
                 /*                  /*
                  * XXX - this behaviour is not documented: the                   * XXX - this behaviour is not documented: the
                  * right-most column is filled to the right margin.                   * right-most column is filled to the right margin.
                  */                   */
Line 905 
Line 891 
                 break;                  break;
         }          }
   
         /*          /*
          * The dash, hyphen, bullet and enum lists all have a special           * The dash, hyphen, bullet and enum lists all have a special
          * HEAD character (temporarily bold, in some cases).           * HEAD character (temporarily bold, in some cases).
          */           */
   
         if (MDOC_HEAD == n->type)          if (MDOC_HEAD == n->type)
                 switch (type) {                  switch (type) {
                 case (LIST_bullet):                  case LIST_bullet:
                         term_fontpush(p, TERMFONT_BOLD);                          term_fontpush(p, TERMFONT_BOLD);
                         term_word(p, "\\[bu]");                          term_word(p, "\\[bu]");
                         term_fontpop(p);                          term_fontpop(p);
                         break;                          break;
                 case (LIST_dash):                  case LIST_dash:
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (LIST_hyphen):                  case LIST_hyphen:
                         term_fontpush(p, TERMFONT_BOLD);                          term_fontpush(p, TERMFONT_BOLD);
                         term_word(p, "\\(hy");                          term_word(p, "\\(hy");
                         term_fontpop(p);                          term_fontpop(p);
                         break;                          break;
                 case (LIST_enum):                  case LIST_enum:
                         (pair->ppair->ppair->count)++;                          (pair->ppair->ppair->count)++;
                         snprintf(buf, sizeof(buf), "%d.",                          snprintf(buf, sizeof(buf), "%d.",
                                         pair->ppair->ppair->count);                              pair->ppair->ppair->count);
                         term_word(p, buf);                          term_word(p, buf);
                         break;                          break;
                 default:                  default:
                         break;                          break;
                 }                  }
   
         /*          /*
          * If we're not going to process our children, indicate so here.           * If we're not going to process our children, indicate so here.
          */           */
   
         switch (type) {          switch (type) {
         case (LIST_bullet):          case LIST_bullet:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_item):          case LIST_item:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_dash):          case LIST_dash:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_hyphen):          case LIST_hyphen:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_enum):          case LIST_enum:
                 if (MDOC_HEAD == n->type)                  if (MDOC_HEAD == n->type)
                         return(0);                          return(0);
                 break;                  break;
         case (LIST_column):          case LIST_column:
                 if (MDOC_HEAD == n->type)                  if (MDOC_HEAD == n->type)
                         return(0);                          return(0);
                 break;                  break;
Line 962 
Line 948 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_it_post(DECL_ARGS)  termp_it_post(DECL_ARGS)
 {  {
Line 975 
Line 959 
         type = n->parent->parent->parent->norm->Bl.type;          type = n->parent->parent->parent->norm->Bl.type;
   
         switch (type) {          switch (type) {
         case (LIST_item):          case LIST_item:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_diag):          case LIST_diag:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_inset):          case LIST_inset:
                 if (MDOC_BODY == n->type)                  if (MDOC_BODY == n->type)
                         term_newln(p);                          term_newln(p);
                 break;                  break;
         case (LIST_column):          case LIST_column:
                 if (MDOC_BODY == n->type)                  if (MDOC_BODY == n->type)
                         term_flushln(p);                          term_flushln(p);
                 break;                  break;
Line 992 
Line 976 
                 break;                  break;
         }          }
   
         /*          /*
          * Now that our output is flushed, we can reset our tags.  Since           * Now that our output is flushed, we can reset our tags.  Since
          * only `It' sets these flags, we're free to assume that nobody           * only `It' sets these flags, we're free to assume that nobody
          * has munged them in the meanwhile.           * has munged them in the meanwhile.
Line 1003 
Line 987 
         p->trailspace = 0;          p->trailspace = 0;
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_nm_pre(DECL_ARGS)  termp_nm_pre(DECL_ARGS)
 {  {
Line 1057 
Line 1039 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_nm_post(DECL_ARGS)  termp_nm_post(DECL_ARGS)
 {  {
Line 1073 
Line 1053 
                 term_flushln(p);                  term_flushln(p);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_fl_pre(DECL_ARGS)  termp_fl_pre(DECL_ARGS)
 {  {
Line 1090 
Line 1068 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp__a_pre(DECL_ARGS)  termp__a_pre(DECL_ARGS)
 {  {
Line 1103 
Line 1079 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_an_pre(DECL_ARGS)  termp_an_pre(DECL_ARGS)
 {  {
Line 1120 
Line 1094 
          * with other macros/text, are split.  -split, in this case,           * with other macros/text, are split.  -split, in this case,
          * will override the condition of the implied first -nosplit.           * will override the condition of the implied first -nosplit.
          */           */
   
         if (n->sec == SEC_AUTHORS) {          if (n->sec == SEC_AUTHORS) {
                 if ( ! (TERMP_ANPREC & p->flags)) {                  if ( ! (TERMP_ANPREC & p->flags)) {
                         if (TERMP_SPLIT & p->flags)                          if (TERMP_SPLIT & p->flags)
Line 1139 
Line 1113 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_an_post(DECL_ARGS)  termp_an_post(DECL_ARGS)
 {  {
Line 1161 
Line 1133 
   
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_ns_pre(DECL_ARGS)  termp_ns_pre(DECL_ARGS)
 {  {
Line 1172 
Line 1142 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_rs_pre(DECL_ARGS)  termp_rs_pre(DECL_ARGS)
 {  {
Line 1185 
Line 1153 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_rv_pre(DECL_ARGS)  termp_rv_pre(DECL_ARGS)
 {  {
Line 1218 
Line 1184 
         else          else
                 term_word(p, "function returns");                  term_word(p, "function returns");
   
         term_word(p, "the value 0 if successful; otherwise the value "          term_word(p, "the value 0 if successful; otherwise the "
                         "-1 is returned and the global variable");              "value -1 is returned and the global variable");
   
         term_fontpush(p, TERMFONT_UNDER);          term_fontpush(p, TERMFONT_UNDER);
         term_word(p, "errno");          term_word(p, "errno");
         term_fontpop(p);          term_fontpop(p);
   
         term_word(p, "is set to indicate the error.");          term_word(p, "is set to indicate the error.");
         p->flags |= TERMP_SENTENCE;          p->flags |= TERMP_SENTENCE;
   
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_ex_pre(DECL_ARGS)  termp_ex_pre(DECL_ARGS)
 {  {
Line 1261 
Line 1225 
         else          else
                 term_word(p, "utility exits");                  term_word(p, "utility exits");
   
         term_word(p, "0 on success, and >0 if an error occurs.");          term_word(p, "0 on success, and >0 if an error occurs.");
   
         p->flags |= TERMP_SENTENCE;          p->flags |= TERMP_SENTENCE;
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_nd_pre(DECL_ARGS)  termp_nd_pre(DECL_ARGS)
 {  {
Line 1284 
Line 1246 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_bl_pre(DECL_ARGS)  termp_bl_pre(DECL_ARGS)
 {  {
Line 1293 
Line 1253 
         return(MDOC_HEAD != n->type);          return(MDOC_HEAD != n->type);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_bl_post(DECL_ARGS)  termp_bl_post(DECL_ARGS)
 {  {
Line 1303 
Line 1261 
                 term_newln(p);                  term_newln(p);
 }  }
   
 /* ARGSUSED */  
 static int  static int
 termp_xr_pre(DECL_ARGS)  termp_xr_pre(DECL_ARGS)
 {  {
Line 1314 
Line 1271 
         assert(MDOC_TEXT == n->type);          assert(MDOC_TEXT == n->type);
         term_word(p, n->string);          term_word(p, n->string);
   
         if (NULL == (n = n->next))          if (NULL == (n = n->next))
                 return(0);                  return(0);
   
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
Line 1338 
Line 1295 
 static void  static void
 synopsis_pre(struct termp *p, const struct mdoc_node *n)  synopsis_pre(struct termp *p, const struct mdoc_node *n)
 {  {
         /*          /*
          * Obviously, if we're not in a SYNOPSIS or no prior macros           * Obviously, if we're not in a SYNOPSIS or no prior macros
          * exist, do nothing.           * exist, do nothing.
          */           */
Line 1350 
Line 1307 
          * newline and return.  UNLESS we're `Fo', `Fn', `Fn', in which           * newline and return.  UNLESS we're `Fo', `Fn', `Fn', in which
          * case we soldier on.           * case we soldier on.
          */           */
         if (n->prev->tok == n->tok &&          if (n->prev->tok == n->tok &&
                         MDOC_Ft != n->tok &&              MDOC_Ft != n->tok &&
                         MDOC_Fo != n->tok &&              MDOC_Fo != n->tok &&
                         MDOC_Fn != n->tok) {              MDOC_Fn != n->tok) {
                 term_newln(p);                  term_newln(p);
                 return;                  return;
         }          }
Line 1364 
Line 1321 
          * vertical space, else only newline and move on.           * vertical space, else only newline and move on.
          */           */
         switch (n->prev->tok) {          switch (n->prev->tok) {
         case (MDOC_Fd):          case MDOC_Fd:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Fn):          case MDOC_Fn:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Fo):          case MDOC_Fo:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_In):          case MDOC_In:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Vt):          case MDOC_Vt:
                 term_vspace(p);                  term_vspace(p);
                 break;                  break;
         case (MDOC_Ft):          case MDOC_Ft:
                 if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {                  if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
                         term_vspace(p);                          term_vspace(p);
                         break;                          break;
Line 1387 
Line 1344 
         }          }
 }  }
   
   
 static int  static int
 termp_vt_pre(DECL_ARGS)  termp_vt_pre(DECL_ARGS)
 {  {
Line 1404 
Line 1360 
         return(termp_under_pre(p, pair, meta, n));          return(termp_under_pre(p, pair, meta, n));
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_bold_pre(DECL_ARGS)  termp_bold_pre(DECL_ARGS)
 {  {
Line 1414 
Line 1368 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_fd_pre(DECL_ARGS)  termp_fd_pre(DECL_ARGS)
 {  {
Line 1424 
Line 1376 
         return(termp_bold_pre(p, pair, meta, n));          return(termp_bold_pre(p, pair, meta, n));
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_fd_post(DECL_ARGS)  termp_fd_post(DECL_ARGS)
 {  {
Line 1433 
Line 1383 
         term_newln(p);          term_newln(p);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_sh_pre(DECL_ARGS)  termp_sh_pre(DECL_ARGS)
 {  {
Line 1442 
Line 1390 
         /* No vspace between consecutive `Sh' calls. */          /* No vspace between consecutive `Sh' calls. */
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_BLOCK):          case MDOC_BLOCK:
                 if (n->prev && MDOC_Sh == n->prev->tok)                  if (n->prev && MDOC_Sh == n->prev->tok)
                         if (NULL == n->prev->body->child)                          if (NULL == n->prev->body->child)
                                 break;                                  break;
                 term_vspace(p);                  term_vspace(p);
                 break;                  break;
         case (MDOC_HEAD):          case MDOC_HEAD:
                 term_fontpush(p, TERMFONT_BOLD);                  term_fontpush(p, TERMFONT_BOLD);
                 break;                  break;
         case (MDOC_BODY):          case MDOC_BODY:
                 p->offset = term_len(p, p->defindent);                  p->offset = term_len(p, p->defindent);
                 if (SEC_AUTHORS == n->sec)                  if (SEC_AUTHORS == n->sec)
                         p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT);                          p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT);
Line 1462 
Line 1410 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_sh_post(DECL_ARGS)  termp_sh_post(DECL_ARGS)
 {  {
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_HEAD):          case MDOC_HEAD:
                 term_newln(p);                  term_newln(p);
                 break;                  break;
         case (MDOC_BODY):          case MDOC_BODY:
                 term_newln(p);                  term_newln(p);
                 p->offset = 0;                  p->offset = 0;
                 break;                  break;
Line 1481 
Line 1427 
         }          }
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_bt_pre(DECL_ARGS)  termp_bt_pre(DECL_ARGS)
 {  {
Line 1492 
Line 1436 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_lb_post(DECL_ARGS)  termp_lb_post(DECL_ARGS)
 {  {
Line 1502 
Line 1444 
                 term_newln(p);                  term_newln(p);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_ud_pre(DECL_ARGS)  termp_ud_pre(DECL_ARGS)
 {  {
Line 1513 
Line 1453 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_d1_pre(DECL_ARGS)  termp_d1_pre(DECL_ARGS)
 {  {
Line 1526 
Line 1464 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_ft_pre(DECL_ARGS)  termp_ft_pre(DECL_ARGS)
 {  {
Line 1538 
Line 1474 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_fn_pre(DECL_ARGS)  termp_fn_pre(DECL_ARGS)
 {  {
Line 1601 
Line 1535 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_fa_pre(DECL_ARGS)  termp_fa_pre(DECL_ARGS)
 {  {
Line 1628 
Line 1560 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_bd_pre(DECL_ARGS)  termp_bd_pre(DECL_ARGS)
 {  {
Line 1652 
Line 1582 
          * for macro lines, a newline is appended to the line.  Blank           * for macro lines, a newline is appended to the line.  Blank
          * lines are allowed.           * lines are allowed.
          */           */
   
         if (DISP_literal != n->norm->Bd.type &&          if (DISP_literal != n->norm->Bd.type &&
                         DISP_unfilled != n->norm->Bd.type)              DISP_unfilled != n->norm->Bd.type)
                 return(1);                  return(1);
   
         tabwidth = p->tabwidth;          tabwidth = p->tabwidth;
Line 1674 
Line 1604 
                  * anyway, so don't sweat it.                   * anyway, so don't sweat it.
                  */                   */
                 switch (nn->tok) {                  switch (nn->tok) {
                 case (MDOC_Sm):                  case MDOC_Sm:
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_br):                  case MDOC_br:
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_sp):                  case MDOC_sp:
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_Bl):                  case MDOC_Bl:
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_D1):                  case MDOC_D1:
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_Dl):                  case MDOC_Dl:
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_Lp):                  case MDOC_Lp:
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_Pp):                  case MDOC_Pp:
                         continue;                          continue;
                 default:                  default:
                         break;                          break;
Line 1705 
Line 1635 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_bd_post(DECL_ARGS)  termp_bd_post(DECL_ARGS)
 {  {
         size_t           rm, rmax;          size_t           rm, rmax;
   
         if (MDOC_BODY != n->type)          if (MDOC_BODY != n->type)
                 return;                  return;
   
         rm = p->rmargin;          rm = p->rmargin;
         rmax = p->maxrmargin;          rmax = p->maxrmargin;
   
         if (DISP_literal == n->norm->Bd.type ||          if (DISP_literal == n->norm->Bd.type ||
                         DISP_unfilled == n->norm->Bd.type)              DISP_unfilled == n->norm->Bd.type)
                 p->rmargin = p->maxrmargin = TERM_MAXMARGIN;                  p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
   
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
Line 1729 
Line 1657 
         p->maxrmargin = rmax;          p->maxrmargin = rmax;
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_bx_pre(DECL_ARGS)  termp_bx_pre(DECL_ARGS)
 {  {
Line 1754 
Line 1680 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_xx_pre(DECL_ARGS)  termp_xx_pre(DECL_ARGS)
 {  {
Line 1764 
Line 1688 
   
         pp = NULL;          pp = NULL;
         switch (n->tok) {          switch (n->tok) {
         case (MDOC_Bsx):          case MDOC_Bsx:
                 pp = "BSD/OS";                  pp = "BSD/OS";
                 break;                  break;
         case (MDOC_Dx):          case MDOC_Dx:
                 pp = "DragonFly";                  pp = "DragonFly";
                 break;                  break;
         case (MDOC_Fx):          case MDOC_Fx:
                 pp = "FreeBSD";                  pp = "FreeBSD";
                 break;                  break;
         case (MDOC_Nx):          case MDOC_Nx:
                 pp = "NetBSD";                  pp = "NetBSD";
                 break;                  break;
         case (MDOC_Ox):          case MDOC_Ox:
                 pp = "OpenBSD";                  pp = "OpenBSD";
                 break;                  break;
         case (MDOC_Ux):          case MDOC_Ux:
                 pp = "UNIX";                  pp = "UNIX";
                 break;                  break;
         default:          default:
Line 1797 
Line 1721 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_pf_post(DECL_ARGS)  termp_pf_post(DECL_ARGS)
 {  {
Line 1806 
Line 1728 
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_ss_pre(DECL_ARGS)  termp_ss_pre(DECL_ARGS)
 {  {
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_BLOCK):          case MDOC_BLOCK:
                 term_newln(p);                  term_newln(p);
                 if (n->prev)                  if (n->prev)
                         term_vspace(p);                          term_vspace(p);
                 break;                  break;
         case (MDOC_HEAD):          case MDOC_HEAD:
                 term_fontpush(p, TERMFONT_BOLD);                  term_fontpush(p, TERMFONT_BOLD);
                 p->offset = term_len(p, (p->defindent+1)/2);                  p->offset = term_len(p, (p->defindent+1)/2);
                 break;                  break;
Line 1829 
Line 1749 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_ss_post(DECL_ARGS)  termp_ss_post(DECL_ARGS)
 {  {
Line 1839 
Line 1757 
                 term_newln(p);                  term_newln(p);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_cd_pre(DECL_ARGS)  termp_cd_pre(DECL_ARGS)
 {  {
Line 1850 
Line 1766 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_in_pre(DECL_ARGS)  termp_in_pre(DECL_ARGS)
 {  {
Line 1871 
Line 1785 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_in_post(DECL_ARGS)  termp_in_post(DECL_ARGS)
 {  {
Line 1887 
Line 1799 
                 term_fontpop(p);                  term_fontpop(p);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_sp_pre(DECL_ARGS)  termp_sp_pre(DECL_ARGS)
 {  {
         size_t           i, len;          size_t           i, len;
   
         switch (n->tok) {          switch (n->tok) {
         case (MDOC_sp):          case MDOC_sp:
                 len = n->child ? a2height(p, n->child->string) : 1;                  len = n->child ? a2height(p, n->child->string) : 1;
                 break;                  break;
         case (MDOC_br):          case MDOC_br:
                 len = 0;                  len = 0;
                 break;                  break;
         default:          default:
Line 1914 
Line 1824 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_quote_pre(DECL_ARGS)  termp_quote_pre(DECL_ARGS)
 {  {
Line 1924 
Line 1832 
                 return(1);                  return(1);
   
         switch (n->tok) {          switch (n->tok) {
         case (MDOC_Ao):          case MDOC_Ao:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Aq):          case MDOC_Aq:
                 term_word(p, "<");                  term_word(p, "<");
                 break;                  break;
         case (MDOC_Bro):          case MDOC_Bro:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Brq):          case MDOC_Brq:
                 term_word(p, "{");                  term_word(p, "{");
                 break;                  break;
         case (MDOC_Oo):          case MDOC_Oo:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Op):          case MDOC_Op:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Bo):          case MDOC_Bo:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Bq):          case MDOC_Bq:
                 term_word(p, "[");                  term_word(p, "[");
                 break;                  break;
         case (MDOC_Do):          case MDOC_Do:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Dq):          case MDOC_Dq:
                 term_word(p, "\\(lq");                  term_word(p, "\\(lq");
                 break;                  break;
         case (MDOC_Eo):          case MDOC_Eo:
                 break;                  break;
         case (MDOC_Po):          case MDOC_Po:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Pq):          case MDOC_Pq:
                 term_word(p, "(");                  term_word(p, "(");
                 break;                  break;
         case (MDOC__T):          case MDOC__T:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Qo):          case MDOC_Qo:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Qq):          case MDOC_Qq:
                 term_word(p, "\"");                  term_word(p, "\"");
                 break;                  break;
         case (MDOC_Ql):          case MDOC_Ql:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_So):          case MDOC_So:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Sq):          case MDOC_Sq:
                 term_word(p, "\\(oq");                  term_word(p, "\\(oq");
                 break;                  break;
         default:          default:
Line 1978 
Line 1886 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_quote_post(DECL_ARGS)  termp_quote_post(DECL_ARGS)
 {  {
Line 1990 
Line 1896 
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
   
         switch (n->tok) {          switch (n->tok) {
         case (MDOC_Ao):          case MDOC_Ao:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Aq):          case MDOC_Aq:
                 term_word(p, ">");                  term_word(p, ">");
                 break;                  break;
         case (MDOC_Bro):          case MDOC_Bro:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Brq):          case MDOC_Brq:
                 term_word(p, "}");                  term_word(p, "}");
                 break;                  break;
         case (MDOC_Oo):          case MDOC_Oo:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Op):          case MDOC_Op:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Bo):          case MDOC_Bo:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Bq):          case MDOC_Bq:
                 term_word(p, "]");                  term_word(p, "]");
                 break;                  break;
         case (MDOC_Do):          case MDOC_Do:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Dq):          case MDOC_Dq:
                 term_word(p, "\\(rq");                  term_word(p, "\\(rq");
                 break;                  break;
         case (MDOC_Eo):          case MDOC_Eo:
                 break;                  break;
         case (MDOC_Po):          case MDOC_Po:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Pq):          case MDOC_Pq:
                 term_word(p, ")");                  term_word(p, ")");
                 break;                  break;
         case (MDOC__T):          case MDOC__T:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Qo):          case MDOC_Qo:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Qq):          case MDOC_Qq:
                 term_word(p, "\"");                  term_word(p, "\"");
                 break;                  break;
         case (MDOC_Ql):          case MDOC_Ql:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_So):          case MDOC_So:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Sq):          case MDOC_Sq:
                 term_word(p, "\\(cq");                  term_word(p, "\\(cq");
                 break;                  break;
         default:          default:
Line 2041 
Line 1947 
         }          }
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_fo_pre(DECL_ARGS)  termp_fo_pre(DECL_ARGS)
 {  {
Line 2085 
Line 1989 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_fo_post(DECL_ARGS)  termp_fo_post(DECL_ARGS)
 {  {
   
         if (MDOC_BODY != n->type)          if (MDOC_BODY != n->type)
                 return;                  return;
   
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
Line 2104 
Line 2006 
         }          }
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_bf_pre(DECL_ARGS)  termp_bf_pre(DECL_ARGS)
 {  {
Line 2115 
Line 2015 
         else if (MDOC_BODY != n->type)          else if (MDOC_BODY != n->type)
                 return(1);                  return(1);
   
         if (FONT_Em == n->norm->Bf.font)          if (FONT_Em == n->norm->Bf.font)
                 term_fontpush(p, TERMFONT_UNDER);                  term_fontpush(p, TERMFONT_UNDER);
         else if (FONT_Sy == n->norm->Bf.font)          else if (FONT_Sy == n->norm->Bf.font)
                 term_fontpush(p, TERMFONT_BOLD);                  term_fontpush(p, TERMFONT_BOLD);
         else          else
                 term_fontpush(p, TERMFONT_NONE);                  term_fontpush(p, TERMFONT_NONE);
   
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_sm_pre(DECL_ARGS)  termp_sm_pre(DECL_ARGS)
 {  {
Line 2142 
Line 2040 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_ap_pre(DECL_ARGS)  termp_ap_pre(DECL_ARGS)
 {  {
Line 2154 
Line 2050 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp____post(DECL_ARGS)  termp____post(DECL_ARGS)
 {  {
Line 2183 
Line 2077 
                 term_word(p, ",");                  term_word(p, ",");
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_li_pre(DECL_ARGS)  termp_li_pre(DECL_ARGS)
 {  {
Line 2193 
Line 2085 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_lk_pre(DECL_ARGS)  termp_lk_pre(DECL_ARGS)
 {  {
Line 2221 
Line 2111 
         return(0);          return(0);
 }  }
   
   
 /* ARGSUSED */  
 static int  static int
 termp_bk_pre(DECL_ARGS)  termp_bk_pre(DECL_ARGS)
 {  {
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_BLOCK):          case MDOC_BLOCK:
                 break;                  break;
         case (MDOC_HEAD):          case MDOC_HEAD:
                 return(0);                  return(0);
         case (MDOC_BODY):          case MDOC_BODY:
                 if (n->parent->args || 0 == n->prev->nchild)                  if (n->parent->args || 0 == n->prev->nchild)
                         p->flags |= TERMP_PREKEEP;                          p->flags |= TERMP_PREKEEP;
                 break;                  break;
Line 2244 
Line 2132 
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  
 static void  static void
 termp_bk_post(DECL_ARGS)  termp_bk_post(DECL_ARGS)
 {  {
Line 2254 
Line 2140 
                 p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);                  p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
 }  }
   
 /* ARGSUSED */  
 static void  static void
 termp__t_post(DECL_ARGS)  termp__t_post(DECL_ARGS)
 {  {
Line 2264 
Line 2149 
          * us instead of underlining us (for disambiguation).           * us instead of underlining us (for disambiguation).
          */           */
         if (n->parent && MDOC_Rs == n->parent->tok &&          if (n->parent && MDOC_Rs == n->parent->tok &&
                         n->parent->norm->Rs.quote_T)              n->parent->norm->Rs.quote_T)
                 termp_quote_post(p, pair, meta, n);                  termp_quote_post(p, pair, meta, n);
   
         termp____post(p, pair, meta, n);          termp____post(p, pair, meta, n);
 }  }
   
 /* ARGSUSED */  
 static int  static int
 termp__t_pre(DECL_ARGS)  termp__t_pre(DECL_ARGS)
 {  {
Line 2280 
Line 2164 
          * us instead of underlining us (for disambiguation).           * us instead of underlining us (for disambiguation).
          */           */
         if (n->parent && MDOC_Rs == n->parent->tok &&          if (n->parent && MDOC_Rs == n->parent->tok &&
                         n->parent->norm->Rs.quote_T)              n->parent->norm->Rs.quote_T)
                 return(termp_quote_pre(p, pair, meta, n));                  return(termp_quote_pre(p, pair, meta, n));
   
         term_fontpush(p, TERMFONT_UNDER);          term_fontpush(p, TERMFONT_UNDER);
         return(1);          return(1);
 }  }
   
 /* ARGSUSED */  
 static int  static int
 termp_under_pre(DECL_ARGS)  termp_under_pre(DECL_ARGS)
 {  {

Legend:
Removed from v.1.165  
changed lines
  Added in v.1.166