[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.20 and 1.23

version 1.20, 2009/08/13 12:15:58 version 1.23, 2009/08/17 11:03:07
Line 66  static int    pre_sp(DECL_ARGS);
Line 66  static int    pre_sp(DECL_ARGS);
   
 static  void              post_B(DECL_ARGS);  static  void              post_B(DECL_ARGS);
 static  void              post_I(DECL_ARGS);  static  void              post_I(DECL_ARGS);
   static  void              post_IP(DECL_ARGS);
 static  void              post_HP(DECL_ARGS);  static  void              post_HP(DECL_ARGS);
 static  void              post_SH(DECL_ARGS);  static  void              post_SH(DECL_ARGS);
 static  void              post_SS(DECL_ARGS);  static  void              post_SS(DECL_ARGS);
   static  void              post_TP(DECL_ARGS);
 static  void              post_i(DECL_ARGS);  static  void              post_i(DECL_ARGS);
   
 static const struct termact termacts[MAN_MAX] = {  static const struct termact termacts[MAN_MAX] = {
Line 76  static const struct termact termacts[MAN_MAX] = {
Line 78  static const struct termact termacts[MAN_MAX] = {
         { NULL, NULL }, /* TH */          { NULL, NULL }, /* TH */
         { pre_SH, post_SH }, /* SH */          { pre_SH, post_SH }, /* SH */
         { pre_SS, post_SS }, /* SS */          { pre_SS, post_SS }, /* SS */
         { pre_TP, NULL }, /* TP */          { pre_TP, post_TP }, /* TP */
         { pre_PP, NULL }, /* LP */          { pre_PP, NULL }, /* LP */
         { pre_PP, NULL }, /* PP */          { pre_PP, NULL }, /* PP */
         { pre_PP, NULL }, /* P */          { pre_PP, NULL }, /* P */
         { pre_IP, NULL }, /* IP */          { pre_IP, post_IP }, /* IP */
         { pre_HP, post_HP }, /* HP */          { pre_HP, post_HP }, /* HP */
         { NULL, NULL }, /* SM */          { NULL, NULL }, /* SM */
         { pre_B, post_B }, /* SB */          { pre_B, post_B }, /* SB */
Line 467  pre_PP(DECL_ARGS)
Line 469  pre_PP(DECL_ARGS)
 static int  static int
 pre_IP(DECL_ARGS)  pre_IP(DECL_ARGS)
 {  {
         /* TODO */          const struct man_node   *nn;
 #if 0          size_t                   len;
         const struct man_node *nn;          int                      ival;
         size_t           offs, sv;  
         int              ival;  
   
         fmt_block_vspace(p, n);          switch (n->type) {
           case (MAN_BODY):
                   p->flags |= TERMP_NOLPAD;
                   p->flags |= TERMP_NOSPACE;
                   break;
           case (MAN_HEAD):
                   p->flags |= TERMP_NOBREAK;
                   p->flags |= TERMP_TWOSPACE;
                   break;
           case (MAN_BLOCK):
                   fmt_block_vspace(p, n);
                   /* FALLTHROUGH */
           default:
                   return(1);
           }
   
         p->flags |= TERMP_NOSPACE;          len = INDENT;
           ival = -1;
   
         sv = p->offset;          /* Calculate offset. */
         p->offset = INDENT;  
   
         if (NULL == n->child)          if (NULL != (nn = n->parent->head->child))
                 return(1);                  if (NULL != (nn = nn->next)) {
                           for ( ; nn->next; nn = nn->next)
                                   /* Do nothing. */ ;
                           if ((ival = arg_width(nn)) >= 0)
                                   len = (size_t)ival;
                   }
   
         p->flags |= TERMP_NOBREAK;          switch (n->type) {
           case (MAN_HEAD):
                   /* Handle zero-width lengths. */
                   if (0 == len)
                           len = 1;
   
         offs = sv;                  p->offset = INDENT;
                   p->rmargin = INDENT + len;
                   if (ival < 0)
                           break;
   
         /*                  /* Don't print the length value. */
          * If the last token is number-looking (3m, 3n, 3) then                  for (nn = n->child; nn->next; nn = nn->next)
          * interpret it as the width specifier, else we stick with the                          print_node(p, fl, nn, m);
          * prior saved offset.  XXX - obviously not documented.                  return(0);
          */          case (MAN_BODY):
         for (nn = n->child; nn; nn = nn->next) {                  p->offset = INDENT + len;
                 if (NULL == nn->next) {                  p->rmargin = p->maxrmargin;
                         ival = arg_width(nn);                  break;
                         if (ival >= 0) {          default:
                                 offs = (size_t)ival;                  break;
                                 break;  
                         }  
                 }  
                 print_node(p, fl, nn, m);  
         }          }
   
         p->rmargin = p->offset + offs;          return(1);
   }
   
         term_flushln(p);  
   
         p->offset = offs;  /* ARGSUSED */
         p->rmargin = p->maxrmargin;  static void
   post_IP(DECL_ARGS)
   {
   
         p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;          switch (n->type) {
           case (MAN_HEAD):
         return(0);                  term_flushln(p);
 #endif                  p->flags &= ~TERMP_NOBREAK;
         return(1);                  p->flags &= ~TERMP_TWOSPACE;
                   p->rmargin = p->maxrmargin;
                   break;
           case (MAN_BODY):
                   term_flushln(p);
                   p->flags &= ~TERMP_NOLPAD;
                   break;
           default:
                   break;
           }
 }  }
   
   
Line 522  pre_IP(DECL_ARGS)
Line 555  pre_IP(DECL_ARGS)
 static int  static int
 pre_TP(DECL_ARGS)  pre_TP(DECL_ARGS)
 {  {
         /* TODO */          const struct man_node   *nn;
 #if 0          size_t                   len;
         const struct man_node *nn;          int                      ival;
         size_t           offs;  
   
         term_vspace(p);          switch (n->type) {
           case (MAN_HEAD):
                   p->flags |= TERMP_NOBREAK;
                   p->flags |= TERMP_TWOSPACE;
                   break;
           case (MAN_BODY):
                   p->flags |= TERMP_NOLPAD;
                   p->flags |= TERMP_NOSPACE;
                   break;
           case (MAN_BLOCK):
                   fmt_block_vspace(p, n);
                   /* FALLTHROUGH */
           default:
                   return(1);
           }
   
         p->offset = INDENT;          len = INDENT;
           ival = -1;
   
         if (NULL == (nn = n->child))          /* Calculate offset. */
                 return(1);  
   
         if (nn->line == n->line) {          if (NULL != (nn = n->parent->head->child))
                 if (MAN_TEXT != nn->type)                  if (NULL != nn->next)
                         errx(1, "expected text line argument");                          if ((ival = arg_width(nn)) >= 0)
                 offs = (size_t)atoi(nn->string);                                  len = (size_t)ival;
                 nn = nn->next;  
         } else  
                 offs = INDENT;  
   
         for ( ; nn; nn = nn->next)          switch (n->type) {
                 print_node(p, fl, nn, m);          case (MAN_HEAD):
                   /* Handle zero-length properly. */
                   if (0 == len)
                           len = 1;
   
         term_flushln(p);                  p->offset = INDENT;
         p->flags |= TERMP_NOSPACE;                  p->rmargin = INDENT + len;
         p->offset += offs;  
         return(0);                  /* Don't print same-line elements. */
 #endif                  for (nn = n->child; nn; nn = nn->next)
                           if (nn->line > n->line)
                                   print_node(p, fl, nn, m);
                   return(0);
           case (MAN_BODY):
                   p->offset = INDENT + len;
                   p->rmargin = p->maxrmargin;
                   break;
           default:
                   break;
           }
   
         return(1);          return(1);
 }  }
   
   
 /* ARGSUSED */  /* ARGSUSED */
   static void
   post_TP(DECL_ARGS)
   {
   
           switch (n->type) {
           case (MAN_HEAD):
                   term_flushln(p);
                   p->flags &= ~TERMP_NOBREAK;
                   p->flags &= ~TERMP_TWOSPACE;
                   p->rmargin = p->maxrmargin;
                   break;
           case (MAN_BODY):
                   term_flushln(p);
                   p->flags &= ~TERMP_NOLPAD;
                   break;
           default:
                   break;
           }
   }
   
   
   /* ARGSUSED */
 static int  static int
 pre_SS(DECL_ARGS)  pre_SS(DECL_ARGS)
 {  {
Line 598  post_SS(DECL_ARGS)
Line 677  post_SS(DECL_ARGS)
 static int  static int
 pre_SH(DECL_ARGS)  pre_SH(DECL_ARGS)
 {  {
         /*  
          * XXX: undocumented: using two `SH' macros in sequence has no  
          * vspace between calls, only a newline.  
          */  
         switch (n->type) {          switch (n->type) {
         case (MAN_BLOCK):          case (MAN_BLOCK):
                   /* If following a prior empty `SH', no vspace. */
                 if (n->prev && MAN_SH == n->prev->tok)                  if (n->prev && MAN_SH == n->prev->tok)
                         if (NULL == n->prev->body->child)                          if (NULL == n->prev->body->child)
                                 break;                                  break;

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.23

CVSweb