src/cx/string.h

Sat, 18 Jan 2025 14:10:51 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 18 Jan 2025 14:10:51 +0100
changeset 1134
60edcd57d54c
parent 1127
1fd31909a3f8
permissions
-rw-r--r--

fix that some IDEs cannot resolve documentation

the way we used macros was confusing the IDE

fixes #562

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

mercurial