1 /* NetHack 3.6 wintype.h $NHDT-Date: 1549327486 2019/02/05 00:44:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.19 $ */ 2 /* Copyright (c) David Cohrs, 1991 */ 3 /* NetHack may be freely redistributed. See license for details. */ 4 5 #ifndef WINTYPE_H 6 #define WINTYPE_H 7 8 typedef int winid; /* a window identifier */ 9 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 uchar a_uchar; 19 unsigned int a_uint; 20 long a_long; 21 unsigned long a_ulong; 22 int *a_iptr; 23 long *a_lptr; 24 unsigned long *a_ulptr; 25 unsigned *a_uptr; 26 const char *a_string; 27 int NDECL((*a_nfunc)); 28 unsigned long a_mask32; /* used by status highlighting */ 29 /* add types as needed */ 30 } anything; 31 #define ANY_P union any /* avoid typedef in prototypes */ 32 /* (buggy old Ultrix compiler) */ 33 34 /* symbolic names for the data types housed in anything */ 35 enum any_types { 36 ANY_VOID = 1, 37 ANY_OBJ, /* struct obj */ 38 ANY_MONST, /* struct monst (not used) */ 39 ANY_INT, /* int */ 40 ANY_CHAR, /* char */ 41 ANY_UCHAR, /* unsigned char */ 42 ANY_SCHAR, /* signed char */ 43 ANY_UINT, /* unsigned int */ 44 ANY_LONG, /* long */ 45 ANY_ULONG, /* unsigned long */ 46 ANY_IPTR, /* pointer to int */ 47 ANY_UPTR, /* pointer to unsigned int */ 48 ANY_LPTR, /* pointer to long */ 49 ANY_ULPTR, /* pointer to unsigned long */ 50 ANY_STR, /* pointer to null-terminated char string */ 51 ANY_NFUNC, /* pointer to function taking no args, returning int */ 52 ANY_MASK32 /* 32-bit mask (stored as unsigned long) */ 53 }; 54 55 /* menu return list */ 56 typedef struct mi { 57 anything item; /* identifier */ 58 long count; /* count */ 59 } menu_item; 60 #define MENU_ITEM_P struct mi 61 62 /* select_menu() "how" argument types */ 63 /* [MINV_PICKMASK in monst.h assumes these have values of 0, 1, 2] */ 64 #define PICK_NONE 0 /* user picks nothing (display only) */ 65 #define PICK_ONE 1 /* only pick one */ 66 #define PICK_ANY 2 /* can pick any amount */ 67 68 /* window types */ 69 /* any additional port specific types should be defined in win*.h */ 70 #define NHW_MESSAGE 1 71 #define NHW_STATUS 2 72 #define NHW_MAP 3 73 #define NHW_MENU 4 74 #define NHW_TEXT 5 75 76 /* attribute types for putstr; the same as the ANSI value, for convenience */ 77 #define ATR_NONE 0 78 #define ATR_BOLD 1 79 #define ATR_DIM 2 80 #define ATR_ULINE 4 81 #define ATR_BLINK 5 82 #define ATR_INVERSE 7 83 /* not a display attribute but passed to putstr() as an attribute; 84 can be masked with one regular display attribute */ 85 #define ATR_URGENT 16 86 #define ATR_NOHISTORY 32 87 88 /* nh_poskey() modifier types */ 89 #define CLICK_1 1 90 #define CLICK_2 2 91 92 /* invalid winid */ 93 #define WIN_ERR ((winid) -1) 94 95 /* menu window keyboard commands (may be mapped) */ 96 /* clang-format off */ 97 #define MENU_FIRST_PAGE '^' 98 #define MENU_LAST_PAGE '|' 99 #define MENU_NEXT_PAGE '>' 100 #define MENU_PREVIOUS_PAGE '<' 101 #define MENU_SELECT_ALL '.' 102 #define MENU_UNSELECT_ALL '-' 103 #define MENU_INVERT_ALL '@' 104 #define MENU_SELECT_PAGE ',' 105 #define MENU_UNSELECT_PAGE '\\' 106 #define MENU_INVERT_PAGE '~' 107 #define MENU_SEARCH ':' 108 /* clang-format on */ 109 110 #endif /* WINTYPE_H */ 111