1#ifndef _XKBRULES_H_ 2#define _XKBRULES_H_ 1 3 4/************************************************************ 5 Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. 6 7 Permission to use, copy, modify, and distribute this 8 software and its documentation for any purpose and without 9 fee is hereby granted, provided that the above copyright 10 notice appear in all copies and that both that copyright 11 notice and this permission notice appear in supporting 12 documentation, and that the name of Silicon Graphics not be 13 used in advertising or publicity pertaining to distribution 14 of the software without specific prior written permission. 15 Silicon Graphics makes no representation about the suitability 16 of this software for any purpose. It is provided "as is" 17 without any express or implied warranty. 18 19 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 20 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 21 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON 22 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 23 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 24 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 25 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH 26 THE USE OR PERFORMANCE OF THIS SOFTWARE. 27 28 ********************************************************/ 29 30/***====================================================================***/ 31 32typedef struct _XkbRF_VarDefs { 33 char * model; 34 char * layout; 35 char * variant; 36 char * options; 37 unsigned short sz_extra; 38 unsigned short num_extra; 39 char * extra_names; 40 char ** extra_values; 41} XkbRF_VarDefsRec,*XkbRF_VarDefsPtr; 42 43typedef struct _XkbRF_VarDesc { 44 char * name; 45 char * desc; 46} XkbRF_VarDescRec, *XkbRF_VarDescPtr; 47 48typedef struct _XkbRF_DescribeVars { 49 int sz_desc; 50 int num_desc; 51 XkbRF_VarDescPtr desc; 52} XkbRF_DescribeVarsRec,*XkbRF_DescribeVarsPtr; 53 54typedef struct _XkbRF_Rule { 55 int number; 56 int layout_num; 57 int variant_num; 58 char * model; 59 char * layout; 60 char * variant; 61 char * option; 62 /* yields */ 63 char * keycodes; 64 char * symbols; 65 char * types; 66 char * compat; 67 char * geometry; 68 char * keymap; 69 unsigned flags; 70} XkbRF_RuleRec,*XkbRF_RulePtr; 71 72typedef struct _XkbRF_Group { 73 int number; 74 char * name; 75 char * words; 76} XkbRF_GroupRec, *XkbRF_GroupPtr; 77 78#define XkbRF_PendingMatch (1L<<1) 79#define XkbRF_Option (1L<<2) 80#define XkbRF_Append (1L<<3) 81#define XkbRF_Normal (1L<<4) 82#define XkbRF_Invalid (1L<<5) 83 84typedef struct _XkbRF_Rules { 85 XkbRF_DescribeVarsRec models; 86 XkbRF_DescribeVarsRec layouts; 87 XkbRF_DescribeVarsRec variants; 88 XkbRF_DescribeVarsRec options; 89 unsigned short sz_extra; 90 unsigned short num_extra; 91 char ** extra_names; 92 XkbRF_DescribeVarsPtr extra; 93 94 unsigned short sz_rules; 95 unsigned short num_rules; 96 XkbRF_RulePtr rules; 97 unsigned short sz_groups; 98 unsigned short num_groups; 99 XkbRF_GroupPtr groups; 100} XkbRF_RulesRec, *XkbRF_RulesPtr; 101 102/***====================================================================***/ 103 104_XFUNCPROTOBEGIN 105 106extern Bool XkbRF_GetComponents( 107 XkbRF_RulesPtr /* rules */, 108 XkbRF_VarDefsPtr /* var_defs */, 109 XkbComponentNamesPtr /* names */ 110); 111 112extern XkbRF_RulePtr XkbRF_AddRule( 113 XkbRF_RulesPtr /* rules */ 114); 115 116extern XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr rules); 117 118extern Bool XkbRF_LoadRules( 119 FILE * /* file */, 120 XkbRF_RulesPtr /* rules */ 121); 122 123extern Bool XkbRF_LoadRulesByName( 124 char * /* base */, 125 char * /* locale */, 126 XkbRF_RulesPtr /* rules */ 127); 128 129/***====================================================================***/ 130 131extern XkbRF_VarDescPtr XkbRF_AddVarDesc( 132 XkbRF_DescribeVarsPtr /* vars */ 133); 134 135extern XkbRF_VarDescPtr XkbRF_AddVarDescCopy( 136 XkbRF_DescribeVarsPtr /* vars */, 137 XkbRF_VarDescPtr /* copy_from */ 138); 139 140extern XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe( 141 XkbRF_RulesPtr /* rules */, 142 char * /* name */ 143); 144 145extern Bool XkbRF_LoadDescriptions( 146 FILE * /* file */, 147 XkbRF_RulesPtr /* rules */ 148); 149 150extern Bool XkbRF_LoadDescriptionsByName( 151 char * /* base */, 152 char * /* locale */, 153 XkbRF_RulesPtr /* rules */ 154); 155 156extern XkbRF_RulesPtr XkbRF_Load( 157 char * /* base */, 158 char * /* locale */, 159 Bool /* wantDesc */, 160 Bool /* wantRules */ 161); 162 163extern XkbRF_RulesPtr XkbRF_Create( 164 int /* sz_rules */, 165 int /* sz_extra */ 166); 167 168/***====================================================================***/ 169 170extern void XkbRF_Free( 171 XkbRF_RulesPtr /* rules */, 172 Bool /* freeRules */ 173); 174 175 176/***====================================================================***/ 177 178#define _XKB_RF_NAMES_PROP_ATOM "_XKB_RULES_NAMES" 179#define _XKB_RF_NAMES_PROP_MAXLEN 1024 180 181 182extern Bool XkbRF_GetNamesProp( 183 Display * /* dpy */, 184 char ** /* rules_file_rtrn */, 185 XkbRF_VarDefsPtr /* var_defs_rtrn */ 186); 187 188extern Bool XkbRF_SetNamesProp( 189 Display * /* dpy */, 190 char * /* rules_file */, 191 XkbRF_VarDefsPtr /* var_defs */ 192); 193 194 195_XFUNCPROTOEND 196 197#endif /* _XKBRULES_H_ */ 198