319 #endif |
319 #endif |
320 |
320 |
321 /** |
321 /** |
322 * Passes the pointer in this string to the cxDefaultAllocator's @c free() function. |
322 * Passes the pointer in this string to the cxDefaultAllocator's @c free() function. |
323 * |
323 * |
324 * The pointer in the struct is set to @c NULL and the length is set to zero |
324 * The pointer in the struct is set to @c NULL, and the length is set to zero, |
325 * which means that this function protects you against double-free. |
325 * which means that this function protects you against double-free. |
326 * |
326 * |
327 * @note There is no implementation for cxstring, because it is unlikely that |
327 * @note There is no implementation for cxstring, because it is unlikely that |
328 * you ever have a <code>const char*</code> you are really supposed to free. |
328 * you ever have a <code>const char*</code> you are really supposed to free. |
329 * If you encounter such situation, you should double-check your code. |
329 * If you encounter such a situation, you should double-check your code. |
330 * |
330 * |
331 * @param str the string to free |
331 * @param str the string to free |
332 */ |
332 */ |
333 cx_attr_export |
333 cx_attr_export |
334 void cx_strfree(cxmutstr *str); |
334 void cx_strfree(cxmutstr *str); |
335 |
335 |
336 /** |
336 /** |
337 * Passes the pointer in this string to the allocators free function. |
337 * Passes the pointer in this string to the allocator's free function. |
338 * |
338 * |
339 * The pointer in the struct is set to @c NULL and the length is set to zero |
339 * The pointer in the struct is set to @c NULL, and the length is set to zero, |
340 * which means that this function protects you against double-free. |
340 * which means that this function protects you against double-free. |
341 * |
341 * |
342 * @note There is no implementation for cxstring, because it is unlikely that |
342 * @note There is no implementation for cxstring, because it is unlikely that |
343 * you ever have a <code>const char*</code> you are really supposed to free. |
343 * you ever have a <code>const char*</code> you are really supposed to free. |
344 * If you encounter such situation, you should double-check your code. |
344 * If you encounter such a situation, you should double-check your code. |
345 * |
345 * |
346 * @param alloc the allocator |
346 * @param alloc the allocator |
347 * @param str the string to free |
347 * @param str the string to free |
348 */ |
348 */ |
349 cx_attr_nonnull_arg(1) |
349 cx_attr_nonnull_arg(1) |
1223 * It sets errno to ERANGE when the target datatype is too small. |
1223 * It sets errno to ERANGE when the target datatype is too small. |
1224 * |
1224 * |
1225 * @param str the string to convert |
1225 * @param str the string to convert |
1226 * @param output a pointer to the integer variable where the result shall be stored |
1226 * @param output a pointer to the integer variable where the result shall be stored |
1227 * @param base 2, 8, 10, or 16 |
1227 * @param base 2, 8, 10, or 16 |
1228 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1228 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1229 * @retval zero success |
1229 * @retval zero success |
1230 * @retval non-zero conversion was not possible |
1230 * @retval non-zero conversion was not possible |
1231 */ |
1231 */ |
1232 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1232 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1233 int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep); |
1233 int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep); |
1240 * It sets errno to ERANGE when the target datatype is too small. |
1240 * It sets errno to ERANGE when the target datatype is too small. |
1241 * |
1241 * |
1242 * @param str the string to convert |
1242 * @param str the string to convert |
1243 * @param output a pointer to the integer variable where the result shall be stored |
1243 * @param output a pointer to the integer variable where the result shall be stored |
1244 * @param base 2, 8, 10, or 16 |
1244 * @param base 2, 8, 10, or 16 |
1245 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1245 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1246 * @retval zero success |
1246 * @retval zero success |
1247 * @retval non-zero conversion was not possible |
1247 * @retval non-zero conversion was not possible |
1248 */ |
1248 */ |
1249 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1249 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1250 int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep); |
1250 int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep); |
1257 * It sets errno to ERANGE when the target datatype is too small. |
1257 * It sets errno to ERANGE when the target datatype is too small. |
1258 * |
1258 * |
1259 * @param str the string to convert |
1259 * @param str the string to convert |
1260 * @param output a pointer to the integer variable where the result shall be stored |
1260 * @param output a pointer to the integer variable where the result shall be stored |
1261 * @param base 2, 8, 10, or 16 |
1261 * @param base 2, 8, 10, or 16 |
1262 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1262 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1263 * @retval zero success |
1263 * @retval zero success |
1264 * @retval non-zero conversion was not possible |
1264 * @retval non-zero conversion was not possible |
1265 */ |
1265 */ |
1266 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1266 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1267 int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep); |
1267 int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep); |
1274 * It sets errno to ERANGE when the target datatype is too small. |
1274 * It sets errno to ERANGE when the target datatype is too small. |
1275 * |
1275 * |
1276 * @param str the string to convert |
1276 * @param str the string to convert |
1277 * @param output a pointer to the integer variable where the result shall be stored |
1277 * @param output a pointer to the integer variable where the result shall be stored |
1278 * @param base 2, 8, 10, or 16 |
1278 * @param base 2, 8, 10, or 16 |
1279 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1279 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1280 * @retval zero success |
1280 * @retval zero success |
1281 * @retval non-zero conversion was not possible |
1281 * @retval non-zero conversion was not possible |
1282 */ |
1282 */ |
1283 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1283 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1284 int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep); |
1284 int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep); |
1291 * It sets errno to ERANGE when the target datatype is too small. |
1291 * It sets errno to ERANGE when the target datatype is too small. |
1292 * |
1292 * |
1293 * @param str the string to convert |
1293 * @param str the string to convert |
1294 * @param output a pointer to the integer variable where the result shall be stored |
1294 * @param output a pointer to the integer variable where the result shall be stored |
1295 * @param base 2, 8, 10, or 16 |
1295 * @param base 2, 8, 10, or 16 |
1296 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1296 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1297 * @retval zero success |
1297 * @retval zero success |
1298 * @retval non-zero conversion was not possible |
1298 * @retval non-zero conversion was not possible |
1299 */ |
1299 */ |
1300 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1300 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1301 int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep); |
1301 int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep); |
1308 * It sets errno to ERANGE when the target datatype is too small. |
1308 * It sets errno to ERANGE when the target datatype is too small. |
1309 * |
1309 * |
1310 * @param str the string to convert |
1310 * @param str the string to convert |
1311 * @param output a pointer to the integer variable where the result shall be stored |
1311 * @param output a pointer to the integer variable where the result shall be stored |
1312 * @param base 2, 8, 10, or 16 |
1312 * @param base 2, 8, 10, or 16 |
1313 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1313 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1314 * @retval zero success |
1314 * @retval zero success |
1315 * @retval non-zero conversion was not possible |
1315 * @retval non-zero conversion was not possible |
1316 */ |
1316 */ |
1317 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1317 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1318 int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep); |
1318 int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep); |
1325 * It sets errno to ERANGE when the target datatype is too small. |
1325 * It sets errno to ERANGE when the target datatype is too small. |
1326 * |
1326 * |
1327 * @param str the string to convert |
1327 * @param str the string to convert |
1328 * @param output a pointer to the integer variable where the result shall be stored |
1328 * @param output a pointer to the integer variable where the result shall be stored |
1329 * @param base 2, 8, 10, or 16 |
1329 * @param base 2, 8, 10, or 16 |
1330 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1330 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1331 * @retval zero success |
1331 * @retval zero success |
1332 * @retval non-zero conversion was not possible |
1332 * @retval non-zero conversion was not possible |
1333 */ |
1333 */ |
1334 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1334 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1335 int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep); |
1335 int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep); |
1342 * It sets errno to ERANGE when the target datatype is too small. |
1342 * It sets errno to ERANGE when the target datatype is too small. |
1343 * |
1343 * |
1344 * @param str the string to convert |
1344 * @param str the string to convert |
1345 * @param output a pointer to the integer variable where the result shall be stored |
1345 * @param output a pointer to the integer variable where the result shall be stored |
1346 * @param base 2, 8, 10, or 16 |
1346 * @param base 2, 8, 10, or 16 |
1347 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1347 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1348 * @retval zero success |
1348 * @retval zero success |
1349 * @retval non-zero conversion was not possible |
1349 * @retval non-zero conversion was not possible |
1350 */ |
1350 */ |
1351 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1351 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1352 int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep); |
1352 int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep); |
1359 * It sets errno to ERANGE when the target datatype is too small. |
1359 * It sets errno to ERANGE when the target datatype is too small. |
1360 * |
1360 * |
1361 * @param str the string to convert |
1361 * @param str the string to convert |
1362 * @param output a pointer to the integer variable where the result shall be stored |
1362 * @param output a pointer to the integer variable where the result shall be stored |
1363 * @param base 2, 8, 10, or 16 |
1363 * @param base 2, 8, 10, or 16 |
1364 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1364 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1365 * @retval zero success |
1365 * @retval zero success |
1366 * @retval non-zero conversion was not possible |
1366 * @retval non-zero conversion was not possible |
1367 */ |
1367 */ |
1368 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1368 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1369 int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); |
1369 int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); |
1376 * It sets errno to ERANGE when the target datatype is too small. |
1376 * It sets errno to ERANGE when the target datatype is too small. |
1377 * |
1377 * |
1378 * @param str the string to convert |
1378 * @param str the string to convert |
1379 * @param output a pointer to the integer variable where the result shall be stored |
1379 * @param output a pointer to the integer variable where the result shall be stored |
1380 * @param base 2, 8, 10, or 16 |
1380 * @param base 2, 8, 10, or 16 |
1381 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1381 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1382 * @retval zero success |
1382 * @retval zero success |
1383 * @retval non-zero conversion was not possible |
1383 * @retval non-zero conversion was not possible |
1384 */ |
1384 */ |
1385 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1385 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1386 int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep); |
1386 int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep); |
1393 * It sets errno to ERANGE when the target datatype is too small. |
1393 * It sets errno to ERANGE when the target datatype is too small. |
1394 * |
1394 * |
1395 * @param str the string to convert |
1395 * @param str the string to convert |
1396 * @param output a pointer to the integer variable where the result shall be stored |
1396 * @param output a pointer to the integer variable where the result shall be stored |
1397 * @param base 2, 8, 10, or 16 |
1397 * @param base 2, 8, 10, or 16 |
1398 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1398 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1399 * @retval zero success |
1399 * @retval zero success |
1400 * @retval non-zero conversion was not possible |
1400 * @retval non-zero conversion was not possible |
1401 */ |
1401 */ |
1402 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1402 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1403 int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep); |
1403 int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep); |
1410 * It sets errno to ERANGE when the target datatype is too small. |
1410 * It sets errno to ERANGE when the target datatype is too small. |
1411 * |
1411 * |
1412 * @param str the string to convert |
1412 * @param str the string to convert |
1413 * @param output a pointer to the integer variable where the result shall be stored |
1413 * @param output a pointer to the integer variable where the result shall be stored |
1414 * @param base 2, 8, 10, or 16 |
1414 * @param base 2, 8, 10, or 16 |
1415 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1415 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1416 * @retval zero success |
1416 * @retval zero success |
1417 * @retval non-zero conversion was not possible |
1417 * @retval non-zero conversion was not possible |
1418 */ |
1418 */ |
1419 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1419 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1420 int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep); |
1420 int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep); |
1427 * It sets errno to ERANGE when the target datatype is too small. |
1427 * It sets errno to ERANGE when the target datatype is too small. |
1428 * |
1428 * |
1429 * @param str the string to convert |
1429 * @param str the string to convert |
1430 * @param output a pointer to the integer variable where the result shall be stored |
1430 * @param output a pointer to the integer variable where the result shall be stored |
1431 * @param base 2, 8, 10, or 16 |
1431 * @param base 2, 8, 10, or 16 |
1432 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1432 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1433 * @retval zero success |
1433 * @retval zero success |
1434 * @retval non-zero conversion was not possible |
1434 * @retval non-zero conversion was not possible |
1435 */ |
1435 */ |
1436 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1436 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1437 int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep); |
1437 int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep); |
1444 * It sets errno to ERANGE when the target datatype is too small. |
1444 * It sets errno to ERANGE when the target datatype is too small. |
1445 * |
1445 * |
1446 * @param str the string to convert |
1446 * @param str the string to convert |
1447 * @param output a pointer to the integer variable where the result shall be stored |
1447 * @param output a pointer to the integer variable where the result shall be stored |
1448 * @param base 2, 8, 10, or 16 |
1448 * @param base 2, 8, 10, or 16 |
1449 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1449 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1450 * @retval zero success |
1450 * @retval zero success |
1451 * @retval non-zero conversion was not possible |
1451 * @retval non-zero conversion was not possible |
1452 */ |
1452 */ |
1453 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1453 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1454 int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep); |
1454 int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep); |
1461 * It sets errno to ERANGE when the target datatype is too small. |
1461 * It sets errno to ERANGE when the target datatype is too small. |
1462 * |
1462 * |
1463 * @param str the string to convert |
1463 * @param str the string to convert |
1464 * @param output a pointer to the integer variable where the result shall be stored |
1464 * @param output a pointer to the integer variable where the result shall be stored |
1465 * @param base 2, 8, 10, or 16 |
1465 * @param base 2, 8, 10, or 16 |
1466 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1466 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1467 * @retval zero success |
1467 * @retval zero success |
1468 * @retval non-zero conversion was not possible |
1468 * @retval non-zero conversion was not possible |
1469 */ |
1469 */ |
1470 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1470 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1471 int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep); |
1471 int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep); |
1478 * It sets errno to ERANGE when the target datatype is too small. |
1478 * It sets errno to ERANGE when the target datatype is too small. |
1479 * |
1479 * |
1480 * @param str the string to convert |
1480 * @param str the string to convert |
1481 * @param output a pointer to the integer variable where the result shall be stored |
1481 * @param output a pointer to the integer variable where the result shall be stored |
1482 * @param base 2, 8, 10, or 16 |
1482 * @param base 2, 8, 10, or 16 |
1483 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1483 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1484 * @retval zero success |
1484 * @retval zero success |
1485 * @retval non-zero conversion was not possible |
1485 * @retval non-zero conversion was not possible |
1486 */ |
1486 */ |
1487 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1487 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1488 int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep); |
1488 int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep); |
1495 * It sets errno to ERANGE when the target datatype is too small. |
1495 * It sets errno to ERANGE when the target datatype is too small. |
1496 * |
1496 * |
1497 * @param str the string to convert |
1497 * @param str the string to convert |
1498 * @param output a pointer to the integer variable where the result shall be stored |
1498 * @param output a pointer to the integer variable where the result shall be stored |
1499 * @param base 2, 8, 10, or 16 |
1499 * @param base 2, 8, 10, or 16 |
1500 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1500 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1501 * @retval zero success |
1501 * @retval zero success |
1502 * @retval non-zero conversion was not possible |
1502 * @retval non-zero conversion was not possible |
1503 */ |
1503 */ |
1504 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1504 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1505 int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep); |
1505 int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep); |
1506 |
1506 |
1507 /** |
1507 /** |
1508 * Converts a string to a single precision floating point number. |
1508 * Converts a string to a single precision floating-point number. |
1509 * |
1509 * |
1510 * The function returns non-zero when conversion is not possible. |
1510 * The function returns non-zero when conversion is not possible. |
1511 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
1511 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
1512 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
1512 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
1513 * |
1513 * |
1514 * @param str the string to convert |
1514 * @param str the string to convert |
1515 * @param output a pointer to the float variable where the result shall be stored |
1515 * @param output a pointer to the float variable where the result shall be stored |
1516 * @param decsep the decimal separator |
1516 * @param decsep the decimal separator |
1517 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1517 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1518 * @retval zero success |
1518 * @retval zero success |
1519 * @retval non-zero conversion was not possible |
1519 * @retval non-zero conversion was not possible |
1520 */ |
1520 */ |
1521 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1521 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1522 int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep); |
1522 int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep); |
1523 |
1523 |
1524 /** |
1524 /** |
1525 * Converts a string to a double precision floating point number. |
1525 * Converts a string to a double precision floating-point number. |
1526 * |
1526 * |
1527 * The function returns non-zero when conversion is not possible. |
1527 * The function returns non-zero when conversion is not possible. |
1528 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
1528 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
1529 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
1529 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
1530 * |
1530 * |
1531 * @param str the string to convert |
1531 * @param str the string to convert |
1532 * @param output a pointer to the float variable where the result shall be stored |
1532 * @param output a pointer to the float variable where the result shall be stored |
1533 * @param decsep the decimal separator |
1533 * @param decsep the decimal separator |
1534 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1534 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
1535 * @retval zero success |
1535 * @retval zero success |
1536 * @retval non-zero conversion was not possible |
1536 * @retval non-zero conversion was not possible |
1537 */ |
1537 */ |
1538 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1538 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1539 int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep); |
1539 int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep); |
1546 * It sets errno to ERANGE when the target datatype is too small. |
1546 * It sets errno to ERANGE when the target datatype is too small. |
1547 * |
1547 * |
1548 * @param str the string to convert |
1548 * @param str the string to convert |
1549 * @param output a pointer to the integer variable where the result shall be stored |
1549 * @param output a pointer to the integer variable where the result shall be stored |
1550 * @param base 2, 8, 10, or 16 |
1550 * @param base 2, 8, 10, or 16 |
1551 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1551 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1552 * @retval zero success |
1552 * @retval zero success |
1553 * @retval non-zero conversion was not possible |
1553 * @retval non-zero conversion was not possible |
1554 */ |
1554 */ |
1555 #define cx_strtos_lc(str, output, base, groupsep) cx_strtos_lc_(cx_strcast(str), output, base, groupsep) |
1555 #define cx_strtos_lc(str, output, base, groupsep) cx_strtos_lc_(cx_strcast(str), output, base, groupsep) |
1556 |
1556 |
1562 * It sets errno to ERANGE when the target datatype is too small. |
1562 * It sets errno to ERANGE when the target datatype is too small. |
1563 * |
1563 * |
1564 * @param str the string to convert |
1564 * @param str the string to convert |
1565 * @param output a pointer to the integer variable where the result shall be stored |
1565 * @param output a pointer to the integer variable where the result shall be stored |
1566 * @param base 2, 8, 10, or 16 |
1566 * @param base 2, 8, 10, or 16 |
1567 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1567 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1568 * @retval zero success |
1568 * @retval zero success |
1569 * @retval non-zero conversion was not possible |
1569 * @retval non-zero conversion was not possible |
1570 */ |
1570 */ |
1571 #define cx_strtoi_lc(str, output, base, groupsep) cx_strtoi_lc_(cx_strcast(str), output, base, groupsep) |
1571 #define cx_strtoi_lc(str, output, base, groupsep) cx_strtoi_lc_(cx_strcast(str), output, base, groupsep) |
1572 |
1572 |
1578 * It sets errno to ERANGE when the target datatype is too small. |
1578 * It sets errno to ERANGE when the target datatype is too small. |
1579 * |
1579 * |
1580 * @param str the string to convert |
1580 * @param str the string to convert |
1581 * @param output a pointer to the integer variable where the result shall be stored |
1581 * @param output a pointer to the integer variable where the result shall be stored |
1582 * @param base 2, 8, 10, or 16 |
1582 * @param base 2, 8, 10, or 16 |
1583 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1583 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1584 * @retval zero success |
1584 * @retval zero success |
1585 * @retval non-zero conversion was not possible |
1585 * @retval non-zero conversion was not possible |
1586 */ |
1586 */ |
1587 #define cx_strtol_lc(str, output, base, groupsep) cx_strtol_lc_(cx_strcast(str), output, base, groupsep) |
1587 #define cx_strtol_lc(str, output, base, groupsep) cx_strtol_lc_(cx_strcast(str), output, base, groupsep) |
1588 |
1588 |
1594 * It sets errno to ERANGE when the target datatype is too small. |
1594 * It sets errno to ERANGE when the target datatype is too small. |
1595 * |
1595 * |
1596 * @param str the string to convert |
1596 * @param str the string to convert |
1597 * @param output a pointer to the integer variable where the result shall be stored |
1597 * @param output a pointer to the integer variable where the result shall be stored |
1598 * @param base 2, 8, 10, or 16 |
1598 * @param base 2, 8, 10, or 16 |
1599 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1599 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1600 * @retval zero success |
1600 * @retval zero success |
1601 * @retval non-zero conversion was not possible |
1601 * @retval non-zero conversion was not possible |
1602 */ |
1602 */ |
1603 #define cx_strtoll_lc(str, output, base, groupsep) cx_strtoll_lc_(cx_strcast(str), output, base, groupsep) |
1603 #define cx_strtoll_lc(str, output, base, groupsep) cx_strtoll_lc_(cx_strcast(str), output, base, groupsep) |
1604 |
1604 |
1610 * It sets errno to ERANGE when the target datatype is too small. |
1610 * It sets errno to ERANGE when the target datatype is too small. |
1611 * |
1611 * |
1612 * @param str the string to convert |
1612 * @param str the string to convert |
1613 * @param output a pointer to the integer variable where the result shall be stored |
1613 * @param output a pointer to the integer variable where the result shall be stored |
1614 * @param base 2, 8, 10, or 16 |
1614 * @param base 2, 8, 10, or 16 |
1615 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1615 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1616 * @retval zero success |
1616 * @retval zero success |
1617 * @retval non-zero conversion was not possible |
1617 * @retval non-zero conversion was not possible |
1618 */ |
1618 */ |
1619 #define cx_strtoi8_lc(str, output, base, groupsep) cx_strtoi8_lc_(cx_strcast(str), output, base, groupsep) |
1619 #define cx_strtoi8_lc(str, output, base, groupsep) cx_strtoi8_lc_(cx_strcast(str), output, base, groupsep) |
1620 |
1620 |
1626 * It sets errno to ERANGE when the target datatype is too small. |
1626 * It sets errno to ERANGE when the target datatype is too small. |
1627 * |
1627 * |
1628 * @param str the string to convert |
1628 * @param str the string to convert |
1629 * @param output a pointer to the integer variable where the result shall be stored |
1629 * @param output a pointer to the integer variable where the result shall be stored |
1630 * @param base 2, 8, 10, or 16 |
1630 * @param base 2, 8, 10, or 16 |
1631 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1631 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1632 * @retval zero success |
1632 * @retval zero success |
1633 * @retval non-zero conversion was not possible |
1633 * @retval non-zero conversion was not possible |
1634 */ |
1634 */ |
1635 #define cx_strtoi16_lc(str, output, base, groupsep) cx_strtoi16_lc_(cx_strcast(str), output, base, groupsep) |
1635 #define cx_strtoi16_lc(str, output, base, groupsep) cx_strtoi16_lc_(cx_strcast(str), output, base, groupsep) |
1636 |
1636 |
1642 * It sets errno to ERANGE when the target datatype is too small. |
1642 * It sets errno to ERANGE when the target datatype is too small. |
1643 * |
1643 * |
1644 * @param str the string to convert |
1644 * @param str the string to convert |
1645 * @param output a pointer to the integer variable where the result shall be stored |
1645 * @param output a pointer to the integer variable where the result shall be stored |
1646 * @param base 2, 8, 10, or 16 |
1646 * @param base 2, 8, 10, or 16 |
1647 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1647 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1648 * @retval zero success |
1648 * @retval zero success |
1649 * @retval non-zero conversion was not possible |
1649 * @retval non-zero conversion was not possible |
1650 */ |
1650 */ |
1651 #define cx_strtoi32_lc(str, output, base, groupsep) cx_strtoi32_lc_(cx_strcast(str), output, base, groupsep) |
1651 #define cx_strtoi32_lc(str, output, base, groupsep) cx_strtoi32_lc_(cx_strcast(str), output, base, groupsep) |
1652 |
1652 |
1658 * It sets errno to ERANGE when the target datatype is too small. |
1658 * It sets errno to ERANGE when the target datatype is too small. |
1659 * |
1659 * |
1660 * @param str the string to convert |
1660 * @param str the string to convert |
1661 * @param output a pointer to the integer variable where the result shall be stored |
1661 * @param output a pointer to the integer variable where the result shall be stored |
1662 * @param base 2, 8, 10, or 16 |
1662 * @param base 2, 8, 10, or 16 |
1663 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1663 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1664 * @retval zero success |
1664 * @retval zero success |
1665 * @retval non-zero conversion was not possible |
1665 * @retval non-zero conversion was not possible |
1666 */ |
1666 */ |
1667 #define cx_strtoi64_lc(str, output, base, groupsep) cx_strtoi64_lc_(cx_strcast(str), output, base, groupsep) |
1667 #define cx_strtoi64_lc(str, output, base, groupsep) cx_strtoi64_lc_(cx_strcast(str), output, base, groupsep) |
1668 |
1668 |
1674 * It sets errno to ERANGE when the target datatype is too small. |
1674 * It sets errno to ERANGE when the target datatype is too small. |
1675 * |
1675 * |
1676 * @param str the string to convert |
1676 * @param str the string to convert |
1677 * @param output a pointer to the integer variable where the result shall be stored |
1677 * @param output a pointer to the integer variable where the result shall be stored |
1678 * @param base 2, 8, 10, or 16 |
1678 * @param base 2, 8, 10, or 16 |
1679 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1679 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1680 * @retval zero success |
1680 * @retval zero success |
1681 * @retval non-zero conversion was not possible |
1681 * @retval non-zero conversion was not possible |
1682 */ |
1682 */ |
1683 #define cx_strtous_lc(str, output, base, groupsep) cx_strtous_lc_(cx_strcast(str), output, base, groupsep) |
1683 #define cx_strtous_lc(str, output, base, groupsep) cx_strtous_lc_(cx_strcast(str), output, base, groupsep) |
1684 |
1684 |
1690 * It sets errno to ERANGE when the target datatype is too small. |
1690 * It sets errno to ERANGE when the target datatype is too small. |
1691 * |
1691 * |
1692 * @param str the string to convert |
1692 * @param str the string to convert |
1693 * @param output a pointer to the integer variable where the result shall be stored |
1693 * @param output a pointer to the integer variable where the result shall be stored |
1694 * @param base 2, 8, 10, or 16 |
1694 * @param base 2, 8, 10, or 16 |
1695 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1695 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1696 * @retval zero success |
1696 * @retval zero success |
1697 * @retval non-zero conversion was not possible |
1697 * @retval non-zero conversion was not possible |
1698 */ |
1698 */ |
1699 #define cx_strtou_lc(str, output, base, groupsep) cx_strtou_lc_(cx_strcast(str), output, base, groupsep) |
1699 #define cx_strtou_lc(str, output, base, groupsep) cx_strtou_lc_(cx_strcast(str), output, base, groupsep) |
1700 |
1700 |
1706 * It sets errno to ERANGE when the target datatype is too small. |
1706 * It sets errno to ERANGE when the target datatype is too small. |
1707 * |
1707 * |
1708 * @param str the string to convert |
1708 * @param str the string to convert |
1709 * @param output a pointer to the integer variable where the result shall be stored |
1709 * @param output a pointer to the integer variable where the result shall be stored |
1710 * @param base 2, 8, 10, or 16 |
1710 * @param base 2, 8, 10, or 16 |
1711 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1711 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1712 * @retval zero success |
1712 * @retval zero success |
1713 * @retval non-zero conversion was not possible |
1713 * @retval non-zero conversion was not possible |
1714 */ |
1714 */ |
1715 #define cx_strtoul_lc(str, output, base, groupsep) cx_strtoul_lc_(cx_strcast(str), output, base, groupsep) |
1715 #define cx_strtoul_lc(str, output, base, groupsep) cx_strtoul_lc_(cx_strcast(str), output, base, groupsep) |
1716 |
1716 |
1722 * It sets errno to ERANGE when the target datatype is too small. |
1722 * It sets errno to ERANGE when the target datatype is too small. |
1723 * |
1723 * |
1724 * @param str the string to convert |
1724 * @param str the string to convert |
1725 * @param output a pointer to the integer variable where the result shall be stored |
1725 * @param output a pointer to the integer variable where the result shall be stored |
1726 * @param base 2, 8, 10, or 16 |
1726 * @param base 2, 8, 10, or 16 |
1727 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1727 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1728 * @retval zero success |
1728 * @retval zero success |
1729 * @retval non-zero conversion was not possible |
1729 * @retval non-zero conversion was not possible |
1730 */ |
1730 */ |
1731 #define cx_strtoull_lc(str, output, base, groupsep) cx_strtoull_lc_(cx_strcast(str), output, base, groupsep) |
1731 #define cx_strtoull_lc(str, output, base, groupsep) cx_strtoull_lc_(cx_strcast(str), output, base, groupsep) |
1732 |
1732 |
1738 * It sets errno to ERANGE when the target datatype is too small. |
1738 * It sets errno to ERANGE when the target datatype is too small. |
1739 * |
1739 * |
1740 * @param str the string to convert |
1740 * @param str the string to convert |
1741 * @param output a pointer to the integer variable where the result shall be stored |
1741 * @param output a pointer to the integer variable where the result shall be stored |
1742 * @param base 2, 8, 10, or 16 |
1742 * @param base 2, 8, 10, or 16 |
1743 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1743 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1744 * @retval zero success |
1744 * @retval zero success |
1745 * @retval non-zero conversion was not possible |
1745 * @retval non-zero conversion was not possible |
1746 */ |
1746 */ |
1747 #define cx_strtou8_lc(str, output, base, groupsep) cx_strtou8_lc_(cx_strcast(str), output, base, groupsep) |
1747 #define cx_strtou8_lc(str, output, base, groupsep) cx_strtou8_lc_(cx_strcast(str), output, base, groupsep) |
1748 |
1748 |
1754 * It sets errno to ERANGE when the target datatype is too small. |
1754 * It sets errno to ERANGE when the target datatype is too small. |
1755 * |
1755 * |
1756 * @param str the string to convert |
1756 * @param str the string to convert |
1757 * @param output a pointer to the integer variable where the result shall be stored |
1757 * @param output a pointer to the integer variable where the result shall be stored |
1758 * @param base 2, 8, 10, or 16 |
1758 * @param base 2, 8, 10, or 16 |
1759 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1759 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1760 * @retval zero success |
1760 * @retval zero success |
1761 * @retval non-zero conversion was not possible |
1761 * @retval non-zero conversion was not possible |
1762 */ |
1762 */ |
1763 #define cx_strtou16_lc(str, output, base, groupsep) cx_strtou16_lc_(cx_strcast(str), output, base, groupsep) |
1763 #define cx_strtou16_lc(str, output, base, groupsep) cx_strtou16_lc_(cx_strcast(str), output, base, groupsep) |
1764 |
1764 |
1770 * It sets errno to ERANGE when the target datatype is too small. |
1770 * It sets errno to ERANGE when the target datatype is too small. |
1771 * |
1771 * |
1772 * @param str the string to convert |
1772 * @param str the string to convert |
1773 * @param output a pointer to the integer variable where the result shall be stored |
1773 * @param output a pointer to the integer variable where the result shall be stored |
1774 * @param base 2, 8, 10, or 16 |
1774 * @param base 2, 8, 10, or 16 |
1775 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1775 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1776 * @retval zero success |
1776 * @retval zero success |
1777 * @retval non-zero conversion was not possible |
1777 * @retval non-zero conversion was not possible |
1778 */ |
1778 */ |
1779 #define cx_strtou32_lc(str, output, base, groupsep) cx_strtou32_lc_(cx_strcast(str), output, base, groupsep) |
1779 #define cx_strtou32_lc(str, output, base, groupsep) cx_strtou32_lc_(cx_strcast(str), output, base, groupsep) |
1780 |
1780 |
1786 * It sets errno to ERANGE when the target datatype is too small. |
1786 * It sets errno to ERANGE when the target datatype is too small. |
1787 * |
1787 * |
1788 * @param str the string to convert |
1788 * @param str the string to convert |
1789 * @param output a pointer to the integer variable where the result shall be stored |
1789 * @param output a pointer to the integer variable where the result shall be stored |
1790 * @param base 2, 8, 10, or 16 |
1790 * @param base 2, 8, 10, or 16 |
1791 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1791 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1792 * @retval zero success |
1792 * @retval zero success |
1793 * @retval non-zero conversion was not possible |
1793 * @retval non-zero conversion was not possible |
1794 */ |
1794 */ |
1795 #define cx_strtou64_lc(str, output, base, groupsep) cx_strtou64_lc_(cx_strcast(str), output, base, groupsep) |
1795 #define cx_strtou64_lc(str, output, base, groupsep) cx_strtou64_lc_(cx_strcast(str), output, base, groupsep) |
1796 |
1796 |
1802 * It sets errno to ERANGE when the target datatype is too small. |
1802 * It sets errno to ERANGE when the target datatype is too small. |
1803 * |
1803 * |
1804 * @param str the string to convert |
1804 * @param str the string to convert |
1805 * @param output a pointer to the integer variable where the result shall be stored |
1805 * @param output a pointer to the integer variable where the result shall be stored |
1806 * @param base 2, 8, 10, or 16 |
1806 * @param base 2, 8, 10, or 16 |
1807 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1807 * @param groupsep (@c const @c char*) each character in this string is treated as a group separator and ignored during conversion |
1808 * @retval zero success |
1808 * @retval zero success |
1809 * @retval non-zero conversion was not possible |
1809 * @retval non-zero conversion was not possible |
1810 */ |
1810 */ |
1811 #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc_(cx_strcast(str), output, base, groupsep) |
1811 #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc_(cx_strcast(str), output, base, groupsep) |
1812 |
1812 |
2115 * @retval non-zero conversion was not possible |
2115 * @retval non-zero conversion was not possible |
2116 */ |
2116 */ |
2117 #define cx_strtou64(str, output, base) cx_strtou64_lc_(cx_strcast(str), output, base, ",") |
2117 #define cx_strtou64(str, output, base) cx_strtou64_lc_(cx_strcast(str), output, base, ",") |
2118 |
2118 |
2119 /** |
2119 /** |
2120 * Converts a string to a single precision floating point number. |
2120 * Converts a string to a single precision floating-point number. |
2121 * |
2121 * |
2122 * The function returns non-zero when conversion is not possible. |
2122 * The function returns non-zero when conversion is not possible. |
2123 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
2123 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
2124 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
2124 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
2125 * |
2125 * |
2126 * @param str the string to convert |
2126 * @param str the string to convert |
2127 * @param output a pointer to the float variable where the result shall be stored |
2127 * @param output a pointer to the float variable where the result shall be stored |
2128 * @param decsep the decimal separator |
2128 * @param decsep the decimal separator |
2129 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
2129 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
2130 * @retval zero success |
2130 * @retval zero success |
2131 * @retval non-zero conversion was not possible |
2131 * @retval non-zero conversion was not possible |
2132 */ |
2132 */ |
2133 #define cx_strtof_lc(str, output, decsep, groupsep) cx_strtof_lc_(cx_strcast(str), output, decsep, groupsep) |
2133 #define cx_strtof_lc(str, output, decsep, groupsep) cx_strtof_lc_(cx_strcast(str), output, decsep, groupsep) |
2134 |
2134 |
2135 /** |
2135 /** |
2136 * Converts a string to a double precision floating point number. |
2136 * Converts a string to a double precision floating-point number. |
2137 * |
2137 * |
2138 * The function returns non-zero when conversion is not possible. |
2138 * The function returns non-zero when conversion is not possible. |
2139 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
2139 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
2140 * |
2140 * |
2141 * @param str the string to convert |
2141 * @param str the string to convert |
2142 * @param output a pointer to the double variable where the result shall be stored |
2142 * @param output a pointer to the double variable where the result shall be stored |
2143 * @param decsep the decimal separator |
2143 * @param decsep the decimal separator |
2144 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
2144 * @param groupsep each character in this string is treated as a group separator and ignored during conversion |
2145 * @retval zero success |
2145 * @retval zero success |
2146 * @retval non-zero conversion was not possible |
2146 * @retval non-zero conversion was not possible |
2147 */ |
2147 */ |
2148 #define cx_strtod_lc(str, output, decsep, groupsep) cx_strtod_lc_(cx_strcast(str), output, decsep, groupsep) |
2148 #define cx_strtod_lc(str, output, decsep, groupsep) cx_strtod_lc_(cx_strcast(str), output, decsep, groupsep) |
2149 |
2149 |
2150 /** |
2150 /** |
2151 * Converts a string to a single precision floating point number. |
2151 * Converts a string to a single precision floating-point number. |
2152 * |
2152 * |
2153 * The function returns non-zero when conversion is not possible. |
2153 * The function returns non-zero when conversion is not possible. |
2154 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
2154 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
2155 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
2155 * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
2156 * |
2156 * |
2157 * The decimal separator is assumed to be a dot character. |
2157 * The decimal separator is assumed to be a dot character. |
2158 * The comma character is treated as group separator and ignored during parsing. |
2158 * The comma character is treated as a group separator and ignored during parsing. |
2159 * If you want to choose a different format, use cx_strtof_lc(). |
2159 * If you want to choose a different format, use cx_strtof_lc(). |
2160 * |
2160 * |
2161 * @param str the string to convert |
2161 * @param str the string to convert |
2162 * @param output a pointer to the float variable where the result shall be stored |
2162 * @param output a pointer to the float variable where the result shall be stored |
2163 * @retval zero success |
2163 * @retval zero success |
2164 * @retval non-zero conversion was not possible |
2164 * @retval non-zero conversion was not possible |
2165 */ |
2165 */ |
2166 #define cx_strtof(str, output) cx_strtof_lc_(cx_strcast(str), output, '.', ",") |
2166 #define cx_strtof(str, output) cx_strtof_lc_(cx_strcast(str), output, '.', ",") |
2167 |
2167 |
2168 /** |
2168 /** |
2169 * Converts a string to a double precision floating point number. |
2169 * Converts a string to a double precision floating-point number. |
2170 * |
2170 * |
2171 * The function returns non-zero when conversion is not possible. |
2171 * The function returns non-zero when conversion is not possible. |
2172 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
2172 * In that case the function sets errno to EINVAL when the reason is an invalid character. |
2173 * |
2173 * |
2174 * The decimal separator is assumed to be a dot character. |
2174 * The decimal separator is assumed to be a dot character. |
2175 * The comma character is treated as group separator and ignored during parsing. |
2175 * The comma character is treated as a group separator and ignored during parsing. |
2176 * If you want to choose a different format, use cx_strtof_lc(). |
2176 * If you want to choose a different format, use cx_strtof_lc(). |
2177 * |
2177 * |
2178 * @param str the string to convert |
2178 * @param str the string to convert |
2179 * @param output a pointer to the double variable where the result shall be stored |
2179 * @param output a pointer to the double variable where the result shall be stored |
2180 * @retval zero success |
2180 * @retval zero success |