[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.30 and 1.31

version 1.30, 2012/07/10 14:38:51 version 1.31, 2012/07/10 19:54:11
Line 100  static int   pre_ux(DECL_ARGS);
Line 100  static int   pre_ux(DECL_ARGS);
 static  int       pre_xr(DECL_ARGS);  static  int       pre_xr(DECL_ARGS);
 static  void      print_word(const char *);  static  void      print_word(const char *);
 static  void      print_offs(const char *);  static  void      print_offs(const char *);
 static  void      print_width(const char *);  static  void      print_width(const char *, const struct mdoc_node *);
 static  void      print_count(int *);  static  void      print_count(int *);
 static  void      print_node(DECL_ARGS);  static  void      print_node(DECL_ARGS);
   
Line 360  print_offs(const char *v)
Line 360  print_offs(const char *v)
 }  }
   
 void  void
 print_width(const char *v)  print_width(const char *v, const struct mdoc_node *child)
 {  {
         char              buf[24];          char              buf[24];
         struct roffsu     su;          struct roffsu     su;
         size_t            sz;          size_t            sz, chsz;
   
           /* XXX Rough estimation, might have multiple parts. */
           chsz = (NULL != child && MDOC_TEXT == child->type) ?
                           strlen(child->string) : 0;
   
         if (a2roffsu(v, &su, SCALE_MAX)) {          if (a2roffsu(v, &su, SCALE_MAX)) {
                 if (SCALE_EN == su.unit)                  if (SCALE_EN == su.unit)
                         sz = su.scale;                          sz = su.scale;
                 else {                  else {
                           if (chsz)
                                   print_word(".HP");
                           else
                                   print_word(".TP");
                         print_word(v);                          print_word(v);
                         return;                          return;
                 }                  }
         } else          } else
                 sz = strlen(v);                  sz = strlen(v);
   
           if (chsz > sz)
                   print_word(".HP");
           else
                   print_word(".TP");
         snprintf(buf, sizeof(buf), "%ldn", sz + 2);          snprintf(buf, sizeof(buf), "%ldn", sz + 2);
         print_word(buf);          print_word(buf);
 }  }
Line 1027  pre_it(DECL_ARGS)
Line 1039  pre_it(DECL_ARGS)
                 case (LIST_dash):                  case (LIST_dash):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (LIST_hyphen):                  case (LIST_hyphen):
                         print_word(".TP");                          print_width(bln->norm->Bl.width, NULL);
                         print_width(bln->norm->Bl.width);  
                         outflags |= MMAN_nl;                          outflags |= MMAN_nl;
                         font_push('B');                          font_push('B');
                         if (LIST_bullet == bln->norm->Bl.type)                          if (LIST_bullet == bln->norm->Bl.type)
Line 1038  pre_it(DECL_ARGS)
Line 1049  pre_it(DECL_ARGS)
                         font_pop();                          font_pop();
                         break;                          break;
                 case (LIST_enum):                  case (LIST_enum):
                         print_word(".TP");                          print_width(bln->norm->Bl.width, NULL);
                         print_width(bln->norm->Bl.width);  
                         outflags |= MMAN_nl;                          outflags |= MMAN_nl;
                         print_count(&bln->norm->Bl.count);                          print_count(&bln->norm->Bl.count);
                         outflags |= MMAN_nl;                          outflags |= MMAN_nl;
                         break;                          break;
                   case (LIST_hang):
                           print_width(bln->norm->Bl.width, n->child);
                           outflags |= MMAN_nl;
                           break;
                 default:                  default:
                         if (bln->norm->Bl.width)                          if (bln->norm->Bl.width)
                                 print_width(bln->norm->Bl.width);                                  print_width(bln->norm->Bl.width, n->child);
                         break;                          break;
                 }                  }
                 outflags |= MMAN_nl;                  outflags |= MMAN_nl;

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

CVSweb