2 * NOTE: This file has been generated automatically by “{{script}}”.
3 * Do not edit manually!
8 * Copyright © 2023 Pierre Le Marre <dev@wismill.eu>
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:
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
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.
36 #include "messages-codes.h"
40 static const struct xkb_message_entry xkb_messages[] = {
41 {% for entry in entries %}
42 { {#--#}{{ entry.message_code_constant}}, "{{entry.message_name}}"}{{ "" if loop.last else "," }}
47 xkb_message_get_all(const struct xkb_message_entry **messages)
49 *messages = xkb_messages;
50 return ARRAY_SIZE(xkb_messages);
53 const struct xkb_message_entry*
54 xkb_message_get(xkb_message_code_t code)
56 {# Binary search seems overkill for now #}
57 if (code < _XKB_LOG_MESSAGE_MIN_CODE || code > _XKB_LOG_MESSAGE_MAX_CODE)
60 for (size_t idx = 0; idx < ARRAY_SIZE(xkb_messages); idx++) {
61 if (xkb_messages[idx].code == code)
62 return &xkb_messages[idx];
65 /* no matching message code found */