Rename 'ctx' back to 'context' in external API
[platform/upstream/libxkbcommon.git] / src / xkbcomp / parseutils.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 PARSEUTILS_H
28 #define PARSEUTILS_H
29
30 #include <stdio.h>
31
32 #include "xkbcomp-priv.h"
33 #include "parser.h"
34
35 struct parser_param {
36     struct xkb_context *ctx;
37     void *scanner;
38     XkbFile *rtrn;
39 };
40
41 struct scanner_extra {
42     char *scanFile;
43     char scanBuf[1024];
44     char *s;
45 };
46
47 extern ParseCommon *
48 AppendStmt(ParseCommon *to, ParseCommon *append);
49
50 extern ExprDef *
51 ExprCreate(unsigned op, unsigned type);
52
53 extern ExprDef *
54 ExprCreateUnary(unsigned op, unsigned type, ExprDef *child);
55
56 extern ExprDef *
57 ExprCreateBinary(unsigned op, ExprDef *left, ExprDef *right);
58
59 extern KeycodeDef *
60 KeycodeCreate(const char *name, unsigned long value);
61
62 extern KeyAliasDef *
63 KeyAliasCreate(const char *alias, const char *real);
64
65 extern VModDef *
66 VModCreate(xkb_atom_t name, ExprDef *value);
67
68 extern VarDef *
69 VarCreate(ExprDef *name, ExprDef *value);
70
71 extern VarDef *
72 BoolVarCreate(xkb_atom_t nameToken, unsigned set);
73
74 extern InterpDef *
75 InterpCreate(char *sym, ExprDef *match);
76
77 extern KeyTypeDef *
78 KeyTypeCreate(xkb_atom_t name, VarDef *body);
79
80 extern SymbolsDef *
81 SymbolsCreate(const char *keyName, ExprDef *symbols);
82
83 extern GroupCompatDef *
84 GroupCompatCreate(int group, ExprDef *def);
85
86 extern ModMapDef *
87 ModMapCreate(uint32_t modifier, ExprDef *keys);
88
89 extern IndicatorMapDef *
90 IndicatorMapCreate(xkb_atom_t name, VarDef *body);
91
92 extern IndicatorNameDef *
93 IndicatorNameCreate(int ndx, ExprDef *name, bool virtual);
94
95 extern ExprDef *
96 ActionCreate(xkb_atom_t name, ExprDef *args);
97
98 extern ExprDef *
99 CreateMultiKeysymList(ExprDef *list);
100
101 extern ExprDef *
102 CreateKeysymList(char *sym);
103
104 extern ExprDef *
105 AppendMultiKeysymList(ExprDef *list, ExprDef *append);
106
107 extern ExprDef *
108 AppendKeysymList(ExprDef *list, char *sym);
109
110 extern int
111 LookupKeysym(const char *str, xkb_keysym_t *sym_rtrn);
112
113 extern IncludeStmt *
114 IncludeCreate(char *str, unsigned merge);
115
116 extern unsigned
117 StmtSetMerge(ParseCommon *stmt, unsigned merge, struct YYLTYPE *loc, void *scanner);
118
119 extern void
120 CheckDefaultMap(XkbFile *maps, const char *fileName);
121
122 extern XkbFile *
123 CreateXKBFile(struct xkb_context *ctx, int type, char *name,
124               ParseCommon *defs, unsigned flags);
125
126 extern bool
127 XKBParseFile(struct xkb_context *ctx, FILE *file,
128                const char *file_name, XkbFile **out);
129
130 extern bool
131 XKBParseString(struct xkb_context *context, const char *string,
132                const char *file_name, XkbFile **out);
133
134 extern void
135 FreeXKBFile(XkbFile *file);
136
137 extern void
138 FreeStmt(ParseCommon *stmt);
139
140 extern void
141 yyerror(struct YYLTYPE *loc, void *scanner, const char *msg);
142
143 #endif /* PARSEUTILS_H */