Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / gtx / gtxkeymap.h
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 #ifndef __GATOR_KEYMAP_H_
11 #define __GATOR_KEYMAP_H_
12
13 /* number of entries max per keymap */
14 #define KEYMAP_NENTRIES 256
15
16 /* types of keymaps */
17 #define KEYMAP_EMPTY 0 /* nothing in this slot */
18 #define KEYMAP_PROC 1 /* procedure in this slot */
19 #define KEYMAP_SUBMAP 2 /* submap in this slot */
20
21 /* one per entry */
22 struct keymap_entry {
23 char type; /* type, e.g. submap, etc */
24 char pad[3]; /* padding */
25 char *name; /* descriptive name of function, if function */
26 union { /* value (proc, submap, etc) */
27 int (*proc) (void *, void *);
28 struct keymap_map *submap;
29 void *generic;
30 } u;
31 void *rock; /* rock to use */
32 };
33
34 struct keymap_map {
35 short refcount; /* reference count */
36 char pad[2]; /* padding to afs_int32 boundary */
37 struct keymap_entry entries[KEYMAP_NENTRIES];
38 };
39
40 struct keymap_state {
41 struct keymap_map *initMap;
42 struct keymap_map *currentMap;
43 };
44
45 extern struct keymap_map *keymap_Create(void);
46 extern int keymap_BindToString(struct keymap_map *, char *,
47 int (*aproc)(void *, void *), char *, void *);
48 extern int keymap_Delete(struct keymap_map *);
49 extern int keymap_InitState(struct keymap_state *, struct keymap_map *);
50 extern int keymap_ProcessKey(struct keymap_state *, int, void *);
51 extern int keymap_ResetState(struct keymap_state *);
52
53 extern char *gtx_CopyString(char *);
54
55
56 #endif /* define for file */