keysym-case-mapping.h.jinja 966 B

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