summaryrefslogtreecommitdiff
path: root/include/u8c
diff options
context:
space:
mode:
Diffstat (limited to 'include/u8c')
-rw-r--r--include/u8c/end.h1
-rw-r--r--include/u8c/errhandltyp.h20
-rw-r--r--include/u8c/errtyp.h29
-rw-r--r--include/u8c/init.h1
-rw-r--r--include/u8c/regerrhandl.h23
-rw-r--r--include/u8c/seterr.h3
-rw-r--r--include/u8c/u32cmp.h1
-rw-r--r--include/u8c/u32cp.h1
-rw-r--r--include/u8c/u32fndchr.h1
-rw-r--r--include/u8c/u32ins.h23
-rw-r--r--include/u8c/ver.h2
11 files changed, 99 insertions, 6 deletions
diff --git a/include/u8c/end.h b/include/u8c/end.h
index 01c8c24..5cc7922 100644
--- a/include/u8c/end.h
+++ b/include/u8c/end.h
@@ -13,7 +13,6 @@
If not, see <https://www.gnu.org/licenses/>.
*/
-/* End */
# if !defined(u8c_sym_end)
# define u8c_sym_end
# include <stdbool.h>
diff --git a/include/u8c/errhandltyp.h b/include/u8c/errhandltyp.h
new file mode 100644
index 0000000..310f6a6
--- /dev/null
+++ b/include/u8c/errhandltyp.h
@@ -0,0 +1,20 @@
+/*
+ Copyright 2021 Gabriel Jensen
+
+ This file is part of u8c.
+
+ u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with u8c.
+
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+# if !defined(u8c_sym_errhandltyp)
+# define u8c_sym_errhandltyp
+# include <u8c/errtyp.h>
+typedef void (* u8c_errhandltyp)(enum u8c_errtyp);
+# endif
diff --git a/include/u8c/errtyp.h b/include/u8c/errtyp.h
new file mode 100644
index 0000000..00a6ef8
--- /dev/null
+++ b/include/u8c/errtyp.h
@@ -0,0 +1,29 @@
+/*
+ Copyright 2021 Gabriel Jensen
+
+ This file is part of u8c.
+
+ u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with u8c.
+
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+/* Error type */
+# if !defined(u8c_sym_errtyp)
+# define u8c_sym_errtyp
+enum u8c_errtyp {
+ u8c_errtyp_badalloc, /* Bad allocation */
+ u8c_errtyp_badio, /* Bad input or output */
+ u8c_errtyp_u32oor, /* UTF-32 out of range */
+ u8c_errtyp_u8oor, /* UTF-8 out of range */
+ u8c_errtyp_deferr, /* Default error */
+ u8c_errtyp_untermin, /* Unterminated input */
+ u8c_errtyp_maxerrtyp, /* Maximum error type */
+ u8c_errtyp_all, /* All */
+};
+# endif
diff --git a/include/u8c/init.h b/include/u8c/init.h
index 1aa4804..e19cb5b 100644
--- a/include/u8c/init.h
+++ b/include/u8c/init.h
@@ -17,5 +17,6 @@
# if !defined(u8c_sym_init)
# define u8c_sym_init
# include <stdbool.h>
+# include <u8c/errtyp.h>
extern bool u8c_init(void);
# endif
diff --git a/include/u8c/regerrhandl.h b/include/u8c/regerrhandl.h
new file mode 100644
index 0000000..d94869a
--- /dev/null
+++ b/include/u8c/regerrhandl.h
@@ -0,0 +1,23 @@
+/*
+ Copyright 2021 Gabriel Jensen
+
+ This file is part of u8c.
+
+ u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with u8c.
+
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+/* Register error handler */
+# if !defined(u8c_sym_regerrhandl)
+# define u8c_sym_regerrhandl
+# include <stdbool.h>
+# include <u8c/errhandltyp.h>
+# include <u8c/errtyp.h>
+extern bool u8c_regerrhandl(enum u8c_errtyp typ,u8c_errhandltyp errhandl);
+# endif
diff --git a/include/u8c/seterr.h b/include/u8c/seterr.h
index 3f3e793..b143f5d 100644
--- a/include/u8c/seterr.h
+++ b/include/u8c/seterr.h
@@ -17,6 +17,7 @@
# if !defined(u8c_sym_seterr)
# define u8c_sym_seterr
# include <stdbool.h>
+# include <u8c/errtyp.h>
# include <uchar.h>
-extern bool u8c_seterr(char32_t const * const msg);
+extern bool u8c_seterr(char32_t const * const msg,enum u8c_errtyp _typ);
# endif
diff --git a/include/u8c/u32cmp.h b/include/u8c/u32cmp.h
index ffc2729..d638255 100644
--- a/include/u8c/u32cmp.h
+++ b/include/u8c/u32cmp.h
@@ -13,7 +13,6 @@
If not, see <https://www.gnu.org/licenses/>.
*/
-/* UTF-32 compare */
# if !defined(luma_sym_u32cmp)
# define luma_sym_u32cmp
# include <stdbool.h>
diff --git a/include/u8c/u32cp.h b/include/u8c/u32cp.h
index 01e2ae1..a79d087 100644
--- a/include/u8c/u32cp.h
+++ b/include/u8c/u32cp.h
@@ -13,7 +13,6 @@
If not, see <https://www.gnu.org/licenses/>.
*/
-/* UTF-32 copy */
# if !defined(luma_sym_u32cp)
# define luma_sym_u32cp
# include <stdbool.h>
diff --git a/include/u8c/u32fndchr.h b/include/u8c/u32fndchr.h
index d52682d..2ba83a1 100644
--- a/include/u8c/u32fndchr.h
+++ b/include/u8c/u32fndchr.h
@@ -13,7 +13,6 @@
If not, see <https://www.gnu.org/licenses/>.
*/
-/* UTF-32 find character */
# if !defined(luma_sym_u32fndchr)
# define luma_sym_u32fndchr
# include <stdbool.h>
diff --git a/include/u8c/u32ins.h b/include/u8c/u32ins.h
new file mode 100644
index 0000000..70a2440
--- /dev/null
+++ b/include/u8c/u32ins.h
@@ -0,0 +1,23 @@
+/*
+ Copyright 2021 Gabriel Jensen
+
+ This file is part of u8c.
+
+ u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with u8c.
+
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+/* UTF-32 insert */
+# if !defined(luma_sym_u32ins)
+# define luma_sym_u32ins
+# include <stdbool.h>
+# include <stddef.h>
+# include <uchar.h>
+extern bool u8c_u32ins(size_t * const sz,char32_t const * * const out,size_t const pos,char32_t const * const str0,char32_t const * const str1);
+# endif
diff --git a/include/u8c/ver.h b/include/u8c/ver.h
index 4fa1b51..3f59f1a 100644
--- a/include/u8c/ver.h
+++ b/include/u8c/ver.h
@@ -17,5 +17,5 @@
# if !defined(u8c_sym_ver)
# define u8c_sym_ver
# include <stdint.h>
-# define u8c_ver (UINT64_C(0x14))
+# define u8c_ver (UINT64_C(0x15))
# endif