summaryrefslogtreecommitdiffstats
path: root/eqn.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 15:21:13 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 15:21:13 +0000
commitff6ddfd72fee08b3063dffb618af31325e51beea (patch)
tree13490df552db9fb8c134636ddefc554d2ded3c46 /eqn.c
parentfaba8b69bbb1a57a9980aa454612ab8cca95e93a (diff)
downloadmandoc-ff6ddfd72fee08b3063dffb618af31325e51beea.tar.gz
Support `size' constructs in eqn.7. Generalise mandoc_strontou to this
effect.
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/eqn.c b/eqn.c
index b4087f26..ca68b1b9 100644
--- a/eqn.c
+++ b/eqn.c
@@ -19,6 +19,7 @@
#endif
#include <assert.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -188,7 +189,7 @@ eqn_box(struct eqn_node *ep, struct eqn_box *last, struct eqn_box **sv)
{
size_t sz;
const char *start;
- int c, i, nextc;
+ int c, i, nextc, size;
enum eqn_fontt font;
struct eqn_box *bp;
@@ -201,6 +202,7 @@ eqn_box(struct eqn_node *ep, struct eqn_box *last, struct eqn_box **sv)
*sv = last;
nextc = 1;
font = EQNFONT_NONE;
+ size = EQN_DEFSIZE;
again:
if (NULL == (start = eqn_nexttok(ep, &sz)))
return(0);
@@ -242,14 +244,22 @@ again:
goto again;
}
- /* Exit this [hopefully] subexpression. */
+ if (sz == 4 && 0 == strncmp("size", start, 1)) {
+ if (NULL == (start = eqn_nexttok(ep, &sz)))
+ return(0);
+ size = mandoc_strntoi(start, sz, 10);
+ goto again;
+ }
if (sz == 1 && 0 == strncmp("}", start, 1))
return(1);
bp = mandoc_calloc(1, sizeof(struct eqn_box));
bp->font = font;
+ bp->size = size;
+
font = EQNFONT_NONE;
+ size = EQN_DEFSIZE;
if (nextc)
last->child = bp;