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

Annotation of mandoc/mandoc.h, Revision 1.16

1.16    ! kristaps    1: /*     $Id: mandoc.h,v 1.15 2010/07/02 12:54:33 kristaps Exp $ */
1.1       kristaps    2: /*
                      3:  * Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
                      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 AUTHOR DISCLAIMS ALL WARRANTIES
                     10:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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: #ifndef MANDOC_H
                     18: #define MANDOC_H
1.7       kristaps   19:
1.16    ! kristaps   20: /*
        !            21:  * This contains declarations that are available system-wide.
        !            22:  */
        !            23:
1.7       kristaps   24: #define ASCII_NBRSP     31  /* non-breaking space */
                     25: #define        ASCII_HYPH       30  /* breakable hyphen */
                     26:
1.1       kristaps   27: __BEGIN_DECLS
                     28:
                     29: enum   mandocerr {
                     30:        MANDOCERR_OK,
1.13      schwarze   31:
                     32:        MANDOCERR_WARNING, /* ===== end of warnings ===== */
                     33:
1.5       kristaps   34:        MANDOCERR_UPPERCASE, /* text should be uppercase */
1.9       kristaps   35:        MANDOCERR_SECOOO, /* sections out of conventional order */
1.5       kristaps   36:        MANDOCERR_SECREP, /* section name repeats */
                     37:        MANDOCERR_PROLOGOOO, /* out of order prologue */
                     38:        MANDOCERR_PROLOGREP, /* repeated prologue entry */
                     39:        MANDOCERR_LISTFIRST, /* list type must come first */
                     40:        MANDOCERR_BADSTANDARD, /* bad standard */
                     41:        MANDOCERR_BADLIB, /* bad library */
                     42:        MANDOCERR_BADESCAPE, /* bad escape sequence */
                     43:        MANDOCERR_BADQUOTE, /* unterminated quoted string */
                     44:        MANDOCERR_NOWIDTHARG, /* argument requires the width argument */
1.12      kristaps   45:        /* FIXME: merge with MANDOCERR_IGNARGV. */
1.5       kristaps   46:        MANDOCERR_WIDTHARG, /* superfluous width argument */
1.13      schwarze   47:        MANDOCERR_IGNARGV, /* ignoring argument */
1.5       kristaps   48:        MANDOCERR_BADDATE, /* bad date argument */
                     49:        MANDOCERR_BADWIDTH, /* bad width argument */
1.9       kristaps   50:        MANDOCERR_BADMSEC, /* unknown manual section */
1.5       kristaps   51:        MANDOCERR_SECMSEC, /* section not in conventional manual section */
                     52:        MANDOCERR_EOLNSPACE, /* end of line whitespace */
1.14      schwarze   53:        MANDOCERR_SCOPENEST, /* blocks badly nested */
1.1       kristaps   54:        MANDOCERR_SCOPEEXIT, /* scope open on exit */
1.13      schwarze   55:
                     56:        MANDOCERR_ERROR, /* ===== end of errors ===== */
1.4       kristaps   57:
1.5       kristaps   58:        MANDOCERR_NAMESECFIRST, /* NAME section must come first */
                     59:        MANDOCERR_BADBOOL, /* bad Boolean value */
                     60:        MANDOCERR_CHILD, /* child violates parent syntax */
                     61:        MANDOCERR_BADATT, /* bad AT&T symbol */
                     62:        MANDOCERR_LISTREP, /* list type repeated */
                     63:        MANDOCERR_DISPREP, /* display type repeated */
                     64:        MANDOCERR_ARGVREP, /* argument repeated */
                     65:        MANDOCERR_NONAME, /* manual name not yet set */
                     66:        MANDOCERR_MACROOBS, /* obsolete macro ignored */
                     67:        MANDOCERR_MACROEMPTY, /* empty macro ignored */
                     68:        MANDOCERR_BADBODY, /* macro not allowed in body */
                     69:        MANDOCERR_BADPROLOG, /* macro not allowed in prologue */
                     70:        MANDOCERR_BADCHAR, /* bad character */
                     71:        MANDOCERR_BADNAMESEC, /* bad NAME section contents */
                     72:        MANDOCERR_NOBLANKLN, /* no blank lines */
                     73:        MANDOCERR_NOTEXT, /* no text in this context */
                     74:        MANDOCERR_BADCOMMENT, /* bad comment style */
                     75:        MANDOCERR_MACRO, /* unknown macro will be lost */
                     76:        MANDOCERR_LINESCOPE, /* line scope broken */
                     77:        MANDOCERR_ARGCOUNT, /* argument count wrong */
1.14      schwarze   78:        MANDOCERR_NOSCOPE, /* no such block is open */
1.5       kristaps   79:        MANDOCERR_SCOPEREP, /* scope already open */
                     80:        /* FIXME: merge following with MANDOCERR_ARGCOUNT */
                     81:        MANDOCERR_NOARGS, /* macro requires line argument(s) */
                     82:        MANDOCERR_NOBODY, /* macro requires body argument(s) */
                     83:        MANDOCERR_NOARGV, /* macro requires argument(s) */
                     84:        MANDOCERR_NOTITLE, /* no title in document */
1.10      kristaps   85:        MANDOCERR_LISTTYPE, /* missing list type */
1.11      kristaps   86:        MANDOCERR_DISPTYPE, /* missing display type */
1.15      kristaps   87:        MANDOCERR_FONTTYPE, /* missing font type */
1.5       kristaps   88:        MANDOCERR_ARGSLOST, /* line argument(s) will be lost */
                     89:        MANDOCERR_BODYLOST, /* body argument(s) will be lost */
1.13      schwarze   90:
                     91:        MANDOCERR_FATAL, /* ===== end of fatal errors ===== */
1.1       kristaps   92:
1.8       kristaps   93:        MANDOCERR_COLUMNS, /* column syntax is inconsistent */
1.5       kristaps   94:        /* FIXME: this should be a MANDOCERR_ERROR */
                     95:        MANDOCERR_NESTEDDISP, /* displays may not be nested */
1.11      kristaps   96:        MANDOCERR_BADDISP, /* unsupported display type */
1.14      schwarze   97:        MANDOCERR_SCOPEFATAL, /* blocks badly nested */
1.13      schwarze   98:        MANDOCERR_SYNTNOSCOPE, /* no scope to rewind: syntax violated */
1.5       kristaps   99:        MANDOCERR_SYNTSCOPE, /* scope broken, syntax violated */
                    100:        MANDOCERR_SYNTLINESCOPE, /* line scope broken, syntax violated */
                    101:        MANDOCERR_SYNTARGVCOUNT, /* argument count wrong, violates syntax */
                    102:        MANDOCERR_SYNTCHILD, /* child violates parent syntax */
                    103:        MANDOCERR_SYNTARGCOUNT, /* argument count wrong, violates syntax */
                    104:        MANDOCERR_NODOCBODY, /* no document body */
                    105:        MANDOCERR_NODOCPROLOG, /* no document prologue */
1.13      schwarze  106:        MANDOCERR_UTSNAME, /* utsname system call failed */
1.1       kristaps  107:        MANDOCERR_MEM, /* memory exhausted */
                    108:
                    109:        MANDOCERR_MAX
                    110: };
                    111:
1.16    ! kristaps  112: enum   regs {
        !           113:        REG_nS = 0,     /* register: nS */
        !           114:        REG__MAX
        !           115: };
        !           116:
        !           117: /*
        !           118:  * A single register entity.  If "set" is zero, the value of the
        !           119:  * register should be the default one, which is per-register.  It's
        !           120:  * assumed that callers know which type in "v" corresponds to which
        !           121:  * register value.
        !           122:  */
        !           123: struct reg {
        !           124:        int               set; /* whether set or not */
        !           125:        union {
        !           126:                unsigned  u; /* unsigned integer */
        !           127:        } v;
        !           128: };
        !           129:
        !           130: /*
        !           131:  * The primary interface to setting register values is in libroff,
        !           132:  * although libmdoc and libman from time to time will manipulate
        !           133:  * registers (such as `.Sh SYNOPSIS' enabling REG_nS).
        !           134:  */
        !           135: struct regset {
        !           136:        struct reg        regs[REG__MAX];
        !           137: };
        !           138:
        !           139: /*
        !           140:  * Callback function for warnings, errors, and fatal errors as they
        !           141:  * occur in the compilers libroff, libmdoc, and libman.
        !           142:  */
        !           143: typedef        int             (*mandocmsg)(enum mandocerr, void *,
        !           144:                                int, int, const char *);
1.1       kristaps  145:
                    146: __END_DECLS
                    147:
                    148: #endif /*!MANDOC_H*/

CVSweb