Rename xkbcomp/misc.h to xkbcomp-priv.h and use it
authorRan Benita <ran234@gmail.com>
Tue, 8 May 2012 10:57:07 +0000 (13:57 +0300)
committerDaniel Stone <daniel@fooishbar.org>
Tue, 8 May 2012 16:29:41 +0000 (17:29 +0100)
The include dependencies were quite convoluted, where you change the
order and get a ton of errors. Instead, change one file to act as the
internal interface for the xkbcomp files, and make every file use it.

Also drop the pointless "xkb" prefix to file names.

Signed-off-by: Ran Benita <ran234@gmail.com>
30 files changed:
Makefile.am
src/xkbcomp/.gitignore
src/xkbcomp/action.c
src/xkbcomp/action.h
src/xkbcomp/alias.c
src/xkbcomp/alias.h
src/xkbcomp/compat.c
src/xkbcomp/expr.c
src/xkbcomp/expr.h
src/xkbcomp/indicators.c
src/xkbcomp/indicators.h
src/xkbcomp/keycodes.c
src/xkbcomp/keycodes.h
src/xkbcomp/keymap.c
src/xkbcomp/keytypes.c
src/xkbcomp/misc.c
src/xkbcomp/parser.y [moved from src/xkbcomp/xkbparse.y with 99% similarity]
src/xkbcomp/parseutils.c
src/xkbcomp/parseutils.h
src/xkbcomp/path.c [moved from src/xkbcomp/xkbpath.c with 98% similarity]
src/xkbcomp/scanner.l [moved from src/xkbcomp/xkbscan.l with 99% similarity]
src/xkbcomp/symbols.c
src/xkbcomp/vmod.c
src/xkbcomp/vmod.h
src/xkbcomp/xkbcomp-priv.h [moved from src/xkbcomp/misc.h with 82% similarity]
src/xkbcomp/xkbcomp.c
src/xkbcomp/xkbcomp.h
src/xkbcomp/xkbpath.h [deleted file]
src/xkbmisc.h
src/xkbrules.h

index 6e4d41f..142796f 100644 (file)
@@ -49,18 +49,17 @@ libxkbcommon_la_SOURCES = \
        src/xkbcomp/keymap.c \
        src/xkbcomp/keytypes.c \
        src/xkbcomp/misc.c \
-       src/xkbcomp/misc.h \
+       src/xkbcomp/parser.y \
        src/xkbcomp/parseutils.c \
        src/xkbcomp/parseutils.h \
+       src/xkbcomp/path.c \
+       src/xkbcomp/scanner.l \
        src/xkbcomp/symbols.c \
        src/xkbcomp/vmod.c \
        src/xkbcomp/vmod.h \
        src/xkbcomp/xkbcomp.c \
        src/xkbcomp/xkbcomp.h \
-       src/xkbcomp/xkbparse.y \
-       src/xkbcomp/xkbpath.c \
-       src/xkbcomp/xkbpath.h \
-       src/xkbcomp/xkbscan.l \
+       src/xkbcomp/xkbcomp-priv.h \
        src/alloc.c \
        src/atom.c \
        src/context.c \
@@ -79,9 +78,9 @@ libxkbcommon_la_SOURCES = \
        src/XKBcommonint.h
 
 BUILT_SOURCES = \
-       src/xkbcomp/xkbparse.c \
-       src/xkbcomp/xkbparse.h \
-       src/xkbcomp/xkbscan.c \
+       src/xkbcomp/parser.c \
+       src/xkbcomp/parser.h \
+       src/xkbcomp/scanner.c \
        src/ks_tables.h
 CLEANFILES = $(BUILT_SOURCES)
 
index f2976af..2081535 100644 (file)
@@ -1,3 +1,3 @@
-xkbparse.c
-xkbparse.h
-xkbscan.c
+parser.c
+parser.h
+scanner.c
index ef7bb85..f42cf1d 100644 (file)
 
  ********************************************************/
 
-#include <X11/X.h>
-
-#include "xkbcomp.h"
-#include "xkbmisc.h"
-#include "expr.h"
-
-#include "keycodes.h"
-#include "vmod.h"
-#include "misc.h"
 #include "action.h"
-#include "misc.h"
+#include "keycodes.h"
 
 static bool actionsInitialized;
 static ExprDef constTrue;
index 0462d5e..bb0b44b 100644 (file)
@@ -27,6 +27,9 @@
 #ifndef ACTION_H
 #define ACTION_H 1
 
+#include "xkbcomp-priv.h"
+#include "expr.h"
+
 #define        F_ClearLocks    0
 #define        F_LatchToLock   1
 #define        F_GenKeyEvent   2
index 0d4abb5..412f643 100644 (file)
 
  ********************************************************/
 
-#include "xkbcomp.h"
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "misc.h"
 #include "alias.h"
 #include "keycodes.h"
 
index 3946551..b7bdf10 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef ALIAS_H
 #define ALIAS_H 1
 
+#include "xkbcomp-priv.h"
+
 typedef struct _AliasInfo
 {
     CommonInfo def;
index 0674ef0..84ca19f 100644 (file)
 
  ********************************************************/
 
-#include "xkbcomp.h"
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "expr.h"
-#include "vmod.h"
-#include "misc.h"
-#include "indicators.h"
-#include "action.h"
+#include "xkbcomp-priv.h"
 #include "parseutils.h"
+#include "action.h"
+#include "indicators.h"
+#include "vmod.h"
 
 typedef struct _SymInterpInfo
 {
index c33e78e..8e1e81f 100644 (file)
 
  ********************************************************/
 
-#include <X11/X.h>
-
-#include "xkbcomp.h"
-#include "xkbmisc.h"
 #include "expr.h"
-#include "vmod.h"
-
-#include <ctype.h>
 
 /***====================================================================***/
 
index 20b6801..89162d1 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef EXPR_H
 #define EXPR_H 1
 
-#include <stdbool.h>
+#include "xkbcomp-priv.h"
 
 typedef union _ExprResult
 {
index 8f614f9..c4f861e 100644 (file)
 
  ********************************************************/
 
-#include "xkbcomp.h"
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "misc.h"
-#include "expr.h"
-#include "vmod.h"
 #include "indicators.h"
+#include "expr.h"
 #include "action.h"
-#include "utils.h"
 
 /***====================================================================***/
 
index 3c6afed..c88ae4b 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef INDICATORS_H
 #define INDICATORS_H 1
 
+#include "xkbcomp-priv.h"
+
 #define        _LED_Index      (1<<0)
 #define        _LED_Mods       (1<<1)
 #define        _LED_Groups     (1<<2)
index e768d91..5790cda 100644 (file)
 
  ********************************************************/
 
-#include "xkbcomp.h"
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "expr.h"
 #include "keycodes.h"
-#include "misc.h"
-#include "alias.h"
+#include "expr.h"
 #include "parseutils.h"
+#include "alias.h"
 
 const char *
 longText(unsigned long val)
index 7f8b567..ba30be2 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef KEYCODES_H
 #define KEYCODES_H 1
 
+#include "xkbcomp-priv.h"
+
 #define KeyNameToLong(n) (              \
     (((unsigned long)n[0]) << 24) |     \
     (((unsigned long)n[1]) << 16) |     \
index 635167d..2d40bb4 100644 (file)
 
  ********************************************************/
 
-#include "xkbcomp.h"
-#include "xkbmisc.h"
-#include "expr.h"
-#include "vmod.h"
-#include "action.h"
-#include "misc.h"
+#include "xkbcomp-priv.h"
 #include "indicators.h"
-#include "xkballoc.h"
 
 /**
  * Compile the given file and store the output in xkb.
index 03c5b04..3344e22 100644 (file)
 
  ********************************************************/
 
-#include "xkbcomp.h"
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "expr.h"
-#include "vmod.h"
-#include "action.h"
-#include "misc.h"
+#include "xkbcomp-priv.h"
 #include "parseutils.h"
+#include "vmod.h"
 
 typedef struct _PreserveInfo
 {
index b2222a7..bdd7dc1 100644 (file)
 
  ********************************************************/
 
-#include "xkbcomp.h"
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "xkbpath.h"
-#include "keycodes.h"
-#include "misc.h"
+#include "xkbcomp-priv.h"
 #include "parseutils.h"
+#include "keycodes.h"
 
 /***====================================================================***/
 
similarity index 99%
rename from src/xkbcomp/xkbparse.y
rename to src/xkbcomp/parser.y
index ffccc75..5ed0608 100644 (file)
  ********************************************************/
 
 %{
-#ifdef DEBUG
-#define YYDEBUG 1
-#endif
-
+#include "xkbcomp-priv.h"
 #include "parseutils.h"
-#include "xkbmisc.h"
-#include <X11/keysym.h>
-#include <stdlib.h>
 
 extern int yylex(union YYSTYPE *val, struct YYLTYPE *loc, void *scanner);
 
index df76a85..f666462 100644 (file)
@@ -25,9 +25,6 @@
  ********************************************************/
 
 #include "parseutils.h"
-#include "xkbmisc.h"
-#include "xkbpath.h"
-#include "xkbparse.h"
 
 #include <X11/keysym.h>
 
index c2880a5..dc9d432 100644 (file)
 #ifndef XKBPARSE_H
 #define        XKBPARSE_H 1
 
-#include "xkbcomp.h"
-#include "xkbparse.h"
+#include <stdio.h>
+
+#include "xkbcomp-priv.h"
+#include "parser.h"
 
 struct parser_param {
     void *scanner;
similarity index 98%
rename from src/xkbcomp/xkbpath.c
rename to src/xkbcomp/path.c
index 884e08a..326e497 100644 (file)
 
 #include <errno.h>
 #include <limits.h>
-#include <stdlib.h>
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
-#include "utils.h"
-#include "xkbpath.h"
+
+#include "xkbcomp-priv.h"
 
 /**
  * Extract the first token from an include statement.
similarity index 99%
rename from src/xkbcomp/xkbscan.l
rename to src/xkbcomp/scanner.l
index 99a1da5..b8f9be2 100644 (file)
  ********************************************************/
 
 %{
-
 #include <stdio.h>
-#include <ctype.h>
 
-#include "utils.h"
+#include "xkbcomp-priv.h"
 #include "parseutils.h"
 
-
 extern int yyparse(struct parser_param *param);
 
 #define YY_USER_ACTION {                \
@@ -45,7 +42,6 @@ extern int yyparse(struct parser_param *param);
         return ERROR_TOK;                                               \
     *yyextra->s++ = ch;                                                 \
 } while (0)
-
 %}
 
 %option reentrant
index f380edf..86a2cb0 100644 (file)
 
  ********************************************************/
 
-#include "xkbcomp.h"
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "expr.h"
-#include "parseutils.h"
-
 #include <X11/keysym.h>
-#include <stdlib.h>
 
-#include "expr.h"
-#include "vmod.h"
+#include "xkbcomp-priv.h"
+#include "parseutils.h"
 #include "action.h"
-#include "keycodes.h"
-#include "misc.h"
 #include "alias.h"
+#include "keycodes.h"
+#include "vmod.h"
 
 /***====================================================================***/
 
index dfb6443..ec72f2b 100644 (file)
 
  ********************************************************/
 
-#include <stdio.h>
-#include "xkbcomp.h"
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "expr.h"
-#include "misc.h"
-
-#include <X11/extensions/XKB.h>
-
 #include "vmod.h"
 
 void
index 3e75033..159a9fe 100644 (file)
@@ -27,6 +27,9 @@
 #ifndef VMOD_H
 #define VMOD_H 1
 
+#include "xkbcomp-priv.h"
+#include "expr.h"
+
 typedef struct _VModInfo
 {
     struct xkb_keymap *xkb;
similarity index 82%
rename from src/xkbcomp/misc.h
rename to src/xkbcomp/xkbcomp-priv.h
index d4aa4ee..9baaaad 100644 (file)
 
  ********************************************************/
 
-#ifndef MISC_H
-#define MISC_H 1
+#ifndef XKBCOMP_PRIV_H
+#define XKBCOMP_PRIV_H
+
+#include "xkbcomp.h"
+#include "xkballoc.h"
+#include "utils.h"
 
 typedef struct _CommonInfo
 {
@@ -71,4 +75,18 @@ extern bool
 FindKeyNameForAlias(struct xkb_keymap *xkb, unsigned long lname,
                     unsigned long *real_name);
 
-#endif /* MISC_H */
+extern bool
+UpdateModifiersFromCompat(struct xkb_keymap *xkb);
+
+extern const char *
+XkbDirectoryForInclude(unsigned type);
+
+extern FILE *
+XkbFindFileInPath(struct xkb_context *context, const char *name,
+                  unsigned type, char **pathRtrn);
+
+extern bool
+XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
+                   char *nextop_rtrn, char **extra_data);
+
+#endif /* XKBCOMP_PRIV_H */
index b3e18a5..1a930ca 100644 (file)
@@ -24,14 +24,9 @@ sale, use or other dealings in this Software without prior written
 authorization from the authors.
 */
 
-#include <limits.h>
-#include "xkbcomp.h"
-#include "xkballoc.h"
+#include "xkbcomp-priv.h"
 #include "xkbrules.h"
-#include "xkbpath.h"
-#include "xkbmisc.h"
 #include "parseutils.h"
-#include "utils.h"
 
 /* Global warning level */
 unsigned int warningLevel = 0;
index 55487ee..1883b9d 100644 (file)
@@ -27,9 +27,6 @@
 #ifndef XKBCOMP_H
 #define        XKBCOMP_H 1
 
-#include "utils.h"
-
-#include "xkbcommon/xkbcommon.h"
 #include "XKBcommonint.h"
 #include "xkbmisc.h"
 
@@ -271,7 +268,4 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap * xkb, unsigned merge,
 extern bool
 CompileSymbols(XkbFile *file, struct xkb_keymap * xkb, unsigned merge);
 
-extern bool
-UpdateModifiersFromCompat(struct xkb_keymap *xkb);
-
 #endif /* XKBCOMP_H */
diff --git a/src/xkbcomp/xkbpath.h b/src/xkbcomp/xkbpath.h
deleted file mode 100644 (file)
index f912fab..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/************************************************************
- Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
-
- Permission to use, copy, modify, and distribute this
- software and its documentation for any purpose and without
- 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
- of the software without specific prior written permission.
- 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
- 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
- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
- THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ********************************************************/
-
-#ifndef _XKBPATH_H_
-#define _XKBPATH_H_ 1
-
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "XKBcommonint.h"
-
-extern const char *
-XkbDirectoryForInclude(unsigned type);
-
-extern FILE *
-XkbFindFileInPath(struct xkb_context *context, const char *name,
-                  unsigned type, char **pathRtrn);
-
-extern bool
-XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
-                   char *nextop_rtrn, char **extra_data);
-
-#endif /* _XKBPATH_H_ */
index b9b9a39..5f2b7fb 100644 (file)
@@ -30,7 +30,6 @@ authorization from the authors.
 #include <stdbool.h>
 #include <X11/Xfuncproto.h>
 
-#include "xkbcommon/xkbcommon.h"
 #include "XKBcommonint.h"
 
 typedef uint32_t xkb_atom_t;
index 843c6ae..70e3711 100644 (file)
@@ -28,6 +28,7 @@ authorization from the authors.
 #define _XKBRULES_H_
 
 #include <stdbool.h>
+#include <stdio.h>
 
 #include "xkbcommon/xkbcommon.h"