xref: /freebsd/contrib/ncurses/progs/dump_entry.h (revision 2b8331622f0b212cf3bb4fc4914a501e5321d506)
1 /****************************************************************************
2  * Copyright 2018,2020 Thomas E. Dickey                                     *
3  * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
4  *                                                                          *
5  * Permission is hereby granted, free of charge, to any person obtaining a  *
6  * copy of this software and associated documentation files (the            *
7  * "Software"), to deal in the Software without restriction, including      *
8  * without limitation the rights to use, copy, modify, merge, publish,      *
9  * distribute, distribute with modifications, sublicense, and/or sell       *
10  * copies of the Software, and to permit persons to whom the Software is    *
11  * furnished to do so, subject to the following conditions:                 *
12  *                                                                          *
13  * The above copyright notice and this permission notice shall be included  *
14  * in all copies or substantial portions of the Software.                   *
15  *                                                                          *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23  *                                                                          *
24  * Except as contained in this notice, the name(s) of the above copyright   *
25  * holders shall not be used in advertising or otherwise to promote the     *
26  * sale, use or other dealings in this Software without prior written       *
27  * authorization.                                                           *
28  ****************************************************************************/
29 
30 /****************************************************************************
31  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
32  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
33  *     and: Thomas E. Dickey                        1996-on                 *
34  ****************************************************************************/
35 
36 /*
37  * $Id: dump_entry.h,v 1.43 2020/11/14 18:16:57 tom Exp $
38  *
39  * Dump control definitions and variables
40  */
41 
42 #ifndef DUMP_ENTRY_H
43 #define DUMP_ENTRY_H 1
44 
45 #define NCURSES_OPAQUE    0
46 #define NCURSES_INTERNALS 1
47 #include <curses.h>
48 #include <term.h>
49 
50 /* capability output formats */
51 #define F_TERMINFO	0	/* use terminfo names */
52 #define F_VARIABLE	1	/* use C variable names */
53 #define F_TERMCAP	2	/* termcap names with capability conversion */
54 #define F_TCONVERR	3	/* as T_TERMCAP, no skip of untranslatables */
55 #define F_LITERAL	4	/* like F_TERMINFO, but no smart defaults */
56 
57 /* capability sort modes */
58 #define S_DEFAULT	0	/* sort by terminfo name (implicit) */
59 #define S_NOSORT	1	/* don't sort */
60 #define S_TERMINFO	2	/* sort by terminfo names (explicit) */
61 #define S_VARIABLE	3	/* sort by C variable names */
62 #define S_TERMCAP	4	/* sort by termcap names */
63 
64 /* capability types for the comparison hook */
65 #define CMP_BOOLEAN	0	/* comparison on booleans */
66 #define CMP_NUMBER	1	/* comparison on numerics */
67 #define CMP_STRING	2	/* comparison on strings */
68 #define CMP_USE		3	/* comparison on use capabilities */
69 
70 typedef unsigned PredType;
71 typedef unsigned PredIdx;
72 typedef int (*PredFunc) (PredType, PredIdx);
73 typedef void (*PredHook) (PredType, PredIdx, const char *);
74 
75 extern NCURSES_CONST char *nametrans(const char *);
76 extern bool has_params(const char *, bool);
77 extern int fmt_entry(TERMTYPE2 *, PredFunc, int, int, int, int);
78 extern int show_entry(void);
79 extern void compare_entry(PredHook, TERMTYPE2 *, bool);
80 extern void dump_entry(TERMTYPE2 *, int, int, int, PredFunc);
81 extern void dump_init(const char *, int, int, bool, int, int, unsigned, bool,
82 		      bool, int);
83 extern void dump_uses(const char *, bool);
84 extern void repair_acsc(TERMTYPE2 *tp);
85 
86 #define L_CURL "{"
87 #define R_CURL "}"
88 
89 #define FAIL	-1
90 
91 #endif /* DUMP_ENTRY_H */
92