Fix some issues found with fuzz testing
[aNetHack.git] / include / wintype.h
blob3dbcc0500cc6c38f2be8b6ba48aa1c44c413f41f
1 /* NetHack 3.6 wintype.h $NHDT-Date: 1461028538 2016/04/19 01:15:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $ */
2 /* Copyright (c) David Cohrs, 1991 */
3 /* NetHack may be freely redistributed. See license for details. */
5 #ifndef WINTYPE_H
6 #define WINTYPE_H
8 typedef int winid; /* a window identifier */
10 /* generic parameter - must not be any larger than a pointer */
11 typedef union any {
12 genericptr_t a_void;
13 struct obj *a_obj;
14 struct monst *a_monst;
15 int a_int;
16 char a_char;
17 schar a_schar;
18 unsigned int a_uint;
19 long a_long;
20 unsigned long a_ulong;
21 int *a_iptr;
22 long *a_lptr;
23 unsigned long *a_ulptr;
24 unsigned *a_uptr;
25 const char *a_string;
26 /* add types as needed */
27 } anything;
28 #define ANY_P union any /* avoid typedef in prototypes */
29 /* (buggy old Ultrix compiler) */
31 /* symbolic names for the data types housed in anything */
32 enum any_types {
33 ANY_VOID = 1,
34 ANY_OBJ, /* struct obj */
35 ANY_MONST, /* struct monst (not used) */
36 ANY_INT, /* int */
37 ANY_CHAR, /* char */
38 ANY_UCHAR, /* unsigned char */
39 ANY_SCHAR, /* signed char */
40 ANY_UINT, /* unsigned int */
41 ANY_LONG, /* long */
42 ANY_ULONG, /* unsigned long */
43 ANY_IPTR, /* pointer to int */
44 ANY_UPTR, /* pointer to unsigned int */
45 ANY_LPTR, /* pointer to long */
46 ANY_ULPTR, /* pointer to unsigned long */
47 ANY_STR, /* pointer to null-terminated char string */
48 ANY_MASK32 /* 32-bit mask (stored as unsigned long) */
51 /* menu return list */
52 typedef struct mi {
53 anything item; /* identifier */
54 long count; /* count */
55 } menu_item;
56 #define MENU_ITEM_P struct mi
58 /* select_menu() "how" argument types */
59 /* [MINV_PICKMASK in monst.h assumes these have values of 0, 1, 2] */
60 #define PICK_NONE 0 /* user picks nothing (display only) */
61 #define PICK_ONE 1 /* only pick one */
62 #define PICK_ANY 2 /* can pick any amount */
64 /* window types */
65 /* any additional port specific types should be defined in win*.h */
66 #define NHW_MESSAGE 1
67 #define NHW_STATUS 2
68 #define NHW_MAP 3
69 #define NHW_MENU 4
70 #define NHW_TEXT 5
72 /* attribute types for putstr; the same as the ANSI value, for convenience */
73 #define ATR_NONE 0
74 #define ATR_BOLD 1
75 #define ATR_DIM 2
76 #define ATR_ULINE 4
77 #define ATR_BLINK 5
78 #define ATR_INVERSE 7
80 /* nh_poskey() modifier types */
81 #define CLICK_1 1
82 #define CLICK_2 2
84 /* invalid winid */
85 #define WIN_ERR ((winid) -1)
87 /* menu window keyboard commands (may be mapped) */
88 /* clang-format off */
89 #define MENU_FIRST_PAGE '^'
90 #define MENU_LAST_PAGE '|'
91 #define MENU_NEXT_PAGE '>'
92 #define MENU_PREVIOUS_PAGE '<'
93 #define MENU_SELECT_ALL '.'
94 #define MENU_UNSELECT_ALL '-'
95 #define MENU_INVERT_ALL '@'
96 #define MENU_SELECT_PAGE ','
97 #define MENU_UNSELECT_PAGE '\\'
98 #define MENU_INVERT_PAGE '~'
99 #define MENU_SEARCH ':'
100 /* clang-format on */
102 #endif /* WINTYPE_H */