diff options
Diffstat (limited to 'include/u8c')
-rw-r--r-- | include/u8c/SIZE_C.h | 30 | ||||
-rw-r--r-- | include/u8c/chk.h | 76 | ||||
-rw-r--r-- | include/u8c/err.h | 51 | ||||
-rw-r--r-- | include/u8c/fmt.h | 110 | ||||
-rw-r--r-- | include/u8c/intern.h | 49 | ||||
-rw-r--r-- | include/u8c/main.h | 55 | ||||
-rw-r--r-- | include/u8c/str.h | 81 | ||||
-rw-r--r-- | include/u8c/u16.h | 36 | ||||
-rw-r--r-- | include/u8c/u8.h | 48 |
9 files changed, 0 insertions, 536 deletions
diff --git a/include/u8c/SIZE_C.h b/include/u8c/SIZE_C.h deleted file mode 100644 index be253f3..0000000 --- a/include/u8c/SIZE_C.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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(SIZE_C) -# include <limits.h> -# include <stdint.h> -# if SIZE_MAX == UINT_LEAST8_MAX -# define SIZE_C(val) UINT8_C(val) -# elif SIZE_MAX == UINT_LEAST16_MAX -# define SIZE_C(val) UINT16_C(val) -# elif SIZE_MAX == UINT_LEAST32_MAX -# define SIZE_C(val) UINT32_C(val) -# elif SIZE_MAX == UINT_LEAST64_MAX -# define SIZE_C(val) UINT64_C(val) -# else -# define SIZE_C(val) ((size_t)UINTMAX_C(val)) -# endif -# endif diff --git a/include/u8c/chk.h b/include/u8c/chk.h deleted file mode 100644 index 03e4ff2..0000000 --- a/include/u8c/chk.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - 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_hdr_chk) -# define u8c_hdr_chk -# include <stdbool.h> -# include <uchar.h> -/* Enumerations: */ -/* Type definitions: */ -/* Structures: */ -struct u8c_isalnum_tuple { - bool res; - bool stat; -}; -struct u8c_isalpha_tuple { - bool res; - bool stat; -}; -struct u8c_iscntrl_tuple { - bool res; - bool stat; -}; -struct u8c_isdigit_tuple { - bool res; - bool stat; -}; -struct u8c_islower_tuple { - bool res; - bool stat; -}; -struct u8c_ispunct_tuple { - bool res; - bool stat; -}; -struct u8c_isspace_tuple { - bool res; - bool stat; -}; -struct u8c_issurro_tuple { - bool res; - bool stat; -}; -struct u8c_isupper_tuple { - bool res; - bool stat; -}; -struct u8c_isxdigit_tuple { - bool res; - bool stat; -}; -/* Functions: */ -extern struct u8c_isalnum_tuple u8c_isalnum( char32_t const chr); /* Is alphanumeric */ -extern struct u8c_isalpha_tuple u8c_isalpha( char32_t const chr); /* Is alphabetic */ -extern struct u8c_iscntrl_tuple u8c_iscntrl( char32_t const chr); /* Is control character */ -extern struct u8c_isdigit_tuple u8c_isdigit( char32_t const chr); /* Is digit */ -extern struct u8c_islower_tuple u8c_islower( char32_t const chr); /* Is lowercase */ -extern struct u8c_ispunct_tuple u8c_ispunct( char32_t const chr); /* Is punctuation */ -extern struct u8c_isspace_tuple u8c_isspace( char32_t const chr); /* Is space */ -extern struct u8c_issurro_tuple u8c_issurro( char32_t const chr); /* Is surrogate point */ -extern struct u8c_isupper_tuple u8c_isupper( char32_t const chr); /* Is uppercase */ -extern struct u8c_isxdigit_tuple u8c_isxdigit(char32_t const chr); /* Is hexadecimal digit */ -/* Constants & Variables: */ -/* Macros: */ -# endif diff --git a/include/u8c/err.h b/include/u8c/err.h deleted file mode 100644 index 26d4b2f..0000000 --- a/include/u8c/err.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - 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_hdr_err) -# define u8c_hdr_err -# include <stdbool.h> -# include <stddef.h> -# include <uchar.h> -/* Enumerations: */ -enum u8c_errtyp { - u8c_errtyp_badalloc, /* Bad allocation */ - u8c_errtyp_badio, /* Bad input or output */ - u8c_errtyp_stroor, /* 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_all, /* All */ -}; -/* Type definitions: */ -typedef void (* u8c_errhandltyp)(enum u8c_errtyp); /* Error handler type */ -/* Structures: */ -struct u8c_geterr_tuple { - char32_t const * err; - size_t errsz; - bool stat; -}; -struct u8c_regerrhandl_tuple { - bool stat; -}; -struct u8c_seterr_tuple { - bool stat; -}; -/* Functions: */ -extern struct u8c_geterr_tuple u8c_geterr( void); /* Get error */ -extern struct u8c_regerrhandl_tuple u8c_regerrhandl(enum u8c_errtyp typ,u8c_errhandltyp errhandl); /* Register error handler */ -extern struct u8c_seterr_tuple u8c_seterr( enum u8c_errtyp typ,char32_t const * const restrict msg); /* Set error */ -/* Constants & Variables: */ -/* Macros: */ -# endif diff --git a/include/u8c/fmt.h b/include/u8c/fmt.h deleted file mode 100644 index 5ddfb02..0000000 --- a/include/u8c/fmt.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - 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_hdr_fmt) -# define u8c_hdr_fmt -# include <stdarg.h> -# include <stdbool.h> -# include <stddef.h> -# include <stdint.h> -# include <stdio.h> -# include <uchar.h> -/* Enumerations: */ -enum u8c_fmttyp { - u8c_fmttyp_bgcol, /* Background colour (uint_least32_t) */ - u8c_fmttyp_bgcol0, /* Background colour #0 */ - u8c_fmttyp_bool, /* Boolean (bool) */ - u8c_fmttyp_byt, /* Byte (char) */ - u8c_fmttyp_chr, /* Character (uint_least32_t) */ - u8c_fmttyp_fgcol, /* Foreground colour (uint_least32_t) */ - u8c_fmttyp_fgcol0, /* Foreground colour #0 */ - u8c_fmttyp_int, /* Integer (int) */ - u8c_fmttyp_int16, /* Integer 16 bit (int_least16_t) */ - u8c_fmttyp_int32, /* Integer 32 bit (int_least32_t) */ - u8c_fmttyp_int64, /* Integer 64 bit (int_least64_t) */ - u8c_fmttyp_int8, /* Integer 8 bit (int_least8_t) */ - u8c_fmttyp_llong, /* Long long (long long) */ - u8c_fmttyp_long, /* Long (long) */ - u8c_fmttyp_sbyt, /* Signed byte (signed char) */ - u8c_fmttyp_shrt, /* Short (short) */ - u8c_fmttyp_str, /* String (char32_t const *) */ - u8c_fmttyp_sz, /* Size (size_t) */ - u8c_fmttyp_tm, /* Time (uint_least64_t) */ - u8c_fmttyp_ubyt, /* Unsigned byte (unsigned char) */ - u8c_fmttyp_uint, /* Unsigned integer (unsigned int) */ - u8c_fmttyp_uint16, /* Unsigned integer 16 bit (uint_least16_t) */ - u8c_fmttyp_uint32, /* Unsigned integer 32 bit (uint_least32_t) */ - u8c_fmttyp_uint64, /* Unsigned integer 64 bit (uint_least64_t) */ - u8c_fmttyp_uint8, /* Unsigned integer 8 bit (uint_least8_t) */ - u8c_fmttyp_ulong, /* Unsigned long (unsigned long) */ - u8c_fmttyp_ullong, /* Unsigned long long (unsigned long long) */ - u8c_fmttyp_ushrt, /* Unsigned short (unsigned short) */ -}; -/* Type definitions: */ -/* Structures: */ -struct u8c_fmt_tuple { - char32_t const * str; - size_t strsz; - bool stat; -}; -struct u8c_print_tuple { - bool stat; -}; -struct u8c_println_tuple { - bool stat; -}; -struct u8c_setfmt_tuple { - bool stat; -}; -struct u8c_vfmt_tuple { - char32_t const * str; - size_t strsz; - bool stat; -}; -struct u8c_vprint_tuple { - bool stat; -}; -/* Functions: */ -extern struct u8c_fmt_tuple u8c_fmt( char32_t const * const restrict in, ...); /* Format */ -extern struct u8c_print_tuple u8c_print( FILE * restrict fp, char32_t const * const restrict msg, ...); /* Print */ -extern struct u8c_println_tuple u8c_println(FILE * restrict fp, char32_t const * const restrict msg, ...); /* Print line */ -extern struct u8c_setfmt_tuple u8c_setfmt( uint_least8_t const base,bool const endian); /* Set format */ -extern struct u8c_vfmt_tuple u8c_vfmt( char32_t const * const restrict in, va_list args); /* Variadic format */ -extern struct u8c_vprint_tuple u8c_vprint( FILE * restrict fp, char32_t const * const restrict msg, va_list args); /* Variadic print */ -/* Constants & Variables: */ -static uint_least32_t const u8c_col_azure = UINT32_C(0x3DA9E1); -static uint_least32_t const u8c_col_ash = UINT32_C(0xD2D2CC); -static uint_least32_t const u8c_col_black = UINT32_C(0x444747); -static uint_least32_t const u8c_col_blue = UINT32_C(0x3D3DE1); -static uint_least32_t const u8c_col_chartreuse = UINT32_C(0xA9E13D); -static uint_least32_t const u8c_col_cyan = UINT32_C(0x3DE1E1); -static uint_least32_t const u8c_col_green = UINT32_C(0x3ED13D); -static uint_least32_t const u8c_col_magenta = UINT32_C(0xE13DE1); -static uint_least32_t const u8c_col_mint = UINT32_C(0x3DE1A9); -static uint_least32_t const u8c_col_orange = UINT32_C(0xE1A93D); -static uint_least32_t const u8c_col_red = UINT32_C(0xE13D3D); -static uint_least32_t const u8c_col_rose = UINT32_C(0xE13DA9); -static uint_least32_t const u8c_col_silver = UINT32_C(0x9CA1A1); -static uint_least32_t const u8c_col_violet = UINT32_C(0xA93dE1); -static uint_least32_t const u8c_col_white = UINT32_C(0xF8F8F1); -static uint_least32_t const u8c_col_yellow = UINT32_C(0xE1E13D); -/* Macros: */ -# if defined(NDEBUG) -/* Debug print */ -# define u8c_dbgprint(...) ((void)0x0) -# else -# define u8c_dbgprint(...) u8c_println(stderr,__VA_ARGS__) -# endif -# endif diff --git a/include/u8c/intern.h b/include/u8c/intern.h deleted file mode 100644 index 4549337..0000000 --- a/include/u8c/intern.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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 -# if defined(u8c_bethrdsafe) && defined(__STDC_NO_THREADS__) -# error u8c is set to be thread-safe, but the implementation does not support multithreading. -# endif -# include <stdbool.h> -# include <stddef.h> -# include <stdint.h> -# include <uchar.h> -# include <u8c/err.h> -# if defined(u8c_bethrdsafe) -# include <threads.h> -# endif -/* Enumerations: */ -/* Type definitions: */ -/* Structures: */ -struct u8c_dattyp { /* Data type */ - char32_t const * err; /* Error */ - u8c_errhandltyp errhandls[(size_t)u8c_errtyp_all]; /* Error handlers */ - uint_least8_t fmtbase; /* Format base */ - bool fmtendian; /* Format endian */ - uint_least8_t stat; /* Status */ -# if defined(u8c_bethrdsafe) - mtx_t errhandlslock; /* Error handlers lock */ - mtx_t errlock; /* Error lock */ - mtx_t fmtlock; /* Format lock */ - mtx_t outlock; /* Output lock */ -# endif -}; -/* Functions: */ -/* Constants & Variables: */ -extern struct u8c_dattyp u8c_dat; /* Data */ -/* Macros: */ -# endif diff --git a/include/u8c/main.h b/include/u8c/main.h deleted file mode 100644 index 4004550..0000000 --- a/include/u8c/main.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - 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_hdr_main) -# define u8c_hdr_main -# include <stdbool.h> -# include <stddef.h> -# include <stdint.h> -# include <stdnoreturn.h> -# include <uchar.h> -/* Enumerations: */ -/* Type definitions: */ -/* Structures: */ -struct u8c_end_tuple { - bool stat; -}; -struct u8c_init_tuple { - bool stat; -}; -struct u8c_uniblk_tuple { - char32_t const * blk; - size_t blksz; - bool stat; -}; -struct u8c_uninm_tuple { - char32_t const * nm; - size_t nmsz; - bool stat; -}; -/* Functions: */ -noreturn extern void u8c_abrtfn(char const * const restrict fl, long const ln,char const * const restrict fn,char const * const restrict why); /* Abort function */ -extern struct u8c_end_tuple u8c_end( void); /* End */ -extern struct u8c_init_tuple u8c_init( void); /* Initialise */ -extern struct u8c_uniblk_tuple u8c_uniblk(char32_t const chr); /* Unicode block */ -extern struct u8c_uninm_tuple u8c_uninm( char32_t const chr); /* Unicode name */ -/* Constants & Variables: */ -extern bool const u8c_dbg; /* Debug */ -extern bool const u8c_thrdsafe; /* Thread-safe */ -static char32_t const u8c_unimax = U'\U0010FFFF'; /* Unicode maximum */ -static uint_least64_t const u8c_ver = UINT64_C(0x1A); /* Version */ -/* Macros: */ -# define u8c_abrt(why) u8c_abrtfn(__FILE__,(long)__LINE__,__func__,why) /* Abort */ -# endif diff --git a/include/u8c/str.h b/include/u8c/str.h deleted file mode 100644 index eecea26..0000000 --- a/include/u8c/str.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - 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_hdr_str) -# define u8c_hdr_str -# include <stdbool.h> -# include <stddef.h> -# include <stdint.h> -# include <uchar.h> -/* Enumerations: */ -/* Type definitions: */ -/* Structures: */ -struct u8c_stralloc_tuple { - bool stat; - char32_t * str; -}; -struct u8c_strcat_tuple { - bool stat; - char32_t const * str; - size_t strsz; -}; -struct u8c_strcmp_tuple { - bool stat; - uint_least8_t res; -}; -struct u8c_strcp_tuple { - bool stat; - char32_t const * str; - size_t strsz; -}; -struct u8c_strfndchr_tuple { - size_t pos; - bool stat; -}; -struct u8c_strfndpat_tuple { - size_t pos; - bool stat; -}; -struct u8c_strfree_tuple { - bool stat; -}; -struct u8c_strins_tuple { - bool stat; - char32_t const * str; - size_t strsz; -}; -struct u8c_strsubstr_tuple { - bool stat; - char32_t const * str; - size_t strsz; -}; -struct u8c_strsz_tuple { - bool stat; - size_t sz; -}; -/* Functions: */ -extern struct u8c_stralloc_tuple u8c_stralloc( size_t const sz); /* String allocate */ -extern struct u8c_strcat_tuple u8c_strcat( char32_t const * const restrict str, char32_t const * const rstr); /* String concatenate */ -extern struct u8c_strcmp_tuple u8c_strcmp( char32_t const * const restrict lstr,char32_t const * const restrict rstr); /* String compare */ -extern struct u8c_strcp_tuple u8c_strcp( char32_t const * const restrict in); /* String copy */ -extern struct u8c_strfndchr_tuple u8c_strfndchr(char32_t const * const restrict in, char32_t const chr); /* String find character */ -extern struct u8c_strfndpat_tuple u8c_strfndpat(char32_t const * const restrict in, char32_t const * const restrict pat); /* String find pattern */ -extern struct u8c_strfree_tuple u8c_strfree( char32_t const * const restrict str); /* String free */ -extern struct u8c_strins_tuple u8c_strins( size_t const pos, char32_t const * const restrict str0,char32_t const * const restrict str1); /* String insert */ -extern struct u8c_strsubstr_tuple u8c_strsubstr(size_t const start,size_t const len, char32_t const * const restrict in); /* String sub-string */ -extern struct u8c_strsz_tuple u8c_strsz( char32_t const * const restrict in); /* String size */ -/* Constants & Variables: */ -/* Macros: */ -# endif diff --git a/include/u8c/u16.h b/include/u8c/u16.h deleted file mode 100644 index 629d39a..0000000 --- a/include/u8c/u16.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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_hdr_u16) -# define u8c_hdr_u16 -# include <stdbool.h> -# include <stddef.h> -# include <uchar.h> -/* Enumerations: */ -/* Type definitions: */ -/* Structures: */ -struct u8c_u16alloc_tuple { - bool stat; - char16_t * u16; -}; -struct u8c_u16free_tuple { - bool stat; -}; -/* Functions: */ -extern struct u8c_u16alloc_tuple u8c_u16alloc(size_t const sz); /* UTF-16 allocate */ -extern struct u8c_u16free_tuple u8c_u16free( char16_t const * const restrict u16); /* UTF-16 free */ -/* Constants & Variables: */ -/* Macros: */ -# endif diff --git a/include/u8c/u8.h b/include/u8c/u8.h deleted file mode 100644 index c7b6cc5..0000000 --- a/include/u8c/u8.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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_hdr_u8) -# define u8c_hdr_u8 -# include <stdbool.h> -# include <stddef.h> -# include <uchar.h> -/* Enumerations: */ -/* Type definitions: */ -/* Structures: */ -struct u8c_u8alloc_tuple { - bool stat; - unsigned char * u8; -}; -struct u8c_u8dec_tuple { - bool stat; - char32_t const * str; - size_t strsz; -}; -struct u8c_u8enc_tuple { - bool stat; - unsigned char const * u8; - size_t u8sz; -}; -struct u8c_u8free_tuple { - bool stat; -}; -/* Functions: */ -extern struct u8c_u8alloc_tuple u8c_u8alloc(size_t const sz); /* UTF-8 allocate */ -extern struct u8c_u8dec_tuple u8c_u8dec( unsigned char const * const restrict u8); /* UTF-8 decode */ -extern struct u8c_u8enc_tuple u8c_u8enc( char32_t const * const restrict u8); /* UTF-8 encode */ -extern struct u8c_u8free_tuple u8c_u8free( unsigned char const * const restrict u8); /* UTF-8 free */ -/* Constants & Variables: */ -/* Macros: */ -# endif |