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

Annotation of mandoc/mdoc.h, Revision 1.145

1.145   ! schwarze    1: /*     $Id: mdoc.h,v 1.144 2015/11/07 14:01:16 schwarze Exp $ */
1.1       kristaps    2: /*
1.118     schwarze    3:  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.136     schwarze    4:  * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
1.1       kristaps    5:  *
                      6:  * Permission to use, copy, modify, and distribute this software for any
1.56      kristaps    7:  * purpose with or without fee is hereby granted, provided that the above
                      8:  * copyright notice and this permission notice appear in all copies.
1.1       kristaps    9:  *
1.137     schwarze   10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
1.56      kristaps   11:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1.137     schwarze   12:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
1.56      kristaps   13:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     15:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     16:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       kristaps   17:  */
                     18:
1.105     kristaps   19: enum   mdocargt {
1.121     kristaps   20:        MDOC_Split, /* -split */
                     21:        MDOC_Nosplit, /* -nospli */
                     22:        MDOC_Ragged, /* -ragged */
                     23:        MDOC_Unfilled, /* -unfilled */
                     24:        MDOC_Literal, /* -literal */
                     25:        MDOC_File, /* -file */
                     26:        MDOC_Offset, /* -offset */
                     27:        MDOC_Bullet, /* -bullet */
                     28:        MDOC_Dash, /* -dash */
                     29:        MDOC_Hyphen, /* -hyphen */
                     30:        MDOC_Item, /* -item */
                     31:        MDOC_Enum, /* -enum */
                     32:        MDOC_Tag, /* -tag */
                     33:        MDOC_Diag, /* -diag */
                     34:        MDOC_Hang, /* -hang */
                     35:        MDOC_Ohang, /* -ohang */
                     36:        MDOC_Inset, /* -inset */
                     37:        MDOC_Column, /* -column */
                     38:        MDOC_Width, /* -width */
                     39:        MDOC_Compact, /* -compact */
                     40:        MDOC_Std, /* -std */
                     41:        MDOC_Filled, /* -filled */
                     42:        MDOC_Words, /* -words */
                     43:        MDOC_Emphasis, /* -emphasis */
                     44:        MDOC_Symbolic, /* -symbolic */
                     45:        MDOC_Nested, /* -nested */
                     46:        MDOC_Centred, /* -centered */
1.105     kristaps   47:        MDOC_ARG_MAX
                     48: };
                     49:
1.129     schwarze   50: /*
                     51:  * An argument to a macro (multiple values = `-column xxx yyy').
1.105     kristaps   52:  */
                     53: struct mdoc_argv {
1.129     schwarze   54:        enum mdocargt     arg; /* type of argument */
1.105     kristaps   55:        int               line;
                     56:        int               pos;
                     57:        size_t            sz; /* elements in "value" */
                     58:        char            **value; /* argument strings */
                     59: };
                     60:
1.33      kristaps   61: /*
1.105     kristaps   62:  * Reference-counted macro arguments.  These are refcounted because
                     63:  * blocks have multiple instances of the same arguments spread across
                     64:  * the HEAD, BODY, TAIL, and BLOCK node types.
1.33      kristaps   65:  */
1.129     schwarze   66: struct mdoc_arg {
1.105     kristaps   67:        size_t            argc;
                     68:        struct mdoc_argv *argv;
                     69:        unsigned int      refcnt;
                     70: };
1.1       kristaps   71:
1.105     kristaps   72: enum   mdoc_list {
                     73:        LIST__NONE = 0,
1.121     kristaps   74:        LIST_bullet, /* -bullet */
                     75:        LIST_column, /* -column */
                     76:        LIST_dash, /* -dash */
                     77:        LIST_diag, /* -diag */
                     78:        LIST_enum, /* -enum */
                     79:        LIST_hang, /* -hang */
                     80:        LIST_hyphen, /* -hyphen */
                     81:        LIST_inset, /* -inset */
                     82:        LIST_item, /* -item */
                     83:        LIST_ohang, /* -ohang */
                     84:        LIST_tag, /* -tag */
1.106     kristaps   85:        LIST_MAX
1.105     kristaps   86: };
                     87:
                     88: enum   mdoc_disp {
                     89:        DISP__NONE = 0,
1.131     schwarze   90:        DISP_centered, /* -centered */
1.121     kristaps   91:        DISP_ragged, /* -ragged */
                     92:        DISP_unfilled, /* -unfilled */
                     93:        DISP_filled, /* -filled */
                     94:        DISP_literal /* -literal */
1.105     kristaps   95: };
                     96:
                     97: enum   mdoc_auth {
                     98:        AUTH__NONE = 0,
1.121     kristaps   99:        AUTH_split, /* -split */
                    100:        AUTH_nosplit /* -nosplit */
1.105     kristaps  101: };
1.60      kristaps  102:
1.105     kristaps  103: enum   mdoc_font {
                    104:        FONT__NONE = 0,
1.121     kristaps  105:        FONT_Em, /* Em, -emphasis */
                    106:        FONT_Li, /* Li, -literal */
                    107:        FONT_Sy /* Sy, -symbolic */
1.105     kristaps  108: };
                    109:
                    110: struct mdoc_bd {
                    111:        const char       *offs; /* -offset */
                    112:        enum mdoc_disp    type; /* -ragged, etc. */
                    113:        int               comp; /* -compact */
                    114: };
                    115:
                    116: struct mdoc_bl {
                    117:        const char       *width; /* -width */
                    118:        const char       *offs; /* -offset */
                    119:        enum mdoc_list    type; /* -tag, -enum, etc. */
                    120:        int               comp; /* -compact */
                    121:        size_t            ncols; /* -column arg count */
                    122:        const char      **cols; /* -column val ptr */
1.123     schwarze  123:        int               count; /* -enum counter */
1.105     kristaps  124: };
                    125:
                    126: struct mdoc_bf {
                    127:        enum mdoc_font    font; /* font */
                    128: };
                    129:
                    130: struct mdoc_an {
                    131:        enum mdoc_auth    auth; /* -split, etc. */
                    132: };
                    133:
1.111     kristaps  134: struct mdoc_rs {
1.115     kristaps  135:        int               quote_T; /* whether to quote %T */
1.111     kristaps  136: };
                    137:
1.105     kristaps  138: /*
                    139:  * Consists of normalised node arguments.  These should be used instead
                    140:  * of iterating through the mdoc_arg pointers of a node: defaults are
                    141:  * provided, etc.
                    142:  */
1.109     kristaps  143: union  mdoc_data {
1.129     schwarze  144:        struct mdoc_an    An;
1.109     kristaps  145:        struct mdoc_bd    Bd;
                    146:        struct mdoc_bf    Bf;
                    147:        struct mdoc_bl    Bl;
1.138     schwarze  148:        struct roff_node *Es;
1.111     kristaps  149:        struct mdoc_rs    Rs;
1.109     kristaps  150: };
                    151:
1.121     kristaps  152: /* Names of macro args.  Index is enum mdocargt. */
1.1       kristaps  153: extern const char *const *mdoc_argnames;
1.143     schwarze  154:
                    155: void            mdoc_validate(struct roff_man *);

CVSweb