]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb/src/third_party/duktape-1.5.2/src-separate/duk_numconv.h
1 #ifndef DUK_NUMCONV_H_INCLUDED
2 #define DUK_NUMCONV_H_INCLUDED
5 * Number-to-string conversion. The semantics of these is very tightly
6 * bound with the Ecmascript semantics required for call sites.
9 /* Output a specified number of digits instead of using the shortest
10 * form. Used for toPrecision() and toFixed().
12 #define DUK_N2S_FLAG_FIXED_FORMAT (1 << 0)
14 /* Force exponential format. Used for toExponential(). */
15 #define DUK_N2S_FLAG_FORCE_EXP (1 << 1)
17 /* If number would need zero padding (for whole number part), use
18 * exponential format instead. E.g. if input number is 12300, 3
19 * digits are generated ("123"), output "1.23e+4" instead of "12300".
20 * Used for toPrecision().
22 #define DUK_N2S_FLAG_NO_ZERO_PAD (1 << 2)
24 /* Digit count indicates number of fractions (i.e. an absolute
25 * digit index instead of a relative one). Used together with
26 * DUK_N2S_FLAG_FIXED_FORMAT for toFixed().
28 #define DUK_N2S_FLAG_FRACTION_DIGITS (1 << 3)
31 * String-to-number conversion
34 /* Maximum exponent value when parsing numbers. This is not strictly
35 * compliant as there should be no upper limit, but as we parse the
36 * exponent without a bigint, impose some limit.
38 #define DUK_S2N_MAX_EXPONENT 1000000000
40 /* Trim white space (= allow leading and trailing whitespace) */
41 #define DUK_S2N_FLAG_TRIM_WHITE (1 << 0)
44 #define DUK_S2N_FLAG_ALLOW_EXP (1 << 1)
46 /* Allow trailing garbage (e.g. treat "123foo" as "123) */
47 #define DUK_S2N_FLAG_ALLOW_GARBAGE (1 << 2)
49 /* Allow leading plus sign */
50 #define DUK_S2N_FLAG_ALLOW_PLUS (1 << 3)
52 /* Allow leading minus sign */
53 #define DUK_S2N_FLAG_ALLOW_MINUS (1 << 4)
55 /* Allow 'Infinity' */
56 #define DUK_S2N_FLAG_ALLOW_INF (1 << 5)
58 /* Allow fraction part */
59 #define DUK_S2N_FLAG_ALLOW_FRAC (1 << 6)
61 /* Allow naked fraction (e.g. ".123") */
62 #define DUK_S2N_FLAG_ALLOW_NAKED_FRAC (1 << 7)
64 /* Allow empty fraction (e.g. "123.") */
65 #define DUK_S2N_FLAG_ALLOW_EMPTY_FRAC (1 << 8)
67 /* Allow empty string to be interpreted as 0 */
68 #define DUK_S2N_FLAG_ALLOW_EMPTY_AS_ZERO (1 << 9)
70 /* Allow leading zeroes (e.g. "0123" -> "123") */
71 #define DUK_S2N_FLAG_ALLOW_LEADING_ZERO (1 << 10)
73 /* Allow automatic detection of hex base ("0x" or "0X" prefix),
74 * overrides radix argument and forces integer mode.
76 #define DUK_S2N_FLAG_ALLOW_AUTO_HEX_INT (1 << 11)
78 /* Allow automatic detection of octal base, overrides radix
79 * argument and forces integer mode.
81 #define DUK_S2N_FLAG_ALLOW_AUTO_OCT_INT (1 << 12)
87 DUK_INTERNAL_DECL
void duk_numconv_stringify(duk_context
*ctx
, duk_small_int_t radix
, duk_small_int_t digits
, duk_small_uint_t flags
);
88 DUK_INTERNAL_DECL
void duk_numconv_parse(duk_context
*ctx
, duk_small_int_t radix
, duk_small_uint_t flags
);
90 #endif /* DUK_NUMCONV_H_INCLUDED */