diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-07-21 15:21:13 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-07-21 15:21:13 +0000 |
commit | 3ee412a268eff0c9e52bb141dc3289eda00a6d53 (patch) | |
tree | c7806e338a7f518f1e0d02ab42c28e4ce822a405 /eqn.c | |
parent | 610da288ad1c36332f5bc333692f49e2326fa30d (diff) | |
download | mandoc-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.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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; |