Shorten context to ctx
[platform/upstream/libxkbcommon.git] / src / xkbcomp / xkbcomp.h
index e9ce3e8..a4078a3 100644 (file)
@@ -6,19 +6,19 @@
  fee is hereby granted, provided that the above copyright
  notice appear in all copies and that both that copyright
  notice and this permission notice appear in supporting
- documentation, and that the name of Silicon Graphics not be 
- used in advertising or publicity pertaining to distribution 
+ documentation, and that the name of Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
  of the software without specific prior written permission.
- Silicon Graphics makes no representation about the suitability 
+ Silicon Graphics makes no representation about the suitability
  of this software for any purpose. It is provided "as is"
  without any express or implied warranty.
- SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
- GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
- DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+ GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
  THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 #ifndef XKBCOMP_H
 #define        XKBCOMP_H 1
 
-#ifndef DEBUG_VAR
-#define        DEBUG_VAR debugFlags
-#endif
-
-#include <X11/X.h>
-#include <X11/Xdefs.h>
-
-#include "utils.h"
-
-#include <X11/extensions/XKM.h>
-#include "X11/extensions/XKBcommon.h"
-
-extern char *scanFile;
+#include "xkb-priv.h"
 
 #define        TypeUnknown     0
 #define        TypeBoolean     1
 #define        TypeInt         2
-#define        TypeFloat       3
 #define        TypeString      4
 #define        TypeAction      5
 #define        TypeKeyName     6
@@ -64,14 +51,6 @@ extern char *scanFile;
 #define        StmtGroupCompatDef      11
 #define        StmtIndicatorMapDef     12
 #define        StmtIndicatorNameDef    13
-#define        StmtOutlineDef          14
-#define        StmtShapeDef            15
-#define        StmtKeyDef              16
-#define        StmtRowDef              17
-#define        StmtSectionDef          18
-#define        StmtOverlayKeyDef       19
-#define        StmtOverlayDef          20
-#define        StmtDoodadDef           21
 
 #define        FileSymInterp   100
 
@@ -88,7 +67,6 @@ typedef struct _ParseCommon
 #define        ExprArrayRef    4
 #define        ExprKeysymList  5
 #define        ExprActionList  6
-#define        ExprCoord       7
 
 #define        OpAdd           20
 #define        OpSubtract      21
@@ -110,7 +88,6 @@ typedef struct _ParseCommon
 #define        CreateKeyNames(x)       ((x)->flags&AutoKeyNames)
 
 extern unsigned warningLevel;
-extern unsigned optionalParts;
 
 typedef struct _IncludeStmt
 {
@@ -138,37 +115,35 @@ typedef struct _Expr
         } binary;
         struct
         {
-            Atom element;
-            Atom field;
+            xkb_atom_t element;
+            xkb_atom_t field;
         } field;
         struct
         {
-            Atom element;
-            Atom field;
+            xkb_atom_t element;
+            xkb_atom_t field;
             struct _Expr *entry;
         } array;
         struct
         {
-            Atom name;
+            xkb_atom_t name;
             struct _Expr *args;
         } action;
         struct
         {
             int nSyms;
             int szSyms;
-            KeySym *syms;
+            char **syms;
+            int nLevels;
+            int szLevels;
+            int *symsMapIndex;
+            unsigned int *symsNumEntries;
         } list;
-        struct
-        {
-            int x;
-            int y;
-        } coord;
         struct _Expr *child;
-        Atom str;
+        xkb_atom_t str;
         unsigned uval;
         int ival;
         char keyName[5];
-        Opaque ptr;
     } value;
 } ExprDef;
 
@@ -184,7 +159,7 @@ typedef struct _VModDef
 {
     ParseCommon common;
     unsigned merge;
-    Atom name;
+    xkb_atom_t name;
     ExprDef *value;
 } VModDef;
 
@@ -193,7 +168,7 @@ typedef struct _KeycodeDef
     ParseCommon common;
     unsigned merge;
     char name[5];
-    ExprDef *value;
+    unsigned long value;
 } KeycodeDef;
 
 typedef struct _KeyAliasDef
@@ -208,7 +183,7 @@ typedef struct _KeyTypeDef
 {
     ParseCommon common;
     unsigned merge;
-    Atom name;
+    xkb_atom_t name;
     VarDef *body;
 } KeyTypeDef;
 
@@ -224,7 +199,7 @@ typedef struct _ModMapDef
 {
     ParseCommon common;
     unsigned merge;
-    Atom modifier;
+    xkb_atom_t modifier;
     ExprDef *keys;
 } ModMapDef;
 
@@ -240,7 +215,7 @@ typedef struct _InterpDef
 {
     ParseCommon common;
     unsigned merge;
-    KeySym sym;
+    char *sym;
     ExprDef *match;
     VarDef *def;
 } InterpDef;
@@ -251,134 +226,45 @@ typedef struct _IndicatorNameDef
     unsigned merge;
     int ndx;
     ExprDef *name;
-    Bool virtual;
+    bool virtual;
 } IndicatorNameDef;
 
-typedef struct _OutlineDef
-{
-    ParseCommon common;
-    Atom field;
-    int nPoints;
-    ExprDef *points;
-} OutlineDef;
-
-typedef struct _ShapeDef
-{
-    ParseCommon common;
-    unsigned merge;
-    Atom name;
-    int nOutlines;
-    OutlineDef *outlines;
-} ShapeDef;
-
-typedef struct _KeyDef
-{
-    ParseCommon common;
-    unsigned defined;
-    char *name;
-    ExprDef *expr;
-} KeyDef;
-
-typedef struct _RowDef
-{
-    ParseCommon common;
-    int nKeys;
-    KeyDef *keys;
-} RowDef;
-
-typedef struct _SectionDef
-{
-    ParseCommon common;
-    unsigned merge;
-    Atom name;
-    int nRows;
-    RowDef *rows;
-} SectionDef;
-
-typedef struct _OverlayKeyDef
-{
-    ParseCommon common;
-    char over[5];
-    char under[5];
-} OverlayKeyDef;
-
-typedef struct _OverlayDef
-{
-    ParseCommon common;
-    unsigned merge;
-    Atom name;
-    int nKeys;
-    OverlayKeyDef *keys;
-} OverlayDef;
-
-typedef struct _DoodadDef
+typedef struct _IndicatorMapDef
 {
     ParseCommon common;
     unsigned merge;
     unsigned type;
-    Atom name;
+    xkb_atom_t name;
     VarDef *body;
-} DoodadDef;
-
-/* IndicatorMapDef doesn't use the type field, but the rest of the fields
-   need to be at the same offsets as in DoodadDef.  Use #define to avoid
-   any strict aliasing problems.  */
-#define IndicatorMapDef DoodadDef
+} IndicatorMapDef;
 
 typedef struct _XkbFile
 {
     ParseCommon common;
-    int type;
+    unsigned type;
     char *topName;
     char *name;
     ParseCommon *defs;
     int id;
     unsigned flags;
-    Bool compiled;
 } XkbFile;
 
-extern Bool
-CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
+extern struct xkb_keymap *
+CompileKeymap(struct xkb_ctx *ctx, XkbFile *file);
 
-extern Bool
-CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
+extern bool
+CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
 
-extern Bool
-CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
-
-extern Bool
-CompileKeyTypes(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
+extern bool
+CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
 
 typedef struct _LEDInfo *LEDInfoPtr;
 
-extern Bool
-CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge,
+extern bool
+CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, unsigned merge,
                  LEDInfoPtr *unboundLEDs);
 
-extern Bool
-CompileSymbols(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
-
-#define        WantLongListing (1<<0)
-#define        WantPartialMaps (1<<1)
-#define        WantHiddenMaps  (1<<2)
-#define        WantFullNames   (1<<3)
-#define        ListRecursive   (1<<4)
-
-extern char *rootDir;
-extern unsigned verboseLevel;
-extern unsigned dirsToStrip;
-
-extern Bool AddListing(char * /* file */ ,
-                       char *   /* map */
-    );
-
-extern Bool AddMatchingFiles(char *     /* head_in */
-    );
-
-extern int AddMapOnly(char *    /* map */
-    );
-
-extern int GenerateListing(char *       /* filename */
-    );
+extern bool
+CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, unsigned merge);
 
 #endif /* XKBCOMP_H */