aboutsummaryrefslogtreecommitdiffstats
path: root/libcmap.h
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-12-20 06:49:30 +0100
committerMattias Andrée <m@maandree.se>2025-12-20 06:49:30 +0100
commit28f3247dbb786a42f0460a7aa88d558056a68144 (patch)
tree16be29e366f0dd9b5a8499e0edb72d8ec780ad8d /libcmap.h
downloadlibcmap-28f3247dbb786a42f0460a7aa88d558056a68144.tar.gz
libcmap-28f3247dbb786a42f0460a7aa88d558056a68144.tar.bz2
libcmap-28f3247dbb786a42f0460a7aa88d558056a68144.tar.xz
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--libcmap.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/libcmap.h b/libcmap.h
new file mode 100644
index 0000000..54e60cc
--- /dev/null
+++ b/libcmap.h
@@ -0,0 +1,47 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef LIBCMAP_H
+#define LIBCMAP_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#if defined(__GNUC__)
+# define LIBCMAP_PURE_ __attribute__((__pure__))
+# define LIBCMAP_CONST_ __attribute__((__const__))
+#else
+# define LIBCMAP_PURE_
+# define LIBCMAP_CONST_
+#endif
+
+
+struct libcmap_range {
+ uint32_t first;
+ uint32_t last;
+};
+
+struct libcmap_block {
+ const char *name;
+ struct libcmap_range range;
+};
+
+struct libcmap_script {
+ const char *name;
+ struct libcmap_range *ranges;
+ size_t nranges;
+};
+
+
+extern const struct libcmap_block *const libcmap_block_list;
+extern const size_t libcmap_block_list_size;
+
+extern const struct libcmap_script *const libcmap_script_list;
+extern const size_t libcmap_script_list_size;
+
+
+const struct libcmap_block *libcmap_find_block(uint32_t codepoint, size_t *offset_out);
+const struct libcmap_script *libcmap_find_script(uint32_t codepoint, size_t *offset_out, size_t *subrange_out);
+
+
+#undef LIBCMAP_PURE_
+#undef LIBCMAP_CONST_
+#endif