diff options
Diffstat (limited to 'include/u8c')
-rw-r--r-- | include/u8c/intern.h | 48 | ||||
-rw-r--r-- | include/u8c/main.h | 8 | ||||
-rw-r--r-- | include/u8c/u16.h | 4 | ||||
-rw-r--r-- | include/u8c/u32.h | 22 |
4 files changed, 66 insertions, 16 deletions
diff --git a/include/u8c/intern.h b/include/u8c/intern.h new file mode 100644 index 0000000..6aeaee2 --- /dev/null +++ b/include/u8c/intern.h @@ -0,0 +1,48 @@ +/* + 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_dattyp) +# define u8c_sym_dattyp +# include <stdalign.h> +# include <stdbool.h> +# include <stddef.h> +# include <stdint.h> +# include <u8c/SIZE_C.h> +# include <u8c/err.h> +# include <uchar.h> +# if defined(u8c_bethrdsafe) +# include <threads.h> +# endif +/* Enumerations: */ +/* Type definitions: */ +/* Structures: */ +struct u8c_dattyp { + char32_t const * err; + u8c_errhandltyp errhandls[(size_t)u8c_errtyp_maxerrtyp]; + uint_least8_t fmtbase; + bool fmtendian; + uint_least8_t stat; +# if defined(u8c_bethrdsafe) + mtx_t errlock; + mtx_t errhandlslock; + mtx_t fmtlock; + mtx_t outlock; +# endif +}; +/* Functions */ +/* Constants & Variables: */ +extern struct u8c_dattyp u8c_dat; +/* Macros: */ +# endif diff --git a/include/u8c/main.h b/include/u8c/main.h index 49049f6..2a13cc0 100644 --- a/include/u8c/main.h +++ b/include/u8c/main.h @@ -24,13 +24,13 @@ /* Type definitions: */ /* Structures: */ /* Functions */ -extern noreturn bool u8c_abrt(char const * const fl,long long const ln,char const * const fn,char const * const why); -extern bool u8c_end( void); -extern bool u8c_init(void); +extern noreturn bool u8c_abrtfn(char const * const fl,long const ln,char const * const fn,char const * const why); +extern bool u8c_end( void); +extern bool u8c_init( void); /* Constants & Variables: */ extern bool const u8c_dbg; extern bool const u8c_thrdsafe; -static char32_t const u8c_unimax = (char32_t)UINT32_C(0x10FFFF); static uint_least64_t const u8c_ver = UINT64_C(0x19); /* Macros: */ +# define u8c_abrt(why) u8c_abrtfn(__FILE__,(long)__LINE__,__func__,why) # endif diff --git a/include/u8c/u16.h b/include/u8c/u16.h index 1babb69..8d81784 100644 --- a/include/u8c/u16.h +++ b/include/u8c/u16.h @@ -22,8 +22,8 @@ /* Type definitions: */ /* Structures: */ /* Functions */ -extern bool u8c_u16alloc(char16_t * * const u16,size_t const sz); -extern bool u8c_u16free(char16_t const * * const u16); +extern bool u8c_u16alloc(char16_t * * const u16,size_t const sz); +extern bool u8c_u16free( char16_t const * * const u16); /* Constants & Variables: */ /* Macros: */ # endif diff --git a/include/u8c/u32.h b/include/u8c/u32.h index 08ac161..e5567e7 100644 --- a/include/u8c/u32.h +++ b/include/u8c/u32.h @@ -17,21 +17,23 @@ # define u8c_hdr_u32 # include <stdbool.h> # include <stddef.h> +# include <stdint.h> # include <uchar.h> /* Enumerations: */ /* Type definitions: */ /* Structures: */ /* Functions */ -extern bool u8c_u32alloc(char32_t * * const u32,size_t const sz); -extern bool u8c_u32cat(size_t * const sz,char32_t const * * const out,char32_t const * const lstr,char32_t const * const rstr); -extern bool u8c_u32cmp(uint_least8_t * const res,char32_t const * const lstr,char32_t const * const rstr); -extern bool u8c_u32cp(size_t * const sz,char32_t const * * const out,char32_t const * const in); -extern bool u8c_u32fndchr(size_t * const pos,char32_t const * const in,char32_t const chr); -extern bool u8c_u32fndpat(size_t * const pos,char32_t const * const in,char32_t const * const pat); -extern bool u8c_u32free(char32_t const * * const u32); -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); -extern bool u8c_u32substr(char32_t const * * const out,size_t const start,size_t const len,char32_t const * const in); -extern bool u8c_u32sz(size_t * sz,char32_t const * in); +extern bool u8c_u32alloc( char32_t * * const u32,size_t const sz); +extern bool u8c_u32cat( size_t * const sz, char32_t const * * const out, char32_t const * const lstr,char32_t const * const rstr); +extern bool u8c_u32cmp( uint_least8_t * const res,char32_t const * const lstr, char32_t const * const rstr); +extern bool u8c_u32cp( size_t * const sz, char32_t const * * const out, char32_t const * const in); +extern bool u8c_u32fndchr(size_t * const pos,char32_t const * const in, char32_t const chr); +extern bool u8c_u32fndpat(size_t * const pos,char32_t const * const in, char32_t const * const pat); +extern bool u8c_u32free( char32_t const * * const u32); +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); +extern bool u8c_u32substr(char32_t const * * const out,size_t const start,size_t const len, char32_t const * const in); +extern bool u8c_u32sz( size_t * sz, char32_t const * in); /* Constants & Variables: */ +static char32_t const u8c_u32max = U'\x10FFFF'; /* Macros: */ # endif |