Edit

kc3-lang/libxkbcommon/test/keysym-case-mapping.h.jinja

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2025-07-07 12:28:24
    Hash : dc63e5f8
    Message : Ensure config.h is always included first While `config.h` may not be necessary in every file, it ensures consistency and makes code refactoring safer.

  • test/keysym-case-mapping.h.jinja
  • // WARNING: This file is automatically generated by: {{ script }}
    #pragma once
    
    #include "config.h"
    
    #include <stdint.h>
    #include <unicode/uchar.h>
    
    /* Unicode code points used in case mapping exceptions */
    {% for lower, upper in upper_exceptions.items() %}
    #define {{ lower | code_point_name_constant(padding=28) }} {{ lower | code_point }} // {{ lower }}
    #define {{ upper | code_point_name_constant(padding=28) }} {{ upper | code_point }} // {{ upper }}
    {% endfor %}
    
    static inline uint32_t
    to_simple_lower(uint32_t cp)
    {
        return (uint32_t)u_tolower((UChar32) cp);
    }
    
    static inline uint32_t
    to_simple_upper(uint32_t cp)
    {
        switch (cp) {
        /* Some exceptions */
        {% for lower, upper in upper_exceptions.items() %}
        case {{ lower | code_point_name_constant }}:
            return {{ upper | code_point_name_constant }};
        {% endfor %}
        /* Default to the Unicode simple mapping */
        default:
            return (uint32_t)u_toupper((UChar32) cp);
        }
    }