diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/u8c.h | 36 | ||||
-rw-r--r-- | include/u8c/SIZE_C.h | 44 | ||||
-rw-r--r-- | include/u8c/col.h | 35 | ||||
-rw-r--r-- | include/u8c/dbgprint.h | 17 | ||||
-rw-r--r-- | include/u8c/debug.h | 16 | ||||
-rw-r--r-- | include/u8c/end.h (renamed from include/u8c/free.h) | 17 | ||||
-rw-r--r-- | include/u8c/fmt.h | 28 | ||||
-rw-r--r-- | include/u8c/fmttyp.h | 17 | ||||
-rw-r--r-- | include/u8c/geterr.h | 27 | ||||
-rw-r--r-- | include/u8c/init.h | 27 | ||||
-rw-r--r-- | include/u8c/print.h | 14 | ||||
-rw-r--r-- | include/u8c/println.h | 28 | ||||
-rw-r--r-- | include/u8c/thrdsafe.h | 27 | ||||
-rw-r--r-- | include/u8c/u32cp.h | 28 | ||||
-rw-r--r-- | include/u8c/u32sz.h | 28 | ||||
-rw-r--r-- | include/u8c/u8dec.h | 17 | ||||
-rw-r--r-- | include/u8c/u8enc.h | 17 | ||||
-rw-r--r-- | include/u8c/ver.h | 10 | ||||
-rw-r--r-- | include/u8c/vfmt.h | 29 | ||||
-rw-r--r-- | include/u8c/vprint.h | 29 |
20 files changed, 449 insertions, 42 deletions
diff --git a/include/u8c.h b/include/u8c.h new file mode 100644 index 0000000..8a11dd5 --- /dev/null +++ b/include/u8c.h @@ -0,0 +1,36 @@ +/* + 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/>. +*/ +/* Import this header to declare every single thing from u8c. */ +/* Expect long compile time. */ +# include <u8c/col.h> +# include <u8c/dbgprint.h> +# include <u8c/debug.h> +# include <u8c/end.h> +# include <u8c/fmt.h> +# include <u8c/fmttyp.h> +# include <u8c/geterr.h> +# include <u8c/init.h> +# include <u8c/print.h> +# include <u8c/println.h> +# include <u8c/SIZE_C.h> +# include <u8c/thrdsafe.h> +# include <u8c/u32cp.h> +# include <u8c/u32sz.h> +# include <u8c/u8dec.h> +# include <u8c/u8enc.h> +# include <u8c/ver.h> +# include <u8c/vfmt.h> +# include <u8c/vprint.h> diff --git a/include/u8c/SIZE_C.h b/include/u8c/SIZE_C.h new file mode 100644 index 0000000..7c9d1a9 --- /dev/null +++ b/include/u8c/SIZE_C.h @@ -0,0 +1,44 @@ +/* + 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/>. +*/ +/* Size constant */ +# if !defined SIZE_C +# include <limits.h> +# include <stdint.h> +# if SIZE_MAX == USHRT_MAX +# if defined(__cplusplus) +/* C++ : Use variable initialisation. */ +# define SIZE_C(val) (unsigned short{val}) +# else +/* C : Use compound literal. */ +# define SIZE_C(val) ((unsigned short){val}) +# endif +# elif SIZE_MAX == UINT_MAX +# define SIZE_C(val) val +# elif SIZE_MAX == ULONG_MAX +# define SIZE_C(val) val ## ul +# elif SIZE_MAX == ULLONG_MAX +# define SIZE_C(val) val ## ull +# elif SIZE_MAX == UINTMAX_MAX +# define SIZE_C(val) UINTMAX_C(val) +# else +/* Cannot match width; construct new element of type "size_t" */ +# if defined(__cplusplus) +# define SIZE_C(val) (std::size_t{val}) +# else +# define SIZE_C(val) ((size_t){val}) +# endif +# endif +# endif diff --git a/include/u8c/col.h b/include/u8c/col.h new file mode 100644 index 0000000..54a2b4e --- /dev/null +++ b/include/u8c/col.h @@ -0,0 +1,35 @@ +/* + 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/>. +*/ +/* Colour */ +# if !defined(u8c_sym_col) +# define u8c_sym_col +# define u8c_col_azure (UINT32_C(0x3DA9E1)) +# define u8c_col_ash (UINT32_C(0xD2D2CC)) +# define u8c_col_black (UINT32_C(0x444747)) +# define u8c_col_blue (UINT32_C(0x3D3DE1)) +# define u8c_col_chartreuse (UINT32_C(0xA9E13D)) +# define u8c_col_cyan (UINT32_C(0x3DE1E1)) +# define u8c_col_green (UINT32_C(0x3ED13D)) +# define u8c_col_magenta (UINT32_C(0xE13DE1)) +# define u8c_col_mint (UINT32_C(0x3DE1A9)) +# define u8c_col_orange (UINT32_C(0xE1A93D)) +# define u8c_col_red (UINT32_C(0xE13D3D)) +# define u8c_col_rose (UINT32_C(0xE13DA9)) +# define u8c_col_silver (UINT32_C(0x9CA1A1)) +# define u8c_col_violet (UINT32_C(0xA93dE1)) +# define u8c_col_white (UINT32_C(0xF8F8F1)) +# define u8c_col_yellow (UINT32_C(0xE1E13D)) +# endif diff --git a/include/u8c/dbgprint.h b/include/u8c/dbgprint.h index 3f4afaf..57cb219 100644 --- a/include/u8c/dbgprint.h +++ b/include/u8c/dbgprint.h @@ -3,9 +3,9 @@ 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 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. + 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. @@ -13,13 +13,18 @@ If not, see <https://www.gnu.org/licenses/>. */ -# if !defined(u8c_sym_dbgprint) -# define u8c_sym_dbgprint +/* Debug print */ +# if !defined(u8c_dbgprint) # if defined(NDEBUG) -# define u8c_dbgprint(...) +# if defined(__cplusplus) +# define u8c_dbgprint(...) static_cast<void>(0x0); +# else +# define u8c_dbgprint(...) ((void)0x0) +# endif # else # include <u8c/print.h> # include <stdint.h> -# define u8c_dbgprint(...) { u8c_print(__VA_ARGS__); } +# include <stdio.h> +# define u8c_dbgprint(...) u8c_print(stderr,__VA_ARGS__) # endif # endif diff --git a/include/u8c/debug.h b/include/u8c/debug.h index 38c00b0..3bd2dfd 100644 --- a/include/u8c/debug.h +++ b/include/u8c/debug.h @@ -3,9 +3,9 @@ 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 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. + 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. @@ -13,13 +13,15 @@ If not, see <https://www.gnu.org/licenses/>. */ +/* Debug */ # if !defined(u8c_sym_debug) # define u8c_sym_debug # include <stdint.h> -uint_least8_t const inline u8c_debug = -# if defined(NDEBUG) - 0x0; -# else - 0x1; +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t const u8c_debug; +# if defined(__cplusplus) +} # endif # endif diff --git a/include/u8c/free.h b/include/u8c/end.h index 573089e..1322496 100644 --- a/include/u8c/free.h +++ b/include/u8c/end.h @@ -3,9 +3,9 @@ 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 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. + 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. @@ -13,8 +13,15 @@ If not, see <https://www.gnu.org/licenses/>. */ -# if !defined(u8c_sym_free) -# define u8c_sym_free +/* End */ +# if !defined(u8c_sym_end) +# define u8c_sym_end # include <stdint.h> -extern uint_least8_t u8c_free(void * ptr); +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_end(void); +# if defined(__cplusplus) +} +# endif # endif diff --git a/include/u8c/fmt.h b/include/u8c/fmt.h new file mode 100644 index 0000000..262c3dc --- /dev/null +++ b/include/u8c/fmt.h @@ -0,0 +1,28 @@ +/* + 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_sym_fmt) +# define u8c_sym_fmt +# include <stddef.h> +# include <stdint.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_fmt(size_t * outstrsz,uint_least32_t * * outstr,uint_least32_t * instr,...); +# if defined(__cplusplus) +} +# endif +# endif diff --git a/include/u8c/fmttyp.h b/include/u8c/fmttyp.h index b2d79ea..e81e774 100644 --- a/include/u8c/fmttyp.h +++ b/include/u8c/fmttyp.h @@ -3,9 +3,9 @@ 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 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. + 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. @@ -13,12 +13,17 @@ If not, see <https://www.gnu.org/licenses/>. */ +/* Format type */ # if !defined(u8c_sym_fmttyp) # define u8c_sym_fmttyp enum u8c_fmttyp { - u8c_fmttyp_chr, - u8c_fmttyp_int, - u8c_fmttyp_str, - u8c_fmttyp_uint, + u8c_fmttyp_bgcol, /* Background colour */ + u8c_fmttyp_bgcol0, /* Background colour #0 */ + u8c_fmttyp_chr, /* Character */ + u8c_fmttyp_fgcol, /* Foreground colour */ + u8c_fmttyp_fgcol0, /* Foreground colour #0 */ + u8c_fmttyp_int, /* Integer */ + u8c_fmttyp_str, /* String */ + u8c_fmttyp_uint, /* Unsigned integer */ }; # endif diff --git a/include/u8c/geterr.h b/include/u8c/geterr.h new file mode 100644 index 0000000..279f1fb --- /dev/null +++ b/include/u8c/geterr.h @@ -0,0 +1,27 @@ +/* + 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/>. +*/ +/* Get error */ +# if !defined(u8c_sym_geterr) +# define u8c_sym_geterr +# include <stdint.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_geterr(size_t * sz,uint_least32_t * * u32); +# if defined(__cplusplus) +} +# endif +# endif diff --git a/include/u8c/init.h b/include/u8c/init.h new file mode 100644 index 0000000..823c1fb --- /dev/null +++ b/include/u8c/init.h @@ -0,0 +1,27 @@ +/* + 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/>. +*/ +/* Initialise */ +# if !defined(u8c_sym_init) +# define u8c_sym_init +# include <stdint.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_init(void); +# if defined(__cplusplus) +} +# endif +# endif diff --git a/include/u8c/print.h b/include/u8c/print.h index 0e52cf1..acbda08 100644 --- a/include/u8c/print.h +++ b/include/u8c/print.h @@ -3,9 +3,9 @@ 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 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. + 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. @@ -13,8 +13,16 @@ If not, see <https://www.gnu.org/licenses/>. */ +/* Print */ # if !defined(u8c_sym_print) # define u8c_sym_print # include <stdint.h> -extern uint_least8_t u8c_print(uint_least32_t * str,...); +# include <stdio.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_print(FILE * fp,uint_least32_t * msg,...); +# if defined(__cplusplus) +} +# endif # endif diff --git a/include/u8c/println.h b/include/u8c/println.h new file mode 100644 index 0000000..10ebff3 --- /dev/null +++ b/include/u8c/println.h @@ -0,0 +1,28 @@ +/* + 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/>. +*/ +/* Print line */ +# if !defined(u8c_sym_println) +# define u8c_sym_println +# include <stdint.h> +# include <stdio.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_println(FILE * fp,uint_least32_t * msg,...); +# if defined(__cplusplus) +} +# endif +# endif diff --git a/include/u8c/thrdsafe.h b/include/u8c/thrdsafe.h new file mode 100644 index 0000000..1de6a31 --- /dev/null +++ b/include/u8c/thrdsafe.h @@ -0,0 +1,27 @@ +/* + 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/>. +*/ +/* Thread-safe */ +# if !defined(u8c_sym_thrdsafe) +# define u8c_sym_thrdsafe +# include <stdint.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t const u8c_thrdsafe; +# if defined(__cplusplus) +} +# endif +# endif diff --git a/include/u8c/u32cp.h b/include/u8c/u32cp.h new file mode 100644 index 0000000..b0ca35f --- /dev/null +++ b/include/u8c/u32cp.h @@ -0,0 +1,28 @@ +/* + 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 copy */ +# if !defined(luma_sym_u32cp) +# define luma_sym_u32cp +# include <stddef.h> +# include <stdint.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_u32cp(size_t * sz,uint_least32_t * * out,uint_least32_t * in); +# if defined(__cplusplus) +} +# endif +# endif diff --git a/include/u8c/u32sz.h b/include/u8c/u32sz.h new file mode 100644 index 0000000..28ef2e4 --- /dev/null +++ b/include/u8c/u32sz.h @@ -0,0 +1,28 @@ +/* + 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 size */ +# if !defined(u8c_sym_u32sz) +# define u8c_sym_u32sz +# include <stddef.h> +# include <stdint.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_u32sz(size_t * sz,uint_least32_t * u32); +# if defined(__cplusplus) +} +# endif +# endif diff --git a/include/u8c/u8dec.h b/include/u8c/u8dec.h index 07c0e27..8ebf64e 100644 --- a/include/u8c/u8dec.h +++ b/include/u8c/u8dec.h @@ -3,9 +3,9 @@ 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 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. + 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. @@ -13,9 +13,16 @@ If not, see <https://www.gnu.org/licenses/>. */ -# if !defined(u8c_sym_u8dec) -# define u8c_sym_u8dec +/* UTF-8 decode */ +# if !defined(u8c_sym_dec) +# define u8c_sym_dec # include <stddef.h> # include <stdint.h> -extern uint_least8_t u8c_u8dec(uint_least8_t * utf,size_t * codepssz,uint_least32_t * * codeps); +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_u8dec(size_t * outsz,uint_least32_t * * out,uint_least8_t * in); +# if defined(__cplusplus) +} +# endif # endif diff --git a/include/u8c/u8enc.h b/include/u8c/u8enc.h index 6083c2a..f4bdfa5 100644 --- a/include/u8c/u8enc.h +++ b/include/u8c/u8enc.h @@ -3,9 +3,9 @@ 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 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. + 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. @@ -13,9 +13,16 @@ If not, see <https://www.gnu.org/licenses/>. */ -# if !defined(u8c_sym_u8enc) -# define u8c_sym_u8enc +/* UTF-8 encode */ +# if !defined(u8c_sym_enc) +# define u8c_sym_enc # include <stddef.h> # include <stdint.h> -extern uint_least8_t u8c_u8enc(uint_least32_t * codeps,size_t * utfsz,uint_least8_t * * utf); +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_u8enc(size_t * sz,uint_least8_t * * out,uint_least32_t * in); +# if defined(__cplusplus) +} +# endif # endif diff --git a/include/u8c/ver.h b/include/u8c/ver.h index 3e8af37..3c07ec6 100644 --- a/include/u8c/ver.h +++ b/include/u8c/ver.h @@ -3,9 +3,9 @@ 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 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. + 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. @@ -13,8 +13,8 @@ If not, see <https://www.gnu.org/licenses/>. */ -# if !defined(u8c_sym_ver) -# define u8c_sym_ver +/* Version */ +# if !defined(u8c_ver) # include <stdint.h> -uint_least64_t const inline u8c_debug = 0x1; +# define u8c_ver (UINT64_C(0x2)) # endif diff --git a/include/u8c/vfmt.h b/include/u8c/vfmt.h new file mode 100644 index 0000000..c12e251 --- /dev/null +++ b/include/u8c/vfmt.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/>. +*/ +/* Variadic format */ +# if !defined(u8c_sym_vfmt) +# define u8c_sym_vfmt +# include <stdarg.h> +# include <stddef.h> +# include <stdint.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_vfmt(size_t * outsz,uint_least32_t * * out,uint_least32_t * in,va_list args); +# if defined(__cplusplus) +} +# endif +# endif diff --git a/include/u8c/vprint.h b/include/u8c/vprint.h new file mode 100644 index 0000000..154aef6 --- /dev/null +++ b/include/u8c/vprint.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/>. +*/ +/* Variadic print */ +# if !defined(u8c_sym_vprint) +# define u8c_sym_vprint +# include <stdarg.h> +# include <stdint.h> +# include <stdio.h> +# if defined(__cplusplus) +extern "C" { +# endif +extern uint_least8_t u8c_vprint(FILE * fp,uint_least32_t * msg,va_list args); +# if defined(__cplusplus) +} +# endif +# endif |