Use CARD32 instead of Atom, move geom headers in
[platform/upstream/libxkbcommon.git] / src / xkbcomp / alias.c
index aadf535..665c34f 100644 (file)
@@ -6,31 +6,32 @@
  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.
 
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbgeom.h"
+#include "xkbmisc.h"
 #include "misc.h"
 #include "alias.h"
 #include "keycodes.h"
 
-#include <X11/extensions/XKBgeomcommon.h>
-
 static void
 HandleCollision(AliasInfo * old, AliasInfo * new)
 {
@@ -39,9 +40,8 @@ HandleCollision(AliasInfo * old, AliasInfo * new)
         if (((new->def.fileID == old->def.fileID) && (warningLevel > 0)) ||
             (warningLevel > 9))
         {
-            WARN2("Alias of %s for %s declared more than once\n",
-                  XkbKeyNameText(new->alias, XkbMessage),
-                  XkbKeyNameText(new->real, XkbMessage));
+            WARN("Alias of %s for %s declared more than once\n",
+                  XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real));
             ACTION("First definition ignored\n");
         }
     }
@@ -61,11 +61,10 @@ HandleCollision(AliasInfo * old, AliasInfo * new)
         if (((old->def.fileID == new->def.fileID) && (warningLevel > 0)) ||
             (warningLevel > 9))
         {
-            WARN1("Multiple definitions for alias %s\n",
-                  XkbKeyNameText(old->alias, XkbMessage));
-            ACTION2("Using %s, ignoring %s\n",
-                    XkbKeyNameText(use, XkbMessage),
-                    XkbKeyNameText(ignore, XkbMessage));
+            WARN("Multiple definitions for alias %s\n",
+                  XkbcKeyNameText(old->alias));
+            ACTION("Using %s, ignoring %s\n",
+                    XkbcKeyNameText(use), XkbcKeyNameText(ignore));
         }
         if (use != old->real)
             memcpy(old->real, use, XkbKeyNameLength);
@@ -156,13 +155,13 @@ MergeAliases(AliasInfo ** into, AliasInfo ** merge, unsigned how_merge)
 }
 
 int
-ApplyAliases(XkbDescPtr xkb, Bool toGeom, AliasInfo ** info_in)
+ApplyAliases(XkbcDescPtr xkb, Bool toGeom, AliasInfo ** info_in)
 {
     register int i;
     XkbKeyAliasPtr old, a;
     AliasInfo *info;
     int nNew, nOld;
-    Status status;
+    int status;
 
     if (*info_in == NULL)
         return True;
@@ -187,9 +186,8 @@ ApplyAliases(XkbDescPtr xkb, Bool toGeom, AliasInfo ** info_in)
         {
             if (warningLevel > 4)
             {
-                WARN2("Attempt to alias %s to non-existent key %s\n",
-                      XkbKeyNameText(info->alias, XkbMessage),
-                      XkbKeyNameText(info->real, XkbMessage));
+                WARN("Attempt to alias %s to non-existent key %s\n",
+                      XkbcKeyNameText(info->alias), XkbcKeyNameText(info->real));
                 ACTION("Ignored\n");
             }
             info->alias[0] = '\0';
@@ -201,9 +199,9 @@ ApplyAliases(XkbDescPtr xkb, Bool toGeom, AliasInfo ** info_in)
             if (warningLevel > 4)
             {
                 WARN("Attempt to create alias with the name of a real key\n");
-                ACTION2("Alias \"%s = %s\" ignored\n",
-                        XkbKeyNameText(info->alias, XkbMessage),
-                        XkbKeyNameText(info->real, XkbMessage));
+                ACTION("Alias \"%s = %s\" ignored\n",
+                        XkbcKeyNameText(info->alias),
+                        XkbcKeyNameText(info->real));
             }
             info->alias[0] = '\0';
             continue;
@@ -237,22 +235,22 @@ ApplyAliases(XkbDescPtr xkb, Bool toGeom, AliasInfo ** info_in)
     {
         if (!xkb->geom)
         {
-            XkbGeometrySizesRec sizes;
-            bzero((char *) &sizes, sizeof(XkbGeometrySizesRec));
+            XkbcGeometrySizesRec sizes;
+            bzero((char *) &sizes, sizeof(XkbcGeometrySizesRec));
             sizes.which = XkbGeomKeyAliasesMask;
             sizes.num_key_aliases = nOld + nNew;
-            status = XkbAllocGeometry(xkb, &sizes);
+            status = XkbcAllocGeometry(xkb, &sizes);
         }
         else
         {
-            status = XkbAllocGeomKeyAliases(xkb->geom, nOld + nNew);
+            status = XkbcAllocGeomKeyAliases(xkb->geom, nOld + nNew);
         }
         if (xkb->geom)
             old = xkb->geom->key_aliases;
     }
     else
     {
-        status = XkbAllocNames(xkb, XkbKeyAliasesMask, 0, nOld + nNew);
+        status = XkbcAllocNames(xkb, XkbKeyAliasesMask, 0, nOld + nNew);
         if (xkb->names)
             old = xkb->names->key_aliases;
     }
@@ -277,7 +275,7 @@ ApplyAliases(XkbDescPtr xkb, Bool toGeom, AliasInfo ** info_in)
 #ifdef DEBUG
     if ((a - old) != (nOld + nNew))
     {
-        WSGO2("Expected %d aliases total but created %d\n", nOld + nNew,
+        WSGO("Expected %d aliases total but created %d\n", nOld + nNew,
               a - old);
     }
 #endif