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

version 1.20, 2012/07/08 15:01:57 version 1.21, 2012/07/08 15:48:13
Line 216  static const struct manact manacts[MDOC_MAX + 1] = {
Line 216  static const struct manact manacts[MDOC_MAX + 1] = {
 static  int             outflags;  static  int             outflags;
 #define MMAN_spc        (1 << 0)  #define MMAN_spc        (1 << 0)
 #define MMAN_nl         (1 << 1)  #define MMAN_nl         (1 << 1)
 #define MMAN_Sm         (1 << 2)  #define MMAN_br         (1 << 2)
 #define MMAN_Bk         (1 << 3)  #define MMAN_sp         (1 << 3)
   #define MMAN_Sm         (1 << 4)
   #define MMAN_Bk         (1 << 5)
   
 static void  static void
 print_word(const char *s)  print_word(const char *s)
 {  {
   
         if (MMAN_nl & outflags) {          if ((MMAN_sp | MMAN_br | MMAN_nl) & outflags) {
                 /*                  /*
                  * If we need a newline, print it now and start afresh.                   * If we need a newline, print it now and start afresh.
                  */                   */
                 putchar('\n');                  if (MMAN_sp & outflags)
                 outflags &= ~(MMAN_nl|MMAN_spc);                          printf("\n.sp\n");
                   else if (MMAN_br & outflags)
                           printf("\n.br\n");
                   else if (MMAN_nl & outflags)
                           putchar('\n');
                   outflags &= ~(MMAN_sp|MMAN_br|MMAN_nl|MMAN_spc);
         } else if (MMAN_spc & outflags && '\0' != s[0])          } else if (MMAN_spc & outflags && '\0' != s[0])
                 /*                  /*
                  * If we need a space, only print it before                   * If we need a space, only print it before
Line 490  static int
Line 497  static int
 pre_bd(DECL_ARGS)  pre_bd(DECL_ARGS)
 {  {
   
         if (0 == n->norm->Bd.comp) {          if (0 == n->norm->Bd.comp)
                 outflags |= MMAN_nl;                  outflags |= MMAN_sp;
                 print_word(".sp");  
         }  
         if (DISP_unfilled == n->norm->Bd.type ||          if (DISP_unfilled == n->norm->Bd.type ||
             DISP_literal  == n->norm->Bd.type) {              DISP_literal  == n->norm->Bd.type) {
                 outflags |= MMAN_nl;                  outflags |= MMAN_nl;
Line 547  static int
Line 552  static int
 pre_br(DECL_ARGS)  pre_br(DECL_ARGS)
 {  {
   
         outflags |= MMAN_nl;          outflags |= MMAN_br;
         print_word(".br");  
         outflags |= MMAN_nl;  
         return(0);          return(0);
 }  }
   
Line 627  pre_fn(DECL_ARGS)
Line 630  pre_fn(DECL_ARGS)
         if (NULL == n)          if (NULL == n)
                 return(0);                  return(0);
   
         if (MDOC_SYNPRETTY & n->flags) {          if (MDOC_SYNPRETTY & n->flags)
                 outflags |= MMAN_nl;                  outflags |= MMAN_br;
                 print_word(".br");  
                 outflags |= MMAN_nl;  
         }  
         print_word("\\fB");          print_word("\\fB");
         outflags &= ~MMAN_spc;          outflags &= ~MMAN_spc;
         print_node(m, n);          print_node(m, n);
Line 648  post_fn(DECL_ARGS)
Line 648  post_fn(DECL_ARGS)
         print_word(")");          print_word(")");
         if (MDOC_SYNPRETTY & n->flags) {          if (MDOC_SYNPRETTY & n->flags) {
                 print_word(";");                  print_word(";");
                 outflags |= MMAN_nl;                  outflags |= MMAN_br;
                 print_word(".br");  
                 outflags |= MMAN_nl;  
         }          }
 }  }
   
Line 660  pre_fo(DECL_ARGS)
Line 658  pre_fo(DECL_ARGS)
   
         switch (n->type) {          switch (n->type) {
         case (MDOC_HEAD):          case (MDOC_HEAD):
                 if (MDOC_SYNPRETTY & n->flags) {                  if (MDOC_SYNPRETTY & n->flags)
                         outflags |= MMAN_nl;                          outflags |= MMAN_br;
                         print_word(".br");  
                         outflags |= MMAN_nl;  
                 }  
                 print_word("\\fB");                  print_word("\\fB");
                 outflags &= ~MMAN_spc;                  outflags &= ~MMAN_spc;
                 break;                  break;
Line 701  pre_in(DECL_ARGS)
Line 696  pre_in(DECL_ARGS)
 {  {
   
         if (MDOC_SYNPRETTY & n->flags) {          if (MDOC_SYNPRETTY & n->flags) {
                 outflags |= MMAN_nl;                  outflags |= MMAN_br;
                 print_word(".br");  
                 outflags |= MMAN_nl;  
                 print_word("\\fB#include <");                  print_word("\\fB#include <");
         } else          } else
                 print_word("<\\fI");                  print_word("<\\fI");
Line 718  post_in(DECL_ARGS)
Line 711  post_in(DECL_ARGS)
         outflags &= ~MMAN_spc;          outflags &= ~MMAN_spc;
         if (MDOC_SYNPRETTY & n->flags) {          if (MDOC_SYNPRETTY & n->flags) {
                 print_word(">\\fP");                  print_word(">\\fP");
                 outflags |= MMAN_nl;                  outflags |= MMAN_br;
                 print_word(".br");  
                 outflags |= MMAN_nl;  
         } else          } else
                 print_word("\\fP>");                  print_word("\\fP>");
 }  }
Line 754  static void
Line 745  static void
 post_lb(DECL_ARGS)  post_lb(DECL_ARGS)
 {  {
   
         if (SEC_LIBRARY == n->sec) {          if (SEC_LIBRARY == n->sec)
                 outflags |= MMAN_nl;                  outflags |= MMAN_br;
                 print_word(".br");  
                 outflags |= MMAN_nl;  
         }  
 }  }
   
 static int  static int
Line 767  pre_nm(DECL_ARGS)
Line 755  pre_nm(DECL_ARGS)
   
         if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)          if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)
                 return(1);                  return(1);
         if (MDOC_SYNPRETTY & n->flags) {          if (MDOC_SYNPRETTY & n->flags)
                 outflags |= MMAN_nl;                  outflags |= MMAN_br;
                 print_word(".br");  
                 outflags |= MMAN_nl;  
         }  
         print_word("\\fB");          print_word("\\fB");
         outflags &= ~MMAN_spc;          outflags &= ~MMAN_spc;
         if (NULL == n->child)          if (NULL == n->child)
Line 858  pre_vt(DECL_ARGS)
Line 843  pre_vt(DECL_ARGS)
                 default:                  default:
                         return(0);                          return(0);
                 }                  }
                 outflags |= MMAN_nl;                  outflags |= MMAN_br;
                 print_word(".br");  
                 outflags |= MMAN_nl;  
         }          }
         print_word("\\fI");          print_word("\\fI");
         outflags &= ~MMAN_spc;          outflags &= ~MMAN_spc;
Line 876  post_vt(DECL_ARGS)
Line 859  post_vt(DECL_ARGS)
   
         outflags &= ~MMAN_spc;          outflags &= ~MMAN_spc;
         print_word("\\fP");          print_word("\\fP");
         if (MDOC_SYNPRETTY & n->flags) {          if (MDOC_SYNPRETTY & n->flags)
                 outflags |= MMAN_nl;                  outflags |= MMAN_br;
                 print_word(".br");  
                 outflags |= MMAN_nl;  
         }  
 }  }
   
 static int  static int

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

CVSweb