1161:747c4baed44f | 1162:e3bb67b72d33 |
---|---|
1294 * @param groupsep each character in this string is treated as group separator and ignored during conversion | 1294 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1295 * @retval zero success | 1295 * @retval zero success |
1296 * @retval non-zero conversion was not possible | 1296 * @retval non-zero conversion was not possible |
1297 */ | 1297 */ |
1298 cx_attr_access_w(2) cx_attr_nonnull_arg(2) | 1298 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1299 int cx_strtoz_lc_(cxstring str, ssize_t *output, int base, const char *groupsep); | |
1300 | |
1301 /** | |
1302 * Converts a string to a number. | |
1303 * | |
1304 * The function returns non-zero when conversion is not possible. | |
1305 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1306 * It sets errno to ERANGE when the target datatype is too small. | |
1307 * | |
1308 * @param str the string to convert | |
1309 * @param output a pointer to the integer variable where the result shall be stored | |
1310 * @param base 2, 8, 10, or 16 | |
1311 * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
1312 * @retval zero success | |
1313 * @retval non-zero conversion was not possible | |
1314 */ | |
1315 cx_attr_access_w(2) cx_attr_nonnull_arg(2) | |
1316 int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); | 1299 int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); |
1317 | 1300 |
1318 /** | 1301 /** |
1319 * Converts a string to a number. | 1302 * Converts a string to a number. |
1320 * | 1303 * |
1447 * @param groupsep each character in this string is treated as group separator and ignored during conversion | 1430 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1448 * @retval zero success | 1431 * @retval zero success |
1449 * @retval non-zero conversion was not possible | 1432 * @retval non-zero conversion was not possible |
1450 */ | 1433 */ |
1451 cx_attr_access_w(2) cx_attr_nonnull_arg(2) | 1434 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1452 int cx_strtouz_lc_(cxstring str, size_t *output, int base, const char *groupsep); | 1435 int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep); |
1453 | 1436 |
1454 /** | 1437 /** |
1455 * Converts a string to a single precision floating point number. | 1438 * Converts a string to a single precision floating point number. |
1456 * | 1439 * |
1457 * The function returns non-zero when conversion is not possible. | 1440 * The function returns non-zero when conversion is not possible. |
1625 * @param base 2, 8, 10, or 16 | 1608 * @param base 2, 8, 10, or 16 |
1626 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | 1609 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion |
1627 * @retval zero success | 1610 * @retval zero success |
1628 * @retval non-zero conversion was not possible | 1611 * @retval non-zero conversion was not possible |
1629 */ | 1612 */ |
1613 #define cx_strtous_lc(str, output, base, groupsep) cx_strtous_lc_(cx_strcast(str), output, base, groupsep) | |
1614 | |
1615 /** | |
1616 * Converts a string to a number. | |
1617 * | |
1618 * The function returns non-zero when conversion is not possible. | |
1619 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1620 * It sets errno to ERANGE when the target datatype is too small. | |
1621 * | |
1622 * @param str the string to convert | |
1623 * @param output a pointer to the integer variable where the result shall be stored | |
1624 * @param base 2, 8, 10, or 16 | |
1625 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1626 * @retval zero success | |
1627 * @retval non-zero conversion was not possible | |
1628 */ | |
1629 #define cx_strtou_lc(str, output, base, groupsep) cx_strtou_lc_(cx_strcast(str), output, base, groupsep) | |
1630 | |
1631 /** | |
1632 * Converts a string to a number. | |
1633 * | |
1634 * The function returns non-zero when conversion is not possible. | |
1635 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1636 * It sets errno to ERANGE when the target datatype is too small. | |
1637 * | |
1638 * @param str the string to convert | |
1639 * @param output a pointer to the integer variable where the result shall be stored | |
1640 * @param base 2, 8, 10, or 16 | |
1641 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1642 * @retval zero success | |
1643 * @retval non-zero conversion was not possible | |
1644 */ | |
1645 #define cx_strtoul_lc(str, output, base, groupsep) cx_strtoul_lc_(cx_strcast(str), output, base, groupsep) | |
1646 | |
1647 /** | |
1648 * Converts a string to a number. | |
1649 * | |
1650 * The function returns non-zero when conversion is not possible. | |
1651 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1652 * It sets errno to ERANGE when the target datatype is too small. | |
1653 * | |
1654 * @param str the string to convert | |
1655 * @param output a pointer to the integer variable where the result shall be stored | |
1656 * @param base 2, 8, 10, or 16 | |
1657 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1658 * @retval zero success | |
1659 * @retval non-zero conversion was not possible | |
1660 */ | |
1661 #define cx_strtoull_lc(str, output, base, groupsep) cx_strtoull_lc_(cx_strcast(str), output, base, groupsep) | |
1662 | |
1663 /** | |
1664 * Converts a string to a number. | |
1665 * | |
1666 * The function returns non-zero when conversion is not possible. | |
1667 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1668 * It sets errno to ERANGE when the target datatype is too small. | |
1669 * | |
1670 * @param str the string to convert | |
1671 * @param output a pointer to the integer variable where the result shall be stored | |
1672 * @param base 2, 8, 10, or 16 | |
1673 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1674 * @retval zero success | |
1675 * @retval non-zero conversion was not possible | |
1676 */ | |
1677 #define cx_strtou8_lc(str, output, base, groupsep) cx_strtou8_lc_(cx_strcast(str), output, base, groupsep) | |
1678 | |
1679 /** | |
1680 * Converts a string to a number. | |
1681 * | |
1682 * The function returns non-zero when conversion is not possible. | |
1683 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1684 * It sets errno to ERANGE when the target datatype is too small. | |
1685 * | |
1686 * @param str the string to convert | |
1687 * @param output a pointer to the integer variable where the result shall be stored | |
1688 * @param base 2, 8, 10, or 16 | |
1689 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1690 * @retval zero success | |
1691 * @retval non-zero conversion was not possible | |
1692 */ | |
1693 #define cx_strtou16_lc(str, output, base, groupsep) cx_strtou16_lc_(cx_strcast(str), output, base, groupsep) | |
1694 | |
1695 /** | |
1696 * Converts a string to a number. | |
1697 * | |
1698 * The function returns non-zero when conversion is not possible. | |
1699 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1700 * It sets errno to ERANGE when the target datatype is too small. | |
1701 * | |
1702 * @param str the string to convert | |
1703 * @param output a pointer to the integer variable where the result shall be stored | |
1704 * @param base 2, 8, 10, or 16 | |
1705 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1706 * @retval zero success | |
1707 * @retval non-zero conversion was not possible | |
1708 */ | |
1709 #define cx_strtou32_lc(str, output, base, groupsep) cx_strtou32_lc_(cx_strcast(str), output, base, groupsep) | |
1710 | |
1711 /** | |
1712 * Converts a string to a number. | |
1713 * | |
1714 * The function returns non-zero when conversion is not possible. | |
1715 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1716 * It sets errno to ERANGE when the target datatype is too small. | |
1717 * | |
1718 * @param str the string to convert | |
1719 * @param output a pointer to the integer variable where the result shall be stored | |
1720 * @param base 2, 8, 10, or 16 | |
1721 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1722 * @retval zero success | |
1723 * @retval non-zero conversion was not possible | |
1724 */ | |
1725 #define cx_strtou64_lc(str, output, base, groupsep) cx_strtou64_lc_(cx_strcast(str), output, base, groupsep) | |
1726 | |
1727 /** | |
1728 * Converts a string to a number. | |
1729 * | |
1730 * The function returns non-zero when conversion is not possible. | |
1731 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1732 * It sets errno to ERANGE when the target datatype is too small. | |
1733 * | |
1734 * @param str the string to convert | |
1735 * @param output a pointer to the integer variable where the result shall be stored | |
1736 * @param base 2, 8, 10, or 16 | |
1737 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1738 * @retval zero success | |
1739 * @retval non-zero conversion was not possible | |
1740 */ | |
1630 #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc_(cx_strcast(str), output, base, groupsep) | 1741 #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc_(cx_strcast(str), output, base, groupsep) |
1631 | 1742 |
1632 /** | 1743 /** |
1633 * Converts a string to a number. | 1744 * Converts a string to a number. |
1634 * | 1745 * |
1635 * The function returns non-zero when conversion is not possible. | 1746 * The function returns non-zero when conversion is not possible. |
1636 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1747 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1637 * It sets errno to ERANGE when the target datatype is too small. | 1748 * It sets errno to ERANGE when the target datatype is too small. |
1638 * | 1749 * |
1639 * @param str the string to convert | |
1640 * @param output a pointer to the integer variable where the result shall be stored | |
1641 * @param base 2, 8, 10, or 16 | |
1642 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1643 * @retval zero success | |
1644 * @retval non-zero conversion was not possible | |
1645 */ | |
1646 #define cx_strtous_lc(str, output, base, groupsep) cx_strtous_lc_(cx_strcast(str), output, base, groupsep) | |
1647 | |
1648 /** | |
1649 * Converts a string to a number. | |
1650 * | |
1651 * The function returns non-zero when conversion is not possible. | |
1652 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1653 * It sets errno to ERANGE when the target datatype is too small. | |
1654 * | |
1655 * @param str the string to convert | |
1656 * @param output a pointer to the integer variable where the result shall be stored | |
1657 * @param base 2, 8, 10, or 16 | |
1658 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1659 * @retval zero success | |
1660 * @retval non-zero conversion was not possible | |
1661 */ | |
1662 #define cx_strtou_lc(str, output, base, groupsep) cx_strtou_lc_(cx_strcast(str), output, base, groupsep) | |
1663 | |
1664 /** | |
1665 * Converts a string to a number. | |
1666 * | |
1667 * The function returns non-zero when conversion is not possible. | |
1668 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1669 * It sets errno to ERANGE when the target datatype is too small. | |
1670 * | |
1671 * @param str the string to convert | |
1672 * @param output a pointer to the integer variable where the result shall be stored | |
1673 * @param base 2, 8, 10, or 16 | |
1674 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1675 * @retval zero success | |
1676 * @retval non-zero conversion was not possible | |
1677 */ | |
1678 #define cx_strtoul_lc(str, output, base, groupsep) cx_strtoul_lc_(cx_strcast(str), output, base, groupsep) | |
1679 | |
1680 /** | |
1681 * Converts a string to a number. | |
1682 * | |
1683 * The function returns non-zero when conversion is not possible. | |
1684 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1685 * It sets errno to ERANGE when the target datatype is too small. | |
1686 * | |
1687 * @param str the string to convert | |
1688 * @param output a pointer to the integer variable where the result shall be stored | |
1689 * @param base 2, 8, 10, or 16 | |
1690 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1691 * @retval zero success | |
1692 * @retval non-zero conversion was not possible | |
1693 */ | |
1694 #define cx_strtoull_lc(str, output, base, groupsep) cx_strtoull_lc_(cx_strcast(str), output, base, groupsep) | |
1695 | |
1696 /** | |
1697 * Converts a string to a number. | |
1698 * | |
1699 * The function returns non-zero when conversion is not possible. | |
1700 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1701 * It sets errno to ERANGE when the target datatype is too small. | |
1702 * | |
1703 * @param str the string to convert | |
1704 * @param output a pointer to the integer variable where the result shall be stored | |
1705 * @param base 2, 8, 10, or 16 | |
1706 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1707 * @retval zero success | |
1708 * @retval non-zero conversion was not possible | |
1709 */ | |
1710 #define cx_strtou8_lc(str, output, base, groupsep) cx_strtou8_lc_(cx_strcast(str), output, base, groupsep) | |
1711 | |
1712 /** | |
1713 * Converts a string to a number. | |
1714 * | |
1715 * The function returns non-zero when conversion is not possible. | |
1716 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1717 * It sets errno to ERANGE when the target datatype is too small. | |
1718 * | |
1719 * @param str the string to convert | |
1720 * @param output a pointer to the integer variable where the result shall be stored | |
1721 * @param base 2, 8, 10, or 16 | |
1722 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1723 * @retval zero success | |
1724 * @retval non-zero conversion was not possible | |
1725 */ | |
1726 #define cx_strtou16_lc(str, output, base, groupsep) cx_strtou16_lc_(cx_strcast(str), output, base, groupsep) | |
1727 | |
1728 /** | |
1729 * Converts a string to a number. | |
1730 * | |
1731 * The function returns non-zero when conversion is not possible. | |
1732 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1733 * It sets errno to ERANGE when the target datatype is too small. | |
1734 * | |
1735 * @param str the string to convert | |
1736 * @param output a pointer to the integer variable where the result shall be stored | |
1737 * @param base 2, 8, 10, or 16 | |
1738 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1739 * @retval zero success | |
1740 * @retval non-zero conversion was not possible | |
1741 */ | |
1742 #define cx_strtou32_lc(str, output, base, groupsep) cx_strtou32_lc_(cx_strcast(str), output, base, groupsep) | |
1743 | |
1744 /** | |
1745 * Converts a string to a number. | |
1746 * | |
1747 * The function returns non-zero when conversion is not possible. | |
1748 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1749 * It sets errno to ERANGE when the target datatype is too small. | |
1750 * | |
1751 * @param str the string to convert | |
1752 * @param output a pointer to the integer variable where the result shall be stored | |
1753 * @param base 2, 8, 10, or 16 | |
1754 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1755 * @retval zero success | |
1756 * @retval non-zero conversion was not possible | |
1757 */ | |
1758 #define cx_strtou64_lc(str, output, base, groupsep) cx_strtou64_lc_(cx_strcast(str), output, base, groupsep) | |
1759 | |
1760 /** | |
1761 * Converts a string to a number. | |
1762 * | |
1763 * The function returns non-zero when conversion is not possible. | |
1764 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1765 * It sets errno to ERANGE when the target datatype is too small. | |
1766 * | |
1767 * @param str the string to convert | |
1768 * @param output a pointer to the integer variable where the result shall be stored | |
1769 * @param base 2, 8, 10, or 16 | |
1770 * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
1771 * @retval zero success | |
1772 * @retval non-zero conversion was not possible | |
1773 */ | |
1774 #define cx_strtouz_lc(str, output, base, groupsep) cx_strtouz_lc_(cx_strcast(str), output, base, groupsep) | |
1775 | |
1776 /** | |
1777 * Converts a string to a number. | |
1778 * | |
1779 * The function returns non-zero when conversion is not possible. | |
1780 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
1781 * It sets errno to ERANGE when the target datatype is too small. | |
1782 * | |
1783 * The comma character is treated as group separator and ignored during parsing. | 1750 * The comma character is treated as group separator and ignored during parsing. |
1784 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1751 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1785 * | 1752 * |
1786 * @param str the string to convert | 1753 * @param str the string to convert |
1787 * @param output a pointer to the integer variable where the result shall be stored | 1754 * @param output a pointer to the integer variable where the result shall be stored |
1788 * @param base 2, 8, 10, or 16 | 1755 * @param base 2, 8, 10, or 16 |
1789 * @retval zero success | 1756 * @retval zero success |
1797 * The function returns non-zero when conversion is not possible. | 1764 * The function returns non-zero when conversion is not possible. |
1798 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1765 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1799 * It sets errno to ERANGE when the target datatype is too small. | 1766 * It sets errno to ERANGE when the target datatype is too small. |
1800 * | 1767 * |
1801 * The comma character is treated as group separator and ignored during parsing. | 1768 * The comma character is treated as group separator and ignored during parsing. |
1802 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1769 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1803 * | 1770 * |
1804 * @param str the string to convert | 1771 * @param str the string to convert |
1805 * @param output a pointer to the integer variable where the result shall be stored | 1772 * @param output a pointer to the integer variable where the result shall be stored |
1806 * @param base 2, 8, 10, or 16 | 1773 * @param base 2, 8, 10, or 16 |
1807 * @retval zero success | 1774 * @retval zero success |
1815 * The function returns non-zero when conversion is not possible. | 1782 * The function returns non-zero when conversion is not possible. |
1816 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1783 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1817 * It sets errno to ERANGE when the target datatype is too small. | 1784 * It sets errno to ERANGE when the target datatype is too small. |
1818 * | 1785 * |
1819 * The comma character is treated as group separator and ignored during parsing. | 1786 * The comma character is treated as group separator and ignored during parsing. |
1820 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1787 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1821 * | 1788 * |
1822 * @param str the string to convert | 1789 * @param str the string to convert |
1823 * @param output a pointer to the integer variable where the result shall be stored | 1790 * @param output a pointer to the integer variable where the result shall be stored |
1824 * @param base 2, 8, 10, or 16 | 1791 * @param base 2, 8, 10, or 16 |
1825 * @retval zero success | 1792 * @retval zero success |
1833 * The function returns non-zero when conversion is not possible. | 1800 * The function returns non-zero when conversion is not possible. |
1834 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1801 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1835 * 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. |
1836 * | 1803 * |
1837 * The comma character is treated as group separator and ignored during parsing. | 1804 * The comma character is treated as group separator and ignored during parsing. |
1838 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1805 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1839 * | 1806 * |
1840 * @param str the string to convert | 1807 * @param str the string to convert |
1841 * @param output a pointer to the integer variable where the result shall be stored | 1808 * @param output a pointer to the integer variable where the result shall be stored |
1842 * @param base 2, 8, 10, or 16 | 1809 * @param base 2, 8, 10, or 16 |
1843 * @retval zero success | 1810 * @retval zero success |
1851 * The function returns non-zero when conversion is not possible. | 1818 * The function returns non-zero when conversion is not possible. |
1852 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1819 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1853 * It sets errno to ERANGE when the target datatype is too small. | 1820 * It sets errno to ERANGE when the target datatype is too small. |
1854 * | 1821 * |
1855 * The comma character is treated as group separator and ignored during parsing. | 1822 * The comma character is treated as group separator and ignored during parsing. |
1856 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1823 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1857 * | 1824 * |
1858 * @param str the string to convert | 1825 * @param str the string to convert |
1859 * @param output a pointer to the integer variable where the result shall be stored | 1826 * @param output a pointer to the integer variable where the result shall be stored |
1860 * @param base 2, 8, 10, or 16 | 1827 * @param base 2, 8, 10, or 16 |
1861 * @retval zero success | 1828 * @retval zero success |
1869 * The function returns non-zero when conversion is not possible. | 1836 * The function returns non-zero when conversion is not possible. |
1870 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1837 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1871 * It sets errno to ERANGE when the target datatype is too small. | 1838 * It sets errno to ERANGE when the target datatype is too small. |
1872 * | 1839 * |
1873 * The comma character is treated as group separator and ignored during parsing. | 1840 * The comma character is treated as group separator and ignored during parsing. |
1874 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1841 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1875 * | 1842 * |
1876 * @param str the string to convert | 1843 * @param str the string to convert |
1877 * @param output a pointer to the integer variable where the result shall be stored | 1844 * @param output a pointer to the integer variable where the result shall be stored |
1878 * @param base 2, 8, 10, or 16 | 1845 * @param base 2, 8, 10, or 16 |
1879 * @retval zero success | 1846 * @retval zero success |
1887 * The function returns non-zero when conversion is not possible. | 1854 * The function returns non-zero when conversion is not possible. |
1888 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1855 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1889 * It sets errno to ERANGE when the target datatype is too small. | 1856 * It sets errno to ERANGE when the target datatype is too small. |
1890 * | 1857 * |
1891 * The comma character is treated as group separator and ignored during parsing. | 1858 * The comma character is treated as group separator and ignored during parsing. |
1892 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1859 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1893 * | 1860 * |
1894 * @param str the string to convert | 1861 * @param str the string to convert |
1895 * @param output a pointer to the integer variable where the result shall be stored | 1862 * @param output a pointer to the integer variable where the result shall be stored |
1896 * @param base 2, 8, 10, or 16 | 1863 * @param base 2, 8, 10, or 16 |
1897 * @retval zero success | 1864 * @retval zero success |
1905 * The function returns non-zero when conversion is not possible. | 1872 * The function returns non-zero when conversion is not possible. |
1906 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1873 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1907 * It sets errno to ERANGE when the target datatype is too small. | 1874 * It sets errno to ERANGE when the target datatype is too small. |
1908 * | 1875 * |
1909 * The comma character is treated as group separator and ignored during parsing. | 1876 * The comma character is treated as group separator and ignored during parsing. |
1910 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1877 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1911 * | 1878 * |
1912 * @param str the string to convert | 1879 * @param str the string to convert |
1913 * @param output a pointer to the integer variable where the result shall be stored | 1880 * @param output a pointer to the integer variable where the result shall be stored |
1914 * @param base 2, 8, 10, or 16 | 1881 * @param base 2, 8, 10, or 16 |
1915 * @retval zero success | 1882 * @retval zero success |
1923 * The function returns non-zero when conversion is not possible. | 1890 * The function returns non-zero when conversion is not possible. |
1924 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1891 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1925 * It sets errno to ERANGE when the target datatype is too small. | 1892 * It sets errno to ERANGE when the target datatype is too small. |
1926 * | 1893 * |
1927 * The comma character is treated as group separator and ignored during parsing. | 1894 * The comma character is treated as group separator and ignored during parsing. |
1928 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1895 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1929 * | 1896 * |
1930 * @param str the string to convert | 1897 * @param str the string to convert |
1931 * @param output a pointer to the integer variable where the result shall be stored | 1898 * @param output a pointer to the integer variable where the result shall be stored |
1932 * @param base 2, 8, 10, or 16 | 1899 * @param base 2, 8, 10, or 16 |
1933 * @retval zero success | 1900 * @retval zero success |
1941 * The function returns non-zero when conversion is not possible. | 1908 * The function returns non-zero when conversion is not possible. |
1942 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1909 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1943 * It sets errno to ERANGE when the target datatype is too small. | 1910 * It sets errno to ERANGE when the target datatype is too small. |
1944 * | 1911 * |
1945 * The comma character is treated as group separator and ignored during parsing. | 1912 * The comma character is treated as group separator and ignored during parsing. |
1946 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1913 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1947 * | 1914 * |
1948 * @param str the string to convert | 1915 * @param str the string to convert |
1949 * @param output a pointer to the integer variable where the result shall be stored | 1916 * @param output a pointer to the integer variable where the result shall be stored |
1950 * @param base 2, 8, 10, or 16 | 1917 * @param base 2, 8, 10, or 16 |
1951 * @retval zero success | 1918 * @retval zero success |
1959 * The function returns non-zero when conversion is not possible. | 1926 * The function returns non-zero when conversion is not possible. |
1960 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1927 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1961 * It sets errno to ERANGE when the target datatype is too small. | 1928 * It sets errno to ERANGE when the target datatype is too small. |
1962 * | 1929 * |
1963 * The comma character is treated as group separator and ignored during parsing. | 1930 * The comma character is treated as group separator and ignored during parsing. |
1964 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1931 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1965 * | 1932 * |
1966 * @param str the string to convert | 1933 * @param str the string to convert |
1967 * @param output a pointer to the integer variable where the result shall be stored | 1934 * @param output a pointer to the integer variable where the result shall be stored |
1968 * @param base 2, 8, 10, or 16 | 1935 * @param base 2, 8, 10, or 16 |
1969 * @retval zero success | 1936 * @retval zero success |
1977 * The function returns non-zero when conversion is not possible. | 1944 * The function returns non-zero when conversion is not possible. |
1978 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1945 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1979 * It sets errno to ERANGE when the target datatype is too small. | 1946 * It sets errno to ERANGE when the target datatype is too small. |
1980 * | 1947 * |
1981 * The comma character is treated as group separator and ignored during parsing. | 1948 * The comma character is treated as group separator and ignored during parsing. |
1982 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1949 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
1983 * | 1950 * |
1984 * @param str the string to convert | 1951 * @param str the string to convert |
1985 * @param output a pointer to the integer variable where the result shall be stored | 1952 * @param output a pointer to the integer variable where the result shall be stored |
1986 * @param base 2, 8, 10, or 16 | 1953 * @param base 2, 8, 10, or 16 |
1987 * @retval zero success | 1954 * @retval zero success |
1995 * The function returns non-zero when conversion is not possible. | 1962 * The function returns non-zero when conversion is not possible. |
1996 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1963 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
1997 * It sets errno to ERANGE when the target datatype is too small. | 1964 * It sets errno to ERANGE when the target datatype is too small. |
1998 * | 1965 * |
1999 * The comma character is treated as group separator and ignored during parsing. | 1966 * The comma character is treated as group separator and ignored during parsing. |
2000 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1967 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
2001 * | 1968 * |
2002 * @param str the string to convert | 1969 * @param str the string to convert |
2003 * @param output a pointer to the integer variable where the result shall be stored | 1970 * @param output a pointer to the integer variable where the result shall be stored |
2004 * @param base 2, 8, 10, or 16 | 1971 * @param base 2, 8, 10, or 16 |
2005 * @retval zero success | 1972 * @retval zero success |
2013 * The function returns non-zero when conversion is not possible. | 1980 * The function returns non-zero when conversion is not possible. |
2014 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1981 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
2015 * It sets errno to ERANGE when the target datatype is too small. | 1982 * It sets errno to ERANGE when the target datatype is too small. |
2016 * | 1983 * |
2017 * The comma character is treated as group separator and ignored during parsing. | 1984 * The comma character is treated as group separator and ignored during parsing. |
2018 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 1985 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
2019 * | 1986 * |
2020 * @param str the string to convert | 1987 * @param str the string to convert |
2021 * @param output a pointer to the integer variable where the result shall be stored | 1988 * @param output a pointer to the integer variable where the result shall be stored |
2022 * @param base 2, 8, 10, or 16 | 1989 * @param base 2, 8, 10, or 16 |
2023 * @retval zero success | 1990 * @retval zero success |
2031 * The function returns non-zero when conversion is not possible. | 1998 * The function returns non-zero when conversion is not possible. |
2032 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 1999 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
2033 * It sets errno to ERANGE when the target datatype is too small. | 2000 * It sets errno to ERANGE when the target datatype is too small. |
2034 * | 2001 * |
2035 * The comma character is treated as group separator and ignored during parsing. | 2002 * The comma character is treated as group separator and ignored during parsing. |
2036 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 2003 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
2037 * | 2004 * |
2038 * @param str the string to convert | 2005 * @param str the string to convert |
2039 * @param output a pointer to the integer variable where the result shall be stored | 2006 * @param output a pointer to the integer variable where the result shall be stored |
2040 * @param base 2, 8, 10, or 16 | 2007 * @param base 2, 8, 10, or 16 |
2041 * @retval zero success | 2008 * @retval zero success |
2049 * The function returns non-zero when conversion is not possible. | 2016 * The function returns non-zero when conversion is not possible. |
2050 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 2017 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
2051 * It sets errno to ERANGE when the target datatype is too small. | 2018 * It sets errno to ERANGE when the target datatype is too small. |
2052 * | 2019 * |
2053 * The comma character is treated as group separator and ignored during parsing. | 2020 * The comma character is treated as group separator and ignored during parsing. |
2054 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 2021 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
2055 * | 2022 * |
2056 * @param str the string to convert | 2023 * @param str the string to convert |
2057 * @param output a pointer to the integer variable where the result shall be stored | 2024 * @param output a pointer to the integer variable where the result shall be stored |
2058 * @param base 2, 8, 10, or 16 | 2025 * @param base 2, 8, 10, or 16 |
2059 * @retval zero success | 2026 * @retval zero success |
2067 * The function returns non-zero when conversion is not possible. | 2034 * The function returns non-zero when conversion is not possible. |
2068 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | 2035 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
2069 * It sets errno to ERANGE when the target datatype is too small. | 2036 * It sets errno to ERANGE when the target datatype is too small. |
2070 * | 2037 * |
2071 * The comma character is treated as group separator and ignored during parsing. | 2038 * The comma character is treated as group separator and ignored during parsing. |
2072 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | 2039 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). |
2073 * | 2040 * |
2074 * @param str the string to convert | 2041 * @param str the string to convert |
2075 * @param output a pointer to the integer variable where the result shall be stored | 2042 * @param output a pointer to the integer variable where the result shall be stored |
2076 * @param base 2, 8, 10, or 16 | 2043 * @param base 2, 8, 10, or 16 |
2077 * @retval zero success | 2044 * @retval zero success |
2078 * @retval non-zero conversion was not possible | 2045 * @retval non-zero conversion was not possible |
2079 */ | 2046 */ |
2080 #define cx_strtou64(str, output, base) cx_strtou64_lc_(cx_strcast(str), output, base, ",") | 2047 #define cx_strtou64(str, output, base) cx_strtou64_lc_(cx_strcast(str), output, base, ",") |
2081 | |
2082 /** | |
2083 * Converts a string to a number. | |
2084 * | |
2085 * The function returns non-zero when conversion is not possible. | |
2086 * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
2087 * It sets errno to ERANGE when the target datatype is too small. | |
2088 * | |
2089 * The comma character is treated as group separator and ignored during parsing. | |
2090 * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtouz_lc()). | |
2091 * | |
2092 * @param str the string to convert | |
2093 * @param output a pointer to the integer variable where the result shall be stored | |
2094 * @param base 2, 8, 10, or 16 | |
2095 * @retval zero success | |
2096 * @retval non-zero conversion was not possible | |
2097 */ | |
2098 #define cx_strtouz(str, output, base) cx_strtouz_lc_(cx_strcast(str), output, base, ",") | |
2099 | 2048 |
2100 /** | 2049 /** |
2101 * Converts a string to a single precision floating point number. | 2050 * Converts a string to a single precision floating point number. |
2102 * | 2051 * |
2103 * The function returns non-zero when conversion is not possible. | 2052 * The function returns non-zero when conversion is not possible. |