[BACK]Return to term.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/term.c between version 1.106 and 1.107

version 1.106, 2009/10/18 13:34:17 version 1.107, 2009/10/18 19:03:37
Line 21 
Line 21 
 #include <string.h>  #include <string.h>
   
 #include "chars.h"  #include "chars.h"
   #include "out.h"
 #include "term.h"  #include "term.h"
 #include "man.h"  #include "man.h"
 #include "mdoc.h"  #include "mdoc.h"
 #include "main.h"  #include "main.h"
 #include "out.h"  
   
 /* FIXME: accomodate non-breaking, non-collapsing white-space. */  /* FIXME: accomodate non-breaking, non-collapsing white-space. */
 /* FIXME: accomodate non-breaking, collapsing white-space. */  /* FIXME: accomodate non-breaking, collapsing white-space. */
Line 561  encode(struct termp *p, char c)
Line 561  encode(struct termp *p, char c)
 }  }
   
   
 int  size_t
 a2height(const char *p)  term_vspan(const struct roffsu *su)
 {  {
         struct roffsu    su;  
         double           r;          double           r;
   
         if ( ! a2roffsu(p, &su))          switch (su->unit) {
                 return(-1);  
   
         switch (su.unit) {  
         case (SCALE_CM):          case (SCALE_CM):
                 r = su.scale * 2;                  r = su->scale * 2;
                 break;                  break;
         case (SCALE_IN):          case (SCALE_IN):
                 r = su.scale * 6;                  r = su->scale * 6;
                 break;                  break;
         case (SCALE_PC):          case (SCALE_PC):
                 r = su.scale;                  r = su->scale;
                 break;                  break;
         case (SCALE_PT):          case (SCALE_PT):
                 r = su.scale / 8;                  r = su->scale / 8;
                 break;                  break;
         case (SCALE_MM):          case (SCALE_MM):
                 r = su.scale / 1000;                  r = su->scale / 1000;
                 break;                  break;
         case (SCALE_VS):          case (SCALE_VS):
                 r = su.scale;                  r = su->scale;
                 break;                  break;
         default:          default:
                 r = su.scale - 1;                  r = su->scale - 1;
                 break;                  break;
         }          }
   
         if (r < 0.0)          if (r < 0.0)
                 r = 0.0;                  r = 0.0;
         return(/* LINTED */(int)          return(/* LINTED */(size_t)
                         r);                          r);
 }  }
   
   
 int  size_t
 a2width(const char *p)  term_hspan(const struct roffsu *su)
 {  {
         struct roffsu    su;  
         double           r;          double           r;
   
         if ( ! a2roffsu(p, &su))          switch (su->unit) {
                 return(-1);  
   
         switch (su.unit) {  
         case (SCALE_CM):          case (SCALE_CM):
                 r = (4 * su.scale) + 2; /* FIXME: double-check. */                  r = (4 * su->scale) + 2; /* FIXME: double-check. */
                 break;                  break;
         case (SCALE_IN):          case (SCALE_IN):
                 r = (10 * su.scale) + 2; /* FIXME: double-check. */                  r = (10 * su->scale) + 2; /* FIXME: double-check. */
                 break;                  break;
         case (SCALE_PC):          case (SCALE_PC):
                 r = (10 * su.scale) / 6; /* FIXME: double-check. */                  r = (10 * su->scale) / 6; /* FIXME: double-check. */
                 break;                  break;
         case (SCALE_PT):          case (SCALE_PT):
                 r = (10 * su.scale) / 72; /* FIXME: double-check. */                  r = (10 * su->scale) / 72; /* FIXME: double-check. */
                 break;                  break;
         case (SCALE_MM):          case (SCALE_MM):
                 r = su.scale / 1000; /* FIXME: double-check. */                  r = su->scale / 1000; /* FIXME: double-check. */
                 break;                  break;
         case (SCALE_VS):          case (SCALE_VS):
                 r = su.scale * 2 - 1; /* FIXME: double-check. */                  r = su->scale * 2 - 1; /* FIXME: double-check. */
                 break;                  break;
         default:          default:
                 r = su.scale + 2;                  r = su->scale;
                 break;                  break;
         }          }
   
         if (r < 0.0)          if (r < 0.0)
                 r = 0.0;                  r = 0.0;
         return((int)/* LINTED */          return((size_t)/* LINTED */
                         r);                          r);
 }  }
   

Legend:
Removed from v.1.106  
changed lines
  Added in v.1.107

CVSweb