Edinburgh Speech Tools  2.1-release
string16.h
Go to the documentation of this file.
1 /*************************************************************************/
2 /* */
3 /* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */
4 /* University of Edinburgh. */
5 /* */
6 /* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */
7 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
8 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
9 /* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */
10 /* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */
11 /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */
12 /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
13 /* */
14 /*************************************************************************/
15 #ifndef STRING16_H
16 #define STRING16_H
17 
18 #ifndef FOR_LT
19 #define STD_API
20 #define WIN_IMP
21 #endif
22 
23 #include "charset.h"
24 #include <stddef.h> /* for size_t */
25 
26 /* String functions */
27 #include <string.h>
28 #if 0
29 /* Don't want to include string.h while testing */
30 
31 int strcmp(const char *, const char *);
32 WIN_IMP int strncmp(const char *, const char *, size_t);
33 int strcasecmp(const char *, const char *);
34 size_t strlen(const char *);
35 WIN_IMP char *strchr(const char *, int);
36 char *strcpy(char *, const char *);
37 WIN_IMP char *strncpy(char *, const char *, size_t);
38 char *strcat(char *, const char *);
39 WIN_IMP char *strstr(const char *, const char *);
40 int memcmp(const void *, const void *, size_t);
41 #ifndef memcpy
42 void *memcpy(void *, const void *, size_t);
43 #endif
44 void *memset(void *, int, size_t);
45 WIN_IMP size_t strspn(const char *, const char *);
46 WIN_IMP size_t strcspn(const char *, const char *);
47 #endif
48 
49 STD_API char8 *strdup8(const char8 *s);
50 #define strchr8(s, c)strchr((s), c)
51 #define strlen8(s) strlen((s))
52 #define strcmp8(s1, s2) strcmp((s1), (s2))
53 #define strncmp8(s1, s2, n) strncmp((s1), (s2), n)
54 #define strcpy8(s1, s2) strcpy((s1), (s2))
55 #define strncpy8(s1, s2, n) strncpy((s1), (s2), n)
56 
57 #define strcat8(s1, s2) strcat((s1), (s2))
58 STD_API int strcasecmp8(const char8 *, const char8 *);
59 STD_API int strncasecmp8(const char8 *, const char8 *, size_t);
60 #define strstr8(s1, s2) strstr(s1, s2)
61 
62 STD_API char16 *strdup16(const char16 *s);
63 STD_API char16 *strchr16(const char16 *, int);
64 STD_API size_t strlen16(const char16 *);
65 STD_API int strcmp16(const char16 *, const char16 *);
66 STD_API int strncmp16(const char16 *, const char16 *, size_t);
67 STD_API char16 *strcpy16(char16 *, const char16 *);
68 STD_API char16 *strncpy16(char16 *, const char16 *, size_t);
69 STD_API char16 *strcat16(char16 *, const char16 *);
70 STD_API int strcasecmp16(const char16 *, const char16 *);
71 STD_API int strncasecmp16(const char16 *, const char16 *, size_t);
72 STD_API char16 *strstr16(const char16 *, const char16 *);
73 
76 
77 #if CHAR_SIZE == 8
78 
79 #define Strdup strdup8
80 #define Strchr strchr8
81 #define Strlen strlen8
82 #define Strcmp strcmp8
83 #define Strncmp strncmp8
84 #define Strcpy strcpy8
85 #define Strncpy strncpy8
86 #define Strcat strcat8
87 #define Strcasecmp strcasecmp8
88 #define Strncasecmp strncasecmp8
89 #define Strstr strstr8
90 
91 #define char8toChar(x) (x)
92 #define Chartochar8(x) (x)
93 
94 #else
95 
96 #define Strdup strdup16
97 #define Strchr strchr16
98 #define Strlen strlen16
99 #define Strcmp strcmp16
100 #define Strncmp strncmp16
101 #define Strcpy strcpy16
102 #define Strncpy strncpy16
103 #define Strcat strcat16
104 #define Strcasecmp strcasecmp16
105 #define Strncasecmp strncasecmp16
106 #define Strstr strstr16
107 
108 #define char8toChar char8tochar16
109 #define Chartochar8 char16tochar8
110 
111 #endif
112 
113 #endif /* STRING16_H */
STD_API int strncasecmp16(const char16 *, const char16 *, size_t)
Definition: string16.c:259
STD_API char16 * strncpy16(char16 *, const char16 *, size_t)
Definition: string16.c:146
STD_API int strcasecmp8(const char8 *, const char8 *)
Definition: string16.c:33
STD_API char16 * char8tochar16(const char8 *s)
Definition: string16.c:99
STD_API char16 * strcat16(char16 *, const char16 *)
STD_API char16 * strcpy16(char16 *, const char16 *)
Definition: string16.c:135
unsigned short char16
Definition: charset.h:32
#define WIN_IMP
Definition: string16.h:20
STD_API char16 * strdup16(const char16 *s)
Definition: string16.c:158
STD_API size_t strlen16(const char16 *)
Definition: string16.c:173
STD_API char16 * strstr16(const char16 *, const char16 *)
Definition: string16.c:284
STD_API int strncasecmp8(const char8 *, const char8 *, size_t)
Definition: string16.c:54
STD_API int strcasecmp16(const char16 *, const char16 *)
Definition: string16.c:238
#define STD_API
Definition: string16.h:19
STD_API char8 * char16tochar8(const char16 *s)
Definition: string16.c:118
STD_API int strcmp16(const char16 *, const char16 *)
Definition: string16.c:192
STD_API char16 * strchr16(const char16 *, int)
Definition: string16.c:183
char char8
Definition: charset.h:31
STD_API char8 * strdup8(const char8 *s)
Definition: string16.c:77
STD_API int strncmp16(const char16 *, const char16 *, size_t)
Definition: string16.c:213