Mercurial > hg > nnchat
annotate th_string.h @ 272:a44d1c720255
Bump version to 0.8.14.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 03 Jun 2011 14:01:27 +0300 |
parents | 51319822ae92 |
children | 3dc86d8eb0a9 |
rev | line source |
---|---|
0 | 1 /* |
2 * Miscellaneous string-handling related utility-functions | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
249 | 4 * (C) Copyright 2002-2011 Tecnic Software productions (TNSP) |
0 | 5 * |
6 * Please read file 'COPYING' for information on license and distribution. | |
7 */ | |
8 #ifndef _TH_STRING_H | |
9 #define _TH_STRING_H | |
10 | |
11 #ifdef __cplusplus | |
12 extern "C" { | |
13 #endif | |
14 | |
15 #include "th_util.h" | |
16 #include <stdlib.h> | |
17 #include <ctype.h> | |
124 | 18 #include <stdarg.h> |
0 | 19 |
11 | 20 /* Macros |
0 | 21 */ |
81 | 22 #define th_isalnum(c) isalnum((int)(unsigned char) c) |
23 #define th_isalpha(c) isalpha((int)(unsigned char) c) | |
24 #define th_isascii(c) isascii((int)(unsigned char) c) | |
25 #define th_isblank(c) isblank((int)(unsigned char) c) | |
26 #define th_iscntrl(c) iscntrl((int)(unsigned char) c) | |
27 #define th_isdigit(c) isdigit((int)(unsigned char) c) | |
28 #define th_isgraph(c) isgraph((int)(unsigned char) c) | |
29 #define th_islower(c) islower((int)(unsigned char) c) | |
30 #define th_isprint(c) isprint((int)(unsigned char) c) | |
31 #define th_ispunct(c) ispunct((int)(unsigned char) c) | |
32 #define th_isspace(c) isspace((int)(unsigned char) c) | |
33 #define th_isupper(c) isupper((int)(unsigned char) c) | |
34 #define th_isxdigit(c) isxdigit((int)(unsigned char) c) | |
35 #define th_iscrlf(c) ((c=='\r')||(c=='\n')) | |
0 | 36 |
81 | 37 #define th_isspecial(q) (((q >= 0x5b) && (q <= 0x60)) || ((q >= 0x7b) && (q <= 0x7d))) |
0 | 38 |
81 | 39 #define th_tolower(c) tolower((int)(unsigned char) c) |
40 #define th_toupper(c) toupper((int)(unsigned char) c) | |
0 | 41 |
42 | |
11 | 43 /* Normal NUL-terminated string functions |
0 | 44 */ |
81 | 45 char *th_strncpy(char *, const char *, size_t); |
124 | 46 int th_strcasecmp(const char *, const char *); |
47 int th_strncasecmp(const char *, const char *, size_t); | |
81 | 48 void th_strip_ctrlchars(char *); |
0 | 49 |
124 | 50 char *th_strdup_vprintf(const char *, va_list); |
51 char *th_strdup_printf(const char *, ...); | |
52 | |
79 | 53 char *th_strdup(const char *); |
124 | 54 int th_pstrcpy(char **, const char *); |
55 int th_pstrcat(char **, const char *); | |
0 | 56 |
124 | 57 const char *th_findnext(const char *, size_t *); |
58 const char *th_findsep(const char *, size_t *, char); | |
59 const char *th_findseporspace(const char *, size_t *, char); | |
11 | 60 |
124 | 61 BOOL th_strmatch(const char *, const char *); |
62 BOOL th_strcasematch(const char *, const char *); | |
11 | 63 |
131
3896861974ac
Added th_get_hex_triplet().
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
64 int th_get_hex_triplet(const char *); |
0 | 65 |
241
a1ee6c76ca1c
Functions for growing a string buffer when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
66 |
a1ee6c76ca1c
Functions for growing a string buffer when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
67 void th_vputch(char **buf, size_t *bufsize, size_t *len, const char ch); |
a1ee6c76ca1c
Functions for growing a string buffer when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
68 void th_vputs(char **buf, size_t *bufsize, size_t *len, const char *str); |
a1ee6c76ca1c
Functions for growing a string buffer when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
69 |
a1ee6c76ca1c
Functions for growing a string buffer when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
70 #define TH_BUFGROW (32) |
a1ee6c76ca1c
Functions for growing a string buffer when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
71 |
0 | 72 #ifdef __cplusplus |
73 } | |
74 #endif | |
75 #endif /* _TH_STRING_H */ |