xref: /openbsd-src/lib/libcurses/term_entry.h (revision b7c51a29a250cc95627d6afcc7ae8b89d69c3005)
1 /*	$OpenBSD: term_entry.h,v 1.3 1999/01/22 04:50:43 millert Exp $	*/
2 
3 /****************************************************************************
4  * Copyright (c) 1998 Free Software Foundation, Inc.                        *
5  *                                                                          *
6  * Permission is hereby granted, free of charge, to any person obtaining a  *
7  * copy of this software and associated documentation files (the            *
8  * "Software"), to deal in the Software without restriction, including      *
9  * without limitation the rights to use, copy, modify, merge, publish,      *
10  * distribute, distribute with modifications, sublicense, and/or sell       *
11  * copies of the Software, and to permit persons to whom the Software is    *
12  * furnished to do so, subject to the following conditions:                 *
13  *                                                                          *
14  * The above copyright notice and this permission notice shall be included  *
15  * in all copies or substantial portions of the Software.                   *
16  *                                                                          *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24  *                                                                          *
25  * Except as contained in this notice, the name(s) of the above copyright   *
26  * holders shall not be used in advertising or otherwise to promote the     *
27  * sale, use or other dealings in this Software without prior written       *
28  * authorization.                                                           *
29  ****************************************************************************/
30 
31 /****************************************************************************
32  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
33  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
34  ****************************************************************************/
35 
36 
37 /*
38  *	term_entry.h -- interface to entry-manipulation code
39  */
40 
41 #ifndef _TERM_ENTRY_H
42 #define _TERM_ENTRY_H
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #define MAX_USES	32
49 
50 typedef struct entry {
51 	TERMTYPE	tterm;
52 	int		nuses;
53 	struct
54         {
55 	    void	*parent;	/* (char *) or (ENTRY *) */
56 	    long	line;
57         }
58 	uses[MAX_USES];
59 	long		cstart, cend;
60 	long		startline;
61 	struct entry	*next;
62 	struct entry	*last;
63 }
64 ENTRY;
65 
66 extern ENTRY	*_nc_head, *_nc_tail;
67 #define for_entry_list(qp)	for (qp = _nc_head; qp; qp = qp->next)
68 
69 #define MAX_LINE	132
70 
71 #define NULLHOOK        (bool(*)(ENTRY *))0
72 
73 /* alloc_entry.c: elementary allocation code */
74 extern void _nc_init_entry(TERMTYPE *const);
75 extern char *_nc_save_str(const char *const);
76 extern void _nc_merge_entry(TERMTYPE *const, TERMTYPE *const);
77 extern void _nc_wrap_entry(ENTRY *const);
78 
79 /* parse_entry.c: entry-parsing code */
80 extern int _nc_parse_entry(ENTRY *, int, bool);
81 extern int _nc_capcmp(const char *, const char *);
82 
83 /* write_entry.c: writing an entry to the file system */
84 extern void _nc_set_writedir(char *);
85 extern void _nc_write_entry(TERMTYPE *const);
86 
87 /* comp_parse.c: entry list handling */
88 extern void _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*));
89 extern bool _nc_entry_match(char *, char *);
90 extern int _nc_resolve_uses(void);
91 extern void _nc_free_entries(ENTRY *);
92 
93 /* read_bsd_terminfo.c: terminfo.db reading */
94 extern int _nc_read_bsd_terminfo_entry(const char * const, char * const, TERMTYPE *const);
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif /* _TERM_ENTRY_H */
101