aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit3ee412a268eff0c9e52bb141dc3289eda00a6d53 (patch)
treec7806e338a7f518f1e0d02ab42c28e4ce822a405 /eqn.c
parent610da288ad1c36332f5bc333692f49e2326fa30d (diff)
downloadmandoc-3ee412a268eff0c9e52bb141dc3289eda00a6d53.tar.gz
mandoc-3ee412a268eff0c9e52bb141dc3289eda00a6d53.tar.zst
mandoc-3ee412a268eff0c9e52bb141dc3289eda00a6d53.zip
Support `size' constructs in eqn.7. Generalise mandoc_strontou to this
effect.
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/eqn.c b/eqn.c
index 23dd934e..706a31cf 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.18 2011/07/21 14:13:00 kristaps Exp $ */
+/* $Id: eqn.c,v 1.19 2011/07/21 15:21:13 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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;