ucx/cx/string.h

Fri, 19 Dec 2025 17:53:18 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 19 Dec 2025 17:53:18 +0100
branch
dav-2
changeset 891
4d58cbcc9efa
parent 889
42cdbf9bbd49
permissions
-rw-r--r--

update ucx

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

mercurial