xkbcomp.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. /************************************************************
  2. Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
  3. Permission to use, copy, modify, and distribute this
  4. software and its documentation for any purpose and without
  5. fee is hereby granted, provided that the above copyright
  6. notice appear in all copies and that both that copyright
  7. notice and this permission notice appear in supporting
  8. documentation, and that the name of Silicon Graphics not be
  9. used in advertising or publicity pertaining to distribution
  10. of the software without specific prior written permission.
  11. Silicon Graphics makes no representation about the suitability
  12. of this software for any purpose. It is provided "as is"
  13. without any express or implied warranty.
  14. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  15. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  16. AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
  17. GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  18. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  19. DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  20. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
  21. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22. ********************************************************/
  23. #ifndef XKBCOMP_H
  24. #define XKBCOMP_H 1
  25. #ifndef DEBUG_VAR
  26. #define DEBUG_VAR debugFlags
  27. #endif
  28. #include <X11/Xlib.h>
  29. #include <X11/XKBlib.h>
  30. #include "utils.h"
  31. #include <X11/extensions/XKM.h>
  32. #include <X11/extensions/XKBfile.h>
  33. extern char *scanFile;
  34. #define TypeUnknown 0
  35. #define TypeBoolean 1
  36. #define TypeInt 2
  37. #define TypeFloat 3
  38. #define TypeString 4
  39. #define TypeAction 5
  40. #define TypeKeyName 6
  41. #define TypeSymbols 7
  42. #define StmtUnknown 0
  43. #define StmtInclude 1
  44. #define StmtKeycodeDef 2
  45. #define StmtKeyAliasDef 3
  46. #define StmtExpr 4
  47. #define StmtVarDef 5
  48. #define StmtKeyTypeDef 6
  49. #define StmtInterpDef 7
  50. #define StmtVModDef 8
  51. #define StmtSymbolsDef 9
  52. #define StmtModMapDef 10
  53. #define StmtGroupCompatDef 11
  54. #define StmtIndicatorMapDef 12
  55. #define StmtIndicatorNameDef 13
  56. #define StmtOutlineDef 14
  57. #define StmtShapeDef 15
  58. #define StmtKeyDef 16
  59. #define StmtRowDef 17
  60. #define StmtSectionDef 18
  61. #define StmtOverlayKeyDef 19
  62. #define StmtOverlayDef 20
  63. #define StmtDoodadDef 21
  64. #define FileSymInterp 100
  65. typedef struct _ParseCommon
  66. {
  67. unsigned stmtType;
  68. struct _ParseCommon *next;
  69. } ParseCommon;
  70. #define ExprValue 0
  71. #define ExprIdent 1
  72. #define ExprActionDecl 2
  73. #define ExprFieldRef 3
  74. #define ExprArrayRef 4
  75. #define ExprKeysymList 5
  76. #define ExprActionList 6
  77. #define ExprCoord 7
  78. #define OpAdd 20
  79. #define OpSubtract 21
  80. #define OpMultiply 22
  81. #define OpDivide 23
  82. #define OpAssign 24
  83. #define OpNot 25
  84. #define OpNegate 26
  85. #define OpInvert 27
  86. #define OpUnaryPlus 28
  87. #define MergeDefault 0
  88. #define MergeAugment 1
  89. #define MergeOverride 2
  90. #define MergeReplace 3
  91. #define MergeAltForm 4
  92. #define AutoKeyNames (1L << 0)
  93. #define CreateKeyNames(x) ((x)->flags&AutoKeyNames)
  94. extern unsigned warningLevel;
  95. extern unsigned optionalParts;
  96. typedef struct _IncludeStmt
  97. {
  98. ParseCommon common;
  99. unsigned merge;
  100. char *stmt;
  101. char *file;
  102. char *map;
  103. char *modifier;
  104. char *path;
  105. struct _IncludeStmt *next;
  106. } IncludeStmt;
  107. typedef struct _Expr
  108. {
  109. ParseCommon common;
  110. unsigned op;
  111. unsigned type;
  112. union
  113. {
  114. struct
  115. {
  116. struct _Expr *left;
  117. struct _Expr *right;
  118. } binary;
  119. struct
  120. {
  121. Atom element;
  122. Atom field;
  123. } field;
  124. struct
  125. {
  126. Atom element;
  127. Atom field;
  128. struct _Expr *entry;
  129. } array;
  130. struct
  131. {
  132. Atom name;
  133. struct _Expr *args;
  134. } action;
  135. struct
  136. {
  137. int nSyms;
  138. int szSyms;
  139. char **syms;
  140. } list;
  141. struct
  142. {
  143. int x;
  144. int y;
  145. } coord;
  146. struct _Expr *child;
  147. Atom str;
  148. unsigned uval;
  149. int ival;
  150. char keyName[5];
  151. Opaque ptr;
  152. } value;
  153. } ExprDef;
  154. typedef struct _VarDef
  155. {
  156. ParseCommon common;
  157. unsigned merge;
  158. ExprDef *name;
  159. ExprDef *value;
  160. } VarDef;
  161. typedef struct _VModDef
  162. {
  163. ParseCommon common;
  164. unsigned merge;
  165. Atom name;
  166. ExprDef *value;
  167. } VModDef;
  168. typedef struct _KeycodeDef
  169. {
  170. ParseCommon common;
  171. unsigned merge;
  172. char name[5];
  173. ExprDef *value;
  174. } KeycodeDef;
  175. typedef struct _KeyAliasDef
  176. {
  177. ParseCommon common;
  178. unsigned merge;
  179. char alias[5];
  180. char real[5];
  181. } KeyAliasDef;
  182. typedef struct _KeyTypeDef
  183. {
  184. ParseCommon common;
  185. unsigned merge;
  186. Atom name;
  187. VarDef *body;
  188. } KeyTypeDef;
  189. typedef struct _SymbolsDef
  190. {
  191. ParseCommon common;
  192. unsigned merge;
  193. char keyName[5];
  194. ExprDef *symbols;
  195. } SymbolsDef;
  196. typedef struct _ModMapDef
  197. {
  198. ParseCommon common;
  199. unsigned merge;
  200. Atom modifier;
  201. ExprDef *keys;
  202. } ModMapDef;
  203. typedef struct _GroupCompatDef
  204. {
  205. ParseCommon common;
  206. unsigned merge;
  207. int group;
  208. ExprDef *def;
  209. } GroupCompatDef;
  210. typedef struct _InterpDef
  211. {
  212. ParseCommon common;
  213. unsigned merge;
  214. KeySym sym;
  215. ExprDef *match;
  216. VarDef *def;
  217. Bool ignore;
  218. } InterpDef;
  219. typedef struct _IndicatorNameDef
  220. {
  221. ParseCommon common;
  222. unsigned merge;
  223. int ndx;
  224. ExprDef *name;
  225. Bool virtual;
  226. } IndicatorNameDef;
  227. typedef struct _OutlineDef
  228. {
  229. ParseCommon common;
  230. Atom field;
  231. int nPoints;
  232. ExprDef *points;
  233. } OutlineDef;
  234. typedef struct _ShapeDef
  235. {
  236. ParseCommon common;
  237. unsigned merge;
  238. Atom name;
  239. int nOutlines;
  240. OutlineDef *outlines;
  241. } ShapeDef;
  242. typedef struct _KeyDef
  243. {
  244. ParseCommon common;
  245. unsigned defined;
  246. char *name;
  247. ExprDef *expr;
  248. } KeyDef;
  249. typedef struct _RowDef
  250. {
  251. ParseCommon common;
  252. int nKeys;
  253. KeyDef *keys;
  254. } RowDef;
  255. typedef struct _SectionDef
  256. {
  257. ParseCommon common;
  258. unsigned merge;
  259. Atom name;
  260. int nRows;
  261. RowDef *rows;
  262. } SectionDef;
  263. typedef struct _OverlayKeyDef
  264. {
  265. ParseCommon common;
  266. char over[5];
  267. char under[5];
  268. } OverlayKeyDef;
  269. typedef struct _OverlayDef
  270. {
  271. ParseCommon common;
  272. unsigned merge;
  273. Atom name;
  274. int nKeys;
  275. OverlayKeyDef *keys;
  276. } OverlayDef;
  277. typedef struct _DoodadDef
  278. {
  279. ParseCommon common;
  280. unsigned merge;
  281. unsigned type;
  282. Atom name;
  283. VarDef *body;
  284. } DoodadDef;
  285. /* IndicatorMapDef doesn't use the type field, but the rest of the fields
  286. need to be at the same offsets as in DoodadDef. Use #define to avoid
  287. any strict aliasing problems. */
  288. #define IndicatorMapDef DoodadDef
  289. typedef struct _XkbFile
  290. {
  291. ParseCommon common;
  292. int type;
  293. char *topName;
  294. char *name;
  295. ParseCommon *defs;
  296. int id;
  297. unsigned flags;
  298. Bool compiled;
  299. } XkbFile;
  300. extern Bool CompileKeymap(XkbFile * /* file */ ,
  301. XkbFileInfo * /* result */ ,
  302. unsigned /* merge */
  303. );
  304. extern Bool CompileKeycodes(XkbFile * /* file */ ,
  305. XkbFileInfo * /* result */ ,
  306. unsigned /* merge */
  307. );
  308. extern Bool CompileGeometry(XkbFile * /* file */ ,
  309. XkbFileInfo * /* result */ ,
  310. unsigned /* merge */
  311. );
  312. extern Bool CompileKeyTypes(XkbFile * /* file */ ,
  313. XkbFileInfo * /* result */ ,
  314. unsigned /* merge */
  315. );
  316. typedef struct _LEDInfo *LEDInfoPtr;
  317. extern Bool CompileCompatMap(XkbFile * /* file */ ,
  318. XkbFileInfo * /* result */ ,
  319. unsigned /* merge */ ,
  320. LEDInfoPtr * /* unboundLEDs */
  321. );
  322. extern Bool CompileSymbols(XkbFile * /* file */ ,
  323. XkbFileInfo * /* result */ ,
  324. unsigned /* merge */
  325. );
  326. #define WantLongListing (1<<0)
  327. #define WantPartialMaps (1<<1)
  328. #define WantHiddenMaps (1<<2)
  329. #define WantFullNames (1<<3)
  330. #define ListRecursive (1<<4)
  331. extern char *rootDir;
  332. extern unsigned verboseLevel;
  333. extern unsigned dirsToStrip;
  334. extern Bool AddListing(char * /* file */ ,
  335. char * /* map */
  336. );
  337. extern Bool AddMatchingFiles(char * /* head_in */
  338. );
  339. extern int AddMapOnly(char * /* map */
  340. );
  341. extern int GenerateListing(char * /* filename */
  342. );
  343. #endif /* XKBCOMP_H */