]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/tinfo/init_keytry.c
ncurses 5.0
[ncurses.git] / ncurses / tinfo / init_keytry.c
1 /****************************************************************************
2  * Copyright (c) 1999 Free Software Foundation, Inc.                        *
3  *                                                                          *
4  * Permission is hereby granted, free of charge, to any person obtaining a  *
5  * copy of this software and associated documentation files (the            *
6  * "Software"), to deal in the Software without restriction, including      *
7  * without limitation the rights to use, copy, modify, merge, publish,      *
8  * distribute, distribute with modifications, sublicense, and/or sell       *
9  * copies of the Software, and to permit persons to whom the Software is    *
10  * furnished to do so, subject to the following conditions:                 *
11  *                                                                          *
12  * The above copyright notice and this permission notice shall be included  *
13  * in all copies or substantial portions of the Software.                   *
14  *                                                                          *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22  *                                                                          *
23  * Except as contained in this notice, the name(s) of the above copyright   *
24  * holders shall not be used in advertising or otherwise to promote the     *
25  * sale, use or other dealings in this Software without prior written       *
26  * authorization.                                                           *
27  ****************************************************************************/
28
29 #include <curses.priv.h>
30
31 #include <term.h>       /* keypad_xmit, keypad_local, meta_on, meta_off */
32                         /* cursor_visible,cursor_normal,cursor_invisible */
33 #include <tic.h>        /* struct tinfo_fkeys */
34
35 MODULE_ID("$Id: init_keytry.c,v 1.2 1999/09/11 17:32:57 Jeffrey.Honig Exp $")
36
37 /*
38 **      _nc_init_keytry()
39 **
40 **      Construct the try for the current terminal's keypad keys.
41 **
42 */
43
44 #ifdef  BROKEN_LINKER
45 #undef  _nc_tinfo_fkeys
46 #endif
47
48 /* LINT_PREPRO
49 #if 0*/
50 #include <init_keytry.h>
51 /* LINT_PREPRO
52 #endif*/
53
54 #ifdef  BROKEN_LINKER
55 struct tinfo_fkeys *_nc_tinfo_fkeysf(void)
56 {
57         return _nc_tinfo_fkeys;
58 }
59 #endif
60
61 void _nc_init_keytry(void)
62 {
63         size_t n;
64
65         /* The SP->_keytry value is initialized in newterm(), where the SP
66          * structure is created, because we can not tell where keypad() or
67          * mouse_activate() (which will call keyok()) are first called.
68          */
69
70         for (n = 0; _nc_tinfo_fkeys[n].code; n++)
71                 if (_nc_tinfo_fkeys[n].offset < STRCOUNT)
72                 _nc_add_to_try(&(SP->_keytry),
73                         CUR Strings[_nc_tinfo_fkeys[n].offset],
74                         _nc_tinfo_fkeys[n].code);
75 #ifdef TRACE
76         _nc_trace_tries(SP->_keytry);
77 #endif
78 }