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

Annotation of mandoc/private.h, Revision 1.48

1.48    ! kristaps    1: /* $Id: private.h,v 1.47 2008/12/29 12:19:41 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 PRIVATE_H
                     20: #define PRIVATE_H
                     21:
1.41      kristaps   22: #include "mdoc.h"
1.27      kristaps   23:
1.41      kristaps   24: struct mdoc {
                     25:        void             *data;
                     26:        struct mdoc_cb    cb;
                     27:        void             *htab;
                     28:        struct mdoc_node *last;
                     29:        struct mdoc_node *first;
1.43      kristaps   30:        struct mdoc_meta  meta;
1.42      kristaps   31:        enum mdoc_sec     sec_lastn;
                     32:        enum mdoc_sec     sec_last;
1.36      kristaps   33: };
                     34:
1.41      kristaps   35: struct mdoc_macro {
                     36:        int     (*fp)(struct mdoc *, int, int, int *, char *);
                     37:        int       flags;
                     38: #define        MDOC_CALLABLE   (1 << 0)
                     39: #define        MDOC_EXPLICIT   (1 << 1)
1.46      kristaps   40: #define        MDOC_PPOST      (1 << 2) /* Linescope: punctuation post-line. */
1.8       kristaps   41: };
1.5       kristaps   42:
1.41      kristaps   43: extern const struct mdoc_macro *const mdoc_macros;
1.24      kristaps   44:
1.43      kristaps   45: #define        MACRO_PROT_ARGS struct mdoc *mdoc, int tok, \
                     46:                        int ppos, int *pos, char *buf
                     47:
1.1       kristaps   48: __BEGIN_DECLS
                     49:
1.41      kristaps   50: int              mdoc_err(struct mdoc *, int, int, enum mdoc_err);
                     51: int              mdoc_warn(struct mdoc *, int, int, enum mdoc_warn);
                     52: void             mdoc_msg(struct mdoc *, int, const char *, ...);
                     53: int              mdoc_macro(struct mdoc *, int, int, int *, char *);
                     54: int              mdoc_find(const struct mdoc *, const char *);
                     55: void             mdoc_word_alloc(struct mdoc *, int, const char *);
                     56: void             mdoc_elem_alloc(struct mdoc *, int, int,
                     57:                        size_t, const struct mdoc_arg *,
                     58:                        size_t, const char **);
                     59: void             mdoc_block_alloc(struct mdoc *, int, int,
                     60:                        size_t, const struct mdoc_arg *);
                     61: void             mdoc_head_alloc(struct mdoc *,
                     62:                        int, int, size_t, const char **);
                     63: void             mdoc_body_alloc(struct mdoc *, int, int);
                     64: void             mdoc_node_free(struct mdoc_node *);
                     65: void             mdoc_sibling(struct mdoc *, int, struct mdoc_node **,
                     66:                        struct mdoc_node **, struct mdoc_node *);
1.44      kristaps   67: void            *mdoc_tokhash_alloc(void);
                     68: int              mdoc_tokhash_find(const void *, const char *);
                     69: void             mdoc_tokhash_free(void *);
1.42      kristaps   70: int              mdoc_isdelim(const char *);
1.45      kristaps   71: int              mdoc_iscdelim(char);
1.43      kristaps   72: enum   mdoc_sec  mdoc_atosec(size_t, const char **);
                     73: enum   mdoc_msec mdoc_atomsec(const char *);
                     74: enum   mdoc_vol  mdoc_atovol(const char *);
                     75: enum   mdoc_arch mdoc_atoarch(const char *);
1.48    ! kristaps   76: enum   mdoc_att  mdoc_atoatt(const char *);
1.43      kristaps   77: time_t           mdoc_atotime(const char *);
                     78:
1.45      kristaps   79: int              mdoc_argv(struct mdoc *, int,
                     80:                        struct mdoc_arg *, int *, char *);
1.44      kristaps   81: void             mdoc_argv_free(int, struct mdoc_arg *);
1.45      kristaps   82: int              mdoc_args(struct mdoc *, int,
                     83:                        int *, char *, int, char **);
                     84: #define        ARGS_ERROR      (-1)
                     85: #define        ARGS_EOLN       (0)
                     86: #define        ARGS_WORD       (1)
                     87: #define        ARGS_PUNCT      (2)
                     88:
                     89: #define        ARGS_QUOTED     (1 << 0)
                     90: #define        ARGS_DELIM      (1 << 1)
1.44      kristaps   91:
                     92: int              xstrlcat(char *, const char *, size_t);
                     93: int              xstrlcpy(char *, const char *, size_t);
                     94: int              xstrcmp(const char *, const char *);
                     95: void            *xcalloc(size_t, size_t);
                     96: char            *xstrdup(const char *);
                     97:
1.48    ! kristaps   98: int              macro_constant(MACRO_PROT_ARGS);
1.47      kristaps   99: int              macro_constant_delimited(MACRO_PROT_ARGS);
1.43      kristaps  100: int              macro_text(MACRO_PROT_ARGS);
                    101: int              macro_scoped_implicit(MACRO_PROT_ARGS);
1.44      kristaps  102: int              macro_scoped_explicit(MACRO_PROT_ARGS);
1.46      kristaps  103: int              macro_scoped_line(MACRO_PROT_ARGS);
                    104: int              macro_scoped_pline(MACRO_PROT_ARGS);
1.43      kristaps  105: int              macro_prologue_ddate(MACRO_PROT_ARGS);
                    106: int              macro_prologue_dtitle(MACRO_PROT_ARGS);
1.44      kristaps  107: int              macro_prologue_os(MACRO_PROT_ARGS);
1.35      kristaps  108:
1.1       kristaps  109: __END_DECLS
                    110:
                    111: #endif /*!PRIVATE_H*/

CVSweb