ucx/cx/string.h

changeset 22
112b85020dc9
parent 21
5ea41679e15d
equal deleted inserted replaced
21:5ea41679e15d 22:112b85020dc9
46 #define CX_PRIstr ".*s" 46 #define CX_PRIstr ".*s"
47 47
48 /** 48 /**
49 * The maximum length of the "needle" in cx_strstr() that can use SBO. 49 * The maximum length of the "needle" in cx_strstr() that can use SBO.
50 */ 50 */
51 cx_attr_export 51 CX_EXPORT extern const unsigned cx_strstr_sbo_size;
52 extern const unsigned cx_strstr_sbo_size;
53 52
54 /** 53 /**
55 * The UCX string structure. 54 * The UCX string structure.
56 */ 55 */
57 struct cx_mutstr_s { 56 struct cx_mutstr_s {
110 /** 109 /**
111 * Position of the currently active token in the source string. 110 * Position of the currently active token in the source string.
112 */ 111 */
113 size_t pos; 112 size_t pos;
114 /** 113 /**
115 * Position of next delimiter in the source string. 114 * Position of the next delimiter in the source string.
116 * 115 *
117 * If the tokenizer has not yet returned a token, the content of this field 116 * If the tokenizer has not yet returned a token, the content of this field
118 * is undefined. If the tokenizer reached the end of the string, this field 117 * is undefined. If the tokenizer reaches the end of the string, this field
119 * contains the length of the source string. 118 * contains the length of the source string.
120 */ 119 */
121 size_t delim_pos; 120 size_t delim_pos;
122 /** 121 /**
123 * The position of the next token in the source string. 122 * The position of the next token in the source string.
165 /** 164 /**
166 * Wraps a mutable string that must be zero-terminated. 165 * Wraps a mutable string that must be zero-terminated.
167 * 166 *
168 * The length is implicitly inferred by using a call to @c strlen(). 167 * The length is implicitly inferred by using a call to @c strlen().
169 * 168 *
169 * When @c NULL is passed, the length will be set to zero.
170 *
170 * @note the wrapped string will share the specified pointer to the string. 171 * @note the wrapped string will share the specified pointer to the string.
171 * If you do want a copy, use cx_strdup() on the return value of this function. 172 * If you do want a copy, use cx_strdup() on the return value of this function.
172 * 173 *
173 * If you need to wrap a constant string, use cx_str(). 174 * If you need to wrap a constant string, use cx_str().
174 * 175 *
175 * @param cstring the string to wrap, must be zero-terminated 176 * @param cstring the string to wrap (must be zero-terminated)
176 * @return the wrapped string 177 * @return the wrapped string
177 * 178 *
178 * @see cx_mutstrn() 179 * @see cx_mutstrn()
179 */ 180 */
180 cx_attr_nonnull 181 cx_attr_nodiscard cx_attr_cstr_arg(1)
181 cx_attr_nodiscard 182 CX_EXPORT cxmutstr cx_mutstr(char *cstring);
182 cx_attr_cstr_arg(1)
183 cx_attr_export
184 cxmutstr cx_mutstr(char *cstring);
185 183
186 /** 184 /**
187 * Wraps a string that does not need to be zero-terminated. 185 * Wraps a string that does not need to be zero-terminated.
188 * 186 *
189 * The argument may be @c NULL if the length is zero. 187 * The argument may be @c NULL if the length is zero.
197 * @param length the length of the string 195 * @param length the length of the string
198 * @return the wrapped string 196 * @return the wrapped string
199 * 197 *
200 * @see cx_mutstr() 198 * @see cx_mutstr()
201 */ 199 */
202 cx_attr_nodiscard 200 cx_attr_nodiscard cx_attr_access_rw(1, 2)
203 cx_attr_access_rw(1, 2) 201 CX_EXPORT cxmutstr cx_mutstrn(char *cstring, size_t length);
204 cx_attr_export
205 cxmutstr cx_mutstrn(
206 char *cstring,
207 size_t length
208 );
209 202
210 /** 203 /**
211 * Wraps a string that must be zero-terminated. 204 * Wraps a string that must be zero-terminated.
212 * 205 *
213 * The length is implicitly inferred by using a call to @c strlen(). 206 * The length is implicitly inferred by using a call to @c strlen().
207 *
208 * When @c NULL is passed, the length will be set to zero.
214 * 209 *
215 * @note the wrapped string will share the specified pointer to the string. 210 * @note the wrapped string will share the specified pointer to the string.
216 * If you do want a copy, use cx_strdup() on the return value of this function. 211 * If you do want a copy, use cx_strdup() on the return value of this function.
217 * 212 *
218 * If you need to wrap a non-constant string, use cx_mutstr(). 213 * If you need to wrap a non-constant string, use cx_mutstr().
219 * 214 *
220 * @param cstring the string to wrap, must be zero-terminated 215 * @param cstring the string to wrap (must be zero-terminated)
221 * @return the wrapped string 216 * @return the wrapped string
222 * 217 *
223 * @see cx_strn() 218 * @see cx_strn()
224 */ 219 */
225 cx_attr_nonnull 220 cx_attr_nodiscard cx_attr_cstr_arg(1)
226 cx_attr_nodiscard 221 CX_EXPORT cxstring cx_str(const char *cstring);
227 cx_attr_cstr_arg(1)
228 cx_attr_export
229 cxstring cx_str(const char *cstring);
230 222
231 223
232 /** 224 /**
233 * Wraps a string that does not need to be zero-terminated. 225 * Wraps a string that does not need to be zero-terminated.
234 * 226 *
243 * @param length the length of the string 235 * @param length the length of the string
244 * @return the wrapped string 236 * @return the wrapped string
245 * 237 *
246 * @see cx_str() 238 * @see cx_str()
247 */ 239 */
248 cx_attr_nodiscard 240 cx_attr_nodiscard cx_attr_access_r(1, 2)
249 cx_attr_access_r(1, 2) 241 CX_EXPORT cxstring cx_strn(const char *cstring, size_t length);
250 cx_attr_export
251 cxstring cx_strn(
252 const char *cstring,
253 size_t length
254 );
255 242
256 #ifdef __cplusplus 243 #ifdef __cplusplus
257 } // extern "C" 244 } // extern "C"
258 cx_attr_nodiscard 245 cx_attr_nodiscard
259 static inline cxstring cx_strcast(cxmutstr str) { 246 CX_CPPDECL cxstring cx_strcast(cxmutstr str) {
260 return cx_strn(str.ptr, str.length); 247 return cx_strn(str.ptr, str.length);
261 } 248 }
262 cx_attr_nodiscard 249 cx_attr_nodiscard
263 static inline cxstring cx_strcast(cxstring str) { 250 CX_CPPDECL cxstring cx_strcast(cxstring str) {
264 return str; 251 return str;
252 }
253 cx_attr_nodiscard
254 CX_CPPDECL cxstring cx_strcast(const char *str) {
255 return cx_str(str);
256 }
257 cx_attr_nodiscard
258 CX_CPPDECL cxstring cx_strcast(const unsigned char *str) {
259 return cx_str(reinterpret_cast<const char*>(str));
265 } 260 }
266 extern "C" { 261 extern "C" {
267 #else 262 #else
268 /** 263 /**
269 * Internal function, do not use. 264 * Internal function, do not use.
270 * @param str 265 * @param str
271 * @return 266 * @return
272 * @see cx_strcast() 267 * @see cx_strcast()
273 */ 268 */
274 cx_attr_nodiscard 269 cx_attr_nodiscard
275 static inline cxstring cx_strcast_m(cxmutstr str) { 270 CX_INLINE cxstring cx_strcast_m(cxmutstr str) {
276 return (cxstring) {str.ptr, str.length}; 271 return (cxstring) {str.ptr, str.length};
277 } 272 }
278 /** 273 /**
279 * Internal function, do not use. 274 * Internal function, do not use.
280 * @param str 275 * @param str
281 * @return 276 * @return
282 * @see cx_strcast() 277 * @see cx_strcast()
283 */ 278 */
284 cx_attr_nodiscard 279 cx_attr_nodiscard
285 static inline cxstring cx_strcast_c(cxstring str) { 280 CX_INLINE cxstring cx_strcast_c(cxstring str) {
286 return str; 281 return str;
287 } 282 }
288 283
289 /** 284 /**
290 * Casts a mutable string to an immutable string. 285 * Internal function, do not use.
291 * 286 * @param str
292 * Does nothing for already immutable strings. 287 * @return
293 * 288 * @see cx_strcast()
294 * @note This is not seriously a cast. Instead, you get a copy 289 */
295 * of the struct with the desired pointer type. Both structs still 290 cx_attr_nodiscard
296 * point to the same location, though! 291 CX_INLINE cxstring cx_strcast_u(const unsigned char *str) {
297 * 292 return cx_str((const char*)str);
298 * @param str (@c cxstring or @c cxmutstr) the string to cast 293 }
299 * @return (@c cxstring) an immutable copy of the string pointer 294
300 */ 295 /**
296 * Internal function, do not use.
297 * @param str
298 * @return
299 * @see cx_strcast()
300 */
301 cx_attr_nodiscard
302 CX_INLINE cxstring cx_strcast_z(const char *str) {
303 return cx_str(str);
304 }
305
306 /**
307 * Wraps any string into an UCX string.
308 *
309 * @param str (any supported string type) the string to cast
310 * @return (@c cxstring) the string wrapped as UCX string
311 */
301 #define cx_strcast(str) _Generic((str), \ 312 #define cx_strcast(str) _Generic((str), \
302 cxmutstr: cx_strcast_m, \ 313 cxmutstr: cx_strcast_m, \
303 cxstring: cx_strcast_c) \ 314 cxstring: cx_strcast_c, \
304 (str) 315 const unsigned char*: cx_strcast_u, \
316 unsigned char *: cx_strcast_u, \
317 const char*: cx_strcast_z, \
318 char *: cx_strcast_z) (str)
305 #endif 319 #endif
306 320
307 /** 321 /**
308 * Passes the pointer in this string to the cxDefaultAllocator's @c free() function. 322 * Passes the pointer in this string to the cxDefaultAllocator's @c free() function.
309 * 323 *
310 * The pointer in the struct is set to @c NULL and the length is set to zero 324 * The pointer in the struct is set to @c NULL, and the length is set to zero,
311 * which means that this function protects you against double-free. 325 * which means that this function protects you against double-free.
312 * 326 *
313 * @note There is no implementation for cxstring, because it is unlikely that 327 * @note There is no implementation for cxstring, because it is unlikely that
314 * you ever have a <code>const char*</code> you are really supposed to free. 328 * you ever have a <code>const char*</code> you are really supposed to free.
315 * If you encounter such situation, you should double-check your code. 329 * If you encounter such a situation, you should double-check your code.
316 * 330 *
317 * @param str the string to free 331 * @param str the string to free
318 */ 332 */
319 cx_attr_export 333 CX_EXPORT void cx_strfree(cxmutstr *str);
320 void cx_strfree(cxmutstr *str); 334
321 335 /**
322 /** 336 * Passes the pointer in this string to the allocator's free function.
323 * Passes the pointer in this string to the allocators free function. 337 *
324 * 338 * The pointer in the struct is set to @c NULL, and the length is set to zero,
325 * The pointer in the struct is set to @c NULL and the length is set to zero
326 * which means that this function protects you against double-free. 339 * which means that this function protects you against double-free.
327 * 340 *
328 * @note There is no implementation for cxstring, because it is unlikely that 341 * @note There is no implementation for cxstring, because it is unlikely that
329 * you ever have a <code>const char*</code> you are really supposed to free. 342 * you ever have a <code>const char*</code> you are really supposed to free.
330 * If you encounter such situation, you should double-check your code. 343 * If you encounter such a situation, you should double-check your code.
331 * 344 *
332 * @param alloc the allocator 345 * @param alloc the allocator
333 * @param str the string to free 346 * @param str the string to free
334 */ 347 */
335 cx_attr_nonnull_arg(1) 348 cx_attr_nonnull_arg(1)
336 cx_attr_export 349 CX_EXPORT void cx_strfree_a(const CxAllocator *alloc, cxmutstr *str);
337 void cx_strfree_a(
338 const CxAllocator *alloc,
339 cxmutstr *str
340 );
341 350
342 /** 351 /**
343 * Copies a string. 352 * Copies a string.
344 * 353 *
345 * The memory in the @p dest structure is either allocated or re-allocated to fit the entire 354 * The memory in the @p dest structure is either allocated or re-allocated to fit the entire
353 * 362 *
354 * @retval zero success 363 * @retval zero success
355 * @retval non-zero if re-allocation failed 364 * @retval non-zero if re-allocation failed
356 */ 365 */
357 cx_attr_nonnull_arg(1) 366 cx_attr_nonnull_arg(1)
358 cx_attr_export 367 CX_EXPORT int cx_strcpy_a(const CxAllocator *alloc, cxmutstr *dest, cxstring src);
359 int cx_strcpy_a(
360 const CxAllocator *alloc,
361 cxmutstr *dest,
362 cxstring src
363 );
364 368
365 369
366 /** 370 /**
367 * Copies a string. 371 * Copies a string.
368 * 372 *
390 * @param count the total number of specified strings 394 * @param count the total number of specified strings
391 * @param ... all strings 395 * @param ... all strings
392 * @return the accumulated length of all strings 396 * @return the accumulated length of all strings
393 */ 397 */
394 cx_attr_nodiscard 398 cx_attr_nodiscard
395 cx_attr_export 399 CX_EXPORT size_t cx_strlen(size_t count, ...);
396 size_t cx_strlen(
397 size_t count,
398 ...
399 );
400 400
401 /** 401 /**
402 * Concatenates strings. 402 * Concatenates strings.
403 * 403 *
404 * The resulting string will be allocated by the specified allocator. 404 * The resulting string will be allocated by the specified allocator.
418 * @param str the string the other strings shall be concatenated to 418 * @param str the string the other strings shall be concatenated to
419 * @param count the number of the other following strings to concatenate 419 * @param count the number of the other following strings to concatenate
420 * @param ... all other UCX strings 420 * @param ... all other UCX strings
421 * @return the concatenated string 421 * @return the concatenated string
422 */ 422 */
423 cx_attr_nodiscard 423 cx_attr_nodiscard cx_attr_nonnull
424 cx_attr_nonnull 424 CX_EXPORT cxmutstr cx_strcat_ma(const CxAllocator *alloc,
425 cx_attr_export 425 cxmutstr str, size_t count, ...);
426 cxmutstr cx_strcat_ma(
427 const CxAllocator *alloc,
428 cxmutstr str,
429 size_t count,
430 ...
431 );
432 426
433 /** 427 /**
434 * Concatenates strings and returns a new string. 428 * Concatenates strings and returns a new string.
435 * 429 *
436 * The resulting string will be allocated by the specified allocator. 430 * The resulting string will be allocated by the specified allocator.
447 * @param count (@c size_t) the number of the other following strings to concatenate 441 * @param count (@c size_t) the number of the other following strings to concatenate
448 * @param ... all other UCX strings 442 * @param ... all other UCX strings
449 * @return (@c cxmutstr) the concatenated string 443 * @return (@c cxmutstr) the concatenated string
450 */ 444 */
451 #define cx_strcat_a(alloc, count, ...) \ 445 #define cx_strcat_a(alloc, count, ...) \
452 cx_strcat_ma(alloc, cx_mutstrn(NULL, 0), count, __VA_ARGS__) 446 cx_strcat_ma(alloc, cx_mutstrn(NULL, 0), count, __VA_ARGS__)
453 447
454 /** 448 /**
455 * Concatenates strings and returns a new string. 449 * Concatenates strings and returns a new string.
456 * 450 *
457 * The resulting string will be allocated by the cxDefaultAllocator. 451 * The resulting string will be allocated by the cxDefaultAllocator.
467 * @param count (@c size_t) the number of the other following strings to concatenate 461 * @param count (@c size_t) the number of the other following strings to concatenate
468 * @param ... all other UCX strings 462 * @param ... all other UCX strings
469 * @return (@c cxmutstr) the concatenated string 463 * @return (@c cxmutstr) the concatenated string
470 */ 464 */
471 #define cx_strcat(count, ...) \ 465 #define cx_strcat(count, ...) \
472 cx_strcat_ma(cxDefaultAllocator, cx_mutstrn(NULL, 0), count, __VA_ARGS__) 466 cx_strcat_ma(cxDefaultAllocator, cx_mutstrn(NULL, 0), count, __VA_ARGS__)
473 467
474 /** 468 /**
475 * Concatenates strings. 469 * Concatenates strings.
476 * 470 *
477 * The resulting string will be allocated by the cxDefaultAllocator. 471 * The resulting string will be allocated by the cxDefaultAllocator.
491 * @param count (@c size_t) the number of the other following strings to concatenate 485 * @param count (@c size_t) the number of the other following strings to concatenate
492 * @param ... all other strings 486 * @param ... all other strings
493 * @return (@c cxmutstr) the concatenated string 487 * @return (@c cxmutstr) the concatenated string
494 */ 488 */
495 #define cx_strcat_m(str, count, ...) \ 489 #define cx_strcat_m(str, count, ...) \
496 cx_strcat_ma(cxDefaultAllocator, str, count, __VA_ARGS__) 490 cx_strcat_ma(cxDefaultAllocator, str, count, __VA_ARGS__)
497 491
498 /** 492 /**
499 * Returns a substring starting at the specified location. 493 * Returns a substring starting at the specified location.
500 * 494 *
501 * @attention the new string references the same memory area as the 495 * @attention the new string references the same memory area as the
509 * @see cx_strsubsl() 503 * @see cx_strsubsl()
510 * @see cx_strsubs_m() 504 * @see cx_strsubs_m()
511 * @see cx_strsubsl_m() 505 * @see cx_strsubsl_m()
512 */ 506 */
513 cx_attr_nodiscard 507 cx_attr_nodiscard
514 cx_attr_export 508 CX_EXPORT cxstring cx_strsubs(cxstring string, size_t start);
515 cxstring cx_strsubs(
516 cxstring string,
517 size_t start
518 );
519 509
520 /** 510 /**
521 * Returns a substring starting at the specified location. 511 * Returns a substring starting at the specified location.
522 * 512 *
523 * The returned string will be limited to @p length bytes or the number 513 * The returned string will be limited to @p length bytes or the number
535 * @see cx_strsubs() 525 * @see cx_strsubs()
536 * @see cx_strsubs_m() 526 * @see cx_strsubs_m()
537 * @see cx_strsubsl_m() 527 * @see cx_strsubsl_m()
538 */ 528 */
539 cx_attr_nodiscard 529 cx_attr_nodiscard
540 cx_attr_export 530 CX_EXPORT cxstring cx_strsubsl(cxstring string, size_t start, size_t length);
541 cxstring cx_strsubsl(
542 cxstring string,
543 size_t start,
544 size_t length
545 );
546 531
547 /** 532 /**
548 * Returns a substring starting at the specified location. 533 * Returns a substring starting at the specified location.
549 * 534 *
550 * @attention the new string references the same memory area as the 535 * @attention the new string references the same memory area as the
558 * @see cx_strsubsl_m() 543 * @see cx_strsubsl_m()
559 * @see cx_strsubs() 544 * @see cx_strsubs()
560 * @see cx_strsubsl() 545 * @see cx_strsubsl()
561 */ 546 */
562 cx_attr_nodiscard 547 cx_attr_nodiscard
563 cx_attr_export 548 CX_EXPORT cxmutstr cx_strsubs_m(cxmutstr string, size_t start);
564 cxmutstr cx_strsubs_m(
565 cxmutstr string,
566 size_t start
567 );
568 549
569 /** 550 /**
570 * Returns a substring starting at the specified location. 551 * Returns a substring starting at the specified location.
571 * 552 *
572 * The returned string will be limited to @p length bytes or the number 553 * The returned string will be limited to @p length bytes or the number
584 * @see cx_strsubs_m() 565 * @see cx_strsubs_m()
585 * @see cx_strsubs() 566 * @see cx_strsubs()
586 * @see cx_strsubsl() 567 * @see cx_strsubsl()
587 */ 568 */
588 cx_attr_nodiscard 569 cx_attr_nodiscard
589 cx_attr_export 570 CX_EXPORT cxmutstr cx_strsubsl_m(cxmutstr string, size_t start, size_t length);
590 cxmutstr cx_strsubsl_m(
591 cxmutstr string,
592 size_t start,
593 size_t length
594 );
595 571
596 /** 572 /**
597 * Returns a substring starting at the location of the first occurrence of the 573 * Returns a substring starting at the location of the first occurrence of the
598 * specified character. 574 * specified character.
599 * 575 *
604 * @return a substring starting at the first location of @p chr 580 * @return a substring starting at the first location of @p chr
605 * 581 *
606 * @see cx_strchr_m() 582 * @see cx_strchr_m()
607 */ 583 */
608 cx_attr_nodiscard 584 cx_attr_nodiscard
609 cx_attr_export 585 CX_EXPORT cxstring cx_strchr(cxstring string, int chr);
610 cxstring cx_strchr(
611 cxstring string,
612 int chr
613 );
614 586
615 /** 587 /**
616 * Returns a substring starting at the location of the first occurrence of the 588 * Returns a substring starting at the location of the first occurrence of the
617 * specified character. 589 * specified character.
618 * 590 *
623 * @return a substring starting at the first location of @p chr 595 * @return a substring starting at the first location of @p chr
624 * 596 *
625 * @see cx_strchr() 597 * @see cx_strchr()
626 */ 598 */
627 cx_attr_nodiscard 599 cx_attr_nodiscard
628 cx_attr_export 600 CX_EXPORT cxmutstr cx_strchr_m(cxmutstr string, int chr);
629 cxmutstr cx_strchr_m(
630 cxmutstr string,
631 int chr
632 );
633 601
634 /** 602 /**
635 * Returns a substring starting at the location of the last occurrence of the 603 * Returns a substring starting at the location of the last occurrence of the
636 * specified character. 604 * specified character.
637 * 605 *
642 * @return a substring starting at the last location of @p chr 610 * @return a substring starting at the last location of @p chr
643 * 611 *
644 * @see cx_strrchr_m() 612 * @see cx_strrchr_m()
645 */ 613 */
646 cx_attr_nodiscard 614 cx_attr_nodiscard
647 cx_attr_export 615 CX_EXPORT cxstring cx_strrchr(cxstring string, int chr);
648 cxstring cx_strrchr(
649 cxstring string,
650 int chr
651 );
652 616
653 /** 617 /**
654 * Returns a substring starting at the location of the last occurrence of the 618 * Returns a substring starting at the location of the last occurrence of the
655 * specified character. 619 * specified character.
656 * 620 *
661 * @return a substring starting at the last location of @p chr 625 * @return a substring starting at the last location of @p chr
662 * 626 *
663 * @see cx_strrchr() 627 * @see cx_strrchr()
664 */ 628 */
665 cx_attr_nodiscard 629 cx_attr_nodiscard
666 cx_attr_export 630 CX_EXPORT cxmutstr cx_strrchr_m(cxmutstr string, int chr);
667 cxmutstr cx_strrchr_m(
668 cxmutstr string,
669 int chr
670 );
671 631
672 /** 632 /**
673 * Returns a substring starting at the location of the first occurrence of the 633 * Returns a substring starting at the location of the first occurrence of the
674 * specified string. 634 * specified string.
675 * 635 *
684 * @p needle, or an empty string, if the sequence is not 644 * @p needle, or an empty string, if the sequence is not
685 * contained 645 * contained
686 * @see cx_strstr_m() 646 * @see cx_strstr_m()
687 */ 647 */
688 cx_attr_nodiscard 648 cx_attr_nodiscard
689 cx_attr_export 649 CX_EXPORT cxstring cx_strstr(cxstring haystack, cxstring needle);
690 cxstring cx_strstr(
691 cxstring haystack,
692 cxstring needle
693 );
694 650
695 /** 651 /**
696 * Returns a substring starting at the location of the first occurrence of the 652 * Returns a substring starting at the location of the first occurrence of the
697 * specified string. 653 * specified string.
698 * 654 *
707 * @p needle, or an empty string, if the sequence is not 663 * @p needle, or an empty string, if the sequence is not
708 * contained 664 * contained
709 * @see cx_strstr() 665 * @see cx_strstr()
710 */ 666 */
711 cx_attr_nodiscard 667 cx_attr_nodiscard
712 cx_attr_export 668 CX_EXPORT cxmutstr cx_strstr_m(cxmutstr haystack, cxstring needle);
713 cxmutstr cx_strstr_m(
714 cxmutstr haystack,
715 cxstring needle
716 );
717 669
718 /** 670 /**
719 * Splits a given string using a delimiter string. 671 * Splits a given string using a delimiter string.
720 * 672 *
721 * @note The resulting array contains strings that point to the source 673 * @note The resulting array contains strings that point to the source
725 * @param delim the delimiter 677 * @param delim the delimiter
726 * @param limit the maximum number of split items 678 * @param limit the maximum number of split items
727 * @param output a preallocated array of at least @p limit length 679 * @param output a preallocated array of at least @p limit length
728 * @return the actual number of split items 680 * @return the actual number of split items
729 */ 681 */
730 cx_attr_nodiscard 682 cx_attr_nodiscard cx_attr_nonnull cx_attr_access_w(4, 3)
731 cx_attr_nonnull 683 CX_EXPORT size_t cx_strsplit(cxstring string, cxstring delim,
732 cx_attr_access_w(4, 3) 684 size_t limit, cxstring *output);
733 cx_attr_export
734 size_t cx_strsplit(
735 cxstring string,
736 cxstring delim,
737 size_t limit,
738 cxstring *output
739 );
740 685
741 /** 686 /**
742 * Splits a given string using a delimiter string. 687 * Splits a given string using a delimiter string.
743 * 688 *
744 * The array pointed to by @p output will be allocated by @p allocator. 689 * The array pointed to by @p output will be allocated by @p allocator.
755 * @param limit the maximum number of split items 700 * @param limit the maximum number of split items
756 * @param output a pointer where the address of the allocated array shall be 701 * @param output a pointer where the address of the allocated array shall be
757 * written to 702 * written to
758 * @return the actual number of split items 703 * @return the actual number of split items
759 */ 704 */
760 cx_attr_nodiscard 705 cx_attr_nodiscard cx_attr_nonnull cx_attr_access_w(5)
761 cx_attr_nonnull 706 CX_EXPORT size_t cx_strsplit_a(const CxAllocator *allocator,
762 cx_attr_access_w(5) 707 cxstring string, cxstring delim,
763 cx_attr_export 708 size_t limit, cxstring **output);
764 size_t cx_strsplit_a(
765 const CxAllocator *allocator,
766 cxstring string,
767 cxstring delim,
768 size_t limit,
769 cxstring **output
770 );
771 709
772 710
773 /** 711 /**
774 * Splits a given string using a delimiter string. 712 * Splits a given string using a delimiter string.
775 * 713 *
780 * @param delim the delimiter 718 * @param delim the delimiter
781 * @param limit the maximum number of split items 719 * @param limit the maximum number of split items
782 * @param output a preallocated array of at least @p limit length 720 * @param output a preallocated array of at least @p limit length
783 * @return the actual number of split items 721 * @return the actual number of split items
784 */ 722 */
785 cx_attr_nodiscard 723 cx_attr_nodiscard cx_attr_nonnull cx_attr_access_w(4, 3)
786 cx_attr_nonnull 724 CX_EXPORT size_t cx_strsplit_m(cxmutstr string, cxstring delim,
787 cx_attr_access_w(4, 3) 725 size_t limit, cxmutstr *output);
788 cx_attr_export
789 size_t cx_strsplit_m(
790 cxmutstr string,
791 cxstring delim,
792 size_t limit,
793 cxmutstr *output
794 );
795 726
796 /** 727 /**
797 * Splits a given string using a delimiter string. 728 * Splits a given string using a delimiter string.
798 * 729 *
799 * The array pointed to by @p output will be allocated by @p allocator. 730 * The array pointed to by @p output will be allocated by @p allocator.
810 * @param limit the maximum number of split items 741 * @param limit the maximum number of split items
811 * @param output a pointer where the address of the allocated array shall be 742 * @param output a pointer where the address of the allocated array shall be
812 * written to 743 * written to
813 * @return the actual number of split items 744 * @return the actual number of split items
814 */ 745 */
815 cx_attr_nodiscard 746 cx_attr_nodiscard cx_attr_nonnull cx_attr_access_w(5)
816 cx_attr_nonnull 747 CX_EXPORT size_t cx_strsplit_ma(const CxAllocator *allocator,
817 cx_attr_access_w(5) 748 cxmutstr string, cxstring delim, size_t limit,
818 cx_attr_export 749 cxmutstr **output);
819 size_t cx_strsplit_ma(
820 const CxAllocator *allocator,
821 cxmutstr string,
822 cxstring delim,
823 size_t limit,
824 cxmutstr **output
825 );
826 750
827 /** 751 /**
828 * Compares two strings. 752 * Compares two strings.
829 * 753 *
830 * @param s1 the first string 754 * @param s1 the first string
831 * @param s2 the second string 755 * @param s2 the second string
832 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger 756 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
833 * than @p s2, zero if both strings equal 757 * than @p s2, zero if both strings equal
834 */ 758 */
835 cx_attr_nodiscard 759 cx_attr_nodiscard
836 cx_attr_export 760 CX_EXPORT int cx_strcmp_(cxstring s1, cxstring s2);
837 int cx_strcmp( 761
838 cxstring s1, 762 /**
839 cxstring s2 763 * Compares two strings.
840 ); 764 *
765 * @param s1 the first string
766 * @param s2 the second string
767 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
768 * than @p s2, zero if both strings equal
769 */
770 #define cx_strcmp(s1, s2) cx_strcmp_(cx_strcast(s1), cx_strcast(s2))
841 771
842 /** 772 /**
843 * Compares two strings ignoring case. 773 * Compares two strings ignoring case.
844 * 774 *
845 * @param s1 the first string 775 * @param s1 the first string
846 * @param s2 the second string 776 * @param s2 the second string
847 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger 777 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
848 * than @p s2, zero if both strings equal ignoring case 778 * than @p s2, zero if both strings equal ignoring case
849 */ 779 */
850 cx_attr_nodiscard 780 cx_attr_nodiscard
851 cx_attr_export 781 CX_EXPORT int cx_strcasecmp_(cxstring s1, cxstring s2);
852 int cx_strcasecmp( 782
853 cxstring s1, 783 /**
854 cxstring s2 784 * Compares two strings ignoring case.
855 ); 785 *
786 * @param s1 the first string
787 * @param s2 the second string
788 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
789 * than @p s2, zero if both strings equal ignoring case
790 */
791 #define cx_strcasecmp(s1, s2) cx_strcasecmp_(cx_strcast(s1), cx_strcast(s2))
856 792
857 /** 793 /**
858 * Compares two strings. 794 * Compares two strings.
859 * 795 *
860 * This function has a compatible signature for the use as a cx_compare_func. 796 * This function has a compatible signature for the use as a cx_compare_func.
797 *
798 * @attention This function can @em only compare UCX strings. It is unsafe to
799 * pass normal C-strings to this function.
861 * 800 *
862 * @param s1 the first string 801 * @param s1 the first string
863 * @param s2 the second string 802 * @param s2 the second string
864 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger 803 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
865 * than @p s2, zero if both strings equal 804 * than @p s2, zero if both strings equal
866 */ 805 */
867 cx_attr_nodiscard 806 cx_attr_nodiscard cx_attr_nonnull
868 cx_attr_nonnull 807 CX_EXPORT int cx_strcmp_p(const void *s1, const void *s2);
869 cx_attr_export
870 int cx_strcmp_p(
871 const void *s1,
872 const void *s2
873 );
874 808
875 /** 809 /**
876 * Compares two strings ignoring case. 810 * Compares two strings ignoring case.
877 * 811 *
878 * This function has a compatible signature for the use as a cx_compare_func. 812 * This function has a compatible signature for the use as a cx_compare_func.
880 * @param s1 the first string 814 * @param s1 the first string
881 * @param s2 the second string 815 * @param s2 the second string
882 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger 816 * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
883 * than @p s2, zero if both strings equal ignoring case 817 * than @p s2, zero if both strings equal ignoring case
884 */ 818 */
885 cx_attr_nodiscard 819 cx_attr_nodiscard cx_attr_nonnull
886 cx_attr_nonnull 820 CX_EXPORT int cx_strcasecmp_p(const void *s1, const void *s2);
887 cx_attr_export
888 int cx_strcasecmp_p(
889 const void *s1,
890 const void *s2
891 );
892 821
893 822
894 /** 823 /**
895 * Creates a duplicate of the specified string. 824 * Creates a duplicate of the specified string.
896 * 825 *
901 * @param allocator the allocator to use 830 * @param allocator the allocator to use
902 * @param string the string to duplicate 831 * @param string the string to duplicate
903 * @return a duplicate of the string 832 * @return a duplicate of the string
904 * @see cx_strdup() 833 * @see cx_strdup()
905 */ 834 */
906 cx_attr_nodiscard 835 cx_attr_nodiscard cx_attr_nonnull
907 cx_attr_nonnull 836 CX_EXPORT cxmutstr cx_strdup_a_(const CxAllocator *allocator, cxstring string);
908 cx_attr_export
909 cxmutstr cx_strdup_a_(
910 const CxAllocator *allocator,
911 cxstring string
912 );
913 837
914 /** 838 /**
915 * Creates a duplicate of the specified string. 839 * Creates a duplicate of the specified string.
916 * 840 *
917 * The new string will contain a copy allocated by @p allocator. 841 * The new string will contain a copy allocated by @p allocator.
922 * @param string the string to duplicate 846 * @param string the string to duplicate
923 * @return (@c cxmutstr) a duplicate of the string 847 * @return (@c cxmutstr) a duplicate of the string
924 * @see cx_strdup() 848 * @see cx_strdup()
925 * @see cx_strfree_a() 849 * @see cx_strfree_a()
926 */ 850 */
927 #define cx_strdup_a(allocator, string) \ 851 #define cx_strdup_a(allocator, string) cx_strdup_a_((allocator), cx_strcast(string))
928 cx_strdup_a_((allocator), cx_strcast(string))
929 852
930 /** 853 /**
931 * Creates a duplicate of the specified string. 854 * Creates a duplicate of the specified string.
932 * 855 *
933 * The new string will contain a copy allocated by the cxDefaultAllocator. 856 * The new string will contain a copy allocated by the cxDefaultAllocator.
950 * 873 *
951 * @param string the string that shall be trimmed 874 * @param string the string that shall be trimmed
952 * @return the trimmed string 875 * @return the trimmed string
953 */ 876 */
954 cx_attr_nodiscard 877 cx_attr_nodiscard
955 cx_attr_export 878 CX_EXPORT cxstring cx_strtrim(cxstring string);
956 cxstring cx_strtrim(cxstring string);
957 879
958 /** 880 /**
959 * Omits leading and trailing spaces. 881 * Omits leading and trailing spaces.
960 * 882 *
961 * @note the returned string references the same memory, thus you 883 * @note the returned string references the same memory, thus you
963 * 885 *
964 * @param string the string that shall be trimmed 886 * @param string the string that shall be trimmed
965 * @return the trimmed string 887 * @return the trimmed string
966 */ 888 */
967 cx_attr_nodiscard 889 cx_attr_nodiscard
968 cx_attr_export 890 CX_EXPORT cxmutstr cx_strtrim_m(cxmutstr string);
969 cxmutstr cx_strtrim_m(cxmutstr string); 891
970 892 /**
971 /** 893 * Checks if a string has a specific prefix.
972 * Checks, if a string has a specific prefix.
973 * 894 *
974 * @param string the string to check 895 * @param string the string to check
975 * @param prefix the prefix the string should have 896 * @param prefix the prefix the string should have
976 * @return @c true, if and only if the string has the specified prefix, 897 * @return @c true, if and only if the string has the specified prefix,
977 * @c false otherwise 898 * @c false otherwise
978 */ 899 */
979 cx_attr_nodiscard 900 cx_attr_nodiscard
980 cx_attr_export 901 CX_EXPORT bool cx_strprefix_(cxstring string, cxstring prefix);
981 bool cx_strprefix( 902
982 cxstring string, 903 /**
983 cxstring prefix 904 * Checks if a string has a specific prefix.
984 ); 905 *
985 906 * @param string the string to check
986 /** 907 * @param prefix the prefix the string should have
987 * Checks, if a string has a specific suffix. 908 * @return @c true, if and only if the string has the specified prefix,
909 * @c false otherwise
910 */
911 #define cx_strprefix(string, prefix) cx_strprefix_(cx_strcast(string), cx_strcast(prefix))
912
913 /**
914 * Checks if a string has a specific suffix.
988 * 915 *
989 * @param string the string to check 916 * @param string the string to check
990 * @param suffix the suffix the string should have 917 * @param suffix the suffix the string should have
991 * @return @c true, if and only if the string has the specified suffix, 918 * @return @c true, if and only if the string has the specified suffix,
992 * @c false otherwise 919 * @c false otherwise
993 */ 920 */
994 cx_attr_nodiscard 921 cx_attr_nodiscard
995 cx_attr_export 922 CX_EXPORT bool cx_strsuffix_(cxstring string, cxstring suffix);
996 bool cx_strsuffix( 923
997 cxstring string, 924 /**
998 cxstring suffix 925 * Checks if a string has a specific suffix.
999 ); 926 *
1000 927 * @param string the string to check
1001 /** 928 * @param suffix the suffix the string should have
1002 * Checks, if a string has a specific prefix, ignoring the case. 929 * @return @c true, if and only if the string has the specified suffix,
930 * @c false otherwise
931 */
932 #define cx_strsuffix(string, suffix) cx_strsuffix_(cx_strcast(string), cx_strcast(suffix))
933
934 /**
935 * Checks if a string has a specific prefix, ignoring the case.
1003 * 936 *
1004 * @param string the string to check 937 * @param string the string to check
1005 * @param prefix the prefix the string should have 938 * @param prefix the prefix the string should have
1006 * @return @c true, if and only if the string has the specified prefix, 939 * @return @c true, if and only if the string has the specified prefix,
1007 * @c false otherwise 940 * @c false otherwise
1008 */ 941 */
1009 cx_attr_nodiscard 942 cx_attr_nodiscard
1010 cx_attr_export 943 CX_EXPORT bool cx_strcaseprefix_(cxstring string, cxstring prefix);
1011 bool cx_strcaseprefix( 944
1012 cxstring string, 945 /**
1013 cxstring prefix 946 * Checks if a string has a specific prefix, ignoring the case.
1014 ); 947 *
948 * @param string the string to check
949 * @param prefix the prefix the string should have
950 * @return @c true, if and only if the string has the specified prefix,
951 * @c false otherwise
952 */
953 #define cx_strcaseprefix(string, prefix) cx_strcaseprefix_(cx_strcast(string), cx_strcast(prefix))
1015 954
1016 /** 955 /**
1017 * Checks, if a string has a specific suffix, ignoring the case. 956 * Checks, if a string has a specific suffix, ignoring the case.
1018 * 957 *
1019 * @param string the string to check 958 * @param string the string to check
1020 * @param suffix the suffix the string should have 959 * @param suffix the suffix the string should have
1021 * @return @c true, if and only if the string has the specified suffix, 960 * @return @c true, if and only if the string has the specified suffix,
1022 * @c false otherwise 961 * @c false otherwise
1023 */ 962 */
1024 cx_attr_nodiscard 963 cx_attr_nodiscard
1025 cx_attr_export 964 CX_EXPORT bool cx_strcasesuffix_(cxstring string, cxstring suffix);
1026 bool cx_strcasesuffix( 965
1027 cxstring string, 966 /**
1028 cxstring suffix 967 * Checks, if a string has a specific suffix, ignoring the case.
1029 ); 968 *
969 * @param string the string to check
970 * @param suffix the suffix the string should have
971 * @return @c true, if and only if the string has the specified suffix,
972 * @c false otherwise
973 */
974 #define cx_strcasesuffix(string, suffix) cx_strcasesuffix_(cx_strcast(string), cx_strcast(suffix))
1030 975
1031 /** 976 /**
1032 * Replaces a string with another string. 977 * Replaces a string with another string.
1033 * 978 *
1034 * Replaces at most @p replmax occurrences. 979 * The function replaces at most @p replmax occurrences.
1035 * 980 *
1036 * The returned string will be allocated by @p allocator and is guaranteed 981 * The returned string will be allocated by @p allocator and is guaranteed
1037 * to be zero-terminated. 982 * to be zero-terminated.
1038 * 983 *
1039 * If allocation fails, or the input string is empty, 984 * If allocation fails, or the input string is empty,
1044 * @param search the string to search for 989 * @param search the string to search for
1045 * @param replacement the replacement string 990 * @param replacement the replacement string
1046 * @param replmax maximum number of replacements 991 * @param replmax maximum number of replacements
1047 * @return the resulting string after applying the replacements 992 * @return the resulting string after applying the replacements
1048 */ 993 */
1049 cx_attr_nodiscard 994 cx_attr_nodiscard cx_attr_nonnull
1050 cx_attr_nonnull 995 CX_EXPORT cxmutstr cx_strreplacen_a(const CxAllocator *allocator,
1051 cx_attr_export 996 cxstring str, cxstring search, cxstring replacement, size_t replmax);
1052 cxmutstr cx_strreplacen_a(
1053 const CxAllocator *allocator,
1054 cxstring str,
1055 cxstring search,
1056 cxstring replacement,
1057 size_t replmax
1058 );
1059 997
1060 /** 998 /**
1061 * Replaces a string with another string. 999 * Replaces a string with another string.
1062 * 1000 *
1063 * Replaces at most @p replmax occurrences. 1001 * The function replaces at most @p replmax occurrences.
1064 * 1002 *
1065 * The returned string will be allocated by the cxDefaultAllocator and is guaranteed 1003 * The returned string will be allocated by the cxDefaultAllocator and is guaranteed
1066 * to be zero-terminated. 1004 * to be zero-terminated.
1067 * 1005 *
1068 * If allocation fails, or the input string is empty, 1006 * If allocation fails, or the input string is empty,
1073 * @param replacement (@c cxstring) the replacement string 1011 * @param replacement (@c cxstring) the replacement string
1074 * @param replmax (@c size_t) maximum number of replacements 1012 * @param replmax (@c size_t) maximum number of replacements
1075 * @return (@c cxmutstr) the resulting string after applying the replacements 1013 * @return (@c cxmutstr) the resulting string after applying the replacements
1076 */ 1014 */
1077 #define cx_strreplacen(str, search, replacement, replmax) \ 1015 #define cx_strreplacen(str, search, replacement, replmax) \
1078 cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, replmax) 1016 cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, replmax)
1079 1017
1080 /** 1018 /**
1081 * Replaces a string with another string. 1019 * Replaces a string with another string.
1082 * 1020 *
1083 * The returned string will be allocated by @p allocator and is guaranteed 1021 * The returned string will be allocated by @p allocator and is guaranteed
1091 * @param search (@c cxstring) the string to search for 1029 * @param search (@c cxstring) the string to search for
1092 * @param replacement (@c cxstring) the replacement string 1030 * @param replacement (@c cxstring) the replacement string
1093 * @return (@c cxmutstr) the resulting string after applying the replacements 1031 * @return (@c cxmutstr) the resulting string after applying the replacements
1094 */ 1032 */
1095 #define cx_strreplace_a(allocator, str, search, replacement) \ 1033 #define cx_strreplace_a(allocator, str, search, replacement) \
1096 cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX) 1034 cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX)
1097 1035
1098 /** 1036 /**
1099 * Replaces a string with another string. 1037 * Replaces a string with another string.
1100 * 1038 *
1101 * The returned string will be allocated by the cxDefaultAllocator and is guaranteed 1039 * The returned string will be allocated by the cxDefaultAllocator and is guaranteed
1108 * @param search (@c cxstring) the string to search for 1046 * @param search (@c cxstring) the string to search for
1109 * @param replacement (@c cxstring) the replacement string 1047 * @param replacement (@c cxstring) the replacement string
1110 * @return (@c cxmutstr) the resulting string after applying the replacements 1048 * @return (@c cxmutstr) the resulting string after applying the replacements
1111 */ 1049 */
1112 #define cx_strreplace(str, search, replacement) \ 1050 #define cx_strreplace(str, search, replacement) \
1113 cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, SIZE_MAX) 1051 cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, SIZE_MAX)
1114 1052
1115 /** 1053 /**
1116 * Creates a string tokenization context. 1054 * Creates a string tokenization context.
1117 * 1055 *
1118 * @param str the string to tokenize 1056 * @param str the string to tokenize
1119 * @param delim the delimiter (must not be empty) 1057 * @param delim the delimiter (must not be empty)
1120 * @param limit the maximum number of tokens that shall be returned 1058 * @param limit the maximum number of tokens that shall be returned
1121 * @return a new string tokenization context 1059 * @return a new string tokenization context
1122 */ 1060 */
1123 cx_attr_nodiscard 1061 cx_attr_nodiscard
1124 cx_attr_export 1062 CX_EXPORT CxStrtokCtx cx_strtok_(cxstring str, cxstring delim, size_t limit);
1125 CxStrtokCtx cx_strtok_(
1126 cxstring str,
1127 cxstring delim,
1128 size_t limit
1129 );
1130 1063
1131 /** 1064 /**
1132 * Creates a string tokenization context. 1065 * Creates a string tokenization context.
1133 * 1066 *
1134 * @param str the string to tokenize 1067 * @param str the string to tokenize
1135 * @param delim the delimiter string (must not be empty) 1068 * @param delim the delimiter string (must not be empty)
1136 * @param limit (@c size_t) the maximum number of tokens that shall be returned 1069 * @param limit (@c size_t) the maximum number of tokens that shall be returned
1137 * @return (@c CxStrtokCtx) a new string tokenization context 1070 * @return (@c CxStrtokCtx) a new string tokenization context
1138 */ 1071 */
1139 #define cx_strtok(str, delim, limit) \ 1072 #define cx_strtok(str, delim, limit) \
1140 cx_strtok_(cx_strcast(str), cx_strcast(delim), (limit)) 1073 cx_strtok_(cx_strcast(str), cx_strcast(delim), (limit))
1141 1074
1142 /** 1075 /**
1143 * Returns the next token. 1076 * Returns the next token.
1144 * 1077 *
1145 * The token will point to the source string. 1078 * The token will point to the source string.
1147 * @param ctx the tokenization context 1080 * @param ctx the tokenization context
1148 * @param token a pointer to memory where the next token shall be stored 1081 * @param token a pointer to memory where the next token shall be stored
1149 * @return true if successful, false if the limit or the end of the string 1082 * @return true if successful, false if the limit or the end of the string
1150 * has been reached 1083 * has been reached
1151 */ 1084 */
1152 cx_attr_nonnull 1085 cx_attr_nonnull cx_attr_nodiscard cx_attr_access_w(2)
1153 cx_attr_nodiscard 1086 CX_EXPORT bool cx_strtok_next(CxStrtokCtx *ctx, cxstring *token);
1154 cx_attr_access_w(2)
1155 cx_attr_export
1156 bool cx_strtok_next(
1157 CxStrtokCtx *ctx,
1158 cxstring *token
1159 );
1160 1087
1161 /** 1088 /**
1162 * Returns the next token of a mutable string. 1089 * Returns the next token of a mutable string.
1163 * 1090 *
1164 * The token will point to the source string. 1091 * The token will point to the source string.
1170 * @param ctx the tokenization context 1097 * @param ctx the tokenization context
1171 * @param token a pointer to memory where the next token shall be stored 1098 * @param token a pointer to memory where the next token shall be stored
1172 * @return true if successful, false if the limit or the end of the string 1099 * @return true if successful, false if the limit or the end of the string
1173 * has been reached 1100 * has been reached
1174 */ 1101 */
1175 cx_attr_nonnull 1102 cx_attr_nonnull cx_attr_nodiscard cx_attr_access_w(2)
1176 cx_attr_nodiscard 1103 CX_EXPORT bool cx_strtok_next_m(CxStrtokCtx *ctx, cxmutstr *token);
1177 cx_attr_access_w(2)
1178 cx_attr_export
1179 bool cx_strtok_next_m(
1180 CxStrtokCtx *ctx,
1181 cxmutstr *token
1182 );
1183 1104
1184 /** 1105 /**
1185 * Defines an array of more delimiters for the specified tokenization context. 1106 * Defines an array of more delimiters for the specified tokenization context.
1186 * 1107 *
1187 * @param ctx the tokenization context 1108 * @param ctx the tokenization context
1188 * @param delim array of more delimiters 1109 * @param delim array of more delimiters
1189 * @param count number of elements in the array 1110 * @param count number of elements in the array
1190 */ 1111 */
1191 cx_attr_nonnull 1112 cx_attr_nonnull cx_attr_access_r(2, 3)
1192 cx_attr_access_r(2, 3) 1113 CX_EXPORT void cx_strtok_delim(CxStrtokCtx *ctx, const cxstring *delim, size_t count);
1193 cx_attr_export
1194 void cx_strtok_delim(
1195 CxStrtokCtx *ctx,
1196 const cxstring *delim,
1197 size_t count
1198 );
1199 1114
1200 /* ------------------------------------------------------------------------- * 1115 /* ------------------------------------------------------------------------- *
1201 * string to number conversion functions * 1116 * string to number conversion functions *
1202 * ------------------------------------------------------------------------- */ 1117 * ------------------------------------------------------------------------- */
1203 1118
1209 * It sets errno to ERANGE when the target datatype is too small. 1124 * It sets errno to ERANGE when the target datatype is too small.
1210 * 1125 *
1211 * @param str the string to convert 1126 * @param str the string to convert
1212 * @param output a pointer to the integer variable where the result shall be stored 1127 * @param output a pointer to the integer variable where the result shall be stored
1213 * @param base 2, 8, 10, or 16 1128 * @param base 2, 8, 10, or 16
1214 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1129 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1215 * @retval zero success 1130 * @retval zero success
1216 * @retval non-zero conversion was not possible 1131 * @retval non-zero conversion was not possible
1217 */ 1132 */
1218 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1133 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1219 int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep); 1134 CX_EXPORT int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep);
1220 1135
1221 /** 1136 /**
1222 * Converts a string to a number. 1137 * Converts a string to a number.
1223 * 1138 *
1224 * The function returns non-zero when conversion is not possible. 1139 * The function returns non-zero when conversion is not possible.
1225 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1140 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1226 * It sets errno to ERANGE when the target datatype is too small. 1141 * It sets errno to ERANGE when the target datatype is too small.
1227 * 1142 *
1228 * @param str the string to convert 1143 * @param str the string to convert
1229 * @param output a pointer to the integer variable where the result shall be stored 1144 * @param output a pointer to the integer variable where the result shall be stored
1230 * @param base 2, 8, 10, or 16 1145 * @param base 2, 8, 10, or 16
1231 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1146 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1232 * @retval zero success 1147 * @retval zero success
1233 * @retval non-zero conversion was not possible 1148 * @retval non-zero conversion was not possible
1234 */ 1149 */
1235 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1150 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1236 int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep); 1151 CX_EXPORT int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep);
1237 1152
1238 /** 1153 /**
1239 * Converts a string to a number. 1154 * Converts a string to a number.
1240 * 1155 *
1241 * The function returns non-zero when conversion is not possible. 1156 * The function returns non-zero when conversion is not possible.
1242 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1157 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1243 * It sets errno to ERANGE when the target datatype is too small. 1158 * It sets errno to ERANGE when the target datatype is too small.
1244 * 1159 *
1245 * @param str the string to convert 1160 * @param str the string to convert
1246 * @param output a pointer to the integer variable where the result shall be stored 1161 * @param output a pointer to the integer variable where the result shall be stored
1247 * @param base 2, 8, 10, or 16 1162 * @param base 2, 8, 10, or 16
1248 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1163 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1249 * @retval zero success 1164 * @retval zero success
1250 * @retval non-zero conversion was not possible 1165 * @retval non-zero conversion was not possible
1251 */ 1166 */
1252 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1167 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1253 int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep); 1168 CX_EXPORT int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep);
1254 1169
1255 /** 1170 /**
1256 * Converts a string to a number. 1171 * Converts a string to a number.
1257 * 1172 *
1258 * The function returns non-zero when conversion is not possible. 1173 * The function returns non-zero when conversion is not possible.
1259 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1174 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1260 * It sets errno to ERANGE when the target datatype is too small. 1175 * It sets errno to ERANGE when the target datatype is too small.
1261 * 1176 *
1262 * @param str the string to convert 1177 * @param str the string to convert
1263 * @param output a pointer to the integer variable where the result shall be stored 1178 * @param output a pointer to the integer variable where the result shall be stored
1264 * @param base 2, 8, 10, or 16 1179 * @param base 2, 8, 10, or 16
1265 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1180 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1266 * @retval zero success 1181 * @retval zero success
1267 * @retval non-zero conversion was not possible 1182 * @retval non-zero conversion was not possible
1268 */ 1183 */
1269 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1184 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1270 int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep); 1185 CX_EXPORT int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep);
1271 1186
1272 /** 1187 /**
1273 * Converts a string to a number. 1188 * Converts a string to a number.
1274 * 1189 *
1275 * The function returns non-zero when conversion is not possible. 1190 * The function returns non-zero when conversion is not possible.
1276 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1191 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1277 * It sets errno to ERANGE when the target datatype is too small. 1192 * It sets errno to ERANGE when the target datatype is too small.
1278 * 1193 *
1279 * @param str the string to convert 1194 * @param str the string to convert
1280 * @param output a pointer to the integer variable where the result shall be stored 1195 * @param output a pointer to the integer variable where the result shall be stored
1281 * @param base 2, 8, 10, or 16 1196 * @param base 2, 8, 10, or 16
1282 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1197 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1283 * @retval zero success 1198 * @retval zero success
1284 * @retval non-zero conversion was not possible 1199 * @retval non-zero conversion was not possible
1285 */ 1200 */
1286 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1201 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1287 int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep); 1202 CX_EXPORT int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep);
1288 1203
1289 /** 1204 /**
1290 * Converts a string to a number. 1205 * Converts a string to a number.
1291 * 1206 *
1292 * The function returns non-zero when conversion is not possible. 1207 * The function returns non-zero when conversion is not possible.
1293 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1208 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1294 * It sets errno to ERANGE when the target datatype is too small. 1209 * It sets errno to ERANGE when the target datatype is too small.
1295 * 1210 *
1296 * @param str the string to convert 1211 * @param str the string to convert
1297 * @param output a pointer to the integer variable where the result shall be stored 1212 * @param output a pointer to the integer variable where the result shall be stored
1298 * @param base 2, 8, 10, or 16 1213 * @param base 2, 8, 10, or 16
1299 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1214 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1300 * @retval zero success 1215 * @retval zero success
1301 * @retval non-zero conversion was not possible 1216 * @retval non-zero conversion was not possible
1302 */ 1217 */
1303 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1218 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1304 int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep); 1219 CX_EXPORT int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep);
1305 1220
1306 /** 1221 /**
1307 * Converts a string to a number. 1222 * Converts a string to a number.
1308 * 1223 *
1309 * The function returns non-zero when conversion is not possible. 1224 * The function returns non-zero when conversion is not possible.
1310 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1225 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1311 * It sets errno to ERANGE when the target datatype is too small. 1226 * It sets errno to ERANGE when the target datatype is too small.
1312 * 1227 *
1313 * @param str the string to convert 1228 * @param str the string to convert
1314 * @param output a pointer to the integer variable where the result shall be stored 1229 * @param output a pointer to the integer variable where the result shall be stored
1315 * @param base 2, 8, 10, or 16 1230 * @param base 2, 8, 10, or 16
1316 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1231 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1317 * @retval zero success 1232 * @retval zero success
1318 * @retval non-zero conversion was not possible 1233 * @retval non-zero conversion was not possible
1319 */ 1234 */
1320 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1235 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1321 int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep); 1236 CX_EXPORT int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep);
1322 1237
1323 /** 1238 /**
1324 * Converts a string to a number. 1239 * Converts a string to a number.
1325 * 1240 *
1326 * The function returns non-zero when conversion is not possible. 1241 * The function returns non-zero when conversion is not possible.
1327 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1242 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1328 * It sets errno to ERANGE when the target datatype is too small. 1243 * It sets errno to ERANGE when the target datatype is too small.
1329 * 1244 *
1330 * @param str the string to convert 1245 * @param str the string to convert
1331 * @param output a pointer to the integer variable where the result shall be stored 1246 * @param output a pointer to the integer variable where the result shall be stored
1332 * @param base 2, 8, 10, or 16 1247 * @param base 2, 8, 10, or 16
1333 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1248 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1334 * @retval zero success 1249 * @retval zero success
1335 * @retval non-zero conversion was not possible 1250 * @retval non-zero conversion was not possible
1336 */ 1251 */
1337 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1252 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1338 int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep); 1253 CX_EXPORT int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep);
1339 1254
1340 /** 1255 /**
1341 * Converts a string to a number. 1256 * Converts a string to a number.
1342 * 1257 *
1343 * The function returns non-zero when conversion is not possible. 1258 * The function returns non-zero when conversion is not possible.
1344 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1259 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1345 * It sets errno to ERANGE when the target datatype is too small. 1260 * It sets errno to ERANGE when the target datatype is too small.
1346 * 1261 *
1347 * @param str the string to convert 1262 * @param str the string to convert
1348 * @param output a pointer to the integer variable where the result shall be stored 1263 * @param output a pointer to the integer variable where the result shall be stored
1349 * @param base 2, 8, 10, or 16 1264 * @param base 2, 8, 10, or 16
1350 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1265 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1351 * @retval zero success 1266 * @retval zero success
1352 * @retval non-zero conversion was not possible 1267 * @retval non-zero conversion was not possible
1353 */ 1268 */
1354 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1269 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1355 int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); 1270 CX_EXPORT int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep);
1356 1271
1357 /** 1272 /**
1358 * Converts a string to a number. 1273 * Converts a string to a number.
1359 * 1274 *
1360 * The function returns non-zero when conversion is not possible. 1275 * The function returns non-zero when conversion is not possible.
1361 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1276 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1362 * It sets errno to ERANGE when the target datatype is too small. 1277 * It sets errno to ERANGE when the target datatype is too small.
1363 * 1278 *
1364 * @param str the string to convert 1279 * @param str the string to convert
1365 * @param output a pointer to the integer variable where the result shall be stored 1280 * @param output a pointer to the integer variable where the result shall be stored
1366 * @param base 2, 8, 10, or 16 1281 * @param base 2, 8, 10, or 16
1367 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1282 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1368 * @retval zero success 1283 * @retval zero success
1369 * @retval non-zero conversion was not possible 1284 * @retval non-zero conversion was not possible
1370 */ 1285 */
1371 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1286 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1372 int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep); 1287 CX_EXPORT int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep);
1373 1288
1374 /** 1289 /**
1375 * Converts a string to a number. 1290 * Converts a string to a number.
1376 * 1291 *
1377 * The function returns non-zero when conversion is not possible. 1292 * The function returns non-zero when conversion is not possible.
1378 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1293 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1379 * It sets errno to ERANGE when the target datatype is too small. 1294 * It sets errno to ERANGE when the target datatype is too small.
1380 * 1295 *
1381 * @param str the string to convert 1296 * @param str the string to convert
1382 * @param output a pointer to the integer variable where the result shall be stored 1297 * @param output a pointer to the integer variable where the result shall be stored
1383 * @param base 2, 8, 10, or 16 1298 * @param base 2, 8, 10, or 16
1384 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1299 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1385 * @retval zero success 1300 * @retval zero success
1386 * @retval non-zero conversion was not possible 1301 * @retval non-zero conversion was not possible
1387 */ 1302 */
1388 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1303 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1389 int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep); 1304 CX_EXPORT int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep);
1390 1305
1391 /** 1306 /**
1392 * Converts a string to a number. 1307 * Converts a string to a number.
1393 * 1308 *
1394 * The function returns non-zero when conversion is not possible. 1309 * The function returns non-zero when conversion is not possible.
1395 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1310 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1396 * It sets errno to ERANGE when the target datatype is too small. 1311 * It sets errno to ERANGE when the target datatype is too small.
1397 * 1312 *
1398 * @param str the string to convert 1313 * @param str the string to convert
1399 * @param output a pointer to the integer variable where the result shall be stored 1314 * @param output a pointer to the integer variable where the result shall be stored
1400 * @param base 2, 8, 10, or 16 1315 * @param base 2, 8, 10, or 16
1401 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1316 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1402 * @retval zero success 1317 * @retval zero success
1403 * @retval non-zero conversion was not possible 1318 * @retval non-zero conversion was not possible
1404 */ 1319 */
1405 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1320 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1406 int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep); 1321 CX_EXPORT int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep);
1407 1322
1408 /** 1323 /**
1409 * Converts a string to a number. 1324 * Converts a string to a number.
1410 * 1325 *
1411 * The function returns non-zero when conversion is not possible. 1326 * The function returns non-zero when conversion is not possible.
1412 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1327 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1413 * It sets errno to ERANGE when the target datatype is too small. 1328 * It sets errno to ERANGE when the target datatype is too small.
1414 * 1329 *
1415 * @param str the string to convert 1330 * @param str the string to convert
1416 * @param output a pointer to the integer variable where the result shall be stored 1331 * @param output a pointer to the integer variable where the result shall be stored
1417 * @param base 2, 8, 10, or 16 1332 * @param base 2, 8, 10, or 16
1418 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1333 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1419 * @retval zero success 1334 * @retval zero success
1420 * @retval non-zero conversion was not possible 1335 * @retval non-zero conversion was not possible
1421 */ 1336 */
1422 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1337 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1423 int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep); 1338 CX_EXPORT int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep);
1424 1339
1425 /** 1340 /**
1426 * Converts a string to a number. 1341 * Converts a string to a number.
1427 * 1342 *
1428 * The function returns non-zero when conversion is not possible. 1343 * The function returns non-zero when conversion is not possible.
1429 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1344 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1430 * It sets errno to ERANGE when the target datatype is too small. 1345 * It sets errno to ERANGE when the target datatype is too small.
1431 * 1346 *
1432 * @param str the string to convert 1347 * @param str the string to convert
1433 * @param output a pointer to the integer variable where the result shall be stored 1348 * @param output a pointer to the integer variable where the result shall be stored
1434 * @param base 2, 8, 10, or 16 1349 * @param base 2, 8, 10, or 16
1435 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1350 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1436 * @retval zero success 1351 * @retval zero success
1437 * @retval non-zero conversion was not possible 1352 * @retval non-zero conversion was not possible
1438 */ 1353 */
1439 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1354 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1440 int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep); 1355 CX_EXPORT int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep);
1441 1356
1442 /** 1357 /**
1443 * Converts a string to a number. 1358 * Converts a string to a number.
1444 * 1359 *
1445 * The function returns non-zero when conversion is not possible. 1360 * The function returns non-zero when conversion is not possible.
1446 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1361 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1447 * It sets errno to ERANGE when the target datatype is too small. 1362 * It sets errno to ERANGE when the target datatype is too small.
1448 * 1363 *
1449 * @param str the string to convert 1364 * @param str the string to convert
1450 * @param output a pointer to the integer variable where the result shall be stored 1365 * @param output a pointer to the integer variable where the result shall be stored
1451 * @param base 2, 8, 10, or 16 1366 * @param base 2, 8, 10, or 16
1452 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1367 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1453 * @retval zero success 1368 * @retval zero success
1454 * @retval non-zero conversion was not possible 1369 * @retval non-zero conversion was not possible
1455 */ 1370 */
1456 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1371 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1457 int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep); 1372 CX_EXPORT int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep);
1458 1373
1459 /** 1374 /**
1460 * Converts a string to a number. 1375 * Converts a string to a number.
1461 * 1376 *
1462 * The function returns non-zero when conversion is not possible. 1377 * The function returns non-zero when conversion is not possible.
1463 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1378 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1464 * It sets errno to ERANGE when the target datatype is too small. 1379 * It sets errno to ERANGE when the target datatype is too small.
1465 * 1380 *
1466 * @param str the string to convert 1381 * @param str the string to convert
1467 * @param output a pointer to the integer variable where the result shall be stored 1382 * @param output a pointer to the integer variable where the result shall be stored
1468 * @param base 2, 8, 10, or 16 1383 * @param base 2, 8, 10, or 16
1469 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1384 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1470 * @retval zero success 1385 * @retval zero success
1471 * @retval non-zero conversion was not possible 1386 * @retval non-zero conversion was not possible
1472 */ 1387 */
1473 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1388 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1474 int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep); 1389 CX_EXPORT int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep);
1475 1390
1476 /** 1391 /**
1477 * Converts a string to a number. 1392 * Converts a string to a number.
1478 * 1393 *
1479 * The function returns non-zero when conversion is not possible. 1394 * The function returns non-zero when conversion is not possible.
1480 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1395 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1481 * It sets errno to ERANGE when the target datatype is too small. 1396 * It sets errno to ERANGE when the target datatype is too small.
1482 * 1397 *
1483 * @param str the string to convert 1398 * @param str the string to convert
1484 * @param output a pointer to the integer variable where the result shall be stored 1399 * @param output a pointer to the integer variable where the result shall be stored
1485 * @param base 2, 8, 10, or 16 1400 * @param base 2, 8, 10, or 16
1486 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1401 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1487 * @retval zero success 1402 * @retval zero success
1488 * @retval non-zero conversion was not possible 1403 * @retval non-zero conversion was not possible
1489 */ 1404 */
1490 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1405 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1491 int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep); 1406 CX_EXPORT int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep);
1492 1407
1493 /** 1408 /**
1494 * Converts a string to a single precision floating point number. 1409 * Converts a string to a single precision floating-point number.
1495 * 1410 *
1496 * The function returns non-zero when conversion is not possible. 1411 * The function returns non-zero when conversion is not possible.
1497 * In that case the function sets errno to EINVAL when the reason is an invalid character. 1412 * In that case the function sets errno to EINVAL when the reason is an invalid character.
1498 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. 1413 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h.
1499 * 1414 *
1500 * @param str the string to convert 1415 * @param str the string to convert
1501 * @param output a pointer to the float variable where the result shall be stored 1416 * @param output a pointer to the float variable where the result shall be stored
1502 * @param decsep the decimal separator 1417 * @param decsep the decimal separator
1503 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1418 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1504 * @retval zero success 1419 * @retval zero success
1505 * @retval non-zero conversion was not possible 1420 * @retval non-zero conversion was not possible
1506 */ 1421 */
1507 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1422 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1508 int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep); 1423 CX_EXPORT int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep);
1509 1424
1510 /** 1425 /**
1511 * Converts a string to a double precision floating point number. 1426 * Converts a string to a double precision floating-point number.
1512 * 1427 *
1513 * The function returns non-zero when conversion is not possible. 1428 * The function returns non-zero when conversion is not possible.
1514 * In that case the function sets errno to EINVAL when the reason is an invalid character. 1429 * In that case the function sets errno to EINVAL when the reason is an invalid character.
1515 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. 1430 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h.
1516 * 1431 *
1517 * @param str the string to convert 1432 * @param str the string to convert
1518 * @param output a pointer to the float variable where the result shall be stored 1433 * @param output a pointer to the float variable where the result shall be stored
1519 * @param decsep the decimal separator 1434 * @param decsep the decimal separator
1520 * @param groupsep each character in this string is treated as group separator and ignored during conversion 1435 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
1521 * @retval zero success 1436 * @retval zero success
1522 * @retval non-zero conversion was not possible 1437 * @retval non-zero conversion was not possible
1523 */ 1438 */
1524 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export 1439 cx_attr_access_w(2) cx_attr_nonnull_arg(2)
1525 int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep); 1440 CX_EXPORT int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep);
1526 1441
1527 /** 1442 /**
1528 * Converts a string to a number. 1443 * Converts a string to a number.
1529 * 1444 *
1530 * The function returns non-zero when conversion is not possible. 1445 * The function returns non-zero when conversion is not possible.
1531 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1446 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1532 * It sets errno to ERANGE when the target datatype is too small. 1447 * It sets errno to ERANGE when the target datatype is too small.
1533 * 1448 *
1534 * @param str the string to convert 1449 * @param str the string to convert
1535 * @param output a pointer to the integer variable where the result shall be stored 1450 * @param output a pointer to the integer variable where the result shall be stored
1536 * @param base 2, 8, 10, or 16 1451 * @param base 2, 8, 10, or 16
1537 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1452 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1538 * @retval zero success 1453 * @retval zero success
1539 * @retval non-zero conversion was not possible 1454 * @retval non-zero conversion was not possible
1540 */ 1455 */
1541 #define cx_strtos_lc(str, output, base, groupsep) cx_strtos_lc_(cx_strcast(str), output, base, groupsep) 1456 #define cx_strtos_lc(str, output, base, groupsep) cx_strtos_lc_(cx_strcast(str), output, base, groupsep)
1542 1457
1548 * It sets errno to ERANGE when the target datatype is too small. 1463 * It sets errno to ERANGE when the target datatype is too small.
1549 * 1464 *
1550 * @param str the string to convert 1465 * @param str the string to convert
1551 * @param output a pointer to the integer variable where the result shall be stored 1466 * @param output a pointer to the integer variable where the result shall be stored
1552 * @param base 2, 8, 10, or 16 1467 * @param base 2, 8, 10, or 16
1553 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1468 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1554 * @retval zero success 1469 * @retval zero success
1555 * @retval non-zero conversion was not possible 1470 * @retval non-zero conversion was not possible
1556 */ 1471 */
1557 #define cx_strtoi_lc(str, output, base, groupsep) cx_strtoi_lc_(cx_strcast(str), output, base, groupsep) 1472 #define cx_strtoi_lc(str, output, base, groupsep) cx_strtoi_lc_(cx_strcast(str), output, base, groupsep)
1558 1473
1564 * It sets errno to ERANGE when the target datatype is too small. 1479 * It sets errno to ERANGE when the target datatype is too small.
1565 * 1480 *
1566 * @param str the string to convert 1481 * @param str the string to convert
1567 * @param output a pointer to the integer variable where the result shall be stored 1482 * @param output a pointer to the integer variable where the result shall be stored
1568 * @param base 2, 8, 10, or 16 1483 * @param base 2, 8, 10, or 16
1569 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1484 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1570 * @retval zero success 1485 * @retval zero success
1571 * @retval non-zero conversion was not possible 1486 * @retval non-zero conversion was not possible
1572 */ 1487 */
1573 #define cx_strtol_lc(str, output, base, groupsep) cx_strtol_lc_(cx_strcast(str), output, base, groupsep) 1488 #define cx_strtol_lc(str, output, base, groupsep) cx_strtol_lc_(cx_strcast(str), output, base, groupsep)
1574 1489
1580 * It sets errno to ERANGE when the target datatype is too small. 1495 * It sets errno to ERANGE when the target datatype is too small.
1581 * 1496 *
1582 * @param str the string to convert 1497 * @param str the string to convert
1583 * @param output a pointer to the integer variable where the result shall be stored 1498 * @param output a pointer to the integer variable where the result shall be stored
1584 * @param base 2, 8, 10, or 16 1499 * @param base 2, 8, 10, or 16
1585 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1500 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1586 * @retval zero success 1501 * @retval zero success
1587 * @retval non-zero conversion was not possible 1502 * @retval non-zero conversion was not possible
1588 */ 1503 */
1589 #define cx_strtoll_lc(str, output, base, groupsep) cx_strtoll_lc_(cx_strcast(str), output, base, groupsep) 1504 #define cx_strtoll_lc(str, output, base, groupsep) cx_strtoll_lc_(cx_strcast(str), output, base, groupsep)
1590 1505
1596 * It sets errno to ERANGE when the target datatype is too small. 1511 * It sets errno to ERANGE when the target datatype is too small.
1597 * 1512 *
1598 * @param str the string to convert 1513 * @param str the string to convert
1599 * @param output a pointer to the integer variable where the result shall be stored 1514 * @param output a pointer to the integer variable where the result shall be stored
1600 * @param base 2, 8, 10, or 16 1515 * @param base 2, 8, 10, or 16
1601 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1516 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1602 * @retval zero success 1517 * @retval zero success
1603 * @retval non-zero conversion was not possible 1518 * @retval non-zero conversion was not possible
1604 */ 1519 */
1605 #define cx_strtoi8_lc(str, output, base, groupsep) cx_strtoi8_lc_(cx_strcast(str), output, base, groupsep) 1520 #define cx_strtoi8_lc(str, output, base, groupsep) cx_strtoi8_lc_(cx_strcast(str), output, base, groupsep)
1606 1521
1612 * It sets errno to ERANGE when the target datatype is too small. 1527 * It sets errno to ERANGE when the target datatype is too small.
1613 * 1528 *
1614 * @param str the string to convert 1529 * @param str the string to convert
1615 * @param output a pointer to the integer variable where the result shall be stored 1530 * @param output a pointer to the integer variable where the result shall be stored
1616 * @param base 2, 8, 10, or 16 1531 * @param base 2, 8, 10, or 16
1617 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1532 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1618 * @retval zero success 1533 * @retval zero success
1619 * @retval non-zero conversion was not possible 1534 * @retval non-zero conversion was not possible
1620 */ 1535 */
1621 #define cx_strtoi16_lc(str, output, base, groupsep) cx_strtoi16_lc_(cx_strcast(str), output, base, groupsep) 1536 #define cx_strtoi16_lc(str, output, base, groupsep) cx_strtoi16_lc_(cx_strcast(str), output, base, groupsep)
1622 1537
1628 * It sets errno to ERANGE when the target datatype is too small. 1543 * It sets errno to ERANGE when the target datatype is too small.
1629 * 1544 *
1630 * @param str the string to convert 1545 * @param str the string to convert
1631 * @param output a pointer to the integer variable where the result shall be stored 1546 * @param output a pointer to the integer variable where the result shall be stored
1632 * @param base 2, 8, 10, or 16 1547 * @param base 2, 8, 10, or 16
1633 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1548 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1634 * @retval zero success 1549 * @retval zero success
1635 * @retval non-zero conversion was not possible 1550 * @retval non-zero conversion was not possible
1636 */ 1551 */
1637 #define cx_strtoi32_lc(str, output, base, groupsep) cx_strtoi32_lc_(cx_strcast(str), output, base, groupsep) 1552 #define cx_strtoi32_lc(str, output, base, groupsep) cx_strtoi32_lc_(cx_strcast(str), output, base, groupsep)
1638 1553
1644 * It sets errno to ERANGE when the target datatype is too small. 1559 * It sets errno to ERANGE when the target datatype is too small.
1645 * 1560 *
1646 * @param str the string to convert 1561 * @param str the string to convert
1647 * @param output a pointer to the integer variable where the result shall be stored 1562 * @param output a pointer to the integer variable where the result shall be stored
1648 * @param base 2, 8, 10, or 16 1563 * @param base 2, 8, 10, or 16
1649 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1564 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1650 * @retval zero success 1565 * @retval zero success
1651 * @retval non-zero conversion was not possible 1566 * @retval non-zero conversion was not possible
1652 */ 1567 */
1653 #define cx_strtoi64_lc(str, output, base, groupsep) cx_strtoi64_lc_(cx_strcast(str), output, base, groupsep) 1568 #define cx_strtoi64_lc(str, output, base, groupsep) cx_strtoi64_lc_(cx_strcast(str), output, base, groupsep)
1654 1569
1660 * It sets errno to ERANGE when the target datatype is too small. 1575 * It sets errno to ERANGE when the target datatype is too small.
1661 * 1576 *
1662 * @param str the string to convert 1577 * @param str the string to convert
1663 * @param output a pointer to the integer variable where the result shall be stored 1578 * @param output a pointer to the integer variable where the result shall be stored
1664 * @param base 2, 8, 10, or 16 1579 * @param base 2, 8, 10, or 16
1665 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1580 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1666 * @retval zero success 1581 * @retval zero success
1667 * @retval non-zero conversion was not possible 1582 * @retval non-zero conversion was not possible
1668 */ 1583 */
1669 #define cx_strtous_lc(str, output, base, groupsep) cx_strtous_lc_(cx_strcast(str), output, base, groupsep) 1584 #define cx_strtous_lc(str, output, base, groupsep) cx_strtous_lc_(cx_strcast(str), output, base, groupsep)
1670 1585
1676 * It sets errno to ERANGE when the target datatype is too small. 1591 * It sets errno to ERANGE when the target datatype is too small.
1677 * 1592 *
1678 * @param str the string to convert 1593 * @param str the string to convert
1679 * @param output a pointer to the integer variable where the result shall be stored 1594 * @param output a pointer to the integer variable where the result shall be stored
1680 * @param base 2, 8, 10, or 16 1595 * @param base 2, 8, 10, or 16
1681 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1596 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1682 * @retval zero success 1597 * @retval zero success
1683 * @retval non-zero conversion was not possible 1598 * @retval non-zero conversion was not possible
1684 */ 1599 */
1685 #define cx_strtou_lc(str, output, base, groupsep) cx_strtou_lc_(cx_strcast(str), output, base, groupsep) 1600 #define cx_strtou_lc(str, output, base, groupsep) cx_strtou_lc_(cx_strcast(str), output, base, groupsep)
1686 1601
1692 * It sets errno to ERANGE when the target datatype is too small. 1607 * It sets errno to ERANGE when the target datatype is too small.
1693 * 1608 *
1694 * @param str the string to convert 1609 * @param str the string to convert
1695 * @param output a pointer to the integer variable where the result shall be stored 1610 * @param output a pointer to the integer variable where the result shall be stored
1696 * @param base 2, 8, 10, or 16 1611 * @param base 2, 8, 10, or 16
1697 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1612 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1698 * @retval zero success 1613 * @retval zero success
1699 * @retval non-zero conversion was not possible 1614 * @retval non-zero conversion was not possible
1700 */ 1615 */
1701 #define cx_strtoul_lc(str, output, base, groupsep) cx_strtoul_lc_(cx_strcast(str), output, base, groupsep) 1616 #define cx_strtoul_lc(str, output, base, groupsep) cx_strtoul_lc_(cx_strcast(str), output, base, groupsep)
1702 1617
1708 * It sets errno to ERANGE when the target datatype is too small. 1623 * It sets errno to ERANGE when the target datatype is too small.
1709 * 1624 *
1710 * @param str the string to convert 1625 * @param str the string to convert
1711 * @param output a pointer to the integer variable where the result shall be stored 1626 * @param output a pointer to the integer variable where the result shall be stored
1712 * @param base 2, 8, 10, or 16 1627 * @param base 2, 8, 10, or 16
1713 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1628 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1714 * @retval zero success 1629 * @retval zero success
1715 * @retval non-zero conversion was not possible 1630 * @retval non-zero conversion was not possible
1716 */ 1631 */
1717 #define cx_strtoull_lc(str, output, base, groupsep) cx_strtoull_lc_(cx_strcast(str), output, base, groupsep) 1632 #define cx_strtoull_lc(str, output, base, groupsep) cx_strtoull_lc_(cx_strcast(str), output, base, groupsep)
1718 1633
1724 * It sets errno to ERANGE when the target datatype is too small. 1639 * It sets errno to ERANGE when the target datatype is too small.
1725 * 1640 *
1726 * @param str the string to convert 1641 * @param str the string to convert
1727 * @param output a pointer to the integer variable where the result shall be stored 1642 * @param output a pointer to the integer variable where the result shall be stored
1728 * @param base 2, 8, 10, or 16 1643 * @param base 2, 8, 10, or 16
1729 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1644 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1730 * @retval zero success 1645 * @retval zero success
1731 * @retval non-zero conversion was not possible 1646 * @retval non-zero conversion was not possible
1732 */ 1647 */
1733 #define cx_strtou8_lc(str, output, base, groupsep) cx_strtou8_lc_(cx_strcast(str), output, base, groupsep) 1648 #define cx_strtou8_lc(str, output, base, groupsep) cx_strtou8_lc_(cx_strcast(str), output, base, groupsep)
1734 1649
1740 * It sets errno to ERANGE when the target datatype is too small. 1655 * It sets errno to ERANGE when the target datatype is too small.
1741 * 1656 *
1742 * @param str the string to convert 1657 * @param str the string to convert
1743 * @param output a pointer to the integer variable where the result shall be stored 1658 * @param output a pointer to the integer variable where the result shall be stored
1744 * @param base 2, 8, 10, or 16 1659 * @param base 2, 8, 10, or 16
1745 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1660 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1746 * @retval zero success 1661 * @retval zero success
1747 * @retval non-zero conversion was not possible 1662 * @retval non-zero conversion was not possible
1748 */ 1663 */
1749 #define cx_strtou16_lc(str, output, base, groupsep) cx_strtou16_lc_(cx_strcast(str), output, base, groupsep) 1664 #define cx_strtou16_lc(str, output, base, groupsep) cx_strtou16_lc_(cx_strcast(str), output, base, groupsep)
1750 1665
1756 * It sets errno to ERANGE when the target datatype is too small. 1671 * It sets errno to ERANGE when the target datatype is too small.
1757 * 1672 *
1758 * @param str the string to convert 1673 * @param str the string to convert
1759 * @param output a pointer to the integer variable where the result shall be stored 1674 * @param output a pointer to the integer variable where the result shall be stored
1760 * @param base 2, 8, 10, or 16 1675 * @param base 2, 8, 10, or 16
1761 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1676 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1762 * @retval zero success 1677 * @retval zero success
1763 * @retval non-zero conversion was not possible 1678 * @retval non-zero conversion was not possible
1764 */ 1679 */
1765 #define cx_strtou32_lc(str, output, base, groupsep) cx_strtou32_lc_(cx_strcast(str), output, base, groupsep) 1680 #define cx_strtou32_lc(str, output, base, groupsep) cx_strtou32_lc_(cx_strcast(str), output, base, groupsep)
1766 1681
1772 * It sets errno to ERANGE when the target datatype is too small. 1687 * It sets errno to ERANGE when the target datatype is too small.
1773 * 1688 *
1774 * @param str the string to convert 1689 * @param str the string to convert
1775 * @param output a pointer to the integer variable where the result shall be stored 1690 * @param output a pointer to the integer variable where the result shall be stored
1776 * @param base 2, 8, 10, or 16 1691 * @param base 2, 8, 10, or 16
1777 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1692 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1778 * @retval zero success 1693 * @retval zero success
1779 * @retval non-zero conversion was not possible 1694 * @retval non-zero conversion was not possible
1780 */ 1695 */
1781 #define cx_strtou64_lc(str, output, base, groupsep) cx_strtou64_lc_(cx_strcast(str), output, base, groupsep) 1696 #define cx_strtou64_lc(str, output, base, groupsep) cx_strtou64_lc_(cx_strcast(str), output, base, groupsep)
1782 1697
1788 * It sets errno to ERANGE when the target datatype is too small. 1703 * It sets errno to ERANGE when the target datatype is too small.
1789 * 1704 *
1790 * @param str the string to convert 1705 * @param str the string to convert
1791 * @param output a pointer to the integer variable where the result shall be stored 1706 * @param output a pointer to the integer variable where the result shall be stored
1792 * @param base 2, 8, 10, or 16 1707 * @param base 2, 8, 10, or 16
1793 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion 1708 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion
1794 * @retval zero success 1709 * @retval zero success
1795 * @retval non-zero conversion was not possible 1710 * @retval non-zero conversion was not possible
1796 */ 1711 */
1797 #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc_(cx_strcast(str), output, base, groupsep) 1712 #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc_(cx_strcast(str), output, base, groupsep)
1798 1713
1801 * 1716 *
1802 * The function returns non-zero when conversion is not possible. 1717 * The function returns non-zero when conversion is not possible.
1803 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1718 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1804 * It sets errno to ERANGE when the target datatype is too small. 1719 * It sets errno to ERANGE when the target datatype is too small.
1805 * 1720 *
1806 * The comma character is treated as group separator and ignored during parsing. 1721 * The comma character is treated as a group separator and ignored during parsing.
1807 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1722 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1808 * 1723 *
1809 * @param str the string to convert 1724 * @param str the string to convert
1810 * @param output a pointer to the integer variable where the result shall be stored 1725 * @param output a pointer to the integer variable where the result shall be stored
1811 * @param base 2, 8, 10, or 16 1726 * @param base 2, 8, 10, or 16
1819 * 1734 *
1820 * The function returns non-zero when conversion is not possible. 1735 * The function returns non-zero when conversion is not possible.
1821 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1736 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1822 * It sets errno to ERANGE when the target datatype is too small. 1737 * It sets errno to ERANGE when the target datatype is too small.
1823 * 1738 *
1824 * The comma character is treated as group separator and ignored during parsing. 1739 * The comma character is treated as a group separator and ignored during parsing.
1825 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1740 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1826 * 1741 *
1827 * @param str the string to convert 1742 * @param str the string to convert
1828 * @param output a pointer to the integer variable where the result shall be stored 1743 * @param output a pointer to the integer variable where the result shall be stored
1829 * @param base 2, 8, 10, or 16 1744 * @param base 2, 8, 10, or 16
1837 * 1752 *
1838 * The function returns non-zero when conversion is not possible. 1753 * The function returns non-zero when conversion is not possible.
1839 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1754 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1840 * It sets errno to ERANGE when the target datatype is too small. 1755 * It sets errno to ERANGE when the target datatype is too small.
1841 * 1756 *
1842 * The comma character is treated as group separator and ignored during parsing. 1757 * The comma character is treated as a group separator and ignored during parsing.
1843 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1758 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1844 * 1759 *
1845 * @param str the string to convert 1760 * @param str the string to convert
1846 * @param output a pointer to the integer variable where the result shall be stored 1761 * @param output a pointer to the integer variable where the result shall be stored
1847 * @param base 2, 8, 10, or 16 1762 * @param base 2, 8, 10, or 16
1855 * 1770 *
1856 * The function returns non-zero when conversion is not possible. 1771 * The function returns non-zero when conversion is not possible.
1857 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1772 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1858 * It sets errno to ERANGE when the target datatype is too small. 1773 * It sets errno to ERANGE when the target datatype is too small.
1859 * 1774 *
1860 * The comma character is treated as group separator and ignored during parsing. 1775 * The comma character is treated as a group separator and ignored during parsing.
1861 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1776 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1862 * 1777 *
1863 * @param str the string to convert 1778 * @param str the string to convert
1864 * @param output a pointer to the integer variable where the result shall be stored 1779 * @param output a pointer to the integer variable where the result shall be stored
1865 * @param base 2, 8, 10, or 16 1780 * @param base 2, 8, 10, or 16
1873 * 1788 *
1874 * The function returns non-zero when conversion is not possible. 1789 * The function returns non-zero when conversion is not possible.
1875 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1790 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1876 * It sets errno to ERANGE when the target datatype is too small. 1791 * It sets errno to ERANGE when the target datatype is too small.
1877 * 1792 *
1878 * The comma character is treated as group separator and ignored during parsing. 1793 * The comma character is treated as a group separator and ignored during parsing.
1879 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1794 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1880 * 1795 *
1881 * @param str the string to convert 1796 * @param str the string to convert
1882 * @param output a pointer to the integer variable where the result shall be stored 1797 * @param output a pointer to the integer variable where the result shall be stored
1883 * @param base 2, 8, 10, or 16 1798 * @param base 2, 8, 10, or 16
1891 * 1806 *
1892 * The function returns non-zero when conversion is not possible. 1807 * The function returns non-zero when conversion is not possible.
1893 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1808 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1894 * It sets errno to ERANGE when the target datatype is too small. 1809 * It sets errno to ERANGE when the target datatype is too small.
1895 * 1810 *
1896 * The comma character is treated as group separator and ignored during parsing. 1811 * The comma character is treated as a group separator and ignored during parsing.
1897 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1812 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1898 * 1813 *
1899 * @param str the string to convert 1814 * @param str the string to convert
1900 * @param output a pointer to the integer variable where the result shall be stored 1815 * @param output a pointer to the integer variable where the result shall be stored
1901 * @param base 2, 8, 10, or 16 1816 * @param base 2, 8, 10, or 16
1909 * 1824 *
1910 * The function returns non-zero when conversion is not possible. 1825 * The function returns non-zero when conversion is not possible.
1911 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1826 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1912 * It sets errno to ERANGE when the target datatype is too small. 1827 * It sets errno to ERANGE when the target datatype is too small.
1913 * 1828 *
1914 * The comma character is treated as group separator and ignored during parsing. 1829 * The comma character is treated as a group separator and ignored during parsing.
1915 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1830 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1916 * 1831 *
1917 * @param str the string to convert 1832 * @param str the string to convert
1918 * @param output a pointer to the integer variable where the result shall be stored 1833 * @param output a pointer to the integer variable where the result shall be stored
1919 * @param base 2, 8, 10, or 16 1834 * @param base 2, 8, 10, or 16
1927 * 1842 *
1928 * The function returns non-zero when conversion is not possible. 1843 * The function returns non-zero when conversion is not possible.
1929 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1844 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1930 * It sets errno to ERANGE when the target datatype is too small. 1845 * It sets errno to ERANGE when the target datatype is too small.
1931 * 1846 *
1932 * The comma character is treated as group separator and ignored during parsing. 1847 * The comma character is treated as a group separator and ignored during parsing.
1933 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1848 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1934 * 1849 *
1935 * @param str the string to convert 1850 * @param str the string to convert
1936 * @param output a pointer to the integer variable where the result shall be stored 1851 * @param output a pointer to the integer variable where the result shall be stored
1937 * @param base 2, 8, 10, or 16 1852 * @param base 2, 8, 10, or 16
1945 * 1860 *
1946 * The function returns non-zero when conversion is not possible. 1861 * The function returns non-zero when conversion is not possible.
1947 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1862 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1948 * It sets errno to ERANGE when the target datatype is too small. 1863 * It sets errno to ERANGE when the target datatype is too small.
1949 * 1864 *
1950 * The comma character is treated as group separator and ignored during parsing. 1865 * The comma character is treated as a group separator and ignored during parsing.
1951 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1866 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1952 * 1867 *
1953 * @param str the string to convert 1868 * @param str the string to convert
1954 * @param output a pointer to the integer variable where the result shall be stored 1869 * @param output a pointer to the integer variable where the result shall be stored
1955 * @param base 2, 8, 10, or 16 1870 * @param base 2, 8, 10, or 16
1963 * 1878 *
1964 * The function returns non-zero when conversion is not possible. 1879 * The function returns non-zero when conversion is not possible.
1965 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1880 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1966 * It sets errno to ERANGE when the target datatype is too small. 1881 * It sets errno to ERANGE when the target datatype is too small.
1967 * 1882 *
1968 * The comma character is treated as group separator and ignored during parsing. 1883 * The comma character is treated as a group separator and ignored during parsing.
1969 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1884 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1970 * 1885 *
1971 * @param str the string to convert 1886 * @param str the string to convert
1972 * @param output a pointer to the integer variable where the result shall be stored 1887 * @param output a pointer to the integer variable where the result shall be stored
1973 * @param base 2, 8, 10, or 16 1888 * @param base 2, 8, 10, or 16
1981 * 1896 *
1982 * The function returns non-zero when conversion is not possible. 1897 * The function returns non-zero when conversion is not possible.
1983 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1898 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
1984 * It sets errno to ERANGE when the target datatype is too small. 1899 * It sets errno to ERANGE when the target datatype is too small.
1985 * 1900 *
1986 * The comma character is treated as group separator and ignored during parsing. 1901 * The comma character is treated as a group separator and ignored during parsing.
1987 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1902 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
1988 * 1903 *
1989 * @param str the string to convert 1904 * @param str the string to convert
1990 * @param output a pointer to the integer variable where the result shall be stored 1905 * @param output a pointer to the integer variable where the result shall be stored
1991 * @param base 2, 8, 10, or 16 1906 * @param base 2, 8, 10, or 16
1999 * 1914 *
2000 * The function returns non-zero when conversion is not possible. 1915 * The function returns non-zero when conversion is not possible.
2001 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1916 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
2002 * It sets errno to ERANGE when the target datatype is too small. 1917 * It sets errno to ERANGE when the target datatype is too small.
2003 * 1918 *
2004 * The comma character is treated as group separator and ignored during parsing. 1919 * The comma character is treated as a group separator and ignored during parsing.
2005 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1920 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
2006 * 1921 *
2007 * @param str the string to convert 1922 * @param str the string to convert
2008 * @param output a pointer to the integer variable where the result shall be stored 1923 * @param output a pointer to the integer variable where the result shall be stored
2009 * @param base 2, 8, 10, or 16 1924 * @param base 2, 8, 10, or 16
2017 * 1932 *
2018 * The function returns non-zero when conversion is not possible. 1933 * The function returns non-zero when conversion is not possible.
2019 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1934 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
2020 * It sets errno to ERANGE when the target datatype is too small. 1935 * It sets errno to ERANGE when the target datatype is too small.
2021 * 1936 *
2022 * The comma character is treated as group separator and ignored during parsing. 1937 * The comma character is treated as a group separator and ignored during parsing.
2023 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1938 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
2024 * 1939 *
2025 * @param str the string to convert 1940 * @param str the string to convert
2026 * @param output a pointer to the integer variable where the result shall be stored 1941 * @param output a pointer to the integer variable where the result shall be stored
2027 * @param base 2, 8, 10, or 16 1942 * @param base 2, 8, 10, or 16
2035 * 1950 *
2036 * The function returns non-zero when conversion is not possible. 1951 * The function returns non-zero when conversion is not possible.
2037 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1952 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
2038 * It sets errno to ERANGE when the target datatype is too small. 1953 * It sets errno to ERANGE when the target datatype is too small.
2039 * 1954 *
2040 * The comma character is treated as group separator and ignored during parsing. 1955 * The comma character is treated as a group separator and ignored during parsing.
2041 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1956 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
2042 * 1957 *
2043 * @param str the string to convert 1958 * @param str the string to convert
2044 * @param output a pointer to the integer variable where the result shall be stored 1959 * @param output a pointer to the integer variable where the result shall be stored
2045 * @param base 2, 8, 10, or 16 1960 * @param base 2, 8, 10, or 16
2053 * 1968 *
2054 * The function returns non-zero when conversion is not possible. 1969 * The function returns non-zero when conversion is not possible.
2055 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1970 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
2056 * It sets errno to ERANGE when the target datatype is too small. 1971 * It sets errno to ERANGE when the target datatype is too small.
2057 * 1972 *
2058 * The comma character is treated as group separator and ignored during parsing. 1973 * The comma character is treated as a group separator and ignored during parsing.
2059 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1974 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
2060 * 1975 *
2061 * @param str the string to convert 1976 * @param str the string to convert
2062 * @param output a pointer to the integer variable where the result shall be stored 1977 * @param output a pointer to the integer variable where the result shall be stored
2063 * @param base 2, 8, 10, or 16 1978 * @param base 2, 8, 10, or 16
2071 * 1986 *
2072 * The function returns non-zero when conversion is not possible. 1987 * The function returns non-zero when conversion is not possible.
2073 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 1988 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
2074 * It sets errno to ERANGE when the target datatype is too small. 1989 * It sets errno to ERANGE when the target datatype is too small.
2075 * 1990 *
2076 * The comma character is treated as group separator and ignored during parsing. 1991 * The comma character is treated as a group separator and ignored during parsing.
2077 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 1992 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
2078 * 1993 *
2079 * @param str the string to convert 1994 * @param str the string to convert
2080 * @param output a pointer to the integer variable where the result shall be stored 1995 * @param output a pointer to the integer variable where the result shall be stored
2081 * @param base 2, 8, 10, or 16 1996 * @param base 2, 8, 10, or 16
2089 * 2004 *
2090 * The function returns non-zero when conversion is not possible. 2005 * The function returns non-zero when conversion is not possible.
2091 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. 2006 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base.
2092 * It sets errno to ERANGE when the target datatype is too small. 2007 * It sets errno to ERANGE when the target datatype is too small.
2093 * 2008 *
2094 * The comma character is treated as group separator and ignored during parsing. 2009 * The comma character is treated as a group separator and ignored during parsing.
2095 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). 2010 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()).
2096 * 2011 *
2097 * @param str the string to convert 2012 * @param str the string to convert
2098 * @param output a pointer to the integer variable where the result shall be stored 2013 * @param output a pointer to the integer variable where the result shall be stored
2099 * @param base 2, 8, 10, or 16 2014 * @param base 2, 8, 10, or 16
2101 * @retval non-zero conversion was not possible 2016 * @retval non-zero conversion was not possible
2102 */ 2017 */
2103 #define cx_strtou64(str, output, base) cx_strtou64_lc_(cx_strcast(str), output, base, ",") 2018 #define cx_strtou64(str, output, base) cx_strtou64_lc_(cx_strcast(str), output, base, ",")
2104 2019
2105 /** 2020 /**
2106 * Converts a string to a single precision floating point number. 2021 * Converts a string to a single precision floating-point number.
2107 * 2022 *
2108 * The function returns non-zero when conversion is not possible. 2023 * The function returns non-zero when conversion is not possible.
2109 * In that case the function sets errno to EINVAL when the reason is an invalid character. 2024 * In that case the function sets errno to EINVAL when the reason is an invalid character.
2110 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. 2025 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h.
2111 * 2026 *
2112 * @param str the string to convert 2027 * @param str the string to convert
2113 * @param output a pointer to the float variable where the result shall be stored 2028 * @param output a pointer to the float variable where the result shall be stored
2114 * @param decsep the decimal separator 2029 * @param decsep the decimal separator
2115 * @param groupsep each character in this string is treated as group separator and ignored during conversion 2030 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
2116 * @retval zero success 2031 * @retval zero success
2117 * @retval non-zero conversion was not possible 2032 * @retval non-zero conversion was not possible
2118 */ 2033 */
2119 #define cx_strtof_lc(str, output, decsep, groupsep) cx_strtof_lc_(cx_strcast(str), output, decsep, groupsep) 2034 #define cx_strtof_lc(str, output, decsep, groupsep) cx_strtof_lc_(cx_strcast(str), output, decsep, groupsep)
2120 2035
2121 /** 2036 /**
2122 * Converts a string to a double precision floating point number. 2037 * Converts a string to a double precision floating-point number.
2123 * 2038 *
2124 * The function returns non-zero when conversion is not possible. 2039 * The function returns non-zero when conversion is not possible.
2125 * In that case the function sets errno to EINVAL when the reason is an invalid character. 2040 * In that case the function sets errno to EINVAL when the reason is an invalid character.
2126 * 2041 *
2127 * @param str the string to convert 2042 * @param str the string to convert
2128 * @param output a pointer to the double variable where the result shall be stored 2043 * @param output a pointer to the double variable where the result shall be stored
2129 * @param decsep the decimal separator 2044 * @param decsep the decimal separator
2130 * @param groupsep each character in this string is treated as group separator and ignored during conversion 2045 * @param groupsep each character in this string is treated as a group separator and ignored during conversion
2131 * @retval zero success 2046 * @retval zero success
2132 * @retval non-zero conversion was not possible 2047 * @retval non-zero conversion was not possible
2133 */ 2048 */
2134 #define cx_strtod_lc(str, output, decsep, groupsep) cx_strtod_lc_(cx_strcast(str), output, decsep, groupsep) 2049 #define cx_strtod_lc(str, output, decsep, groupsep) cx_strtod_lc_(cx_strcast(str), output, decsep, groupsep)
2135 2050
2136 /** 2051 /**
2137 * Converts a string to a single precision floating point number. 2052 * Converts a string to a single precision floating-point number.
2138 * 2053 *
2139 * The function returns non-zero when conversion is not possible. 2054 * The function returns non-zero when conversion is not possible.
2140 * In that case the function sets errno to EINVAL when the reason is an invalid character. 2055 * In that case the function sets errno to EINVAL when the reason is an invalid character.
2141 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. 2056 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h.
2142 * 2057 *
2143 * The decimal separator is assumed to be a dot character. 2058 * The decimal separator is assumed to be a dot character.
2144 * The comma character is treated as group separator and ignored during parsing. 2059 * The comma character is treated as a group separator and ignored during parsing.
2145 * If you want to choose a different format, use cx_strtof_lc(). 2060 * If you want to choose a different format, use cx_strtof_lc().
2146 * 2061 *
2147 * @param str the string to convert 2062 * @param str the string to convert
2148 * @param output a pointer to the float variable where the result shall be stored 2063 * @param output a pointer to the float variable where the result shall be stored
2149 * @retval zero success 2064 * @retval zero success
2150 * @retval non-zero conversion was not possible 2065 * @retval non-zero conversion was not possible
2151 */ 2066 */
2152 #define cx_strtof(str, output) cx_strtof_lc_(cx_strcast(str), output, '.', ",") 2067 #define cx_strtof(str, output) cx_strtof_lc_(cx_strcast(str), output, '.', ",")
2153 2068
2154 /** 2069 /**
2155 * Converts a string to a double precision floating point number. 2070 * Converts a string to a double precision floating-point number.
2156 * 2071 *
2157 * The function returns non-zero when conversion is not possible. 2072 * The function returns non-zero when conversion is not possible.
2158 * In that case the function sets errno to EINVAL when the reason is an invalid character. 2073 * In that case the function sets errno to EINVAL when the reason is an invalid character.
2159 * 2074 *
2160 * The decimal separator is assumed to be a dot character. 2075 * The decimal separator is assumed to be a dot character.
2161 * The comma character is treated as group separator and ignored during parsing. 2076 * The comma character is treated as a group separator and ignored during parsing.
2162 * If you want to choose a different format, use cx_strtof_lc(). 2077 * If you want to choose a different format, use cx_strtof_lc().
2163 * 2078 *
2164 * @param str the string to convert 2079 * @param str the string to convert
2165 * @param output a pointer to the double variable where the result shall be stored 2080 * @param output a pointer to the double variable where the result shall be stored
2166 * @retval zero success 2081 * @retval zero success

mercurial