// WARNING: This file is automatically generated by: {{ script }}
#pragma once

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