0
|
1 /*
|
|
2 * Miscellaneous string-handling related utility-functions
|
|
3 * Programmed and designed by Matti 'ccr' Hamalainen
|
|
4 * (C) Copyright 2002-2008 Tecnic Software productions (TNSP)
|
|
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>
|
|
18
|
11
|
19 /* Macros
|
0
|
20 */
|
|
21 #define th_isalnum(c) isalnum((int)(unsigned char) c)
|
|
22 #define th_isalpha(c) isalpha((int)(unsigned char) c)
|
|
23 #define th_isascii(c) isascii((int)(unsigned char) c)
|
|
24 #define th_isblank(c) isblank((int)(unsigned char) c)
|
|
25 #define th_iscntrl(c) iscntrl((int)(unsigned char) c)
|
|
26 #define th_isdigit(c) isdigit((int)(unsigned char) c)
|
|
27 #define th_isgraph(c) isgraph((int)(unsigned char) c)
|
|
28 #define th_islower(c) islower((int)(unsigned char) c)
|
|
29 #define th_isprint(c) isprint((int)(unsigned char) c)
|
|
30 #define th_ispunct(c) ispunct((int)(unsigned char) c)
|
|
31 #define th_isspace(c) isspace((int)(unsigned char) c)
|
|
32 #define th_isupper(c) isupper((int)(unsigned char) c)
|
|
33 #define th_isxdigit(c) isxdigit((int)(unsigned char) c)
|
|
34 #define th_iscrlf(c) ((c=='\r')||(c=='\n'))
|
|
35
|
|
36 #define th_isspecial(q) (((q >= 0x5b) && (q <= 0x60)) || ((q >= 0x7b) && (q <= 0x7d)))
|
|
37
|
|
38 #define th_tolower(c) tolower((int)(unsigned char) c)
|
|
39 #define th_toupper(c) toupper((int)(unsigned char) c)
|
|
40
|
|
41
|
11
|
42 /* Normal NUL-terminated string functions
|
0
|
43 */
|
11
|
44 char *th_stralloc(size_t);
|
|
45 char *th_strrealloc(char *, size_t);
|
|
46 char *th_strdup(char *);
|
|
47 char *th_strncpy(char *, char *, size_t);
|
|
48 int th_strcasecmp(char *, char *);
|
|
49 int th_strncasecmp(char *, char *, size_t);
|
|
50 void th_strip_ctrlchars(char *);
|
0
|
51
|
11
|
52 int th_pstrcpy(char **, char *);
|
|
53 int th_pstrcat(char **, char *);
|
0
|
54
|
11
|
55 char *th_findnext(char *, size_t *);
|
|
56 char *th_findsep(char *, size_t *, char);
|
|
57 char *th_findseporspace(char *, size_t *, char);
|
|
58
|
|
59 BOOL th_strmatch(char *, char *);
|
|
60 BOOL th_strcasematch(char *, char *);
|
|
61
|
0
|
62
|
|
63 #ifdef __cplusplus
|
|
64 }
|
|
65 #endif
|
|
66 #endif /* _TH_STRING_H */
|