diff options
Diffstat (limited to 'term.c')
-rw-r--r-- | term.c | 54 |
1 files changed, 23 insertions, 31 deletions
@@ -21,11 +21,11 @@ #include <string.h> #include "chars.h" +#include "out.h" #include "term.h" #include "man.h" #include "mdoc.h" #include "main.h" -#include "out.h" /* FIXME: accomodate non-breaking, non-collapsing white-space. */ /* FIXME: accomodate non-breaking, collapsing white-space. */ @@ -561,82 +561,74 @@ encode(struct termp *p, char c) } -int -a2height(const char *p) +size_t +term_vspan(const struct roffsu *su) { - struct roffsu su; double r; - if ( ! a2roffsu(p, &su)) - return(-1); - - switch (su.unit) { + switch (su->unit) { case (SCALE_CM): - r = su.scale * 2; + r = su->scale * 2; break; case (SCALE_IN): - r = su.scale * 6; + r = su->scale * 6; break; case (SCALE_PC): - r = su.scale; + r = su->scale; break; case (SCALE_PT): - r = su.scale / 8; + r = su->scale / 8; break; case (SCALE_MM): - r = su.scale / 1000; + r = su->scale / 1000; break; case (SCALE_VS): - r = su.scale; + r = su->scale; break; default: - r = su.scale - 1; + r = su->scale - 1; break; } if (r < 0.0) r = 0.0; - return(/* LINTED */(int) + return(/* LINTED */(size_t) r); } -int -a2width(const char *p) +size_t +term_hspan(const struct roffsu *su) { - struct roffsu su; double r; - if ( ! a2roffsu(p, &su)) - return(-1); - - switch (su.unit) { + switch (su->unit) { case (SCALE_CM): - r = (4 * su.scale) + 2; /* FIXME: double-check. */ + r = (4 * su->scale) + 2; /* FIXME: double-check. */ break; case (SCALE_IN): - r = (10 * su.scale) + 2; /* FIXME: double-check. */ + r = (10 * su->scale) + 2; /* FIXME: double-check. */ break; case (SCALE_PC): - r = (10 * su.scale) / 6; /* FIXME: double-check. */ + r = (10 * su->scale) / 6; /* FIXME: double-check. */ break; case (SCALE_PT): - r = (10 * su.scale) / 72; /* FIXME: double-check. */ + r = (10 * su->scale) / 72; /* FIXME: double-check. */ break; case (SCALE_MM): - r = su.scale / 1000; /* FIXME: double-check. */ + r = su->scale / 1000; /* FIXME: double-check. */ break; case (SCALE_VS): - r = su.scale * 2 - 1; /* FIXME: double-check. */ + r = su->scale * 2 - 1; /* FIXME: double-check. */ break; default: - r = su.scale + 2; + r = su->scale; break; } if (r < 0.0) r = 0.0; - return((int)/* LINTED */ + return((size_t)/* LINTED */ r); } |