svn commit: r268897 - in stable/9: contrib/libucl contrib/libucl/cmake contrib/libucl/doc contrib/libucl/include contrib/libucl/src contrib/libucl/tests contrib/libucl/tests/basic contrib/libucl/te...

Baptiste Daroussin bapt at FreeBSD.org
Sat Jul 19 23:57:38 UTC 2014


Author: bapt
Date: Sat Jul 19 23:57:36 2014
New Revision: 268897
URL: http://svnweb.freebsd.org/changeset/base/268897

Log:
  MFC: r263648, r264789, r266636
  
  This brings:
  - schema validation
  - xpath-like interface for ucl objects
  
  Adapt pkg(7) to the new libucl API

Added:
  stable/9/contrib/libucl/Makefile.am
     - copied unchanged from r263648, head/contrib/libucl/Makefile.am
  stable/9/contrib/libucl/autogen.sh
     - copied unchanged from r263648, head/contrib/libucl/autogen.sh
  stable/9/contrib/libucl/cmake/
     - copied from r263648, head/contrib/libucl/cmake/
  stable/9/contrib/libucl/configure.ac
     - copied, changed from r263648, head/contrib/libucl/configure.ac
  stable/9/contrib/libucl/doc/Makefile.am
     - copied unchanged from r263648, head/contrib/libucl/doc/Makefile.am
  stable/9/contrib/libucl/doc/libucl.3
     - copied, changed from r263648, head/contrib/libucl/doc/libucl.3
  stable/9/contrib/libucl/doc/pandoc.template
     - copied unchanged from r263648, head/contrib/libucl/doc/pandoc.template
  stable/9/contrib/libucl/libucl.pc.in
     - copied unchanged from r263648, head/contrib/libucl/libucl.pc.in
  stable/9/contrib/libucl/src/Makefile.am
     - copied, changed from r263648, head/contrib/libucl/src/Makefile.am
  stable/9/contrib/libucl/src/tree.h
     - copied unchanged from r263648, head/contrib/libucl/src/tree.h
  stable/9/contrib/libucl/src/ucl_schema.c
     - copied, changed from r263648, head/contrib/libucl/src/ucl_schema.c
  stable/9/contrib/libucl/stamp-h.in
     - copied unchanged from r263648, head/contrib/libucl/stamp-h.in
  stable/9/contrib/libucl/tests/.gitignore
     - copied unchanged from r263648, head/contrib/libucl/tests/.gitignore
  stable/9/contrib/libucl/tests/Makefile.am
     - copied unchanged from r263648, head/contrib/libucl/tests/Makefile.am
  stable/9/contrib/libucl/tests/basic/
     - copied from r263648, head/contrib/libucl/tests/basic/
  stable/9/contrib/libucl/tests/basic.test
     - copied unchanged from r263648, head/contrib/libucl/tests/basic.test
  stable/9/contrib/libucl/tests/generate.test
     - copied unchanged from r263648, head/contrib/libucl/tests/generate.test
  stable/9/contrib/libucl/tests/schema/
     - copied from r263648, head/contrib/libucl/tests/schema/
  stable/9/contrib/libucl/tests/schema.test
     - copied unchanged from r263648, head/contrib/libucl/tests/schema.test
  stable/9/contrib/libucl/tests/speed.test
     - copied unchanged from r263648, head/contrib/libucl/tests/speed.test
  stable/9/contrib/libucl/tests/test_schema.c
     - copied, changed from r263648, head/contrib/libucl/tests/test_schema.c
  stable/9/contrib/libucl/utils/Makefile.am
     - copied unchanged from r263648, head/contrib/libucl/utils/Makefile.am
Deleted:
  stable/9/contrib/libucl/.gitignore
  stable/9/contrib/libucl/tests/1.in
  stable/9/contrib/libucl/tests/1.res
  stable/9/contrib/libucl/tests/10.in
  stable/9/contrib/libucl/tests/2.in
  stable/9/contrib/libucl/tests/2.res
  stable/9/contrib/libucl/tests/3.in
  stable/9/contrib/libucl/tests/3.res
  stable/9/contrib/libucl/tests/4.in
  stable/9/contrib/libucl/tests/4.res
  stable/9/contrib/libucl/tests/5.in
  stable/9/contrib/libucl/tests/5.res
  stable/9/contrib/libucl/tests/6.in
  stable/9/contrib/libucl/tests/6.res
  stable/9/contrib/libucl/tests/7.in
  stable/9/contrib/libucl/tests/7.res
  stable/9/contrib/libucl/tests/8.in
  stable/9/contrib/libucl/tests/8.res
  stable/9/contrib/libucl/tests/9-comment.inc
  stable/9/contrib/libucl/tests/9-empty.inc
  stable/9/contrib/libucl/tests/9.in
  stable/9/contrib/libucl/tests/9.inc
  stable/9/contrib/libucl/tests/9.res
Modified:
  stable/9/contrib/libucl/Makefile.unix
  stable/9/contrib/libucl/Makefile.w32
  stable/9/contrib/libucl/README.md
  stable/9/contrib/libucl/doc/api.md
  stable/9/contrib/libucl/include/ucl.h
  stable/9/contrib/libucl/src/ucl_emitter.c
  stable/9/contrib/libucl/src/ucl_hash.c
  stable/9/contrib/libucl/src/ucl_hash.h
  stable/9/contrib/libucl/src/ucl_internal.h
  stable/9/contrib/libucl/src/ucl_parser.c
  stable/9/contrib/libucl/src/ucl_util.c
  stable/9/contrib/libucl/tests/run_tests.sh
  stable/9/contrib/libucl/tests/test_basic.c
  stable/9/contrib/libucl/tests/test_generate.c
  stable/9/contrib/libucl/tests/test_speed.c
  stable/9/contrib/libucl/utils/objdump.c
  stable/9/lib/libucl/Makefile
  stable/9/usr.sbin/pkg/config.c
  stable/9/usr.sbin/pkg/pkg.c
Directory Properties:
  stable/9/contrib/libucl/   (props changed)
  stable/9/lib/libucl/   (props changed)
  stable/9/usr.sbin/pkg/   (props changed)

Copied: stable/9/contrib/libucl/Makefile.am (from r263648, head/contrib/libucl/Makefile.am)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/contrib/libucl/Makefile.am	Sat Jul 19 23:57:36 2014	(r268897, copy of r263648, head/contrib/libucl/Makefile.am)
@@ -0,0 +1,7 @@
+ACLOCAL_AMFLAGS = -I m4
+EXTRA_DIST = uthash README.md
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libucl.pc
+
+SUBDIRS = src tests utils doc
\ No newline at end of file

Modified: stable/9/contrib/libucl/Makefile.unix
==============================================================================
--- stable/9/contrib/libucl/Makefile.unix	Sat Jul 19 23:44:57 2014	(r268896)
+++ stable/9/contrib/libucl/Makefile.unix	Sat Jul 19 23:57:36 2014	(r268897)
@@ -4,7 +4,7 @@ LD ?= gcc
 C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-pointer-sign -I./include -I./uthash -I./src
 MAJOR_VERSION = 0
 MINOR_VERSION = 2
-PATCH_VERSION = 8
+PATCH_VERSION = 9
 VERSION = "$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)"
 SONAME = libucl.so
 SONAME_FULL = $(SONAME).$(MAJOR_VERSION)
@@ -21,8 +21,17 @@ LD_SHARED_FLAGS ?= -Wl,-soname,$(SONAME)
 LD_UCL_FLAGS ?= -L$(OBJDIR) -Wl,-rpath,$(OBJDIR) -lucl
 LD_ADD ?= -lrt
 COPT_FLAGS ?= -O2
-HDEPS = $(SRCDIR)/ucl_hash.h $(SRCDIR)/ucl_chartable.h $(SRCDIR)/ucl_internal.h $(INCLUDEDIR)/ucl.h $(SRCDIR)/xxhash.h
-OBJECTS = $(OBJDIR)/ucl_hash.o $(OBJDIR)/ucl_util.o $(OBJDIR)/ucl_parser.o $(OBJDIR)/ucl_emitter.o $(OBJDIR)/xxhash.o
+HDEPS = $(SRCDIR)/ucl_hash.h \
+		$(SRCDIR)/ucl_chartable.h \
+		$(SRCDIR)/ucl_internal.h \
+		$(INCLUDEDIR)/ucl.h \
+		$(SRCDIR)/xxhash.h
+OBJECTS = $(OBJDIR)/ucl_hash.o \
+		$(OBJDIR)/ucl_util.o \
+		$(OBJDIR)/ucl_parser.o \
+		$(OBJDIR)/ucl_emitter.o \
+		$(OBJDIR)/ucl_schema.o \
+		$(OBJDIR)/xxhash.o
 
 all: $(OBJDIR) $(OBJDIR)/$(SONAME)
 
@@ -44,11 +53,13 @@ $(OBJDIR)/ucl_emitter.o: $(SRCDIR)/ucl_e
 	$(CC) -o $(OBJDIR)/ucl_emitter.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_emitter.c
 $(OBJDIR)/ucl_hash.o: $(SRCDIR)/ucl_hash.c $(HDEPS)
 	$(CC) -o $(OBJDIR)/ucl_hash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_hash.c
+$(OBJDIR)/ucl_schema.o: $(SRCDIR)/ucl_schema.c $(HDEPS)
+	$(CC) -o $(OBJDIR)/ucl_schema.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_schema.c
 $(OBJDIR)/xxhash.o: $(SRCDIR)/xxhash.c $(HDEPS)
 	$(CC) -o $(OBJDIR)/xxhash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/xxhash.c
 
 clean:
-	$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(SONAME_FULL) $(OBJDIR)/$(SONAME) $(OBJDIR)/chargen $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/objdump $(OBJDIR)/test_generate
+	$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(SONAME_FULL) $(OBJDIR)/$(SONAME) $(OBJDIR)/chargen $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/objdump $(OBJDIR)/test_generate $(OBJDIR)/test_schema || true
 	$(RMDIR) $(OBJDIR)
 	
 # Utils
@@ -60,13 +71,15 @@ objdump: utils/objdump.c $(OBJDIR)/$(SON
 
 # Tests
 
-test: $(OBJDIR) $(OBJDIR)/$(SONAME) $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate
+test: $(OBJDIR) $(OBJDIR)/$(SONAME) $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate $(OBJDIR)/test_schema
 
 run-test: test
-	TEST_DIR=$(TESTDIR) $(TESTDIR)/run_tests.sh $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate
+	TEST_DIR=$(TESTDIR) $(TESTDIR)/run_tests.sh $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate $(OBJDIR)/test_schema
 	
 $(OBJDIR)/test_basic: $(TESTDIR)/test_basic.c $(OBJDIR)/$(SONAME)
 	$(CC) -o $(OBJDIR)/test_basic $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_basic.c $(LD_UCL_FLAGS)
+$(OBJDIR)/test_schema: $(TESTDIR)/test_schema.c $(OBJDIR)/$(SONAME)
+	$(CC) -o $(OBJDIR)/test_schema $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_schema.c $(LD_UCL_FLAGS)
 $(OBJDIR)/test_speed: $(TESTDIR)/test_speed.c $(OBJDIR)/$(SONAME)
 	$(CC) -o $(OBJDIR)/test_speed $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_speed.c $(LD_UCL_FLAGS) $(LD_ADD)
 $(OBJDIR)/test_generate: $(TESTDIR)/test_generate.c $(OBJDIR)/$(SONAME)

Modified: stable/9/contrib/libucl/Makefile.w32
==============================================================================
--- stable/9/contrib/libucl/Makefile.w32	Sat Jul 19 23:44:57 2014	(r268896)
+++ stable/9/contrib/libucl/Makefile.w32	Sat Jul 19 23:57:36 2014	(r268897)
@@ -4,7 +4,7 @@ LD ?= gcc
 C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-pointer-sign -I./include -I./uthash -I./src
 MAJOR_VERSION = 0
 MINOR_VERSION = 2
-PATCH_VERSION = 8
+PATCH_VERSION = 9
 VERSION = "$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)"
 SONAME = libucl.dll
 OBJDIR ?= .obj
@@ -24,8 +24,17 @@ LD_SHARED_FLAGS ?= -Wl,-soname,$(SONAME)
 LD_UCL_FLAGS ?= -L$(OBJDIR) -Wl,-rpath,$(OBJDIR) -lucl
 LD_ADD ?= -lrt
 COPT_FLAGS ?= -O2
-HDEPS = $(SRCDIR)/ucl_hash.h $(SRCDIR)/ucl_chartable.h $(SRCDIR)/ucl_internal.h $(INCLUDEDIR)/ucl.h $(SRCDIR)/xxhash.h
-OBJECTS = $(OBJDIR)/ucl_hash.o $(OBJDIR)/ucl_util.o $(OBJDIR)/ucl_parser.o $(OBJDIR)/ucl_emitter.o $(OBJDIR)/xxhash.o
+HDEPS = $(SRCDIR)/ucl_hash.h \
+		$(SRCDIR)/ucl_chartable.h \
+		$(SRCDIR)/ucl_internal.h \
+		$(INCLUDEDIR)/ucl.h \
+		$(SRCDIR)/xxhash.h
+OBJECTS = $(OBJDIR)/ucl_hash.o \
+		$(OBJDIR)/ucl_util.o \
+		$(OBJDIR)/ucl_parser.o \
+		$(OBJDIR)/ucl_emitter.o \
+		$(OBJDIR)/ucl_schema.o \
+		$(OBJDIR)/xxhash.o
 
 all: $(OBJDIR) $(OBJDIR)/$(SONAME)
 
@@ -44,6 +53,8 @@ $(OBJDIR)/ucl_emitter.o: $(SRCDIR)/ucl_e
 	$(CC) -o $(OBJDIR)/ucl_emitter.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_emitter.c
 $(OBJDIR)/ucl_hash.o: $(SRCDIR)/ucl_hash.c $(HDEPS)
 	$(CC) -o $(OBJDIR)/ucl_hash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_hash.c
+$(OBJDIR)/ucl_schema.o: $(SRCDIR)/ucl_schema.c $(HDEPS)
+	$(CC) -o $(OBJDIR)/ucl_schema.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_schema.c
 $(OBJDIR)/xxhash.o: $(SRCDIR)/xxhash.c $(HDEPS)
 	$(CC) -o $(OBJDIR)/xxhash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/xxhash.c
 

Modified: stable/9/contrib/libucl/README.md
==============================================================================
--- stable/9/contrib/libucl/README.md	Sat Jul 19 23:44:57 2014	(r268896)
+++ stable/9/contrib/libucl/README.md	Sat Jul 19 23:57:36 2014	(r268897)
@@ -1,3 +1,26 @@
+# LIBUCL
+
+[![Build Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl)
+
+**Table of Contents**  *generated with [DocToc](http://doctoc.herokuapp.com/)*
+
+- [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)
+	- [Commments](#commments)
+	- [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
@@ -262,6 +285,10 @@ Each UCL object can be serialized to one
 * `Configuration` - nginx like notation;
 * `YAML` - yaml inlined notation.
 
+## Validation
+
+UCL allows validation of objects. It uses the same schema that is used for json: [json schema v4](http://json-schema.org). UCL supports the full set of json schema with the exception of remote references. This feature is unlikely useful for configuration objects. Of course, a schema definition can be in UCL format instead of JSON that simplifies schemas writing. Moreover, since UCL supports multiple values for keys in an object it is possible to specify generic integer constraints `maxValues` and `minValues` to define the limits of values count in a single key. UCL currently is not absolutely strict about validation schemas themselves, therefore UCL users should supply valid schemas (as it is defined in json-schema draft v4) to ensure that the input objects are validated properly.
+
 ## Performance
 
 Are UCL parser and emitter fast enough? Well, there are some numbers.

Copied: stable/9/contrib/libucl/autogen.sh (from r263648, head/contrib/libucl/autogen.sh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/contrib/libucl/autogen.sh	Sat Jul 19 23:57:36 2014	(r268897, copy of r263648, head/contrib/libucl/autogen.sh)
@@ -0,0 +1,2 @@
+#!/bin/sh
+autoreconf -i

Copied and modified: stable/9/contrib/libucl/configure.ac (from r263648, head/contrib/libucl/configure.ac)
==============================================================================
--- head/contrib/libucl/configure.ac	Sat Mar 22 17:28:14 2014	(r263648, copy source)
+++ stable/9/contrib/libucl/configure.ac	Sat Jul 19 23:57:36 2014	(r268897)
@@ -1,7 +1,7 @@
 m4_define([maj_ver], [0])
-m4_define([med_ver], [3])
-m4_define([min_ver], [0])
-m4_define([so_version], [maj_ver:med_ver])
+m4_define([med_ver], [4])
+m4_define([min_ver], [1])
+m4_define([so_version], [1:0:0])
 m4_define([ucl_version], [maj_ver.med_ver.min_ver])
 
 AC_INIT([libucl],[ucl_version],[https://github.com/vstakhov/libucl],[libucl])
@@ -48,11 +48,17 @@ AC_CHECK_HEADERS_ONCE([float.h])
 AC_CHECK_HEADERS_ONCE([math.h])
 
 dnl Example of default-disabled feature
-AC_ARG_ENABLE([urls], AS_HELP_STRING([--enable-urls], [Enable URLs fetch (requires libfetch or libcurl)]))
+AC_ARG_ENABLE([urls], AS_HELP_STRING([--enable-urls], 
+	[Enable URLs fetch (requires libfetch or libcurl) @<:@default=no@:>@]), [],
+	[enable_urls=no])
+AC_ARG_ENABLE([regex], AS_HELP_STRING([--enable-regex], 
+	[Enable regex checking for schema @<:@default=yes@:>@]), [],
+	[enable_regex=yes])
 AC_ARG_ENABLE([signatures], AS_HELP_STRING([--enable-signatures],
-	[Enable signatures check (requires openssl)]))
+	[Enable signatures check (requires openssl) @<:@default=no@:>@]), [],
+	[enable_signatures=no])
 AC_ARG_ENABLE([utils],
-	[--enable-utils Build and install utils],
+	AS_HELP_STRING([--enable-utils], [Build and install utils @<:@default=no@:>@]),
 	[case "${enableval}" in
   		yes) utils=true ;;
   		no)  utils=false ;;
@@ -63,11 +69,11 @@ AM_CONDITIONAL([UTILS], [test x$utils = 
 AS_IF([test "x$enable_signatures" = "xyes"], [
 	AC_SEARCH_LIBS([EVP_MD_CTX_create], [crypto], [
 		AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if you have the 'crypto' library (-lcrypto).])
-		LIBSSL_LIB="-lcrypto"
+		LIBCRYPTO_LIB="-lcrypto"
 		LIBS_EXTRA="${LIBS_EXTRA} -lcrypto"
 		], [AC_MSG_ERROR([unable to find the EVP_MD_CTX_create() function])])
 ])
-
+AC_SUBST(LIBCRYPTO_LIB)
 AC_PATH_PROG(PANDOC, pandoc, [/non/existent])
 
 AC_SEARCH_LIBS([clock_gettime], [rt], [], [
@@ -77,11 +83,21 @@ AC_SEARCH_LIBS([clock_gettime], [rt], []
 ])
 AC_SEARCH_LIBS([remainder], [m], [], [AC_MSG_ERROR([unable to find remainder() function])])
 
-AC_CHECK_HEADER([regex.h], [
-	AC_DEFINE(HAVE_REGEX_H, 1, [Define to 1 if you have the <regex.h> header file.])
-	],
-	[AC_MSG_ERROR([unable to find the regex.h header])],
-	[#include <sys/types.h>])
+AS_IF([test "x$enable_regex" = "xyes"], [
+	AC_CHECK_HEADER([regex.h], [
+		AC_DEFINE(HAVE_REGEX_H, 1, [Define to 1 if you have the <regex.h> header file.])
+		AC_SEARCH_LIBS([regexec], [regex], [
+			AS_IF([test "x$ac_cv_search_regexec" = "x-lregex"], [
+				LIBREGEX_LIB="-lregex"
+				LIBS_EXTRA="${LIBS_EXTRA} -lregex"
+				]
+			)], 
+			[AC_MSG_ERROR([unable to find the regexec() function])])],
+			[AC_MSG_ERROR([unable to find the regex.h header])
+		],
+		[#include <sys/types.h>])
+])
+AC_SUBST(LIBREGEX_LIB)
 
 AS_IF([test "x$enable_urls" = "xyes"], [
 	AC_CHECK_HEADER([fetch.h], [
@@ -114,6 +130,29 @@ AS_IF([test "x$enable_urls" = "xyes"], [
 
 AC_SUBST(LIBS_EXTRA)
 
+AC_MSG_CHECKING(for GCC atomic builtins)
+AC_LINK_IFELSE([
+	AC_LANG_SOURCE([[
+		int main() {
+			volatile unsigned long val = 1;
+			__sync_synchronize();
+			__sync_val_compare_and_swap(&val, 1, 0);
+			__sync_add_and_fetch(&val, 1);
+			__sync_sub_and_fetch(&val, 1);
+			return 0;
+		}
+	]])
+],
+[
+	AC_MSG_RESULT([yes])
+	AC_DEFINE([HAVE_ATOMIC_BUILTINS], [1], [Has gcc/MSVC atomic intrinsics])
+],
+[
+	AC_MSG_RESULT([no])
+	AC_DEFINE([HAVE_ATOMIC_BUILTINS], [0], [Has gcc/MSVC atomic intrinsics])
+	AC_MSG_WARN([Libucl references could be thread-unsafe because atomic builtins are missing])
+])
+
 AC_CONFIG_FILES(Makefile \
 	src/Makefile \
 	tests/Makefile \

Copied: stable/9/contrib/libucl/doc/Makefile.am (from r263648, head/contrib/libucl/doc/Makefile.am)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/contrib/libucl/doc/Makefile.am	Sat Jul 19 23:57:36 2014	(r268897, copy of r263648, head/contrib/libucl/doc/Makefile.am)
@@ -0,0 +1,8 @@
+EXTRA_DIST = api.md
+
+dist_man_MANS = libucl.3
+
+gen-man: @PANDOC@
+	tail -n +$$(grep -n '# Synopsis' api.md | cut -d':' -f1) api.md | \
+	cat pandoc.template - | sed -e 's/^# \(.*\)/# \U\1/' | \
+	@PANDOC@ -s -f markdown -t man -o libucl.3 
\ No newline at end of file

Modified: stable/9/contrib/libucl/doc/api.md
==============================================================================
--- stable/9/contrib/libucl/doc/api.md	Sat Jul 19 23:44:57 2014	(r268896)
+++ stable/9/contrib/libucl/doc/api.md	Sat Jul 19 23:57:36 2014	(r268897)
@@ -1,30 +1,75 @@
-Synopsis
-========
+# API documentation
+
+**Table of Contents**  *generated with [DocToc](http://doctoc.herokuapp.com/)*
+
+- [Synopsis](#synopsis)
+- [Description](#description)
+	- [Parser functions](#parser-functions)
+	- [Emitting functions](#emitting-functions)
+	- [Conversion functions](#conversion-functions)
+	- [Generation functions](#generation-functions)
+	- [Iteration functions](#iteration-functions)
+	- [Validation functions](#validation-functions)
+	- [Utility functions](#utility-functions)
+- [Parser functions](#parser-functions-1)
+	- [ucl_parser_new](#ucl_parser_new)
+	- [ucl_parser_register_macro](#ucl_parser_register_macro)
+	- [ucl_parser_register_variable](#ucl_parser_register_variable)
+	- [ucl_parser_add_chunk](#ucl_parser_add_chunk)
+	- [ucl_parser_add_string](#ucl_parser_add_string)
+	- [ucl_parser_add_file](#ucl_parser_add_file)
+	- [ucl_parser_get_object](#ucl_parser_get_object)
+	- [ucl_parser_get_error](#ucl_parser_get_error)
+	- [ucl_parser_free](#ucl_parser_free)
+	- [ucl_pubkey_add](#ucl_pubkey_add)
+	- [ucl_parser_set_filevars](#ucl_parser_set_filevars)
+	- [Parser usage example](#parser-usage-example)
+- [Emitting functions](#emitting-functions-1)
+	- [ucl_object_emit](#ucl_object_emit)
+	- [ucl_object_emit_full](#ucl_object_emit_full)
+- [Conversion functions](#conversion-functions-1)
+- [Generation functions](#generation-functions-1)
+	- [ucl_object_new](#ucl_object_new)
+	- [ucl_object_typed_new](#ucl_object_typed_new)
+	- [Primitive objects generation](#primitive-objects-generation)
+	- [ucl_object_fromstring_common](#ucl_object_fromstring_common)
+- [Iteration functions](#iteration-functions-1)
+	- [ucl_iterate_object](#ucl_iterate_object)
+- [Validation functions](#validation-functions-1)
+	- [ucl_object_validate](#ucl_object_validate)
+
+# Synopsis
 
 `#include <ucl.h>`
 
-Description
-===========
+# Description
 
 Libucl is a parser and `C` API to parse and generate `ucl` objects. Libucl consist of several groups of functions:
 
 ### Parser functions
-Used to parse `ucl` files and provide interface to extract `ucl` object
+Used to parse `ucl` files and provide interface to extract `ucl` object. Currently, `libucl` can parse only full `ucl` documents, for instance, it is impossible to parse a part of document and therefore it is impossible to use `libucl` as a streaming parser. In future, this limitation can be removed.
 
 ### Emitting functions
-Convert `ucl` objects to some textual or binary representation.
+Convert `ucl` objects to some textual or binary representation. Currently, libucl supports the following exports:
+
+- `JSON` - valid json format (can possibly loose some original data, such as implicit arrays)
+- `Config` - human-readable configuration format (losseless)
+- `YAML` - embedded yaml format (has the same limitations as `json` output)
 
 ### Conversion functions
-Help to convert `ucl` objects to C types
+Help to convert `ucl` objects to C types. These functions are used to convert `ucl_object_t` to C primitive types, such as numbers, strings or boolean values.
 
 ### Generation functions
-Allow creating of `ucl` objects from C types
+Allow creating of `ucl` objects from C types and creating of complex `ucl` objects, such as hashes or arrays from primitive `ucl` objects, such as numbers or strings.
 
 ### Iteration functions
-Iterate over `ucl` objects
+Iterate over `ucl` complex objects or over a chain of values, for example when a key in an object has multiple values (that can be treated as implicit array or implicit consolidation).
+
+### Validation functions
+Validation functions are used to validate some object `obj` using json-schema compatible object `schema`. Both input and schema must be UCL objects to perform validation.
 
 ### Utility functions
-Provide basic utilities to manage `ucl` objects
+Provide basic utilities to manage `ucl` objects: creating, removing, retaining and releasing reference count and so on.
 
 # Parser functions
 
@@ -40,6 +85,7 @@ Creates new parser with the specified fl
 
 - `UCL_PARSER_KEY_LOWERCASE` - lowercase keys parsed
 - `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
 
@@ -87,6 +133,14 @@ while this one won't be parsed correctly
 
 This limitation may possible be removed in future.
 
+### ucl_parser_add_string
+~~~C
+bool ucl_parser_add_string (struct ucl_parser *parser, 
+    const char *data, size_t len);
+~~~
+
+This function acts exactly like `ucl_parser_add_chunk` does but if `len` argument is zero, then the string `data` must be zero-terminated and the actual length is calculated up to `\0` character. 
+
 ### ucl_parser_add_file
 
 ~~~C
@@ -228,7 +282,7 @@ Libucl provides the following functions 
 ### ucl_object_emit
 
 ~~~C
-unsigned char *ucl_object_emit (ucl_object_t *obj, enum ucl_emitter emit_type);
+unsigned char *ucl_object_emit (const ucl_object_t *obj, enum ucl_emitter emit_type);
 ~~~
 
 Allocate a string that is suitable to fit the underlying UCL object `obj` and fill it with the textual representation of the object `obj` according to style `emit_type`. The caller should free the returned string after using.
@@ -236,7 +290,7 @@ Allocate a string that is suitable to fi
 ### ucl_object_emit_full
 
 ~~~C
-bool ucl_object_emit_full (ucl_object_t *obj, enum ucl_emitter emit_type,
+bool ucl_object_emit_full (const ucl_object_t *obj, enum ucl_emitter emit_type,
 		struct ucl_emitter_functions *emitter);
 ~~~
 
@@ -314,19 +368,20 @@ This function is used to convert a strin
 - `UCL_STRING_PARSE_BOOLEAN` - parse passed string and detect boolean
 - `UCL_STRING_PARSE_INT` - parse passed string and detect integer number
 - `UCL_STRING_PARSE_DOUBLE` - parse passed string and detect integer or float number
-- `UCL_STRING_PARSE_NUMBER` - parse passed string and detect number (both float or integer types)
-- `UCL_STRING_PARSE` - parse passed string (and detect booleans and numbers)
+- `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 function
+# 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). To iterate over an object, an array or a key with multiple values there is a function `ucl_iterate_object`.
 
 ## ucl_iterate_object
 ~~~C
-ucl_object_t* ucl_iterate_object (ucl_object_t *obj, 
+const ucl_object_t* ucl_iterate_object (const ucl_object_t *obj, 
 	ucl_object_iter_t *iter, bool expand_values);
 ~~~
 
@@ -334,7 +389,7 @@ This function accept opaque iterator poi
 
 ~~~C
 ucl_object_iter_t it = NULL, it_obj = NULL;
-ucl_object_t *cur, *tmp;
+const ucl_object_t *cur, *tmp;
 
 /* Iterate over the object */
 while ((obj = ucl_iterate_object (top, &it, true))) {
@@ -345,4 +400,40 @@ while ((obj = ucl_iterate_object (top, &
 			ucl_object_tostring_forced (cur));
 	}
 }
-~~~
\ No newline at end of file
+~~~
+
+# Validation functions
+
+Currently, there is only one validation function called `ucl_object_validate`. It performs validation of object using the specified schema. This function is defined as following:
+
+## ucl_object_validate
+~~~C
+bool ucl_object_validate (const ucl_object_t *schema,
+	const ucl_object_t *obj, struct ucl_schema_error *err);
+~~~
+
+This function uses ucl object `schema`, that must be valid in terms of `json-schema` draft v4, to validate input object `obj`. If this function returns `true` then validation procedure has been succeed. Otherwise, `false` is returned and `err` is set to a specific value. If caller set `err` to NULL then this function does not set any error just returning `false`. Error is the structure defined as following:
+
+~~~C
+struct ucl_schema_error {
+	enum ucl_schema_error_code code;	/* error code */
+	char msg[128];				/* error message */
+	ucl_object_t *obj;			/* object where error occured */
+};
+~~~
+
+Caller may use `code` field to get a numeric error code:
+
+~~~C
+enum ucl_schema_error_code {
+	UCL_SCHEMA_OK = 0,          /* no error */
+	UCL_SCHEMA_TYPE_MISMATCH,   /* type of object is incorrect */
+	UCL_SCHEMA_INVALID_SCHEMA,  /* schema is invalid */
+	UCL_SCHEMA_MISSING_PROPERTY,/* missing properties */
+	UCL_SCHEMA_CONSTRAINT,      /* constraint found */
+	UCL_SCHEMA_MISSING_DEPENDENCY, /* missing dependency */
+	UCL_SCHEMA_UNKNOWN          /* generic error */
+};
+~~~
+
+`msg` is a stiring description of an error and `obj` is an object where error has been occurred. Error object is not allocated by libucl, so there is no need to free it after validation (a static object should thus be used).
\ No newline at end of file

Copied and modified: stable/9/contrib/libucl/doc/libucl.3 (from r263648, head/contrib/libucl/doc/libucl.3)
==============================================================================
--- head/contrib/libucl/doc/libucl.3	Sat Mar 22 17:28:14 2014	(r263648, copy source)
+++ stable/9/contrib/libucl/doc/libucl.3	Sat Jul 19 23:57:36 2014	(r268897)
@@ -6,11 +6,11 @@
 \f[B]ucl_parser_add_string\f[], \f[B]ucl_parser_add_file\f[],
 \f[B]ucl_parser_get_object\f[], \f[B]ucl_parser_get_error\f[],
 \f[B]ucl_parser_free\f[], \f[B]ucl_pubkey_add\f[],
-\f[B]ucl_parser_set_filevars\f[] - universal configuration library
+\f[B]ucl_parser_set_filevars\f[] \- universal configuration library
 parser and utility functions
 .SH LIBRARY
 .PP
-UCL library (libucl, -lucl)
+UCL library (libucl, \-lucl)
 .SH SYNOPSIS
 .PP
 \f[C]#include\ <ucl.h>\f[]
@@ -32,12 +32,12 @@ In future, this limitation can be remove
 Convert \f[C]ucl\f[] objects to some textual or binary representation.
 Currently, libucl supports the following exports:
 .IP \[bu] 2
-\f[C]JSON\f[] - valid json format (can possibly loose some original
+\f[C]JSON\f[] \- valid json format (can possibly loose some original
 data, such as implicit arrays)
 .IP \[bu] 2
-\f[C]Config\f[] - human-readable configuration format (losseless)
+\f[C]Config\f[] \- human\-readable configuration format (losseless)
 .IP \[bu] 2
-\f[C]YAML\f[] - embedded yaml format (has the same limitations as
+\f[C]YAML\f[] \- embedded yaml format (has the same limitations as
 \f[C]json\f[] output)
 .SS Conversion functions
 .PP
@@ -57,7 +57,7 @@ as implicit array or implicit consolidat
 .SS Validation functions
 .PP
 Validation functions are used to validate some object \f[C]obj\f[] using
-json-schema compatible object \f[C]schema\f[].
+json\-schema compatible object \f[C]schema\f[].
 Both input and schema must be UCL objects to perform validation.
 .SS Utility functions
 .PP
@@ -76,13 +76,13 @@ struct\ ucl_parser*\ ucl_parser_new\ (in
 .PP
 Creates new parser with the specified flags:
 .IP \[bu] 2
-\f[C]UCL_PARSER_KEY_LOWERCASE\f[] - lowercase keys parsed
+\f[C]UCL_PARSER_KEY_LOWERCASE\f[] \- lowercase keys parsed
 .IP \[bu] 2
-\f[C]UCL_PARSER_ZEROCOPY\f[] - 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)
+\f[C]UCL_PARSER_ZEROCOPY\f[] \- 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)
 .IP \[bu] 2
-\f[C]UCL_PARSER_NO_TIME\f[] - treat time values as strings without
+\f[C]UCL_PARSER_NO_TIME\f[] \- treat time values as strings without
 parsing them as floats
 .SS ucl_parser_register_macro
 .IP
@@ -161,7 +161,7 @@ bool\ ucl_parser_add_string\ (struct\ uc
 .PP
 This function acts exactly like \f[C]ucl_parser_add_chunk\f[] does but
 if \f[C]len\f[] argument is zero, then the string \f[C]data\f[] must be
-zero-terminated and the actual length is calculated up to \f[C]\\0\f[]
+zero\-terminated and the actual length is calculated up to \f[C]\\0\f[]
 character.
 .SS ucl_parser_add_file
 .IP
@@ -229,7 +229,7 @@ bool\ ucl_pubkey_add\ (struct\ ucl_parse
 This function adds a public key from text blob \f[C]key\f[] of length
 \f[C]len\f[] to the \f[C]parser\f[] object.
 This public key should be in the \f[C]PEM\f[] format and can be used by
-\f[C].includes\f[] macro for checking signatures of files included.
+\f[C]\&.includes\f[] macro for checking signatures of files included.
 \f[C]Openssl\f[] support should be enabled to make this function
 working.
 If a key cannot be added (e.g.
@@ -247,25 +247,26 @@ bool\ ucl_parser_set_filevars\ (struct\ 
 Add the standard file variables to the \f[C]parser\f[] based on the
 \f[C]filename\f[] specified:
 .IP \[bu] 2
-\f[C]$FILENAME\f[] - a filename of \f[C]ucl\f[] input
+\f[C]$FILENAME\f[] \- a filename of \f[C]ucl\f[] input
 .IP \[bu] 2
-\f[C]$CURDIR\f[] - a current directory of the input
+\f[C]$CURDIR\f[] \- a current directory of the input
 .PP
-For example, if a \f[C]filename\f[] param is \f[C]../something.conf\f[]
-then the variables will have the following values:
+For example, if a \f[C]filename\f[] param is
+\f[C]\&../something.conf\f[] then the variables will have the following
+values:
 .IP \[bu] 2
-\f[C]$FILENAME\f[] - "../something.conf"
+\f[C]$FILENAME\f[] \- "../something.conf"
 .IP \[bu] 2
-\f[C]$CURDIR\f[] - ".."
+\f[C]$CURDIR\f[] \- ".."
 .PP
 if \f[C]need_expand\f[] parameter is \f[C]true\f[] then all relative
 paths are expanded using \f[C]realpath\f[] call.
-In this example if \f[C]..\f[] is \f[C]/etc/dir\f[] then variables will
-have these values:
+In this example if \f[C]\&..\f[] is \f[C]/etc/dir\f[] then variables
+will have these values:
 .IP \[bu] 2
-\f[C]$FILENAME\f[] - "/etc/something.conf"
+\f[C]$FILENAME\f[] \- "/etc/something.conf"
 .IP \[bu] 2
-\f[C]$CURDIR\f[] - "/etc"
+\f[C]$CURDIR\f[] \- "/etc"
 .SS Parser usage example
 .PP
 The following example loads, parses and extracts \f[C]ucl\f[] object
@@ -283,7 +284,7 @@ FILE\ *in;
 in\ =\ stdin;
 parser\ =\ ucl_parser_new\ (0);
 while\ (!feof\ (in)\ &&\ r\ <\ (int)sizeof\ (inbuf))\ {
-\ \ \ \ r\ +=\ fread\ (inbuf\ +\ r,\ 1,\ sizeof\ (inbuf)\ -\ r,\ in);
+\ \ \ \ r\ +=\ fread\ (inbuf\ +\ r,\ 1,\ sizeof\ (inbuf)\ \-\ r,\ in);
 }
 ucl_parser_add_chunk\ (parser,\ inbuf,\ r);
 fclose\ (in);
@@ -309,20 +310,20 @@ return\ ret;
 .PP
 Libucl can transform UCL objects to a number of tectual formats:
 .IP \[bu] 2
-configuration (\f[C]UCL_EMIT_CONFIG\f[]) - nginx like human readable
+configuration (\f[C]UCL_EMIT_CONFIG\f[]) \- nginx like human readable
 configuration file where implicit arrays are transformed to the
 duplicate keys
 .IP \[bu] 2
-compact json: \f[C]UCL_EMIT_JSON_COMPACT\f[] - single line valid json
+compact json: \f[C]UCL_EMIT_JSON_COMPACT\f[] \- single line valid json
 without spaces
 .IP \[bu] 2
-formatted json: \f[C]UCL_EMIT_JSON\f[] - pretty formatted JSON with
+formatted json: \f[C]UCL_EMIT_JSON\f[] \- pretty formatted JSON with
 newlines and spaces
 .IP \[bu] 2
-compact yaml: \f[C]UCL_EMIT_YAML\f[] - compact YAML output
+compact yaml: \f[C]UCL_EMIT_YAML\f[] \- compact YAML output
 .PP
 Moreover, libucl API allows to select a custom set of emitting functions
-allowing efficent and zero-copy output of libucl objects.
+allowing efficent and zero\-copy output of libucl objects.
 Libucl uses the following structure to support this feature:
 .IP
 .nf
@@ -344,17 +345,17 @@ struct\ ucl_emitter_functions\ {
 .PP
 This structure defines the following callbacks:
 .IP \[bu] 2
-\f[C]ucl_emitter_append_character\f[] - a function that is called to
+\f[C]ucl_emitter_append_character\f[] \- a function that is called to
 append \f[C]nchars\f[] characters equal to \f[C]c\f[]
 .IP \[bu] 2
-\f[C]ucl_emitter_append_len\f[] - used to append a string of length
+\f[C]ucl_emitter_append_len\f[] \- used to append a string of length
 \f[C]len\f[] starting from pointer \f[C]str\f[]
 .IP \[bu] 2
-\f[C]ucl_emitter_append_int\f[] - this function applies to integer
+\f[C]ucl_emitter_append_int\f[] \- this function applies to integer
 numbers
 .IP \[bu] 2
-\f[C]ucl_emitter_append_double\f[] - this function is intended to output
-floating point variable
+\f[C]ucl_emitter_append_double\f[] \- this function is intended to
+output floating point variable
 .PP
 The set of these functions could be used to output text formats of
 \f[C]UCL\f[] objects to different structures or streams.
@@ -364,7 +365,7 @@ Libucl provides the following functions 
 .IP
 .nf
 \f[C]
-unsigned\ char\ *ucl_object_emit\ (ucl_object_t\ *obj,\ enum\ ucl_emitter\ emit_type);
+unsigned\ char\ *ucl_object_emit\ (const\ ucl_object_t\ *obj,\ enum\ ucl_emitter\ emit_type);
 \f[]
 .fi
 .PP
@@ -376,7 +377,7 @@ The caller should free the returned stri
 .IP
 .nf
 \f[C]
-bool\ ucl_object_emit_full\ (ucl_object_t\ *obj,\ enum\ ucl_emitter\ emit_type,
+bool\ ucl_object_emit_full\ (const\ ucl_object_t\ *obj,\ enum\ ucl_emitter\ emit_type,
 \ \ \ \ \ \ \ \ struct\ ucl_emitter_functions\ *emitter);
 \f[]
 .fi
@@ -400,26 +401,26 @@ cannot be converted then some reasonable
 strings and 0 for numbers)
 .PP
 Also there is a single \f[C]ucl_object_tostring_forced\f[] function that
-converts any UCL object (including compound types - arrays and objects)
+converts any UCL object (including compound types \- arrays and objects)
 to a string representation.
 For compound and numeric types this function performs emitting to a
 compact json format actually.
 .PP
 Here is a list of all conversion functions:
 .IP \[bu] 2
-\f[C]ucl_object_toint\f[] - returns \f[C]int64_t\f[] of UCL object
+\f[C]ucl_object_toint\f[] \- returns \f[C]int64_t\f[] of UCL object
 .IP \[bu] 2
-\f[C]ucl_object_todouble\f[] - returns \f[C]double\f[] of UCL object
+\f[C]ucl_object_todouble\f[] \- returns \f[C]double\f[] of UCL object
 .IP \[bu] 2
-\f[C]ucl_object_toboolean\f[] - returns \f[C]bool\f[] of UCL object
+\f[C]ucl_object_toboolean\f[] \- returns \f[C]bool\f[] of UCL object
 .IP \[bu] 2
-\f[C]ucl_object_tostring\f[] - returns \f[C]const\ char\ *\f[] of UCL
+\f[C]ucl_object_tostring\f[] \- returns \f[C]const\ char\ *\f[] of UCL
 object (this string is NULL terminated)
 .IP \[bu] 2
-\f[C]ucl_object_tolstring\f[] - returns \f[C]const\ char\ *\f[] and
+\f[C]ucl_object_tolstring\f[] \- returns \f[C]const\ char\ *\f[] and
 \f[C]size_t\f[] len of UCL object (string can be not NULL terminated)
 .IP \[bu] 2
-\f[C]ucl_object_tostring_forced\f[] - returns string representation of
+\f[C]ucl_object_tostring_forced\f[] \- returns string representation of
 any UCL object
 .PP
 Strings returned by these pointers are associated with the UCL object
@@ -448,26 +449,28 @@ ucl_object_t\ *\ ucl_object_typed_new\ (
 \f[]
 .fi
 .PP
-Create an object of a specified type: - \f[C]UCL_OBJECT\f[] - UCL object
-- key/value pairs - \f[C]UCL_ARRAY\f[] - UCL array - \f[C]UCL_INT\f[] -
-integer number - \f[C]UCL_FLOAT\f[] - floating point number -
-\f[C]UCL_STRING\f[] - NULL terminated string - \f[C]UCL_BOOLEAN\f[] -
-boolean value - \f[C]UCL_TIME\f[] - time value (floating point number of
-seconds) - \f[C]UCL_USERDATA\f[] - opaque userdata pointer (may be used
-in macros) - \f[C]UCL_NULL\f[] - null value
+Create an object of a specified type: \- \f[C]UCL_OBJECT\f[] \- UCL
+object \- key/value pairs \- \f[C]UCL_ARRAY\f[] \- UCL array \-
+\f[C]UCL_INT\f[] \- integer number \- \f[C]UCL_FLOAT\f[] \- floating
+point number \- \f[C]UCL_STRING\f[] \- NULL terminated string \-
+\f[C]UCL_BOOLEAN\f[] \- boolean value \- \f[C]UCL_TIME\f[] \- time value
+(floating point number of seconds) \- \f[C]UCL_USERDATA\f[] \- opaque
+userdata pointer (may be used in macros) \- \f[C]UCL_NULL\f[] \- null
+value
 .PP
 This object should be released by caller.
 .SS Primitive objects generation
 .PP
 Libucl provides the functions similar to inverse conversion functions
-called with the specific C type: - \f[C]ucl_object_fromint\f[] -
-converts \f[C]int64_t\f[] to UCL object - \f[C]ucl_object_fromdouble\f[]
-- converts \f[C]double\f[] to UCL object -
-\f[C]ucl_object_fromboolean\f[] - converts \f[C]bool\f[] to UCL object -
-\f[C]ucl_object_fromstring\f[] - converts \f[C]const\ char\ *\f[] to UCL
-object (this string is NULL terminated) -
-\f[C]ucl_object_fromlstring\f[] - converts \f[C]const\ char\ *\f[] and
-\f[C]size_t\f[] len to UCL object (string can be not NULL terminated)
+called with the specific C type: \- \f[C]ucl_object_fromint\f[] \-
+converts \f[C]int64_t\f[] to UCL object \-
+\f[C]ucl_object_fromdouble\f[] \- converts \f[C]double\f[] to UCL object
+\- \f[C]ucl_object_fromboolean\f[] \- converts \f[C]bool\f[] to UCL
+object \- \f[C]ucl_object_fromstring\f[] \- converts
+\f[C]const\ char\ *\f[] to UCL object (this string is NULL terminated)
+\- \f[C]ucl_object_fromlstring\f[] \- converts \f[C]const\ char\ *\f[]
+and \f[C]size_t\f[] len to UCL object (string can be not NULL
+terminated)
 .PP
 Also there is a function to generate UCL object from a string performing
 various parsing or conversion operations called
@@ -484,35 +487,35 @@ ucl_object_t\ *\ ucl_object_fromstring_c
 This function is used to convert a string \f[C]str\f[] of size
 \f[C]len\f[] to an UCL objects applying \f[C]flags\f[] conversions.
 If \f[C]len\f[] is equal to zero then a \f[C]str\f[] is assumed as
-NULL-terminated.
+NULL\-terminated.
 This function supports the following flags (a set of flags can be
 specified using logical \f[C]OR\f[] operation):
 .IP \[bu] 2
-\f[C]UCL_STRING_ESCAPE\f[] - perform JSON escape
+\f[C]UCL_STRING_ESCAPE\f[] \- perform JSON escape
 .IP \[bu] 2
-\f[C]UCL_STRING_TRIM\f[] - trim leading and trailing whitespaces
+\f[C]UCL_STRING_TRIM\f[] \- trim leading and trailing whitespaces
 .IP \[bu] 2
-\f[C]UCL_STRING_PARSE_BOOLEAN\f[] - parse passed string and detect
+\f[C]UCL_STRING_PARSE_BOOLEAN\f[] \- parse passed string and detect
 boolean
 .IP \[bu] 2
-\f[C]UCL_STRING_PARSE_INT\f[] - parse passed string and detect integer
+\f[C]UCL_STRING_PARSE_INT\f[] \- parse passed string and detect integer
 number
 .IP \[bu] 2
-\f[C]UCL_STRING_PARSE_DOUBLE\f[] - parse passed string and detect
+\f[C]UCL_STRING_PARSE_DOUBLE\f[] \- parse passed string and detect
 integer or float number
 .IP \[bu] 2
-\f[C]UCL_STRING_PARSE_TIME\f[] - parse time values as floating point
+\f[C]UCL_STRING_PARSE_TIME\f[] \- parse time values as floating point
 numbers
 .IP \[bu] 2
-\f[C]UCL_STRING_PARSE_NUMBER\f[] - parse passed string and detect number
-(both float, integer and time types)
+\f[C]UCL_STRING_PARSE_NUMBER\f[] \- parse passed string and detect
+number (both float, integer and time types)
 .IP \[bu] 2
-\f[C]UCL_STRING_PARSE\f[] - parse passed string (and detect booleans,
+\f[C]UCL_STRING_PARSE\f[] \- parse passed string (and detect booleans,
 numbers and time values)
 .IP \[bu] 2
-\f[C]UCL_STRING_PARSE_BYTES\f[] - assume that numeric multipliers are in
-bytes notation, for example \f[C]10k\f[] means \f[C]10*1024\f[] and not
-\f[C]10*1000\f[] as assumed without this flag
+\f[C]UCL_STRING_PARSE_BYTES\f[] \- assume that numeric multipliers are
+in bytes notation, for example \f[C]10k\f[] means \f[C]10*1024\f[] and
+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[].
@@ -530,7 +533,7 @@ is a function \f[C]ucl_iterate_object\f[
 .IP
 .nf
 \f[C]
-ucl_object_t*\ ucl_iterate_object\ (ucl_object_t\ *obj,\ 
+const\ ucl_object_t*\ ucl_iterate_object\ (const\ ucl_object_t\ *obj,\ 
 \ \ \ \ ucl_object_iter_t\ *iter,\ bool\ expand_values);
 \f[]
 .fi
@@ -561,7 +564,7 @@ Here is an example of iteration over the
 .nf
 \f[C]
 ucl_object_iter_t\ it\ =\ NULL,\ it_obj\ =\ NULL;
-ucl_object_t\ *cur,\ *tmp;
+const\ ucl_object_t\ *cur,\ *tmp;
 
 /*\ Iterate\ over\ the\ object\ */
 while\ ((obj\ =\ ucl_iterate_object\ (top,\ &it,\ true)))\ {
@@ -584,13 +587,13 @@ This function is defined as following:
 .IP
 .nf
 \f[C]
-bool\ ucl_object_validate\ (ucl_object_t\ *schema,
-\ \ \ \ ucl_object_t\ *obj,\ struct\ ucl_schema_error\ *err);
+bool\ ucl_object_validate\ (const\ ucl_object_t\ *schema,
+\ \ \ \ const\ ucl_object_t\ *obj,\ struct\ ucl_schema_error\ *err);
 \f[]
 .fi
 .PP
 This function uses ucl object \f[C]schema\f[], that must be valid in
-terms of \f[C]json-schema\f[] draft v4, to validate input object
+terms of \f[C]json\-schema\f[] draft v4, to validate input object
 \f[C]obj\f[].
 If this function returns \f[C]true\f[] then validation procedure has
 been succeed.

Copied: stable/9/contrib/libucl/doc/pandoc.template (from r263648, head/contrib/libucl/doc/pandoc.template)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/contrib/libucl/doc/pandoc.template	Sat Jul 19 23:57:36 2014	(r268897, copy of r263648, head/contrib/libucl/doc/pandoc.template)
@@ -0,0 +1,12 @@
+% LIBUCL(5) Libucl manual
+% Vsevolod Stakhov <vsevolod at highsecure.ru>
+% March 20, 2014
+
+# Name
+
+**ucl_parser_new**, **ucl_parser_register_macro**, **ucl_parser_register_variable**, **ucl_parser_add_chunk**, **ucl_parser_add_string**, **ucl_parser_add_file**, **ucl_parser_get_object**, **ucl_parser_get_error**, **ucl_parser_free**, **ucl_pubkey_add**, **ucl_parser_set_filevars** - universal configuration library parser and utility functions
+
+# Library
+
+UCL library (libucl, -lucl)
+

Modified: stable/9/contrib/libucl/include/ucl.h
==============================================================================
--- stable/9/contrib/libucl/include/ucl.h	Sat Jul 19 23:44:57 2014	(r268896)
+++ stable/9/contrib/libucl/include/ucl.h	Sat Jul 19 23:57:36 2014	(r268897)
@@ -81,6 +81,14 @@ extern "C" {
 #define UCL_WARN_UNUSED_RESULT
 #endif
 
+#ifdef __GNUC__
+#define UCL_DEPRECATED(func) func __attribute__ ((deprecated))
+#elif defined(_MSC_VER)
+#define UCL_DEPRECATED(func) __declspec(deprecated) func
+#else
+#define UCL_DEPRECATED(func) func
+#endif
+
 /**
  * @defgroup structures Structures and types
  * UCL defines several enumeration types used for error reporting or specifying flags and attributes.
@@ -138,7 +146,8 @@ typedef enum ucl_emitter {
  */
 typedef enum ucl_parser_flags {
 	UCL_PARSER_KEY_LOWERCASE = 0x1, /**< Convert all keys to lower case */
-	UCL_PARSER_ZEROCOPY = 0x2 /**< Parse input in zero-copy mode if possible */
+	UCL_PARSER_ZEROCOPY = 0x2, /**< Parse input in zero-copy mode if possible */
+	UCL_PARSER_NO_TIME = 0x4 /**< Do not parse time and treat time values as strings */
 } ucl_parser_flags_t;
 
 /**
@@ -150,11 +159,12 @@ typedef enum ucl_string_flags {
 	UCL_STRING_PARSE_BOOLEAN = 0x4,    /**< Parse passed string and detect boolean */
 	UCL_STRING_PARSE_INT = 0x8,    /**< Parse passed string and detect integer number */
 	UCL_STRING_PARSE_DOUBLE = 0x10,    /**< Parse passed string and detect integer or float number */
-	UCL_STRING_PARSE_NUMBER =  UCL_STRING_PARSE_INT|UCL_STRING_PARSE_DOUBLE ,  /**<
+	UCL_STRING_PARSE_TIME = 0x20, /**< Parse time strings */
+	UCL_STRING_PARSE_NUMBER =  UCL_STRING_PARSE_INT|UCL_STRING_PARSE_DOUBLE|UCL_STRING_PARSE_TIME,  /**<
 									Parse passed string and detect number */
 	UCL_STRING_PARSE =  UCL_STRING_PARSE_BOOLEAN|UCL_STRING_PARSE_NUMBER,   /**<
 									Parse passed string (and detect booleans and numbers) */
-	UCL_STRING_PARSE_BYTES = 0x20  /**< Treat numbers as bytes */
+	UCL_STRING_PARSE_BYTES = 0x40  /**< Treat numbers as bytes */
 } ucl_string_flags_t;
 
 /**
@@ -206,51 +216,33 @@ typedef struct ucl_object_s {
  * @param obj CL object
  * @return zero terminated key
  */
-UCL_EXTERN char* ucl_copy_key_trash (ucl_object_t *obj);
+UCL_EXTERN char* ucl_copy_key_trash (const ucl_object_t *obj);
 
 /**
  * Copy and return a string value of an object, returned key is zero-terminated
  * @param obj CL object
  * @return zero terminated string representation of object value
  */
-UCL_EXTERN char* ucl_copy_value_trash (ucl_object_t *obj);
+UCL_EXTERN char* ucl_copy_value_trash (const ucl_object_t *obj);
 
 /**
  * Creates a new object
  * @return new object
  */
-static inline ucl_object_t* ucl_object_new (void) UCL_WARN_UNUSED_RESULT;
-static inline ucl_object_t *
-ucl_object_new (void)
-{
-	ucl_object_t *new;
-	new = malloc (sizeof (ucl_object_t));
-	if (new != NULL) {
-		memset (new, 0, sizeof (ucl_object_t));
-		new->ref = 1;
-		new->type = UCL_NULL;
-	}
-	return new;
-}
+UCL_EXTERN ucl_object_t* ucl_object_new (void) UCL_WARN_UNUSED_RESULT;
 
 /**
  * Create new object with type specified
  * @param type type of a new object
  * @return new object
  */
-static inline ucl_object_t* ucl_object_typed_new (unsigned int type) UCL_WARN_UNUSED_RESULT;
-static inline ucl_object_t *
-ucl_object_typed_new (unsigned int type)
-{
-	ucl_object_t *new;
-	new = malloc (sizeof (ucl_object_t));
-	if (new != NULL) {
-		memset (new, 0, sizeof (ucl_object_t));
-		new->ref = 1;
-		new->type = (type <= UCL_NULL ? type : UCL_NULL);
-	}
-	return new;
-}
+UCL_EXTERN ucl_object_t* ucl_object_typed_new (ucl_type_t type) UCL_WARN_UNUSED_RESULT;
+
+/**
+ * Return the type of an object
+ * @return the object type
+ */
+UCL_EXTERN ucl_type_t ucl_object_type (const ucl_object_t *obj);
 
 /**
  * Convert any string to an ucl object making the specified transformations
@@ -267,11 +259,7 @@ UCL_EXTERN ucl_object_t * ucl_object_fro
  * @param str NULL terminated string, will be json escaped
  * @return new object
  */
-static inline ucl_object_t *
-ucl_object_fromstring (const char *str)
-{
-	return ucl_object_fromstring_common (str, 0, UCL_STRING_ESCAPE);
-}
+UCL_EXTERN ucl_object_t *ucl_object_fromstring (const char *str) UCL_WARN_UNUSED_RESULT;
 
 /**
  * Create a UCL object from the specified string
@@ -279,68 +267,29 @@ ucl_object_fromstring (const char *str)
  * @param len length of a string
  * @return new object
  */
-static inline ucl_object_t *
-ucl_object_fromlstring (const char *str, size_t len)
-{
-	return ucl_object_fromstring_common (str, len, UCL_STRING_ESCAPE);
-}
+UCL_EXTERN ucl_object_t *ucl_object_fromlstring (const char *str,
+		size_t len) UCL_WARN_UNUSED_RESULT;
 
 /**
  * Create an object from an integer number
  * @param iv number
  * @return new object
  */
-static inline ucl_object_t *
-ucl_object_fromint (int64_t iv)
-{
-	ucl_object_t *obj;
-
-	obj = ucl_object_new ();
-	if (obj != NULL) {
-		obj->type = UCL_INT;
-		obj->value.iv = iv;
-	}
-
-	return obj;
-}
+UCL_EXTERN ucl_object_t* ucl_object_fromint (int64_t iv) UCL_WARN_UNUSED_RESULT;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-stable-9 mailing list