Drop CARD32 and Opaque types
[platform/upstream/libxkbcommon.git] / src / xkbcomp / expr.h
1 /************************************************************
2  Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
3
4  Permission to use, copy, modify, and distribute this
5  software and its documentation for any purpose and without
6  fee is hereby granted, provided that the above copyright
7  notice appear in all copies and that both that copyright
8  notice and this permission notice appear in supporting
9  documentation, and that the name of Silicon Graphics not be
10  used in advertising or publicity pertaining to distribution
11  of the software without specific prior written permission.
12  Silicon Graphics makes no representation about the suitability
13  of this software for any purpose. It is provided "as is"
14  without any express or implied warranty.
15
16  SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17  SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18  AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19  GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22  OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
23  THE USE OR PERFORMANCE OF THIS SOFTWARE.
24
25  ********************************************************/
26
27 #ifndef EXPR_H
28 #define EXPR_H 1
29
30 typedef union _ExprResult
31 {
32     char *str;
33     int ival;
34     unsigned uval;
35     XkbKeyNameRec keyName;
36 } ExprResult;
37
38 typedef Bool(*IdentLookupFunc) (char * /* priv */ ,
39                                 uint32_t /* elem */ ,
40                                 uint32_t /* field */ ,
41                                 unsigned /* type */ ,
42                                 ExprResult *    /* val_rtrn */
43     );
44
45 extern char *exprTypeText(unsigned      /* type */
46     );
47
48 extern int ExprResolveLhs(ExprDef * /* expr */ ,
49                           ExprResult * /* elem_rtrn */ ,
50                           ExprResult * /* field_rtrn */ ,
51                           ExprDef **    /* index_rtrn */
52     );
53
54 typedef struct _LookupPriv
55 {
56     char * priv;
57     IdentLookupFunc chain;
58     char * chainPriv;
59 } LookupPriv;
60
61 typedef struct _LookupEntry
62 {
63     const char *name;
64     unsigned result;
65 } LookupEntry;
66
67 typedef struct _LookupTable
68 {
69     char *element;
70     LookupEntry *entries;
71     struct _LookupTable *nextElement;
72 } LookupTable;
73
74
75 extern char *exprOpText(unsigned        /* type */
76     );
77
78 extern int RadioLookup(char * /* priv */ ,
79                        uint32_t /* elem */ ,
80                        uint32_t /* field */ ,
81                        unsigned /* type */ ,
82                        ExprResult *     /* val_rtrn */
83     );
84
85 extern int SimpleLookup(char * /* priv */ ,
86                         uint32_t /* elem */ ,
87                         uint32_t /* field */ ,
88                         unsigned /* type */ ,
89                         ExprResult *    /* val_rtrn */
90     );
91
92 extern int TableLookup(char * /* priv */ ,
93                        uint32_t /* elem */ ,
94                        uint32_t /* field */ ,
95                        unsigned /* type */ ,
96                        ExprResult *     /* val_rtrn */
97     );
98
99 extern int LookupModIndex(char * /* priv */ ,
100                           uint32_t /* elem */ ,
101                           uint32_t /* field */ ,
102                           unsigned /* type */ ,
103                           ExprResult *  /* val_rtrn */
104     );
105
106 extern int LookupModMask(char * /* priv */ ,
107                          uint32_t /* elem */ ,
108                          uint32_t /* field */ ,
109                          unsigned /* type */ ,
110                          ExprResult *   /* val_rtrn */
111     );
112
113 extern int ExprResolveModIndex(ExprDef * /* expr */ ,
114                                ExprResult * /* val_rtrn */ ,
115                                IdentLookupFunc /* lookup */ ,
116                                char * /* lookupPriv */
117     );
118
119 extern int ExprResolveModMask(ExprDef * /* expr */ ,
120                               ExprResult * /* val_rtrn */ ,
121                               IdentLookupFunc /* lookup */ ,
122                               char *  /* priv */
123     );
124
125 extern int ExprResolveBoolean(ExprDef * /* expr */ ,
126                               ExprResult * /* val_rtrn */ ,
127                               IdentLookupFunc /* lookup */ ,
128                               char *  /* lookupPriv */
129     );
130
131 extern int ExprResolveInteger(ExprDef * /* expr */ ,
132                               ExprResult * /* val_rtrn */ ,
133                               IdentLookupFunc /* lookup */ ,
134                               char *  /* lookupPriv */
135     );
136
137 extern int ExprResolveFloat(ExprDef * /* expr */ ,
138                             ExprResult * /* val_rtrn */ ,
139                             IdentLookupFunc /* lookup */ ,
140                             char *    /* lookupPriv */
141     );
142
143 extern int ExprResolveString(ExprDef * /* expr */ ,
144                              ExprResult * /* val_rtrn */ ,
145                              IdentLookupFunc /* lookup */ ,
146                              char *   /* lookupPriv */
147     );
148
149 extern int ExprResolveKeyName(ExprDef * /* expr */ ,
150                               ExprResult * /* val_rtrn */ ,
151                               IdentLookupFunc /* lookup */ ,
152                               char *  /* lookupPriv */
153     );
154
155 extern int ExprResolveEnum(ExprDef * /* expr */ ,
156                            ExprResult * /* val_rtrn */ ,
157                            LookupEntry *        /* values */
158     );
159
160 extern int ExprResolveMask(ExprDef * /* expr */ ,
161                            ExprResult * /* val_rtrn */ ,
162                            IdentLookupFunc /* lookup */ ,
163                            char *     /* lookupPriv */
164     );
165
166 extern int ExprResolveKeySym(ExprDef * /* expr */ ,
167                              ExprResult * /* val_rtrn */ ,
168                              IdentLookupFunc /* lookup */ ,
169                              char *   /* lookupPriv */
170     );
171
172 #endif /* EXPR_H */