xref: /illumos-gate/usr/src/cmd/mandoc/libman.h (revision cec8643b)
1*cec8643bSMichal Nowak /*	$Id: libman.h,v 1.86 2018/12/31 10:04:39 schwarze Exp $ */
295c635efSGarrett D'Amore /*
395c635efSGarrett D'Amore  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4*cec8643bSMichal Nowak  * Copyright (c) 2014, 2015, 2018 Ingo Schwarze <schwarze@openbsd.org>
595c635efSGarrett D'Amore  *
695c635efSGarrett D'Amore  * Permission to use, copy, modify, and distribute this software for any
795c635efSGarrett D'Amore  * purpose with or without fee is hereby granted, provided that the above
895c635efSGarrett D'Amore  * copyright notice and this permission notice appear in all copies.
995c635efSGarrett D'Amore  *
10371584c2SYuri Pankov  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
1195c635efSGarrett D'Amore  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12371584c2SYuri Pankov  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
1395c635efSGarrett D'Amore  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1495c635efSGarrett D'Amore  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1595c635efSGarrett D'Amore  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1695c635efSGarrett D'Amore  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1795c635efSGarrett D'Amore  */
1895c635efSGarrett D'Amore 
19*cec8643bSMichal Nowak struct	roff_node;
20*cec8643bSMichal Nowak struct	roff_man;
21*cec8643bSMichal Nowak 
22371584c2SYuri Pankov #define	MACRO_PROT_ARGS	  struct roff_man *man, \
23c66b8046SYuri Pankov 			  enum roff_tok tok, \
2495c635efSGarrett D'Amore 			  int line, \
2595c635efSGarrett D'Amore 			  int ppos, \
2695c635efSGarrett D'Amore 			  int *pos, \
2795c635efSGarrett D'Amore 			  char *buf
2895c635efSGarrett D'Amore 
2995c635efSGarrett D'Amore struct	man_macro {
30260e9a87SYuri Pankov 	void		(*fp)(MACRO_PROT_ARGS);
3195c635efSGarrett D'Amore 	int		  flags;
32*cec8643bSMichal Nowak #define	MAN_BSCOPED	 (1 << 0)  /* Optional next-line block scope. */
33*cec8643bSMichal Nowak #define	MAN_ESCOPED	 (1 << 1)  /* Optional next-line element scope. */
34*cec8643bSMichal Nowak #define	MAN_NSCOPED	 (1 << 2)  /* Allowed in next-line element scope. */
35*cec8643bSMichal Nowak #define	MAN_XSCOPE	 (1 << 3)  /* Exit next-line block scope. */
36*cec8643bSMichal Nowak #define	MAN_JOIN	 (1 << 4)  /* Join arguments together. */
3795c635efSGarrett D'Amore };
3895c635efSGarrett D'Amore 
39*cec8643bSMichal Nowak const struct man_macro *man_macro(enum roff_tok);
4095c635efSGarrett D'Amore 
41*cec8643bSMichal Nowak void		  man_descope(struct roff_man *, int, int, char *);
42371584c2SYuri Pankov void		  man_unscope(struct roff_man *, const struct roff_node *);
43