summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-03-20 23:36:42 +0000
committerschwarze <schwarze@openbsd.org>2011-03-20 23:36:42 +0000
commit8d973ab119273c11ad7f320bfed8d32e8a0d6d10 (patch)
treee658fb3bb47acda8528f51b78b59375134ad24ba /usr.bin/mandoc/mdoc.c
parentAdd two missing lines that got missed when I did the initial at + cron (diff)
downloadwireguard-openbsd-8d973ab119273c11ad7f320bfed8d32e8a0d6d10.tar.xz
wireguard-openbsd-8d973ab119273c11ad7f320bfed8d32e8a0d6d10.zip
Import the foundation for eqn(7) support.
Written by kristaps@. For now, i'm adding one line to each of the four frontends to just pass the input text through to the output, not yet interpreting any of then eqn keywords.
Diffstat (limited to 'usr.bin/mandoc/mdoc.c')
-rw-r--r--usr.bin/mandoc/mdoc.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 79dffc42cb9..24c09e765a3 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.80 2011/03/07 01:35:33 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.81 2011/03/20 23:36:42 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -218,6 +218,30 @@ mdoc_endparse(struct mdoc *m)
}
int
+mdoc_addeqn(struct mdoc *m, const struct eqn *ep)
+{
+ struct mdoc_node *n;
+
+ assert( ! (MDOC_HALT & m->flags));
+
+ /* No text before an initial macro. */
+
+ if (SEC_NONE == m->lastnamed) {
+ mdoc_pmsg(m, ep->line, ep->pos, MANDOCERR_NOTEXT);
+ return(1);
+ }
+
+ n = node_alloc(m, ep->line, ep->pos, MDOC_MAX, MDOC_EQN);
+ n->eqn = ep;
+
+ if ( ! node_append(m, n))
+ return(0);
+
+ m->next = MDOC_NEXT_SIBLING;
+ return(1);
+}
+
+int
mdoc_addspan(struct mdoc *m, const struct tbl_span *sp)
{
struct mdoc_node *n;