1#ifndef NOTCURSES_EGCPOOL
2#define NOTCURSES_EGCPOOL
16#include "compat/compat.h"
35#define POOL_MINIMUM_ALLOC BUFSIZ
36#define POOL_MAXIMUM_BYTES (1 << 24)
49 if(newsize < pool->poolsize){
56 if(newsize * 2 < newsize){
65 char* tmp = (
char*)realloc(pool->
pool, newsize);
80utf8_codepoint_length(
unsigned char c){
104utf8_egc_len(
const char* gcluster,
int* colcount){
109 memset(&mbt, 0,
sizeof(mbt));
110 wchar_t wc, prevw = 0;
113 r = mbrtowc(&wc, gcluster, MB_LEN_MAX, &mbt);
116 logerror(
"invalid UTF8: %s", gcluster);
119 if(prevw && !injoin && uc_is_grapheme_break(prevw, wc)){
123 if(uc_is_property_variation_selector(wc)){
126 }
else if(wc == L
'\u200d' || injoin){
139 logerror(
"prohibited or invalid unicode: 0x%08x", (
unsigned)wc);
168egcpool_release(
egcpool* pool,
int offset){
170 while(pool->pool[offset]){
171 pool->pool[offset] =
'\0';
174 assert(offset < pool->poolsize);
176 pool->poolused -= freed;
188static inline uint32_t
195cell_extended_p(
const nccell*
c){
202 return !cell_extended_p(
c);
209 uint32_t
idx = cell_egc_idx(
c);
#define POOL_MAXIMUM_BYTES
__attribute__((nonnull(1, 2))) int egcpool_stash(egcpool *pool
#define POOL_MINIMUM_ALLOC
#define logerror(fmt,...)
API int API int const nccell unsigned len