summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/unicode.c13
-rw-r--r--lib/unicode.h20
2 files changed, 33 insertions, 0 deletions
diff --git a/lib/unicode.c b/lib/unicode.c
new file mode 100644
index 0000000..b52431f
--- /dev/null
+++ b/lib/unicode.c
@@ -0,0 +1,13 @@
+#include "unicode.h"
+#include <glib.h>
+
+const char *
+next_char(const char * c)
+{
+ return g_utf8_next_char(c);
+}
+uint32_t
+get_codepoint(const char * c)
+{
+ return g_utf8_get_char(c);
+}
diff --git a/lib/unicode.h b/lib/unicode.h
new file mode 100644
index 0000000..8bd841b
--- /dev/null
+++ b/lib/unicode.h
@@ -0,0 +1,20 @@
+#ifndef UNICODE_H
+#define UNICODE_H
+
+// Wrappers of some glib functions (why are we using glib then?) which we want, but glib.h is a bit C like
+
+#ifdef __cplusplus
+# include <cstdint>
+extern "C" {
+#else
+# include <stdint.h>
+#endif
+
+const char * next_char(const char *);
+uint32_t get_codepoint(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif