xref: /freebsd/contrib/mandoc/libman.h (revision 7648bc9fee8dec6cb3c4941e0165a930fbe8dcb0)
1*7295610fSBaptiste Daroussin /*	$Id: libman.h,v 1.86 2018/12/31 10:04:39 schwarze Exp $ */
261d06d6bSBaptiste Daroussin /*
361d06d6bSBaptiste Daroussin  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4*7295610fSBaptiste Daroussin  * Copyright (c) 2014, 2015, 2018 Ingo Schwarze <schwarze@openbsd.org>
561d06d6bSBaptiste Daroussin  *
661d06d6bSBaptiste Daroussin  * Permission to use, copy, modify, and distribute this software for any
761d06d6bSBaptiste Daroussin  * purpose with or without fee is hereby granted, provided that the above
861d06d6bSBaptiste Daroussin  * copyright notice and this permission notice appear in all copies.
961d06d6bSBaptiste Daroussin  *
1061d06d6bSBaptiste Daroussin  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
1161d06d6bSBaptiste Daroussin  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1261d06d6bSBaptiste Daroussin  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
1361d06d6bSBaptiste Daroussin  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1461d06d6bSBaptiste Daroussin  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1561d06d6bSBaptiste Daroussin  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1661d06d6bSBaptiste Daroussin  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1761d06d6bSBaptiste Daroussin  */
1861d06d6bSBaptiste Daroussin 
19*7295610fSBaptiste Daroussin struct	roff_node;
20*7295610fSBaptiste Daroussin struct	roff_man;
21*7295610fSBaptiste Daroussin 
2261d06d6bSBaptiste Daroussin #define	MACRO_PROT_ARGS	  struct roff_man *man, \
2361d06d6bSBaptiste Daroussin 			  enum roff_tok tok, \
2461d06d6bSBaptiste Daroussin 			  int line, \
2561d06d6bSBaptiste Daroussin 			  int ppos, \
2661d06d6bSBaptiste Daroussin 			  int *pos, \
2761d06d6bSBaptiste Daroussin 			  char *buf
2861d06d6bSBaptiste Daroussin 
2961d06d6bSBaptiste Daroussin struct	man_macro {
3061d06d6bSBaptiste Daroussin 	void		(*fp)(MACRO_PROT_ARGS);
3161d06d6bSBaptiste Daroussin 	int		  flags;
32*7295610fSBaptiste Daroussin #define	MAN_BSCOPED	 (1 << 0)  /* Optional next-line block scope. */
33*7295610fSBaptiste Daroussin #define	MAN_ESCOPED	 (1 << 1)  /* Optional next-line element scope. */
34*7295610fSBaptiste Daroussin #define	MAN_NSCOPED	 (1 << 2)  /* Allowed in next-line element scope. */
35*7295610fSBaptiste Daroussin #define	MAN_XSCOPE	 (1 << 3)  /* Exit next-line block scope. */
36*7295610fSBaptiste Daroussin #define	MAN_JOIN	 (1 << 4)  /* Join arguments together. */
3761d06d6bSBaptiste Daroussin };
3861d06d6bSBaptiste Daroussin 
39*7295610fSBaptiste Daroussin const struct man_macro *man_macro(enum roff_tok);
4061d06d6bSBaptiste Daroussin 
41*7295610fSBaptiste Daroussin void		  man_descope(struct roff_man *, int, int, char *);
4261d06d6bSBaptiste Daroussin void		  man_unscope(struct roff_man *, const struct roff_node *);
43