usched: Allow process to change self cpu affinity
[dragonfly.git] / contrib / mdocml / eqn_html.c
blob3e58ab5880b5e8953c0069fcdcd00c797dd99ac5
1 /* $Id: eqn_html.c,v 1.3 2014/04/20 16:46:04 schwarze Exp $ */
2 /*
3 * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
21 #include <assert.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
26 #include "mandoc.h"
27 #include "out.h"
28 #include "html.h"
30 static const enum htmltag fontmap[EQNFONT__MAX] = {
31 TAG_SPAN, /* EQNFONT_NONE */
32 TAG_SPAN, /* EQNFONT_ROMAN */
33 TAG_B, /* EQNFONT_BOLD */
34 TAG_B, /* EQNFONT_FAT */
35 TAG_I /* EQNFONT_ITALIC */
38 static void eqn_box(struct html *, const struct eqn_box *);
41 void
42 print_eqn(struct html *p, const struct eqn *ep)
44 struct htmlpair tag;
45 struct tag *t;
47 PAIR_CLASS_INIT(&tag, "eqn");
48 t = print_otag(p, TAG_SPAN, 1, &tag);
50 p->flags |= HTML_NONOSPACE;
51 eqn_box(p, ep->root);
52 p->flags &= ~HTML_NONOSPACE;
54 print_tagq(p, t);
57 static void
58 eqn_box(struct html *p, const struct eqn_box *bp)
60 struct tag *t;
62 t = EQNFONT_NONE == bp->font ? NULL :
63 print_otag(p, fontmap[(int)bp->font], 0, NULL);
65 if (bp->left)
66 print_text(p, bp->left);
68 if (bp->text)
69 print_text(p, bp->text);
71 if (bp->first)
72 eqn_box(p, bp->first);
74 if (NULL != t)
75 print_tagq(p, t);
76 if (bp->right)
77 print_text(p, bp->right);
79 if (bp->next)
80 eqn_box(p, bp->next);