summaryrefslogtreecommitdiff
path: root/support/dktools/dk4strd.c
blob: 88f5e64678ae76fd25f747dca188cb3f50ceb185 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
/*
Copyright (C) 2015-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: dk4strd.ctr
*/

/**	@file dk4strd.c The dk4strd module.
*/


#line 405 "dk4strd.ctr"


#include "dk4conf.h"
#include "dk4strd.h"

#if DK4_CHAR_SIZE > 1
#ifndef DK4STRW_H_INCLUDED
#include "dk4strw.h"
#endif
#else
#ifndef DK4STR8_H_INCLUDED
#include "dk4str8.h"
#endif
#endif


int
dk4str_cpy_s(dkChar *dst, size_t sz, const dkChar *src, dk4_er_t *erp)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_cpy_s(dst, sz, src, erp));
#else
  return (dk4str8_cpy_s(dst, sz, src, erp));
#endif
}



int
dk4str_cat_s(dkChar *dst, size_t sz, const dkChar *src, dk4_er_t *erp)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_cat_s(dst, sz, src, erp));
#else
  return (dk4str8_cat_s(dst, sz, src, erp));
#endif
}



void
dk4str_cpy_to_left(dkChar *dst, const dkChar *src)
{
#if DK4_CHAR_SIZE > 1
  dk4strw_cpy_to_left(dst, src);
#else
  dk4str8_cpy_to_left(dst, src);
#endif
}



size_t
dk4str_len(const dkChar *src)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_len(src));
#else
  return (dk4str8_len(src));
#endif
}



int
dk4str_cmp(const dkChar *s1, const dkChar *s2)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_cmp(s1, s2));
#else
  return (dk4str8_cmp(s1, s2));
#endif
}



int
dk4str_ncmp(const dkChar *s1, const dkChar *s2, size_t n)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_ncmp(s1, s2, n));
#else
  return (dk4str8_ncmp(s1, s2, n));
#endif
}


int
dk4str_casecmp(const dkChar *s1, const dkChar *s2)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_casecmp(s1, s2));
#else
  return (dk4str8_casecmp(s1, s2));
#endif
}



dkChar *
dk4str_sep(dkChar **stringp, const dkChar *delim)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_sep(stringp, delim));
#else
  return (dk4str8_sep(stringp, delim));
#endif
}



dkChar *
dk4str_start(const dkChar *src, const dkChar *delim)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_start(src, delim));
#else
  return (dk4str8_start(src, delim));
#endif
}



dkChar *
dk4str_next(dkChar *src, const dkChar *delim)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_next(src, delim));
#else
  return (dk4str8_next(src, delim));
#endif
}



size_t
dk4str_tokenize(
  dkChar **dpp, size_t szdpp, dkChar *src, const dkChar *delim, dk4_er_t *erp
)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_tokenize(dpp, szdpp, src, delim, erp));
#else
  return (dk4str8_tokenize(dpp, szdpp, src, delim, erp));
#endif
}



void
dk4str_normalize(dkChar *src, const dkChar *delim)
{
#if DK4_CHAR_SIZE > 1
  dk4strw_normalize(src, delim);
#else
  dk4str8_normalize(src, delim);
#endif
}



#if (defined(_WIN32) && DK4_USE_WINDOWS_LOCAL_ALLOC) \
    || (DK4_HAVE_MALLOC && DK4_HAVE_FREE)

dkChar *
dk4str_dup(const dkChar *src, dk4_er_t *erp)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_dup(src, erp));
#else
  return (dk4str8_dup(src, erp));
#endif
}

#endif
/* if (defined(_WIN32) ... */



int
dk4str_array_index(const dkChar * const *arr, const dkChar *str, int cs)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_array_index(arr, str, cs));
#else
  return (dk4str8_array_index(arr, str, cs));
#endif
}



int
dk4str_is_abbr(const dkChar *str, const dkChar *pattern, dkChar spec, int cs)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_is_abbr(str, pattern, spec, cs));
#else
  return (dk4str8_is_abbr(str, pattern, spec, cs));
#endif
}



int
dk4str_abbr_index(
  const dkChar * const	*arr,
  dkChar		 spec,
  const dkChar		*str,
  int cs
)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_abbr_index(arr, spec, str, cs));
#else
  return (dk4str8_abbr_index(arr, spec, str, cs));
#endif
}



int
dk4str_is_bool(const dkChar *str)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_is_bool(str));
#else
  return (dk4str8_is_bool(str));
#endif
}



int
dk4str_is_on(const dkChar *str)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_is_on(str));
#else
  return (dk4str8_is_on(str));
#endif
}



dkChar *
dk4str_chr(const dkChar *s, dkChar c)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_chr(s,  c));
#else
  return (dk4str8_chr(s, c));
#endif
}



dkChar *
dk4str_rchr(const dkChar *s, dkChar c)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_rchr(s, c));
#else
  return (dk4str8_rchr(s, c));
#endif
}



int
dk4str_pathcmp(const dkChar *s1, const dkChar *s2)
{
#if DK4_HAVE_CASE_INSENSITIVE_PATHNAMES
  return (dk4str_casecmp(s1, s2));
#else
  return (dk4str_cmp(s1, s2));
#endif
}



void
dk4str_rtwh(dkChar *str, const dkChar *whsp)
{
#if DK4_CHAR_SIZE > 1
  dk4strw_rtwh(str, whsp);
#else
  dk4str8_rtwh(str, whsp);
#endif
}



void
dk4str_delnl(dkChar *lptr)
{
#if DK4_CHAR_SIZE > 1
  dk4strw_delnl(lptr);
#else
  dk4str8_delnl(lptr);
#endif
}



const dkChar *
dk4str_skip(const dkChar *line, size_t skip)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_skip(line, skip));
#else
  return (dk4str8_skip(line, skip));
#endif
}




int
dk4str_sanitize(dkChar *str)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_sanitize(str));
#else
  return (dk4str8_sanitize(str));
#endif
}



int
dk4str_buffer_sanitize(dkChar *str, size_t sz)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_buffer_sanitize(str, sz));
#else
  return (dk4str8_buffer_sanitize(str, sz));
#endif
}



int
dk4str_free_sanitized(dkChar *str)
{
#if DK4_CHAR_SIZE > 1
  return (dk4strw_free_sanitized(str));
#else
  return (dk4str8_free_sanitized(str));
#endif
}