Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages (part 2) #379

Merged
merged 2 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
336 changes: 331 additions & 5 deletions doc/message-registry.md

Large diffs are not rendered by default.

172 changes: 170 additions & 2 deletions doc/message-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,26 @@
- *decimal integer:* 1, 123, etc.
- *decimal floating-point number:* 1.23, etc.
- *hexadecimal integer:* prefixed with “0x”: 0x123, 0xff, 0xAB, etc.
- id: "conflicting-key-type-preserve-entries"
code: 43
added: ALWAYS
type: warning
description: "Conflicting “preserve” entries in a key type"
- id: "unsupported-modifier-mask"
code: 60
added: ALWAYS
type: error
description: "Warn on unsupported modifier mask"
- id: "expected-array-entry"
code: 77
added: ALWAYS
type: error
description: "Expected an array entry, but the index is missing"
- id: "illegal-keycode-alias"
code: 101
added: ALWAYS
type: warning
description: "Illegal keycode alias with the name of a real key"
- id: "unrecognized-keysym"
code: 107
added: ALWAYS
Expand Down Expand Up @@ -65,18 +80,63 @@
```c
key <AB08> {[ comma, semicolon, periodcentered, multiply ]};
```
- id: "undeclared-virtual-modifier"
code: 123
added: ALWAYS
type: error
description: "A virtual modifier is used before being declared"
- id: "wrong-statement-type"
code: 150
added: ALWAYS
type: error
description: "The type of the statement is not allowed in the context"
- id: "unsupported-geometry-section"
code: 172
added: ALWAYS
type: warning
description: "Geometry sections are not supported"
- id: "cannot-infer-key-type"
code: 183
added: ALWAYS
type: warning
description: "Warn if no key type can be inferred"
- id: "illegal-key-type-preserve-result"
code: 195
added: ALWAYS
type: warning
description: "The result of a key type “preserve” entry must be a subset of its input modifiers."
- id: "invalid-include-statement"
code: 203
added: ALWAYS
type: error
description: "Syntax error in the include statement"
- id: "invalid-modmap-entry"
code: 206
added: ALWAYS
type: error
description: "A modmap entry is invalid"
- id: "unsupported-group-index"
code: 237
added: ALWAYS
type: error
description: "Warn when a group index is not supported"
details: |
xkbcommon supports group index in the range (1..{{XKB_MAX_GROUPS}}).
- id: "conflicting-key-type-level-names"
code: 239
added: ALWAYS
type: warning
description: "The name of a key type level is defined multiple times."
- id: "invalid-set-default-statement"
code: 254
added: ALWAYS
type: error
description: "Invalid statement setting default values"
- id: "conflicting-key-type-map-entry"
code: 266
added: ALWAYS
type: warning
description: "Conflicting “map” entries in type definition"
- id: "undefined-key-type"
code: 286
added: ALWAYS
Expand All @@ -95,11 +155,56 @@
details: |
Shift levels are _one_-indexed. xkbcommon supports two formats of shift levels:
as numbers and as identifiers `LevelN`, where `N` is in the range (1..8).
- id: "included-file-not-found"
code: 338
added: ALWAYS
type: error
description: "Could not find a file used in an include statement"
- id: "unknown-operator"
code: 345
added: ALWAYS
type: error
description: "Use of an operator that is unknown and thus unsupported"
- id: "duplicate-entry"
code: 378
added: ALWAYS
type: warning
description: "An entry is duplicated and will be ignored"
- id: "conflicting-key-type-definitions"
code: 407
added: ALWAYS
type: warning
description: "Conflicting definitions of a key type"
details: |
The given key type is defined multiple times, but only one definition is kept.
- id: "wrong-scope"
code: 428
added: ALWAYS
type: error
description: "A statement is in a wrong scope and should be moved"
- id: "missing-default-section"
code: 433
added: ALWAYS
type: warning
description: "Missing default section in included file"
details: |
When using an include statement, the included file may contains multiple sections.
The include statement may specify the name of the section to include, or leave it
unspecified. In the latter case, the included file must then define a *default* section.
The present warning is shown when no default section is defined.

To solve this, either fix the include statement by specifying the exact section to
include, or declare a default section in the included file.
- id: "conflicting-key-symbol"
code: 461
added: ALWAYS
type: warning
description: "Warn if there are conflicting keysyms while merging keys"
- id: "invalid-operation"
code: 478
added: ALWAYS
type: error
description: "The operation is invalid in the context"
- id: "numeric-keysym"
code: 489
added: 1.6.0
Expand Down Expand Up @@ -132,11 +237,26 @@
added: ALWAYS
type: warning
description: "TODO: add description"
- id: "conflicting-key-name"
code: 523
added: ALWAYS
type: warning
description: "Conflicting definitions of a key name or alias"
- id: "allocation-error"
code: 550
added: ALWAYS
type: error
description: "Cannot allocate memory"
- id: "wrong-field-type"
code: 578
added: ALWAYS
type: error
description: "Warn when a field has not the expected type"
- id: "invalid-real-modifier"
code: 623
added: ALWAYS
type: error
description: "Invalid _real_ modifier"
- id: "unknown-char-escape-sequence"
code: 645
added: ALWAYS
Expand All @@ -156,11 +276,21 @@
| `\e` | `U+001B` Escape |
| `\\` | `U+005C` Backslash |
| `\NNN` | _Octal_ escape, from `\0` to `\777` |
- id: "invalid-included-file"
code: 661
added: ALWAYS
type: error
description: "The target file of an include statement could not be processed"
- id: "multiple-groups-at-once"
code: 700
added: ALWAYS
type: warning
description: "Warn if a key defines multiple groups at once"
- id: "unsupported-symbols-field"
code: 711
added: ALWAYS
type: warning
description: "A legacy X11 symbol field is not supported"
- id: "invalid-syntax"
code: 769
added: ALWAYS
Expand All @@ -170,34 +300,72 @@
code: 770
added: ALWAYS
type: warning
description: "TODO: add description"
description: "Reference to an undefined keycode"
- id: "invalid-expression-type"
code: 784
added: ALWAYS
type: error
description: "An expression has not the expected type"
- id: "invalid-value"
code: 796
added: ALWAYS
type: error
description: "A value is invalid and will be ignored"
- id: "conflicting-modmap"
code: 800
added: ALWAYS
type: warning
description: "Warn if there are conflicting modmap definitions"
details: |
@todo detailed explanation and examples
- id: "unknown-field"
code: 812
added: ALWAYS
type: error
description: "A field is unknown and will be ignored"
- id: "conflicting-key-action"
code: 883
added: ALWAYS
type: warning
description: "Warn if there are conflicting actions while merging keys"
- id: "conflicting-key-type"
- id: "conflicting-key-type-merging-groups"
code: 893
added: ALWAYS
type: warning
description: "Warn if there are conflicting key types while merging groups"
- id: "conflicting-key-symbols-entry"
code: 901
added: ALWAYS
type: error
description: "Conflicting symbols entry for a key"
- id: "missing-symbols-group-name-index"
code: 903
added: ALWAYS
type: warning
description: "Missing group index in a group name entry"
- id: "conflicting-key-fields"
code: 935
added: ALWAYS
type: warning
description: "Warn if there are conflicting fields while merging keys"
- id: "invalid-identifier"
code: 949
added: ALWAYS
type: error
description: "An identifier is used but is not built-in"
- id: "unresolved-keymap-symbol"
code: 965
added: ALWAYS
type: warning
description: "Warn if using a symbol not defined in the keymap"
- id: "undeclared-modifiers-in-key-type"
code: 971
added: ALWAYS
type: warning
description: "Some modifiers used in a key type “map” or “preserve” entry are not declared"
details: |
The modifiers used in `map` or `preserve` entries should be declared using the entry
`modifiers` in the key type.

# TODO: deprecated keysym
# TODO: unicode keysym when named and recommended keysym exists
4 changes: 3 additions & 1 deletion src/compose/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,9 @@ parse_file(struct xkb_compose_table *table, FILE *file, const char *file_name)

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;
}
Expand Down
6 changes: 4 additions & 2 deletions src/compose/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ xkb_compose_table_new_from_locale(struct xkb_context *ctx,
}
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;
Expand All @@ -220,7 +221,8 @@ xkb_compose_table_new_from_locale(struct xkb_context *ctx,
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);
Expand Down
1 change: 1 addition & 0 deletions src/context-priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ xkb_context_sanitize_rule_names(struct xkb_context *ctx,
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",
Expand Down
8 changes: 5 additions & 3 deletions src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ xkb_context_include_path_append(struct xkb_context *ctx, const char *path)
}

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;
}

Expand Down Expand Up @@ -304,7 +305,8 @@ xkb_context_new(enum xkb_context_flags flags)

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;
Expand Down
Loading