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

Annotation of mandoc/ml.h, Revision 1.16

1.16    ! kristaps    1: /* $Id: ml.h,v 1.15 2008/12/10 12:09:47 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 ML_H
                     20: #define ML_H
                     21:
1.12      kristaps   22: #include "private.h"
                     23:
                     24: #define        COLUMNS           72
                     25: #define        INDENT_SZ         4
                     26: #define        INDENT(x)         ((x) > MAXINDENT ? MAXINDENT : (x))
                     27: #define        MAXINDENT         10
                     28:
1.1       kristaps   29: struct md_mlg;
                     30:
                     31: enum   md_ns {
                     32:        MD_NS_BLOCK,
1.2       kristaps   33:        MD_NS_HEAD,
                     34:        MD_NS_BODY,
1.1       kristaps   35:        MD_NS_INLINE,
1.15      kristaps   36:        MD_NS_DEFAULT
1.1       kristaps   37: };
                     38:
1.12      kristaps   39: enum   ml_scope {
                     40:        ML_OPEN,
                     41:        ML_CLOSE
                     42: };
                     43:
1.16    ! kristaps   44: struct ml_args {
        !            45:        const struct md_args    *args;
        !            46:        const struct md_rbuf    *rbuf;
        !            47:        struct md_mbuf          *mbuf;
        !            48:        int                      section;
        !            49:        void                    *data;
        !            50: };
        !            51:
1.7       kristaps   52: struct ml_cbs {
1.16    ! kristaps   53:        int     (*ml_begin)(struct ml_args *, const struct tm *,
1.7       kristaps   54:                        const char *, const char *,
1.13      kristaps   55:                        enum roffmsec, enum roffvol);
1.16    ! kristaps   56:        int     (*ml_end)(struct ml_args *, const struct tm *,
1.14      kristaps   57:                        const char *, const char *,
                     58:                        enum roffmsec, enum roffvol);
1.16    ! kristaps   59:        ssize_t (*ml_beginstring)(struct ml_args *,
1.8       kristaps   60:                        const char *, size_t);
1.16    ! kristaps   61:        ssize_t (*ml_endstring)(struct ml_args *,
1.8       kristaps   62:                        const char *, size_t);
1.16    ! kristaps   63:        ssize_t (*ml_endtag)(struct ml_args *, enum md_ns, int);
        !            64:        ssize_t (*ml_begintag)(struct ml_args *, enum md_ns, int,
1.3       kristaps   65:                        const int *, const char **);
1.7       kristaps   66:        int     (*ml_alloc)(void **);
                     67:        void    (*ml_free)(void *);
                     68: };
1.1       kristaps   69:
                     70: __BEGIN_DECLS
                     71:
1.5       kristaps   72: int              ml_putstring(struct md_mbuf *,
                     73:                        const char *, size_t *);
1.1       kristaps   74: int              ml_nputstring(struct md_mbuf *,
                     75:                        const char *, size_t, size_t *);
                     76: int              ml_nputs(struct md_mbuf *,
                     77:                        const char *, size_t, size_t *);
1.2       kristaps   78: int              ml_puts(struct md_mbuf *, const char *, size_t *);
1.1       kristaps   79: int              ml_putchars(struct md_mbuf *,
                     80:                        char, size_t, size_t *);
                     81:
1.7       kristaps   82: struct md_mlg   *mlg_alloc(const struct md_args *,
1.1       kristaps   83:                        const struct md_rbuf *, struct md_mbuf *,
1.7       kristaps   84:                        const struct ml_cbs *);
1.1       kristaps   85: int              mlg_exit(struct md_mlg *, int);
                     86: int              mlg_line(struct md_mlg *, char *);
                     87:
1.12      kristaps   88: int              ml_tagput(struct md_mbuf *,
                     89:                        enum ml_scope, const char *, size_t *);
                     90:
1.1       kristaps   91: __END_DECLS
                     92:
                     93: #endif /*!ML_H*/

CVSweb