abda073a60c76536402cfc40c0e450453314d615
[platform/upstream/libxkbcommon.git] / tools / messages.c
1 /*
2  * NOTE: This file has been generated automatically by “update-message-registry.py”.
3  *       Do not edit manually!
4  *
5  */
6
7 /*
8  * Copyright © 2023 Pierre Le Marre <dev@wismill.eu>
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice (including the next
18  * paragraph) shall be included in all copies or substantial portions of the
19  * Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  */
29
30 #include "config.h"
31
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35
36 #include "messages-codes.h"
37 #include "messages.h"
38 #include "utils.h"
39
40 static const struct xkb_message_entry xkb_messages[] = {
41     {XKB_ERROR_MALFORMED_NUMBER_LITERAL, "Malformed number literal"},
42     {XKB_ERROR_UNSUPPORTED_MODIFIER_MASK, "Unsupported modifier mask"},
43     {XKB_WARNING_UNRECOGNIZED_KEYSYM, "Unrecognized keysym"},
44     {XKB_WARNING_CANNOT_INFER_KEY_TYPE, "Cannot infer key type"},
45     {XKB_ERROR_UNSUPPORTED_GROUP_INDEX, "Unsupported group index"},
46     {XKB_WARNING_UNDEFINED_KEY_TYPE, "Undefined key type"},
47     {XKB_WARNING_NON_BASE_GROUP_NAME, "Non base group name"},
48     {XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL, "Unsupported shift level"},
49     {XKB_WARNING_CONFLICTING_KEY_SYMBOL, "Conflicting key symbol"},
50     {XKB_WARNING_NUMERIC_KEYSYM, "Numeric keysym"},
51     {XKB_WARNING_EXTRA_SYMBOLS_IGNORED, "Extra symbols ignored"},
52     {XKB_ERROR_WRONG_FIELD_TYPE, "Wrong field type"},
53     {XKB_WARNING_UNKNOWN_CHAR_ESCAPE_SEQUENCE, "Unknown char escape sequence"},
54     {XKB_WARNING_MULTIPLE_GROUPS_AT_ONCE, "Multiple groups at once"},
55     {XKB_ERROR_INVALID_SYNTAX, "Invalid syntax"},
56     {XKB_WARNING_UNDEFINED_KEYCODE, "Undefined keycode"},
57     {XKB_WARNING_CONFLICTING_MODMAP, "Conflicting modmap"},
58     {XKB_WARNING_CONFLICTING_KEY_ACTION, "Conflicting key action"},
59     {XKB_WARNING_CONFLICTING_KEY_TYPE, "Conflicting key type"},
60     {XKB_WARNING_CONFLICTING_KEY_FIELDS, "Conflicting key fields"},
61     {XKB_WARNING_UNRESOLVED_KEYMAP_SYMBOL, "Unresolved keymap symbol"}
62 };
63
64 int
65 xkb_message_get_all(const struct xkb_message_entry **messages)
66 {
67     *messages = xkb_messages;
68     return ARRAY_SIZE(xkb_messages);
69 }
70
71 const struct xkb_message_entry*
72 xkb_message_get(xkb_message_code_t code)
73 {
74     if (code < _XKB_LOG_MESSAGE_MIN_CODE || code > _XKB_LOG_MESSAGE_MAX_CODE)
75         return NULL;
76
77     for (size_t idx = 0; idx < ARRAY_SIZE(xkb_messages); idx++) {
78         if (xkb_messages[idx].code == code)
79             return &xkb_messages[idx];
80     }
81
82     /* no matching message code found */
83     return NULL;
84 }