summaryrefslogtreecommitdiff
path: root/src/core/utf8.h
diff options
context:
space:
mode:
authorXavier G <xavier.github@kindwolf.org>2016-05-13 01:26:33 +0200
committerXavier G <xavier.github@kindwolf.org>2016-05-13 01:26:33 +0200
commit5538578820550c1a62dc4d0e6451332229eeee75 (patch)
treefe7bfe41e28d86ddaf406423b3a0c025d780e328 /src/core/utf8.h
parent2ba4b9d26afb87c2e661b1c07313ca78b3c5618e (diff)
downloadirssi-5538578820550c1a62dc4d0e6451332229eeee75.zip
Move utf8.{h,c} from fe-common/core to core.
Diffstat (limited to 'src/core/utf8.h')
-rw-r--r--src/core/utf8.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/core/utf8.h b/src/core/utf8.h
new file mode 100644
index 00000000..63261a24
--- /dev/null
+++ b/src/core/utf8.h
@@ -0,0 +1,20 @@
+#ifndef __UTF8_H
+#define __UTF8_H
+
+/* XXX I didn't check the encoding range of big5+. This is standard big5. */
+#define is_big5_los(lo) (0x40 <= (lo) && (lo) <= 0x7E) /* standard */
+#define is_big5_lox(lo) (0x80 <= (lo) && (lo) <= 0xFE) /* extended */
+#define is_big5_lo(lo) ((is_big5_los(lo) || is_big5_lox(lo)))
+#define is_big5_hi(hi) (0x81 <= (hi) && (hi) <= 0xFE)
+#define is_big5(hi,lo) (is_big5_hi(hi) && is_big5_lo(lo))
+
+#include <glib.h>
+typedef guint32 unichar;
+
+/* Returns width for character (0-2). */
+int mk_wcwidth(unichar c);
+
+#define unichar_isprint(c) (((c) & ~0x80) >= 32)
+#define is_utf8_leading(c) (((c) & 0xc0) != 0x80)
+
+#endif