Remove all non-public API from XKBcommon.h header
authorDan Nicholson <dbn.lists@gmail.com>
Wed, 8 Apr 2009 14:46:25 +0000 (07:46 -0700)
committerDan Nicholson <dbn.lists@gmail.com>
Wed, 8 Apr 2009 14:46:25 +0000 (07:46 -0700)
The noble intention was to expose all the new API and new generic types
in the split out kbproto headers through XKBcommon.h. It turns out that
would be a massive amount of work in the server. Someday, but first just
wedging in XkbCompileKeymap* would be good.

Most of the API is in new internal xkb*.h headers. In order to allow the
XKBcommon.h header to be used from the server, we can't pull in other
headers from kbproto since the server has its own copies. However, types
that are different (XkbDescRec, XkbAction) still have Xkbc equivalents
here, and I think they should be used in the server.

36 files changed:
include/X11/extensions/XKBcommon.h
src/Makefile.am
src/alloc.c
src/atom.c
src/galloc.c
src/geom.c
src/keysym.c
src/malloc.c
src/maprules.c
src/misc.c
src/text.c
src/xkb.c
src/xkballoc.h [new file with mode: 0644]
src/xkbcomp/action.c
src/xkbcomp/alias.c
src/xkbcomp/compat.c
src/xkbcomp/expr.c
src/xkbcomp/geometry.c
src/xkbcomp/indicators.c
src/xkbcomp/keycodes.c
src/xkbcomp/keymap.c
src/xkbcomp/keytypes.c
src/xkbcomp/misc.c
src/xkbcomp/parseutils.c
src/xkbcomp/symbols.c
src/xkbcomp/vmod.c
src/xkbcomp/xkbcomp.c
src/xkbcomp/xkbcomp.h
src/xkbcomp/xkbparse.y
src/xkbcomp/xkbpath.h
src/xkbgeom.h [new file with mode: 0644]
src/xkbmisc.h [new file with mode: 0644]
src/xkbrules.h [new file with mode: 0644]
test/namescomp.c
test/rulescomp.c
test/xkey.c

index fa6d136..39679f3 100644 (file)
@@ -28,13 +28,7 @@ authorization from the authors.
 #ifndef _XKBCOMMON_H_
 #define _XKBCOMMON_H_
 
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xdefs.h>
 #include <X11/Xfuncproto.h>
-#include <X11/extensions/XKBstrcommon.h>
-#include <X11/extensions/XKBgeomcommon.h>
-#include <X11/extensions/XKBrulescommon.h>
 
 /* Action structures used in the server */
 typedef struct _XkbcModAction {
@@ -129,9 +123,6 @@ typedef struct _XkbcDesc {
     XkbGeometryPtr      geom;
 } XkbcDescRec, *XkbcDescPtr;
 
-#define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbcKSLower)
-#define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbcKSUpper)
-
 _XFUNCPROTOBEGIN
 
 extern XkbcDescPtr
@@ -140,312 +131,6 @@ XkbcCompileKeymapFromRules(const char *rules, XkbRF_VarDefsPtr defs);
 extern XkbcDescPtr
 XkbcCompileKeymapFromComponents(XkbComponentNamesPtr ktcsg);
 
-extern char *
-XkbcKeysymToString(KeySym ks);
-
-extern KeySym
-XkbcStringToKeysym(const char *s);
-
-extern int
-XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI);
-
-extern void
-XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap);
-
-extern int
-XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases);
-
-extern void
-XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap);
-
-extern int
-XkbcAllocControls(XkbcDescPtr xkb, unsigned which);
-
-extern void
-XkbcFreeControls(XkbcDescPtr xkb, unsigned which, Bool freeMap);
-
-extern int
-XkbcAllocIndicatorMaps(XkbcDescPtr xkb);
-
-extern void
-XkbcFreeIndicatorMaps(XkbcDescPtr xkb);
-
-extern XkbcDescRec *
-XkbcAllocKeyboard(void);
-
-extern void
-XkbcFreeKeyboard(XkbcDescPtr xkb, unsigned which, Bool freeAll);
-
-extern int
-XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes);
-
-extern int
-XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions);
-
-extern int
-XkbcCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into);
-
-extern int
-XkbcCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types);
-
-extern int
-XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
-                  Bool want_preserve, int new_num_lvls);
-
-extern KeySym *
-XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed);
-
-extern int
-XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
-                       XkbChangesPtr changes);
-
-extern XkbcAction *
-XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed);
-
-extern void
-XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
-
-extern void
-XkbcFreeServerMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
-
-extern void
-XkbcFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count,
-                        Bool freeAll);
-
-extern void
-XkbcFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
-                        Bool freeAll);
-
-extern void
-XkbcFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll);
-
-extern void
-XkbcFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll);
-
-extern void
-XkbcFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap);
-
-extern int
-XkbcAllocGeomProps(XkbGeometryPtr geom, int nProps);
-
-extern int
-XkbcAllocGeomColors(XkbGeometryPtr geom, int nColors);
-
-extern int
-XkbcAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases);
-
-extern int
-XkbcAllocGeomShapes(XkbGeometryPtr geom, int nShapes);
-
-extern int
-XkbcAllocGeomSections(XkbGeometryPtr geom, int nSections);
-
-extern int
-XkbcAllocGeomOverlays(XkbSectionPtr section, int nOverlays);
-
-extern int
-XkbcAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows);
-
-extern int
-XkbcAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys);
-
-extern int
-XkbcAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads);
-
-extern int
-XkbcAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads);
-
-extern int
-XkbcAllocGeomOutlines(XkbShapePtr shape, int nOL);
-
-extern int
-XkbcAllocGeomRows(XkbSectionPtr section, int nRows);
-
-extern int
-XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts);
-
-extern int
-XkbcAllocGeomKeys(XkbRowPtr row, int nKeys);
-
-extern int
-XkbcAllocGeometry(XkbcDescPtr xkb, XkbGeometrySizesPtr sizes);
-
-extern XkbPropertyPtr
-XkbcAddGeomProperty(XkbGeometryPtr geom, char *name, char *value);
-
-extern XkbKeyAliasPtr
-XkbcAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr);
-
-extern XkbColorPtr
-XkbcAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel);
-
-extern XkbOutlinePtr
-XkbcAddGeomOutline(XkbShapePtr shape, int sz_points);
-
-extern XkbShapePtr
-XkbcAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines);
-
-extern XkbKeyPtr
-XkbcAddGeomKey(XkbRowPtr row);
-
-extern XkbRowPtr
-XkbcAddGeomRow(XkbSectionPtr section, int sz_keys);
-
-extern XkbSectionPtr
-XkbcAddGeomSection(XkbGeometryPtr geom, Atom name,
-                   int sz_rows, int sz_doodads, int sz_over);
-
-extern XkbDoodadPtr
-XkbcAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name);
-
-extern XkbOverlayKeyPtr
-XkbcAddGeomOverlayKey(XkbOverlayPtr overlay, XkbOverlayRowPtr row,
-                      char *over, char *under);
-
-extern XkbOverlayRowPtr
-XkbcAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys);
-
-extern XkbOverlayPtr
-XkbcAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows);
-
-extern void
-XkbcInitAtoms(void);
-
-extern char *
-XkbcAtomGetString(Atom atom);
-
-extern Atom
-XkbcInternAtom(char *name, Bool onlyIfExists);
-
-extern char *
-XkbcAtomText(Atom atm);
-
-extern char *
-XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx);
-
-extern char *
-XkbcVModMaskText(XkbcDescPtr xkb, unsigned modMask, unsigned mask);
-
-extern char *
-XkbcModIndexText(unsigned ndx);
-
-extern char *
-XkbcModMaskText(unsigned mask, Bool cFormat);
-
-extern char *
-XkbcConfigText(unsigned config);
-
-extern char *
-XkbcGeomFPText(int val);
-
-extern char *
-XkbcActionTypeText(unsigned type);
-
-extern char *
-XkbcKeysymText(KeySym sym);
-
-extern char *
-XkbcKeyNameText(char *name);
-
-extern char *
-XkbcSIMatchText(unsigned type);
-
-extern Bool
-XkbcComputeShapeBounds(XkbShapePtr shape);
-
-extern Bool
-XkbcComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds);
-
-extern Bool
-XkbcComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row);
-
-extern Bool
-XkbcComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section);
-
-extern Bool
-XkbcRF_GetComponents(XkbRF_RulesPtr rules, XkbRF_VarDefsPtr defs,
-                     XkbComponentNamesPtr names);
-
-extern XkbRF_RulePtr
-XkbcRF_AddRule(XkbRF_RulesPtr rules);
-
-extern XkbRF_GroupPtr
-XkbcRF_AddGroup(XkbRF_RulesPtr rules);
-
-extern Bool
-XkbcRF_LoadRules(FILE *file, XkbRF_RulesPtr rules);
-
-extern Bool
-XkbcRF_LoadRulesByName(char *base, char *locale, XkbRF_RulesPtr rules);
-
-extern XkbRF_VarDescPtr
-XkbcRF_AddVarDesc(XkbRF_DescribeVarsPtr vars);
-
-extern XkbRF_VarDescPtr
-XkbcRF_AddVarDescCopy(XkbRF_DescribeVarsPtr vars, XkbRF_VarDescPtr from);
-
-extern XkbRF_DescribeVarsPtr
-XkbcRF_AddVarToDescribe(XkbRF_RulesPtr rules, char *name);
-
-extern Bool
-XkbcRF_LoadDescriptions(FILE *file, XkbRF_RulesPtr rules);
-
-extern Bool
-XkbcRF_LoadDescriptionsByName(char *base, char *locale, XkbRF_RulesPtr rules);
-
-extern XkbRF_RulesPtr
-XkbcRF_Load(char *base, char *locale, Bool wantDesc, Bool wantRules);
-
-extern XkbRF_RulesPtr
-XkbcRF_Create(int szRules, int szExtra);
-
-extern void
-XkbcRF_Free(XkbRF_RulesPtr rules, Bool freeRules);
-
-extern int
-XkbcInitCanonicalKeyTypes(XkbcDescPtr xkb, unsigned which, int keypadVMod);
-
-extern Bool
-XkbcVirtualModsToReal(XkbcDescPtr xkb, unsigned virtual_mask,
-                      unsigned *mask_rtrn);
-
-extern Bool
-XkbcComputeEffectiveMap(XkbcDescPtr xkb, XkbKeyTypePtr type,
-                        unsigned char *map_rtrn);
-
-extern void
-XkbcEnsureSafeMapName(char *name);
-
-extern unsigned
-_XkbcKSCheckCase(KeySym sym);
-
 _XFUNCPROTOEND
 
 #endif /* _XKBCOMMON_H_ */
index f165e91..0159a6d 100644 (file)
@@ -16,4 +16,8 @@ libxkbcommon_la_SOURCES = \
        maprules.c \
        misc.c \
        text.c \
-       xkb.c
+       xkb.c \
+       xkballoc.h \
+       xkbgeom.h \
+       xkbmisc.h \
+       xkbrules.h
index f4989b1..fce6b8c 100644 (file)
@@ -26,10 +26,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#include "xkballoc.h"
+#include "xkbgeom.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
-#include <X11/X.h>
-#include <X11/Xdefs.h>
 #include <X11/extensions/XKB.h>
 
 int
index 7889030..127716f 100644 (file)
@@ -73,6 +73,7 @@ SOFTWARE.
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#include "xkbmisc.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
 
index 49af81b..b45ce74 100644 (file)
@@ -26,10 +26,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#include "xkbgeom.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
-#include <X11/X.h>
-#include <X11/Xdefs.h>
 #include <X11/extensions/XKB.h>
 
 static void
index d03586b..9572f01 100644 (file)
@@ -28,6 +28,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <config.h>
 #endif
 
+#include "xkbgeom.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
 
index a289a9a..4738fc2 100644 (file)
@@ -30,6 +30,7 @@ authorization from the authors.
 #endif
 #include <X11/X.h>
 #include <X11/keysymdef.h>
+#include "xkbmisc.h"
 #include "X11/extensions/XKBcommon.h"
 #include <stdlib.h>
 #include <string.h>
index cf5103f..3946d2c 100644 (file)
@@ -24,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 ********************************************************/
 
+#include "xkballoc.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
 
index dee410f..2c7156b 100644 (file)
@@ -27,6 +27,7 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#include "xkbrules.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
 
index b42ab89..dcdc26f 100644 (file)
@@ -28,9 +28,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <config.h>
 #endif
 
+#include "xkballoc.h"
+#include "xkbmisc.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
 #include <X11/keysym.h>
+#include <X11/extensions/XKBfilecommon.h>
 
 #define mapSize(m) (sizeof(m) / sizeof(XkbKTMapEntryRec))
 static XkbKTMapEntryRec map2Level[]= {
index 207177e..9da18b6 100644 (file)
@@ -27,6 +27,7 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#include "xkbmisc.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
 #include <X11/extensions/XKM.h>
index de2d0d3..b0b0de6 100644 (file)
--- a/src/xkb.c
+++ b/src/xkb.c
@@ -27,7 +27,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-
+#include "xkbmisc.h"
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
 
diff --git a/src/xkballoc.h b/src/xkballoc.h
new file mode 100644 (file)
index 0000000..3d28843
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+Copyright 2009  Dan Nicholson
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+*/
+
+#ifndef _XKBALLOC_H_
+#define _XKBALLOC_H_
+
+#include <X11/X.h>
+#include <X11/Xdefs.h>
+#include <X11/extensions/XKBstrcommon.h>
+#include <X11/extensions/XKBrulescommon.h>
+#include "X11/extensions/XKBcommon.h"
+
+extern int
+XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI);
+
+extern void
+XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap);
+
+extern int
+XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG,
+               int nTotalAliases);
+
+extern void
+XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap);
+
+extern int
+XkbcAllocControls(XkbcDescPtr xkb, unsigned which);
+
+extern void
+XkbcFreeControls(XkbcDescPtr xkb, unsigned which, Bool freeMap);
+
+extern int
+XkbcAllocIndicatorMaps(XkbcDescPtr xkb);
+
+extern void
+XkbcFreeIndicatorMaps(XkbcDescPtr xkb);
+
+extern XkbcDescRec *
+XkbcAllocKeyboard(void);
+
+extern void
+XkbcFreeKeyboard(XkbcDescPtr xkb, unsigned which, Bool freeAll);
+
+/***====================================================================***/
+
+extern int
+XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes);
+
+extern int
+XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions);
+
+extern int
+XkbcCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into);
+
+extern int
+XkbcCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types);
+
+extern int
+XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
+                  Bool want_preserve, int new_num_lvls);
+
+extern KeySym *
+XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed);
+
+extern int
+XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
+                       XkbChangesPtr changes);
+
+extern XkbcAction *
+XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed);
+
+extern void
+XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
+
+extern void
+XkbcFreeServerMap(XkbcDescPtr xkb, unsigned what, Bool freeMap);
+
+#endif /* _XKBALLOC_H_ */
index ca9c44e..6d55d68 100644 (file)
@@ -25,6 +25,7 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 
index 250b4b8..97b7b48 100644 (file)
@@ -25,6 +25,9 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbgeom.h"
+#include "xkbmisc.h"
 #include "misc.h"
 #include "alias.h"
 #include "keycodes.h"
index c3fdbde..1e518cf 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <X11/Xos.h>
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 #include "vmod.h"
index 7f9a90d..a6375e1 100644 (file)
@@ -25,6 +25,7 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 
index 92717d6..eb2c7f2 100644 (file)
@@ -25,6 +25,9 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbgeom.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 #include "vmod.h"
index ffdb250..69036c7 100644 (file)
@@ -25,6 +25,8 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbmisc.h"
 #include "misc.h"
 #include "tokens.h"
 #include "expr.h"
index 95437b0..7a77737 100644 (file)
@@ -25,6 +25,8 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 #include "keycodes.h"
index f8ed4a7..f850a83 100644 (file)
@@ -25,6 +25,7 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 #include "vmod.h"
index d82bf47..bb77811 100644 (file)
@@ -25,6 +25,8 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 #include "vmod.h"
index 4b00ebf..a847f6c 100644 (file)
@@ -25,6 +25,8 @@
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbmisc.h"
 #include "xkbpath.h"
 #include "tokens.h"
 #include "keycodes.h"
index cdf4b36..ed66263 100644 (file)
@@ -26,6 +26,7 @@
 
 #define        DEBUG_VAR parseDebug
 #include "parseutils.h"
+#include "xkbmisc.h"
 #include "xkbpath.h"
 #include <X11/keysym.h>
 #include <X11/extensions/XKBgeomcommon.h>
index 8ac5fb5..fedaf01 100644 (file)
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 
+#include <X11/extensions/XKBfilecommon.h>
 #include <X11/keysym.h>
 #include <stdlib.h>
 
index 3faa46a..3746560 100644 (file)
@@ -27,6 +27,8 @@
 #define        DEBUG_VAR debugFlags
 #include <stdio.h>
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 #include "misc.h"
index 2f3329a..05cb7ad 100644 (file)
@@ -25,9 +25,10 @@ authorization from the authors.
 */
 
 #include <limits.h>
-#include "X11/extensions/XKBcommon.h"
-#include <X11/extensions/XKM.h>
 #include "xkbcomp.h"
+#include "xkballoc.h"
+#include "xkbrules.h"
+#include <X11/extensions/XKM.h>
 #include "parseutils.h"
 #include "utils.h"
 
index 30bc6b2..43eeb1a 100644 (file)
@@ -37,6 +37,8 @@
 #include "utils.h"
 
 #include <X11/extensions/XKM.h>
+#include <X11/extensions/XKBstrcommon.h>
+#include <X11/extensions/XKBrulescommon.h>
 #include "X11/extensions/XKBcommon.h"
 #include "XKBcommonint.h"
 
index 1395b2c..f95dec9 100644 (file)
@@ -94,6 +94,7 @@
 #endif
 #define        DEBUG_VAR parseDebug
 #include "parseutils.h"
+#include "xkbmisc.h"
 #include <X11/keysym.h>
 #include <X11/extensions/XKBgeomcommon.h>
 #include <stdlib.h>
index 69d2393..3cf582e 100644 (file)
@@ -27,7 +27,9 @@
 #ifndef _XKBPATH_H_
 #define _XKBPATH_H_ 1
 
-#include "X11/extensions/XKBcommon.h"
+#include <stdio.h>
+#include <X11/X.h>
+#include <X11/Xdefs.h>
 
 extern Bool XkbInitIncludePath(void);
 
diff --git a/src/xkbgeom.h b/src/xkbgeom.h
new file mode 100644 (file)
index 0000000..5a80f32
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+Copyright 2009  Dan Nicholson
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+*/
+
+#ifndef _XKBGEOM_H_
+#define _XKBGEOM_H_
+
+#include <X11/X.h>
+#include <X11/Xdefs.h>
+#include <X11/extensions/XKBstrcommon.h>
+#include <X11/extensions/XKBgeomcommon.h>
+#include <X11/extensions/XKBrulescommon.h>
+#include "X11/extensions/XKBcommon.h"
+
+extern void
+XkbcFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count,
+                        Bool freeAll);
+
+extern void
+XkbcFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
+                        Bool freeAll);
+
+extern void
+XkbcFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll);
+
+extern void
+XkbcFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll);
+
+extern void
+XkbcFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap);
+
+extern int
+XkbcAllocGeomProps(XkbGeometryPtr geom, int nProps);
+
+extern int
+XkbcAllocGeomColors(XkbGeometryPtr geom, int nColors);
+
+extern int
+XkbcAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases);
+
+extern int
+XkbcAllocGeomShapes(XkbGeometryPtr geom, int nShapes);
+
+extern int
+XkbcAllocGeomSections(XkbGeometryPtr geom, int nSections);
+
+extern int
+XkbcAllocGeomOverlays(XkbSectionPtr section, int nOverlays);
+
+extern int
+XkbcAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows);
+
+extern int
+XkbcAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys);
+
+extern int
+XkbcAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads);
+
+extern int
+XkbcAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads);
+
+extern int
+XkbcAllocGeomOutlines(XkbShapePtr shape, int nOL);
+
+extern int
+XkbcAllocGeomRows(XkbSectionPtr section, int nRows);
+
+extern int
+XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts);
+
+extern int
+XkbcAllocGeomKeys(XkbRowPtr row, int nKeys);
+
+extern int
+XkbcAllocGeometry(XkbcDescPtr xkb, XkbGeometrySizesPtr sizes);
+
+extern XkbPropertyPtr
+XkbcAddGeomProperty(XkbGeometryPtr geom, char *name, char *value);
+
+extern XkbKeyAliasPtr
+XkbcAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr);
+
+extern XkbColorPtr
+XkbcAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel);
+
+extern XkbOutlinePtr
+XkbcAddGeomOutline(XkbShapePtr shape, int sz_points);
+
+extern XkbShapePtr
+XkbcAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines);
+
+extern XkbKeyPtr
+XkbcAddGeomKey(XkbRowPtr row);
+
+extern XkbRowPtr
+XkbcAddGeomRow(XkbSectionPtr section, int sz_keys);
+
+extern XkbSectionPtr
+XkbcAddGeomSection(XkbGeometryPtr geom, Atom name,
+                   int sz_rows, int sz_doodads, int sz_over);
+
+extern XkbDoodadPtr
+XkbcAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name);
+
+extern XkbOverlayKeyPtr
+XkbcAddGeomOverlayKey(XkbOverlayPtr overlay, XkbOverlayRowPtr row,
+                      char *over, char *under);
+
+extern XkbOverlayRowPtr
+XkbcAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys);
+
+extern XkbOverlayPtr
+XkbcAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows);
+
+/***====================================================================***/
+
+extern Bool
+XkbcComputeShapeBounds(XkbShapePtr shape);
+
+extern Bool
+XkbcComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds);
+
+extern Bool
+XkbcComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row);
+
+extern Bool
+XkbcComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section);
+
+#endif /* _XKBGEOM_H_ */
diff --git a/src/xkbmisc.h b/src/xkbmisc.h
new file mode 100644 (file)
index 0000000..17b33c8
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+Copyright 2009  Dan Nicholson
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+*/
+
+#ifndef _XKBMISC_H_
+#define _XKBMISC_H_
+
+#include <X11/X.h>
+#include <X11/Xdefs.h>
+#include <X11/extensions/XKBstrcommon.h>
+#include <X11/extensions/XKBrulescommon.h>
+#include "X11/extensions/XKBcommon.h"
+
+extern char *
+XkbcKeysymToString(KeySym ks);
+
+extern KeySym
+XkbcStringToKeysym(const char *s);
+
+/***====================================================================***/
+
+extern Bool
+XkbcComputeEffectiveMap(XkbcDescPtr xkb, XkbKeyTypePtr type,
+                        unsigned char *map_rtrn);
+
+/***====================================================================***/
+
+extern int
+XkbcInitCanonicalKeyTypes(XkbcDescPtr xkb, unsigned which, int keypadVMod);
+
+extern Bool
+XkbcVirtualModsToReal(XkbcDescPtr xkb, unsigned virtual_mask,
+                      unsigned *mask_rtrn);
+
+extern void
+XkbcEnsureSafeMapName(char *name);
+
+extern unsigned
+_XkbcKSCheckCase(KeySym sym);
+
+#define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbKSLower)
+#define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbKSUpper)
+
+/***====================================================================***/
+
+extern void
+XkbcInitAtoms(void);
+
+extern char *
+XkbcAtomGetString(Atom atom);
+
+extern Atom
+XkbcInternAtom(char *name, Bool onlyIfExists);
+
+/***====================================================================***/
+
+extern char *
+XkbcAtomText(Atom atm);
+
+extern char *
+XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx);
+
+extern char *
+XkbcVModMaskText(XkbcDescPtr xkb, unsigned modMask, unsigned mask);
+
+extern char *
+XkbcModIndexText(unsigned ndx);
+
+extern char *
+XkbcModMaskText(unsigned mask, Bool cFormat);
+
+extern char *
+XkbcConfigText(unsigned config);
+
+extern char *
+XkbcGeomFPText(int val);
+
+extern char *
+XkbcActionTypeText(unsigned type);
+
+extern char *
+XkbcKeysymText(KeySym sym);
+
+extern char *
+XkbcKeyNameText(char *name);
+
+extern char *
+XkbcSIMatchText(unsigned type);
+
+#endif /* _XKBMISC_H_ */
diff --git a/src/xkbrules.h b/src/xkbrules.h
new file mode 100644 (file)
index 0000000..87abf49
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+Copyright 2009  Dan Nicholson
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+*/
+
+#ifndef _XKBRULES_H_
+#define _XKBRULES_H_
+
+#include <stdio.h>
+#include <X11/X.h>
+#include <X11/Xdefs.h>
+#include <X11/extensions/XKBstrcommon.h>
+#include <X11/extensions/XKBrulescommon.h>
+#include "X11/extensions/XKBcommon.h"
+
+extern Bool
+XkbcRF_GetComponents(XkbRF_RulesPtr rules, XkbRF_VarDefsPtr defs,
+                     XkbComponentNamesPtr names);
+
+extern XkbRF_RulePtr
+XkbcRF_AddRule(XkbRF_RulesPtr rules);
+
+extern XkbRF_GroupPtr
+XkbcRF_AddGroup(XkbRF_RulesPtr rules);
+
+extern Bool
+XkbcRF_LoadRules(FILE *file, XkbRF_RulesPtr rules);
+
+extern Bool
+XkbcRF_LoadRulesByName(char *base, char *locale, XkbRF_RulesPtr rules);
+
+extern XkbRF_VarDescPtr
+XkbcRF_AddVarDesc(XkbRF_DescribeVarsPtr vars);
+
+extern XkbRF_VarDescPtr
+XkbcRF_AddVarDescCopy(XkbRF_DescribeVarsPtr vars, XkbRF_VarDescPtr from);
+
+extern XkbRF_DescribeVarsPtr
+XkbcRF_AddVarToDescribe(XkbRF_RulesPtr rules, char *name);
+
+extern Bool
+XkbcRF_LoadDescriptions(FILE *file, XkbRF_RulesPtr rules);
+
+extern Bool
+XkbcRF_LoadDescriptionsByName(char *base, char *locale, XkbRF_RulesPtr rules);
+
+extern XkbRF_RulesPtr
+XkbcRF_Load(char *base, char *locale, Bool wantDesc, Bool wantRules);
+
+extern XkbRF_RulesPtr
+XkbcRF_Create(int szRules, int szExtra);
+
+extern void
+XkbcRF_Free(XkbRF_RulesPtr rules, Bool freeRules);
+
+#endif /* _XKBRULES_H_ */
index 4f40b1f..864a22a 100644 (file)
@@ -26,9 +26,10 @@ authorization from the authors.
 
 #include <stdlib.h>
 #include <stdio.h>
+#include "xkbmisc.h"
 #include "X11/extensions/XKBcommon.h"
 #include <X11/extensions/XKBstrcommon.h>
-#include "../src/xkbcomp/utils.h"
+#include "xkbcomp/utils.h"
 
 int main(int argc, char *argv[])
 {
index cee1b9d..01aecc7 100644 (file)
@@ -26,9 +26,11 @@ authorization from the authors.
 
 #include <stdlib.h>
 #include <stdio.h>
+#include "xkbmisc.h"
+#include "xkbrules.h"
 #include "X11/extensions/XKBcommon.h"
 #include <X11/extensions/XKBstrcommon.h>
-#include "../src/xkbcomp/utils.h"
+#include "xkbcomp/utils.h"
 
 int main(int argc, char *argv[])
 {
index 015a432..834ebdb 100644 (file)
@@ -1,3 +1,4 @@
+#include "xkbmisc.h"
 #include "X11/extensions/XKBcommon.h"
 #include <stdlib.h>
 #include <stdio.h>