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

Annotation of mandoc/term.h, Revision 1.10

1.10    ! kristaps    1: /* $Id: term.h,v 1.9 2009/02/25 15:12:26 kristaps Exp $ */
1.1       kristaps    2: /*
                      3:  * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
                      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
                      7:  * above copyright notice and this permission notice appear in all
                      8:  * copies.
                      9:  *
                     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.
                     18:  */
                     19: #ifndef TERM_H
                     20: #define TERM_H
                     21:
                     22: #include "mdoc.h"
                     23:
                     24: __BEGIN_DECLS
                     25:
                     26: struct termp {
                     27:        size_t            rmargin;
                     28:        size_t            maxrmargin;
                     29:        size_t            maxcols;
                     30:        size_t            offset;
                     31:        size_t            col;
                     32:        int               flags;
                     33: #define        TERMP_BOLD       (1 << 0)       /* Embolden words. */
                     34: #define        TERMP_UNDERLINE  (1 << 1)       /* Underline words. */
                     35: #define        TERMP_NOSPACE    (1 << 2)       /* No space before words. */
                     36: #define        TERMP_NOLPAD     (1 << 3)       /* No leftpad before flush. */
                     37: #define        TERMP_NOBREAK    (1 << 4)       /* No break after flush. */
1.3       kristaps   38: #define        TERMP_LITERAL    (1 << 5)       /* Literal words. */
1.4       kristaps   39: #define        TERMP_IGNDELIM   (1 << 6)       /* Delims like regulars. */
1.10    ! kristaps   40: #define        TERMP_NONOSPACE  (1 << 7)       /* No space (no autounset). */
1.1       kristaps   41:        char             *buf;
                     42: };
                     43:
1.6       kristaps   44: struct termpair {
1.9       kristaps   45:        struct termpair  *ppair;
1.6       kristaps   46:        int               type;
                     47: #define        TERMPAIR_FLAG    (1 << 0)
1.7       kristaps   48:        int               flag;
                     49:        size_t            offset;
1.8       kristaps   50:        size_t            rmargin;
1.9       kristaps   51:        int               count;
1.6       kristaps   52: };
                     53:
                     54: #define        TERMPAIR_SETFLAG(p, fl) \
                     55:        do { \
1.7       kristaps   56:                assert(! (TERMPAIR_FLAG & (p)->type)); \
                     57:                (p)->flag = (fl); \
                     58:                (p)->type |= TERMPAIR_FLAG; \
1.6       kristaps   59:        } while (0)
                     60:
1.1       kristaps   61: struct termact {
                     62:        int             (*pre)(struct termp *,
1.6       kristaps   63:                                struct termpair *,
1.1       kristaps   64:                                const struct mdoc_meta *,
                     65:                                const struct mdoc_node *);
1.2       kristaps   66:        void            (*post)(struct termp *,
1.6       kristaps   67:                                struct termpair *,
1.1       kristaps   68:                                const struct mdoc_meta *,
                     69:                                const struct mdoc_node *);
                     70: };
                     71:
                     72: void                     newln(struct termp *);
                     73: void                     vspace(struct termp *);
                     74: void                     word(struct termp *, const char *);
                     75: void                     flushln(struct termp *);
1.2       kristaps   76: void                     transcode(struct termp *,
                     77:                                const char *, size_t);
1.1       kristaps   78:
1.5       kristaps   79: void                     subtree(struct termp *,
                     80:                                const struct mdoc_meta *,
                     81:                                const struct mdoc_node *);
                     82:
1.1       kristaps   83: const  struct termact   *termacts;
                     84:
                     85: __END_DECLS
                     86:
                     87: #endif /*!TERM_H*/

CVSweb