Move enum xkb_file_type to xkbcomp/ast.h This is a more suitable place for this enum, since it's internal to xkbcomp. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
diff --git a/src/text.c b/src/text.c
index ae71d3a..c98b915 100644
--- a/src/text.c
+++ b/src/text.c
@@ -226,23 +226,6 @@ ModMaskText(xkb_mod_mask_t mask)
return buf;
}
-static const char *xkb_file_type_strings[_FILE_TYPE_NUM_ENTRIES] = {
- [FILE_TYPE_KEYMAP] = "xkb_keymap",
- [FILE_TYPE_TYPES] = "xkb_types",
- [FILE_TYPE_COMPAT] = "xkb_compatibility",
- [FILE_TYPE_SYMBOLS] = "xkb_symbols",
- [FILE_TYPE_KEYCODES] = "xkb_keycodes",
- [FILE_TYPE_RULES] = "rules",
-};
-
-const char *
-FileTypeText(enum xkb_file_type type)
-{
- if (type > _FILE_TYPE_NUM_ENTRIES)
- return "unknown";
- return xkb_file_type_strings[type];
-}
-
static const char *actionTypeNames[XkbSA_NumActions] = {
[XkbSA_NoAction] = "NoAction",
[XkbSA_SetMods] = "SetMods",
diff --git a/src/text.h b/src/text.h
index 5ad5778..7991b88 100644
--- a/src/text.h
+++ b/src/text.h
@@ -45,9 +45,6 @@ const char *
ModMaskText(xkb_mod_mask_t mask);
const char *
-FileTypeText(enum xkb_file_type type);
-
-const char *
ActionTypeText(unsigned type);
const char *
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index dbdfe44..2a55baf 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -95,28 +95,6 @@ typedef uint32_t xkb_atom_t;
#define XKB_ATOM_NONE 0
#define XKB_LEVEL_INVALID 0xffffffff
-enum xkb_file_type {
- /* Component files, by order of compilation. */
- FILE_TYPE_KEYCODES = 0,
- FILE_TYPE_TYPES = 1,
- FILE_TYPE_COMPAT = 2,
- FILE_TYPE_SYMBOLS = 3,
- /* Geometry is not compiled any more. */
- FILE_TYPE_GEOMETRY = 4,
-
- /* A top level file which includes the above files. */
- FILE_TYPE_KEYMAP,
-
-/* File types which must be found in a keymap file. */
-#define FIRST_KEYMAP_FILE_TYPE FILE_TYPE_KEYCODES
-#define LAST_KEYMAP_FILE_TYPE FILE_TYPE_SYMBOLS
-
- /* This one doesn't mix with the others, but useful here as well. */
- FILE_TYPE_RULES,
-
- _FILE_TYPE_NUM_ENTRIES
-};
-
struct xkb_context {
int refcnt;
diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c
index bbafaf4..a16c771 100644
--- a/src/xkbcomp/ast-build.c
+++ b/src/xkbcomp/ast-build.c
@@ -651,6 +651,23 @@ FreeXkbFile(XkbFile *file)
}
}
+static const char *xkb_file_type_strings[_FILE_TYPE_NUM_ENTRIES] = {
+ [FILE_TYPE_KEYCODES] = "xkb_keycodes",
+ [FILE_TYPE_TYPES] = "xkb_types",
+ [FILE_TYPE_COMPAT] = "xkb_compatibility",
+ [FILE_TYPE_SYMBOLS] = "xkb_symbols",
+ [FILE_TYPE_KEYMAP] = "xkb_keymap",
+ [FILE_TYPE_RULES] = "rules",
+};
+
+const char *
+xkb_file_type_to_string(enum xkb_file_type type)
+{
+ if (type > _FILE_TYPE_NUM_ENTRIES)
+ return "unknown";
+ return xkb_file_type_strings[type];
+}
+
static const char *stmt_type_strings[_STMT_NUM_VALUES] = {
[STMT_UNKNOWN] = "unknown statement",
[STMT_INCLUDE] = "include statement",
diff --git a/src/xkbcomp/ast.h b/src/xkbcomp/ast.h
index 43f53d1..dbbe3c5 100644
--- a/src/xkbcomp/ast.h
+++ b/src/xkbcomp/ast.h
@@ -27,6 +27,28 @@
#ifndef XKBCOMP_AST_H
#define XKBCOMP_AST_H
+enum xkb_file_type {
+ /* Component files, by order of compilation. */
+ FILE_TYPE_KEYCODES = 0,
+ FILE_TYPE_TYPES = 1,
+ FILE_TYPE_COMPAT = 2,
+ FILE_TYPE_SYMBOLS = 3,
+ /* Geometry is not compiled any more. */
+ FILE_TYPE_GEOMETRY = 4,
+
+ /* A top level file which includes the above files. */
+ FILE_TYPE_KEYMAP,
+
+/* File types which must be found in a keymap file. */
+#define FIRST_KEYMAP_FILE_TYPE FILE_TYPE_KEYCODES
+#define LAST_KEYMAP_FILE_TYPE FILE_TYPE_SYMBOLS
+
+ /* This one doesn't mix with the others, but useful here as well. */
+ FILE_TYPE_RULES,
+
+ _FILE_TYPE_NUM_ENTRIES
+};
+
enum stmt_type {
STMT_UNKNOWN = 0,
STMT_INCLUDE,
@@ -87,6 +109,9 @@ enum merge_mode {
};
const char *
+xkb_file_type_to_string(enum xkb_file_type type);
+
+const char *
stmt_type_to_string(enum stmt_type type);
const char *
diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c
index 7d0004d..3599602 100644
--- a/src/xkbcomp/include.c
+++ b/src/xkbcomp/include.c
@@ -29,7 +29,6 @@
#include <stdio.h>
#include "xkbcomp-priv.h"
-#include "text.h"
#include "include.h"
/**
@@ -245,7 +244,8 @@ ProcessIncludeFile(struct xkb_context *ctx,
}
if (!mapToUse) {
log_err(ctx, "No %s named \"%s\" in the include file \"%s\"\n",
- FileTypeText(file_type), stmt->map, stmt->file);
+ xkb_file_type_to_string(file_type), stmt->map,
+ stmt->file);
return false;
}
}
@@ -259,8 +259,8 @@ ProcessIncludeFile(struct xkb_context *ctx,
log_err(ctx,
"Include file wrong type (expected %s, got %s); "
"Include file \"%s\" ignored\n",
- FileTypeText(file_type), FileTypeText(mapToUse->file_type),
- stmt->file);
+ xkb_file_type_to_string(file_type),
+ xkb_file_type_to_string(mapToUse->file_type), stmt->file);
return false;
}
/* FIXME: we have to check recursive includes here (or somewhere) */
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index e0a1cfe..9ceaa0c 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -25,7 +25,6 @@
*/
#include "xkbcomp-priv.h"
-#include "text.h"
#include "rules.h"
typedef bool (*compile_file_fn)(XkbFile *file,
@@ -56,7 +55,7 @@ compile_keymap_file(struct xkb_context *ctx, XkbFile *file)
if (file->file_type != FILE_TYPE_KEYMAP) {
log_err(ctx, "Cannot compile a %s file alone into a keymap\n",
- FileTypeText(file->file_type));
+ xkb_file_type_to_string(file->file_type));
goto err;
}
@@ -66,7 +65,7 @@ compile_keymap_file(struct xkb_context *ctx, XkbFile *file)
if (file->file_type < FIRST_KEYMAP_FILE_TYPE ||
file->file_type > LAST_KEYMAP_FILE_TYPE) {
log_err(ctx, "Cannot define %s in a keymap file\n",
- FileTypeText(file->file_type));
+ xkb_file_type_to_string(file->file_type));
continue;
}
@@ -74,7 +73,7 @@ compile_keymap_file(struct xkb_context *ctx, XkbFile *file)
log_err(ctx,
"More than one %s section in keymap file; "
"All sections after the first ignored\n",
- FileTypeText(file->file_type));
+ xkb_file_type_to_string(file->file_type));
continue;
}
@@ -96,7 +95,7 @@ compile_keymap_file(struct xkb_context *ctx, XkbFile *file)
type++) {
if (files[type] == NULL) {
log_err(ctx, "Required section %s missing from keymap\n",
- FileTypeText(type));
+ xkb_file_type_to_string(type));
ok = false;
}
}
@@ -108,10 +107,11 @@ compile_keymap_file(struct xkb_context *ctx, XkbFile *file)
type <= LAST_KEYMAP_FILE_TYPE;
type++) {
log_dbg(ctx, "Compiling %s \"%s\"\n",
- FileTypeText(type), files[type]->topName);
+ xkb_file_type_to_string(type), files[type]->topName);
ok = compile_file_fns[type](files[type], keymap, MERGE_OVERRIDE);
if (!ok) {
- log_err(ctx, "Failed to compile %s\n", FileTypeText(type));
+ log_err(ctx, "Failed to compile %s\n",
+ xkb_file_type_to_string(type));
goto err;
}
}