view release on metacpan or search on metacpan
libucl-0.8.1/ChangeLog.md view on Meta::CPAN
- C++ wrapper: add convenience method at() and lookup() (by Yonghee Kim)
- C++ wrapper: add assignment operator to Ucl class (by Yonghee Kim)
- C++ wrapper: support variables in parser (by Yonghee Kim)
- C++ wrapper: refactoring C++ interface (by Yonghee Kim):
- use auto variables (if possible)
- remove dangling expressions
- use std::set::emplace instead of std::set::insert
- not use std::move in return statement; considering copy elision
- C++ wrapper: fix compilation error and warnings (by Zhe Wang)
- C++ wrapper: fix iteration over objects in which the first value is `false` (by Zhe Wang)
- C++ wrapper: Macro helper functions (by Chris Meacham)
- C++ wrapper: Changing the duplicate strategy in the C++ API (by Chris Meacham)
- C++ wrapper: Added access functions for the size of a UCL_ARRAY (by Chris Meacham)
- Fix caseless comparison
- Fix include when EPERM is issued
- Fix Windows build
- Allow to reserve space in arrays and hashes
- Fix bug with including of empty files
- Move to mum_hash from xxhash
- Fix msgpack on non-x86
- python: Add support to Python 3 (by Denis Volpato Martins)
libucl-0.8.1/README.md view on Meta::CPAN
- [Introduction](#introduction)
- [Basic structure](#basic-structure)
- [Improvements to the json notation](#improvements-to-the-json-notation)
- [General syntax sugar](#general-syntax-sugar)
- [Automatic arrays creation](#automatic-arrays-creation)
- [Named keys hierarchy](#named-keys-hierarchy)
- [Convenient numbers and booleans](#convenient-numbers-and-booleans)
- [General improvements](#general-improvements)
- [Comments](#comments)
- [Macros support](#macros-support)
- [Variables support](#variables-support)
- [Multiline strings](#multiline-strings)
- [Emitter](#emitter)
- [Validation](#validation)
- [Performance](#performance)
- [Conclusion](#conclusion)
## Introduction
This document describes the main features and principles of the configuration
libucl-0.8.1/README.md view on Meta::CPAN
Multiline comments may be nested:
```c
# Sample single line comment
/*
some comment
/* nested comment */
end of comment
*/
```
### Macros support
UCL supports external macros both multiline and single line ones:
```nginx
.macro_name "sometext";
.macro_name {
Some long text
....
};
```
libucl-0.8.1/README.md view on Meta::CPAN
ucl: emitted json in 0.1174 seconds
ucl: emitted compact json in 0.0991 seconds
ucl: emitted yaml in 0.1354 seconds
```
You can do your own benchmarks by running `make check` in libucl top directory.
## Conclusion
UCL has clear design that should be very convenient for reading and writing. At the same time it is compatible with
JSON language and therefore can be used as a simple JSON parser. Macro logic provides an ability to extend configuration
language (for example by including some lua code) and comments allow to disable or enable the parts of a configuration
quickly.
libucl-0.8.1/doc/api.md view on Meta::CPAN
- `UCL_PARSER_ZEROCOPY` - try to use zero-copy mode when reading files (in zero-copy mode text chunk being parsed without copying strings so it should exist till any object parsed is used)
- `UCL_PARSER_NO_TIME` - treat time values as strings without parsing them as floats
### ucl_parser_register_macro
~~~C
void ucl_parser_register_macro (struct ucl_parser *parser,
const char *macro, ucl_macro_handler handler, void* ud);
~~~
Register new macro with name .`macro` parsed by handler `handler` that accepts opaque data pointer `ud`. Macro handler should be of the following type:
~~~C
bool (*ucl_macro_handler) (const unsigned char *data,
size_t len, void* ud);`
~~~
Handler function accepts macro text `data` of length `len` and the opaque pointer `ud`. If macro is parsed successfully the handler should return `true`. `false` indicates parsing failure and the parser can be terminated.
### ucl_parser_register_variable
libucl-0.8.1/doc/libucl.3 view on Meta::CPAN
.IP
.nf
\f[C]
void\ ucl_parser_register_macro\ (struct\ ucl_parser\ *parser,
\ \ \ \ const\ char\ *macro,\ ucl_macro_handler\ handler,\ void*\ ud);
\f[]
.fi
.PP
Register new macro with name .\f[C]macro\f[] parsed by handler
\f[C]handler\f[] that accepts opaque data pointer \f[C]ud\f[].
Macro handler should be of the following type:
.IP
.nf
\f[C]
bool\ (*ucl_macro_handler)\ (const\ unsigned\ char\ *data,
\ \ \ \ size_t\ len,\ void*\ ud);`
\f[]
.fi
.PP
Handler function accepts macro text \f[C]data\f[] of length \f[C]len\f[]
and the opaque pointer \f[C]ud\f[].
libucl-0.8.1/include/ucl.h view on Meta::CPAN
/**
* @defgroup parser Parsing functions
* These functions are used to parse UCL objects
*
* @{
*/
/**
* Macro handler for a parser
* @param data the content of macro
* @param len the length of content
* @param arguments arguments object
* @param ud opaque user data
* @param err error pointer
* @return true if macro has been parsed
*/
typedef bool (*ucl_macro_handler) (const unsigned char *data, size_t len,
const ucl_object_t *arguments,
void* ud);
libucl-0.8.1/m4/ax_lua.m4 view on Meta::CPAN
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 39
dnl =========================================================================
dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION],
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl =========================================================================
AC_DEFUN([AX_PROG_LUA],
[
libucl-0.8.1/python/src/uclmodule.c view on Meta::CPAN
static PyMethodDef uclMethods[] = {
{"load", ucl_load, METH_VARARGS, "Load UCL from stream"},
{"dump", ucl_dump, METH_VARARGS, "Dump UCL to stream"},
{"validate", ucl_validate, METH_VARARGS, "Validate ucl stream against schema"},
{NULL, NULL, 0, NULL}
};
static void
init_macros(PyObject *mod)
{
PyModule_AddIntMacro(mod, UCL_EMIT_JSON);
PyModule_AddIntMacro(mod, UCL_EMIT_JSON_COMPACT);
PyModule_AddIntMacro(mod, UCL_EMIT_CONFIG);
PyModule_AddIntMacro(mod, UCL_EMIT_YAML);
PyModule_AddIntMacro(mod, UCL_EMIT_MSGPACK);
SchemaError = PyErr_NewException("ucl.SchemaError", NULL, NULL);
Py_INCREF(SchemaError);
PyModule_AddObject(mod, "SchemaError", SchemaError);
}
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef uclmodule = {
PyModuleDef_HEAD_INIT,
"ucl",
libucl-0.8.1/src/mum.h view on Meta::CPAN
#include <limits.h>
#ifdef _MSC_VER
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
/* Macro saying to use 128-bit integers implemented by GCC for some
targets. */
#ifndef _MUM_USE_INT128
/* In GCC uint128_t is defined if HOST_BITS_PER_WIDE_INT >= 64.
HOST_WIDE_INT is long if HOST_BITS_PER_LONG > HOST_BITS_PER_INT,
otherwise int. */
#if defined(__GNUC__) && UINT_MAX != ULONG_MAX
#define _MUM_USE_INT128 1
#else
#define _MUM_USE_INT128 0
#endif
libucl-0.8.1/src/mum.h view on Meta::CPAN
_mum_le32 (uint32_t v) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || !defined(MUM_TARGET_INDEPENDENT_HASH)
return v;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
return _mum_bswap32 (v);
#else
#error "Unknown endianness"
#endif
}
/* Macro defining how many times the most nested loop in
_mum_hash_aligned will be unrolled by the compiler (although it can
make an own decision:). Use only a constant here to help a
compiler to unroll a major loop.
The macro value affects the result hash for strings > 128 bit. The
unroll factor greatly affects the hashing speed. We prefer the
speed. */
#ifndef _MUM_UNROLL_FACTOR_POWER
#if defined(__PPC64__) && !defined(MUM_TARGET_INDEPENDENT_HASH)
#define _MUM_UNROLL_FACTOR_POWER 3
libucl-0.8.1/src/ucl_parser.c view on Meta::CPAN
if (*p == '}') {
break;
}
ucl_chunk_skipc (chunk, p);
}
*macro_start = c;
*macro_len = p - c;
ucl_chunk_skipc (chunk, p);
break;
default:
/* Macro is not enclosed in quotes or braces */
c = p;
while (p < chunk->end) {
if (ucl_lex_is_atom_end (*p)) {
break;
}
ucl_chunk_skipc (chunk, p);
}
*macro_start = c;
*macro_len = p - c;
break;