xkbcomp: use new log functions 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 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 3209871..597cba6 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -114,30 +114,32 @@ siText(SymInterpInfo * si, CompatInfo * info)
static inline bool
ReportSINotArray(CompatInfo *info, SymInterpInfo *si, const char *field)
{
- return ReportNotArray("symbol interpretation", field, siText(si, info));
+ return ReportNotArray(info->keymap, "symbol interpretation", field,
+ siText(si, info));
}
static inline bool
ReportSIBadType(CompatInfo *info, SymInterpInfo *si, const char *field,
const char *wanted)
{
- return ReportBadType("symbol interpretation", field, siText(si, info),
- wanted);
+ return ReportBadType(info->keymap, "symbol interpretation", field,
+ siText(si, info), wanted);
}
static inline bool
ReportIndicatorBadType(CompatInfo *info, LEDInfo *led,
const char *field, const char *wanted)
{
- return ReportBadType("indicator map", field,
- xkb_atom_text(info->keymap->ctx, led->name), wanted);
+ return ReportBadType(info->keymap, "indicator map", field,
+ xkb_atom_text(info->keymap->ctx, led->name),
+ wanted);
}
static inline bool
ReportIndicatorNotArray(CompatInfo *info, LEDInfo *led,
const char *field)
{
- return ReportNotArray("indicator map", field,
+ return ReportNotArray(info->keymap, "indicator map", field,
xkb_atom_text(info->keymap->ctx, led->name));
}
@@ -706,7 +708,8 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, char *field,
return ReportSIBadType(info, si, field, "level specification");
}
else {
- ok = ReportBadField("symbol interpretation", field, siText(si, info));
+ ok = ReportBadField(keymap, "symbol interpretation", field,
+ siText(si, info));
}
return ok;
}
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 8eaaafe..b1f8b20 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -717,7 +717,8 @@ HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def,
char buf[20];
snprintf(buf, sizeof(buf), "%d", def->ndx);
info->errorCount++;
- return ReportBadType("indicator", "name", buf, "string");
+ return ReportBadType(info->keymap, "indicator", "name", buf,
+ "string");
}
ii.name = xkb_atom_intern(info->keymap->ctx, tmp.str);
free(tmp.str);
diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c
index 371f06e..a3fa0e2 100644
--- a/src/xkbcomp/keytypes.c
+++ b/src/xkbcomp/keytypes.c
@@ -112,14 +112,16 @@ static inline bool
ReportTypeShouldBeArray(KeyTypesInfo *info, KeyTypeInfo *type,
const char *field)
{
- return ReportShouldBeArray("key type", field, TypeTxt(info, type));
+ return ReportShouldBeArray(info->keymap, "key type", field,
+ TypeTxt(info, type));
}
static inline bool
ReportTypeBadType(KeyTypesInfo *info, KeyTypeInfo *type,
const char *field, const char *wanted)
{
- return ReportBadType("key type", field, TypeTxt(info, type), wanted);
+ return ReportBadType(info->keymap, "key type", field, TypeTxt(info, type),
+ wanted);
}
static inline bool
diff --git a/src/xkbcomp/xkbcomp-priv.h b/src/xkbcomp/xkbcomp-priv.h
index 423c824..2d94419 100644
--- a/src/xkbcomp/xkbcomp-priv.h
+++ b/src/xkbcomp/xkbcomp-priv.h
@@ -71,35 +71,46 @@ LongToKeyName(unsigned long val, char *name)
}
static inline bool
-ReportNotArray(const char *type, const char *field, const char *name)
+ReportNotArray(struct xkb_keymap *keymap, const char *type, const char *field,
+ const char *name)
{
- ERROR("The %s %s field is not an array\n", type, field);
- ACTION("Ignoring illegal assignment in %s\n", name);
+ log_err(keymap->ctx,
+ "The %s %s field is not an array; "
+ "Ignoring illegal assignment in %s\n",
+ type, field, name);
return false;
}
static inline bool
-ReportShouldBeArray(const char *type, const char *field, const char *name)
+ReportShouldBeArray(struct xkb_keymap *keymap, const char *type,
+ const char *field, const char *name)
{
- ERROR("Missing subscript for %s %s\n", type, field);
- ACTION("Ignoring illegal assignment in %s\n", name);
+ log_err(keymap->ctx,
+ "Missing subscript for %s %s; "
+ "Ignoring illegal assignment in %s\n",
+ type, field, name);
return false;
}
static inline bool
-ReportBadType(const char *type, const char *field,
+ReportBadType(struct xkb_keymap *keymap, const char *type, const char *field,
const char *name, const char *wanted)
{
- ERROR("The %s %s field must be a %s\n", type, field, wanted);
- ACTION("Ignoring illegal assignment in %s\n", name);
+ log_err(keymap->ctx,
+ "The %s %s field must be a %s; "
+ "Ignoring illegal assignment in %s\n",
+ type, field, wanted, name);
return false;
}
static inline bool
-ReportBadField(const char *type, const char *field, const char *name)
+ReportBadField(struct xkb_keymap *keymap, const char *type, const char *field,
+ const char *name)
{
- ERROR("Unknown %s field %s in %s\n", type, field, name);
- ACTION("Ignoring assignment to unknown field in %s\n", name);
+ log_err(keymap->ctx,
+ "Unknown %s field %s in %s; "
+ "Ignoring assignment to unknown field in %s\n",
+ type, field, name, name);
return false;
}
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index 7adb35c..cb9eb20 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -91,8 +91,8 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
* in the parser.
*/
if (file->type != FILE_TYPE_KEYMAP) {
- ERROR("Cannot compile a %s file alone into a keymap\n",
- XkbcFileTypeText(file->type));
+ log_err(ctx, "Cannot compile a %s file alone into a keymap\n",
+ XkbcFileTypeText(file->type));
goto err;
}
@@ -100,9 +100,10 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
for (file = (XkbFile *) file->defs; file;
file = (XkbFile *) file->common.next) {
if (have & file->type) {
- ERROR("More than one %s section in a keymap file\n",
- XkbcFileTypeText(file->type));
- ACTION("All sections after the first ignored\n");
+ log_err(ctx,
+ "More than one %s section in a keymap file; "
+ "All sections after the first ignored\n",
+ XkbcFileTypeText(file->type));
continue;
}
@@ -124,8 +125,8 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
break;
default:
- ERROR("Cannot define %s in a keymap file\n",
- XkbcFileTypeText(file->type));
+ log_err(ctx, "Cannot define %s in a keymap file\n",
+ XkbcFileTypeText(file->type));
continue;
}
@@ -145,8 +146,8 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
for (bit = 1; missing != 0; bit <<= 1) {
if (missing & bit) {
- ERROR("Required section %s missing from keymap\n",
- XkbcFileTypeText(bit));
+ log_err(ctx, "Required section %s missing from keymap\n",
+ XkbcFileTypeText(bit));
missing &= ~bit;
}
}
@@ -156,22 +157,22 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
ok = CompileKeycodes(keycodes, keymap, MERGE_OVERRIDE);
if (!ok) {
- ERROR("Failed to compile keycodes\n");
+ log_err(ctx, "Failed to compile keycodes\n");
goto err;
}
ok = CompileKeyTypes(types, keymap, MERGE_OVERRIDE);
if (!ok) {
- ERROR("Failed to compile key types\n");
+ log_err(ctx, "Failed to compile key types\n");
goto err;
}
ok = CompileCompatMap(compat, keymap, MERGE_OVERRIDE);
if (!ok) {
- ERROR("Failed to compile compat map\n");
+ log_err(ctx, "Failed to compile compat map\n");
goto err;
}
ok = CompileSymbols(symbols, keymap, MERGE_OVERRIDE);
if (!ok) {
- ERROR("Failed to compile symbols\n");
+ log_err(ctx, "Failed to compile symbols\n");
goto err;
}
@@ -182,7 +183,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
return keymap;
err:
- ACTION("Failed to compile keymap\n");
+ log_err(ctx, "Failed to compile keymap\n");
xkb_map_unref(keymap);
return NULL;
}
@@ -196,33 +197,33 @@ xkb_map_new_from_kccgst(struct xkb_context *ctx,
struct xkb_keymap *keymap;
if (!kccgst) {
- ERROR("No components specified\n");
+ log_err(ctx, "No components specified\n");
return NULL;
}
if (ISEMPTY(kccgst->keycodes)) {
- ERROR("Keycodes required to generate XKB keymap\n");
+ log_err(ctx, "Keycodes required to generate XKB keymap\n");
return NULL;
}
if (ISEMPTY(kccgst->compat)) {
- ERROR("Compat map required to generate XKB keymap\n");
+ log_err(ctx, "Compat map required to generate XKB keymap\n");
return NULL;
}
if (ISEMPTY(kccgst->types)) {
- ERROR("Types required to generate XKB keymap\n");
+ log_err(ctx, "Types required to generate XKB keymap\n");
return NULL;
}
if (ISEMPTY(kccgst->symbols)) {
- ERROR("Symbols required to generate XKB keymap\n");
+ log_err(ctx, "Symbols required to generate XKB keymap\n");
return NULL;
}
file = keymap_file_from_components(ctx, kccgst);
if (!file) {
- ERROR("Failed to generate parsed XKB file from components\n");
+ log_err(ctx, "Failed to generate parsed XKB file from components\n");
return NULL;
}
@@ -240,14 +241,14 @@ xkb_map_new_from_names(struct xkb_context *ctx,
struct xkb_keymap *keymap;
if (!rmlvo || ISEMPTY(rmlvo->rules) || ISEMPTY(rmlvo->layout)) {
- ERROR("rules and layout required to generate XKB keymap\n");
+ log_err(ctx, "rules and layout required to generate XKB keymap\n");
return NULL;
}
kkctgs = xkb_components_from_rules(ctx, rmlvo);
if (!kkctgs) {
- ERROR("failed to generate XKB components from rules \"%s\"\n",
- rmlvo->rules);
+ log_err(ctx, "failed to generate XKB components from rules \"%s\"\n",
+ rmlvo->rules);
return NULL;
}
@@ -273,18 +274,18 @@ xkb_map_new_from_string(struct xkb_context *ctx,
struct xkb_keymap *keymap;
if (format != XKB_KEYMAP_FORMAT_TEXT_V1) {
- ERROR("unsupported keymap format %d\n", format);
+ log_err(ctx, "unsupported keymap format %d\n", format);
return NULL;
}
if (!string) {
- ERROR("No string specified to generate XKB keymap\n");
+ log_err(ctx, "No string specified to generate XKB keymap\n");
return NULL;
}
ok = XKBParseString(ctx, string, "input", &file);
if (!ok) {
- ERROR("Failed to parse input xkb file\n");
+ log_err(ctx, "Failed to parse input xkb file\n");
return NULL;
}
@@ -304,18 +305,18 @@ xkb_map_new_from_file(struct xkb_context *ctx,
struct xkb_keymap *keymap;
if (format != XKB_KEYMAP_FORMAT_TEXT_V1) {
- ERROR("Unsupported keymap format %d\n", format);
+ log_err(ctx, "Unsupported keymap format %d\n", format);
return NULL;
}
if (!file) {
- ERROR("No file specified to generate XKB keymap\n");
+ log_err(ctx, "No file specified to generate XKB keymap\n");
return NULL;
}
ok = XKBParseFile(ctx, file, "(unknown file)", &xkb_file);
if (!ok) {
- ERROR("Failed to parse input xkb file\n");
+ log_err(ctx, "Failed to parse input xkb file\n");
return NULL;
}