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

Diff for /mandoc/man_term.c between version 1.157 and 1.162

version 1.157, 2014/12/02 10:08:06 version 1.162, 2014/12/23 09:31:46
Line 57  struct termact {
Line 57  struct termact {
 };  };
   
 static  int               a2width(const struct termp *, const char *);  static  int               a2width(const struct termp *, const char *);
 static  size_t            a2height(const struct termp *, const char *);  
   
 static  void              print_man_nodelist(DECL_ARGS);  static  void              print_man_nodelist(DECL_ARGS);
 static  void              print_man_node(DECL_ARGS);  static  void              print_man_node(DECL_ARGS);
Line 123  static const struct termact termacts[MAN_MAX] = {
Line 122  static const struct termact termacts[MAN_MAX] = {
         { NULL, NULL, 0 }, /* RE */          { NULL, NULL, 0 }, /* RE */
         { pre_RS, post_RS, 0 }, /* RS */          { pre_RS, post_RS, 0 }, /* RS */
         { pre_ign, NULL, 0 }, /* DT */          { pre_ign, NULL, 0 }, /* DT */
         { pre_ign, NULL, 0 }, /* UC */          { pre_ign, NULL, MAN_NOTEXT }, /* UC */
         { pre_PD, NULL, MAN_NOTEXT }, /* PD */          { pre_PD, NULL, MAN_NOTEXT }, /* PD */
         { pre_ign, NULL, 0 }, /* AT */          { pre_ign, NULL, 0 }, /* AT */
         { pre_in, NULL, MAN_NOTEXT }, /* in */          { pre_in, NULL, MAN_NOTEXT }, /* in */
Line 184  terminal_man(void *arg, const struct man *man)
Line 183  terminal_man(void *arg, const struct man *man)
         }          }
 }  }
   
   
 static size_t  
 a2height(const struct termp *p, const char *cp)  
 {  
         struct roffsu    su;  
   
         if ( ! a2roffsu(cp, &su, SCALE_VS))  
                 SCALE_VS_INIT(&su, atoi(cp));  
   
         return(term_vspan(p, &su));  
 }  
   
 static int  static int
 a2width(const struct termp *p, const char *cp)  a2width(const struct termp *p, const char *cp)
 {  {
         struct roffsu    su;          struct roffsu    su;
   
         if ( ! a2roffsu(cp, &su, SCALE_BU))          if ( ! a2roffsu(cp, &su, SCALE_EN))
                 return(-1);                  return(-1);
   
         return((int)term_hspan(p, &su));          return((int)term_hspan(p, &su));
Line 288  pre_literal(DECL_ARGS)
Line 275  pre_literal(DECL_ARGS)
 static int  static int
 pre_PD(DECL_ARGS)  pre_PD(DECL_ARGS)
 {  {
           struct roffsu    su;
   
         n = n->child;          n = n->child;
         if (0 == n) {          if (n == NULL) {
                 mt->pardist = 1;                  mt->pardist = 1;
                 return(0);                  return(0);
         }          }
         assert(MAN_TEXT == n->type);          assert(MAN_TEXT == n->type);
         mt->pardist = atoi(n->string);          if (a2roffsu(n->string, &su, SCALE_VS))
                   mt->pardist = term_vspan(p, &su);
         return(0);          return(0);
 }  }
   
Line 462  pre_in(DECL_ARGS)
Line 451  pre_in(DECL_ARGS)
 static int  static int
 pre_sp(DECL_ARGS)  pre_sp(DECL_ARGS)
 {  {
           struct roffsu    su;
         char            *s;          char            *s;
         size_t           i, len;          size_t           i, len;
         int              neg;          int              neg;
Line 499  pre_sp(DECL_ARGS)
Line 489  pre_sp(DECL_ARGS)
                         neg = 1;                          neg = 1;
                         s++;                          s++;
                 }                  }
                 len = a2height(p, s);                  if ( ! a2roffsu(s, &su, SCALE_VS))
                           su.scale = 1.0;
                   len = term_vspan(p, &su);
                 break;                  break;
         }          }
   
Line 631  pre_IP(DECL_ARGS)
Line 623  pre_IP(DECL_ARGS)
   
                 p->offset = mt->offset;                  p->offset = mt->offset;
                 p->rmargin = mt->offset + len;                  p->rmargin = mt->offset + len;
                 if (ival < 0)  
                         break;  
   
                 /* Set the saved left-margin. */                  /* Set the saved left-margin. */
                 mt->lmargin[mt->lmargincur] = (size_t)ival;                  if (ival >= 0)
                           mt->lmargin[mt->lmargincur] = (size_t)ival;
   
                 savelit = MANT_LITERAL & mt->fl;                  savelit = MANT_LITERAL & mt->fl;
                 mt->fl &= ~MANT_LITERAL;                  mt->fl &= ~MANT_LITERAL;
Line 778  pre_SS(DECL_ARGS)
Line 769  pre_SS(DECL_ARGS)
                 mt->fl &= ~MANT_LITERAL;                  mt->fl &= ~MANT_LITERAL;
                 mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);                  mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
                 mt->offset = term_len(p, p->defindent);                  mt->offset = term_len(p, p->defindent);
                 /* If following a prior empty `SS', no vspace. */  
                 if (n->prev && MAN_SS == n->prev->tok)                  /*
                         if (NULL == n->prev->body->child)                   * No vertical space before the first subsection
                                 break;                   * and after an empty subsection.
                 if (NULL == n->prev)                   */
   
                   do {
                           n = n->prev;
                   } while (n != NULL && termacts[n->tok].flags & MAN_NOTEXT);
                   if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
                         break;                          break;
   
                 for (i = 0; i < mt->pardist; i++)                  for (i = 0; i < mt->pardist; i++)
                         term_vspace(p);                          term_vspace(p);
                 break;                  break;
Line 827  pre_SH(DECL_ARGS)
Line 824  pre_SH(DECL_ARGS)
                 mt->fl &= ~MANT_LITERAL;                  mt->fl &= ~MANT_LITERAL;
                 mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);                  mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
                 mt->offset = term_len(p, p->defindent);                  mt->offset = term_len(p, p->defindent);
                 /* If following a prior empty `SH', no vspace. */  
                 if (n->prev && MAN_SH == n->prev->tok)                  /*
                         if (NULL == n->prev->body->child)                   * No vertical space before the first section
                                 break;                   * and after an empty section.
                 /* If the first macro, no vspae. */                   */
                 if (NULL == n->prev)  
                   do {
                           n = n->prev;
                   } while (n != NULL && termacts[n->tok].flags & MAN_NOTEXT);
                   if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
                         break;                          break;
   
                 for (i = 0; i < mt->pardist; i++)                  for (i = 0; i < mt->pardist; i++)
                         term_vspace(p);                          term_vspace(p);
                 break;                  break;

Legend:
Removed from v.1.157  
changed lines
  Added in v.1.162

CVSweb