ok = map_file(file, &string, &size);
if (!ok) {
- log_err(table->ctx, "Couldn't read Compose file %s: %s\n",
+ log_err(table->ctx,
+ XKB_LOG_MESSAGE_NO_ID,
+ "Couldn't read Compose file %s: %s\n",
file_name, strerror(errno));
return false;
}
}
free(path);
- log_err(ctx, "couldn't find a Compose file for locale \"%s\" (mapped to \"%s\")\n",
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "couldn't find a Compose file for locale \"%s\" (mapped to \"%s\")\n",
locale, table->locale);
xkb_compose_table_unref(table);
return NULL;
return NULL;
}
- log_dbg(ctx, "created compose table from locale %s with path %s\n",
+ log_dbg(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "created compose table from locale %s with path %s\n",
table->locale, path);
free(path);
if (!isempty(rmlvo->variant)) {
const char *variant = xkb_context_get_default_variant(ctx);
log_warn(ctx,
+ XKB_LOG_MESSAGE_NO_ID,
"Layout not provided, but variant set to \"%s\": "
"ignoring variant and using defaults for both: "
"layout=\"%s\", variant=\"%s\".\n",
}
darray_append(ctx->includes, tmp);
- log_dbg(ctx, "Include path added: %s\n", tmp);
+ log_dbg(ctx, XKB_LOG_MESSAGE_NO_ID, "Include path added: %s\n", tmp);
return 1;
err:
darray_append(ctx->failed_includes, tmp);
- log_dbg(ctx, "Include path failed: %s (%s)\n", tmp, strerror(err));
+ log_dbg(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Include path failed: %s (%s)\n", tmp, strerror(err));
return 0;
}
if (!(flags & XKB_CONTEXT_NO_DEFAULT_INCLUDES) &&
!xkb_context_include_path_append_default(ctx)) {
- log_err(ctx, "failed to add default include path %s\n",
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "failed to add default include path %s\n",
DFLT_XKB_CONFIG_ROOT);
xkb_context_unref(ctx);
return NULL;
xkb_context_sanitize_rule_names(struct xkb_context *ctx,
struct xkb_rule_names *rmlvo);
+/*
+ * Macro sorcery: PREPEND_MESSAGE_ID enables the log functions to format messages
+ * with the message ID only if the ID is not 0 (XKB_LOG_MESSAGE_NO_ID).
+ * This avoid checking the ID value at run time.
+ *
+ * The trick resides in CHECK_ID:
+ * • CHECK_ID(0) expands to:
+ * ‣ SECOND(MATCH0, WITH_ID, unused)
+ * ‣ SECOND(unused,WITHOUT_ID, WITH_ID, unused)
+ * ‣ WITHOUT_ID
+ * • CHECK_ID(123) expands to:
+ * ‣ SECOND(MATCH123, WITH_ID, unused)
+ * ‣ WITH_ID
+*/
+#define EXPAND(...) __VA_ARGS__ /* needed for MSVC compatibility */
+
+#define JOIN_EXPAND(a, b) a##b
+#define JOIN(a, b) JOIN_EXPAND(a, b)
+
+#define SECOND_EXPAND(a, b, ...) b
+#define SECOND(...) EXPAND(SECOND_EXPAND(__VA_ARGS__))
+
+#define MATCH0 unused,WITHOUT_ID
+#define CHECK_ID(value) SECOND(JOIN(MATCH, value), WITH_ID, unused)
+
+#define FORMAT_MESSAGE_WITHOUT_ID(id, fmt) fmt
+#define FORMAT_MESSAGE_WITH_ID(id, fmt) "[XKB-%03d] " fmt, id
+#define PREPEND_MESSAGE_ID(id, fmt) JOIN(FORMAT_MESSAGE_, CHECK_ID(id))(id, fmt)
+
/*
* The format is not part of the argument list in order to avoid the
* "ISO C99 requires rest arguments to be used" warning when only the
* result in an error, though.
*/
#define xkb_log_with_code(ctx, level, verbosity, msg_id, fmt, ...) \
- xkb_log(ctx, level, verbosity, "[XKB-%03d] " fmt, \
- msg_id, ##__VA_ARGS__)
-#define log_dbg_with_code(ctx, id, ...) \
- xkb_log_with_code((ctx), XKB_LOG_LEVEL_DEBUG, 0, (id), __VA_ARGS__)
-#define log_dbg(ctx, ...) \
- xkb_log((ctx), XKB_LOG_LEVEL_DEBUG, 0, __VA_ARGS__)
-#define log_info_with_code(ctx, id, ...) \
- xkb_log_with_code((ctx), XKB_LOG_LEVEL_INFO, 0, (id), __VA_ARGS__)
-#define log_info(ctx, ...) \
- xkb_log((ctx), XKB_LOG_LEVEL_INFO, 0, __VA_ARGS__)
-#define log_warn_with_code(ctx, id, ...) \
- xkb_log_with_code((ctx), XKB_LOG_LEVEL_WARNING, 0, (id), __VA_ARGS__)
-#define log_warn(ctx, ...) \
- xkb_log((ctx), XKB_LOG_LEVEL_WARNING, 0, __VA_ARGS__)
-#define log_err_with_code(ctx, id, ...) \
- xkb_log_with_code((ctx), XKB_LOG_LEVEL_ERROR, 0, (id), __VA_ARGS__)
-#define log_err(ctx, ...) \
- xkb_log((ctx), XKB_LOG_LEVEL_ERROR, 0, __VA_ARGS__)
-#define log_wsgo_with_code(ctx, id, ...) \
- xkb_log_with_code((ctx), XKB_LOG_LEVEL_CRITICAL, 0, (id), __VA_ARGS__)
-#define log_wsgo(ctx, ...) \
- xkb_log((ctx), XKB_LOG_LEVEL_CRITICAL, 0, __VA_ARGS__)
+ xkb_log(ctx, level, verbosity, PREPEND_MESSAGE_ID(msg_id, fmt), ##__VA_ARGS__)
+#define log_dbg(ctx, id, ...) \
+ xkb_log_with_code((ctx), XKB_LOG_LEVEL_DEBUG, 0, id, __VA_ARGS__)
+#define log_info(ctx, id, ...) \
+ xkb_log_with_code((ctx), XKB_LOG_LEVEL_INFO, 0, id, __VA_ARGS__)
+#define log_warn(ctx, id, ...) \
+ xkb_log_with_code((ctx), XKB_LOG_LEVEL_WARNING, 0, id, __VA_ARGS__)
+#define log_err(ctx, id, ...) \
+ xkb_log_with_code((ctx), XKB_LOG_LEVEL_ERROR, 0, id, __VA_ARGS__)
+#define log_wsgo(ctx, id, ...) \
+ xkb_log_with_code((ctx), XKB_LOG_LEVEL_CRITICAL, 0, id, __VA_ARGS__)
#define log_vrb(ctx, vrb, id, ...) \
- xkb_log_with_code((ctx), XKB_LOG_LEVEL_WARNING, (vrb), (id), __VA_ARGS__)
+ xkb_log_with_code((ctx), XKB_LOG_LEVEL_WARNING, (vrb), id, __VA_ARGS__)
/*
* Variants which are prefixed by the name of the function they're
* Here we must have the silly 1 variant.
*/
#define log_err_func(ctx, fmt, ...) \
- log_err(ctx, "%s: " fmt, __func__, __VA_ARGS__)
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID, "%s: " fmt, __func__, __VA_ARGS__)
#define log_err_func1(ctx, fmt) \
- log_err(ctx, "%s: " fmt, __func__)
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID, "%s: " fmt, __func__)
#endif
/**
* Special case when no message identifier is defined.
- *
- * @added 1.6.0
- *
*/
#define XKB_LOG_MESSAGE_NO_ID 0
/**
* @name Codes of the log messages
- *
- * @added 1.6.0
- *
*/
enum xkb_message_code {
_XKB_LOG_MESSAGE_MIN_CODE = 34,
/**
* Special case when no message identifier is defined.
- *
- * @added 1.6.0
- *
*/
#define XKB_LOG_MESSAGE_NO_ID 0
/**
* @name Codes of the log messages
- *
- * @added 1.6.0
- *
*/
enum xkb_message_code {
_XKB_LOG_MESSAGE_MIN_CODE = {{ entries[0].code }},
*/
#define FAIL_UNLESS(expr) do { \
if (!(expr)) { \
- log_err(keymap->ctx, \
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID, \
"x11: failed to get keymap from X server: unmet condition in %s(): %s\n", \
__func__, STRINGIFY(expr)); \
goto fail; \
#define FAIL_IF_BAD_REPLY(reply, request_name) do { \
if (!reply) { \
- log_err(keymap->ctx, \
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID, \
"x11: failed to get keymap from X server: %s request failed\n", \
(request_name)); \
goto fail; \
enum xkb_action_type action, enum action_field field,
const char *type)
{
- log_err_with_code(ctx, code,
+ log_err(ctx, code,
"Value of %s field must be of type %s; "
"Action %s definition ignored\n",
fieldText(field), type, ActionTypeText(action));
ReportIllegal(struct xkb_context *ctx, enum xkb_action_type action,
enum action_field field)
{
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Field %s is not defined for an action of type %s; "
"Action definition ignored\n",
fieldText(field), ActionTypeText(action));
ReportActionNotArray(struct xkb_context *ctx, enum xkb_action_type action,
enum action_field field)
{
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"The %s field in the %s action is not an array; "
"Action definition ignored\n",
fieldText(field), ActionTypeText(action));
field, "integer");
if (val < INT16_MIN || val > INT16_MAX) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"The %s field in the %s action must be in range %d..%d; "
"Action definition ignored\n",
fieldText(field), ActionTypeText(action->type),
field, "integer (range 1..5)");
if (btn < 0 || btn > 5) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Button must specify default or be in the range 1..5; "
"Illegal button value %d ignored\n", btn);
return false;
field, "integer");
if (val < 0 || val > 255) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"The count field must have a value in the range 0..255; "
"Illegal count %d ignored\n", val);
return false;
field, "integer (range 1..5)");
if (btn < 0 || btn > 5) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"New default button value must be in the range 1..5; "
"Illegal default button value %d ignored\n", btn);
return false;
}
if (btn == 0) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Cannot set default pointer button to \"default\"; "
"Illegal default button setting ignored\n");
return false;
field, "integer (0..255)");
if (val < 0 || val > 255) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Screen index must be in the range 1..255; "
"Illegal screen value %d ignored\n", val);
return false;
ACTION_TYPE_PRIVATE, field, "integer");
if (type < 0 || type > 255) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Private action type must be in the range 0..255; "
"Illegal type %d ignored\n", type);
return false;
* make actions like these no-ops for now.
*/
if (type < ACTION_TYPE_PRIVATE) {
- log_info(ctx,
+ log_info(ctx, XKB_LOG_MESSAGE_NO_ID,
"Private actions of type %s are not supported; Ignored\n",
ActionTypeText(type));
act->type = ACTION_TYPE_NONE;
str = xkb_atom_text(ctx, val);
len = strlen(str);
if (len < 1 || len > sizeof(act->data)) {
- log_warn(ctx,
+ log_warn(ctx, XKB_LOG_MESSAGE_NO_ID,
"A private action has %ld data bytes; "
"Illegal data ignored\n", sizeof(act->data));
return false;
int ndx, datum;
if (!ExprResolveInteger(ctx, array_ndx, &ndx)) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Array subscript must be integer; "
"Illegal subscript ignored\n");
return false;
}
if (ndx < 0 || (size_t) ndx >= sizeof(act->data)) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"The data for a private action is %lu bytes long; "
"Attempt to use data[%d] ignored\n",
(unsigned long) sizeof(act->data), ndx);
field, "integer");
if (datum < 0 || datum > 255) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"All data for a private action must be 0..255; "
"Illegal datum %d ignored\n", datum);
return false;
enum xkb_action_type handler_type;
if (def->expr.op != EXPR_ACTION_DECL) {
- log_err(ctx, "Expected an action definition, found %s\n",
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Expected an action definition, found %s\n",
expr_op_type_to_string(def->expr.op));
return false;
}
str = xkb_atom_text(ctx, def->action.name);
if (!stringToAction(str, &handler_type)) {
- log_err(ctx, "Unknown action %s\n", str);
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID, "Unknown action %s\n", str);
return false;
}
return false;
if (elemRtrn) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Cannot change defaults in an action definition; "
"Ignoring attempt to change %s.%s\n",
elemRtrn, fieldRtrn);
}
if (!stringToField(fieldRtrn, &fieldNdx)) {
- log_err(ctx, "Unknown field name %s\n", fieldRtrn);
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Unknown field name %s\n", fieldRtrn);
return false;
}
return false;
if (!stringToField(field, &action_field)) {
- log_err(ctx, "\"%s\" is not a legal field name\n", field);
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "\"%s\" is not a legal field name\n", field);
return false;
}
return first;
err:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_INCLUDE_STATEMENT,
"Illegal include statement \"%s\"; Ignored\n", stmt);
FreeInclude(first);
if (new->merge == MERGE_REPLACE) {
if (report)
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Multiple definitions for \"%s\"; "
"Earlier interpretation ignored\n",
siText(new, info));
}
if (collide) {
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Multiple interpretations of \"%s\"; "
"Using %s definition for duplicate fields\n",
siText(new, info),
const char *pred_txt = xkb_atom_text(info->ctx, expr->action.name);
if (!LookupString(symInterpretMatchMaskNames, pred_txt, pred_rtrn) ||
!expr->action.args || expr->action.args->common.next) {
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Illegal modifier predicate \"%s\"; Ignored\n", pred_txt);
return false;
}
if (new->merge == MERGE_REPLACE) {
if (report)
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Map for indicator %s redefined; "
"Earlier definition ignored\n",
xkb_atom_text(info->ctx, old->led.name));
}
if (collide) {
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Map for indicator %s redefined; "
"Using %s definition for duplicate fields\n",
xkb_atom_text(info->ctx, old->led.name),
}
if (info->num_leds >= XKB_MAX_LEDS) {
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Too many LEDs defined (maximum %d)\n",
XKB_MAX_LEDS);
return false;
si->defined |= SI_FIELD_AUTO_REPEAT;
}
else if (istreq(field, "locking")) {
- log_dbg(info->ctx,
+ log_dbg(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"The \"locking\" field in symbol interpretation is unsupported; "
"Ignored\n");
}
ledi->defined |= LED_FIELD_CTRLS;
}
else if (istreq(field, "allowexplicit")) {
- log_dbg(info->ctx,
+ log_dbg(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"The \"allowExplicit\" field in indicator statements is unsupported; "
"Ignored\n");
}
istreq(field, "leddriveskeyboard") ||
istreq(field, "indicatordriveskbd") ||
istreq(field, "indicatordriveskeyboard")) {
- log_dbg(info->ctx,
+ log_dbg(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"The \"%s\" field in indicator statements is unsupported; "
"Ignored\n", field);
}
else if (istreq(field, "index")) {
/* Users should see this, it might cause unexpected behavior. */
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"The \"index\" field in indicator statements is unsupported; "
"Ignored\n");
}
else {
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Unknown field %s in map for %s indicator; "
"Definition ignored\n",
field, xkb_atom_text(info->ctx, ledi->led.name));
for (; def; def = (VarDef *) def->common.next) {
if (def->name && def->name->expr.op == EXPR_FIELD_REF) {
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Cannot set a global default value from within an interpret statement; "
"Move statements to the global file scope\n");
ok = false;
SymInterpInfo si;
if (!ResolveStateAndPredicate(def->match, &pred, &mods, info)) {
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Couldn't determine matching modifiers; "
"Symbol interpretation ignored\n");
return false;
}
if (elem) {
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Cannot set defaults for \"%s\" element in indicator map; "
"Assignment to %s.%s ignored\n", elem, elem, field);
ok = false;
ok = HandleInterpDef(info, (InterpDef *) stmt, merge);
break;
case STMT_GROUP_COMPAT:
- log_dbg(info->ctx,
+ log_dbg(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"The \"group\" statement in compat is unsupported; "
"Ignored\n");
ok = true;
ok = HandleVModDef(info->ctx, &info->mods, (VModDef *) stmt, merge);
break;
default:
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Compat files may not include other types; "
"Ignoring %s\n", stmt_type_to_string(stmt->type));
ok = false;
info->errorCount++;
if (info->errorCount > 10) {
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Abandoning compatibility map \"%s\"\n", file->name);
break;
}
/* Not previously declared; create it with next free index. */
if (i >= keymap->num_leds) {
- log_dbg(keymap->ctx,
+ log_dbg(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
"Indicator name \"%s\" was not declared in the keycodes section; "
"Adding new indicator\n",
xkb_atom_text(keymap->ctx, ledi->led.name));
if (i >= keymap->num_leds) {
/* Not place to put it; ignore. */
if (i >= XKB_MAX_LEDS) {
- log_err(keymap->ctx,
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
"Too many indicators (maximum is %d); "
"Indicator name \"%s\" ignored\n",
XKB_MAX_LEDS,
default:
break;
}
- log_wsgo_with_code(ctx,
+ log_wsgo(ctx,
XKB_ERROR_INVALID_SYNTAX,
"Unexpected operator %d in ResolveLhs\n", expr->expr.op);
return false;
switch (expr->expr.op) {
case EXPR_VALUE:
if (expr->expr.value_type != EXPR_TYPE_BOOLEAN) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Found constant of type %s where boolean was expected\n",
expr_value_type_to_string(expr->expr.value_type));
return true;
}
}
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_IDENTIFIER,
"Identifier \"%s\" of type boolean is unknown\n", ident);
return false;
case EXPR_FIELD_REF:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_EXPRESSION_TYPE,
"Default \"%s.%s\" of type boolean is unknown\n",
xkb_atom_text(ctx, expr->field_ref.element),
case EXPR_ACTION_DECL:
case EXPR_ACTION_LIST:
case EXPR_KEYSYM_LIST:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_OPERATION,
"%s of boolean values not permitted\n",
expr_op_type_to_string(expr->expr.op));
break;
default:
- log_wsgo_with_code(ctx,
+ log_wsgo(ctx,
XKB_ERROR_UNKNOWN_OPERATOR,
"Unknown operator %d in ResolveBoolean\n",
expr->expr.op);
switch (expr->expr.op) {
case EXPR_VALUE:
if (expr->expr.value_type != EXPR_TYPE_INT) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Found constant of type %s where an int was expected\n",
expr_value_type_to_string(expr->expr.value_type));
break;
case EXPR_DIVIDE:
if (rightRtrn == 0) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_OPERATION,
"Cannot divide by zero: %d / %d\n",
leftRtrn, rightRtrn);
return ExprResolveKeyCode(ctx, expr->unary.child, kc);
default:
- log_wsgo_with_code(ctx,
+ log_wsgo(ctx,
XKB_ERROR_INVALID_SYNTAX,
"Unknown operator %d in ResolveKeyCode\n", expr->expr.op);
break;
switch (expr->expr.op) {
case EXPR_VALUE:
if (expr->expr.value_type != EXPR_TYPE_INT) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Found constant of type %s where an int was expected\n",
expr_value_type_to_string(expr->expr.value_type));
ok = lookup(ctx, lookupPriv, expr->ident.ident, EXPR_TYPE_INT, &u);
if (!ok)
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_IDENTIFIER,
"Identifier \"%s\" of type int is unknown\n",
xkb_atom_text(ctx, expr->ident.ident));
return ok;
case EXPR_FIELD_REF:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_EXPRESSION_TYPE,
"Default \"%s.%s\" of type int is unknown\n",
xkb_atom_text(ctx, expr->field_ref.element),
break;
case EXPR_DIVIDE:
if (r == 0) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_OPERATION,
"Cannot divide by zero: %d / %d\n", l, r);
return false;
*val_rtrn = l / r;
break;
default:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_OPERATION,
"%s of integers not permitted\n",
expr_op_type_to_string(expr->expr.op));
return true;
case EXPR_ASSIGN:
- log_wsgo_with_code(ctx,
+ log_wsgo(ctx,
XKB_ERROR_INVALID_OPERATION,
"Assignment operator not implemented yet\n");
break;
case EXPR_NOT:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_OPERATION,
"The ! operator cannot be applied to an integer\n");
return false;
lookupPriv);
default:
- log_wsgo_with_code(ctx,
+ log_wsgo(ctx,
XKB_ERROR_UNKNOWN_OPERATOR,
"Unknown operator %d in ResolveInteger\n",
expr->expr.op);
return false;
if (result <= 0 || result > XKB_MAX_GROUPS) {
- log_err_with_code(ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Group index %u is out of range (1..%d)\n",
result, XKB_MAX_GROUPS);
return false;
return false;
if (result < 1) {
- log_err_with_code(ctx, XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL,
+ log_err(ctx, XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL,
"Shift level %d is out of range\n", result);
return false;
}
switch (expr->expr.op) {
case EXPR_VALUE:
if (expr->expr.value_type != EXPR_TYPE_STRING) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Found constant of type %s, expected a string\n",
expr_value_type_to_string(expr->expr.value_type));
return true;
case EXPR_IDENT:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_IDENTIFIER,
"Identifier \"%s\" of type string not found\n",
xkb_atom_text(ctx, expr->ident.ident));
return false;
case EXPR_FIELD_REF:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_EXPRESSION_TYPE,
"Default \"%s.%s\" of type string not found\n",
xkb_atom_text(ctx, expr->field_ref.element),
case EXPR_ACTION_DECL:
case EXPR_ACTION_LIST:
case EXPR_KEYSYM_LIST:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_SYNTAX,
"%s of strings not permitted\n",
expr_op_type_to_string(expr->expr.op));
return false;
default:
- log_wsgo_with_code(ctx,
+ log_wsgo(ctx,
XKB_ERROR_UNKNOWN_OPERATOR,
"Unknown operator %d in ResolveString\n",
expr->expr.op);
unsigned int *val_rtrn, const LookupEntry *values)
{
if (expr->expr.op != EXPR_IDENT) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Found a %s where an enumerated value was expected\n",
expr_op_type_to_string(expr->expr.op));
if (!SimpleLookup(ctx, values, expr->ident.ident, EXPR_TYPE_INT,
val_rtrn)) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_IDENTIFIER,
"Illegal identifier %s; expected one of:\n",
xkb_atom_text(ctx, expr->ident.ident));
while (values && values->name)
{
- log_err_with_code(ctx, XKB_ERROR_INVALID_IDENTIFIER, "\t%s\n", values->name);
+ log_err(ctx, XKB_ERROR_INVALID_IDENTIFIER, "\t%s\n", values->name);
values++;
}
return false;
switch (expr->expr.op) {
case EXPR_VALUE:
if (expr->expr.value_type != EXPR_TYPE_INT) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Found constant of type %s where a mask was expected\n",
expr_value_type_to_string(expr->expr.value_type));
ok = lookup(ctx, lookupPriv, expr->ident.ident, EXPR_TYPE_INT,
val_rtrn);
if (!ok)
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_IDENTIFIER,
"Identifier \"%s\" of type int is unknown\n",
xkb_atom_text(ctx, expr->ident.ident));
return ok;
case EXPR_FIELD_REF:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_EXPRESSION_TYPE,
"Default \"%s.%s\" of type int is unknown\n",
xkb_atom_text(ctx, expr->field_ref.element),
case EXPR_ACTION_DECL:
if (bogus == NULL)
bogus = "function use";
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Unexpected %s in mask expression; Expression Ignored\n",
bogus);
break;
case EXPR_MULTIPLY:
case EXPR_DIVIDE:
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_OPERATION,
"Cannot %s masks; Illegal operation ignored\n",
(expr->expr.op == EXPR_DIVIDE ? "divide" : "multiply"));
return true;
case EXPR_ASSIGN:
- log_wsgo_with_code(ctx,
+ log_wsgo(ctx,
XKB_ERROR_INVALID_OPERATION,
"Assignment operator not implemented yet\n");
break;
case EXPR_NOT:
left = expr->unary.child;
if (!ExprResolveIntegerLookup(ctx, left, &v, lookup, lookupPriv))
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_OPERATION,
"The %s operator cannot be used with a mask\n",
(expr->expr.op == EXPR_NEGATE ? "-" : "!"));
return false;
default:
- log_wsgo_with_code(ctx,
+ log_wsgo(ctx,
XKB_ERROR_UNKNOWN_OPERATOR,
"Unknown operator %d in ResolveMask\n",
expr->expr.op);
return false;
if (val < XKB_KEYSYM_MIN) {
- log_warn_with_code(ctx, XKB_WARNING_UNRECOGNIZED_KEYSYM,
+ log_warn(ctx, XKB_WARNING_UNRECOGNIZED_KEYSYM,
"unrecognized keysym \"-0x%x\" (%d)\n",
(unsigned int) -val, val);
return false;
}
if (val <= XKB_KEYSYM_MAX) {
- log_warn_with_code(ctx, XKB_WARNING_NUMERIC_KEYSYM,
+ log_warn(ctx, XKB_WARNING_NUMERIC_KEYSYM,
"numeric keysym \"0x%x\" (%d)",
(unsigned int) val, val);
*sym_rtrn = (xkb_keysym_t) val;
return true;
}
- log_warn_with_code(ctx, XKB_WARNING_UNRECOGNIZED_KEYSYM,
+ log_warn(ctx, XKB_WARNING_UNRECOGNIZED_KEYSYM,
"unrecognized keysym \"0x%x\" (%d)\n",
(unsigned int) val, val);
return false;
xkb_atom_t name;
if (def->expr.op != EXPR_IDENT) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Cannot resolve virtual modifier: "
"found %s where a virtual modifier name was expected\n",
name = def->ident.ident;
ndx = XkbModNameToIndex(mods, name, mod_type);
if (ndx == XKB_MOD_INVALID) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_UNDECLARED_VIRTUAL_MODIFIER,
"Cannot resolve virtual modifier: "
"\"%s\" was not previously declared\n",
unsigned int i;
if (xkb_context_num_include_paths(ctx) > 0) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INCLUDED_FILE_NOT_FOUND,
"%d include paths searched:\n",
xkb_context_num_include_paths(ctx));
for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INCLUDED_FILE_NOT_FOUND,
"\t%s\n",
xkb_context_include_path_get(ctx, i));
}
else {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INCLUDED_FILE_NOT_FOUND,
"There are no include paths to search\n");
}
if (xkb_context_num_failed_include_paths(ctx) > 0) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INCLUDED_FILE_NOT_FOUND,
"%d include paths could not be added:\n",
xkb_context_num_failed_include_paths(ctx));
for (i = 0; i < xkb_context_num_failed_include_paths(ctx); i++)
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INCLUDED_FILE_NOT_FOUND,
"\t%s\n",
xkb_context_failed_include_path_get(ctx, i));
buf = asprintf_safe("%s/%s/%s", xkb_context_include_path_get(ctx, i),
typeDir, name);
if (!buf) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_ALLOCATION_ERROR,
"Failed to alloc buffer for (%s/%s/%s)\n",
xkb_context_include_path_get(ctx, i), typeDir, name);
/* We only print warnings if we can't find the file on the first lookup */
if (*offset == 0) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INCLUDED_FILE_NOT_FOUND,
"Couldn't find file \"%s/%s\" in include paths\n",
typeDir, name);
if (xkb_file) {
if (xkb_file->file_type != file_type) {
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_INCLUDED_FILE,
"Include file of wrong type (expected %s, got %s); "
"Include file \"%s\" ignored\n",
if (!xkb_file) {
if (stmt->map)
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_INCLUDED_FILE,
"Couldn't process include statement for '%s(%s)'\n",
stmt->file, stmt->map);
else
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_INVALID_INCLUDED_FILE,
"Couldn't process include statement for '%s'\n",
stmt->file);
old = FindLedByName(info, new->name, &old_idx);
if (old) {
if (old_idx == new_idx) {
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Multiple indicators named \"%s\"; "
"Identical definitions ignored\n",
xkb_atom_text(info->ctx, new->name));
if (report) {
xkb_led_index_t use = (replace ? new_idx + 1 : old_idx + 1);
xkb_led_index_t ignore = (replace ? old_idx + 1 : new_idx + 1);
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Multiple indicators named %s; Using %d, ignoring %d\n",
xkb_atom_text(info->ctx, new->name), use, ignore);
}
if (report) {
const xkb_atom_t use = (replace ? new->name : old->name);
const xkb_atom_t ignore = (replace ? old->name : new->name);
- log_warn(info->ctx, "Multiple names for indicator %d; "
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Multiple names for indicator %d; "
"Using %s, ignoring %s\n", new_idx + 1,
xkb_atom_text(info->ctx, use),
xkb_atom_text(info->ctx, ignore));
if (old_name == name) {
if (report)
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Multiple identical key name definitions; "
"Later occurrences of \"%s = %d\" ignored\n",
lname, kc);
}
else if (merge == MERGE_AUGMENT) {
if (report)
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Multiple names for keycode %d; "
"Using %s, ignoring %s\n", kc, lname, kname);
return true;
}
else {
if (report)
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Multiple names for keycode %d; "
"Using %s, ignoring %s\n", kc, kname, lname);
darray_item(info->key_names, kc) = XKB_ATOM_NONE;
if (merge == MERGE_OVERRIDE) {
darray_item(info->key_names, old_kc) = XKB_ATOM_NONE;
if (report)
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_NAME,
"Key name %s assigned to multiple keys; "
"Using %d, ignoring %d\n", kname, kc, old_kc);
}
if (stmt->value < 0 || stmt->value > XKB_KEYCODE_MAX) {
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Illegal keycode %lld: must be between 0..%u; "
"Key ignored\n", (long long) stmt->value, XKB_KEYCODE_MAX);
return false;
use = (merge == MERGE_AUGMENT ? old->real : def->real);
ignore = (merge == MERGE_AUGMENT ? def->real : old->real);
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_NAME,
"Multiple definitions for alias %s; "
"Using %s, ignoring %s\n",
return false;
if (elem) {
- log_err(info->ctx, "Unknown element %s encountered; "
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID, "Unknown element %s encountered; "
"Default for field %s ignored\n", elem, field);
return false;
}
if (!istreq(field, "minimum") && !istreq(field, "maximum")) {
- log_err(info->ctx, "Unknown field encountered; "
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID, "Unknown field encountered; "
"Assignment to field %s ignored\n", field);
return false;
}
if (def->ndx < 1 || def->ndx > XKB_MAX_LEDS) {
info->errorCount++;
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Illegal indicator index (%d) specified; must be between 1 .. %d; "
"Ignored\n", def->ndx, XKB_MAX_LEDS);
return false;
ok = HandleLedNameDef(info, (LedNameDef *) stmt, merge);
break;
default:
- log_err(info->ctx,
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Keycode files may define key and indicator names only; "
"Ignoring %s\n", stmt_type_to_string(stmt->type));
ok = false;
info->errorCount++;
if (info->errorCount > 10) {
- log_err(info->ctx, "Abandoning keycodes file \"%s\"\n",
+ log_err(info->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Abandoning keycodes file \"%s\"\n",
file->name);
break;
}
XKB_WARNING_UNSUPPORTED_GEOMETRY_SECTION,
"Geometry sections are not supported; ignoring\n");
} else {
- log_err(ctx, "Cannot define %s in a keymap file\n",
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Cannot define %s in a keymap file\n",
xkb_file_type_to_string(file->file_type));
}
continue;
}
if (files[file->file_type]) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"More than one %s section in keymap file; "
"All sections after the first ignored\n",
xkb_file_type_to_string(file->file_type));
type <= LAST_KEYMAP_FILE_TYPE;
type++) {
if (files[type] == NULL) {
- log_err(ctx, "Required section %s missing from keymap\n",
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Required section %s missing from keymap\n",
xkb_file_type_to_string(type));
ok = false;
}
for (type = FIRST_KEYMAP_FILE_TYPE;
type <= LAST_KEYMAP_FILE_TYPE;
type++) {
- log_dbg(ctx, "Compiling %s \"%s\"\n",
+ log_dbg(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Compiling %s \"%s\"\n",
xkb_file_type_to_string(type), files[type]->name);
ok = compile_file_fns[type](files[type], keymap, merge);
if (!ok) {
- log_err(ctx, "Failed to compile %s\n",
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Failed to compile %s\n",
xkb_file_type_to_string(type));
return false;
}
if (file) {
bool ret = read_rules_file(m->ctx, m, include_depth + 1, file, s.buf);
if (!ret)
- log_err(m->ctx, "No components returned from included XKB rules \"%s\"\n", s.buf);
+ log_err(m->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "No components returned from included XKB rules \"%s\"\n",
+ s.buf);
fclose(file);
} else {
- log_err(m->ctx, "Failed to open included XKB rules \"%s\"\n", s.buf);
+ log_err(m->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Failed to open included XKB rules \"%s\"\n",
+ s.buf);
}
}
ret = map_file(file, &string, &size);
if (!ret) {
- log_err(ctx, "Couldn't read rules file \"%s\": %s\n",
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Couldn't read rules file \"%s\": %s\n",
path, strerror(errno));
goto out;
}
darray_empty(matcher->kccgst[KCCGST_COMPAT]) ||
/* darray_empty(matcher->kccgst[KCCGST_GEOMETRY]) || */
darray_empty(matcher->kccgst[KCCGST_SYMBOLS])) {
- log_err(ctx, "No components returned from XKB rules \"%s\"\n", path);
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "No components returned from XKB rules \"%s\"\n", path);
ret = false;
goto err_out;
}
mval = &matcher->rmlvo.model;
if (!mval->matched && mval->sval.len > 0)
- log_err(matcher->ctx, "Unrecognized RMLVO model \"%.*s\" was ignored\n",
+ log_err(matcher->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Unrecognized RMLVO model \"%.*s\" was ignored\n",
mval->sval.len, mval->sval.start);
darray_foreach(mval, matcher->rmlvo.layouts)
if (!mval->matched && mval->sval.len > 0)
- log_err(matcher->ctx, "Unrecognized RMLVO layout \"%.*s\" was ignored\n",
+ log_err(matcher->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Unrecognized RMLVO layout \"%.*s\" was ignored\n",
mval->sval.len, mval->sval.start);
darray_foreach(mval, matcher->rmlvo.variants)
if (!mval->matched && mval->sval.len > 0)
- log_err(matcher->ctx, "Unrecognized RMLVO variant \"%.*s\" was ignored\n",
+ log_err(matcher->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Unrecognized RMLVO variant \"%.*s\" was ignored\n",
mval->sval.len, mval->sval.start);
darray_foreach(mval, matcher->rmlvo.options)
if (!mval->matched && mval->sval.len > 0)
- log_err(matcher->ctx, "Unrecognized RMLVO option \"%.*s\" was ignored\n",
+ log_err(matcher->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Unrecognized RMLVO option \"%.*s\" was ignored\n",
mval->sval.len, mval->sval.start);
err_out:
ok = map_file(file, &string, &size);
if (!ok) {
- log_err(ctx, "Couldn't read XKB file %s: %s\n",
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Couldn't read XKB file %s: %s\n",
file_name, strerror(errno));
return NULL;
}
xkb_atom_t ignore = (clobber ? into->type : from->type);
if (report) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_TYPE_MERGING_GROUPS,
"Multiple definitions for group %d type of key %s; "
"Using %s, ignoring %s\n",
ignore = (clobber ? &intoLevel->action : &fromLevel->action);
if (report) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_ACTION,
"Multiple actions for level %d/group %u on key %s; "
"Using %s, ignoring %s\n",
}
else if (!XkbLevelsSameSyms(fromLevel, intoLevel)) {
if (report) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_SYMBOL,
"Multiple symbols for level %d/group %u on key %s; "
"Using %s, ignoring %s\n",
}
if (collide) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_FIELDS,
"Symbol map for key %s redefined; "
"Using %s definition for conflicting fields\n",
ignore = (clobber ? old->modifier : new->modifier);
if (new->haveSymbol) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_MODMAP,
"Symbol \"%s\" added to modifier map for multiple modifiers; "
"Using %s, ignoring %s\n",
ModIndexText(info->ctx, &info->mods, use),
ModIndexText(info->ctx, &info->mods, ignore));
} else {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_MODMAP,
"Key \"%s\" added to modifier map for multiple modifiers; "
"Using %s, ignoring %s\n",
if (stmt->modifier) {
next_incl.explicit_group = atoi(stmt->modifier) - 1;
if (next_incl.explicit_group >= XKB_MAX_GROUPS) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Cannot set explicit group to %d - must be between 1..%d; "
"Ignoring group number\n",
}
if (i >= XKB_MAX_GROUPS) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Too many groups of %s for key %s (max %u); "
"Ignoring %s defined for extra groups\n",
}
if (!ExprResolveGroup(info->ctx, arrayNdx, ndx_rtrn)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Illegal group index for %s of key %s\n"
"Definition with non-integer array index ignored\n",
name, KeyInfoText(info, keyi));
}
if (value->expr.op != EXPR_KEYSYM_LIST) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Expected a list of symbols, found %s; "
"Ignoring symbols for group %u of %s\n",
}
if (groupi->defined & GROUP_FIELD_SYMS) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_CONFLICTING_KEY_SYMBOLS_ENTRY,
"Symbols for key %s, group %u already defined; "
"Ignoring duplicate definition\n",
}
if (value->expr.op != EXPR_ACTION_LIST) {
- log_wsgo(info->ctx,
+ log_wsgo(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Bad expression type (%d) for action list value; "
"Ignoring actions for group %u of %s\n",
value->expr.op, ndx, KeyInfoText(info, keyi));
}
if (groupi->defined & GROUP_FIELD_ACTS) {
- log_wsgo(info->ctx,
+ log_wsgo(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Actions for key %s, group %u already defined\n",
KeyInfoText(info, keyi), ndx);
return false;
union xkb_action *toAct = &darray_item(groupi->levels, i).action;
if (!HandleActionDef(info->ctx, info->actions, &info->mods, act, toAct))
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_VALUE,
"Illegal action definition for %s; "
"Action for group %u/level %u ignored\n",
xkb_atom_t val;
if (!ExprResolveString(info->ctx, value, &val)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"The type field of a key symbol map must be a string; "
"Ignoring illegal type definition\n");
keyi->defined |= KEY_FIELD_DEFAULT_TYPE;
}
else if (!ExprResolveGroup(info->ctx, arrayNdx, &ndx)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Illegal group index for type of key %s; "
"Definition with non-integer array index ignored\n",
KeyInfoText(info, keyi));
if (!ExprResolveModMask(info->ctx, value, MOD_VIRT, &info->mods,
&mask)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNSUPPORTED_MODIFIER_MASK,
"Expected a virtual modifier mask, found %s; "
"Ignoring virtual modifiers definition for key %s\n",
unsigned int val;
if (!ExprResolveEnum(info->ctx, value, &val, repeatEntries)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_VALUE,
"Illegal repeat setting for %s; "
"Non-boolean repeat setting ignored\n",
bool set;
if (!ExprResolveBoolean(info->ctx, value, &set)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_VALUE,
"Illegal groupsWrap setting for %s; "
"Non-boolean value ignored\n",
bool set;
if (!ExprResolveBoolean(info->ctx, value, &set)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_VALUE,
"Illegal groupsClamp setting for %s; "
"Non-boolean value ignored\n",
xkb_layout_index_t grp;
if (!ExprResolveGroup(info->ctx, value, &grp)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Illegal group index for redirect of key %s; "
"Definition with non-integer group ignored\n",
KeyInfoText(info, keyi));
keyi->defined |= KEY_FIELD_GROUPINFO;
}
else {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNKNOWN_FIELD,
"Unknown field %s in a symbol interpretation; "
"Definition ignored\n",
}
if (!ExprResolveGroup(info->ctx, arrayNdx, &group)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Illegal index in group name definition; "
"Definition with non-integer array index ignored\n");
return false;
}
if (!ExprResolveString(info->ctx, value, &name)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Group name must be a string; "
"Illegal name for group %d ignored\n", group);
group_to_use = info->explicit_group;
}
else {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_NON_BASE_GROUP_NAME,
"An explicit group was specified for the '%s' map, "
"but it provides a name for a group other than Group1 (%d); "
}
else if (!elem && (istreq(field, "groupswrap") ||
istreq(field, "wrapgroups"))) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_WARNING_UNSUPPORTED_SYMBOLS_FIELD,
"Global \"groupswrap\" not supported; Ignored\n");
ret = true;
}
else if (!elem && (istreq(field, "groupsclamp") ||
istreq(field, "clampgroups"))) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_WARNING_UNSUPPORTED_SYMBOLS_FIELD,
"Global \"groupsclamp\" not supported; Ignored\n");
ret = true;
}
else if (!elem && (istreq(field, "groupsredirect") ||
istreq(field, "redirectgroups"))) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_WARNING_UNSUPPORTED_SYMBOLS_FIELD,
"Global \"groupsredirect\" not supported; Ignored\n");
ret = true;
}
else if (!elem && istreq(field, "allownone")) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_WARNING_UNSUPPORTED_SYMBOLS_FIELD,
"Radio groups not supported; "
"Ignoring \"allownone\" specification\n");
for (; def; def = (VarDef *) def->common.next) {
if (def->name && def->name->expr.op == EXPR_FIELD_REF) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_SCOPE,
"Cannot set a global default value from within a key statement; "
"Move statements to the global file scope\n");
}
if (warn) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_MULTIPLE_GROUPS_AT_ONCE,
"For the map %s an explicit group specified, "
"but key %s has more than one group defined; "
// Handle normal entry
ndx = XkbModNameToIndex(&info->mods, def->modifier, MOD_REAL);
if (ndx == XKB_MOD_INVALID) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_REAL_MODIFIER,
"Illegal modifier map definition; "
"Ignoring map for non-modifier \"%s\"\n",
tmp.u.keySym = sym;
}
else {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_MODMAP_ENTRY,
"Modmap entries may contain only key names or keysyms; "
"Illegal definition for %s modifier ignored\n",
ok = HandleModMapDef(info, (ModMapDef *) stmt);
break;
default:
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_STATEMENT_TYPE,
"Symbols files may not include other types; "
"Ignoring %s\n", stmt_type_to_string(stmt->type));
info->errorCount++;
if (info->errorCount > 10) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_SYNTAX,
"Abandoning symbols file \"%s\"\n",
file->name);
}
if (type_name == XKB_ATOM_NONE) {
- log_warn_with_code(keymap->ctx,
+ log_warn(keymap->ctx,
XKB_WARNING_CANNOT_INFER_KEY_TYPE,
"Couldn't find an automatic type for key '%s' group %d with %lu levels; "
"Using the default type\n",
break;
if (i >= keymap->num_types) {
- log_warn_with_code(keymap->ctx,
+ log_warn(keymap->ctx,
XKB_WARNING_UNDEFINED_KEY_TYPE,
"The type \"%s\" for key '%s' group %d was not previously defined; "
"Using the default type\n",
continue;
if (key->num_groups < 1)
- log_info(info->ctx,
+ log_info(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"No symbols defined for %s\n",
KeyNameText(info->ctx, key->name));
}
if (old) {
if (new->merge == MERGE_REPLACE || new->merge == MERGE_OVERRIDE) {
if ((same_file && verbosity > 0) || verbosity > 9) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_TYPE_DEFINITIONS,
"Multiple definitions of the %s key type; "
"Earlier definition ignored\n",
xkb_mod_mask_t mods;
if (arrayNdx)
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"The modifiers field of a key type is not an array; "
"Illegal array subscript ignored\n");
if (!ExprResolveModMask(info->ctx, value, MOD_BOTH, &info->mods, &mods)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNSUPPORTED_MODIFIER_MASK,
"Key type mask field must be a modifier mask; "
"Key type definition ignored\n");
}
if (type->defined & TYPE_FIELD_MASK) {
- log_warn(info->ctx,
+ log_warn(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Multiple modifier mask definitions for key type %s; "
"Using %s, ignoring %s\n",
xkb_atom_text(info->ctx, type->name),
old = FindMatchingMapEntry(type, new->mods.mods);
if (old) {
if (report && old->level != new->level) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_TYPE_MAP_ENTRY,
"Multiple map entries for %s in %s; "
"Using %d, ignoring %d\n",
}
if (!ExprResolveLevel(info->ctx, value, &entry.level)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL,
"Level specifications in a key type must be integer; "
"Ignoring malformed level specification\n");
return false;
if (!ExprResolveModMask(info->ctx, value, MOD_BOTH, &info->mods,
&preserve_mods)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNSUPPORTED_MODIFIER_MASK,
"Preserve value in a key type is not a modifier mask; "
"Ignoring preserve[%s] in type %s\n",
type, "level name", "integer");
if (!ExprResolveString(info->ctx, value, &level_name)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Non-string name for level %d in key type %s; "
"Ignoring illegal level name definition\n",
type_field = TYPE_FIELD_LEVEL_NAME;
ok = SetLevelName(info, type, arrayNdx, value);
} else {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNKNOWN_FIELD,
"Unknown field %s in key type %s; Definition ignored\n",
field, TypeTxt(info, type));
continue;
if (elem && istreq(elem, "type")) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_SET_DEFAULT_STATEMENT,
"Support for changing the default type has been removed; "
"Statement ignored\n");
ok = HandleKeyTypeDef(info, (KeyTypeDef *) stmt, merge);
break;
case STMT_VAR:
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_STATEMENT_TYPE,
"Support for changing the default type has been removed; "
"Statement ignored\n");
ok = HandleVModDef(info->ctx, &info->mods, (VModDef *) stmt, merge);
break;
default:
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_STATEMENT_TYPE,
"Key type files may not include other declarations; "
"Ignoring %s\n", stmt_type_to_string(stmt->type));
info->errorCount++;
if (info->errorCount > 10) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_SYNTAX,
"Abandoning keytypes file \"%s\"\n", file->name);
break;
* through modifier_map or some such.
*/
if (!ExprResolveModMask(ctx, stmt->value, MOD_REAL, mods, &mapping)) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Declaration of %s ignored\n",
xkb_atom_text(ctx, stmt->name));
return false;
xkb_mods_enumerate(i, mod, mods) {
if (mod->name == stmt->name) {
if (mod->type != MOD_VIRT) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Can't add a virtual modifier named \"%s\"; "
"there is already a non-virtual modifier with this name! Ignored\n",
xkb_atom_text(ctx, mod->name));
use = (merge == MERGE_OVERRIDE ? mapping : mod->mapping);
ignore = (merge == MERGE_OVERRIDE ? mod->mapping : mapping);
- log_warn(ctx,
+ log_warn(ctx, XKB_LOG_MESSAGE_NO_ID,
"Virtual modifier %s defined multiple times; "
"Using %s, ignoring %s\n",
xkb_atom_text(ctx, stmt->name),
}
if (mods->num_mods >= XKB_MAX_MODS) {
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Too many modifiers defined (maximum %d)\n",
XKB_MAX_MODS);
return false;
ReportNotArray(struct xkb_context *ctx, const char *type, const char *field,
const char *name)
{
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"The %s %s field is not an array; "
"Ignoring illegal assignment in %s\n",
ReportShouldBeArray(struct xkb_context *ctx, const char *type,
const char *field, const char *name)
{
- log_err_with_code(ctx,
+ log_err(ctx,
XKB_ERROR_EXPECTED_ARRAY_ENTRY,
"Missing subscript for %s %s; "
"Ignoring illegal assignment in %s\n",
ReportBadType(struct xkb_context *ctx, xkb_message_code_t code, const char *type,
const char *field, const char *name, const char *wanted)
{
- log_err_with_code(ctx, code, "The %s %s field must be a %s; "
+ log_err(ctx, code,
+ "The %s %s field must be a %s; "
"Ignoring illegal assignment in %s\n",
type, field, wanted, name);
return false;
ReportBadField(struct xkb_context *ctx, const char *type, const char *field,
const char *name)
{
- log_err(ctx,
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
"Unknown %s field %s in %s; "
"Ignoring assignment to unknown field in %s\n",
type, field, name, name);
compile_keymap_file(struct xkb_keymap *keymap, XkbFile *file)
{
if (file->file_type != FILE_TYPE_KEYMAP) {
- log_err(keymap->ctx,
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
"Cannot compile a %s file alone into a keymap\n",
xkb_file_type_to_string(file->file_type));
return false;
}
if (!CompileKeymap(file, keymap, MERGE_OVERRIDE)) {
- log_err(keymap->ctx,
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
"Failed to compile keymap\n");
return false;
}
struct xkb_component_names kccgst;
XkbFile *file;
- log_dbg(keymap->ctx,
+ log_dbg(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
"Compiling from RMLVO: rules '%s', model '%s', layout '%s', "
"variant '%s', options '%s'\n",
rmlvo->rules, rmlvo->model, rmlvo->layout, rmlvo->variant,
ok = xkb_components_from_rules(keymap->ctx, rmlvo, &kccgst);
if (!ok) {
- log_err(keymap->ctx,
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
"Couldn't look up rules '%s', model '%s', layout '%s', "
"variant '%s', options '%s'\n",
rmlvo->rules, rmlvo->model, rmlvo->layout, rmlvo->variant,
return false;
}
- log_dbg(keymap->ctx,
+ log_dbg(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
"Compiling from KcCGST: keycodes '%s', types '%s', "
"compat '%s', symbols '%s'\n",
kccgst.keycodes, kccgst.types, kccgst.compat, kccgst.symbols);
free(kccgst.symbols);
if (!file) {
- log_err(keymap->ctx,
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
"Failed to generate parsed XKB file from components\n");
return false;
}
xkb_file = XkbParseString(keymap->ctx, string, len, "(input string)", NULL);
if (!xkb_file) {
- log_err(keymap->ctx, "Failed to parse input xkb string\n");
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Failed to parse input xkb string\n");
return false;
}
xkb_file = XkbParseFile(keymap->ctx, file, "(unknown file)", NULL);
if (!xkb_file) {
- log_err(keymap->ctx, "Failed to parse input xkb file\n");
+ log_err(keymap->ctx, XKB_LOG_MESSAGE_NO_ID,
+ "Failed to parse input xkb file\n");
return false;
}
xkb_context_set_user_data(ctx, &log_string);
xkb_context_set_log_fn(ctx, log_fn);
- log_warn(ctx, "first warning: %d\n", 87);
- log_info(ctx, "first info\n");
- log_dbg(ctx, "first debug: %s\n", "hello");
- log_err(ctx, "first error: %lu\n", 115415UL);
+ log_warn(ctx, XKB_LOG_MESSAGE_NO_ID, "first warning: %d\n", 87);
+ log_info(ctx, XKB_LOG_MESSAGE_NO_ID, "first info\n");
+ log_dbg(ctx, XKB_LOG_MESSAGE_NO_ID, "first debug: %s\n", "hello");
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID, "first error: %lu\n", 115415UL);
log_vrb(ctx, 5, XKB_LOG_MESSAGE_NO_ID, "first verbose 5\n");
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_DEBUG);
- log_warn(ctx, "second warning: %d\n", 87);
- log_dbg(ctx, "second debug: %s %s\n", "hello", "world");
- log_info(ctx, "second info\n");
- log_err(ctx, "second error: %lu\n", 115415UL);
+ log_warn(ctx, XKB_LOG_MESSAGE_NO_ID, "second warning: %d\n", 87);
+ log_dbg(ctx, XKB_LOG_MESSAGE_NO_ID, "second debug: %s %s\n", "hello", "world");
+ log_info(ctx, XKB_LOG_MESSAGE_NO_ID, "second info\n");
+ log_err(ctx, XKB_ERROR_MALFORMED_NUMBER_LITERAL, "second error: %lu\n", 115415UL);
log_vrb(ctx, 6, XKB_LOG_MESSAGE_NO_ID, "second verbose 6\n");
xkb_context_set_log_verbosity(ctx, 0);
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
- log_warn(ctx, "third warning: %d\n", 87);
- log_dbg(ctx, "third debug: %s %s\n", "hello", "world");
- log_info(ctx, "third info\n");
- log_err(ctx, "third error: %lu\n", 115415UL);
+ log_warn(ctx, XKB_LOG_MESSAGE_NO_ID, "third warning: %d\n", 87);
+ log_dbg(ctx, XKB_LOG_MESSAGE_NO_ID, "third debug: %s %s\n", "hello", "world");
+ log_info(ctx, XKB_LOG_MESSAGE_NO_ID, "third info\n");
+ log_err(ctx, XKB_LOG_MESSAGE_NO_ID, "third error: %lu\n", 115415UL);
log_vrb(ctx, 0, XKB_LOG_MESSAGE_NO_ID, "third verbose 0\n");
printf("%s", log_string.item);
assert(streq(log_string.item,
"warning: first warning: 87\n"
"error: first error: 115415\n"
- "warning: [XKB-000] first verbose 5\n"
+ "warning: first verbose 5\n"
"warning: second warning: 87\n"
"debug: second debug: hello world\n"
"info: second info\n"
- "error: second error: 115415\n"));
+ "error: [XKB-034] second error: 115415\n"));
xkb_context_unref(ctx);
darray_free(log_string);