Debian Codegraph @

test/keysym-case-mapping.h.jinja

raw
1 // WARNING: This file is automatically generated by: {{ script }}
2 #pragma once
3
4 #include "config.h"
5
6 #include <stdint.h>
7 #include <unicode/uchar.h>
8
9 /* Unicode code points used in case mapping exceptions */
10 {% for lower, upper in upper_exceptions.items() %}
11 #define {{ lower | code_point_name_constant(padding=28) }} {{ lower | code_point }} // {{ lower }}
12 #define {{ upper | code_point_name_constant(padding=28) }} {{ upper | code_point }} // {{ upper }}
13 {% endfor %}
14
15 static inline uint32_t
16 to_simple_lower(uint32_t cp)
17 {
18 return (uint32_t)u_tolower((UChar32) cp);
19 }
20
21 static inline uint32_t
22 to_simple_upper(uint32_t cp)
23 {
24 switch (cp) {
25 /* Some exceptions */
26 {% for lower, upper in upper_exceptions.items() %}
27 case {{ lower | code_point_name_constant }}:
28 return {{ upper | code_point_name_constant }};
29 {% endfor %}
30 /* Default to the Unicode simple mapping */
31 default:
32 return (uint32_t)u_toupper((UChar32) cp);
33 }
34 }