Sun, 28 Dec 2025 17:31:20 +0100
overhaul all attributes
|
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 | |
|
1582
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
42 | #include <string.h> |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
43 | |
|
1672
94360453bce4
partially revert the changes to cx_strcat() and add CX_NULLSTR macro
Mike Becker <universe@uap-core.de>
parents:
1671
diff
changeset
|
44 | /** Convenience macro for creating a null string */ |
|
94360453bce4
partially revert the changes to cx_strcat() and add CX_NULLSTR macro
Mike Becker <universe@uap-core.de>
parents:
1671
diff
changeset
|
45 | #define CX_NULLSTR cx_mutstr(NULL) |
|
94360453bce4
partially revert the changes to cx_strcat() and add CX_NULLSTR macro
Mike Becker <universe@uap-core.de>
parents:
1671
diff
changeset
|
46 | |
|
1297
0811fb9a8dba
bring back CX_PRIstr and CX_SFMT macros - resolves #612
Mike Becker <universe@uap-core.de>
parents:
1224
diff
changeset
|
47 | /** Expands a UCX string as printf arguments. */ |
|
0811fb9a8dba
bring back CX_PRIstr and CX_SFMT macros - resolves #612
Mike Becker <universe@uap-core.de>
parents:
1224
diff
changeset
|
48 | #define CX_SFMT(s) (int) (s).length, (s).ptr |
|
0811fb9a8dba
bring back CX_PRIstr and CX_SFMT macros - resolves #612
Mike Becker <universe@uap-core.de>
parents:
1224
diff
changeset
|
49 | |
|
0811fb9a8dba
bring back CX_PRIstr and CX_SFMT macros - resolves #612
Mike Becker <universe@uap-core.de>
parents:
1224
diff
changeset
|
50 | /** Format specifier for a UCX string */ |
|
0811fb9a8dba
bring back CX_PRIstr and CX_SFMT macros - resolves #612
Mike Becker <universe@uap-core.de>
parents:
1224
diff
changeset
|
51 | #define CX_PRIstr ".*s" |
|
0811fb9a8dba
bring back CX_PRIstr and CX_SFMT macros - resolves #612
Mike Becker <universe@uap-core.de>
parents:
1224
diff
changeset
|
52 | |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
53 | /** |
|
806
e06249e09f99
add constant for reading out strstr sbo size - relates to #343
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
54 | * 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
|
55 | */ |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
56 | CX_EXPORT 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
|
57 | |
|
e06249e09f99
add constant for reading out strstr sbo size - relates to #343
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
58 | /** |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
59 | * The UCX string structure. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
60 | */ |
|
577
26447d59a5ab
wrong position of struct identifier
Mike Becker <universe@uap-core.de>
parents:
576
diff
changeset
|
61 | struct cx_mutstr_s { |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
62 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
63 | * A pointer to the string. |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
64 | * @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
|
65 | */ |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
66 | char *ptr; |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
67 | /** The length of the string */ |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
68 | size_t length; |
|
577
26447d59a5ab
wrong position of struct identifier
Mike Becker <universe@uap-core.de>
parents:
576
diff
changeset
|
69 | }; |
|
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 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
72 | * A mutable string. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
73 | */ |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
74 | typedef struct cx_mutstr_s cxmutstr; |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
75 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
76 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
77 | * The UCX string structure for immutable (constant) strings. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
78 | */ |
|
577
26447d59a5ab
wrong position of struct identifier
Mike Becker <universe@uap-core.de>
parents:
576
diff
changeset
|
79 | struct cx_string_s { |
|
576
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 | * 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
|
82 | * @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
|
83 | */ |
|
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
806
diff
changeset
|
84 | const char *ptr; |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
85 | /** The length of the string */ |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
86 | size_t length; |
|
577
26447d59a5ab
wrong position of struct identifier
Mike Becker <universe@uap-core.de>
parents:
576
diff
changeset
|
87 | }; |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
88 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
89 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
90 | * An immutable string. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
91 | */ |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
92 | typedef struct cx_string_s cxstring; |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
93 | |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
94 | /** |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
95 | * Context for string tokenizing. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
96 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
97 | struct cx_strtok_ctx_s { |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
98 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
99 | * The string to tokenize. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
100 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
101 | cxstring str; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
102 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
103 | * The primary delimiter. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
104 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
105 | cxstring delim; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
106 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
107 | * Optional array of more delimiters. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
108 | */ |
|
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
806
diff
changeset
|
109 | const cxstring *delim_more; |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
110 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
111 | * Length of the array containing more delimiters. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
112 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
113 | size_t delim_more_count; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
114 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
115 | * 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
|
116 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
117 | size_t pos; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
118 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
119 | * Position of the next delimiter in the source string. |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
120 | * |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
121 | * If the tokenizer has not yet returned a token, the content of this field |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
122 | * is undefined. If the tokenizer reaches the end of the string, this field |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
123 | * contains the length of the source string. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
124 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
125 | size_t delim_pos; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
126 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
127 | * 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
|
128 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
129 | size_t next_pos; |
|
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 | * The number of already found tokens. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
132 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
133 | size_t found; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
134 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
135 | * 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
|
136 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
137 | size_t limit; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
138 | }; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
139 | |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
140 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
141 | * A string tokenizing context. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
142 | */ |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
143 | typedef struct cx_strtok_ctx_s CxStrtokCtx; |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
144 | |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
145 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
146 | * 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
|
147 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
148 | * 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
|
149 | * |
|
1334
7763892ed801
allow NULL for creating UCX strings - resolves #683
Mike Becker <universe@uap-core.de>
parents:
1331
diff
changeset
|
150 | * When @c NULL is passed, the length will be set to zero. |
|
7763892ed801
allow NULL for creating UCX strings - resolves #683
Mike Becker <universe@uap-core.de>
parents:
1331
diff
changeset
|
151 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
152 | * @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
|
153 | * 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
|
154 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
155 | * 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
|
156 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
157 | * @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
|
158 | * @return the wrapped string |
|
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 | * @see cx_mutstrn() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
161 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
162 | CX_NODISCARD CX_CSTR_ARG(1) |
|
1582
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
163 | CX_INLINE cxmutstr cx_mutstr(char *cstring) { |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
164 | cxmutstr str; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
165 | str.ptr = cstring; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
166 | str.length = cstring == NULL ? 0 : strlen(cstring); |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
167 | return str; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
168 | } |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
169 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
170 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
171 | * 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
|
172 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
173 | * 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
|
174 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
175 | * @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
|
176 | * 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
|
177 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
178 | * 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
|
179 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
180 | * @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
|
181 | * @param length the length of the string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
182 | * @return the wrapped string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
183 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
184 | * @see cx_mutstr() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
185 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
186 | CX_NODISCARD CX_ACCESS_RW(1, 2) |
|
1582
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
187 | CX_INLINE cxmutstr cx_mutstrn(char *cstring, size_t length) { |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
188 | cxmutstr str; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
189 | str.ptr = cstring; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
190 | str.length = length; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
191 | return str; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
192 | } |
|
576
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 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
195 | * Wraps a string that must be zero-terminated. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
196 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
197 | * 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
|
198 | * |
|
1334
7763892ed801
allow NULL for creating UCX strings - resolves #683
Mike Becker <universe@uap-core.de>
parents:
1331
diff
changeset
|
199 | * When @c NULL is passed, the length will be set to zero. |
|
7763892ed801
allow NULL for creating UCX strings - resolves #683
Mike Becker <universe@uap-core.de>
parents:
1331
diff
changeset
|
200 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
201 | * @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
|
202 | * 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
|
203 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
204 | * 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
|
205 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
206 | * @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
|
207 | * @return the wrapped string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
208 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
209 | * @see cx_strn() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
210 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
211 | CX_NODISCARD CX_CSTR_ARG(1) |
|
1582
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
212 | CX_INLINE cxstring cx_str(const char *cstring) { |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
213 | cxstring str; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
214 | str.ptr = cstring; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
215 | str.length = cstring == NULL ? 0 : strlen(cstring); |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
216 | return str; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
217 | } |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
218 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
219 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
220 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
221 | * 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
|
222 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
223 | * 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
|
224 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
225 | * @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
|
226 | * 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
|
227 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
228 | * 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
|
229 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
230 | * @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
|
231 | * @param length the length of the string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
232 | * @return the wrapped string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
233 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
234 | * @see cx_str() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
235 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
236 | CX_NODISCARD CX_ACCESS_R(1, 2) |
|
1582
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
237 | CX_INLINE cxstring cx_strn(const char *cstring, size_t length) { |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
238 | cxstring str; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
239 | str.ptr = cstring; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
240 | str.length = length; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
241 | return str; |
|
32b82c424252
removes the CX_STR() macro and instead makes the cx_str() inlinable
Mike Becker <universe@uap-core.de>
parents:
1488
diff
changeset
|
242 | } |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
243 | |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
244 | #ifdef __cplusplus |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
245 | CX_NODISCARD |
| 1673 | 246 | CX_CPPDECL cxmutstr cx_strcast_m(cxmutstr str) { |
| 247 | return str; | |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
248 | } |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
249 | CX_NODISCARD |
| 1673 | 250 | CX_CPPDECL cxstring cx_strcast_m(cxstring str) { |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
251 | return str; |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
252 | } |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
253 | CX_NODISCARD |
| 1673 | 254 | CX_CPPDECL cxmutstr cx_strcast_m(char *str) { |
| 255 | return cx_mutstr(str); | |
| 256 | } | |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
257 | CX_NODISCARD |
| 1673 | 258 | CX_CPPDECL cxmutstr cx_strcast_m(unsigned char *str) { |
| 259 | return cx_mutstr(reinterpret_cast<char*>(str)); | |
| 260 | } | |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
261 | CX_NODISCARD |
| 1673 | 262 | CX_CPPDECL cxstring cx_strcast_m(const char *str) { |
|
1331
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
263 | return cx_str(str); |
|
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
264 | } |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
265 | CX_NODISCARD |
| 1673 | 266 | CX_CPPDECL cxstring cx_strcast_m(const unsigned char *str) { |
|
1488
946895d19dde
fix wrong type of cast in C++ version of string.h
Mike Becker <universe@uap-core.de>
parents:
1426
diff
changeset
|
267 | return cx_str(reinterpret_cast<const char*>(str)); |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
268 | } |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
269 | CX_NODISCARD |
| 1673 | 270 | CX_CPPDECL cxstring cx_strcast_(cxmutstr str) { |
| 271 | return cx_strn(str.ptr, str.length); | |
| 272 | } | |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
273 | CX_NODISCARD |
| 1673 | 274 | CX_CPPDECL cxstring cx_strcast_(cxstring str) { |
| 275 | return str; | |
| 276 | } | |
| 277 | #define cx_strcast(s) cx_strcast_(cx_strcast_m(s)) | |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
278 | #else |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
279 | /** |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
280 | * Internal function, do not use. |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
281 | * @param str |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
282 | * @return |
| 1673 | 283 | * @see cx_strcast_m() |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
284 | * @see cx_strcast() |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
285 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
286 | CX_NODISCARD |
| 1673 | 287 | CX_INLINE cxmutstr cx_strcast_cxms(cxmutstr str) { |
| 288 | return str; | |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
289 | } |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
290 | /** |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
291 | * Internal function, do not use. |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
292 | * @param str |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
293 | * @return |
| 1673 | 294 | * @see cx_strcast_m() |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
295 | * @see cx_strcast() |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
296 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
297 | CX_NODISCARD |
| 1673 | 298 | CX_INLINE cxstring cx_strcast_cxs(cxstring str) { |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
299 | return str; |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
300 | } |
|
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
301 | |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
302 | /** |
|
1331
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
303 | * Internal function, do not use. |
|
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
304 | * @param str |
|
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
305 | * @return |
| 1673 | 306 | * @see cx_strcast_m() |
|
1331
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
307 | * @see cx_strcast() |
|
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
308 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
309 | CX_NODISCARD |
| 1673 | 310 | CX_INLINE cxmutstr cx_strcast_uc(unsigned char *str) { |
| 311 | return cx_mutstr((char*)str); | |
| 312 | } | |
| 313 | ||
| 314 | /** | |
| 315 | * Internal function, do not use. | |
| 316 | * @param str | |
| 317 | * @return | |
| 318 | * @see cx_strcast_m() | |
| 319 | * @see cx_strcast() | |
| 320 | */ | |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
321 | CX_NODISCARD |
| 1673 | 322 | CX_INLINE cxmutstr cx_strcast_c(char *str) { |
| 323 | return cx_mutstr(str); | |
| 324 | } | |
| 325 | ||
| 326 | /** | |
| 327 | * Internal function, do not use. | |
| 328 | * @param str | |
| 329 | * @return | |
| 330 | * @see cx_strcast_m() | |
| 331 | * @see cx_strcast() | |
| 332 | */ | |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
333 | CX_NODISCARD |
| 1673 | 334 | CX_INLINE cxstring cx_strcast_ucc(const unsigned char *str) { |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
335 | return cx_str((const char*)str); |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
336 | } |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
337 | |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
338 | /** |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
339 | * Internal function, do not use. |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
340 | * @param str |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
341 | * @return |
| 1673 | 342 | * @see cx_strcast_m() |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
343 | * @see cx_strcast() |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
344 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
345 | CX_NODISCARD |
| 1673 | 346 | CX_INLINE cxstring cx_strcast_cc(const char *str) { |
|
1331
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
347 | return cx_str(str); |
|
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
348 | } |
|
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
349 | |
|
02946dc73e6a
add support for C-strings in cx_strcast() - resolves #549
Mike Becker <universe@uap-core.de>
parents:
1318
diff
changeset
|
350 | /** |
|
1416
e67caa21d5a7
add unsigned char strings to cx_strcast() and changes documentation
Mike Becker <universe@uap-core.de>
parents:
1334
diff
changeset
|
351 | * Wraps any string into an UCX string. |
|
e67caa21d5a7
add unsigned char strings to cx_strcast() and changes documentation
Mike Becker <universe@uap-core.de>
parents:
1334
diff
changeset
|
352 | * |
|
e67caa21d5a7
add unsigned char strings to cx_strcast() and changes documentation
Mike Becker <universe@uap-core.de>
parents:
1334
diff
changeset
|
353 | * @param str (any supported string type) the string to cast |
| 1673 | 354 | * @return (@c cxstring) or (@c cxmutstr) the string wrapped as UCX string |
| 355 | */ | |
| 356 | #define cx_strcast_m(str) _Generic((str), \ | |
| 357 | cxmutstr: cx_strcast_cxms, \ | |
| 358 | cxstring: cx_strcast_cxs, \ | |
| 359 | const unsigned char*: cx_strcast_ucc, \ | |
| 360 | unsigned char *: cx_strcast_uc, \ | |
| 361 | const char*: cx_strcast_cc, \ | |
| 362 | char *: cx_strcast_c) (str) | |
| 363 | ||
| 364 | /** | |
| 365 | * Internal function, do not use. | |
| 366 | * @param str | |
| 367 | * @return | |
|
1416
e67caa21d5a7
add unsigned char strings to cx_strcast() and changes documentation
Mike Becker <universe@uap-core.de>
parents:
1334
diff
changeset
|
368 | */ |
| 1673 | 369 | CX_INLINE cxstring cx_strcast_1(cxmutstr str) { |
| 370 | return (cxstring){str.ptr, str.length}; | |
| 371 | } | |
| 372 | ||
| 373 | /** | |
| 374 | * Internal function, do not use. | |
| 375 | * @param str | |
| 376 | * @return | |
| 377 | */ | |
| 378 | CX_INLINE cxstring cx_strcast_2(cxstring str) { | |
| 379 | return str; | |
| 380 | } | |
| 381 | ||
| 382 | /** internal conversion macro */ | |
| 383 | #define cx_strcast_(str) _Generic((str), \ | |
| 384 | cxmutstr: cx_strcast_1, \ | |
| 385 | cxstring: cx_strcast_2)(str) | |
| 386 | ||
| 387 | /** | |
| 388 | * Converts any string to a cxstring. | |
| 389 | * | |
| 390 | * @param str (any supported string type) the string to cast | |
| 391 | * @return he string converted to a (@c cxstring) | |
| 392 | */ | |
| 393 | #define cx_strcast(str) cx_strcast_(cx_strcast_m(str)) | |
|
1050
3df63e95921a
make cx_strcast() also support cxstring
Mike Becker <universe@uap-core.de>
parents:
1046
diff
changeset
|
394 | #endif |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
395 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
396 | /** |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
397 | * Casts away constness and converts a cxstring to a cxmutstr. |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
398 | * For internal use only! |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
399 | * @param str |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
400 | * @return |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
401 | */ |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
402 | CX_INLINE cxmutstr cx_mutstrcast(cxstring str) { |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
403 | cxmutstr s; |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
404 | s.ptr = (char*)str.ptr; |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
405 | s.length = str.length; |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
406 | return s; |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
407 | } |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
408 | |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
409 | /** |
|
1318
12fa1d37fe48
allow changing the cxDefaultAllocator - resolves #669
Mike Becker <universe@uap-core.de>
parents:
1313
diff
changeset
|
410 | * Passes the pointer in this string to the cxDefaultAllocator's @c free() function. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
411 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
412 | * The pointer in the struct is set to @c NULL, and the length is set to zero, |
|
1127
1fd31909a3f8
removes some unnecessary string functions - fixes #561
Mike Becker <universe@uap-core.de>
parents:
1107
diff
changeset
|
413 | * 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
|
414 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
415 | * @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
|
416 | * you ever have a <code>const char*</code> you are really supposed to free. |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
417 | * If you encounter such a situation, you should double-check your code. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
418 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
419 | * @param str the string to free |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
420 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
421 | CX_EXTERN |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
422 | void cx_strfree(cxmutstr *str); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
423 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
424 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
425 | * Passes the pointer in this string to the allocator's free function. |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
426 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
427 | * The pointer in the struct is set to @c NULL, and the length is set to zero, |
|
1127
1fd31909a3f8
removes some unnecessary string functions - fixes #561
Mike Becker <universe@uap-core.de>
parents:
1107
diff
changeset
|
428 | * 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
|
429 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
430 | * @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
|
431 | * you ever have a <code>const char*</code> you are really supposed to free. |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
432 | * If you encounter such a 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
|
433 | * |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
434 | * @param alloc the allocator |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
435 | * @param str the string to free |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
436 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
437 | CX_EXTERN CX_NONNULL_ARG(1) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
438 | void cx_strfree_a(const CxAllocator *alloc, cxmutstr *str); |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
439 | |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
440 | /** |
|
1304
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
441 | * Copies a string. |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
442 | * |
|
1644
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
443 | * Internal function - do not use. |
|
1304
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
444 | * |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
445 | * @param alloc the allocator |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
446 | * @param dest a pointer to the structure where to copy the contents to |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
447 | * @param src the source string |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
448 | * |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
449 | * @retval zero success |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
450 | * @retval non-zero if re-allocation failed |
|
1644
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
451 | * @see cx_strcpy_a() |
|
1304
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
452 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
453 | CX_EXTERN CX_NONNULL_ARG(1) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
454 | int cx_strcpy_a_(const CxAllocator *alloc, cxmutstr *dest, cxstring src); |
|
1304
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
455 | |
|
1644
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
456 | /** |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
457 | * Copies a string. |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
458 | * |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
459 | * The memory in the @p dest structure is either allocated or re-allocated to fit the entire |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
460 | * source string, including a zero-terminator. |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
461 | * |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
462 | * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is. |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
463 | * |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
464 | * @param alloc (@c CxAllocator*) the allocator |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
465 | * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
466 | * @param src the source string |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
467 | * @retval zero success |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
468 | * @retval non-zero if re-allocation failed |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
469 | */ |
|
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
470 | #define cx_strcpy_a(alloc, dest, src) cx_strcpy_a_(alloc, dest, cx_strcast(src)) |
|
1304
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
471 | |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
472 | /** |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
473 | * Copies a string. |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
474 | * |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
475 | * The memory in the @p dest structure is either allocated or re-allocated to fit the entire |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
476 | * source string, including a zero-terminator. |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
477 | * |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
478 | * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is. |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
479 | * |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
480 | * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to |
|
1644
bbe3199e37fc
changes cx_strcpy() and cx_strcpy_a() to accept any string
Mike Becker <universe@uap-core.de>
parents:
1582
diff
changeset
|
481 | * @param src the source string |
|
1304
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
482 | * @retval zero success |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
483 | * @retval non-zero if re-allocation failed |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
484 | */ |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
485 | #define cx_strcpy(dest, src) cx_strcpy_a(cxDefaultAllocator, dest, src) |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
486 | |
|
57e062a4bb05
adds cx_strcpy() and cx_strcpy_a()
Mike Becker <universe@uap-core.de>
parents:
1297
diff
changeset
|
487 | /** |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
488 | * 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
|
489 | * |
|
1ecf4dbbc60c
add some more overflow treatment and make sure to set errno properly
Mike Becker <universe@uap-core.de>
parents:
1001
diff
changeset
|
490 | * 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
|
491 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
492 | * @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
|
493 | * specified strings, the behavior is undefined. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
494 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
495 | * @param count the total number of specified strings |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
496 | * @param ... all strings |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
497 | * @return the accumulated length of all strings |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
498 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
499 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
500 | size_t cx_strlen(size_t count, ...); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
501 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
502 | /** |
|
697
ebdce4bf262b
add cx_strcat_m() and cx_strcat_ma() for in-place concatenation
Mike Becker <universe@uap-core.de>
parents:
693
diff
changeset
|
503 | * Concatenates strings. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
504 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
505 | * 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
|
506 | * 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
|
507 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
508 | * 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
|
509 | * 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
|
510 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
511 | * @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
|
512 | * 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
|
513 | * It is also guaranteed that the returned string is zero-terminated. |
|
1672
94360453bce4
partially revert the changes to cx_strcat() and add CX_NULLSTR macro
Mike Becker <universe@uap-core.de>
parents:
1671
diff
changeset
|
514 | * If allocation fails, the @c ptr in the returned string will be @c NULL. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
515 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
516 | * @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
|
517 | * @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
|
518 | * @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
|
519 | * @param ... all other UCX strings |
|
1672
94360453bce4
partially revert the changes to cx_strcat() and add CX_NULLSTR macro
Mike Becker <universe@uap-core.de>
parents:
1671
diff
changeset
|
520 | * @return the concatenated string |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
521 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
522 | CX_EXTERN CX_NONNULL |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
523 | cxmutstr cx_strcat_a(const CxAllocator *alloc, |
|
1672
94360453bce4
partially revert the changes to cx_strcat() and add CX_NULLSTR macro
Mike Becker <universe@uap-core.de>
parents:
1671
diff
changeset
|
524 | cxmutstr str, size_t 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
|
525 | |
|
ebdce4bf262b
add cx_strcat_m() and cx_strcat_ma() for in-place concatenation
Mike Becker <universe@uap-core.de>
parents:
693
diff
changeset
|
526 | /** |
|
ebdce4bf262b
add cx_strcat_m() and cx_strcat_ma() for in-place concatenation
Mike Becker <universe@uap-core.de>
parents:
693
diff
changeset
|
527 | * Concatenates strings and returns a new string. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
528 | * |
|
1318
12fa1d37fe48
allow changing the cxDefaultAllocator - resolves #669
Mike Becker <universe@uap-core.de>
parents:
1313
diff
changeset
|
529 | * The resulting string will be allocated by the cxDefaultAllocator. |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
530 | * 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
|
531 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
532 | * @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
|
533 | * resulting string. |
|
589
c290f8fd979e
add zero-termination guarantees
Mike Becker <universe@uap-core.de>
parents:
584
diff
changeset
|
534 | * It is also guaranteed that the returned string is zero-terminated. |
|
1672
94360453bce4
partially revert the changes to cx_strcat() and add CX_NULLSTR macro
Mike Becker <universe@uap-core.de>
parents:
1671
diff
changeset
|
535 | * If allocation fails, the @c ptr in the returned string will be @c NULL. |
|
589
c290f8fd979e
add zero-termination guarantees
Mike Becker <universe@uap-core.de>
parents:
584
diff
changeset
|
536 | * |
|
1667
608cc0b25352
changes cx_strcat() family of function to return an int and removes two unnecessary variants
Mike Becker <universe@uap-core.de>
parents:
1652
diff
changeset
|
537 | * @param str (@c cxmutstr*) the string the other strings shall be concatenated to |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
538 | * @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
|
539 | * @param ... all other UCX strings |
|
1672
94360453bce4
partially revert the changes to cx_strcat() and add CX_NULLSTR macro
Mike Becker <universe@uap-core.de>
parents:
1671
diff
changeset
|
540 | * @return the concatenated string |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
541 | */ |
|
1667
608cc0b25352
changes cx_strcat() family of function to return an int and removes two unnecessary variants
Mike Becker <universe@uap-core.de>
parents:
1652
diff
changeset
|
542 | #define cx_strcat(str, count, ...) \ |
|
608cc0b25352
changes cx_strcat() family of function to return an int and removes two unnecessary variants
Mike Becker <universe@uap-core.de>
parents:
1652
diff
changeset
|
543 | cx_strcat_a(cxDefaultAllocator, str, count, __VA_ARGS__) |
|
576
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 | /** |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
546 | * Returns a substring. |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
547 | * |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
548 | * Internal function - do not use. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
549 | * |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
550 | * @param string input string |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
551 | * @param start start location of the substring |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
552 | * @param length the maximum length of the returned string |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
553 | * @return a substring of @p string starting at @p start |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
554 | * @see cx_strsubsl() |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
555 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
556 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
557 | cxstring cx_strsubsl_(cxstring string, size_t start, size_t length); |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
558 | |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
559 | /** |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
560 | * Returns a substring. |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
561 | * |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
562 | * Internal function - do not use. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
563 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
564 | * @param string input string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
565 | * @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
|
566 | * @return a substring of @p string starting at @p start |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
567 | * @see cx_strsubs() |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
568 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
569 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
570 | cxstring cx_strsubs_(cxstring string, size_t start); |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
571 | |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
572 | CX_INLINE |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
573 | cxmutstr cx_strsubs_m_(cxmutstr string, size_t start) { |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
574 | return cx_mutstrcast(cx_strsubs_(cx_strcast(string), start)); |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
575 | } |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
576 | |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
577 | CX_INLINE |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
578 | cxmutstr cx_strsubsl_m_(cxmutstr string, size_t start, size_t length) { |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
579 | return cx_mutstrcast(cx_strsubsl_(cx_strcast(string), start, length)); |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
580 | } |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
581 | |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
582 | #ifdef __cplusplus |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
583 | CX_CPPDECL cxstring cx_strsubs_cpp_(cxstring string, size_t start) { |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
584 | return cx_strsubs_(string, start); |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
585 | } |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
586 | CX_CPPDECL cxstring cx_strsubsl_cpp_(cxstring string, size_t start, size_t length) { |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
587 | return cx_strsubsl_(string, start, length); |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
588 | } |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
589 | CX_CPPDECL cxmutstr cx_strsubs_cpp_(cxmutstr string, size_t start) { |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
590 | return cx_strsubs_m_(string, start); |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
591 | } |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
592 | CX_CPPDECL cxmutstr cx_strsubsl_cpp_(cxmutstr string, size_t start, size_t length) { |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
593 | return cx_strsubsl_m_(string, start, length); |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
594 | } |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
595 | #define cx_strsubs(string, start) cx_strsubs_cpp_(cx_strcast_m(string), start) |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
596 | #define cx_strsubsl(string, start, length) cx_strsubsl_cpp_(cx_strcast_m(string), start, length) |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
597 | #else |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
598 | /** |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
599 | * Returns a substring starting at the specified location. |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
600 | * |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
601 | * @attention the new string references the same memory area as the |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
602 | * input string and is @em not zero-terminated. |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
603 | * Use cx_strdup() to get a copy. |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
604 | * |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
605 | * @param string input string |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
606 | * @param start (@c size_t) start location of the substring |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
607 | * @return (@c cxstring or @c cxmutstr) 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
|
608 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
609 | * @see cx_strsubsl() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
610 | */ |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
611 | #define cx_strsubs(string, start) _Generic(cx_strcast_m(string), \ |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
612 | cxstring: cx_strsubs_, \ |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
613 | cxmutstr: cx_strsubs_m_)(cx_strcast_m(string), start) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
614 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
615 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
616 | * Returns a substring starting at the specified location. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
617 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
618 | * 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
|
619 | * 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
|
620 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
621 | * @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
|
622 | * 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
|
623 | * Use cx_strdup() to get a copy. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
624 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
625 | * @param string input string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
626 | * @param start start location of the substring |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
627 | * @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
|
628 | * @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
|
629 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
630 | * @see cx_strsubs() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
631 | */ |
|
1674
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
632 | #define cx_strsubsl(string, start, length) _Generic(cx_strcast_m(string), \ |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
633 | cxstring: cx_strsubsl_, \ |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
634 | cxmutstr: cx_strsubsl_m_)(cx_strcast_m(string), start, length) |
|
8b0f162ac88e
full generic support for cx_strsubs() and cx_strsubsl()
Mike Becker <universe@uap-core.de>
parents:
1673
diff
changeset
|
635 | #endif |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
636 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
637 | /** |
| 1668 | 638 | * Returns the character at the specified index offset. |
| 639 | * | |
| 640 | * Internal function - do not use. | |
| 641 | * | |
| 642 | * @param str the string | |
| 643 | * @param index the index offset | |
| 644 | * @return the character at the index | |
| 645 | * @see cx_strat() | |
| 646 | */ | |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
647 | CX_INLINE |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
648 | char cx_strat_(cxstring str, off_t index) { |
| 1668 | 649 | size_t i; |
| 650 | if (index >= 0) { | |
| 651 | i = index; | |
| 652 | } else { | |
| 653 | i = (size_t) (str.length + index); | |
| 654 | } | |
| 655 | if (i >= str.length) { | |
| 656 | return '\0'; | |
| 657 | } | |
| 658 | return str.ptr[i]; | |
| 659 | } | |
| 660 | ||
| 661 | /** | |
| 662 | * Returns the character at the specified index offset. | |
| 663 | * | |
| 664 | * When the @p index is negative, the character is counted from the end of the | |
| 665 | * string where -1 denotes the last character in the string. | |
| 666 | * | |
| 667 | * When the @p index is out of bounds, the function returns zero. | |
| 668 | * | |
| 669 | * @param str the string | |
| 670 | * @param index the index offset | |
| 671 | * @return the character at the index | |
| 672 | * @see cx_strat() | |
| 673 | */ | |
| 674 | #define cx_strat(str, index) cx_strat_(cx_strcast(str), index) | |
| 675 | ||
| 676 | /** | |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
677 | * 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
|
678 | * specified character. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
679 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
680 | * 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
|
681 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
682 | * @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
|
683 | * @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
|
684 | * @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
|
685 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
686 | * @see cx_strchr_m() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
687 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
688 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
689 | cxstring cx_strchr(cxstring string, int chr); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
690 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
691 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
692 | * 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
|
693 | * specified character. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
694 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
695 | * 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
|
696 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
697 | * @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
|
698 | * @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
|
699 | * @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
|
700 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
701 | * @see cx_strchr() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
702 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
703 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
704 | cxmutstr cx_strchr_m(cxmutstr string, int chr); |
|
576
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 | * 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
|
708 | * specified character. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
709 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
710 | * 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
|
711 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
712 | * @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
|
713 | * @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
|
714 | * @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
|
715 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
716 | * @see cx_strrchr_m() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
717 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
718 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
719 | cxstring cx_strrchr(cxstring string, int chr); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
720 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
721 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
722 | * 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
|
723 | * specified character. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
724 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
725 | * 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
|
726 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
727 | * @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
|
728 | * @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
|
729 | * @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
|
730 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
731 | * @see cx_strrchr() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
732 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
733 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
734 | cxmutstr cx_strrchr_m(cxmutstr string, int chr); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
735 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
736 | /** |
|
1646
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
737 | * Searches for a specific substring. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
738 | * |
|
1646
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
739 | * Internal function - do not use. |
|
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 haystack the string to be scanned |
|
1646
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
742 | * @param needle string containing the sequence of characters to match |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
743 | * @return a substring starting at the first occurrence of @p needle, |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
744 | * or an empty string, if the sequence is not contained |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
745 | * @see cx_strstr() |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
746 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
747 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
748 | cxstring cx_strstr_(cxstring haystack, cxstring needle); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
749 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
750 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
751 | * 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
|
752 | * specified string. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
753 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
754 | * 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
|
755 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
756 | * 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
|
757 | * returned. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
758 | * |
|
1646
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
759 | * @param haystack (@c cxstring) the string to be scanned |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
760 | * @param needle string containing the sequence of characters to match |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
761 | * @return (@c cxstring) a substring starting at the first occurrence of |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
762 | * @p needle, or an empty string, if the sequence is not contained |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
763 | * @see cx_strstr_m() |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
764 | */ |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
765 | #define cx_strstr(haystack, needle) cx_strstr_(haystack, cx_strcast(needle)) |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
766 | |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
767 | /** |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
768 | * Searches for a specific substring. |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
769 | * |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
770 | * Internal function - do not use. |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
771 | * |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
772 | * @param haystack the string to be scanned |
|
1646
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
773 | * @param needle string containing the sequence of characters to match |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
774 | * @return a substring starting at the first occurrence of @p needle, |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
775 | * or an empty string, if the sequence is not contained |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
776 | * @see cx_strstr_m() |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
777 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
778 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
779 | cxmutstr cx_strstr_m_(cxmutstr haystack, cxstring needle); |
|
1646
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
780 | |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
781 | /** |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
782 | * Returns a substring starting at the location of the first occurrence of the |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
783 | * specified string. |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
784 | * |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
785 | * If @p haystack does not contain @p needle, an empty string is returned. |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
786 | * |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
787 | * If @p needle is an empty string, the complete @p haystack is |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
788 | * returned. |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
789 | * |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
790 | * @param haystack (@c cxmutstr) the string to be scanned |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
791 | * @param needle string containing the sequence of characters to match |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
792 | * @return (@c cxmutstr) a substring starting at the first occurrence of |
|
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
793 | * @p needle, or an empty string, if the sequence is not contained |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
794 | * @see cx_strstr() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
795 | */ |
|
1646
85fd3ff8416e
add support for any string to cx_strstr() and cx_strstr_m()
Mike Becker <universe@uap-core.de>
parents:
1644
diff
changeset
|
796 | #define cx_strstr_m(haystack, needle) cx_strstr_m_(haystack, cx_strcast(needle)) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
797 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
798 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
799 | * Splits a given string using a delimiter string. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
800 | * |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
801 | * Internal function - do not use. |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
802 | * |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
803 | * @param string the string to split |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
804 | * @param delim the delimiter |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
805 | * @param limit the maximum number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
806 | * @param output the output array |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
807 | * @return the actual number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
808 | * @see cx_strsplit() |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
809 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
810 | CX_EXTERN CX_NODISCARD CX_NONNULL CX_ACCESS_W(4, 3) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
811 | size_t cx_strsplit_(cxstring string, cxstring delim, |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
812 | size_t limit, cxstring *output); |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
813 | |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
814 | /** |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
815 | * Splits a given string using a delimiter string. |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
816 | * |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
817 | * Internal function - do not use. |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
818 | * |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
819 | * @param allocator the allocator to use for allocating the resulting array |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
820 | * @param string the string to split |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
821 | * @param delim the delimiter |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
822 | * @param limit the maximum number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
823 | * @param output the output array |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
824 | * @return the actual number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
825 | * @see cx_strsplit_a() |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
826 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
827 | CX_EXTERN CX_NODISCARD CX_NONNULL CX_ACCESS_W(5) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
828 | size_t cx_strsplit_a_(const CxAllocator *allocator, |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
829 | cxstring string, cxstring delim, |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
830 | size_t limit, cxstring **output); |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
831 | |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
832 | |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
833 | /** |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
834 | * Splits a given string using a delimiter string. |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
835 | * |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
836 | * Internal function - do not use. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
837 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
838 | * @param string the string to split |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
839 | * @param delim the delimiter |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
840 | * @param limit the maximum number of split items |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
841 | * @param output the output array |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
842 | * @return the actual number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
843 | * @see cx_strsplit_m() |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
844 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
845 | CX_EXTERN CX_NODISCARD CX_NONNULL CX_ACCESS_W(4, 3) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
846 | size_t cx_strsplit_m_(cxmutstr string, cxstring delim, |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
847 | size_t limit, cxmutstr *output); |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
848 | |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
849 | /** |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
850 | * Splits a given string using a delimiter string. |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
851 | * |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
852 | * Internal function - do not use. |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
853 | * |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
854 | * @param allocator the allocator to use for allocating the resulting array |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
855 | * @param string the string to split |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
856 | * @param delim the delimiter |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
857 | * @param limit the maximum number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
858 | * @param output the output array |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
859 | * @return the actual number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
860 | * @see cx_strsplit_ma() |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
861 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
862 | CX_EXTERN CX_NODISCARD CX_NONNULL CX_ACCESS_W(5) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
863 | size_t cx_strsplit_ma_(const CxAllocator *allocator, |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
864 | cxmutstr string, cxstring delim, size_t limit, |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
865 | cxmutstr **output); |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
866 | |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
867 | /** |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
868 | * Splits a given string using a delimiter string. |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
869 | * |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
870 | * @note The resulting array contains strings that point to the source |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
871 | * @p string. Use cx_strdup() to get copies. |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
872 | * |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
873 | * @param string (@c cxstring) the string to split |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
874 | * @param delim the delimiter |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
875 | * @param limit (@c size_t) the maximum number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
876 | * @param output (@c cxstring*) a preallocated array of at least @p limit length |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
877 | * @return the actual number of split items |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
878 | */ |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
879 | #define cx_strsplit(string, delim, limit, output) \ |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
880 | cx_strsplit_(string, cx_strcast(delim), limit, output) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
881 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
882 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
883 | * Splits a given string using a delimiter string. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
884 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
885 | * 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
|
886 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
887 | * @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
|
888 | * @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
|
889 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
890 | * @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
|
891 | * @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
|
892 | * |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
893 | * @param allocator (@c CxAllocator*) the allocator to use for allocating the resulting array |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
894 | * @param string (@c cxstring) the string to split |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
895 | * @param delim the delimiter |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
896 | * @param limit (@c size_t) the maximum number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
897 | * @param output (@c cxstring**) a pointer where the address of the allocated |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
898 | * array shall be written to |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
899 | * @return the actual number of split items |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
900 | */ |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
901 | #define cx_strsplit_a(allocator, string, delim, limit, output) \ |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
902 | cx_strsplit_a_(allocator, string, cx_strcast(delim), limit, output) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
903 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
904 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
905 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
906 | * Splits a given string using a delimiter string. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
907 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
908 | * @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
|
909 | * @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
|
910 | * |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
911 | * @param string (@c cxmutstr) the string to split |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
912 | * @param delim the delimiter |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
913 | * @param limit (@c size_t) the maximum number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
914 | * @param output (@c cxmutstr*) a preallocated array of at least @p limit length |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
915 | * @return the actual number of split items |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
916 | */ |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
917 | #define cx_strsplit_m(string, delim, limit, output) \ |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
918 | cx_strsplit_m_(string, cx_strcast(delim), limit, output) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
919 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
920 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
921 | * Splits a given string using a delimiter string. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
922 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
923 | * 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
|
924 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
925 | * @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
|
926 | * @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
|
927 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
928 | * @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
|
929 | * @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
|
930 | * |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
931 | * @param allocator (@c CxAllocator*) the allocator to use for allocating the resulting array |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
932 | * @param string (@c cxmutstr) the string to split |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
933 | * @param delim the delimiter |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
934 | * @param limit (@c size_t) the maximum number of split items |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
935 | * @param output (@c cxmutstr**) a pointer where the address of the allocated |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
936 | * array shall be written to |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
937 | * @return the actual number of split items |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
938 | */ |
|
1652
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
939 | #define cx_strsplit_ma(allocator, string, delim, limit, output) \ |
|
db8299984bfe
add support for any string as a delimiter in all cx_strsplit() variants
Mike Becker <universe@uap-core.de>
parents:
1651
diff
changeset
|
940 | cx_strsplit_ma_(allocator, string, cx_strcast(delim), limit, output) |
|
576
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 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
943 | * Compares two strings. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
944 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
945 | * @param s1 the first string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
946 | * @param s2 the second string |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
947 | * @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
|
948 | * 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
|
949 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
950 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
951 | int cx_strcmp_(cxstring s1, cxstring s2); |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
952 | |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
953 | /** |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
954 | * Compares two strings. |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
955 | * |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
956 | * @param s1 the first string |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
957 | * @param s2 the second string |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
958 | * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
959 | * than @p s2, zero if both strings equal |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
960 | */ |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
961 | #define cx_strcmp(s1, s2) cx_strcmp_(cx_strcast(s1), cx_strcast(s2)) |
|
576
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 | * Compares two strings ignoring 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 | * @param s1 the first string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
967 | * @param s2 the second string |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
968 | * @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
|
969 | * 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
|
970 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
971 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
972 | int cx_strcasecmp_(cxstring s1, cxstring s2); |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
973 | |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
974 | /** |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
975 | * Compares two strings ignoring case. |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
976 | * |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
977 | * @param s1 the first string |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
978 | * @param s2 the second string |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
979 | * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
980 | * than @p s2, zero if both strings equal ignoring case |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
981 | */ |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
982 | #define cx_strcasecmp(s1, s2) cx_strcasecmp_(cx_strcast(s1), cx_strcast(s2)) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
983 | |
|
657
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
984 | /** |
|
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
985 | * Compares two strings. |
|
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
986 | * |
|
677
b09aae58bba4
refactoring of collections to make use of destructors in map implementations
Mike Becker <universe@uap-core.de>
parents:
657
diff
changeset
|
987 | * 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
|
988 | * |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
989 | * @attention This function can @em only compare UCX strings. It is unsafe to |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
990 | * pass normal C-strings to this function. |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
991 | * |
|
657
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
992 | * @param s1 the first string |
|
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
993 | * @param s2 the second string |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
994 | * @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
|
995 | * 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
|
996 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
997 | CX_EXTERN CX_NODISCARD CX_NONNULL |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
998 | int cx_strcmp_p(const void *s1, const void *s2); |
|
657
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
999 | |
|
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
1000 | /** |
|
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
1001 | * Compares two strings ignoring case. |
|
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
1002 | * |
|
677
b09aae58bba4
refactoring of collections to make use of destructors in map implementations
Mike Becker <universe@uap-core.de>
parents:
657
diff
changeset
|
1003 | * 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
|
1004 | * |
|
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
1005 | * @param s1 the first string |
|
3eeadf666d6b
add CxListComparator compatible string compare functions
Mike Becker <universe@uap-core.de>
parents:
645
diff
changeset
|
1006 | * @param s2 the second string |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1007 | * @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
|
1008 | * 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
|
1009 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1010 | CX_EXTERN CX_NODISCARD CX_NONNULL |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1011 | int cx_strcasecmp_p(const void *s1, const void *s2); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1012 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1013 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1014 | * Creates a duplicate of the specified string. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1015 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1016 | * 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
|
1017 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1018 | * @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
|
1019 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1020 | * @param allocator the allocator to use |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1021 | * @param string the string to duplicate |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1022 | * @return a duplicate of the string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1023 | * @see cx_strdup() |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1024 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1025 | CX_EXTERN CX_NODISCARD CX_NONNULL |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1026 | cxmutstr cx_strdup_a_(const CxAllocator *allocator, cxstring string); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1027 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1028 | /** |
|
578
0b2c0cb280a9
some function can be macros using the default allocator
Mike Becker <universe@uap-core.de>
parents:
577
diff
changeset
|
1029 | * 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
|
1030 | * |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1031 | * 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
|
1032 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1033 | * @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
|
1034 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1035 | * @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
|
1036 | * @param string the string to duplicate |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1037 | * @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
|
1038 | * @see cx_strdup() |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1039 | * @see cx_strfree_a() |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1040 | */ |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1041 | #define cx_strdup_a(allocator, string) cx_strdup_a_((allocator), cx_strcast(string)) |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1042 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1043 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1044 | * 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
|
1045 | * |
|
1318
12fa1d37fe48
allow changing the cxDefaultAllocator - resolves #669
Mike Becker <universe@uap-core.de>
parents:
1313
diff
changeset
|
1046 | * The new string will contain a copy allocated by the cxDefaultAllocator. |
|
12fa1d37fe48
allow changing the cxDefaultAllocator - resolves #669
Mike Becker <universe@uap-core.de>
parents:
1313
diff
changeset
|
1047 | * 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
|
1048 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1049 | * @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
|
1050 | * |
|
1127
1fd31909a3f8
removes some unnecessary string functions - fixes #561
Mike Becker <universe@uap-core.de>
parents:
1107
diff
changeset
|
1051 | * @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
|
1052 | * @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
|
1053 | * @see cx_strdup_a() |
|
1127
1fd31909a3f8
removes some unnecessary string functions - fixes #561
Mike Becker <universe@uap-core.de>
parents:
1107
diff
changeset
|
1054 | * @see cx_strfree() |
|
578
0b2c0cb280a9
some function can be macros using the default allocator
Mike Becker <universe@uap-core.de>
parents:
577
diff
changeset
|
1055 | */ |
|
1223
be4c13de7c4f
fix cx_strdup() not using cx_strcast()
Mike Becker <universe@uap-core.de>
parents:
1221
diff
changeset
|
1056 | #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
|
1057 | |
|
0b2c0cb280a9
some function can be macros using the default allocator
Mike Becker <universe@uap-core.de>
parents:
577
diff
changeset
|
1058 | /** |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1059 | * Omits leading and trailing spaces. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1060 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1061 | * @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
|
1062 | * must @em not free the returned memory. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1063 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1064 | * @param string the string that shall be trimmed |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1065 | * @return the trimmed string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1066 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1067 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1068 | cxstring cx_strtrim(cxstring string); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1069 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1070 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1071 | * Omits leading and trailing spaces. |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1072 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1073 | * @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
|
1074 | * must @em not free the returned memory. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1075 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1076 | * @param string the string that shall be trimmed |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1077 | * @return the trimmed string |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1078 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1079 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1080 | cxmutstr cx_strtrim_m(cxmutstr string); |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1081 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1082 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1083 | * Checks if a string has a specific prefix. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1084 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1085 | * @param string the string to check |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1086 | * @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
|
1087 | * @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
|
1088 | * @c false otherwise |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1089 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1090 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1091 | bool cx_strprefix_(cxstring string, cxstring prefix); |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1092 | |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1093 | /** |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1094 | * Checks if a string has a specific prefix. |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1095 | * |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1096 | * @param string the string to check |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1097 | * @param prefix the prefix the string should have |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1098 | * @return @c true, if and only if the string has the specified prefix, |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1099 | * @c false otherwise |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1100 | */ |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1101 | #define cx_strprefix(string, prefix) cx_strprefix_(cx_strcast(string), cx_strcast(prefix)) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1102 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1103 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1104 | * Checks if a string has a specific suffix. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1105 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1106 | * @param string the string to check |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1107 | * @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
|
1108 | * @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
|
1109 | * @c false otherwise |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1110 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1111 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1112 | bool cx_strsuffix_(cxstring string, cxstring suffix); |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1113 | |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1114 | /** |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1115 | * Checks if a string has a specific suffix. |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1116 | * |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1117 | * @param string the string to check |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1118 | * @param suffix the suffix the string should have |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1119 | * @return @c true, if and only if the string has the specified suffix, |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1120 | * @c false otherwise |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1121 | */ |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1122 | #define cx_strsuffix(string, suffix) cx_strsuffix_(cx_strcast(string), cx_strcast(suffix)) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1123 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1124 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1125 | * Checks if a string has a specific prefix, ignoring the case. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1126 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1127 | * @param string the string to check |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1128 | * @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
|
1129 | * @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
|
1130 | * @c false otherwise |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1131 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1132 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1133 | bool cx_strcaseprefix_(cxstring string, cxstring prefix); |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1134 | |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1135 | /** |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1136 | * Checks if a string has a specific prefix, ignoring the case. |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1137 | * |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1138 | * @param string the string to check |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1139 | * @param prefix the prefix the string should have |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1140 | * @return @c true, if and only if the string has the specified prefix, |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1141 | * @c false otherwise |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1142 | */ |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1143 | #define cx_strcaseprefix(string, prefix) cx_strcaseprefix_(cx_strcast(string), cx_strcast(prefix)) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1144 | |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1145 | /** |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1146 | * 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
|
1147 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1148 | * @param string the string to check |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1149 | * @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
|
1150 | * @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
|
1151 | * @c false otherwise |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1152 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1153 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1154 | bool cx_strcasesuffix_(cxstring string, cxstring suffix); |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1155 | |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1156 | /** |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1157 | * Checks, if a string has a specific suffix, ignoring the case. |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1158 | * |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1159 | * @param string the string to check |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1160 | * @param suffix the suffix the string should have |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1161 | * @return @c true, if and only if the string has the specified suffix, |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1162 | * @c false otherwise |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1163 | */ |
|
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1164 | #define cx_strcasesuffix(string, suffix) cx_strcasesuffix_(cx_strcast(string), cx_strcast(suffix)) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1165 | |
|
1651
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1166 | /** |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1167 | * Replaces a string with another string. |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1168 | * |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1169 | * Internal function - do not use. |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1170 | * |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1171 | * @param allocator |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1172 | * @param str |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1173 | * @param search |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1174 | * @param replacement |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1175 | * @param replmax |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1176 | * @return |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1177 | * @see cx_strreplace_a() |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1178 | * @see cx_strreplace() |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1179 | * @see cx_strreplacen_a() |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1180 | * @see cx_strreplacen() |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1181 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1182 | CX_EXTERN CX_NODISCARD CX_NONNULL |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1183 | cxmutstr cx_strreplace_(const CxAllocator *allocator, |
|
1651
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1184 | cxstring str, cxstring search, cxstring replacement, size_t replmax); |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1185 | |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1186 | /** |
|
1221
304f4f7b37d1
document cx_strreplace() family of functions and improve docstrings
Mike Becker <universe@uap-core.de>
parents:
1193
diff
changeset
|
1187 | * Replaces a string with another string. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1188 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1189 | * The function replaces at most @p replmax occurrences. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1190 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1191 | * 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
|
1192 | * to be zero-terminated. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1193 | * |
|
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1194 | * 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
|
1195 | * the returned string will be empty. |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1196 | * |
|
1651
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1197 | * @param allocator (@c CxAllocator*) the allocator to use |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1198 | * @param str the string where replacements should be applied |
|
1221
304f4f7b37d1
document cx_strreplace() family of functions and improve docstrings
Mike Becker <universe@uap-core.de>
parents:
1193
diff
changeset
|
1199 | * @param search the string to search for |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1200 | * @param replacement the replacement string |
|
1651
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1201 | * @param replmax (@c size_t) maximum number of replacements |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1202 | * @return (@c cxmutstr) the resulting string after applying the replacements |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1203 | */ |
|
1651
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1204 | #define cx_strreplacen_a(allocator, str, search, replacement, replmax) \ |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1205 | cx_strreplace_(allocator, cx_strcast(str), cx_strcast(search), cx_strcast(replacement), replmax) |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1206 | |
|
578
0b2c0cb280a9
some function can be macros using the default allocator
Mike Becker <universe@uap-core.de>
parents:
577
diff
changeset
|
1207 | /** |
|
1221
304f4f7b37d1
document cx_strreplace() family of functions and improve docstrings
Mike Becker <universe@uap-core.de>
parents:
1193
diff
changeset
|
1208 | * Replaces a string with another string. |
|
578
0b2c0cb280a9
some function can be macros using the default allocator
Mike Becker <universe@uap-core.de>
parents:
577
diff
changeset
|
1209 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1210 | * The function 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
|
1211 | * |
|
1318
12fa1d37fe48
allow changing the cxDefaultAllocator - resolves #669
Mike Becker <universe@uap-core.de>
parents:
1313
diff
changeset
|
1212 | * The returned string will be allocated by the cxDefaultAllocator and is guaranteed |
|
589
c290f8fd979e
add zero-termination guarantees
Mike Becker <universe@uap-core.de>
parents:
584
diff
changeset
|
1213 | * 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
|
1214 | * |
|
0b2c0cb280a9
some function can be macros using the default allocator
Mike Becker <universe@uap-core.de>
parents:
577
diff
changeset
|
1215 | * 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
|
1216 | * 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
|
1217 | * |
|
1651
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1218 | * @param str the string where replacements should be applied |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1219 | * @param search the string to search for |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1220 | * @param replacement the replacement string |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1221 | * @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
|
1222 | * @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
|
1223 | */ |
|
1221
304f4f7b37d1
document cx_strreplace() family of functions and improve docstrings
Mike Becker <universe@uap-core.de>
parents:
1193
diff
changeset
|
1224 | #define cx_strreplacen(str, search, replacement, replmax) \ |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1225 | cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, replmax) |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1226 | |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1227 | /** |
|
1221
304f4f7b37d1
document cx_strreplace() family of functions and improve docstrings
Mike Becker <universe@uap-core.de>
parents:
1193
diff
changeset
|
1228 | * Replaces a string with another string. |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1229 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1230 | * 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
|
1231 | * to be zero-terminated. |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1232 | * |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1233 | * 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
|
1234 | * the returned string will be empty. |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1235 | * |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1236 | * @param allocator (@c CxAllocator*) the allocator to use |
|
1651
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1237 | * @param str the string where replacements should be applied |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1238 | * @param search the string to search for |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1239 | * @param replacement the replacement string |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1240 | * @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
|
1241 | */ |
|
1221
304f4f7b37d1
document cx_strreplace() family of functions and improve docstrings
Mike Becker <universe@uap-core.de>
parents:
1193
diff
changeset
|
1242 | #define cx_strreplace_a(allocator, str, search, replacement) \ |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1243 | cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX) |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1244 | |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1245 | /** |
|
1221
304f4f7b37d1
document cx_strreplace() family of functions and improve docstrings
Mike Becker <universe@uap-core.de>
parents:
1193
diff
changeset
|
1246 | * Replaces a string with another string. |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1247 | * |
|
1318
12fa1d37fe48
allow changing the cxDefaultAllocator - resolves #669
Mike Becker <universe@uap-core.de>
parents:
1313
diff
changeset
|
1248 | * The returned string will be allocated by the cxDefaultAllocator and is guaranteed |
|
589
c290f8fd979e
add zero-termination guarantees
Mike Becker <universe@uap-core.de>
parents:
584
diff
changeset
|
1249 | * to be zero-terminated. |
|
583
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1250 | * |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1251 | * 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
|
1252 | * the returned string will be empty. |
|
0f3c9662f9b5
add tests and missing implementations for strings
Mike Becker <universe@uap-core.de>
parents:
581
diff
changeset
|
1253 | * |
|
1651
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1254 | * @param str the string where replacements should be applied |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1255 | * @param search the string to search for |
|
38b051dea6b1
add support for any string to all cx_strreplace() variants
Mike Becker <universe@uap-core.de>
parents:
1646
diff
changeset
|
1256 | * @param replacement the replacement string |
|
1107
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1257 | * @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
|
1258 | */ |
|
1221
304f4f7b37d1
document cx_strreplace() family of functions and improve docstrings
Mike Becker <universe@uap-core.de>
parents:
1193
diff
changeset
|
1259 | #define cx_strreplace(str, search, replacement) \ |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1260 | cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, SIZE_MAX) |
|
578
0b2c0cb280a9
some function can be macros using the default allocator
Mike Becker <universe@uap-core.de>
parents:
577
diff
changeset
|
1261 | |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1262 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1263 | * Creates a string tokenization context. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1264 | * |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1265 | * @param str the string to tokenize |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1266 | * @param delim the delimiter (must not be empty) |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1267 | * @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
|
1268 | * @return a new string tokenization context |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1269 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1270 | CX_EXTERN CX_NODISCARD |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1271 | CxStrtokCtx cx_strtok_(cxstring str, cxstring delim, size_t limit); |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1272 | |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1273 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1274 | * Creates a string tokenization context. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1275 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1276 | * @param str the string to tokenize |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1277 | * @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
|
1278 | * @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
|
1279 | * @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
|
1280 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1281 | #define cx_strtok(str, delim, limit) \ |
|
1426
3a89b31f0724
clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
1282 | cx_strtok_(cx_strcast(str), cx_strcast(delim), (limit)) |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1283 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1284 | /** |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1285 | * Returns the next token. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1286 | * |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1287 | * The token will point to the source string. |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1288 | * |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1289 | * @param ctx the tokenization context |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1290 | * @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
|
1291 | * @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
|
1292 | * has been reached |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1293 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1294 | CX_EXTERN CX_NONNULL CX_NODISCARD CX_ACCESS_W(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1295 | bool cx_strtok_next_(CxStrtokCtx *ctx, cxstring *token); |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1296 | |
|
1671
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1297 | #ifdef __cplusplus |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1298 | CX_CPPDECL cx_strtok_next(CxStrtokCtx *ctx, cxstring *token) { |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1299 | return cx_strtok_next_(ctx, token); |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1300 | } |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1301 | CX_CPPDECL cx_strtok_next(CxStrtokCtx *ctx, cxmutstr *token) { |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1302 | // Note: this is actually UB - fixed with start_lifetime_as() in C++23 |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1303 | // but it works on all supported platforms |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1304 | return cx_strtok_next_(ctx, reinterpret_cast<cxstring*>(token)); |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1305 | } |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1306 | #else // ! __cplusplus |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1307 | /** |
|
1671
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1308 | * Returns the next token. |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1309 | * |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1310 | * 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
|
1311 | * |
|
1671
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1312 | * @param ctx (@c CxStrtokCtx*) the tokenization context |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1313 | * @param token a pointer to either a @c cxstring or @c cxmutstr |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1314 | * where the next token shall be stored |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1315 | * @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
|
1316 | * has been reached |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1317 | */ |
|
1671
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1318 | #define cx_strtok_next(ctx, token) _Generic((token), \ |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1319 | cxstring*: cx_strtok_next_, \ |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1320 | cxmutstr*: cx_strtok_next_)(ctx, (cxstring*)token) |
|
cf19b7820ff0
simplify cx_strtok_next() by removing the _m() variant - relates to #792
Mike Becker <universe@uap-core.de>
parents:
1668
diff
changeset
|
1321 | #endif |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1322 | |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1323 | /** |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1324 | * 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
|
1325 | * |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1326 | * @param ctx the tokenization context |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1327 | * @param delim array of more delimiters |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1328 | * @param count number of elements in the array |
|
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1329 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1330 | CX_EXTERN CX_NONNULL CX_ACCESS_R(2, 3) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1331 | void cx_strtok_delim(CxStrtokCtx *ctx, const cxstring *delim, size_t count); |
|
645
ec50abb285ad
add strtok API - fixes #220
Mike Becker <universe@uap-core.de>
parents:
589
diff
changeset
|
1332 | |
|
1043
256ea5a36b5a
add function prototypes and macros for string conversion function
Mike Becker <universe@uap-core.de>
parents:
1040
diff
changeset
|
1333 | /* ------------------------------------------------------------------------- * |
|
256ea5a36b5a
add function prototypes and macros for string conversion function
Mike Becker <universe@uap-core.de>
parents:
1040
diff
changeset
|
1334 | * 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
|
1335 | * ------------------------------------------------------------------------- */ |
|
256ea5a36b5a
add function prototypes and macros for string conversion function
Mike Becker <universe@uap-core.de>
parents:
1040
diff
changeset
|
1336 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1337 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1338 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1339 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1340 | * 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
|
1341 | * 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
|
1342 | * 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
|
1343 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1344 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1345 | * @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
|
1346 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1347 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1348 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1349 | * @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
|
1350 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1351 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1352 | int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1353 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1354 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1355 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1356 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1357 | * 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
|
1358 | * 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
|
1359 | * 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
|
1360 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1361 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1362 | * @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
|
1363 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1364 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1365 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1366 | * @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
|
1367 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1368 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1369 | int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1370 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1371 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1372 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1373 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1374 | * 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
|
1375 | * 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
|
1376 | * 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
|
1377 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1378 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1379 | * @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
|
1380 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1381 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1382 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1383 | * @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
|
1384 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1385 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1386 | int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1387 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1388 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1389 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1390 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1391 | * 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
|
1392 | * 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
|
1393 | * 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
|
1394 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1395 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1396 | * @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
|
1397 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1398 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1399 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1400 | * @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
|
1401 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1402 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1403 | int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1404 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1405 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1406 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1407 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1408 | * 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
|
1409 | * 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
|
1410 | * 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
|
1411 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1412 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1413 | * @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
|
1414 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1415 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1416 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1417 | * @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
|
1418 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1419 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1420 | int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1421 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1422 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1423 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1424 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1425 | * 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
|
1426 | * 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
|
1427 | * 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
|
1428 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1429 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1430 | * @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
|
1431 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1432 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1433 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1434 | * @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
|
1435 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1436 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1437 | int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1438 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1439 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1440 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1441 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1442 | * 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
|
1443 | * 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
|
1444 | * 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
|
1445 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1446 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1447 | * @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
|
1448 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1449 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1450 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1451 | * @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
|
1452 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1453 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1454 | int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1455 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1456 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1457 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1458 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1459 | * 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
|
1460 | * 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
|
1461 | * 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
|
1462 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1463 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1464 | * @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
|
1465 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1466 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1467 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1468 | * @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
|
1469 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1470 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1471 | int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1472 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1473 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1474 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1475 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1476 | * 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
|
1477 | * 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
|
1478 | * 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
|
1479 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1480 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1481 | * @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
|
1482 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1483 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1484 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1485 | * @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
|
1486 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1487 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1488 | int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1489 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1490 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1491 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1492 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1493 | * 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
|
1494 | * 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
|
1495 | * 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
|
1496 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1497 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1498 | * @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
|
1499 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1500 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1501 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1502 | * @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
|
1503 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1504 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1505 | int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1506 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1507 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1508 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1509 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1510 | * 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
|
1511 | * 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
|
1512 | * 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
|
1513 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1514 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1515 | * @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
|
1516 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1517 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1518 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1519 | * @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
|
1520 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1521 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1522 | int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1523 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1524 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1525 | * Converts a string to a number. |
|
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 | * 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
|
1528 | * 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
|
1529 | * 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
|
1530 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1531 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1532 | * @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
|
1533 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1534 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1535 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1536 | * @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
|
1537 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1538 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1539 | int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1540 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1541 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1542 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1543 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1544 | * 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
|
1545 | * 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
|
1546 | * 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
|
1547 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1548 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1549 | * @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
|
1550 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1551 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1552 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1553 | * @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
|
1554 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1555 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1556 | int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1557 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1558 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1559 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1560 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1561 | * 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
|
1562 | * 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
|
1563 | * 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
|
1564 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1565 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1566 | * @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
|
1567 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1568 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1569 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1570 | * @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
|
1571 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1572 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1573 | int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1574 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1575 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1576 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1577 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1578 | * 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
|
1579 | * 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
|
1580 | * 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
|
1581 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1582 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1583 | * @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
|
1584 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1585 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1586 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1587 | * @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
|
1588 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1589 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1590 | int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep); |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1591 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1592 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1593 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1594 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1595 | * 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
|
1596 | * 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
|
1597 | * 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
|
1598 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1599 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1600 | * @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
|
1601 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1602 | * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1603 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1604 | * @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
|
1605 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1606 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1607 | 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
|
1608 | |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1609 | /** |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1610 | * 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
|
1611 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1612 | * 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
|
1613 | * 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
|
1614 | * 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
|
1615 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1616 | * @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
|
1617 | * @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
|
1618 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1619 | * @param groupsep each character in this string is treated as a 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
|
1620 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1621 | * @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
|
1622 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1623 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1624 | int cx_strtoz_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
|
1625 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1626 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1627 | * Converts a string to a single precision floating-point number. |
|
1045
468c868cc8a8
add attributes to string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1044
diff
changeset
|
1628 | * |
|
468c868cc8a8
add attributes to string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1044
diff
changeset
|
1629 | * 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
|
1630 | * 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
|
1631 | * 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
|
1632 | * |
|
468c868cc8a8
add attributes to string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1044
diff
changeset
|
1633 | * @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
|
1634 | * @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
|
1635 | * @param decsep the decimal separator |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1636 | * @param groupsep each character in this string is treated as a 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
|
1637 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1638 | * @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
|
1639 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1640 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1641 | 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
|
1642 | |
|
468c868cc8a8
add attributes to string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1044
diff
changeset
|
1643 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1644 | * Converts a string to a double precision floating-point number. |
|
1045
468c868cc8a8
add attributes to string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1044
diff
changeset
|
1645 | * |
|
468c868cc8a8
add attributes to string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1044
diff
changeset
|
1646 | * 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
|
1647 | * 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
|
1648 | * 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
|
1649 | * |
|
468c868cc8a8
add attributes to string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1044
diff
changeset
|
1650 | * @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
|
1651 | * @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
|
1652 | * @param decsep the decimal separator |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1653 | * @param groupsep each character in this string is treated as a 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
|
1654 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1655 | * @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
|
1656 | */ |
|
1675
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1657 | CX_EXTERN CX_ACCESS_W(2) CX_NONNULL_ARG(2) |
|
36c0fb2b60b2
overhaul all attributes
Mike Becker <universe@uap-core.de>
parents:
1674
diff
changeset
|
1658 | 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
|
1659 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1660 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1661 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1662 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1663 | * 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
|
1664 | * 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
|
1665 | * 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
|
1666 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1667 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1668 | * @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
|
1669 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1670 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1671 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1672 | * @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
|
1673 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1674 | #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
|
1675 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1676 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1677 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1678 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1679 | * 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
|
1680 | * 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
|
1681 | * 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
|
1682 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1683 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1684 | * @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
|
1685 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1686 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1687 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1688 | * @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
|
1689 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1690 | #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
|
1691 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1692 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1693 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1694 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1695 | * 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
|
1696 | * 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
|
1697 | * 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
|
1698 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1699 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1700 | * @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
|
1701 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1702 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1703 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1704 | * @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
|
1705 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1706 | #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
|
1707 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1708 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1709 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1710 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1711 | * 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
|
1712 | * 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
|
1713 | * 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
|
1714 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1715 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1716 | * @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
|
1717 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1718 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1719 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1720 | * @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
|
1721 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1722 | #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
|
1723 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1724 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1725 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1726 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1727 | * 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
|
1728 | * 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
|
1729 | * 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
|
1730 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1731 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1732 | * @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
|
1733 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1734 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1735 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1736 | * @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
|
1737 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1738 | #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
|
1739 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1740 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1741 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1742 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1743 | * 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
|
1744 | * 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
|
1745 | * 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
|
1746 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1747 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1748 | * @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
|
1749 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1750 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1751 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1752 | * @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
|
1753 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1754 | #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
|
1755 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1756 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1757 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1758 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1759 | * 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
|
1760 | * 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
|
1761 | * 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
|
1762 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1763 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1764 | * @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
|
1765 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1766 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1767 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1768 | * @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
|
1769 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1770 | #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
|
1771 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1772 | /** |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1773 | * 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
|
1774 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1775 | * 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
|
1776 | * 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
|
1777 | * 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
|
1778 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1779 | * @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
|
1780 | * @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
|
1781 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1782 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1783 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1784 | * @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
|
1785 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1786 | #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
|
1787 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1788 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1789 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1790 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1791 | * 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
|
1792 | * 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
|
1793 | * 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
|
1794 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1795 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1796 | * @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
|
1797 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1798 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1799 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1800 | * @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
|
1801 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1802 | #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
|
1803 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1804 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1805 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1806 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1807 | * 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
|
1808 | * 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
|
1809 | * 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
|
1810 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1811 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1812 | * @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
|
1813 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1814 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1815 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1816 | * @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
|
1817 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1818 | #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
|
1819 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1820 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1821 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1822 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1823 | * 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
|
1824 | * 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
|
1825 | * 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
|
1826 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1827 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1828 | * @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
|
1829 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1830 | * @param groupsep (@c const @c char*) each character in this string is treated as a 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
|
1831 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1832 | * @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
|
1833 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1834 | #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
|
1835 | |
|
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 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1838 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1839 | * 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
|
1840 | * 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
|
1841 | * 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
|
1842 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1843 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1844 | * @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
|
1845 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1846 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1847 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1848 | * @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
|
1849 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1850 | #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
|
1851 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1852 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1853 | * Converts a string to a number. |
|
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 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
|
1856 | * 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
|
1857 | * 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
|
1858 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1859 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1860 | * @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
|
1861 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1862 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1863 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1864 | * @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
|
1865 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1866 | #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
|
1867 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1868 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1869 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1870 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1871 | * 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
|
1872 | * 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
|
1873 | * 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
|
1874 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1875 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1876 | * @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
|
1877 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1878 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
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 |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1881 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1882 | #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
|
1883 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1884 | /** |
|
1134
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 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1892 | * @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
|
1893 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1894 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1895 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1896 | * @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
|
1897 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1898 | #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
|
1899 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1900 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1901 | * Converts a string to a number. |
|
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 | * 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
|
1904 | * 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
|
1905 | * 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
|
1906 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1907 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1908 | * @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
|
1909 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1910 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1911 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1912 | * @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
|
1913 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1914 | #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
|
1915 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1916 | /** |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1917 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1918 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1919 | * 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
|
1920 | * 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
|
1921 | * 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
|
1922 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1923 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1924 | * @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
|
1925 | * @param base 2, 8, 10, or 16 |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1926 | * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1927 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1928 | * @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
|
1929 | */ |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
1930 | #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc_(cx_strcast(str), output, base, groupsep) |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1931 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1932 | /** |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1933 | * 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
|
1934 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1935 | * 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
|
1936 | * 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
|
1937 | * 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
|
1938 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1939 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
1940 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1941 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
1942 | * @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
|
1943 | * @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
|
1944 | * @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
|
1945 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
1946 | * @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
|
1947 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1948 | #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
|
1949 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1950 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1951 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1952 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1953 | * 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
|
1954 | * 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
|
1955 | * 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
|
1956 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1957 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
1958 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1959 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1960 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1961 | * @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
|
1962 | * @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
|
1963 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1964 | * @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
|
1965 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1966 | #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
|
1967 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1968 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1969 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1970 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1971 | * 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
|
1972 | * 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
|
1973 | * 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
|
1974 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1975 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
1976 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1977 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1978 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1979 | * @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
|
1980 | * @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
|
1981 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1982 | * @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
|
1983 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1984 | #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
|
1985 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1986 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1987 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1988 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1989 | * 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
|
1990 | * 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
|
1991 | * 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
|
1992 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
1993 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
1994 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1995 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1996 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
1997 | * @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
|
1998 | * @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
|
1999 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2000 | * @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
|
2001 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2002 | #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
|
2003 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2004 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2005 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2006 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2007 | * 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
|
2008 | * 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
|
2009 | * 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
|
2010 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2011 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2012 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2013 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2014 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2015 | * @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
|
2016 | * @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
|
2017 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2018 | * @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
|
2019 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2020 | #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
|
2021 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2022 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2023 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2024 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2025 | * 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
|
2026 | * 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
|
2027 | * 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
|
2028 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2029 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2030 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2031 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2032 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2033 | * @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
|
2034 | * @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
|
2035 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2036 | * @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
|
2037 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2038 | #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
|
2039 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2040 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2041 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2042 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2043 | * 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
|
2044 | * 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
|
2045 | * 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
|
2046 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2047 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2048 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2049 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2050 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2051 | * @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
|
2052 | * @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
|
2053 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2054 | * @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
|
2055 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2056 | #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
|
2057 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2058 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2059 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2060 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2061 | * 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
|
2062 | * 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
|
2063 | * 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
|
2064 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2065 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2066 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2067 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2068 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2069 | * @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
|
2070 | * @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
|
2071 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2072 | * @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
|
2073 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2074 | #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
|
2075 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2076 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2077 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2078 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2079 | * 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
|
2080 | * 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
|
2081 | * 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
|
2082 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2083 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2084 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2085 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2086 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2087 | * @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
|
2088 | * @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
|
2089 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2090 | * @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
|
2091 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2092 | #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
|
2093 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2094 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2095 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2096 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2097 | * 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
|
2098 | * 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
|
2099 | * 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
|
2100 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2101 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2102 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2103 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2104 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2105 | * @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
|
2106 | * @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
|
2107 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2108 | * @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
|
2109 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2110 | #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
|
2111 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2112 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2113 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2114 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2115 | * 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
|
2116 | * 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
|
2117 | * 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
|
2118 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2119 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2120 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2121 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2122 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2123 | * @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
|
2124 | * @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
|
2125 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2126 | * @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
|
2127 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2128 | #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
|
2129 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2130 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2131 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2132 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2133 | * 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
|
2134 | * 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
|
2135 | * 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
|
2136 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2137 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2138 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2139 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2140 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2141 | * @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
|
2142 | * @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
|
2143 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2144 | * @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
|
2145 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2146 | #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
|
2147 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2148 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2149 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2150 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2151 | * 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
|
2152 | * 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
|
2153 | * 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
|
2154 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2155 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2156 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2157 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2158 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2159 | * @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
|
2160 | * @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
|
2161 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2162 | * @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
|
2163 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2164 | #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
|
2165 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2166 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2167 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2168 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2169 | * 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
|
2170 | * 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
|
2171 | * 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
|
2172 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2173 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2174 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2175 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2176 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2177 | * @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
|
2178 | * @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
|
2179 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2180 | * @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
|
2181 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2182 | #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
|
2183 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2184 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2185 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2186 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2187 | * 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
|
2188 | * 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
|
2189 | * 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
|
2190 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2191 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2192 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2193 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2194 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2195 | * @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
|
2196 | * @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
|
2197 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2198 | * @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
|
2199 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2200 | #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
|
2201 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2202 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2203 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2204 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2205 | * 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
|
2206 | * 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
|
2207 | * 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
|
2208 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2209 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2210 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2211 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2212 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2213 | * @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
|
2214 | * @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
|
2215 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2216 | * @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
|
2217 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2218 | #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
|
2219 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2220 | /** |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2221 | * Converts a string to a number. |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2222 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2223 | * 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
|
2224 | * 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
|
2225 | * 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
|
2226 | * |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2227 | * The comma character is treated as a group separator and ignored during parsing. |
|
1162
e3bb67b72d33
remove dependency to ssize_t - fixes #552
Mike Becker <universe@uap-core.de>
parents:
1134
diff
changeset
|
2228 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2229 | * |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2230 | * @param str the string to convert |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2231 | * @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
|
2232 | * @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
|
2233 | * @retval zero success |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2234 | * @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
|
2235 | */ |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2236 | #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
|
2237 | |
|
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2238 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2239 | * Converts a string to a single precision floating-point number. |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2240 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2241 | * 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
|
2242 | * 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
|
2243 | * 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
|
2244 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2245 | * @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
|
2246 | * @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
|
2247 | * @param decsep the decimal separator |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2248 | * @param groupsep each character in this string is treated as a 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
|
2249 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
2250 | * @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
|
2251 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2252 | #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
|
2253 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2254 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2255 | * Converts a string to a double precision floating-point number. |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2256 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2257 | * 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
|
2258 | * 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
|
2259 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2260 | * @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
|
2261 | * @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
|
2262 | * @param decsep the decimal separator |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2263 | * @param groupsep each character in this string is treated as a 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
|
2264 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
2265 | * @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
|
2266 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2267 | #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
|
2268 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2269 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2270 | * Converts a string to a single precision floating-point number. |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2271 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2272 | * 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
|
2273 | * 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
|
2274 | * 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
|
2275 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2276 | * The decimal separator is assumed to be a dot character. |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2277 | * The comma character is treated as a group separator and ignored during parsing. |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2278 | * 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
|
2279 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2280 | * @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
|
2281 | * @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
|
2282 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
2283 | * @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
|
2284 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2285 | #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
|
2286 | |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2287 | /** |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2288 | * Converts a string to a double precision floating-point number. |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2289 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2290 | * 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
|
2291 | * 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
|
2292 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2293 | * The decimal separator is assumed to be a dot character. |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1416
diff
changeset
|
2294 | * The comma character is treated as a group separator and ignored during parsing. |
|
1044
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2295 | * 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
|
2296 | * |
|
776001e4cc96
add documentation for string to number conversion functions
Mike Becker <universe@uap-core.de>
parents:
1043
diff
changeset
|
2297 | * @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
|
2298 | * @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
|
2299 | * @retval zero success |
|
9d77c7a99441
refine docs for string.h - issue #548
Mike Becker <universe@uap-core.de>
parents:
1050
diff
changeset
|
2300 | * @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
|
2301 | */ |
|
1134
60edcd57d54c
fix that some IDEs cannot resolve documentation
Mike Becker <universe@uap-core.de>
parents:
1127
diff
changeset
|
2302 | #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
|
2303 | |
|
576
ba0c4ff6698e
first proposal for the string header
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2304 | #endif //UCX_STRING_H |