annotate th_string.h @ 79:e36df57c5b0f

Use th_strdup() again.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 24 Dec 2008 16:03:53 +0200
parents 4e3616709752
children 69aed051f84d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * Miscellaneous string-handling related utility-functions
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Programmed and designed by Matti 'ccr' Hamalainen
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * (C) Copyright 2002-2008 Tecnic Software productions (TNSP)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 *
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 * Please read file 'COPYING' for information on license and distribution.
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 */
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 #ifndef _TH_STRING_H
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #define _TH_STRING_H
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #ifdef __cplusplus
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 extern "C" {
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 #include "th_util.h"
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 #include <stdlib.h>
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 #include <ctype.h>
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
11
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
19 /* Macros
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 */
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 #define th_isalnum(c) isalnum((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 #define th_isalpha(c) isalpha((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #define th_isascii(c) isascii((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 #define th_isblank(c) isblank((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #define th_iscntrl(c) iscntrl((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 #define th_isdigit(c) isdigit((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 #define th_isgraph(c) isgraph((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 #define th_islower(c) islower((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 #define th_isprint(c) isprint((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 #define th_ispunct(c) ispunct((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #define th_isspace(c) isspace((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 #define th_isupper(c) isupper((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #define th_isxdigit(c) isxdigit((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #define th_iscrlf(c) ((c=='\r')||(c=='\n'))
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 #define th_isspecial(q) (((q >= 0x5b) && (q <= 0x60)) || ((q >= 0x7b) && (q <= 0x7d)))
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 #define th_tolower(c) tolower((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 #define th_toupper(c) toupper((int)(unsigned char) c)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41
11
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
42 /* Normal NUL-terminated string functions
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 */
11
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
44 char *th_stralloc(size_t);
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
45 char *th_strrealloc(char *, size_t);
48
4e3616709752 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
46 char *th_strncpy(char *, const char *, size_t);
11
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
47 int th_strcasecmp(char *, char *);
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
48 int th_strncasecmp(char *, char *, size_t);
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
49 void th_strip_ctrlchars(char *);
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
79
e36df57c5b0f Use th_strdup() again.
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
51 char *th_strdup(const char *);
e36df57c5b0f Use th_strdup() again.
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
52 int th_pstrcpy(char **, char *);
e36df57c5b0f Use th_strdup() again.
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
53 int th_pstrcat(char **, char *);
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54
11
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
55 char *th_findnext(char *, size_t *);
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
56 char *th_findsep(char *, size_t *, char);
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
57 char *th_findseporspace(char *, size_t *, char);
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
58
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
59 BOOL th_strmatch(char *, char *);
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
60 BOOL th_strcasematch(char *, char *);
707e35b03f89 Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
61
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 #ifdef __cplusplus
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 }
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 #endif /* _TH_STRING_H */