Adaptive Framework
0.9.0
|
Files | |
file | afw_number.h |
Adaptive Framework Number Header. | |
Macros | |
#define | AFW_NUMBER_Q_INF "INF" |
#define | AFW_NUMBER_Q_INFINITY "Infinity" |
#define | AFW_NUMBER_Q_NEGATIVE_INF "-INF" |
#define | AFW_NUMBER_Q_NEGATIVE_INFINITY "-Infinity" |
#define | AFW_NUMBER_Q_NAN "NaN" |
#define | AFW_NUMBER_Q_NEGATIVE_NAN "-NaN" |
#define | AFW_NUMBER_Q_EXPONENT_ZERO "E0" |
#define | afw_number_parse_integer(cursor, len, i, p, xctx) afw_number_parse(cursor, len, i, NULL, NULL, p, xctx) |
Parse an integer using specified pool for work area. More... | |
#define | afw_number_parse_double(cursor, len, d, p, xctx) afw_number_parse(cursor, len, NULL, d, NULL, p, xctx) |
Parse a double using specified pool for work area. More... | |
Functions | |
afw_boolean_t | afw_number_is_finite (double d) |
Determine if double is finite. More... | |
afw_boolean_t | afw_number_is_positive_infinity (double d) |
Determine if double is positive infinity. More... | |
afw_boolean_t | afw_number_is_negative_infinity (double d) |
Determine if double is negative infinity. More... | |
afw_boolean_t | afw_number_is_NaN (double d) |
Determine if double is not a number. More... | |
afw_size_t | afw_number_parse (const afw_utf8_octet_t *cursor, afw_size_t len, afw_integer_t *i, afw_double_t *d, afw_boolean_t *is_double, const afw_pool_t *p, afw_xctx_t *xctx) |
Parse an integer or double using specified pool for work area. More... | |
const afw_utf8_t * | afw_number_double_to_utf8 (afw_double_t d, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert a double to utf8 in specified pool. More... | |
afw_double_t | afw_number_utf8_to_double (const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert a utf8 string to double in specified pool. More... | |
const afw_utf8_t * | afw_number_integer_to_utf8 (afw_integer_t i, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert an integer to utf8 in specified pool. More... | |
afw_size_t | afw_number_integer_set_u8 (afw_integer_t i, afw_utf8_octet_t *s, afw_size_t len, afw_xctx_t *xctx) |
Convert an integer to u8 in supplied buffer. More... | |
afw_integer_t | afw_number_utf8_to_integer (const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert a utf8 string to integer in specified pool. More... | |
int | afw_number_bytes_needed_size_t (afw_size_t i) |
Determine bytes needed to hold printable size_t. More... | |
afw_number_bytes_needed_integer (afw_integer_t i) | |
Determine bytes needed to hold printable afw_integer_t. More... | |
Adaptive Framework number support.
#define afw_number_parse_double | ( | cursor, | |
len, | |||
d, | |||
p, | |||
xctx | |||
) | afw_number_parse(cursor, len, NULL, d, NULL, p, xctx) |
Parse a double using specified pool for work area.
cursor | is pointer to char where number starts. |
len | of buffer remaining starting at cursor. |
d | is NULL or pointer to place to return double. |
p | to use for wa. |
xctx | of caller. |
Definition at line 131 of file afw_number.h.
#define afw_number_parse_integer | ( | cursor, | |
len, | |||
i, | |||
p, | |||
xctx | |||
) | afw_number_parse(cursor, len, i, NULL, NULL, p, xctx) |
Parse an integer using specified pool for work area.
cursor | is pointer to char where number starts. |
len | of buffer remaining starting at cursor. |
i | is NULL or pointer to place to return integer. |
p | to use for wa. |
xctx | of caller. |
Definition at line 118 of file afw_number.h.
afw_number_bytes_needed_integer | ( | afw_integer_t | i | ) |
Determine bytes needed to hold printable afw_integer_t.
i | to check. |
Definition at line 437 of file afw_number.c.
int afw_number_bytes_needed_size_t | ( | afw_size_t | i | ) |
Determine bytes needed to hold printable size_t.
i | to check. |
Definition at line 425 of file afw_number.c.
const afw_utf8_t* afw_number_double_to_utf8 | ( | afw_double_t | d, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert a double to utf8 in specified pool.
d | is double to convert. |
p | to use for result. |
xctx | of caller. |
The canonical representation for float is defined by prohibiting certain options from the Lexical representation (�3.2.4.1). Specifically, the exponent must be indicated by "E". Leading zeroes and the preceding optional "+" sign are prohibited in the exponent. If the exponent is zero, it must be indicated by "E0". For the mantissa, the preceding optional "+" sign is prohibited and the decimal point is required. Leading and trailing zeroes are prohibited subject to the following: number representations must be normalized such that there is a single digit which is non-zero to the left of the decimal point and at least a single digit to the right of the decimal point unless the value being represented is zero. The canonical representation for zero is 0.0E0.
Definition at line 19 of file afw_number.c.
afw_size_t afw_number_integer_set_u8 | ( | afw_integer_t | i, |
afw_utf8_octet_t * | s, | ||
afw_size_t | len, | ||
afw_xctx_t * | xctx | ||
) |
Convert an integer to u8 in supplied buffer.
i | is integer to convert. |
s | is address of place to put result. |
len | of place to put result. |
p | to use for result. |
xctx | of caller. |
Definition at line 187 of file afw_number.c.
const afw_utf8_t* afw_number_integer_to_utf8 | ( | afw_integer_t | i, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert an integer to utf8 in specified pool.
i | is integer to convert. |
p | to use for result. |
xctx | of caller. |
Definition at line 168 of file afw_number.c.
afw_boolean_t afw_number_is_finite | ( | double | d | ) |
Determine if double is finite.
d | is double to check. |
Definition at line 45 of file afw_number.h.
afw_boolean_t afw_number_is_NaN | ( | double | d | ) |
Determine if double is not a number.
d | is double to check. |
If a number is not a number (NaN) the number compared to itself will not be true.
Definition at line 84 of file afw_number.h.
afw_boolean_t afw_number_is_negative_infinity | ( | double | d | ) |
Determine if double is negative infinity.
d | is double to check. |
Definition at line 69 of file afw_number.h.
afw_boolean_t afw_number_is_positive_infinity | ( | double | d | ) |
Determine if double is positive infinity.
d | is double to check. |
Definition at line 57 of file afw_number.h.
afw_size_t afw_number_parse | ( | const afw_utf8_octet_t * | cursor, |
afw_size_t | len, | ||
afw_integer_t * | i, | ||
afw_double_t * | d, | ||
afw_boolean_t * | is_double, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Parse an integer or double using specified pool for work area.
cursor | is pointer to char where number starts. |
len | of buffer remaining starting at cursor. |
i | is NULL or pointer to place to return integer. |
d | is NULL or pointer to place to return double. |
is_double | is NULL or pointer to place to set to true if number is a double. |
p | to use for wa. |
xctx | of caller. |
Definition at line 203 of file afw_number.c.
afw_double_t afw_number_utf8_to_double | ( | const afw_utf8_t * | s, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert a utf8 string to double in specified pool.
s | is utf8 sting to convert. |
p | to use for result. |
xctx | of caller. |
Definition at line 169 of file afw_number.h.
afw_integer_t afw_number_utf8_to_integer | ( | const afw_utf8_t * | s, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert a utf8 string to integer in specified pool.
s | is utf8 sting to convert. |
p | to use for result. |
xctx | of caller. |
Definition at line 221 of file afw_number.h.