X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=includes%2Fuchar.h;h=c061113e087855daed43f8b8124b41b030fb711e;hp=1419df66b128be4f3d8545f6cf241041d7482546;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=3f732ec3f85c5db7c563eba5fcb24a7ce69ec79e diff --git a/includes/uchar.h b/includes/uchar.h index 1419df6..c061113 100644 --- a/includes/uchar.h +++ b/includes/uchar.h @@ -1,19 +1,16 @@ -/* 7.28 +/* Unicode utilities - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. */ - #ifndef _PDCLIB_UCHAR_H -#define _PDCLIB_UCHAR_H -#include <_PDCLIB_encoding.h> -_PDCLIB_BEGIN_EXTERN_C +#define _PDCLIB_UCHAR_H _PDCLIB_UCHAR_H +#include "_PDCLIB_int.h" -/* This is mostly a placeholder. for now. This header will be completed by the - * release of 0.6, but at present merely exposes types needed by the rest of the - * library - */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef _PDCLIB_SIZE_T_DEFINED #define _PDCLIB_SIZE_T_DEFINED _PDCLIB_SIZE_T_DEFINED @@ -26,15 +23,46 @@ typedef _PDCLIB_mbstate_t mbstate_t; #endif #ifndef __cplusplus + +/* These are built-in types in C++ */ + #ifndef _PDCLIB_CHAR16_T_DEFINED #define _PDCLIB_CHAR16_T_DEFINED _PDCLIB_CHAR16_T_DEFINED -typedef _PDCLIB_char16_t char16_t; +typedef _PDCLIB_uint_least16_t char16_t; #endif #ifndef _PDCLIB_CHAR32_T_DEFINED #define _PDCLIB_CHAR32_T_DEFINED _PDCLIB_CHAR32_T_DEFINED -typedef _PDCLIB_char32_t char32_t; +typedef _PDCLIB_uint_least32_t char32_t; +#endif + #endif + +size_t mbrtoc16( char16_t * _PDCLIB_restrict pc16, const char * _PDCLIB_restrict s, size_t n, mbstate_t * _PDCLIB_restrict ps ); + +size_t c16rtomb( char * _PDCLIB_restrict s, char16_t c16, mbstate_t * _PDCLIB_restrict ps ); + +size_t mbrtoc32( char32_t * _PDCLIB_restrict pc32, const char * _PDCLIB_restrict s, size_t n, mbstate_t * _PDCLIB_restrict ps); + +size_t c32rtomb( char * _PDCLIB_restrict s, char32_t c32, mbstate_t * _PDCLIB_restrict ps); + +#if defined(_PDCLIB_EXTENSIONS) + +/* Analogous to strlen() / wcslen() */ + +size_t _PDCLIB_c16slen( const char16_t * str ); + +size_t _PDCLIB_c32slen( const char32_t * str ); + +/* String generalizations of the above functions */ + +size_t _PDCLIB_mbsrtoc16s( char16_t * _PDCLIB_restrict dst, const char * * _PDCLIB_restrict src, size_t len, mbstate_t * _PDCLIB_restrict ps ); + +size_t _PDCLIB_mbsrtoc32s( char32_t * _PDCLIB_restrict dst, const char * * _PDCLIB_restrict src, size_t len, mbstate_t * _PDCLIB_restrict ps ); + +size_t _PDCLIB_c16srtombs( char * _PDCLIB_restrict dst, const char16_t * * _PDCLIB_restrict src, size_t len, mbstate_t * _PDCLIB_restrict ps ); + +size_t _PDCLIB_c32srtombs( char * _PDCLIB_restrict dst, const char32_t * * _PDCLIB_restrict src, size_t len, mbstate_t * _PDCLIB_restrict ps ); #endif -#endif \ No newline at end of file +#endif