Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Macros | Functions

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_tafw_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_tafw_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...
 

Detailed Description

Adaptive Framework number support.

Macro Definition Documentation

◆ afw_number_parse_double

#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.

Parameters
cursoris pointer to char where number starts.
lenof buffer remaining starting at cursor.
dis NULL or pointer to place to return double.
pto use for wa.
xctxof caller.
Returns
len of number in buffer starting at buffer or or -1 if error.

Definition at line 131 of file afw_number.h.

◆ afw_number_parse_integer

#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.

Parameters
cursoris pointer to char where number starts.
lenof buffer remaining starting at cursor.
iis NULL or pointer to place to return integer.
pto use for wa.
xctxof caller.
Returns
len of number in buffer starting at buffer or or -1 if error.

Definition at line 118 of file afw_number.h.

Function Documentation

◆ afw_number_bytes_needed_integer()

afw_number_bytes_needed_integer ( afw_integer_t  i)

Determine bytes needed to hold printable afw_integer_t.

Parameters
ito check.
Returns
number of bytes needed.

Definition at line 437 of file afw_number.c.

◆ afw_number_bytes_needed_size_t()

int afw_number_bytes_needed_size_t ( afw_size_t  i)

Determine bytes needed to hold printable size_t.

Parameters
ito check.
Returns
number of bytes needed.

Definition at line 425 of file afw_number.c.

◆ afw_number_double_to_utf8()

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.

Parameters
dis double to convert.
pto use for result.
xctxof caller.
Returns
utf8 representation of double.

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_number_integer_set_u8()

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.

Parameters
iis integer to convert.
sis address of place to put result.
lenof place to put result.
pto use for result.
xctxof caller.
Returns
len used.

Definition at line 187 of file afw_number.c.

◆ afw_number_integer_to_utf8()

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.

Parameters
iis integer to convert.
pto use for result.
xctxof caller.
Returns
utf8 representation of integer.

Definition at line 168 of file afw_number.c.

◆ afw_number_is_finite()

afw_boolean_t afw_number_is_finite ( double  d)

Determine if double is finite.

Parameters
dis double to check.
Returns
true if number is finite.

Definition at line 45 of file afw_number.h.

◆ afw_number_is_NaN()

afw_boolean_t afw_number_is_NaN ( double  d)

Determine if double is not a number.

Parameters
dis double to check.
Returns
true if number is not a number (NaN).

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_number_is_negative_infinity()

afw_boolean_t afw_number_is_negative_infinity ( double  d)

Determine if double is negative infinity.

Parameters
dis double to check.
Returns
true if number is negative infinity.

Definition at line 69 of file afw_number.h.

◆ afw_number_is_positive_infinity()

afw_boolean_t afw_number_is_positive_infinity ( double  d)

Determine if double is positive infinity.

Parameters
dis double to check.
Returns
true if number is positive infinity.

Definition at line 57 of file afw_number.h.

◆ afw_number_parse()

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.

Parameters
cursoris pointer to char where number starts.
lenof buffer remaining starting at cursor.
iis NULL or pointer to place to return integer.
dis NULL or pointer to place to return double.
is_doubleis NULL or pointer to place to set to true if number is a double.
pto use for wa.
xctxof caller.
Returns
len of number in buffer starting at buffer or or -1 if error.

Definition at line 203 of file afw_number.c.

◆ afw_number_utf8_to_double()

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.

Parameters
sis utf8 sting to convert.
pto use for result.
xctxof caller.
Returns
double in internal representation.

Definition at line 169 of file afw_number.h.

◆ afw_number_utf8_to_integer()

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.

Parameters
sis utf8 sting to convert.
pto use for result.
xctxof caller.
Returns
integer in internal representation.

Definition at line 221 of file afw_number.h.