summaryrefslogtreecommitdiff
path: root/include/u8c
diff options
context:
space:
mode:
Diffstat (limited to 'include/u8c')
-rw-r--r--include/u8c/fmt.h2
-rw-r--r--include/u8c/freeu32.h26
-rw-r--r--include/u8c/freeu8.h26
-rw-r--r--include/u8c/geterr.h2
-rw-r--r--include/u8c/isalnum.h2
-rw-r--r--include/u8c/isalpha.h2
-rw-r--r--include/u8c/iscntrl.h2
-rw-r--r--include/u8c/isdigit.h2
-rw-r--r--include/u8c/ispunct.h2
-rw-r--r--include/u8c/isspace.h2
-rw-r--r--include/u8c/print.h2
-rw-r--r--include/u8c/println.h2
-rw-r--r--include/u8c/seterr.h2
-rw-r--r--include/u8c/txt.h29
-rw-r--r--include/u8c/u32cmp.h2
-rw-r--r--include/u8c/u32cp.h2
-rw-r--r--include/u8c/u32sz.h2
-rw-r--r--include/u8c/u8dec.h2
-rw-r--r--include/u8c/u8enc.h2
-rw-r--r--include/u8c/ver.h2
-rw-r--r--include/u8c/vfmt.h2
-rw-r--r--include/u8c/vprint.h2
22 files changed, 100 insertions, 19 deletions
diff --git a/include/u8c/fmt.h b/include/u8c/fmt.h
index 7f31528..61ee8b2 100644
--- a/include/u8c/fmt.h
+++ b/include/u8c/fmt.h
@@ -21,7 +21,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_fmt(size_t * const outsz,uint_least32_t * * const out,uint_least32_t * const in,...);
+extern uint_least8_t u8c_fmt(size_t * const outsz,uint_least32_t const * * const out,uint_least32_t const * const in,...);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/freeu32.h b/include/u8c/freeu32.h
new file mode 100644
index 0000000..99ac8c2
--- /dev/null
+++ b/include/u8c/freeu32.h
@@ -0,0 +1,26 @@
+/*
+ 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/>.
+*/
+/* Format */
+# if !defined(u8c_freeu32)
+# if defined(__cplusplus)
+# include <cstdlib>
+# define u8c_freeu32(u32) (std::free(const_cast<uint_least32_t *>(u32)))
+# else
+# include <stdint.h>
+# include <stdlib.h>
+# define u8c_freeu32(u32) (free((uint_least32_t *)u32))
+# endif
+# endif
diff --git a/include/u8c/freeu8.h b/include/u8c/freeu8.h
new file mode 100644
index 0000000..7ae7abd
--- /dev/null
+++ b/include/u8c/freeu8.h
@@ -0,0 +1,26 @@
+/*
+ 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/>.
+*/
+/* Format */
+# if !defined(u8c_freeu8)
+# if defined(__cplusplus)
+# include <cstdlib>
+# define u8c_freeu8(u8) (std::free(u8))
+# else
+# include <stdint.h>
+# include <stdlib.h>
+# define u8c_freeu8(u8) (free((uint_least8_t *)u8))
+# endif
+# endif
diff --git a/include/u8c/geterr.h b/include/u8c/geterr.h
index abc1fb6..45a25ac 100644
--- a/include/u8c/geterr.h
+++ b/include/u8c/geterr.h
@@ -21,7 +21,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_geterr(size_t * const sz,uint_least32_t * * const out);
+extern uint_least8_t u8c_geterr(size_t * const sz,uint_least32_t const * * const out);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/isalnum.h b/include/u8c/isalnum.h
index 7b8c7fa..0b61bfd 100644
--- a/include/u8c/isalnum.h
+++ b/include/u8c/isalnum.h
@@ -20,7 +20,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_isalnum(uint_least8_t * const res,uint_least32_t chr);
+extern uint_least8_t u8c_isalnum(uint_least8_t * const res,uint_least32_t const chr);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/isalpha.h b/include/u8c/isalpha.h
index 1065414..3493dc0 100644
--- a/include/u8c/isalpha.h
+++ b/include/u8c/isalpha.h
@@ -20,7 +20,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_isalpha(uint_least8_t * const res,uint_least32_t chr);
+extern uint_least8_t u8c_isalpha(uint_least8_t * const res,uint_least32_t const chr);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/iscntrl.h b/include/u8c/iscntrl.h
index 2e30d1c..0f52911 100644
--- a/include/u8c/iscntrl.h
+++ b/include/u8c/iscntrl.h
@@ -20,7 +20,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_iscntrl(uint_least8_t * const res,uint_least32_t chr);
+extern uint_least8_t u8c_iscntrl(uint_least8_t * const res,uint_least32_t const chr);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/isdigit.h b/include/u8c/isdigit.h
index 4fdad4a..c2053c7 100644
--- a/include/u8c/isdigit.h
+++ b/include/u8c/isdigit.h
@@ -20,7 +20,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_isdigit(uint_least8_t * const res,uint_least32_t chr);
+extern uint_least8_t u8c_isdigit(uint_least8_t * const res,uint_least32_t const chr);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/ispunct.h b/include/u8c/ispunct.h
index 68809f2..a4da5c9 100644
--- a/include/u8c/ispunct.h
+++ b/include/u8c/ispunct.h
@@ -20,7 +20,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_ispunct(uint_least8_t * const res,uint_least32_t chr);
+extern uint_least8_t u8c_ispunct(uint_least8_t * const res,uint_least32_t const chr);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/isspace.h b/include/u8c/isspace.h
index 2fec0e0..35f9d4f 100644
--- a/include/u8c/isspace.h
+++ b/include/u8c/isspace.h
@@ -20,7 +20,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_isspace(uint_least8_t * const res,uint_least32_t chr);
+extern uint_least8_t u8c_isspace(uint_least8_t * const res,uint_least32_t const chr);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/print.h b/include/u8c/print.h
index f30b485..f77875d 100644
--- a/include/u8c/print.h
+++ b/include/u8c/print.h
@@ -21,7 +21,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_print(FILE * fp,uint_least32_t * const msg,...);
+extern uint_least8_t u8c_print(FILE * fp,uint_least32_t const * const msg,...);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/println.h b/include/u8c/println.h
index 2887726..d6874de 100644
--- a/include/u8c/println.h
+++ b/include/u8c/println.h
@@ -21,7 +21,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_println(FILE * fp,uint_least32_t * const msg,...);
+extern uint_least8_t u8c_println(FILE * fp,uint_least32_t const * const msg,...);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/seterr.h b/include/u8c/seterr.h
index df3270f..ae2f534 100644
--- a/include/u8c/seterr.h
+++ b/include/u8c/seterr.h
@@ -17,5 +17,5 @@
# if !defined(u8c_sym_seterr)
# define u8c_sym_seterr
# include <stdint.h>
-extern uint_least8_t u8c_seterr(uint_least32_t * const msg);
+extern uint_least8_t u8c_seterr(uint_least32_t const * const msg);
# endif
diff --git a/include/u8c/txt.h b/include/u8c/txt.h
new file mode 100644
index 0000000..8b2ba45
--- /dev/null
+++ b/include/u8c/txt.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/>.
+*/
+/* Text */
+# if !defined(__STDC_UTF_32__)
+# error UTF-32 is required to use u8c_txt.
+# else
+# if !defined(u8c_txt)
+# if defined(__cplusplus)
+# include <cstdint>
+# define u8c_txt(txt) (reinterpret_cast<std::uint_least32_t const *>(U ## txt ## ))
+# else
+# include <stdint.h>
+# define u8c_txt(txt) (uint_least32_t const *)U ## txt
+# endif
+# endif
+# endif
diff --git a/include/u8c/u32cmp.h b/include/u8c/u32cmp.h
index aa437f0..5ca3d5d 100644
--- a/include/u8c/u32cmp.h
+++ b/include/u8c/u32cmp.h
@@ -20,7 +20,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_u32cmp(uint_least8_t * const res,uint_least32_t * const lstr,uint_least32_t * const rstr);
+extern uint_least8_t u8c_u32cmp(uint_least8_t * const res,uint_least32_t const * const lstr,uint_least32_t const * const rstr);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/u32cp.h b/include/u8c/u32cp.h
index 4b2a66e..66cc870 100644
--- a/include/u8c/u32cp.h
+++ b/include/u8c/u32cp.h
@@ -21,7 +21,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_u32cp(size_t * const sz,uint_least32_t * * const out,uint_least32_t * const in);
+extern uint_least8_t u8c_u32cp(size_t * const sz,uint_least32_t const * * const out,uint_least32_t const * const in);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/u32sz.h b/include/u8c/u32sz.h
index 1a763f7..b97ccdb 100644
--- a/include/u8c/u32sz.h
+++ b/include/u8c/u32sz.h
@@ -21,7 +21,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_u32sz(size_t * sz,uint_least32_t * in);
+extern uint_least8_t u8c_u32sz(size_t * sz,uint_least32_t const * in);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/u8dec.h b/include/u8c/u8dec.h
index 45c7f72..eed43ae 100644
--- a/include/u8c/u8dec.h
+++ b/include/u8c/u8dec.h
@@ -21,7 +21,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_u8dec(size_t * const sz,uint_least32_t * * const out,uint_least8_t * const in);
+extern uint_least8_t u8c_u8dec(size_t * const sz,uint_least32_t const * * const out,uint_least8_t const * const in);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/u8enc.h b/include/u8c/u8enc.h
index 5223898..8040f8d 100644
--- a/include/u8c/u8enc.h
+++ b/include/u8c/u8enc.h
@@ -21,7 +21,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_u8enc(size_t * const sz,uint_least8_t * * const out,uint_least32_t * const in);
+extern uint_least8_t u8c_u8enc(size_t * const sz,uint_least8_t const * * const out,uint_least32_t const * const in);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/ver.h b/include/u8c/ver.h
index b2101af..3122392 100644
--- a/include/u8c/ver.h
+++ b/include/u8c/ver.h
@@ -16,5 +16,5 @@
/* Version */
# if !defined(u8c_ver)
# include <stdint.h>
-# define u8c_ver (UINT64_C(0xC))
+# define u8c_ver (UINT64_C(0xD))
# endif
diff --git a/include/u8c/vfmt.h b/include/u8c/vfmt.h
index dc29311..d4ae9b0 100644
--- a/include/u8c/vfmt.h
+++ b/include/u8c/vfmt.h
@@ -22,7 +22,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_vfmt(size_t * const sz,uint_least32_t * * const out,uint_least32_t * const in,va_list args);
+extern uint_least8_t u8c_vfmt(size_t * const sz,uint_least32_t const * * const out,uint_least32_t const * const in,va_list args);
# if defined(__cplusplus)
}
# endif
diff --git a/include/u8c/vprint.h b/include/u8c/vprint.h
index c2b292e..ace9612 100644
--- a/include/u8c/vprint.h
+++ b/include/u8c/vprint.h
@@ -22,7 +22,7 @@
# if defined(__cplusplus)
extern "C" {
# endif
-extern uint_least8_t u8c_vprint(FILE * fp,uint_least32_t * const msg,va_list args);
+extern uint_least8_t u8c_vprint(FILE * fp,uint_least32_t const * const msg,va_list args);
# if defined(__cplusplus)
}
# endif