xref: /netbsd-src/external/bsd/mdocml/dist/libman.h (revision 544c191c349c1704c9d5e679d12ec15cff579663)
1*544c191cSchristos /*	Id: libman.h,v 1.86 2018/12/31 10:04:39 schwarze Exp  */
24154958bSjoerg /*
3c5f73b34Sjoerg  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4*544c191cSchristos  * Copyright (c) 2014, 2015, 2018 Ingo Schwarze <schwarze@openbsd.org>
54154958bSjoerg  *
64154958bSjoerg  * Permission to use, copy, modify, and distribute this software for any
74154958bSjoerg  * purpose with or without fee is hereby granted, provided that the above
84154958bSjoerg  * copyright notice and this permission notice appear in all copies.
94154958bSjoerg  *
109ff1f2acSchristos  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
114154958bSjoerg  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
129ff1f2acSchristos  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
134154958bSjoerg  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
144154958bSjoerg  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
154154958bSjoerg  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
164154958bSjoerg  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
174154958bSjoerg  */
184154958bSjoerg 
19*544c191cSchristos struct	roff_node;
20*544c191cSchristos struct	roff_man;
21*544c191cSchristos 
229ff1f2acSchristos #define	MACRO_PROT_ARGS	  struct roff_man *man, \
23c9bcef03Schristos 			  enum roff_tok tok, \
2482361f10Sjoerg 			  int line, \
2582361f10Sjoerg 			  int ppos, \
2682361f10Sjoerg 			  int *pos, \
2782361f10Sjoerg 			  char *buf
284154958bSjoerg 
294154958bSjoerg struct	man_macro {
30fec65c98Schristos 	void		(*fp)(MACRO_PROT_ARGS);
314154958bSjoerg 	int		  flags;
32*544c191cSchristos #define	MAN_BSCOPED	 (1 << 0)  /* Optional next-line block scope. */
33*544c191cSchristos #define	MAN_ESCOPED	 (1 << 1)  /* Optional next-line element scope. */
34*544c191cSchristos #define	MAN_NSCOPED	 (1 << 2)  /* Allowed in next-line element scope. */
35*544c191cSchristos #define	MAN_XSCOPE	 (1 << 3)  /* Exit next-line block scope. */
36*544c191cSchristos #define	MAN_JOIN	 (1 << 4)  /* Join arguments together. */
374154958bSjoerg };
384154958bSjoerg 
39*544c191cSchristos const struct man_macro *man_macro(enum roff_tok);
404154958bSjoerg 
41*544c191cSchristos void		  man_descope(struct roff_man *, int, int, char *);
429ff1f2acSchristos void		  man_unscope(struct roff_man *, const struct roff_node *);
43