[BACK]Return to macro.h CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / docbook2mdoc

Annotation of docbook2mdoc/macro.h, Revision 1.4

1.4     ! schwarze    1: /* $Id: macro.h,v 1.3 2019/04/06 22:37:57 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.4     ! schwarze   31:        int              flags;
        !            32: #define        FMT_NOSPC        (1 << 0)    /* Suppress space before next node. */
        !            33: #define        FMT_ARG          (1 << 1)    /* May add argument to current macro. */
        !            34: #define        FMT_CHILD        (1 << 2)    /* Expect a single child macro. */
        !            35: #define        FMT_IMPL         (1 << 3)    /* Partial implicit block is open. */
1.1       schwarze   36:        enum linestate   linestate;
                     37: };
                     38:
                     39: #define        ARG_SPACE       1  /* Insert whitespace before this argument. */
                     40: #define        ARG_SINGLE      2  /* Quote argument if it contains whitespace. */
                     41: #define        ARG_QUOTED      4  /* We are already in a quoted argument. */
                     42: #define        ARG_UPPER       8  /* Covert argument to upper case. */
                     43:
                     44:
                     45: void    macro_open(struct format *, const char *);
                     46: void    macro_close(struct format *);
                     47: void    macro_line(struct format *, const char *);
                     48:
                     49: void    macro_addarg(struct format *, const char *, int);
                     50: void    macro_argline(struct format *, const char *, const char *);
                     51: void    macro_addnode(struct format *, struct pnode *, int);
                     52: void    macro_nodeline(struct format *, const char *, struct pnode *, int);
1.2       schwarze   53:
                     54: void    print_text(struct format *, const char *, int);
                     55: void    print_textnode(struct format *, struct pnode *);

CVSweb