summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-10-18 19:03:36 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-10-18 19:03:36 +0000
commitb24acbb5f3ae16c8a4e9645043803117dda71323 (patch)
tree1a7428e9636ad90860f62860b0e85c725e8cb556 /term.c
parentd6c7a4661f77e1989e0da0c6d16c039362c1d97d (diff)
downloadmandoc-b24acbb5f3ae16c8a4e9645043803117dda71323.tar.gz
Made sure devices and formats recognise that -man and -mdoc have different syntax for scaling widths: -mdoc assumes no unit means that the value is a string literal while -man instead uses the default vertical/horizontal scale.
Diffstat (limited to 'term.c')
-rw-r--r--term.c54
1 files changed, 23 insertions, 31 deletions
diff --git a/term.c b/term.c
index d08112a3..5ba6c8ab 100644
--- a/term.c
+++ b/term.c
@@ -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);
}