]> git.cameronkatri.com Git - mandoc.git/blob - man_action.c
344933d29cc7790098a87aa63970148f0cf37eb4
[mandoc.git] / man_action.c
1 /* $Id: man_action.c,v 1.43 2010/11/30 15:24:27 kristaps Exp $ */
2 /*
3 * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
4 *
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.
8 *
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.
16 */
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20
21 #include <assert.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <time.h>
25
26 #include "mandoc.h"
27 #include "libman.h"
28 #include "libmandoc.h"
29
30 struct actions {
31 int (*post)(struct man *);
32 };
33
34 const struct actions man_actions[MAN_MAX] = {
35 { NULL }, /* br */
36 { NULL }, /* TH */
37 { NULL }, /* SH */
38 { NULL }, /* SS */
39 { NULL }, /* TP */
40 { NULL }, /* LP */
41 { NULL }, /* PP */
42 { NULL }, /* P */
43 { NULL }, /* IP */
44 { NULL }, /* HP */
45 { NULL }, /* SM */
46 { NULL }, /* SB */
47 { NULL }, /* BI */
48 { NULL }, /* IB */
49 { NULL }, /* BR */
50 { NULL }, /* RB */
51 { NULL }, /* R */
52 { NULL }, /* B */
53 { NULL }, /* I */
54 { NULL }, /* IR */
55 { NULL }, /* RI */
56 { NULL }, /* na */
57 { NULL }, /* i */
58 { NULL }, /* sp */
59 { NULL }, /* nf */
60 { NULL }, /* fi */
61 { NULL }, /* r */
62 { NULL }, /* RE */
63 { NULL }, /* RS */
64 { NULL }, /* DT */
65 { NULL }, /* UC */
66 { NULL }, /* PD */
67 { NULL }, /* Sp */
68 { NULL }, /* Vb */
69 { NULL }, /* Ve */
70 { NULL }, /* AT */
71 { NULL }, /* in */
72 };
73
74
75 int
76 man_action_post(struct man *m)
77 {
78
79 if (MAN_ACTED & m->last->flags)
80 return(1);
81 m->last->flags |= MAN_ACTED;
82
83 switch (m->last->type) {
84 case (MAN_TEXT):
85 /* FALLTHROUGH */
86 case (MAN_ROOT):
87 return(1);
88 default:
89 break;
90 }
91
92 if (NULL == man_actions[m->last->tok].post)
93 return(1);
94 return((*man_actions[m->last->tok].post)(m));
95 }
96
97
98
99