summaryrefslogtreecommitdiffstats
path: root/eqn.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-25 15:37:00 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-25 15:37:00 +0000
commit50079d4076610ce94c315c3ead86fa3dd19dc673 (patch)
treea0a462e3767cedd8ddb18951887372ecbe0ebe93 /eqn.c
parent9e5a4ae8da2d23137cf7342e8fe27ed1172b98f5 (diff)
downloadmandoc-50079d4076610ce94c315c3ead86fa3dd19dc673.tar.gz
Implement the first steps of equation parsing from within libmdoc.
This consists of a shim around the text parser that calls out to libroff if equation components exist on the line. Right now this will do nothing, as the equation delimiter always returns nil.
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/eqn.c b/eqn.c
index 63d53d20..2ff91b7a 100644
--- a/eqn.c
+++ b/eqn.c
@@ -294,8 +294,7 @@ eqn_read(struct eqn_node **epp, int ln,
*/
if (0 == strncmp(p, ".EN", 3)) {
- er = eqn_end(ep);
- *epp = NULL;
+ er = eqn_end(epp);
p += 3;
while (' ' == *p || '\t' == *p)
p++;
@@ -333,7 +332,7 @@ eqn_alloc(const char *name, int pos, int line, struct mparse *parse)
p = mandoc_calloc(1, sizeof(struct eqn_node));
- if ('\0' != *name) {
+ if (name && '\0' != *name) {
sz = strlen(name);
assert(sz);
do {
@@ -352,11 +351,15 @@ eqn_alloc(const char *name, int pos, int line, struct mparse *parse)
}
enum rofferr
-eqn_end(struct eqn_node *ep)
+eqn_end(struct eqn_node **epp)
{
+ struct eqn_node *ep;
struct eqn_box *root;
enum eqn_rest c;
+ ep = *epp;
+ *epp = NULL;
+
ep->eqn.root = mandoc_calloc(1, sizeof(struct eqn_box));
root = ep->eqn.root;