summaryrefslogtreecommitdiff
path: root/src/utf8.h
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-01-04 11:51:58 +0800
committerJSDurand <mmemmew@gmail.com>2022-01-04 11:51:58 +0800
commit55dc897da6e81f2a26cfc7e66ac942824773498b (patch)
treefce0d7d57832907c991d551833bf5eecde947dd2 /src/utf8.h
parent53b8b6ffab5a968db75e9babddf4e2dbb2c688a3 (diff)
temporary commit
Now we can read grammars from a file. But we need to check if it works for reading strings still.
Diffstat (limited to 'src/utf8.h')
-rw-r--r--src/utf8.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/utf8.h b/src/utf8.h
new file mode 100644
index 0000000..5b3c9f2
--- /dev/null
+++ b/src/utf8.h
@@ -0,0 +1,25 @@
+#ifndef UTF8_H
+#define UTF8_H
+#include "str.h"
+
+typedef struct utf8_s utf8;
+
+enum UTF8_State_e {
+ UTF8_STATE_ACCEPT = 0,
+ UTF8_STATE_REJECT = 12,
+ UTF8_STATE_1 = 24,
+ UTF8_STATE_2 = 36,
+ UTF8_STATE_3 = 48,
+ UTF8_STATE_4 = 60,
+ UTF8_STATE_5 = 72,
+ UTF8_STATE_6 = 84,
+ UTF8_STATE_7 = 96
+};
+
+typedef enum UTF8_State_e UTF8_State;
+
+utf8 *new_utf8(char *string, UNUM size);
+
+unsigned char encode(NUM code_point, str *result);
+
+#endif