[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.28 and 1.29

version 1.28, 2009/07/12 17:25:07 version 1.29, 2009/07/12 17:45:17
Line 87  const int ttypes[TTYPE_NMAX] = {
Line 87  const int ttypes[TTYPE_NMAX] = {
 struct  termpair {  struct  termpair {
         struct termpair  *ppair;          struct termpair  *ppair;
         int               flag;         /* Whether being used. */          int               flag;         /* Whether being used. */
         size_t            offset;       /* Left margin. */  
         size_t            rmargin;      /* Right margin. */          size_t            rmargin;      /* Right margin. */
         int               count;        /* Enum count. */          int               count;        /* Enum count. */
 };  };
Line 347  print_node(DECL_ARGS)
Line 346  print_node(DECL_ARGS)
 {  {
         int              dochild;          int              dochild;
         struct termpair  npair;          struct termpair  npair;
           size_t           offset;
   
         /* Pre-processing. */          /* Pre-processing. */
   
         dochild = 1;          dochild = 1;
           offset = p->offset;
   
         npair.ppair = pair;          npair.ppair = pair;
         npair.offset = npair.rmargin = 0;          npair.rmargin = 0;
         npair.flag = 0;          npair.flag = 0;
         npair.count = 0;          npair.count = 0;
   
Line 370  print_node(DECL_ARGS)
Line 372  print_node(DECL_ARGS)
         if (dochild && node->child)          if (dochild && node->child)
                 print_body(p, &npair, meta, node->child);                  print_body(p, &npair, meta, node->child);
   
         p->flags &= ~npair.flag;  
   
         /* Post-processing. */          /* Post-processing. */
   
         if (MDOC_TEXT != node->type)          if (MDOC_TEXT != node->type)
                 if (termacts[node->tok].post)                  if (termacts[node->tok].post)
                         (*termacts[node->tok].post)(p, &npair, meta, node);                          (*termacts[node->tok].post)(p, &npair, meta, node);
   
           p->offset = offset;
           p->flags &= ~npair.flag;
 }  }
   
   
Line 705  termp_it_pre(DECL_ARGS)
Line 708  termp_it_pre(DECL_ARGS)
   
         /* Save parent attributes. */          /* Save parent attributes. */
   
         pair->offset = p->offset;  
         pair->rmargin = p->rmargin;          pair->rmargin = p->rmargin;
         pair->flag = p->flags;          pair->flag = p->flags;
   
Line 969  termp_it_post(DECL_ARGS)
Line 971  termp_it_post(DECL_ARGS)
                 break;                  break;
         }          }
   
         p->offset = pair->offset;  
         p->rmargin = pair->rmargin;          p->rmargin = pair->rmargin;
         p->flags = pair->flag;          p->flags = pair->flag;
 }  }
Line 1188  termp_vt_pre(DECL_ARGS)
Line 1189  termp_vt_pre(DECL_ARGS)
 {  {
   
         /* FIXME: this can be "type name". */          /* FIXME: this can be "type name". */
         pair->flag |= TTYPE_VAR_DECL;          pair->flag |= ttypes[TTYPE_VAR_DECL];
         return(1);          return(1);
 }  }
   
Line 1208  static int
Line 1209  static int
 termp_fd_pre(DECL_ARGS)  termp_fd_pre(DECL_ARGS)
 {  {
   
         pair->flag |= TTYPE_FUNC_DECL;          pair->flag |= ttypes[TTYPE_FUNC_DECL];
         return(1);          return(1);
 }  }
   
Line 1220  termp_fd_post(DECL_ARGS)
Line 1221  termp_fd_post(DECL_ARGS)
   
         if (node->sec != SEC_SYNOPSIS)          if (node->sec != SEC_SYNOPSIS)
                 return;                  return;
   
         term_newln(p);          term_newln(p);
         if (node->next && MDOC_Fd != node->next->tok)          if (node->next && MDOC_Fd != node->next->tok)
                 term_vspace(p);                  term_vspace(p);
Line 1336  termp_d1_pre(DECL_ARGS)
Line 1338  termp_d1_pre(DECL_ARGS)
         if (MDOC_BLOCK != node->type)          if (MDOC_BLOCK != node->type)
                 return(1);                  return(1);
         term_newln(p);          term_newln(p);
         pair->offset = INDENT + 1;          p->offset += (INDENT + 1);
         p->offset += pair->offset;  
         return(1);          return(1);
 }  }
   
Line 1350  termp_d1_post(DECL_ARGS)
Line 1351  termp_d1_post(DECL_ARGS)
         if (MDOC_BLOCK != node->type)          if (MDOC_BLOCK != node->type)
                 return;                  return;
         term_newln(p);          term_newln(p);
         p->offset -= pair->offset;  
 }  }
   
   
Line 1519  termp_bd_pre(DECL_ARGS)
Line 1519  termp_bd_pre(DECL_ARGS)
         if (NULL == node->parent->args)          if (NULL == node->parent->args)
                 errx(1, "missing display type");                  errx(1, "missing display type");
   
         pair->offset = p->offset;  
   
         for (type = -1, i = 0;          for (type = -1, i = 0;
                         i < (int)node->parent->args->argc; i++) {                          i < (int)node->parent->args->argc; i++) {
                 switch (node->parent->args->argv[i].arg) {                  switch (node->parent->args->argv[i].arg) {
Line 1590  termp_bd_post(DECL_ARGS)
Line 1588  termp_bd_post(DECL_ARGS)
   
         term_flushln(p);          term_flushln(p);
         p->flags &= ~TERMP_LITERAL;          p->flags &= ~TERMP_LITERAL;
         p->offset = pair->offset;  
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
 }  }
   
Line 1740  static void
Line 1737  static void
 termp_ss_post(DECL_ARGS)  termp_ss_post(DECL_ARGS)
 {  {
   
         switch (node->type) {          if (MDOC_HEAD == node->type)
         case (MDOC_HEAD):  
                 term_newln(p);                  term_newln(p);
                 p->offset = INDENT;  
                 break;  
         default:  
                 break;  
         }  
 }  }
   
   

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

CVSweb