Config-UCL
view release on metacpan or search on metacpan
libucl-0.8.1/doc/api.md view on Meta::CPAN
- `UCL_STRING_PARSE_DOUBLE` - parse passed string and detect integer or float number
- `UCL_STRING_PARSE_TIME` - parse time values as floating point numbers
- `UCL_STRING_PARSE_NUMBER` - parse passed string and detect number (both float, integer and time types)
- `UCL_STRING_PARSE` - parse passed string (and detect booleans, numbers and time values)
- `UCL_STRING_PARSE_BYTES` - assume that numeric multipliers are in bytes notation, for example `10k` means `10*1024` and not `10*1000` as assumed without this flag
If parsing operations fail then the resulting UCL object will be a `UCL_STRING`. A caller should always check the type of the returned object and release it after using.
# Iteration functions
Iteration are used to iterate over UCL compound types: arrays and objects. Moreover, iterations could be performed over the keys with multiple values (implicit arrays).
There are two types of iterators API: old and unsafe one via `ucl_iterate_object` and the proposed interface of safe iterators.
## ucl_iterate_object
~~~C
const ucl_object_t* ucl_iterate_object (const ucl_object_t *obj,
ucl_object_iter_t *iter, bool expand_values);
~~~
This function accepts opaque iterator pointer `iter`. In the first call this iterator *must* be initialized to `NULL`. Iterator is changed by this function call. `ucl_iterate_object` returns the next UCL object in the compound object `obj` or `NULL` ...
libucl-0.8.1/doc/libucl.3 view on Meta::CPAN
not \f[C]10*1000\f[] as assumed without this flag
.PP
If parsing operations fail then the resulting UCL object will be a
\f[C]UCL_STRING\f[].
A caller should always check the type of the returned object and release
it after using.
.SH ITERATION FUNCTIONS
.PP
Iteration are used to iterate over UCL compound types: arrays and
objects.
Moreover, iterations could be performed over the keys with multiple
values (implicit arrays).
There are two types of iterators API: old and unsafe one via
\f[C]ucl_iterate_object\f[] and the proposed interface of safe
iterators.
.SS ucl_iterate_object
.IP
.nf
\f[C]
const\ ucl_object_t*\ ucl_iterate_object\ (const\ ucl_object_t\ *obj,\
\ \ \ \ ucl_object_iter_t\ *iter,\ bool\ expand_values);
libucl-0.8.1/doc/lua_api.md view on Meta::CPAN
The module `ucl` defines the following functions.
### Function `ucl_object_push_lua(L, obj, allow_array)`
This is a `C` function to push `UCL` object as lua variable. This function
converts `obj` to lua representation using the following conversions:
- *scalar* values are directly presented by lua objects
- *userdata* values are converted to lua function objects using `LUA_REGISTRYINDEX`,
this can be used to pass functions from lua to c and vice-versa
- *arrays* are converted to lua tables with numeric indices suitable for `ipairs` iterations
- *objects* are converted to lua tables with string indices
**Parameters:**
- `L {lua_State}`: lua state pointer
- `obj {ucl_object_t}`: object to push
- `allow_array {bool}`: expand implicit arrays (should be true for all but partial arrays)
**Returns:**
libucl-0.8.1/lua/lua_ucl.c view on Meta::CPAN
}
/***
* @function ucl_object_push_lua(L, obj, allow_array)
* This is a `C` function to push `UCL` object as lua variable. This function
* converts `obj` to lua representation using the following conversions:
*
* - *scalar* values are directly presented by lua objects
* - *userdata* values are converted to lua function objects using `LUA_REGISTRYINDEX`,
* this can be used to pass functions from lua to c and vice-versa
* - *arrays* are converted to lua tables with numeric indicies suitable for `ipairs` iterations
* - *objects* are converted to lua tables with string indicies
* @param {lua_State} L lua state pointer
* @param {ucl_object_t} obj object to push
* @param {bool} allow_array expand implicit arrays (should be true for all but partial arrays)
* @return {int} `1` if an object is pushed to lua
*/
int
ucl_object_push_lua (lua_State *L, const ucl_object_t *obj, bool allow_array)
{
switch (obj->type) {
libucl-0.8.1/src/mum.h view on Meta::CPAN
result = _mum (result, _mum_block_start_prime);
while (len > _MUM_UNROLL_FACTOR * sizeof (uint64_t)) {
/* This loop could be vectorized when we have vector insns for
64x64->128-bit multiplication. AVX2 currently only have a
vector insn for 4 32x32->64-bit multiplication. */
for (i = 0; i < _MUM_UNROLL_FACTOR; i++)
result ^= _mum (_mum_le (((uint64_t *) str)[i]), _mum_primes[i]);
len -= _MUM_UNROLL_FACTOR * sizeof (uint64_t);
str += _MUM_UNROLL_FACTOR * sizeof (uint64_t);
/* We will use the same prime numbers on the next iterations --
randomize the state. */
result = _mum (result, _mum_unroll_prime);
}
n = len / sizeof (uint64_t);
for (i = 0; i < (int)n; i++)
result ^= _mum (_mum_le (((uint64_t *) str)[i]), _mum_primes[i]);
len -= n * sizeof (uint64_t); str += n * sizeof (uint64_t);
switch (len) {
case 7:
u64 = _mum_le32 (*(uint32_t *) str);
( run in 1.262 second using v1.01-cache-2.11-cpan-96521ef73a4 )