summaryrefslogtreecommitdiff
path: root/src/libbasic/include/basic/gunicode.h
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-09-10 10:47:48 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-09-10 10:47:48 -0400
commita1c7a49f2dbd12ff48a5bbd3b673a23944b72465 (patch)
tree8c2a709b2527827d9d2f87e69858773f0e457665 /src/libbasic/include/basic/gunicode.h
parentb2361d9c29f2a551cb1e2fb0b75753c299a1ddfd (diff)
./move.sh
Diffstat (limited to 'src/libbasic/include/basic/gunicode.h')
-rw-r--r--src/libbasic/include/basic/gunicode.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libbasic/include/basic/gunicode.h b/src/libbasic/include/basic/gunicode.h
new file mode 100644
index 0000000000..5975bc8fc9
--- /dev/null
+++ b/src/libbasic/include/basic/gunicode.h
@@ -0,0 +1,30 @@
+#pragma once
+
+/* gunicode.h - Unicode manipulation functions
+ *
+ * Copyright (C) 1999, 2000 Tom Tromey
+ * Copyright 2000, 2005 Red Hat, Inc.
+ */
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+char *utf8_prev_char (const char *p);
+
+extern const char utf8_skip_data[256];
+
+/**
+ * g_utf8_next_char:
+ * @p: Pointer to the start of a valid UTF-8 character
+ *
+ * Skips to the next character in a UTF-8 string. The string must be
+ * valid; this macro is as fast as possible, and has no error-checking.
+ * You would use this macro to iterate over a string character by
+ * character. The macro returns the start of the next UTF-8 character.
+ * Before using this macro, use g_utf8_validate() to validate strings
+ * that may contain invalid UTF-8.
+ */
+#define utf8_next_char(p) (char *)((p) + utf8_skip_data[*(const unsigned char *)(p)])
+
+bool unichar_iswide (uint32_t c);