1*2b949d04SAndroid Build Coastguard Worker%{ 2*2b949d04SAndroid Build Coastguard Worker#include "config.h" 3*2b949d04SAndroid Build Coastguard Worker 4*2b949d04SAndroid Build Coastguard Worker#include "xkbcomp-priv.h" 5*2b949d04SAndroid Build Coastguard Worker#include "parser-priv.h" 6*2b949d04SAndroid Build Coastguard Worker 7*2b949d04SAndroid Build Coastguard Workerstatic const struct keyword_tok * 8*2b949d04SAndroid Build Coastguard Workerkeyword_gperf_lookup (register const char *str, register size_t len); 9*2b949d04SAndroid Build Coastguard Worker%} 10*2b949d04SAndroid Build Coastguard Worker 11*2b949d04SAndroid Build Coastguard Workerstruct keyword_tok { int name; int tok; }; 12*2b949d04SAndroid Build Coastguard Worker%language=ANSI-C 13*2b949d04SAndroid Build Coastguard Worker%define hash-function-name keyword_gperf_hash 14*2b949d04SAndroid Build Coastguard Worker%define lookup-function-name keyword_gperf_lookup 15*2b949d04SAndroid Build Coastguard Worker%readonly-tables 16*2b949d04SAndroid Build Coastguard Worker%enum 17*2b949d04SAndroid Build Coastguard Worker%includes 18*2b949d04SAndroid Build Coastguard Worker%struct-type 19*2b949d04SAndroid Build Coastguard Worker%pic 20*2b949d04SAndroid Build Coastguard Worker%ignore-case 21*2b949d04SAndroid Build Coastguard Worker 22*2b949d04SAndroid Build Coastguard Worker%% 23*2b949d04SAndroid Build Coastguard Workeraction, ACTION_TOK 24*2b949d04SAndroid Build Coastguard Workeralias, ALIAS 25*2b949d04SAndroid Build Coastguard Workeralphanumeric_keys, ALPHANUMERIC_KEYS 26*2b949d04SAndroid Build Coastguard Workeralternate_group, ALTERNATE_GROUP 27*2b949d04SAndroid Build Coastguard Workeralternate, ALTERNATE 28*2b949d04SAndroid Build Coastguard Workeraugment, AUGMENT 29*2b949d04SAndroid Build Coastguard Workerdefault, DEFAULT 30*2b949d04SAndroid Build Coastguard Workerfunction_keys, FUNCTION_KEYS 31*2b949d04SAndroid Build Coastguard Workergroup, GROUP 32*2b949d04SAndroid Build Coastguard Workerhidden, HIDDEN 33*2b949d04SAndroid Build Coastguard Workerinclude, INCLUDE 34*2b949d04SAndroid Build Coastguard Workerindicator, INDICATOR 35*2b949d04SAndroid Build Coastguard Workerinterpret, INTERPRET 36*2b949d04SAndroid Build Coastguard Workerkeypad_keys, KEYPAD_KEYS 37*2b949d04SAndroid Build Coastguard Workerkey, KEY 38*2b949d04SAndroid Build Coastguard Workerkeys, KEYS 39*2b949d04SAndroid Build Coastguard Workerlogo, LOGO 40*2b949d04SAndroid Build Coastguard Workermodifier_keys, MODIFIER_KEYS 41*2b949d04SAndroid Build Coastguard Workermodifier_map, MODIFIER_MAP 42*2b949d04SAndroid Build Coastguard Workermod_map, MODIFIER_MAP 43*2b949d04SAndroid Build Coastguard Workermodmap, MODIFIER_MAP 44*2b949d04SAndroid Build Coastguard Workeroutline, OUTLINE 45*2b949d04SAndroid Build Coastguard Workeroverlay, OVERLAY 46*2b949d04SAndroid Build Coastguard Workeroverride, OVERRIDE 47*2b949d04SAndroid Build Coastguard Workerpartial, PARTIAL 48*2b949d04SAndroid Build Coastguard Workerreplace, REPLACE 49*2b949d04SAndroid Build Coastguard Workerrow, ROW 50*2b949d04SAndroid Build Coastguard Workersection, SECTION 51*2b949d04SAndroid Build Coastguard Workershape, SHAPE 52*2b949d04SAndroid Build Coastguard Workersolid, SOLID 53*2b949d04SAndroid Build Coastguard Workertext, TEXT 54*2b949d04SAndroid Build Coastguard Workertype, TYPE 55*2b949d04SAndroid Build Coastguard Workervirtual_modifiers, VIRTUAL_MODS 56*2b949d04SAndroid Build Coastguard Workervirtual, VIRTUAL 57*2b949d04SAndroid Build Coastguard Workerxkb_compatibility_map, XKB_COMPATMAP 58*2b949d04SAndroid Build Coastguard Workerxkb_compatibility, XKB_COMPATMAP 59*2b949d04SAndroid Build Coastguard Workerxkb_compat_map, XKB_COMPATMAP 60*2b949d04SAndroid Build Coastguard Workerxkb_compat, XKB_COMPATMAP 61*2b949d04SAndroid Build Coastguard Workerxkb_geometry, XKB_GEOMETRY 62*2b949d04SAndroid Build Coastguard Workerxkb_keycodes, XKB_KEYCODES 63*2b949d04SAndroid Build Coastguard Workerxkb_keymap, XKB_KEYMAP 64*2b949d04SAndroid Build Coastguard Workerxkb_layout, XKB_LAYOUT 65*2b949d04SAndroid Build Coastguard Workerxkb_semantics, XKB_SEMANTICS 66*2b949d04SAndroid Build Coastguard Workerxkb_symbols, XKB_SYMBOLS 67*2b949d04SAndroid Build Coastguard Workerxkb_types, XKB_TYPES 68*2b949d04SAndroid Build Coastguard Worker%% 69*2b949d04SAndroid Build Coastguard Worker 70*2b949d04SAndroid Build Coastguard Workerint 71*2b949d04SAndroid Build Coastguard Workerkeyword_to_token(const char *string, size_t len) 72*2b949d04SAndroid Build Coastguard Worker{ 73*2b949d04SAndroid Build Coastguard Worker const struct keyword_tok *kt = keyword_gperf_lookup(string, len); 74*2b949d04SAndroid Build Coastguard Worker if (!kt) 75*2b949d04SAndroid Build Coastguard Worker return -1; 76*2b949d04SAndroid Build Coastguard Worker return kt->tok; 77*2b949d04SAndroid Build Coastguard Worker} 78