]>
git.cameronkatri.com Git - mandoc.git/blob - man_macro.c
1 /* $Id: man_macro.c,v 1.2 2009/03/23 14:31:58 kristaps Exp $ */
3 * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
27 static int in_line_eoln(MACRO_PROT_ARGS
);
29 const struct man_macro __man_macros
[MAN_MAX
] = {
30 { in_line_eoln
, 0 }, /* MAN___ */
31 { in_line_eoln
, 0 }, /* MAN_TH */
32 { in_line_eoln
, 0 }, /* MAN_SH */
33 { in_line_eoln
, 0 }, /* MAN_SS */
34 { in_line_eoln
, 0 }, /* MAN_TP */
35 { in_line_eoln
, 0 }, /* MAN_LP */
36 { in_line_eoln
, 0 }, /* MAN_PP */
37 { in_line_eoln
, 0 }, /* MAN_P */
38 { in_line_eoln
, 0 }, /* MAN_IP */
39 { in_line_eoln
, 0 }, /* MAN_HP */
40 { in_line_eoln
, 0 }, /* MAN_SM */
41 { in_line_eoln
, 0 }, /* MAN_SB */
42 { in_line_eoln
, 0 }, /* MAN_BI */
43 { in_line_eoln
, 0 }, /* MAN_IB */
44 { in_line_eoln
, 0 }, /* MAN_BR */
45 { in_line_eoln
, 0 }, /* MAN_RB */
46 { in_line_eoln
, 0 }, /* MAN_R */
47 { in_line_eoln
, 0 }, /* MAN_B */
48 { in_line_eoln
, 0 }, /* MAN_I */
51 const struct man_macro
* const man_macros
= __man_macros
;
55 * In-line macro that spans an entire line. May be callable, but has no
56 * subsequent parsed arguments.
59 in_line_eoln(MACRO_PROT_ARGS
)
65 if ( ! man_elem_alloc(man
, line
, ppos
, tok
, arg
))
67 man
->next
= MDOC_NEXT_SIBLING
;
71 w
= man_args(man
, line
, pos
, buf
, tok
, &p
);
78 c
= ARGS_QWORD
== w
? MAN_MAX
:
79 lookup(man
, line
, la
, tok
, p
);
81 if (MDOC_MAX
!= c
&& -1 != c
) {
82 if ( ! rew_elem(mdoc
, tok
))
84 return(mdoc_macro(mdoc
, c
, line
, la
, pos
, buf
));
88 if ( ! mdoc_word_alloc(mdoc
, line
, la
, p
))
92 return(rew_elem(mdoc
, tok
));