Annotation of docbook2mdoc/macro.h, Revision 1.3
1.3 ! schwarze 1: /* $Id: macro.h,v 1.2 2019/03/28 20:41:33 schwarze Exp $ */
1.1 schwarze 2: /*
3: * Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
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 AUTHORS DISCLAIM ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS 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:
18: /*
19: * The interface of the macro line formatter,
20: * a part of the mdoc(7) formatter.
21: */
22:
23: enum linestate {
24: LINE_NEW = 0, /* At the beginning of a new line. */
25: LINE_TEXT, /* In the middle of a text line. */
26: LINE_MACRO /* In the middle of a macro line. */
27: };
28:
29: struct format {
30: int level; /* Header level, starting at 1. */
1.3 ! schwarze 31: int spc; /* Whitespace before next macro. */
1.1 schwarze 32: enum linestate linestate;
33: };
34:
35: #define ARG_SPACE 1 /* Insert whitespace before this argument. */
36: #define ARG_SINGLE 2 /* Quote argument if it contains whitespace. */
37: #define ARG_QUOTED 4 /* We are already in a quoted argument. */
38: #define ARG_UPPER 8 /* Covert argument to upper case. */
39:
40:
41: void macro_open(struct format *, const char *);
42: void macro_close(struct format *);
43: void macro_line(struct format *, const char *);
44: void macro_closepunct(struct format *, struct pnode *);
45:
46: void macro_addarg(struct format *, const char *, int);
47: void macro_argline(struct format *, const char *, const char *);
48: void macro_addnode(struct format *, struct pnode *, int);
49: void macro_nodeline(struct format *, const char *, struct pnode *, int);
1.2 schwarze 50:
51: void print_text(struct format *, const char *, int);
52: void print_textnode(struct format *, struct pnode *);
CVSweb