OSDN Git Service

ifdef-ed official patches
[jnethack/source.git] / include / wintype.h
1 /* NetHack 3.6  wintype.h       $NHDT-Date: 1433207914 2015/06/02 01:18:34 $  $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
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     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) */
30
31 /* symbolic names for the data types housed in anything */
32 /* clang-format off */
33 #define ANY_VOID         1
34 #define ANY_OBJ          2      /* struct obj */
35 #define ANY_MONST        3      /* struct monst (not used) */
36 #define ANY_INT          4      /* int */
37 #define ANY_CHAR         5      /* char */
38 #define ANY_UCHAR        6      /* unsigned char */
39 #define ANY_SCHAR        7      /* signed char */
40 #define ANY_UINT         8      /* unsigned int */
41 #define ANY_LONG         9      /* long */
42 #define ANY_ULONG       10      /* unsigned long */
43 #define ANY_IPTR        11      /* pointer to int */
44 #define ANY_UPTR        12      /* pointer to unsigned int */
45 #define ANY_LPTR        13      /* pointer to long */
46 #define ANY_ULPTR       14      /* pointer to unsigned long */
47 #define ANY_STR         15      /* pointer to null-terminated char string */
48 #define ANY_MASK32      16      /* 32-bit mask (stored as unsigned long) */
49 /* clang-format on */
50
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
57
58 /* select_menu() "how" argument types */
59 #define PICK_NONE 0 /* user picks nothing (display only) */
60 #define PICK_ONE 1  /* only pick one */
61 #define PICK_ANY 2  /* can pick any amount */
62
63 /* window types */
64 /* any additional port specific types should be defined in win*.h */
65 #define NHW_MESSAGE 1
66 #define NHW_STATUS 2
67 #define NHW_MAP 3
68 #define NHW_MENU 4
69 #define NHW_TEXT 5
70
71 /* attribute types for putstr; the same as the ANSI value, for convenience */
72 #define ATR_NONE 0
73 #define ATR_BOLD 1
74 #define ATR_DIM 2
75 #define ATR_ULINE 4
76 #define ATR_BLINK 5
77 #define ATR_INVERSE 7
78
79 /* nh_poskey() modifier types */
80 #define CLICK_1 1
81 #define CLICK_2 2
82
83 /* invalid winid */
84 #define WIN_ERR ((winid) -1)
85
86 /* menu window keyboard commands (may be mapped) */
87 /* clang-format off */
88 #define MENU_FIRST_PAGE         '^'
89 #define MENU_LAST_PAGE          '|'
90 #define MENU_NEXT_PAGE          '>'
91 #define MENU_PREVIOUS_PAGE      '<'
92 #define MENU_SELECT_ALL         '.'
93 #define MENU_UNSELECT_ALL       '-'
94 #define MENU_INVERT_ALL         '@'
95 #define MENU_SELECT_PAGE        ','
96 #define MENU_UNSELECT_PAGE      '\\'
97 #define MENU_INVERT_PAGE        '~'
98 #define MENU_SEARCH             ':'
99 /* clang-format on */
100
101 #endif /* WINTYPE_H */