Home | History | Annotate | Line # | Download | only in dist
man.h revision 1.1.1.11
      1  1.1.1.11  joerg /*	$Vendor-Id: man.h,v 1.59 2011/10/06 22:29:12 kristaps Exp $ */
      2       1.1  joerg /*
      3  1.1.1.10  joerg  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps (at) bsd.lv>
      4       1.1  joerg  *
      5       1.1  joerg  * Permission to use, copy, modify, and distribute this software for any
      6       1.1  joerg  * purpose with or without fee is hereby granted, provided that the above
      7       1.1  joerg  * copyright notice and this permission notice appear in all copies.
      8       1.1  joerg  *
      9       1.1  joerg  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10       1.1  joerg  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11       1.1  joerg  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     12       1.1  joerg  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     13       1.1  joerg  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     14       1.1  joerg  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     15       1.1  joerg  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     16       1.1  joerg  */
     17       1.1  joerg #ifndef MAN_H
     18       1.1  joerg #define MAN_H
     19       1.1  joerg 
     20   1.1.1.4  joerg enum	mant {
     21   1.1.1.4  joerg 	MAN_br = 0,
     22   1.1.1.4  joerg 	MAN_TH,
     23   1.1.1.4  joerg 	MAN_SH,
     24   1.1.1.4  joerg 	MAN_SS,
     25   1.1.1.4  joerg 	MAN_TP,
     26   1.1.1.4  joerg 	MAN_LP,
     27   1.1.1.4  joerg 	MAN_PP,
     28   1.1.1.4  joerg 	MAN_P,
     29   1.1.1.4  joerg 	MAN_IP,
     30   1.1.1.4  joerg 	MAN_HP,
     31   1.1.1.4  joerg 	MAN_SM,
     32   1.1.1.4  joerg 	MAN_SB,
     33   1.1.1.4  joerg 	MAN_BI,
     34   1.1.1.4  joerg 	MAN_IB,
     35   1.1.1.4  joerg 	MAN_BR,
     36   1.1.1.4  joerg 	MAN_RB,
     37   1.1.1.4  joerg 	MAN_R,
     38   1.1.1.4  joerg 	MAN_B,
     39   1.1.1.4  joerg 	MAN_I,
     40   1.1.1.4  joerg 	MAN_IR,
     41   1.1.1.4  joerg 	MAN_RI,
     42   1.1.1.4  joerg 	MAN_na,
     43   1.1.1.4  joerg 	MAN_sp,
     44   1.1.1.4  joerg 	MAN_nf,
     45   1.1.1.4  joerg 	MAN_fi,
     46   1.1.1.4  joerg 	MAN_RE,
     47   1.1.1.4  joerg 	MAN_RS,
     48   1.1.1.4  joerg 	MAN_DT,
     49   1.1.1.4  joerg 	MAN_UC,
     50   1.1.1.4  joerg 	MAN_PD,
     51   1.1.1.5  joerg 	MAN_AT,
     52   1.1.1.8  joerg 	MAN_in,
     53   1.1.1.9  joerg 	MAN_ft,
     54   1.1.1.4  joerg 	MAN_MAX
     55   1.1.1.4  joerg };
     56       1.1  joerg 
     57       1.1  joerg enum	man_type {
     58       1.1  joerg 	MAN_TEXT,
     59       1.1  joerg 	MAN_ELEM,
     60       1.1  joerg 	MAN_ROOT,
     61       1.1  joerg 	MAN_BLOCK,
     62       1.1  joerg 	MAN_HEAD,
     63   1.1.1.9  joerg 	MAN_BODY,
     64  1.1.1.10  joerg 	MAN_TAIL,
     65  1.1.1.10  joerg 	MAN_TBL,
     66  1.1.1.10  joerg 	MAN_EQN
     67       1.1  joerg };
     68       1.1  joerg 
     69       1.1  joerg struct	man_meta {
     70   1.1.1.9  joerg 	char		*msec; /* `TH' section (1, 3p, etc.) */
     71  1.1.1.10  joerg 	char		*date; /* `TH' normalised date */
     72   1.1.1.9  joerg 	char		*vol; /* `TH' volume */
     73   1.1.1.9  joerg 	char		*title; /* `TH' title (e.g., FOO) */
     74   1.1.1.9  joerg 	char		*source; /* `TH' source (e.g., GNU) */
     75       1.1  joerg };
     76       1.1  joerg 
     77       1.1  joerg struct	man_node {
     78   1.1.1.9  joerg 	struct man_node	*parent; /* parent AST node */
     79   1.1.1.9  joerg 	struct man_node	*child; /* first child AST node */
     80   1.1.1.9  joerg 	struct man_node	*next; /* sibling AST node */
     81   1.1.1.9  joerg 	struct man_node	*prev; /* prior sibling AST node */
     82   1.1.1.9  joerg 	int		 nchild; /* number children */
     83       1.1  joerg 	int		 line;
     84       1.1  joerg 	int		 pos;
     85   1.1.1.9  joerg 	enum mant	 tok; /* tok or MAN__MAX if none */
     86       1.1  joerg 	int		 flags;
     87   1.1.1.9  joerg #define	MAN_VALID	(1 << 0) /* has been validated */
     88   1.1.1.9  joerg #define	MAN_EOS		(1 << 2) /* at sentence boundary */
     89  1.1.1.10  joerg #define	MAN_LINE	(1 << 3) /* first macro/text on line */
     90   1.1.1.9  joerg 	enum man_type	 type; /* AST node type */
     91   1.1.1.9  joerg 	char		*string; /* TEXT node argument */
     92   1.1.1.9  joerg 	struct man_node	*head; /* BLOCK node HEAD ptr */
     93  1.1.1.10  joerg 	struct man_node *tail; /* BLOCK node TAIL ptr */
     94   1.1.1.9  joerg 	struct man_node	*body; /* BLOCK node BODY ptr */
     95   1.1.1.9  joerg 	const struct tbl_span *span; /* TBL */
     96  1.1.1.10  joerg 	const struct eqn *eqn; /* EQN */
     97       1.1  joerg };
     98       1.1  joerg 
     99  1.1.1.10  joerg /* Names of macros.  Index is enum mant. */
    100       1.1  joerg extern	const char *const *man_macronames;
    101       1.1  joerg 
    102       1.1  joerg __BEGIN_DECLS
    103       1.1  joerg 
    104       1.1  joerg struct	man;
    105       1.1  joerg 
    106       1.1  joerg const struct man_node *man_node(const struct man *);
    107       1.1  joerg const struct man_meta *man_meta(const struct man *);
    108  1.1.1.11  joerg const struct mparse   *man_mparse(const struct man *);
    109       1.1  joerg 
    110       1.1  joerg __END_DECLS
    111       1.1  joerg 
    112       1.1  joerg #endif /*!MAN_H*/
    113