Mercurial > hg > nnchat
view th_string.h @ 322:b9c15c57dc8f
Clean up message functions, add new printMsgQ() helper function for messages that should not
go into the log file. Add skeleton help function, accessible via F1 key. And other cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 11 Jun 2011 09:48:26 +0300 |
parents | eb74097b73f5 |
children | fae4651d37bc |
line wrap: on
line source
/* * Miscellaneous string-handling related utility-functions * Programmed and designed by Matti 'ccr' Hamalainen * (C) Copyright 2002-2011 Tecnic Software productions (TNSP) * * Please read file 'COPYING' for information on license and distribution. */ #ifndef _TH_STRING_H #define _TH_STRING_H #ifdef __cplusplus extern "C" { #endif #include "th_util.h" #include <stdlib.h> #include <ctype.h> #include <stdarg.h> /* Macros */ #define th_isalnum(c) isalnum((int)(unsigned char) c) #define th_isalpha(c) isalpha((int)(unsigned char) c) #define th_isascii(c) isascii((int)(unsigned char) c) #define th_isblank(c) isblank((int)(unsigned char) c) #define th_iscntrl(c) iscntrl((int)(unsigned char) c) #define th_isdigit(c) isdigit((int)(unsigned char) c) #define th_isgraph(c) isgraph((int)(unsigned char) c) #define th_islower(c) islower((int)(unsigned char) c) #define th_isprint(c) isprint((int)(unsigned char) c) #define th_ispunct(c) ispunct((int)(unsigned char) c) #define th_isspace(c) isspace((int)(unsigned char) c) #define th_isupper(c) isupper((int)(unsigned char) c) #define th_isxdigit(c) isxdigit((int)(unsigned char) c) #define th_iscrlf(c) ((c=='\r')||(c=='\n')) #define th_isspecial(q) (((q >= 0x5b) && (q <= 0x60)) || ((q >= 0x7b) && (q <= 0x7d))) #define th_tolower(c) tolower((int)(unsigned char) c) #define th_toupper(c) toupper((int)(unsigned char) c) /* Normal NUL-terminated string functions */ char *th_strncpy(char *, const char *, size_t); int th_strcasecmp(const char *, const char *); int th_strncasecmp(const char *, const char *, size_t); void th_strip_ctrlchars(char *); char *th_strdup_vprintf(const char *, va_list); char *th_strdup_printf(const char *, ...); void th_pstr_vprintf(char **, const char *, va_list); void th_pstr_printf(char **, const char *, ...); char *th_strdup(const char *); int th_pstrcpy(char **, const char *); int th_pstrcat(char **, const char *); const char *th_findnext(const char *, size_t *); const char *th_findsep(const char *, size_t *, char); const char *th_findseporspace(const char *, size_t *, char); BOOL th_strmatch(const char *, const char *); BOOL th_strcasematch(const char *, const char *); int th_get_hex_triplet(const char *); BOOL th_vputch(char **buf, size_t *bufsize, size_t *len, const char ch); BOOL th_vputs(char **buf, size_t *bufsize, size_t *len, const char *str); #define TH_BUFGROW (32) #ifdef __cplusplus } #endif #endif /* _TH_STRING_H */