/* Simple extendable string. * I think this doesn't leak? */ #ifndef _EXSTRING_H #define _EXSTRING_H #include typedef struct { size_t currentSize; char cstr[]; } exStringOpt; typedef char* exString; #define EXS(s) (* (char**)(s)) typedef char (*exsp_select)(void* state, char mapchar); typedef int (*exsp_where)(void* state, char mapchar); exString* exs_new(const char* from); exString* exs_clone(exString* from); void exs_free(exString* str); void exs_nappend(exString* str, const char* from, size_t length); void exs_append(exString* str, const char* from); void exs_appendf(exString* str, const char* fmt, ...); size_t exs_realsize(exString* str); void exs_reduce(exString* str, size_t by); void exs_nappendc(exString* str, char c, int times); void exs_appendc(exString* str, char c); void exs_recalc(exString* str); void exs_reset(exString * str); exString* exs_where(exString* str, exsp_where func, void* state); exString* exs_select(exString *str, exsp_select func, void* state); void exs_whereip(exString* str, exsp_where, void* state); void exs_selectip(exString* str, exsp_select, void* state); char exspf_upper(void* state, char c); char exspf_lower(void* state, char c); int exspf_only(void* state, char c); int exspf_only_not(void* state, char c); #endif /* _EXSTRING_H */