Home | History | Annotate | Line # | Download | only in dist
libmdoc.h revision 1.1.1.15.2.2
      1  1.1.1.15.2.2  pgoyette /*	Id: libmdoc.h,v 1.109 2017/02/16 03:00:23 schwarze Exp  */
      2           1.1     joerg /*
      3      1.1.1.12     joerg  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps (at) bsd.lv>
      4  1.1.1.15.2.1  pgoyette  * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze (at) openbsd.org>
      5           1.1     joerg  *
      6           1.1     joerg  * Permission to use, copy, modify, and distribute this software for any
      7           1.1     joerg  * purpose with or without fee is hereby granted, provided that the above
      8           1.1     joerg  * copyright notice and this permission notice appear in all copies.
      9           1.1     joerg  *
     10  1.1.1.15.2.1  pgoyette  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
     11           1.1     joerg  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12  1.1.1.15.2.1  pgoyette  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
     13           1.1     joerg  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14           1.1     joerg  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     15           1.1     joerg  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     16           1.1     joerg  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17           1.1     joerg  */
     18           1.1     joerg 
     19  1.1.1.15.2.1  pgoyette #define	MACRO_PROT_ARGS	struct roff_man *mdoc, \
     20  1.1.1.15.2.1  pgoyette 			int tok, \
     21       1.1.1.8     joerg 			int line, \
     22       1.1.1.8     joerg 			int ppos, \
     23       1.1.1.8     joerg 			int *pos, \
     24       1.1.1.8     joerg 			char *buf
     25           1.1     joerg 
     26           1.1     joerg struct	mdoc_macro {
     27      1.1.1.15  christos 	void		(*fp)(MACRO_PROT_ARGS);
     28           1.1     joerg 	int		  flags;
     29           1.1     joerg #define	MDOC_CALLABLE	 (1 << 0)
     30           1.1     joerg #define	MDOC_PARSED	 (1 << 1)
     31           1.1     joerg #define	MDOC_EXPLICIT	 (1 << 2)
     32           1.1     joerg #define	MDOC_PROLOGUE	 (1 << 3)
     33      1.1.1.14     joerg #define	MDOC_IGNDELIM	 (1 << 4)
     34      1.1.1.14     joerg #define	MDOC_JOIN	 (1 << 5)
     35           1.1     joerg };
     36           1.1     joerg 
     37       1.1.1.5     joerg enum	margserr {
     38       1.1.1.5     joerg 	ARGS_ERROR,
     39      1.1.1.12     joerg 	ARGS_EOLN, /* end-of-line */
     40      1.1.1.12     joerg 	ARGS_WORD, /* normal word */
     41      1.1.1.12     joerg 	ARGS_PUNCT, /* series of punctuation */
     42      1.1.1.12     joerg 	ARGS_QWORD, /* quoted word */
     43  1.1.1.15.2.1  pgoyette 	ARGS_PHRASE /* Bl -column phrase */
     44       1.1.1.5     joerg };
     45       1.1.1.5     joerg 
     46      1.1.1.11     joerg /*
     47      1.1.1.11     joerg  * A punctuation delimiter is opening, closing, or "middle mark"
     48      1.1.1.11     joerg  * punctuation.  These govern spacing.
     49      1.1.1.11     joerg  * Opening punctuation (e.g., the opening parenthesis) suppresses the
     50      1.1.1.11     joerg  * following space; closing punctuation (e.g., the closing parenthesis)
     51      1.1.1.11     joerg  * suppresses the leading space; middle punctuation (e.g., the vertical
     52      1.1.1.11     joerg  * bar) can do either.  The middle punctuation delimiter bends the rules
     53      1.1.1.11     joerg  * depending on usage.
     54      1.1.1.11     joerg  */
     55       1.1.1.5     joerg enum	mdelim {
     56       1.1.1.5     joerg 	DELIM_NONE = 0,
     57       1.1.1.5     joerg 	DELIM_OPEN,
     58       1.1.1.5     joerg 	DELIM_MIDDLE,
     59      1.1.1.11     joerg 	DELIM_CLOSE,
     60      1.1.1.11     joerg 	DELIM_MAX
     61       1.1.1.5     joerg };
     62       1.1.1.5     joerg 
     63           1.1     joerg extern	const struct mdoc_macro *const mdoc_macros;
     64           1.1     joerg 
     65           1.1     joerg 
     66      1.1.1.15  christos void		  mdoc_macro(MACRO_PROT_ARGS);
     67  1.1.1.15.2.1  pgoyette void		  mdoc_elem_alloc(struct roff_man *, int, int,
     68  1.1.1.15.2.1  pgoyette 			int, struct mdoc_arg *);
     69  1.1.1.15.2.1  pgoyette struct roff_node *mdoc_block_alloc(struct roff_man *, int, int,
     70  1.1.1.15.2.1  pgoyette 			int, struct mdoc_arg *);
     71  1.1.1.15.2.1  pgoyette void		  mdoc_tail_alloc(struct roff_man *, int, int, int);
     72  1.1.1.15.2.1  pgoyette struct roff_node *mdoc_endbody_alloc(struct roff_man *, int, int, int,
     73  1.1.1.15.2.2  pgoyette 			struct roff_node *);
     74  1.1.1.15.2.1  pgoyette void		  mdoc_node_relink(struct roff_man *, struct roff_node *);
     75  1.1.1.15.2.1  pgoyette void		  mdoc_node_validate(struct roff_man *);
     76  1.1.1.15.2.1  pgoyette void		  mdoc_state(struct roff_man *, struct roff_node *);
     77  1.1.1.15.2.1  pgoyette void		  mdoc_state_reset(struct roff_man *);
     78  1.1.1.15.2.1  pgoyette int		  mdoc_hash_find(const char *);
     79  1.1.1.15.2.1  pgoyette const char	 *mdoc_a2arch(const char *);
     80           1.1     joerg const char	 *mdoc_a2att(const char *);
     81           1.1     joerg const char	 *mdoc_a2lib(const char *);
     82  1.1.1.15.2.1  pgoyette enum roff_sec	  mdoc_a2sec(const char *);
     83           1.1     joerg const char	 *mdoc_a2st(const char *);
     84  1.1.1.15.2.1  pgoyette void		  mdoc_argv(struct roff_man *, int, int,
     85           1.1     joerg 			struct mdoc_arg **, int *, char *);
     86  1.1.1.15.2.1  pgoyette enum margserr	  mdoc_args(struct roff_man *, int,
     87  1.1.1.15.2.1  pgoyette 			int *, char *, int, char **);
     88      1.1.1.11     joerg enum mdelim	  mdoc_isdelim(const char *);
     89