[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.36 and 1.39

version 1.36, 2009/07/12 20:30:35 version 1.39, 2009/07/14 15:17:25
Line 147  static int   termp_ft_pre(DECL_ARGS);
Line 147  static int   termp_ft_pre(DECL_ARGS);
 static  int       termp_ic_pre(DECL_ARGS);  static  int       termp_ic_pre(DECL_ARGS);
 static  int       termp_in_pre(DECL_ARGS);  static  int       termp_in_pre(DECL_ARGS);
 static  int       termp_it_pre(DECL_ARGS);  static  int       termp_it_pre(DECL_ARGS);
 static  int       termp_lb_pre(DECL_ARGS);  
 static  int       termp_lk_pre(DECL_ARGS);  static  int       termp_lk_pre(DECL_ARGS);
 static  int       termp_ms_pre(DECL_ARGS);  static  int       termp_ms_pre(DECL_ARGS);
 static  int       termp_mt_pre(DECL_ARGS);  static  int       termp_mt_pre(DECL_ARGS);
Line 281  static const struct termact termacts[MDOC_MAX] = {
Line 280  static const struct termact termacts[MDOC_MAX] = {
         { NULL, NULL }, /* Hf */          { NULL, NULL }, /* Hf */
         { NULL, NULL }, /* Fr */          { NULL, NULL }, /* Fr */
         { termp_ud_pre, NULL }, /* Ud */          { termp_ud_pre, NULL }, /* Ud */
         { termp_lb_pre, termp_lb_post }, /* Lb */          { NULL, termp_lb_post }, /* Lb */
         { termp_pp_pre, NULL }, /* Lp */          { termp_pp_pre, NULL }, /* Lp */
         { termp_lk_pre, NULL }, /* Lk */          { termp_lk_pre, NULL }, /* Lk */
         { termp_mt_pre, NULL }, /* Mt */          { termp_mt_pre, NULL }, /* Mt */
Line 572  arg_listtype(const struct mdoc_node *n)
Line 571  arg_listtype(const struct mdoc_node *n)
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_Column):                  case (MDOC_Column):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                   case (MDOC_Hang):
                           /* FALLTHROUGH */
                 case (MDOC_Ohang):                  case (MDOC_Ohang):
                         return(n->args->argv[i].arg);                          return(n->args->argv[i].arg);
                 default:                  default:
                         break;                          break;
                 }                  }
   
         /* FIXME: mandated by parser. */          return(-1);
   
         errx(1, "list type not supported");  
         /* NOTREACHED */  
 }  }
   
   
Line 702  termp_it_pre(DECL_ARGS)
Line 700  termp_it_pre(DECL_ARGS)
 {  {
         const struct mdoc_node *bl, *n;          const struct mdoc_node *bl, *n;
         char                    buf[7];          char                    buf[7];
         int                     i, type, keys[3], vals[3], sv;          int                     i, type, keys[3], vals[3];
         size_t                  width, offset;          size_t                  width, offset;
   
         if (MDOC_BLOCK == node->type)          if (MDOC_BLOCK == node->type)
Line 727  termp_it_pre(DECL_ARGS)
Line 725  termp_it_pre(DECL_ARGS)
         (void)arg_getattrs(keys, vals, 3, bl);          (void)arg_getattrs(keys, vals, 3, bl);
   
         type = arg_listtype(bl);          type = arg_listtype(bl);
           assert(-1 != type);
   
         /* Calculate real width and offset. */          /* Calculate real width and offset. */
   
Line 753  termp_it_pre(DECL_ARGS)
Line 752  termp_it_pre(DECL_ARGS)
         /*          /*
          * 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.  FIXME: double-check that correct.
          */           */
   
         switch (type) {          switch (type) {
Line 769  termp_it_pre(DECL_ARGS)
Line 768  termp_it_pre(DECL_ARGS)
                 if (width < 5)                  if (width < 5)
                         width = 5;                          width = 5;
                 break;                  break;
           case (MDOC_Hang):
                   if (0 == width)
                           width = 8;
                   break;
         case (MDOC_Tag):          case (MDOC_Tag):
                 if (0 == width)                  if (0 == width)
                         width = 10;                          width = 10;
Line 826  termp_it_pre(DECL_ARGS)
Line 829  termp_it_pre(DECL_ARGS)
         case (MDOC_Enum):          case (MDOC_Enum):
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Hyphen):          case (MDOC_Hyphen):
                 /* FALLTHROUGH */                  if (MDOC_HEAD == node->type)
                           p->flags |= TERMP_NOBREAK;
                   else
                           p->flags |= TERMP_NOLPAD;
                   break;
           case (MDOC_Hang):
                   if (MDOC_HEAD == node->type)
                           p->flags |= TERMP_NOBREAK;
                   else
                           p->flags |= TERMP_NOLPAD;
   
                   if (MDOC_HEAD == node->type)
                           p->flags |= TERMP_HANG;
                   break;
         case (MDOC_Tag):          case (MDOC_Tag):
                 if (MDOC_HEAD == node->type)                  if (MDOC_HEAD == node->type)
                         p->flags |= TERMP_NOBREAK;                          p->flags |= TERMP_NOBREAK;
                 else                  else
                         p->flags |= TERMP_NOLPAD;                          p->flags |= TERMP_NOLPAD;
                 if (MDOC_HEAD == node->type && MDOC_Tag == type)  
                         if (NULL == node->next ||                  if (MDOC_HEAD != node->type)
                                         NULL == node->next->child)                          break;
                                 p->flags |= TERMP_NONOBREAK;                  if (NULL == node->next || NULL == node->next->child)
                           p->flags |= TERMP_DANGLE;
                 break;                  break;
         case (MDOC_Column):          case (MDOC_Column):
                 if (MDOC_HEAD == node->type) {                  if (MDOC_HEAD == node->type) {
Line 873  termp_it_pre(DECL_ARGS)
Line 890  termp_it_pre(DECL_ARGS)
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Hyphen):          case (MDOC_Hyphen):
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
           case (MDOC_Hang):
                   /* FALLTHROUGH */
         case (MDOC_Tag):          case (MDOC_Tag):
                 if (MDOC_HEAD == node->type)                  if (MDOC_HEAD == node->type)
                         p->rmargin = p->offset + width;                          p->rmargin = p->offset + width;
Line 891  termp_it_pre(DECL_ARGS)
Line 910  termp_it_pre(DECL_ARGS)
          * HEAD character (temporarily bold, in some cases).           * HEAD character (temporarily bold, in some cases).
          */           */
   
         sv = p->flags;  
         if (MDOC_HEAD == node->type)          if (MDOC_HEAD == node->type)
                 switch (type) {                  switch (type) {
                 case (MDOC_Bullet):                  case (MDOC_Bullet):
                         p->flags |= TERMP_BOLD;                          p->flags |= TERMP_BOLD;
                         term_word(p, "\\[bu]");                          term_word(p, "\\[bu]");
                           p->flags &= ~TERMP_BOLD;
                         break;                          break;
                 case (MDOC_Dash):                  case (MDOC_Dash):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_Hyphen):                  case (MDOC_Hyphen):
                         p->flags |= TERMP_BOLD;                          p->flags |= TERMP_BOLD;
                         term_word(p, "\\(hy");                          term_word(p, "\\(hy");
                           p->flags &= ~TERMP_BOLD;
                         break;                          break;
                 case (MDOC_Enum):                  case (MDOC_Enum):
                         (pair->ppair->ppair->count)++;                          (pair->ppair->ppair->count)++;
Line 914  termp_it_pre(DECL_ARGS)
Line 934  termp_it_pre(DECL_ARGS)
                         break;                          break;
                 }                  }
   
         p->flags = sv; /* Restore saved flags. */  
   
         /*          /*
          * If we're not going to process our children, indicate so here.           * If we're not going to process our children, indicate so here.
          */           */
Line 955  termp_it_post(DECL_ARGS)
Line 973  termp_it_post(DECL_ARGS)
                 return;                  return;
   
         type = arg_listtype(node->parent->parent->parent);          type = arg_listtype(node->parent->parent->parent);
           assert(-1 != type);
   
         switch (type) {          switch (type) {
         case (MDOC_Diag):          case (MDOC_Diag):
Line 1279  termp_bt_pre(DECL_ARGS)
Line 1298  termp_bt_pre(DECL_ARGS)
 {  {
   
         term_word(p, "is currently in beta test.");          term_word(p, "is currently in beta test.");
         return(1);  
 }  
   
   
 /* ARGSUSED */  
 static int  
 termp_lb_pre(DECL_ARGS)  
 {  
         const char      *lb;  
   
         assert(node->child && MDOC_TEXT == node->child->type);  
         lb = mdoc_a2lib(node->child->string);  
         if (lb) {  
                 term_word(p, lb);  
                 return(0);  
         }  
         term_word(p, "library");  
         return(1);          return(1);
 }  }
   

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.39

CVSweb