Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Update libucl from latest git use a global config.h for the while external directory
Baptiste Daroussin committed 12 years ago
commit 7c88f3b01af6be31e4e0e54d50f2b4885e1854f2
parent 6f18a14
93 files changed +3865 -411
modified configure.ac
@@ -128,6 +128,26 @@ AC_CHECK_HEADER([sys/capability.h], [

])

+
AC_CHECK_HEADERS_ONCE([fcntl.h])
+
AC_CHECK_HEADERS_ONCE([sys/types.h])
+
AC_CHECK_HEADERS_ONCE([sys/stat.h])
+
AC_CHECK_HEADERS_ONCE([sys/param.h])
+
AC_CHECK_HEADERS_ONCE([sys/mman.h])
+
AC_CHECK_HEADERS_ONCE([stdlib.h])
+
AC_CHECK_HEADERS_ONCE([stddef.h])
+
AC_CHECK_HEADERS_ONCE([stdarg.h])
+
AC_CHECK_HEADERS_ONCE([stdbool.h])
+
AC_CHECK_HEADERS_ONCE([stdint.h])
+
AC_CHECK_HEADERS_ONCE([string.h])
+
AC_CHECK_HEADERS_ONCE([unistd.h])
+
AC_CHECK_HEADERS_ONCE([ctype.h])
+
AC_CHECK_HEADERS_ONCE([errno.h])
+
AC_CHECK_HEADERS_ONCE([limits.h])
+
AC_CHECK_HEADERS_ONCE([libgen.h])
+
AC_CHECK_HEADERS_ONCE([stdio.h])
+
AC_CHECK_HEADERS_ONCE([float.h])
+
AC_CHECK_HEADERS_ONCE([math.h])
+


AC_SUBST([LIBELF_LIB])
AC_SUBST([LIBELF_BUNDLED])
modified external/Makefile.am
@@ -54,7 +54,6 @@ noinst_HEADERS= expat/amiga/expat_68k.h \
		libucl/uthash/uthash.h \
		libucl/uthash/utlist.h \
		libucl/uthash/utstring.h \
-
		libyaml/config.h \
		libyaml/include/yaml.h \
		libyaml/src/yaml_private.h \
		libyaml/win32/config.h \
added external/config.h
@@ -0,0 +1,15 @@
+
#ifdef HAVE_CONFIG_H
+
#include "pkg_config.h"
+
#endif
+

+
/* Define the major version number. */
+
#define YAML_VERSION_MAJOR 0
+

+
/* Define the minor version number. */
+
#define YAML_VERSION_MINOR 1
+

+
/* Define the patch version number. */
+
#define YAML_VERSION_PATCH 4
+

+
/* Define the version string. */
+
#define YAML_VERSION_STRING "0.1.4"
added external/libucl/Makefile.am
@@ -0,0 +1,3 @@
+
ACLOCAL_AMFLAGS = -I m4
+
EXTRA_DIST = uthash $(TESTS)
+
SUBDIRS = src tests

\ No newline at end of file
modified external/libucl/Makefile.unix
@@ -21,8 +21,17 @@ LD_SHARED_FLAGS ?= -Wl,-soname,$(SONAME) -shared -lm
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_emitter.c $(HDEPS)
	$(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)/$(SONAME)

# 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 external/libucl/Makefile.w32
@@ -24,8 +24,17 @@ LD_SHARED_FLAGS ?= -Wl,-soname,$(SONAME) -shared -lm
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_emitter.c $(HDEPS)
	$(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

added external/libucl/autogen.sh
@@ -0,0 +1,2 @@
+
#!/bin/sh
+
autoreconf -i
added external/libucl/cmake/CMakeLists.txt
@@ -0,0 +1,112 @@
+
PROJECT(libucl C)
+

+
SET(LIBUCL_VERSION_MAJOR 0)
+
SET(LIBUCL_VERSION_MINOR 2)
+
SET(LIBUCL_VERSION_PATCH 9)
+

+
SET(LIBUCL_VERSION         "${LIBUCL_VERSION_MAJOR}.${LIBUCL_VERSION_MINOR}.${LIBUCL_VERSION_PATCH}")
+

+
INCLUDE(CheckCCompilerFlag)
+
INCLUDE(FindOpenSSL)
+
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
+

+
OPTION(ENABLE_URL_INCLUDE  "Enable urls in ucl includes (requires libcurl or libfetch) [default: OFF]" OFF)
+
OPTION(ENABLE_URL_SIGN  "Enable signatures check in ucl includes (requires openssl) [default: OFF]" OFF)
+
OPTION(BUILD_SHARED_LIBS "Build Shared Libraries [default: OFF]" OFF)
+

+
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+
	LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt)
+
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+

+
IF(ENABLE_URL_INCLUDE MATCHES "ON")
+
    FIND_LIBRARY(LIBFETCH_LIBRARY NAMES fetch PATHS	PATH_SUFFIXES lib64 lib
+
                      PATHS
+
                          ~/Library/Frameworks
+
                          /Library/Frameworks
+
                          /usr/local
+
                          /usr
+
                          /sw
+
                          /opt/local
+
                          /opt/csw
+
                          /opt
+
                     DOC "Path where the libfetch library can be found")
+
    IF(LIBFETCH_LIBRARY)
+
    	FIND_FILE(HAVE_FETCH_H NAMES fetch.h PATHS /usr/include
+
    											   /opt/include
+
    											   /usr/local/include
+
    				DOC "Path to libfetch header")
+
    ELSE(LIBFETCH_LIBRARY)
+
    	# Try to find libcurl
+
    	ProcessPackage(CURL libcurl)
+
    	IF(NOT CURL_FOUND)
+
    		MESSAGE(WARNING "Neither libcurl nor libfetch were found, no support of URL includes in configuration")
+
    	ENDIF(NOT CURL_FOUND)
+
    ENDIF(LIBFETCH_LIBRARY)
+
ENDIF(ENABLE_URL_INCLUDE MATCHES "ON")
+

+
SET(CMAKE_C_WARN_FLAGS "")
+
CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL)
+
CHECK_C_COMPILER_FLAG(-W SUPPORT_W)
+
CHECK_C_COMPILER_FLAG(-Wno-unused-parameter SUPPORT_WPARAM)
+
CHECK_C_COMPILER_FLAG(-Wno-pointer-sign SUPPORT_WPOINTER_SIGN)
+
CHECK_C_COMPILER_FLAG(-Wstrict-prototypes SUPPORT_WSTRICT_PROTOTYPES)
+
IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
+
	CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD_FLAG)
+
ENDIF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
+
IF(SUPPORT_W)
+
	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -W")
+
ENDIF(SUPPORT_W)
+
IF(SUPPORT_WALL)
+
	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wall")
+
ENDIF(SUPPORT_WALL)
+
IF(SUPPORT_WPARAM)
+
	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-parameter")
+
ENDIF(SUPPORT_WPARAM)
+
IF(SUPPORT_WPOINTER_SIGN)
+
	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-pointer-sign")
+
ENDIF(SUPPORT_WPOINTER_SIGN)
+
IF(SUPPORT_WSTRICT_PROTOTYPES)
+
	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wstrict-prototypes")
+
ENDIF(SUPPORT_WSTRICT_PROTOTYPES)
+
IF(SUPPORT_STD_FLAG)
+
	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -std=c99")
+
ENDIF(SUPPORT_STD_FLAG)
+

+
IF(ENABLE_URL_SIGN MATCHES "ON")
+
	IF(OPENSSL_FOUND)
+
		SET(HAVE_OPENSSL 1)
+
		INCLUDE_DIRECTORIES("${OPENSSL_INCLUDE_DIR}")
+
	ENDIF(OPENSSL_FOUND)
+
ENDIF(ENABLE_URL_SIGN MATCHES "ON")
+

+
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../src")
+
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../include")
+
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../uthash")
+

+
SET(UCLSRC            ../src/ucl_util.c
+
                      ../src/ucl_parser.c
+
                      ../src/ucl_emitter.c
+
                      ../src/ucl_hash.c
+
                      ../src/ucl_schema.c
+
                      ../src/xxhash.c)
+

+

+
SET (LIB_TYPE STATIC)
+
IF (BUILD_SHARED_LIBS)
+
  SET (LIB_TYPE SHARED)
+
ENDIF (BUILD_SHARED_LIBS)
+
ADD_LIBRARY(ucl ${LIB_TYPE} ${UCLSRC})
+
SET_TARGET_PROPERTIES(ucl PROPERTIES VERSION ${LIBUCL_VERSION} SOVERSION ${LIBUCL_VERSION_MAJOR})
+

+
IF(HAVE_FETCH_H)
+
    TARGET_LINK_LIBRARIES(ucl fetch)
+
ELSE(HAVE_FETCH_H)
+
    IF(CURL_FOUND)
+
        TARGET_LINK_LIBRARIES(ucl ${CURL_LIBRARIES})
+
    ENDIF(CURL_FOUND)
+
ENDIF(HAVE_FETCH_H)
+
IF(ENABLE_URL_SIGN MATCHES "ON")
+
	IF(OPENSSL_FOUND)
+
		TARGET_LINK_LIBRARIES(ucl ${OPENSSL_LIBRARIES})
+
	ENDIF(OPENSSL_FOUND)
+
ENDIF(ENABLE_URL_SIGN MATCHES "ON")
added external/libucl/configure.ac
@@ -0,0 +1,97 @@
+
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([ucl_version], [maj_ver.med_ver.min_ver])
+

+
AC_INIT([libucl],[ucl_version],[https://github.com/vstakhov/libucl],[libucl])
+
AC_CONFIG_SRCDIR([configure.ac])
+
AM_INIT_AUTOMAKE([1.11 foreign -Wportability no-dist-gzip dist-xz])
+

+
UCL_VERSION=ucl_version
+
SO_VERSION=so_version
+

+
AC_SUBST(UCL_VERSION)
+
AC_SUBST(SO_VERSION)
+

+
AC_PROG_CC_C99
+
AM_PROG_CC_C_O
+
LT_INIT
+
AC_CONFIG_MACRO_DIR([m4])
+
AC_CONFIG_HEADERS([config.h])
+

+
AC_C_CONST
+
AC_TYPE_SIZE_T
+

+
AC_CHECK_HEADERS_ONCE([fcntl.h unistd.h])
+
AC_TYPE_OFF_T
+
AC_FUNC_MMAP
+
AC_CHECK_HEADERS_ONCE([fcntl.h])
+
AC_CHECK_HEADERS_ONCE([sys/types.h])
+
AC_CHECK_HEADERS_ONCE([sys/stat.h])
+
AC_CHECK_HEADERS_ONCE([sys/param.h])
+
AC_CHECK_HEADERS_ONCE([sys/mman.h])
+
AC_CHECK_HEADERS_ONCE([stdlib.h])
+
AC_CHECK_HEADERS_ONCE([stddef.h])
+
AC_CHECK_HEADERS_ONCE([stdarg.h])
+
AC_CHECK_HEADERS_ONCE([stdbool.h])
+
AC_CHECK_HEADERS_ONCE([stdint.h])
+
AC_CHECK_HEADERS_ONCE([string.h])
+
AC_CHECK_HEADERS_ONCE([unistd.h])
+
AC_CHECK_HEADERS_ONCE([ctype.h])
+
AC_CHECK_HEADERS_ONCE([errno.h])
+
AC_CHECK_HEADERS_ONCE([limits.h])
+
AC_CHECK_HEADERS_ONCE([libgen.h])
+
AC_CHECK_HEADERS_ONCE([stdio.h])
+
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([signatures], AS_HELP_STRING([--enable-signatures], 
+
	[Enable signatures check (requires openssl)]))
+

+
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"
+
		LIBS_EXTRA="${LIBS_EXTRA} -lcrypto"
+
		], [AC_MSG_ERROR([unable to find the EVP_MD_CTX_create() function])])
+
])
+
AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([unable to find clock_gettime() function])])
+
	
+
AS_IF([test "x$enable_urls" = "xyes"], [	
+
	AC_CHECK_HEADER([fetch.h], [
+
		AC_DEFINE(HAVE_FETCH_H, 1, [Define to 1 if you have the <fetch.h> header file.])
+
		AC_CHECK_LIB(fetch, fetchXGet, [
+
			AC_DEFINE(HAVE_LIBFETCH, 1, [Define to 1 if you have the 'fetch' library (-fetch).])
+
			LIBFETCH_LIBS="-lfetch"
+
			have_libfetch="yes"
+
			LIBS_EXTRA="${LIBS_EXTRA} -lfetch"
+
		])
+
	], [],[
+
	#include <stdio.h>
+
	#ifdef HAVE_SYS_PARAM_H
+
	#include <sys/param.h>
+
	#endif
+
	])
+
	AC_SUBST(LIBFETCH_LIBS)
+
	
+
	AS_IF([ test "x$have_libfetch" != "xyes"], [
+
		dnl Fallback to libcurl
+
		PKG_CHECK_MODULES([CURL], [libcurl], [
+
			AC_DEFINE(CURL_FOUND, 1, [Use libcurl])
+
			LIBS_EXTRA="${LIBS_EXTRA} -lcurl"], 
+
		[AC_MSG_ERROR([unable to find neither libfetch nor libcurl])])
+
	])
+
	AC_SUBST(CURL_FOUND)
+
	AC_SUBST(CURL_LIBS)
+
	AC_SUBST(CURL_CFLAGS)
+
])
+

+
AC_CONFIG_FILES(Makefile \
+
	src/Makefile \
+
	tests/Makefile \
+
	libucl.pc)
+
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
+
AC_OUTPUT
modified external/libucl/include/ucl.h
@@ -551,6 +551,27 @@ UCL_EXTERN ucl_object_t* ucl_object_ref (ucl_object_t *obj);
 * @param obj object to unref
 */
UCL_EXTERN void ucl_object_unref (ucl_object_t *obj);
+

+
/**
+
 * Compare objects `o1` and `o2`
+
 * @param o1 the first object
+
 * @param o2 the second object
+
 * @return values >0, 0 and <0 if `o1` is more than, equal and less than `o2`.
+
 * The order of comparison:
+
 * 1) Type of objects
+
 * 2) Size of objects
+
 * 3) Content of objects
+
 */
+
UCL_EXTERN int ucl_object_compare (ucl_object_t *o1, ucl_object_t *o2);
+

+
/**
+
 * Sort UCL array using `cmp` compare function
+
 * @param ar
+
 * @param cmp
+
 */
+
UCL_EXTERN void ucl_object_array_sort (ucl_object_t *ar,
+
		int (*cmp)(ucl_object_t *o1, ucl_object_t *o2));
+

/**
 * Opaque iterator object
 */
@@ -728,6 +749,47 @@ UCL_EXTERN bool ucl_object_emit_full (ucl_object_t *obj, enum ucl_emitter emit_t
		struct ucl_emitter_functions *emitter);
/** @} */

+
/**
+
 * @defgroup schema Schema functions
+
 * These functions are used to validate UCL objects using json schema format
+
 *
+
 * @{
+
 */
+

+
/**
+
 * Used to define UCL schema error
+
 */
+
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,/**< one or more missing properties */
+
	UCL_SCHEMA_CONSTRAINT,      /**< constraint found */
+
	UCL_SCHEMA_UNKNOWN          /**< generic error */
+
};
+

+
/**
+
 * Generic ucl schema error
+
 */
+
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 */
+
};
+

+
/**
+
 * Validate object `obj` using schema object `schema`.
+
 * @param schema schema object
+
 * @param obj object to validate
+
 * @param err error pointer, if this parameter is not NULL and error has been
+
 * occured, then `err` is filled with the exact error definition.
+
 * @return true if `obj` is valid using `schema`
+
 */
+
UCL_EXTERN bool ucl_object_validate (ucl_object_t *schema,
+
		ucl_object_t *obj, struct ucl_schema_error *err);
+

+
/** @} */
+

#ifdef  __cplusplus
}
#endif
added external/libucl/libucl.pc.in
@@ -0,0 +1,11 @@
+
prefix=@prefix@
+
exec_prefix=@exec_prefix@
+
libdir=@libdir@
+
includedir=@includedir@
+

+
Name: LibUCL
+
Description: Universal configuration library
+
Version: @UCL_VERSION@
+
Libs: -L${libdir} -lucl
+
Libs.private: @LIBS_EXTRA@
+
Cflags: -I${includedir}/ @EXTRA_CFLAGS@
added external/libucl/m4/.gitignore
@@ -0,0 +1,4 @@
+
# Ignore everything in this directory
+
*
+
# Except this file
+
!.gitignore
added external/libucl/src/Makefile.am
@@ -0,0 +1,19 @@
+
libucl_common_cflags=	-I$(top_srcdir)/src \
+
			-I$(top_srcdir)/include \
+
			-I$(top_srcdir)/uthash \
+
			-Wall -W -Wno-unused-parameter -Wno-pointer-sign
+
lib_LTLIBRARIES=	libucl.la
+
libucl_la_SOURCES=	ucl_emitter.c \
+
					ucl_hash.c \
+
					ucl_parser.c \
+
					ucl_schema.c \
+
					ucl_util.c \
+
					xxhash.c
+
libucl_la_CFLAGS=	$(libucl_common_cflags) \
+
					@CURL_CFLAGS@
+
libucl_la_LDFLAGS = -version-info @SO_VERSION@
+
libucl_la_LIBADD=	@LIBFETCH_LIBS@ \
+
					@CURL_LIBS@
+

+
include_HEADERS=	$(top_srcdir)/include/ucl.h
+

added external/libucl/src/tree.h
@@ -0,0 +1,212 @@
+
/* tree.h -- AVL trees (in the spirit of BSD's 'queue.h')	-*- C -*-	*/
+

+
/* Copyright (c) 2005 Ian Piumarta
+
 * 
+
 * All rights reserved.
+
 * 
+
 * Permission is hereby granted, free of charge, to any person obtaining a copy
+
 * of this software and associated documentation files (the 'Software'), to deal
+
 * in the Software without restriction, including without limitation the rights
+
 * to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+
 * Software, and to permit persons to whom the Software is furnished to do so,
+
 * provided that the above copyright notice(s) and this permission notice appear
+
 * in all copies of the Software and that both the above copyright notice(s) and
+
 * this permission notice appear in supporting documentation.
+
 *
+
 * THE SOFTWARE IS PROVIDED 'AS IS'.  USE ENTIRELY AT YOUR OWN RISK.
+
 */
+

+
/* This file defines an AVL balanced binary tree [Georgii M. Adelson-Velskii and
+
 * Evgenii M. Landis, 'An algorithm for the organization of information',
+
 * Doklady Akademii Nauk SSSR, 146:263-266, 1962 (Russian).  Also in Myron
+
 * J. Ricci (trans.), Soviet Math, 3:1259-1263, 1962 (English)].
+
 * 
+
 * An AVL tree is headed by pointers to the root node and to a function defining
+
 * the ordering relation between nodes.  Each node contains an arbitrary payload
+
 * plus three fields per tree entry: the depth of the subtree for which it forms
+
 * the root and two pointers to child nodes (singly-linked for minimum space, at
+
 * the expense of direct access to the parent node given a pointer to one of the
+
 * children).  The tree is rebalanced after every insertion or removal.  The
+
 * tree may be traversed in two directions: forward (in-order left-to-right) and
+
 * reverse (in-order, right-to-left).
+
 * 
+
 * Because of the recursive nature of many of the operations on trees it is
+
 * necessary to define a number of helper functions for each type of tree node.
+
 * The macro TREE_DEFINE(node_tag, entry_name) defines these functions with
+
 * unique names according to the node_tag.  This macro should be invoked,
+
 * thereby defining the necessary functions, once per node tag in the program.
+
 * 
+
 * For details on the use of these macros, see the tree(3) manual page.
+
 */
+

+
#ifndef __tree_h
+
#define __tree_h
+

+

+
#define TREE_DELTA_MAX	1
+

+
#define TREE_ENTRY(type)			\
+
  struct {					\
+
    struct type	*avl_left;			\
+
    struct type	*avl_right;			\
+
    int		 avl_height;			\
+
  }
+

+
#define TREE_HEAD(name, type)				\
+
  struct name {						\
+
    struct type *th_root;				\
+
    int  (*th_cmp)(struct type *lhs, struct type *rhs);	\
+
  }
+

+
#define TREE_INITIALIZER(cmp) { 0, cmp }
+

+
#define TREE_DELTA(self, field)								\
+
  (( (((self)->field.avl_left)  ? (self)->field.avl_left->field.avl_height  : 0))	\
+
   - (((self)->field.avl_right) ? (self)->field.avl_right->field.avl_height : 0))
+

+
/* Recursion prevents the following from being defined as macros. */
+

+
#define TREE_DEFINE(node, field)									\
+
													\
+
  struct node *TREE_BALANCE_##node##_##field(struct node *);						\
+
													\
+
  struct node *TREE_ROTL_##node##_##field(struct node *self)						\
+
  {													\
+
    struct node *r= self->field.avl_right;								\
+
    self->field.avl_right= r->field.avl_left;								\
+
    r->field.avl_left= TREE_BALANCE_##node##_##field(self);						\
+
    return TREE_BALANCE_##node##_##field(r);								\
+
  }													\
+
													\
+
  struct node *TREE_ROTR_##node##_##field(struct node *self)						\
+
  {													\
+
    struct node *l= self->field.avl_left;								\
+
    self->field.avl_left= l->field.avl_right;								\
+
    l->field.avl_right= TREE_BALANCE_##node##_##field(self);						\
+
    return TREE_BALANCE_##node##_##field(l);								\
+
  }													\
+
													\
+
  struct node *TREE_BALANCE_##node##_##field(struct node *self)						\
+
  {													\
+
    int delta= TREE_DELTA(self, field);									\
+
													\
+
    if (delta < -TREE_DELTA_MAX)									\
+
      {													\
+
	if (TREE_DELTA(self->field.avl_right, field) > 0)						\
+
	  self->field.avl_right= TREE_ROTR_##node##_##field(self->field.avl_right);			\
+
	return TREE_ROTL_##node##_##field(self);							\
+
      }													\
+
    else if (delta > TREE_DELTA_MAX)									\
+
      {													\
+
	if (TREE_DELTA(self->field.avl_left, field) < 0)						\
+
	  self->field.avl_left= TREE_ROTL_##node##_##field(self->field.avl_left);			\
+
	return TREE_ROTR_##node##_##field(self);							\
+
      }													\
+
    self->field.avl_height= 0;										\
+
    if (self->field.avl_left && (self->field.avl_left->field.avl_height > self->field.avl_height))	\
+
      self->field.avl_height= self->field.avl_left->field.avl_height;					\
+
    if (self->field.avl_right && (self->field.avl_right->field.avl_height > self->field.avl_height))	\
+
      self->field.avl_height= self->field.avl_right->field.avl_height;					\
+
    self->field.avl_height += 1;									\
+
    return self;											\
+
  }													\
+
													\
+
  struct node *TREE_INSERT_##node##_##field								\
+
    (struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs))		\
+
  {													\
+
    if (!self)												\
+
      return elm;											\
+
    if (compare(elm, self) < 0)										\
+
      self->field.avl_left= TREE_INSERT_##node##_##field(self->field.avl_left, elm, compare);		\
+
    else												\
+
      self->field.avl_right= TREE_INSERT_##node##_##field(self->field.avl_right, elm, compare);		\
+
    return TREE_BALANCE_##node##_##field(self);								\
+
  }													\
+
													\
+
  struct node *TREE_FIND_##node##_##field								\
+
    (struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs))		\
+
  {													\
+
    if (!self)												\
+
      return 0;												\
+
    if (compare(elm, self) == 0)									\
+
      return self;											\
+
    if (compare(elm, self) < 0)										\
+
      return TREE_FIND_##node##_##field(self->field.avl_left, elm, compare);				\
+
    else												\
+
      return TREE_FIND_##node##_##field(self->field.avl_right, elm, compare);				\
+
  }													\
+
													\
+
  struct node *TREE_MOVE_RIGHT(struct node *self, struct node *rhs)					\
+
  {													\
+
    if (!self)												\
+
      return rhs;											\
+
    self->field.avl_right= TREE_MOVE_RIGHT(self->field.avl_right, rhs);					\
+
    return TREE_BALANCE_##node##_##field(self);								\
+
  }													\
+
													\
+
  struct node *TREE_REMOVE_##node##_##field								\
+
    (struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs))		\
+
  {													\
+
    if (!self) return 0;										\
+
													\
+
    if (compare(elm, self) == 0)									\
+
      {													\
+
	struct node *tmp= TREE_MOVE_RIGHT(self->field.avl_left, self->field.avl_right);			\
+
	self->field.avl_left= 0;									\
+
	self->field.avl_right= 0;									\
+
	return tmp;											\
+
      }													\
+
    if (compare(elm, self) < 0)										\
+
      self->field.avl_left= TREE_REMOVE_##node##_##field(self->field.avl_left, elm, compare);		\
+
    else												\
+
      self->field.avl_right= TREE_REMOVE_##node##_##field(self->field.avl_right, elm, compare);		\
+
    return TREE_BALANCE_##node##_##field(self);								\
+
  }													\
+
													\
+
  void TREE_FORWARD_APPLY_ALL_##node##_##field								\
+
    (struct node *self, void (*function)(struct node *node, void *data), void *data)			\
+
  {													\
+
    if (self)												\
+
      {													\
+
	TREE_FORWARD_APPLY_ALL_##node##_##field(self->field.avl_left, function, data);			\
+
	function(self, data);										\
+
	TREE_FORWARD_APPLY_ALL_##node##_##field(self->field.avl_right, function, data);			\
+
      }													\
+
  }													\
+
													\
+
  void TREE_REVERSE_APPLY_ALL_##node##_##field								\
+
    (struct node *self, void (*function)(struct node *node, void *data), void *data)			\
+
  {													\
+
    if (self)												\
+
      {													\
+
	TREE_REVERSE_APPLY_ALL_##node##_##field(self->field.avl_right, function, data);			\
+
	function(self, data);										\
+
	TREE_REVERSE_APPLY_ALL_##node##_##field(self->field.avl_left, function, data);			\
+
      }													\
+
  }
+

+
#define TREE_INSERT(head, node, field, elm)						\
+
  ((head)->th_root= TREE_INSERT_##node##_##field((head)->th_root, (elm), (head)->th_cmp))
+

+
#define TREE_FIND(head, node, field, elm)				\
+
  (TREE_FIND_##node##_##field((head)->th_root, (elm), (head)->th_cmp))
+

+
#define TREE_REMOVE(head, node, field, elm)						\
+
  ((head)->th_root= TREE_REMOVE_##node##_##field((head)->th_root, (elm), (head)->th_cmp))
+

+
#define TREE_DEPTH(head, field)			\
+
  ((head)->th_root->field.avl_height)
+

+
#define TREE_FORWARD_APPLY(head, node, field, function, data)	\
+
  TREE_FORWARD_APPLY_ALL_##node##_##field((head)->th_root, function, data)
+

+
#define TREE_REVERSE_APPLY(head, node, field, function, data)	\
+
  TREE_REVERSE_APPLY_ALL_##node##_##field((head)->th_root, function, data)
+

+
#define TREE_INIT(head, cmp) do {		\
+
    (head)->th_root= 0;				\
+
    (head)->th_cmp= (cmp);			\
+
  } while (0)
+

+

+
#endif /* __tree_h */
modified external/libucl/src/ucl_emitter.c
@@ -21,8 +21,16 @@
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#ifdef HAVE_CONFIG_H
+
#include "config.h"
+
#endif
+

+
#ifdef HAVE_FLOAT_H
#include <float.h>
+
#endif
+
#ifdef HAVE_MATH_H
#include <math.h>
+
#endif
#include "ucl.h"
#include "ucl_internal.h"
#include "ucl_chartable.h"
modified external/libucl/src/ucl_hash.c
@@ -21,6 +21,7 @@
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#include "ucl_internal.h"
#include "ucl_hash.h"
#include "utlist.h"

modified external/libucl/src/ucl_internal.h
@@ -24,18 +24,47 @@
#ifndef UCL_INTERNAL_H_
#define UCL_INTERNAL_H_

+
#ifdef HAVE_CONFIG_H
+
#include "config.h"
+
#endif
+

+
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-
#ifndef _WIN32
-
#include <sys/mman.h>
#endif
+

+
#ifdef HAVE_SYS_MMAN_H
+
# ifndef _WIN32
+
#  include <sys/mman.h>
+
# endif
+
#endif
+
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+
#endif
+
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
+
#endif

+
#ifdef HAVE_LIMITS_H
#include <limits.h>
+
#endif
+
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
+
#endif
+
#ifdef HAVE_ERRNO_H
#include <errno.h>
+
#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
+
#endif
+
#ifdef HAVE_CTYPE_H
#include <ctype.h>
+
#endif
+
#ifdef HAVE_STDIO_H
+
#include <stdio.h>
+
#endif
+
#ifdef HAVE_STRING_H
+
#include <string.h>
+
#endif

#include "utlist.h"
#include "utstring.h"
modified external/libucl/src/ucl_parser.c
@@ -662,7 +662,8 @@ ucl_maybe_parse_number (ucl_object_t *obj,
	}

	/* Now check endptr */
-
	if (endptr == NULL || ucl_lex_is_atom_end (*endptr) || *endptr == '\0') {
+
	if (endptr == NULL || ucl_lex_is_atom_end (*endptr) || *endptr == '\0' ||
+
			ucl_test_character (*endptr, UCL_CHARACTER_WHITESPACE_UNSAFE)) {
		p = endptr;
		goto set_obj;
	}
added external/libucl/src/ucl_schema.c
@@ -0,0 +1,595 @@
+
/*
+
 * Copyright (c) 2014, Vsevolod Stakhov
+
 *
+
 * All rights reserved.
+
 *
+
 * Redistribution and use in source and binary forms, with or without
+
 * modification, are permitted provided that the following conditions are met:
+
 *	 * Redistributions of source code must retain the above copyright
+
 *	   notice, this list of conditions and the following disclaimer.
+
 *	 * Redistributions in binary form must reproduce the above copyright
+
 *	   notice, this list of conditions and the following disclaimer in the
+
 *	   documentation and/or other materials provided with the distribution.
+
 *
+
 * THIS SOFTWARE IS PROVIDED BY AUTHOR ''AS IS'' AND ANY
+
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+
 * DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY
+
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
 */
+

+
#include "ucl.h"
+
#include "ucl_internal.h"
+
#include "tree.h"
+
#include "utlist.h"
+
#ifdef HAVE_STDARG_H
+
#include <stdarg.h>
+
#endif
+
#ifdef HAVE_STDIO_H
+
#include <stdio.h>
+
#endif
+

+
static bool
+
ucl_string_to_type (const char *input, ucl_type_t *res)
+
{
+
	if (strcasecmp (input, "object") == 0) {
+
		*res = UCL_OBJECT;
+
	}
+
	else if (strcasecmp (input, "array") == 0) {
+
		*res = UCL_ARRAY;
+
	}
+
	else if (strcasecmp (input, "integer") == 0) {
+
		*res = UCL_INT;
+
	}
+
	else if (strcasecmp (input, "number") == 0) {
+
		*res = UCL_FLOAT;
+
	}
+
	else if (strcasecmp (input, "string") == 0) {
+
		*res = UCL_STRING;
+
	}
+
	else if (strcasecmp (input, "boolean") == 0) {
+
		*res = UCL_BOOLEAN;
+
	}
+
	else if (strcasecmp (input, "null") == 0) {
+
		*res = UCL_NULL;
+
	}
+
	else {
+
		return false;
+
	}
+

+
	return true;
+
}
+

+
static const char *
+
ucl_object_type_to_string (ucl_type_t type)
+
{
+
	const char *res = "unknown";
+

+
	switch (type) {
+
	case UCL_OBJECT:
+
		res = "object";
+
		break;
+
	case UCL_ARRAY:
+
		res = "array";
+
		break;
+
	case UCL_INT:
+
		res = "integer";
+
		break;
+
	case UCL_FLOAT:
+
	case UCL_TIME:
+
		res = "number";
+
		break;
+
	case UCL_STRING:
+
		res = "string";
+
		break;
+
	case UCL_BOOLEAN:
+
		res = "boolean";
+
		break;
+
	case UCL_NULL:
+
	case UCL_USERDATA:
+
		res = "null";
+
		break;
+
	}
+

+
	return res;
+
}
+

+
/*
+
 * Create validation error
+
 */
+
static void
+
ucl_schema_create_error (struct ucl_schema_error *err,
+
		enum ucl_schema_error_code code, ucl_object_t *obj,
+
		const char *fmt, ...)
+
{
+
	va_list va;
+

+
	if (err != NULL) {
+
		err->code = code;
+
		err->obj = obj;
+
		va_start (va, fmt);
+
		vsnprintf (err->msg, sizeof (err->msg), fmt, va);
+
		va_end (va);
+
	}
+
}
+

+
/*
+
 * Validate object
+
 */
+
static bool
+
ucl_schema_validate_object (ucl_object_t *schema,
+
		ucl_object_t *obj, struct ucl_schema_error *err)
+
{
+
	ucl_object_t *elt, *prop, *found, *additional_schema = NULL,
+
			*required = NULL;
+
	ucl_object_iter_t iter = NULL, piter = NULL;
+
	bool ret = true, allow_additional = true;
+
	int64_t minmax;
+

+
	while (ret && (elt = ucl_iterate_object (schema, &iter, true)) != NULL) {
+
		if (elt->type == UCL_OBJECT &&
+
				strcmp (ucl_object_key (elt), "properties") == 0) {
+
			while (ret && (prop = ucl_iterate_object (elt, &piter, true)) != NULL) {
+
				found = ucl_object_find_key (obj, ucl_object_key (prop));
+
				if (found) {
+
					ret = ucl_object_validate (prop, found, err);
+
				}
+
			}
+
		}
+
		else if (strcmp (ucl_object_key (elt), "additionalProperties") == 0) {
+
			if (elt->type == UCL_BOOLEAN) {
+
				if (!ucl_object_toboolean (elt)) {
+
					/* Deny additional fields completely */
+
					allow_additional = false;
+
				}
+
			}
+
			else if (elt->type == UCL_OBJECT) {
+
				/* Define validator for additional fields */
+
				additional_schema = elt;
+
			}
+
			else {
+
				ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, elt,
+
						"additionalProperties attribute is invalid in schema");
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if (strcmp (ucl_object_key (elt), "required") == 0) {
+
			if (elt->type == UCL_ARRAY) {
+
				required = elt;
+
			}
+
			else {
+
				ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, elt,
+
						"required attribute is invalid in schema");
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if (strcmp (ucl_object_key (elt), "minProperties") == 0
+
				&& ucl_object_toint_safe (elt, &minmax)) {
+
			if (obj->len < minmax) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
						"object has not enough properties: %u, minimum is: %u",
+
						obj->len, (unsigned)minmax);
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if (strcmp (ucl_object_key (elt), "maxProperties") == 0
+
				&& ucl_object_toint_safe (elt, &minmax)) {
+
			if (obj->len > minmax) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
						"object has too many properties: %u, maximum is: %u",
+
						obj->len, (unsigned)minmax);
+
				ret = false;
+
				break;
+
			}
+
		}
+
		/* XXX: propertyPatterns */
+
	}
+

+
	if (ret) {
+
		/* Additional properties */
+
		if (!allow_additional || additional_schema != NULL) {
+
			/* Check if we have exactly the same properties in schema and object */
+
			iter = NULL;
+
			prop = ucl_object_find_key (schema, "properties");
+
			while ((elt = ucl_iterate_object (obj, &iter, true)) != NULL) {
+
				if (prop == NULL ||
+
					(found = ucl_object_find_key (prop, ucl_object_key (elt))) == NULL) {
+
					if (!allow_additional) {
+
						ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
								"object has undefined property %s",
+
								ucl_object_key (elt));
+
						ret = false;
+
						break;
+
					}
+
					else if (additional_schema != NULL) {
+
						if (!ucl_object_validate (additional_schema, elt, err)) {
+
							ret = false;
+
							break;
+
						}
+
					}
+
				}
+
			}
+
		}
+
		/* Required properties */
+
		if (required != NULL) {
+
			iter = NULL;
+
			while ((elt = ucl_iterate_object (required, &iter, true)) != NULL) {
+
				if (ucl_object_find_key (obj, ucl_object_tostring (elt)) == NULL) {
+
					ucl_schema_create_error (err, UCL_SCHEMA_MISSING_PROPERTY, obj,
+
							"object has missing property %s",
+
							ucl_object_tostring (elt));
+
					ret = false;
+
					break;
+
				}
+
			}
+
		}
+
	}
+

+

+
	return ret;
+
}
+

+
static bool
+
ucl_schema_validate_number (ucl_object_t *schema,
+
		ucl_object_t *obj, struct ucl_schema_error *err)
+
{
+
	ucl_object_t *elt, *test;
+
	ucl_object_iter_t iter = NULL;
+
	bool ret = true, exclusive = false;
+
	double constraint, val;
+

+
	while (ret && (elt = ucl_iterate_object (schema, &iter, true)) != NULL) {
+
		if (elt->type == UCL_INT &&
+
			strcmp (ucl_object_key (elt), "multipleOf") == 0) {
+
			val = ucl_object_toint (elt);
+
			if (val <= 0) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, elt,
+
						"multipleOf must be greater than zero");
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) &&
+
			strcmp (ucl_object_key (elt), "maximum") == 0) {
+
			constraint = ucl_object_todouble (elt);
+
			test = ucl_object_find_key (schema, "exclusiveMaximum");
+
			if (test && test->type == UCL_BOOLEAN) {
+
				exclusive = ucl_object_toboolean (test);
+
			}
+
			val = ucl_object_todouble (obj);
+
			if (val > constraint || (exclusive && val >= constraint)) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
						"number is too big: %.3f, maximum is: %.3f",
+
						val, constraint);
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) &&
+
				strcmp (ucl_object_key (elt), "minimum") == 0) {
+
			constraint = ucl_object_todouble (elt);
+
			test = ucl_object_find_key (schema, "exclusiveMinimum");
+
			if (test && test->type == UCL_BOOLEAN) {
+
				exclusive = ucl_object_toboolean (test);
+
			}
+
			val = ucl_object_todouble (obj);
+
			if (val < constraint || (exclusive && val <= constraint)) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
						"number is too small: %.3f, minimum is: %.3f",
+
						val, constraint);
+
				ret = false;
+
				break;
+
			}
+
		}
+
	}
+

+
	return ret;
+
}
+

+
static bool
+
ucl_schema_validate_string (ucl_object_t *schema,
+
		ucl_object_t *obj, struct ucl_schema_error *err)
+
{
+
	ucl_object_t *elt;
+
	ucl_object_iter_t iter = NULL;
+
	bool ret = true;
+
	int64_t constraint;
+

+
	while (ret && (elt = ucl_iterate_object (schema, &iter, true)) != NULL) {
+
		if (elt->type == UCL_INT &&
+
			strcmp (ucl_object_key (elt), "maxLength") == 0) {
+
			constraint = ucl_object_toint (elt);
+
			if (obj->len > constraint) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
						"string is too big: %.3f, maximum is: %.3f",
+
						obj->len, constraint);
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if (elt->type == UCL_INT &&
+
				strcmp (ucl_object_key (elt), "minLength") == 0) {
+
			constraint = ucl_object_toint (elt);
+
			if (obj->len < constraint) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
						"string is too short: %.3f, minimum is: %.3f",
+
						obj->len, constraint);
+
				ret = false;
+
				break;
+
			}
+
		}
+
		/* XXX: pattern */
+
	}
+

+
	return ret;
+
}
+

+
struct ucl_compare_node {
+
	ucl_object_t *obj;
+
	TREE_ENTRY(ucl_compare_node) link;
+
	struct ucl_compare_node *next;
+
};
+

+
typedef TREE_HEAD(_tree, ucl_compare_node) ucl_compare_tree_t;
+

+
TREE_DEFINE(ucl_compare_node, link)
+

+
static int
+
ucl_schema_elt_compare (struct ucl_compare_node *n1, struct ucl_compare_node *n2)
+
{
+
	ucl_object_t *o1 = n1->obj, *o2 = n2->obj;
+

+
	return ucl_object_compare (o1, o2);
+
}
+

+
static bool
+
ucl_schema_array_is_unique (ucl_object_t *obj, struct ucl_schema_error *err)
+
{
+
	ucl_compare_tree_t tree = TREE_INITIALIZER (ucl_schema_elt_compare);
+
	ucl_object_iter_t iter = NULL;
+
	ucl_object_t *elt;
+
	struct ucl_compare_node *node, test, *nodes = NULL, *tmp;
+
	bool ret = true;
+

+
	while ((elt = ucl_iterate_object (obj, &iter, true)) != NULL) {
+
		test.obj = elt;
+
		node = TREE_FIND (&tree, ucl_compare_node, link, &test);
+
		if (node != NULL) {
+
			ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, elt,
+
					"duplicate values detected while uniqueItems is true");
+
			ret = false;
+
			break;
+
		}
+
		node = calloc (1, sizeof (*node));
+
		if (node == NULL) {
+
			ucl_schema_create_error (err, UCL_SCHEMA_UNKNOWN, elt,
+
					"cannot allocate tree node");
+
			ret = false;
+
			break;
+
		}
+
		node->obj = elt;
+
		TREE_INSERT (&tree, ucl_compare_node, link, node);
+
		LL_PREPEND (nodes, node);
+
	}
+

+
	LL_FOREACH_SAFE (nodes, node, tmp) {
+
		free (node);
+
	}
+

+
	return ret;
+
}
+

+
static bool
+
ucl_schema_validate_array (ucl_object_t *schema,
+
		ucl_object_t *obj, struct ucl_schema_error *err)
+
{
+
	ucl_object_t *elt, *it, *found, *additional_schema = NULL,
+
			*first_unvalidated = NULL;
+
	ucl_object_iter_t iter = NULL, piter = NULL;
+
	bool ret = true, allow_additional = true, need_unique = false;
+
	int64_t minmax;
+

+
	while (ret && (elt = ucl_iterate_object (schema, &iter, true)) != NULL) {
+
		if (strcmp (ucl_object_key (elt), "items") == 0) {
+
			if (elt->type == UCL_ARRAY) {
+
				found = obj->value.av;
+
				while (ret && (it = ucl_iterate_object (elt, &piter, true)) != NULL) {
+
					if (found) {
+
						ret = ucl_object_validate (it, found, err);
+
						found = found->next;
+
					}
+
				}
+
				if (found != NULL) {
+
					/* The first element that is not validated */
+
					first_unvalidated = found;
+
				}
+
			}
+
			else if (elt->type == UCL_OBJECT) {
+
				/* Validate all items using the specified schema */
+
				while (ret && (it = ucl_iterate_object (obj, &piter, true)) != NULL) {
+
					ret = ucl_object_validate (elt, it, err);
+
				}
+
			}
+
			else {
+
				ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, elt,
+
						"items attribute is invalid in schema");
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if (strcmp (ucl_object_key (elt), "additionalItems") == 0) {
+
			if (elt->type == UCL_BOOLEAN) {
+
				if (!ucl_object_toboolean (elt)) {
+
					/* Deny additional fields completely */
+
					allow_additional = false;
+
				}
+
			}
+
			else if (elt->type == UCL_OBJECT) {
+
				/* Define validator for additional fields */
+
				additional_schema = elt;
+
			}
+
			else {
+
				ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, elt,
+
						"additionalItems attribute is invalid in schema");
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if (elt->type == UCL_BOOLEAN &&
+
				strcmp (ucl_object_key (elt), "uniqueItems") == 0) {
+
			need_unique = ucl_object_toboolean (elt);
+
		}
+
		else if (strcmp (ucl_object_key (elt), "minItems") == 0
+
				&& ucl_object_toint_safe (elt, &minmax)) {
+
			if (obj->len < minmax) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
						"array has not enough items: %u, minimum is: %u",
+
						obj->len, (unsigned)minmax);
+
				ret = false;
+
				break;
+
			}
+
		}
+
		else if (strcmp (ucl_object_key (elt), "maxItems") == 0
+
				&& ucl_object_toint_safe (elt, &minmax)) {
+
			if (obj->len > minmax) {
+
				ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
						"array has too many items: %u, maximum is: %u",
+
						obj->len, (unsigned)minmax);
+
				ret = false;
+
				break;
+
			}
+
		}
+
	}
+

+
	if (ret) {
+
		/* Additional properties */
+
		if (!allow_additional || additional_schema != NULL) {
+
			if (first_unvalidated != NULL) {
+
				if (!allow_additional) {
+
					ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
+
							"object has undefined property %s",
+
							ucl_object_key (elt));
+
					ret = false;
+
				}
+
				else if (additional_schema != NULL) {
+
					elt = first_unvalidated;
+
					while (elt) {
+
						if (!ucl_object_validate (additional_schema, elt, err)) {
+
							ret = false;
+
							break;
+
						}
+
						elt = elt->next;
+
					}
+
				}
+
			}
+
		}
+
		/* Required properties */
+
		if (ret && need_unique) {
+
			ret = ucl_schema_array_is_unique (obj, err);
+
		}
+
	}
+

+
	return ret;
+
}
+

+
/*
+
 * Returns whether this object is allowed for this type
+
 */
+
static bool
+
ucl_schema_type_is_allowed (ucl_object_t *type, ucl_object_t *obj,
+
		struct ucl_schema_error *err)
+
{
+
	ucl_object_iter_t iter = NULL;
+
	ucl_object_t *elt;
+
	const char *type_str;
+
	ucl_type_t t;
+

+
	if (type == NULL) {
+
		/* Any type is allowed */
+
		return true;
+
	}
+

+
	if (type->type == UCL_ARRAY) {
+
		/* One of allowed types */
+
		while ((elt = ucl_iterate_object (type, &iter, true)) != NULL) {
+
			if (ucl_schema_type_is_allowed (elt, obj, err)) {
+
				return true;
+
			}
+
		}
+
	}
+
	else if (type->type == UCL_STRING) {
+
		type_str = ucl_object_tostring (type);
+
		if (!ucl_string_to_type (type_str, &t)) {
+
			ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, type,
+
					"Type attribute is invalid in schema");
+
			return false;
+
		}
+
		if (obj->type != t) {
+
			/* Some types are actually compatible */
+
			if (obj->type == UCL_TIME && t == UCL_FLOAT) {
+
				return true;
+
			}
+
			else if (obj->type == UCL_INT && t == UCL_FLOAT) {
+
				return true;
+
			}
+
			else {
+
				ucl_schema_create_error (err, UCL_SCHEMA_TYPE_MISMATCH, obj,
+
						"Invalid type of %s, expected %s",
+
						ucl_object_type_to_string (obj->type),
+
						ucl_object_type_to_string (t));
+
			}
+
		}
+
		else {
+
			/* Types are equal */
+
			return true;
+
		}
+
	}
+

+
	return false;
+
}
+

+
bool
+
ucl_object_validate (ucl_object_t *schema,
+
		ucl_object_t *obj, struct ucl_schema_error *err)
+
{
+
	ucl_object_t *elt;
+

+
	if (schema->type != UCL_OBJECT) {
+
		ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, schema,
+
				"schema is %s instead of object", ucl_object_type_to_string (schema->type));
+
		return false;
+
	}
+
	elt = ucl_object_find_key (schema, "type");
+

+
	if (!ucl_schema_type_is_allowed (elt, obj, err)) {
+
		return false;
+
	}
+

+
	switch (obj->type) {
+
	case UCL_OBJECT:
+
		return ucl_schema_validate_object (schema, obj, err);
+
		break;
+
	case UCL_ARRAY:
+
		return ucl_schema_validate_array (schema, obj, err);
+
		break;
+
	case UCL_INT:
+
	case UCL_FLOAT:
+
		return ucl_schema_validate_number (schema, obj, err);
+
		break;
+
	case UCL_STRING:
+
		return ucl_schema_validate_string (schema, obj, err);
+
		break;
+
	default:
+
		break;
+
	}
+

+
	return true;
+
}
modified external/libucl/src/ucl_util.c
@@ -25,7 +25,9 @@
#include "ucl_internal.h"
#include "ucl_chartable.h"

+
#ifdef HAVE_LIBGEN_H
#include <libgen.h> /* For dirname */
+
#endif

#ifdef HAVE_OPENSSL
#include <openssl/err.h>
@@ -35,6 +37,13 @@
#include <openssl/evp.h>
#endif

+
#ifdef CURL_FOUND
+
#include <curl/curl.h>
+
#endif
+
#ifdef HAVE_FETCH_H
+
#include <fetch.h>
+
#endif
+

#ifdef _WIN32
#include <windows.h>

@@ -1130,6 +1139,7 @@ ucl_object_insert_key_common (ucl_object_t *top, ucl_object_t *elt,
	if (!found) {
		top->value.ov = ucl_hash_insert_object (top->value.ov, elt);
		DL_APPEND (found, elt);
+
		top->len ++;
	}
	else {
		if (replace) {
@@ -1736,3 +1746,86 @@ ucl_object_unref (ucl_object_t *obj)
		ucl_object_free (obj);
	}
}
+

+
int
+
ucl_object_compare (ucl_object_t *o1, ucl_object_t *o2)
+
{
+
	ucl_object_t *it1, *it2;
+
	ucl_object_iter_t iter = NULL;
+
	int ret = 0;
+

+
	if (o1->type != o2->type) {
+
		return (o1->type) - (o2->type);
+
	}
+

+
	switch (o1->type) {
+
	case UCL_STRING:
+
		if (o1->len == o2->len) {
+
			ret = strcmp (ucl_object_tostring(o1), ucl_object_tostring(o2));
+
		}
+
		else {
+
			ret = o1->len - o2->len;
+
		}
+
		break;
+
	case UCL_FLOAT:
+
	case UCL_INT:
+
	case UCL_TIME:
+
		ret = ucl_object_todouble (o1) - ucl_object_todouble (o2);
+
		break;
+
	case UCL_BOOLEAN:
+
		ret = ucl_object_toboolean (o1) - ucl_object_toboolean (o2);
+
		break;
+
	case UCL_ARRAY:
+
		if (o1->len == o2->len) {
+
			it1 = o1->value.av;
+
			it2 = o2->value.av;
+
			/* Compare all elements in both arrays */
+
			while (it1 != NULL && it2 != NULL) {
+
				ret = ucl_object_compare (it1, it2);
+
				if (ret != 0) {
+
					break;
+
				}
+
				it1 = it1->next;
+
				it2 = it2->next;
+
			}
+
		}
+
		else {
+
			ret = o1->len - o2->len;
+
		}
+
		break;
+
	case UCL_OBJECT:
+
		if (o1->len == o2->len) {
+
			while ((it1 = ucl_iterate_object (o1, &iter, true)) != NULL) {
+
				it2 = ucl_object_find_key (o2, ucl_object_key (it1));
+
				if (it2 == NULL) {
+
					ret = 1;
+
					break;
+
				}
+
				ret = ucl_object_compare (it1, it2);
+
				if (ret != 0) {
+
					break;
+
				}
+
			}
+
		}
+
		else {
+
			ret = o1->len - o2->len;
+
		}
+
		break;
+
	default:
+
		ret = 0;
+
		break;
+
	}
+

+
	return ret;
+
}
+

+
void
+
ucl_object_array_sort (ucl_object_t *ar,
+
		int (*cmp)(ucl_object_t *o1, ucl_object_t *o2))
+
{
+
	if (cmp == NULL || ar == NULL || ar->type != UCL_ARRAY) {
+
		return;
+
	}
+

+
	DL_SORT (ar->value.av, cmp);
+
}
added external/libucl/stamp-h.in
@@ -0,0 +1 @@
+
timestamp
deleted external/libucl/tests/1.in
@@ -1,14 +0,0 @@
-
{
-
"key1": value;
-
"key1": value2;
-
"key1": "value;"
-
"key1": 1.0,
-
"key1": -0xdeadbeef
-
"key1": 0xdeadbeef.1
-
"key1": 0xreadbeef
-
"key1": -1e-10,
-
"key1": 1
-
"key1": true
-
"key1": no
-
"key1": yes
-
}
deleted external/libucl/tests/1.res
@@ -1,13 +0,0 @@
-
key1 = "value";
-
key1 = "value2";
-
key1 = "value;";
-
key1 = 1.0;
-
key1 = -3735928559;
-
key1 = "0xdeadbeef.1";
-
key1 = "0xreadbeef";
-
key1 = -1e-10;
-
key1 = 1;
-
key1 = true;
-
key1 = false;
-
key1 = true;
-

deleted external/libucl/tests/2.in
@@ -1,24 +0,0 @@
-
section1 { param1 = value; param2 = value, 
-
section3 {param = value; param2 = value, param3 = ["value1", value2, 100500]}}
-
section2 { param1 = {key = value}, param1 = ["key"]}
-

-
# Numbers
-
key1 = 1s
-
key2 = 1min
-
key3 = 1kb
-
key4 = 5M
-
key5 = 10mS
-
key6 = 10y
-

-
# Strings
-
key1 = "some string";
-
key2 = /some/path;
-
key3 = 111some,
-
key4: s1,
-
"key5": "\n\r123"
-

-
# Variables
-
keyvar = "$ABItest";
-
keyvar = "${ABI}$ABI${ABI}${$ABI}";
-
keyvar = "${some}$no${}$$test$$$$$$$";
-
keyvar = "$ABI$$ABI$$$ABI$$$$";
deleted external/libucl/tests/2.res
@@ -1,37 +0,0 @@
-
section1 {
-
    param1 = "value";
-
    param2 = "value";
-
    section3 {
-
        param = "value";
-
        param2 = "value";
-
        param3 [
-
            "value1",
-
            "value2",
-
            100500,
-
        ]
-
    }
-
}
-
section2 {
-
    param1 {
-
        key = "value";
-
    }
-
    param1 [
-
        "key",
-
    ]
-
}
-
key1 = 1.0;
-
key1 = "some string";
-
key2 = 60.0;
-
key2 = "/some/path";
-
key3 = 1024;
-
key3 = "111some";
-
key4 = 5000000;
-
key4 = "s1";
-
key5 = 0.010000;
-
key5 = "\n\r123";
-
key6 = 2207520000.000000;
-
keyvar = "unknowntest";
-
keyvar = "unknownunknownunknown${unknown}";
-
keyvar = "${some}$no${}$$test$$$$$$$";
-
keyvar = "unknown$ABI$unknown$$";
-

deleted external/libucl/tests/3.in
@@ -1,31 +0,0 @@
-
/*
-
 * Pkg conf
-
 */
-

-
#packagesite http//pkg.freebsd.org/freebsd-9-amd64/latest
-
#packagesite http//pkg.freebsd.org/freebsd-9-amd64/latest
-
packagesite: http://pkg-test.freebsd.org/pkg-test/${ABI}/latest
-
squaretest: some[]value
-
ALIAS             : {
-
  all-depends: query %dn-%dv,
-
  annotations: info -A,
-
  build-depends: info -qd,
-
  download: fetch,
-
  iinfo: info -i -g -x,
-
  isearch: search -i -g -x,
-
  leaf: query -e '%a == 0' '%n-%v',
-
  leaf: query -e '%a == 0' '%n-%v',
-
  list: info -ql,
-
  origin: info -qo,
-
  provided-depends: info -qb,
-
  raw: info -R,
-
  required-depends: info -qr,
-
  shared-depends: info -qB,
-
  show: info -f -k,
-
  size: info -sq,
-
  }
-

-
repo_dirs : [
-
  /home/bapt,
-
  /usr/local/etc
-
]
deleted external/libucl/tests/3.res
@@ -1,25 +0,0 @@
-
packagesite = "http://pkg-test.freebsd.org/pkg-test/unknown/latest";
-
squaretest = "some[]value";
-
alias {
-
    all-depends = "query %dn-%dv";
-
    annotations = "info -A";
-
    build-depends = "info -qd";
-
    download = "fetch";
-
    iinfo = "info -i -g -x";
-
    isearch = "search -i -g -x";
-
    leaf = "query -e '%a == 0' '%n-%v'";
-
    leaf = "query -e '%a == 0' '%n-%v'";
-
    list = "info -ql";
-
    origin = "info -qo";
-
    provided-depends = "info -qb";
-
    raw = "info -R";
-
    required-depends = "info -qr";
-
    shared-depends = "info -qB";
-
    show = "info -f -k";
-
    size = "info -sq";
-
}
-
repo_dirs [
-
    "/home/bapt",
-
    "/usr/local/etc",
-
]
-

deleted external/libucl/tests/4.in
@@ -1,47 +0,0 @@
-
name : "pkgconf"
-
version : "0.9.3"
-
origin : "devel/pkgconf"
-
comment : "Utility to help to configure compiler and linker flags"
-
arch : "freebsd:9:x86:64"
-
maintainer : "bapt@FreeBSD.org"
-
prefix : "/usr/local"
-
licenselogic : "single"
-
licenses : [
-
    "BSD",
-
]
-
flatsize : 60523
-
desc : "pkgconf is a program which helps to configure compiler and linker flags for\ndevelopment frameworks. It is similar to pkg-config, but was written from\nscratch in Summer of 2011 to replace pkg-config, which now needs itself to build\nitself.\n\nWWW: https://github.com/pkgconf/pkgconf"
-
categories : [
-
    "devel",
-
]
-
files : {
-
    /usr/local/bin/pkg-config : "-",
-
    /usr/local/bin/pkgconf : "4a0fc53e5ad64e8085da2e61652d61c50b192a086421d865703f1de9f724da38",
-
    /usr/local/share/aclocal/pkg.m4 : "cffab33d659adfe36497ec57665eec36fa6fb7b007e578e6ac2434cc28be8820",
-
    /usr/local/share/licenses/pkgconf-0.9.3/BSD : "85e7a53b5e2d3e350e2d084fed2f94b7f63005f8e1168740e1e84aa9fa5d48ce",
-
    /usr/local/share/licenses/pkgconf-0.9.3/LICENSE : "d9cce0db43502eb1bd8fbef7e960cfaa43b5647186f7f7379923b336209fd77b",
-
    /usr/local/share/licenses/pkgconf-0.9.3/catalog.mk : "e7b131acce7c3d3c61f2214607b11b34526e03b05afe89a608f50586a898e2ef",
-
}
-
directories : {
-
    /usr/local/share/licenses/pkgconf-0.9.3/ : false,
-
    /usr/local/share/licenses/ : true,
-
}
-
scripts : {
-
    post-install : "cd /usr/local\nn",
-
    pre-deinstall : "cd /usr/local\nn",
-
    post-deinstall : "cd /usr/local\nn",
-
}
-
multiline-key : <<EOD
-
test
-
test
-
test\n
-
/* comment like */
-
# Some invalid endings
-
 EOD
-
EOD   
-
EOF
-
# Valid ending + empty string
-

-
EOD
-

-
normal-key : <<EODnot
deleted external/libucl/tests/4.res
@@ -1,36 +0,0 @@
-
name = "pkgconf";
-
version = "0.9.3";
-
origin = "devel/pkgconf";
-
comment = "Utility to help to configure compiler and linker flags";
-
arch = "freebsd:9:x86:64";
-
maintainer = "bapt@FreeBSD.org";
-
prefix = "/usr/local";
-
licenselogic = "single";
-
licenses [
-
    "BSD",
-
]
-
flatsize = 60523;
-
desc = "pkgconf is a program which helps to configure compiler and linker flags for\ndevelopment frameworks. It is similar to pkg-config, but was written from\nscratch in Summer of 2011 to replace pkg-config, which now needs itself to build\nitself.\n\nWWW: https://github.com/pkgconf/pkgconf";
-
categories [
-
    "devel",
-
]
-
files {
-
    /usr/local/bin/pkg-config = "-";
-
    /usr/local/bin/pkgconf = "4a0fc53e5ad64e8085da2e61652d61c50b192a086421d865703f1de9f724da38";
-
    /usr/local/share/aclocal/pkg.m4 = "cffab33d659adfe36497ec57665eec36fa6fb7b007e578e6ac2434cc28be8820";
-
    /usr/local/share/licenses/pkgconf-0.9.3/bsd = "85e7a53b5e2d3e350e2d084fed2f94b7f63005f8e1168740e1e84aa9fa5d48ce";
-
    /usr/local/share/licenses/pkgconf-0.9.3/license = "d9cce0db43502eb1bd8fbef7e960cfaa43b5647186f7f7379923b336209fd77b";
-
    /usr/local/share/licenses/pkgconf-0.9.3/catalog.mk = "e7b131acce7c3d3c61f2214607b11b34526e03b05afe89a608f50586a898e2ef";
-
}
-
directories {
-
    /usr/local/share/licenses/pkgconf-0.9.3/ = false;
-
    /usr/local/share/licenses/ = true;
-
}
-
scripts {
-
    post-install = "cd /usr/local\nn";
-
    pre-deinstall = "cd /usr/local\nn";
-
    post-deinstall = "cd /usr/local\nn";
-
}
-
multiline-key = "test\ntest\ntest\\n\n/* comment like */\n# Some invalid endings\n EOD\nEOD   \nEOF\n# Valid ending + empty string\n";
-
normal-key = "<<EODnot";
-

deleted external/libucl/tests/6.in
@@ -1,4 +0,0 @@
-

-
# test
-
#
-
key = value
deleted external/libucl/tests/6.res
@@ -1,2 +0,0 @@
-
key = "value";
-

deleted external/libucl/tests/8.in
@@ -1,23 +0,0 @@
-
section blah { # test
-
	param = "value"
-
}
-
section test {
-
	key = test;
-
	subsection testsub {
-
		flag on;
-
		subsubsection testsubsub1 testsubsub2 {
-
			key = [1, 2, 3];
-
		}
-
	}
-
}
-

-
section test {
-
	/* Empty */
-
}
-

-

-
section foo { # test
-
	param = 123.2;
-
}
-

-
array = []
deleted external/libucl/tests/8.res
@@ -1,38 +0,0 @@
-
section {
-
    blah {
-
        param = "value";
-
    }
-
}
-
section {
-
    test {
-
        key = "test";
-
        subsection {
-
            testsub {
-
                flag = true;
-
                subsubsection {
-
                    testsubsub1 {
-
                        testsubsub2 {
-
                            key [
-
                                1,
-
                                2,
-
                                3,
-
                            ]
-
                        }
-
                    }
-
                }
-
            }
-
        }
-
    }
-
}
-
section {
-
    test {
-
    }
-
}
-
section {
-
    foo {
-
        param = 123.200000;
-
    }
-
}
-
array [
-
]
-

deleted external/libucl/tests/9-comment.inc
@@ -1 +0,0 @@
-
#key = value
deleted external/libucl/tests/9-empty.inc
deleted external/libucl/tests/9.in
@@ -1,12 +0,0 @@
-
.include "$CURDIR/9.inc"
-
.include "$CURDIR/9-comment.inc"
-
#.include "$CURDIR/9.inc"
-
.include "$CURDIR/9.inc"
-

-
key = value;
-
.include "$CURDIR/9.inc"
-

-
.try_include "/non/existent"
-
#.try_include "$CURDIR/9.incorrect.inc"
-
# 9.incorrect.inc contains '{}}'
-
#key = value;
deleted external/libucl/tests/9.inc
@@ -1 +0,0 @@
-
key1 = value
deleted external/libucl/tests/9.res
@@ -1,5 +0,0 @@
-
key1 = "value";
-
key1 = "value";
-
key1 = "value";
-
key = "value";
-

added external/libucl/tests/Makefile.am
@@ -0,0 +1,28 @@
+
TESTS = basic.test \
+
		generate.test \
+
		schema.test \
+
		speed.test
+
TESTS_ENVIRONMENT = $(SH) TEST_DIR=$(top_srcdir)/tests
+

+
common_test_cflags = -I$(top_srcdir)/include \
+
					-I$(top_srcdir)/src \
+
					-I$(top_srcdir)/uthash
+
common_test_ldadd = $(top_builddir)/src/libucl.la
+

+
test_basic_SOURCES = test_basic.c
+
test_basic_LDADD = $(common_test_ldadd)
+
test_basic_CFLAGS = $(common_test_cflags)
+

+
test_speed_SOURCES = test_speed.c
+
test_speed_LDADD = $(common_test_ldadd)
+
test_speed_CFLAGS = $(common_test_cflags)
+

+
test_generate_SOURCES = test_generate.c
+
test_generate_LDADD = $(common_test_ldadd)
+
test_generate_CFLAGS = $(common_test_cflags)
+

+
test_schema_SOURCES = test_generate.c
+
test_schema_LDADD = $(common_test_ldadd)
+
test_schema_CFLAGS = $(common_test_cflags)
+

+
check_PROGRAMS = test_basic test_speed test_generate test_schema

\ No newline at end of file
added external/libucl/tests/basic.test
@@ -0,0 +1,25 @@
+
#!/bin/sh
+

+
PROG=test_basic
+

+
for _tin in ${TEST_DIR}/basic/*.in ; do
+
	_t=`echo $_tin | sed -e 's/.in$//'`
+
	$PROG $_t.in $_t.out
+
	if [ $? -ne 0 ] ; then
+
		echo "Test: $_t failed, output:"
+
		cat $_t.out
+
		rm $_t.out
+
		exit 1
+
	fi
+
	if [ -f $_t.res ] ; then
+
	diff -s $_t.out $_t.res -u 2>/dev/null
+
		if [ $? -ne 0 ] ; then
+
			rm $_t.out
+
			echo "Test: $_t output missmatch"
+
			exit 1
+
		fi
+
	fi
+
	rm $_t.out
+
done
+

+

added external/libucl/tests/basic/1.in
@@ -0,0 +1,14 @@
+
{
+
"key1": value;
+
"key1": value2;
+
"key1": "value;"
+
"key1": 1.0,
+
"key1": -0xdeadbeef
+
"key1": 0xdeadbeef.1
+
"key1": 0xreadbeef
+
"key1": -1e-10,
+
"key1": 1
+
"key1": true
+
"key1": no
+
"key1": yes
+
}
added external/libucl/tests/basic/1.res
@@ -0,0 +1,13 @@
+
key1 = "value";
+
key1 = "value2";
+
key1 = "value;";
+
key1 = 1.0;
+
key1 = -3735928559;
+
key1 = "0xdeadbeef.1";
+
key1 = "0xreadbeef";
+
key1 = -1e-10;
+
key1 = 1;
+
key1 = true;
+
key1 = false;
+
key1 = true;
+

added external/libucl/tests/basic/10.in
@@ -0,0 +1,9 @@
+
section foo bar {
+
	  key = value
+
}
+
section foo baz {
+
	  key = value
+
}
+
section foo {
+
	  bar = lol /* removing this line makes parsing successful */
+
}
added external/libucl/tests/basic/2.in
@@ -0,0 +1,24 @@
+
section1 { param1 = value; param2 = value, 
+
section3 {param = value; param2 = value, param3 = ["value1", value2, 100500]}}
+
section2 { param1 = {key = value}, param1 = ["key"]}
+

+
# Numbers
+
key1 = 1s
+
key2 = 1min
+
key3 = 1kb
+
key4 = 5M
+
key5 = 10mS
+
key6 = 10y
+

+
# Strings
+
key1 = "some string";
+
key2 = /some/path;
+
key3 = 111some,
+
key4: s1,
+
"key5": "\n\r123"
+

+
# Variables
+
keyvar = "$ABItest";
+
keyvar = "${ABI}$ABI${ABI}${$ABI}";
+
keyvar = "${some}$no${}$$test$$$$$$$";
+
keyvar = "$ABI$$ABI$$$ABI$$$$";
added external/libucl/tests/basic/2.res
@@ -0,0 +1,37 @@
+
section1 {
+
    param1 = "value";
+
    param2 = "value";
+
    section3 {
+
        param = "value";
+
        param2 = "value";
+
        param3 [
+
            "value1",
+
            "value2",
+
            100500,
+
        ]
+
    }
+
}
+
section2 {
+
    param1 {
+
        key = "value";
+
    }
+
    param1 [
+
        "key",
+
    ]
+
}
+
key1 = 1.0;
+
key1 = "some string";
+
key2 = 60.0;
+
key2 = "/some/path";
+
key3 = 1024;
+
key3 = "111some";
+
key4 = 5000000;
+
key4 = "s1";
+
key5 = 0.010000;
+
key5 = "\n\r123";
+
key6 = 2207520000.000000;
+
keyvar = "unknowntest";
+
keyvar = "unknownunknownunknown${unknown}";
+
keyvar = "${some}$no${}$$test$$$$$$$";
+
keyvar = "unknown$ABI$unknown$$";
+

added external/libucl/tests/basic/3.in
@@ -0,0 +1,31 @@
+
/*
+
 * Pkg conf
+
 */
+

+
#packagesite http//pkg.freebsd.org/freebsd-9-amd64/latest
+
#packagesite http//pkg.freebsd.org/freebsd-9-amd64/latest
+
packagesite: http://pkg-test.freebsd.org/pkg-test/${ABI}/latest
+
squaretest: some[]value
+
ALIAS             : {
+
  all-depends: query %dn-%dv,
+
  annotations: info -A,
+
  build-depends: info -qd,
+
  download: fetch,
+
  iinfo: info -i -g -x,
+
  isearch: search -i -g -x,
+
  leaf: query -e '%a == 0' '%n-%v',
+
  leaf: query -e '%a == 0' '%n-%v',
+
  list: info -ql,
+
  origin: info -qo,
+
  provided-depends: info -qb,
+
  raw: info -R,
+
  required-depends: info -qr,
+
  shared-depends: info -qB,
+
  show: info -f -k,
+
  size: info -sq,
+
  }
+

+
repo_dirs : [
+
  /home/bapt,
+
  /usr/local/etc
+
]
added external/libucl/tests/basic/3.res
@@ -0,0 +1,25 @@
+
packagesite = "http://pkg-test.freebsd.org/pkg-test/unknown/latest";
+
squaretest = "some[]value";
+
alias {
+
    all-depends = "query %dn-%dv";
+
    annotations = "info -A";
+
    build-depends = "info -qd";
+
    download = "fetch";
+
    iinfo = "info -i -g -x";
+
    isearch = "search -i -g -x";
+
    leaf = "query -e '%a == 0' '%n-%v'";
+
    leaf = "query -e '%a == 0' '%n-%v'";
+
    list = "info -ql";
+
    origin = "info -qo";
+
    provided-depends = "info -qb";
+
    raw = "info -R";
+
    required-depends = "info -qr";
+
    shared-depends = "info -qB";
+
    show = "info -f -k";
+
    size = "info -sq";
+
}
+
repo_dirs [
+
    "/home/bapt",
+
    "/usr/local/etc",
+
]
+

added external/libucl/tests/basic/4.in
@@ -0,0 +1,47 @@
+
name : "pkgconf"
+
version : "0.9.3"
+
origin : "devel/pkgconf"
+
comment : "Utility to help to configure compiler and linker flags"
+
arch : "freebsd:9:x86:64"
+
maintainer : "bapt@FreeBSD.org"
+
prefix : "/usr/local"
+
licenselogic : "single"
+
licenses : [
+
    "BSD",
+
]
+
flatsize : 60523
+
desc : "pkgconf is a program which helps to configure compiler and linker flags for\ndevelopment frameworks. It is similar to pkg-config, but was written from\nscratch in Summer of 2011 to replace pkg-config, which now needs itself to build\nitself.\n\nWWW: https://github.com/pkgconf/pkgconf"
+
categories : [
+
    "devel",
+
]
+
files : {
+
    /usr/local/bin/pkg-config : "-",
+
    /usr/local/bin/pkgconf : "4a0fc53e5ad64e8085da2e61652d61c50b192a086421d865703f1de9f724da38",
+
    /usr/local/share/aclocal/pkg.m4 : "cffab33d659adfe36497ec57665eec36fa6fb7b007e578e6ac2434cc28be8820",
+
    /usr/local/share/licenses/pkgconf-0.9.3/BSD : "85e7a53b5e2d3e350e2d084fed2f94b7f63005f8e1168740e1e84aa9fa5d48ce",
+
    /usr/local/share/licenses/pkgconf-0.9.3/LICENSE : "d9cce0db43502eb1bd8fbef7e960cfaa43b5647186f7f7379923b336209fd77b",
+
    /usr/local/share/licenses/pkgconf-0.9.3/catalog.mk : "e7b131acce7c3d3c61f2214607b11b34526e03b05afe89a608f50586a898e2ef",
+
}
+
directories : {
+
    /usr/local/share/licenses/pkgconf-0.9.3/ : false,
+
    /usr/local/share/licenses/ : true,
+
}
+
scripts : {
+
    post-install : "cd /usr/local\nn",
+
    pre-deinstall : "cd /usr/local\nn",
+
    post-deinstall : "cd /usr/local\nn",
+
}
+
multiline-key : <<EOD
+
test
+
test
+
test\n
+
/* comment like */
+
# Some invalid endings
+
 EOD
+
EOD   
+
EOF
+
# Valid ending + empty string
+

+
EOD
+

+
normal-key : <<EODnot
added external/libucl/tests/basic/4.res
@@ -0,0 +1,36 @@
+
name = "pkgconf";
+
version = "0.9.3";
+
origin = "devel/pkgconf";
+
comment = "Utility to help to configure compiler and linker flags";
+
arch = "freebsd:9:x86:64";
+
maintainer = "bapt@FreeBSD.org";
+
prefix = "/usr/local";
+
licenselogic = "single";
+
licenses [
+
    "BSD",
+
]
+
flatsize = 60523;
+
desc = "pkgconf is a program which helps to configure compiler and linker flags for\ndevelopment frameworks. It is similar to pkg-config, but was written from\nscratch in Summer of 2011 to replace pkg-config, which now needs itself to build\nitself.\n\nWWW: https://github.com/pkgconf/pkgconf";
+
categories [
+
    "devel",
+
]
+
files {
+
    /usr/local/bin/pkg-config = "-";
+
    /usr/local/bin/pkgconf = "4a0fc53e5ad64e8085da2e61652d61c50b192a086421d865703f1de9f724da38";
+
    /usr/local/share/aclocal/pkg.m4 = "cffab33d659adfe36497ec57665eec36fa6fb7b007e578e6ac2434cc28be8820";
+
    /usr/local/share/licenses/pkgconf-0.9.3/bsd = "85e7a53b5e2d3e350e2d084fed2f94b7f63005f8e1168740e1e84aa9fa5d48ce";
+
    /usr/local/share/licenses/pkgconf-0.9.3/license = "d9cce0db43502eb1bd8fbef7e960cfaa43b5647186f7f7379923b336209fd77b";
+
    /usr/local/share/licenses/pkgconf-0.9.3/catalog.mk = "e7b131acce7c3d3c61f2214607b11b34526e03b05afe89a608f50586a898e2ef";
+
}
+
directories {
+
    /usr/local/share/licenses/pkgconf-0.9.3/ = false;
+
    /usr/local/share/licenses/ = true;
+
}
+
scripts {
+
    post-install = "cd /usr/local\nn";
+
    pre-deinstall = "cd /usr/local\nn";
+
    post-deinstall = "cd /usr/local\nn";
+
}
+
multiline-key = "test\ntest\ntest\\n\n/* comment like */\n# Some invalid endings\n EOD\nEOD   \nEOF\n# Valid ending + empty string\n";
+
normal-key = "<<EODnot";
+

added external/libucl/tests/basic/6.in
@@ -0,0 +1,4 @@
+

+
# test
+
#
+
key = value
added external/libucl/tests/basic/6.res
@@ -0,0 +1,2 @@
+
key = "value";
+

added external/libucl/tests/basic/8.in
@@ -0,0 +1,23 @@
+
section blah { # test
+
	param = "value"
+
}
+
section test {
+
	key = test;
+
	subsection testsub {
+
		flag on;
+
		subsubsection testsubsub1 testsubsub2 {
+
			key = [1, 2, 3];
+
		}
+
	}
+
}
+

+
section test {
+
	/* Empty */
+
}
+

+

+
section foo { # test
+
	param = 123.2;
+
}
+

+
array = []
added external/libucl/tests/basic/8.res
@@ -0,0 +1,38 @@
+
section {
+
    blah {
+
        param = "value";
+
    }
+
}
+
section {
+
    test {
+
        key = "test";
+
        subsection {
+
            testsub {
+
                flag = true;
+
                subsubsection {
+
                    testsubsub1 {
+
                        testsubsub2 {
+
                            key [
+
                                1,
+
                                2,
+
                                3,
+
                            ]
+
                        }
+
                    }
+
                }
+
            }
+
        }
+
    }
+
}
+
section {
+
    test {
+
    }
+
}
+
section {
+
    foo {
+
        param = 123.200000;
+
    }
+
}
+
array [
+
]
+

added external/libucl/tests/basic/9-comment.inc
@@ -0,0 +1 @@
+
#key = value
added external/libucl/tests/basic/9-empty.inc
added external/libucl/tests/basic/9.in
@@ -0,0 +1,12 @@
+
.include "$CURDIR/9.inc"
+
.include "$CURDIR/9-comment.inc"
+
#.include "$CURDIR/9.inc"
+
.include "$CURDIR/9.inc"
+

+
key = value;
+
.include "$CURDIR/9.inc"
+

+
.try_include "/non/existent"
+
#.try_include "$CURDIR/9.incorrect.inc"
+
# 9.incorrect.inc contains '{}}'
+
#key = value;
added external/libucl/tests/basic/9.inc
@@ -0,0 +1 @@
+
key1 = value
added external/libucl/tests/basic/9.res
@@ -0,0 +1,5 @@
+
key1 = "value";
+
key1 = "value";
+
key1 = "value";
+
key = "value";
+

added external/libucl/tests/generate.test
@@ -0,0 +1,13 @@
+
#!/bin/sh
+

+
PROG=test_generate
+

+
$PROG ${TEST_DIR}/generate.out
+
diff -s ${TEST_DIR}/generate.out ${TEST_DIR}/generate.res -u 2>/dev/null
+
if [ $? -ne 0 ] ; then
+
	rm ${TEST_DIR}/generate.out
+
	echo "Test: generate.res output missmatch"
+
	exit 1
+
fi
+
rm ${TEST_DIR}/generate.out
+

modified external/libucl/tests/run_tests.sh
@@ -37,6 +37,15 @@ if [ $# -gt 2 ] ; then
	rm ${TEST_DIR}/generate.out
fi

+
if [ $# -gt 3 ] ; then
+
	rm /tmp/_ucl_test_schema.out ||true
+
	for i in ${TEST_DIR}/schema/*.json ; do
+
		_name=`basename $i`
+
		printf "running schema test suite $_name... "
+
		cat $i | $4 >> /tmp/_ucl_test_schema.out && ( echo "OK" ) || ( echo "Fail" )
+
	done
+
fi
+

sh -c "xz -c < /dev/null > /dev/null"
if [ $? -eq 0 -a $# -gt 1 ] ; then
	echo 'Running speed tests'
added external/libucl/tests/schema.test
@@ -0,0 +1,9 @@
+
#!/bin/sh
+

+
PROG=test_schema
+
rm /tmp/_ucl_test_schema.out ||true
+
for i in ${TEST_DIR}/schema/*.json ; do
+
	_name=`basename $i`
+
	printf "running schema test suite $_name... "
+
	cat $i | $4 >> /tmp/_ucl_test_schema.out && ( echo "OK" ) || ( echo "Fail" )
+
done
added external/libucl/tests/schema/additionalItems.json
@@ -0,0 +1,82 @@
+
[
+
    {
+
        "description": "additionalItems as schema",
+
        "schema": {
+
            "items": [{}],
+
            "additionalItems": {"type": "integer"}
+
        },
+
        "tests": [
+
            {
+
                "description": "additional items match schema",
+
                "data": [ null, 2, 3, 4 ],
+
                "valid": true
+
            },
+
            {
+
                "description": "additional items do not match schema",
+
                "data": [ null, 2, 3, "foo" ],
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "items is schema, no additionalItems",
+
        "schema": {
+
            "items": {},
+
            "additionalItems": false
+
        },
+
        "tests": [
+
            {
+
                "description": "all items match schema",
+
                "data": [ 1, 2, 3, 4, 5 ],
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "array of items with no additionalItems",
+
        "schema": {
+
            "items": [{}, {}, {}],
+
            "additionalItems": false
+
        },
+
        "tests": [
+
            {
+
                "description": "no additional items present",
+
                "data": [ 1, 2, 3 ],
+
                "valid": true
+
            },
+
            {
+
                "description": "additional items are not permitted",
+
                "data": [ 1, 2, 3, 4 ],
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "additionalItems as false without items",
+
        "schema": {"additionalItems": false},
+
        "tests": [
+
            {
+
                "description":
+
                    "items defaults to empty schema so everything is valid",
+
                "data": [ 1, 2, 3, 4, 5 ],
+
                "valid": true
+
            },
+
            {
+
                "description": "ignores non-arrays",
+
                "data": {"foo" : "bar"},
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "additionalItems are allowed by default",
+
        "schema": {"items": [{"type": "integer"}]},
+
        "tests": [
+
            {
+
                "description": "only the first item is validated",
+
                "data": [1, "foo", false],
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/additionalProperties.json
@@ -0,0 +1,69 @@
+
[
+
    {
+
        "description":
+
            "additionalProperties being false does not allow other properties",
+
        "schema": {
+
            "properties": {"foo": {}, "bar": {}},
+
            "patternProperties": { "^v": {} },
+
            "additionalProperties": false
+
        },
+
        "tests": [
+
            {
+
                "description": "no additional properties is valid",
+
                "data": {"foo": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "an additional property is invalid",
+
                "data": {"foo" : 1, "bar" : 2, "quux" : "boom"},
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-objects",
+
                "data": [1, 2, 3],
+
                "valid": true
+
            },
+
            {
+
                "description": "patternProperties are not additional properties",
+
                "data": {"foo":1, "vroom": 2},
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description":
+
            "additionalProperties allows a schema which should validate",
+
        "schema": {
+
            "properties": {"foo": {}, "bar": {}},
+
            "additionalProperties": {"type": "boolean"}
+
        },
+
        "tests": [
+
            {
+
                "description": "no additional properties is valid",
+
                "data": {"foo": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "an additional valid property is valid",
+
                "data": {"foo" : 1, "bar" : 2, "quux" : true},
+
                "valid": true
+
            },
+
            {
+
                "description": "an additional invalid property is invalid",
+
                "data": {"foo" : 1, "bar" : 2, "quux" : 12},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "additionalProperties are allowed by default",
+
        "schema": {"properties": {"foo": {}, "bar": {}}},
+
        "tests": [
+
            {
+
                "description": "additional properties are allowed",
+
                "data": {"foo": 1, "bar": 2, "quux": true},
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/allOf.json
@@ -0,0 +1,112 @@
+
[
+
    {
+
        "description": "allOf",
+
        "schema": {
+
            "allOf": [
+
                {
+
                    "properties": {
+
                        "bar": {"type": "integer"}
+
                    },
+
                    "required": ["bar"]
+
                },
+
                {
+
                    "properties": {
+
                        "foo": {"type": "string"}
+
                    },
+
                    "required": ["foo"]
+
                }
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "allOf",
+
                "data": {"foo": "baz", "bar": 2},
+
                "valid": true
+
            },
+
            {
+
                "description": "mismatch second",
+
                "data": {"foo": "baz"},
+
                "valid": false
+
            },
+
            {
+
                "description": "mismatch first",
+
                "data": {"bar": 2},
+
                "valid": false
+
            },
+
            {
+
                "description": "wrong type",
+
                "data": {"foo": "baz", "bar": "quux"},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "allOf with base schema",
+
        "schema": {
+
            "properties": {"bar": {"type": "integer"}},
+
            "required": ["bar"],
+
            "allOf" : [
+
                {
+
                    "properties": {
+
                        "foo": {"type": "string"}
+
                    },
+
                    "required": ["foo"]
+
                },
+
                {
+
                    "properties": {
+
                        "baz": {"type": "null"}
+
                    },
+
                    "required": ["baz"]
+
                }
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "valid",
+
                "data": {"foo": "quux", "bar": 2, "baz": null},
+
                "valid": true
+
            },
+
            {
+
                "description": "mismatch base schema",
+
                "data": {"foo": "quux", "baz": null},
+
                "valid": false
+
            },
+
            {
+
                "description": "mismatch first allOf",
+
                "data": {"bar": 2, "baz": null},
+
                "valid": false
+
            },
+
            {
+
                "description": "mismatch second allOf",
+
                "data": {"foo": "quux", "bar": 2},
+
                "valid": false
+
            },
+
            {
+
                "description": "mismatch both",
+
                "data": {"bar": 2},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "allOf simple types",
+
        "schema": {
+
            "allOf": [
+
                {"maximum": 30},
+
                {"minimum": 20}
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "valid",
+
                "data": 25,
+
                "valid": true
+
            },
+
            {
+
                "description": "mismatch one",
+
                "data": 35,
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/anyOf.json
@@ -0,0 +1,68 @@
+
[
+
    {
+
        "description": "anyOf",
+
        "schema": {
+
            "anyOf": [
+
                {
+
                    "type": "integer"
+
                },
+
                {
+
                    "minimum": 2
+
                }
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "first anyOf valid",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "second anyOf valid",
+
                "data": 2.5,
+
                "valid": true
+
            },
+
            {
+
                "description": "both anyOf valid",
+
                "data": 3,
+
                "valid": true
+
            },
+
            {
+
                "description": "neither anyOf valid",
+
                "data": 1.5,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "anyOf with base schema",
+
        "schema": {
+
            "type": "string",
+
            "anyOf" : [
+
                {
+
                    "maxLength": 2
+
                },
+
                {
+
                    "minLength": 4
+
                }
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "mismatch base schema",
+
                "data": 3,
+
                "valid": false
+
            },
+
            {
+
                "description": "one anyOf valid",
+
                "data": "foobar",
+
                "valid": true
+
            },
+
            {
+
                "description": "both anyOf invalid",
+
                "data": "foo",
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/definitions.json
@@ -0,0 +1,32 @@
+
[
+
    {
+
        "description": "valid definition",
+
        "schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
+
        "tests": [
+
            {
+
                "description": "valid definition schema",
+
                "data": {
+
                    "definitions": {
+
                        "foo": {"type": "integer"}
+
                    }
+
                },
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "invalid definition",
+
        "schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
+
        "tests": [
+
            {
+
                "description": "invalid definition schema",
+
                "data": {
+
                    "definitions": {
+
                        "foo": {"type": 1}
+
                    }
+
                },
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/dependencies.json
@@ -0,0 +1,113 @@
+
[
+
    {
+
        "description": "dependencies",
+
        "schema": {
+
            "dependencies": {"bar": ["foo"]}
+
        },
+
        "tests": [
+
            {
+
                "description": "neither",
+
                "data": {},
+
                "valid": true
+
            },
+
            {
+
                "description": "nondependant",
+
                "data": {"foo": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "with dependency",
+
                "data": {"foo": 1, "bar": 2},
+
                "valid": true
+
            },
+
            {
+
                "description": "missing dependency",
+
                "data": {"bar": 2},
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-objects",
+
                "data": "foo",
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "multiple dependencies",
+
        "schema": {
+
            "dependencies": {"quux": ["foo", "bar"]}
+
        },
+
        "tests": [
+
            {
+
                "description": "neither",
+
                "data": {},
+
                "valid": true
+
            },
+
            {
+
                "description": "nondependants",
+
                "data": {"foo": 1, "bar": 2},
+
                "valid": true
+
            },
+
            {
+
                "description": "with dependencies",
+
                "data": {"foo": 1, "bar": 2, "quux": 3},
+
                "valid": true
+
            },
+
            {
+
                "description": "missing dependency",
+
                "data": {"foo": 1, "quux": 2},
+
                "valid": false
+
            },
+
            {
+
                "description": "missing other dependency",
+
                "data": {"bar": 1, "quux": 2},
+
                "valid": false
+
            },
+
            {
+
                "description": "missing both dependencies",
+
                "data": {"quux": 1},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "multiple dependencies subschema",
+
        "schema": {
+
            "dependencies": {
+
                "bar": {
+
                    "properties": {
+
                        "foo": {"type": "integer"},
+
                        "bar": {"type": "integer"}
+
                    }
+
                }
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "valid",
+
                "data": {"foo": 1, "bar": 2},
+
                "valid": true
+
            },
+
            {
+
                "description": "no dependency",
+
                "data": {"foo": "quux"},
+
                "valid": true
+
            },
+
            {
+
                "description": "wrong type",
+
                "data": {"foo": "quux", "bar": 2},
+
                "valid": false
+
            },
+
            {
+
                "description": "wrong type other",
+
                "data": {"foo": 2, "bar": "quux"},
+
                "valid": false
+
            },
+
            {
+
                "description": "wrong type both",
+
                "data": {"foo": "quux", "bar": "quux"},
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/enum.json
@@ -0,0 +1,72 @@
+
[
+
    {
+
        "description": "simple enum validation",
+
        "schema": {"enum": [1, 2, 3]},
+
        "tests": [
+
            {
+
                "description": "one of the enum is valid",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "something else is invalid",
+
                "data": 4,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "heterogeneous enum validation",
+
        "schema": {"enum": [6, "foo", [], true, {"foo": 12}]},
+
        "tests": [
+
            {
+
                "description": "one of the enum is valid",
+
                "data": [],
+
                "valid": true
+
            },
+
            {
+
                "description": "something else is invalid",
+
                "data": null,
+
                "valid": false
+
            },
+
            {
+
                "description": "objects are deep compared",
+
                "data": {"foo": false},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "enums in properties",
+
        "schema": {
+
           "type":"object",
+
		     "properties": {
+
		        "foo": {"enum":["foo"]},
+
		        "bar": {"enum":["bar"]}
+
		     },
+
		     "required": ["bar"]
+
		  },
+
        "tests": [
+
            {
+
                "description": "both properties are valid",
+
                "data": {"foo":"foo", "bar":"bar"},
+
                "valid": true
+
            },
+
            {
+
                "description": "missing optional property is valid",
+
                "data": {"bar":"bar"},
+
                "valid": true
+
            },
+
            {
+
                "description": "missing required property is invalid",
+
                "data": {"foo":"foo"},
+
                "valid": false
+
            },
+
            {
+
                "description": "missing all properties is invalid",
+
                "data": {},
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/items.json
@@ -0,0 +1,46 @@
+
[
+
    {
+
        "description": "a schema given for items",
+
        "schema": {
+
            "items": {"type": "integer"}
+
        },
+
        "tests": [
+
            {
+
                "description": "valid items",
+
                "data": [ 1, 2, 3 ],
+
                "valid": true
+
            },
+
            {
+
                "description": "wrong type of items",
+
                "data": [1, "x"],
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-arrays",
+
                "data": {"foo" : "bar"},
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "an array of schemas for items",
+
        "schema": {
+
            "items": [
+
                {"type": "integer"},
+
                {"type": "string"}
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "correct types",
+
                "data": [ 1, "foo" ],
+
                "valid": true
+
            },
+
            {
+
                "description": "wrong types",
+
                "data": [ "foo", 1 ],
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/maxItems.json
@@ -0,0 +1,28 @@
+
[
+
    {
+
        "description": "maxItems validation",
+
        "schema": {"maxItems": 2},
+
        "tests": [
+
            {
+
                "description": "shorter is valid",
+
                "data": [1],
+
                "valid": true
+
            },
+
            {
+
                "description": "exact length is valid",
+
                "data": [1, 2],
+
                "valid": true
+
            },
+
            {
+
                "description": "too long is invalid",
+
                "data": [1, 2, 3],
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-arrays",
+
                "data": "foobar",
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/maxLength.json
@@ -0,0 +1,28 @@
+
[
+
    {
+
        "description": "maxLength validation",
+
        "schema": {"maxLength": 2},
+
        "tests": [
+
            {
+
                "description": "shorter is valid",
+
                "data": "f",
+
                "valid": true
+
            },
+
            {
+
                "description": "exact length is valid",
+
                "data": "fo",
+
                "valid": true
+
            },
+
            {
+
                "description": "too long is invalid",
+
                "data": "foo",
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-strings",
+
                "data": 10,
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/maxProperties.json
@@ -0,0 +1,28 @@
+
[
+
    {
+
        "description": "maxProperties validation",
+
        "schema": {"maxProperties": 2},
+
        "tests": [
+
            {
+
                "description": "shorter is valid",
+
                "data": {"foo": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "exact length is valid",
+
                "data": {"foo": 1, "bar": 2},
+
                "valid": true
+
            },
+
            {
+
                "description": "too long is invalid",
+
                "data": {"foo": 1, "bar": 2, "baz": 3},
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-objects",
+
                "data": "foobar",
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/maximum.json
@@ -0,0 +1,42 @@
+
[
+
    {
+
        "description": "maximum validation",
+
        "schema": {"maximum": 3.0},
+
        "tests": [
+
            {
+
                "description": "below the maximum is valid",
+
                "data": 2.6,
+
                "valid": true
+
            },
+
            {
+
                "description": "above the maximum is invalid",
+
                "data": 3.5,
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-numbers",
+
                "data": "x",
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "exclusiveMaximum validation",
+
        "schema": {
+
            "maximum": 3.0,
+
            "exclusiveMaximum": true
+
        },
+
        "tests": [
+
            {
+
                "description": "below the maximum is still valid",
+
                "data": 2.2,
+
                "valid": true
+
            },
+
            {
+
                "description": "boundary point is invalid",
+
                "data": 3.0,
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/minItems.json
@@ -0,0 +1,28 @@
+
[
+
    {
+
        "description": "minItems validation",
+
        "schema": {"minItems": 1},
+
        "tests": [
+
            {
+
                "description": "longer is valid",
+
                "data": [1, 2],
+
                "valid": true
+
            },
+
            {
+
                "description": "exact length is valid",
+
                "data": [1],
+
                "valid": true
+
            },
+
            {
+
                "description": "too short is invalid",
+
                "data": [],
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-arrays",
+
                "data": "",
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/minLength.json
@@ -0,0 +1,28 @@
+
[
+
    {
+
        "description": "minLength validation",
+
        "schema": {"minLength": 2},
+
        "tests": [
+
            {
+
                "description": "longer is valid",
+
                "data": "foo",
+
                "valid": true
+
            },
+
            {
+
                "description": "exact length is valid",
+
                "data": "fo",
+
                "valid": true
+
            },
+
            {
+
                "description": "too short is invalid",
+
                "data": "f",
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-strings",
+
                "data": 1,
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/minProperties.json
@@ -0,0 +1,28 @@
+
[
+
    {
+
        "description": "minProperties validation",
+
        "schema": {"minProperties": 1},
+
        "tests": [
+
            {
+
                "description": "longer is valid",
+
                "data": {"foo": 1, "bar": 2},
+
                "valid": true
+
            },
+
            {
+
                "description": "exact length is valid",
+
                "data": {"foo": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "too short is invalid",
+
                "data": {},
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-objects",
+
                "data": "",
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/minimum.json
@@ -0,0 +1,42 @@
+
[
+
    {
+
        "description": "minimum validation",
+
        "schema": {"minimum": 1.1},
+
        "tests": [
+
            {
+
                "description": "above the minimum is valid",
+
                "data": 2.6,
+
                "valid": true
+
            },
+
            {
+
                "description": "below the minimum is invalid",
+
                "data": 0.6,
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-numbers",
+
                "data": "x",
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "exclusiveMinimum validation",
+
        "schema": {
+
            "minimum": 1.1,
+
            "exclusiveMinimum": true
+
        },
+
        "tests": [
+
            {
+
                "description": "above the minimum is still valid",
+
                "data": 1.2,
+
                "valid": true
+
            },
+
            {
+
                "description": "boundary point is invalid",
+
                "data": 1.1,
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/multipleOf.json
@@ -0,0 +1,60 @@
+
[
+
    {
+
        "description": "by int",
+
        "schema": {"multipleOf": 2},
+
        "tests": [
+
            {
+
                "description": "int by int",
+
                "data": 10,
+
                "valid": true
+
            },
+
            {
+
                "description": "int by int fail",
+
                "data": 7,
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-numbers",
+
                "data": "foo",
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "by number",
+
        "schema": {"multipleOf": 1.5},
+
        "tests": [
+
            {
+
                "description": "zero is multiple of anything",
+
                "data": 0,
+
                "valid": true
+
            },
+
            {
+
                "description": "4.5 is multiple of 1.5",
+
                "data": 4.5,
+
                "valid": true
+
            },
+
            {
+
                "description": "35 is not multiple of 1.5",
+
                "data": 35,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "by small number",
+
        "schema": {"multipleOf": 0.0001},
+
        "tests": [
+
            {
+
                "description": "0.0075 is multiple of 0.0001",
+
                "data": 0.0075,
+
                "valid": true
+
            },
+
            {
+
                "description": "0.00751 is not multiple of 0.0001",
+
                "data": 0.00751,
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/not.json
@@ -0,0 +1,96 @@
+
[
+
    {
+
        "description": "not",
+
        "schema": {
+
            "not": {"type": "integer"}
+
        },
+
        "tests": [
+
            {
+
                "description": "allowed",
+
                "data": "foo",
+
                "valid": true
+
            },
+
            {
+
                "description": "disallowed",
+
                "data": 1,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "not multiple types",
+
        "schema": {
+
            "not": {"type": ["integer", "boolean"]}
+
        },
+
        "tests": [
+
            {
+
                "description": "valid",
+
                "data": "foo",
+
                "valid": true
+
            },
+
            {
+
                "description": "mismatch",
+
                "data": 1,
+
                "valid": false
+
            },
+
            {
+
                "description": "other mismatch",
+
                "data": true,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "not more complex schema",
+
        "schema": {
+
            "not": {
+
                "type": "object",
+
                "properties": {
+
                    "foo": {
+
                        "type": "string"
+
                    }
+
                }
+
             }
+
        },
+
        "tests": [
+
            {
+
                "description": "match",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "other match",
+
                "data": {"foo": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "mismatch",
+
                "data": {"foo": "bar"},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "forbidden property",
+
        "schema": {
+
            "properties": {
+
                "foo": { 
+
                    "not": {}
+
                }
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "property present",
+
                "data": {"foo": 1, "bar": 2},
+
                "valid": false
+
            },
+
            {
+
                "description": "property absent",
+
                "data": {"bar": 1, "baz": 2},
+
                "valid": true
+
            }
+
        ]
+
    }
+

+
]
added external/libucl/tests/schema/oneOf.json
@@ -0,0 +1,68 @@
+
[
+
    {
+
        "description": "oneOf",
+
        "schema": {
+
            "oneOf": [
+
                {
+
                    "type": "integer"
+
                },
+
                {
+
                    "minimum": 2
+
                }
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "first oneOf valid",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "second oneOf valid",
+
                "data": 2.5,
+
                "valid": true
+
            },
+
            {
+
                "description": "both oneOf valid",
+
                "data": 3,
+
                "valid": false
+
            },
+
            {
+
                "description": "neither oneOf valid",
+
                "data": 1.5,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "oneOf with base schema",
+
        "schema": {
+
            "type": "string",
+
            "oneOf" : [
+
                {
+
                    "minLength": 2
+
                },
+
                {
+
                    "maxLength": 4
+
                }
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "mismatch base schema",
+
                "data": 3,
+
                "valid": false
+
            },
+
            {
+
                "description": "one oneOf valid",
+
                "data": "foobar",
+
                "valid": true
+
            },
+
            {
+
                "description": "both oneOf valid",
+
                "data": "foo",
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/pattern.json
@@ -0,0 +1,23 @@
+
[
+
    {
+
        "description": "pattern validation",
+
        "schema": {"pattern": "^a*$"},
+
        "tests": [
+
            {
+
                "description": "a matching pattern is valid",
+
                "data": "aaa",
+
                "valid": true
+
            },
+
            {
+
                "description": "a non-matching pattern is invalid",
+
                "data": "abc",
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-strings",
+
                "data": true,
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/patternProperties.json
@@ -0,0 +1,110 @@
+
[
+
    {
+
        "description":
+
            "patternProperties validates properties matching a regex",
+
        "schema": {
+
            "patternProperties": {
+
                "f.*o": {"type": "integer"}
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "a single valid match is valid",
+
                "data": {"foo": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "multiple valid matches is valid",
+
                "data": {"foo": 1, "foooooo" : 2},
+
                "valid": true
+
            },
+
            {
+
                "description": "a single invalid match is invalid",
+
                "data": {"foo": "bar", "fooooo": 2},
+
                "valid": false
+
            },
+
            {
+
                "description": "multiple invalid matches is invalid",
+
                "data": {"foo": "bar", "foooooo" : "baz"},
+
                "valid": false
+
            },
+
            {
+
                "description": "ignores non-objects",
+
                "data": 12,
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "multiple simultaneous patternProperties are validated",
+
        "schema": {
+
            "patternProperties": {
+
                "a*": {"type": "integer"},
+
                "aaa*": {"maximum": 20}
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "a single valid match is valid",
+
                "data": {"a": 21},
+
                "valid": true
+
            },
+
            {
+
                "description": "a simultaneous match is valid",
+
                "data": {"aaaa": 18},
+
                "valid": true
+
            },
+
            {
+
                "description": "multiple matches is valid",
+
                "data": {"a": 21, "aaaa": 18},
+
                "valid": true
+
            },
+
            {
+
                "description": "an invalid due to one is invalid",
+
                "data": {"a": "bar"},
+
                "valid": false
+
            },
+
            {
+
                "description": "an invalid due to the other is invalid",
+
                "data": {"aaaa": 31},
+
                "valid": false
+
            },
+
            {
+
                "description": "an invalid due to both is invalid",
+
                "data": {"aaa": "foo", "aaaa": 31},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "regexes are not anchored by default and are case sensitive",
+
        "schema": {
+
            "patternProperties": {
+
                "[0-9]{2,}": { "type": "boolean" },
+
                "X_": { "type": "string" }
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "non recognized members are ignored",
+
                "data": { "answer 1": "42" },
+
                "valid": true
+
            },
+
            {
+
                "description": "recognized members are accounted for",
+
                "data": { "a31b": null },
+
                "valid": false
+
            },
+
            {
+
                "description": "regexes are case sensitive",
+
                "data": { "a_x_3": 3 },
+
                "valid": true
+
            },
+
            {
+
                "description": "regexes are case sensitive, 2",
+
                "data": { "a_X_3": 3 },
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/properties.json
@@ -0,0 +1,92 @@
+
[
+
    {
+
        "description": "object properties validation",
+
        "schema": {
+
            "properties": {
+
                "foo": {"type": "integer"},
+
                "bar": {"type": "string"}
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "both properties present and valid is valid",
+
                "data": {"foo": 1, "bar": "baz"},
+
                "valid": true
+
            },
+
            {
+
                "description": "one property invalid is invalid",
+
                "data": {"foo": 1, "bar": {}},
+
                "valid": false
+
            },
+
            {
+
                "description": "both properties invalid is invalid",
+
                "data": {"foo": [], "bar": {}},
+
                "valid": false
+
            },
+
            {
+
                "description": "doesn't invalidate other properties",
+
                "data": {"quux": []},
+
                "valid": true
+
            },
+
            {
+
                "description": "ignores non-objects",
+
                "data": [],
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description":
+
            "properties, patternProperties, additionalProperties interaction",
+
        "schema": {
+
            "properties": {
+
                "foo": {"type": "array", "maxItems": 3},
+
                "bar": {"type": "array"}
+
            },
+
            "patternProperties": {"f.o": {"minItems": 2}},
+
            "additionalProperties": {"type": "integer"}
+
        },
+
        "tests": [
+
            {
+
                "description": "property validates property",
+
                "data": {"foo": [1, 2]},
+
                "valid": true
+
            },
+
            {
+
                "description": "property invalidates property",
+
                "data": {"foo": [1, 2, 3, 4]},
+
                "valid": false
+
            },
+
            {
+
                "description": "patternProperty invalidates property",
+
                "data": {"foo": []},
+
                "valid": false
+
            },
+
            {
+
                "description": "patternProperty validates nonproperty",
+
                "data": {"fxo": [1, 2]},
+
                "valid": true
+
            },
+
            {
+
                "description": "patternProperty invalidates nonproperty",
+
                "data": {"fxo": []},
+
                "valid": false
+
            },
+
            {
+
                "description": "additionalProperty ignores property",
+
                "data": {"bar": []},
+
                "valid": true
+
            },
+
            {
+
                "description": "additionalProperty validates others",
+
                "data": {"quux": 3},
+
                "valid": true
+
            },
+
            {
+
                "description": "additionalProperty invalidates others",
+
                "data": {"quux": "foo"},
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/ref.json
@@ -0,0 +1,144 @@
+
[
+
    {
+
        "description": "root pointer ref",
+
        "schema": {
+
            "properties": {
+
                "foo": {"$ref": "#"}
+
            },
+
            "additionalProperties": false
+
        },
+
        "tests": [
+
            {
+
                "description": "match",
+
                "data": {"foo": false},
+
                "valid": true
+
            },
+
            {
+
                "description": "recursive match",
+
                "data": {"foo": {"foo": false}},
+
                "valid": true
+
            },
+
            {
+
                "description": "mismatch",
+
                "data": {"bar": false},
+
                "valid": false
+
            },
+
            {
+
                "description": "recursive mismatch",
+
                "data": {"foo": {"bar": false}},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "relative pointer ref to object",
+
        "schema": {
+
            "properties": {
+
                "foo": {"type": "integer"},
+
                "bar": {"$ref": "#/properties/foo"}
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "match",
+
                "data": {"bar": 3},
+
                "valid": true
+
            },
+
            {
+
                "description": "mismatch",
+
                "data": {"bar": true},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "relative pointer ref to array",
+
        "schema": {
+
            "items": [
+
                {"type": "integer"},
+
                {"$ref": "#/items/0"}
+
            ]
+
        },
+
        "tests": [
+
            {
+
                "description": "match array",
+
                "data": [1, 2],
+
                "valid": true
+
            },
+
            {
+
                "description": "mismatch array",
+
                "data": [1, "foo"],
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "escaped pointer ref",
+
        "schema": {
+
            "tilda~field": {"type": "integer"},
+
            "slash/field": {"type": "integer"},
+
            "percent%field": {"type": "integer"},
+
            "properties": {
+
                "tilda": {"$ref": "#/tilda~0field"},
+
                "slash": {"$ref": "#/slash~1field"},
+
                "percent": {"$ref": "#/percent%25field"}
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "slash",
+
                "data": {"slash": "aoeu"},
+
                "valid": false
+
            },
+
            {
+
                "description": "tilda",
+
                "data": {"tilda": "aoeu"},
+
                "valid": false
+
            },
+
            {
+
                "description": "percent",
+
                "data": {"percent": "aoeu"},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "nested refs",
+
        "schema": {
+
            "definitions": {
+
                "a": {"type": "integer"},
+
                "b": {"$ref": "#/definitions/a"},
+
                "c": {"$ref": "#/definitions/b"}
+
            },
+
            "$ref": "#/definitions/c"
+
        },
+
        "tests": [
+
            {
+
                "description": "nested ref valid",
+
                "data": 5,
+
                "valid": true
+
            },
+
            {
+
                "description": "nested ref invalid",
+
                "data": "a",
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "remote ref, containing refs itself",
+
        "schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
+
        "tests": [
+
            {
+
                "description": "remote ref valid",
+
                "data": {"minLength": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "remote ref invalid",
+
                "data": {"minLength": -1},
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/refRemote.json
@@ -0,0 +1,74 @@
+
[
+
    {
+
        "description": "remote ref",
+
        "schema": {"$ref": "http://localhost:1234/integer.json"},
+
        "tests": [
+
            {
+
                "description": "remote ref valid",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "remote ref invalid",
+
                "data": "a",
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "fragment within remote ref",
+
        "schema": {"$ref": "http://localhost:1234/subSchemas.json#/integer"},
+
        "tests": [
+
            {
+
                "description": "remote fragment valid",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "remote fragment invalid",
+
                "data": "a",
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "ref within remote ref",
+
        "schema": {
+
            "$ref": "http://localhost:1234/subSchemas.json#/refToInteger"
+
        },
+
        "tests": [
+
            {
+
                "description": "ref within ref valid",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "ref within ref invalid",
+
                "data": "a",
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "change resolution scope",
+
        "schema": {
+
            "id": "http://localhost:1234/",
+
            "items": {
+
                "id": "folder/",
+
                "items": {"$ref": "folderInteger.json"}
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "changed scope ref valid",
+
                "data": [[1]],
+
                "valid": true
+
            },
+
            {
+
                "description": "changed scope ref invalid",
+
                "data": [["a"]],
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/required.json
@@ -0,0 +1,39 @@
+
[
+
    {
+
        "description": "required validation",
+
        "schema": {
+
            "properties": {
+
                "foo": {},
+
                "bar": {}
+
            },
+
            "required": ["foo"]
+
        },
+
        "tests": [
+
            {
+
                "description": "present required property is valid",
+
                "data": {"foo": 1},
+
                "valid": true
+
            },
+
            {
+
                "description": "non-present required property is invalid",
+
                "data": {"bar": 1},
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "required default validation",
+
        "schema": {
+
            "properties": {
+
                "foo": {}
+
            }
+
        },
+
        "tests": [
+
            {
+
                "description": "not required by default",
+
                "data": {},
+
                "valid": true
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/type.json
@@ -0,0 +1,330 @@
+
[
+
    {
+
        "description": "integer type matches integers",
+
        "schema": {"type": "integer"},
+
        "tests": [
+
            {
+
                "description": "an integer is an integer",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "a float is not an integer",
+
                "data": 1.1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a string is not an integer",
+
                "data": "foo",
+
                "valid": false
+
            },
+
            {
+
                "description": "an object is not an integer",
+
                "data": {},
+
                "valid": false
+
            },
+
            {
+
                "description": "an array is not an integer",
+
                "data": [],
+
                "valid": false
+
            },
+
            {
+
                "description": "a boolean is not an integer",
+
                "data": true,
+
                "valid": false
+
            },
+
            {
+
                "description": "null is not an integer",
+
                "data": null,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "number type matches numbers",
+
        "schema": {"type": "number"},
+
        "tests": [
+
            {
+
                "description": "an integer is a number",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "a float is a number",
+
                "data": 1.1,
+
                "valid": true
+
            },
+
            {
+
                "description": "a string is not a number",
+
                "data": "foo",
+
                "valid": false
+
            },
+
            {
+
                "description": "an object is not a number",
+
                "data": {},
+
                "valid": false
+
            },
+
            {
+
                "description": "an array is not a number",
+
                "data": [],
+
                "valid": false
+
            },
+
            {
+
                "description": "a boolean is not a number",
+
                "data": true,
+
                "valid": false
+
            },
+
            {
+
                "description": "null is not a number",
+
                "data": null,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "string type matches strings",
+
        "schema": {"type": "string"},
+
        "tests": [
+
            {
+
                "description": "1 is not a string",
+
                "data": 1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a float is not a string",
+
                "data": 1.1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a string is a string",
+
                "data": "foo",
+
                "valid": true
+
            },
+
            {
+
                "description": "an object is not a string",
+
                "data": {},
+
                "valid": false
+
            },
+
            {
+
                "description": "an array is not a string",
+
                "data": [],
+
                "valid": false
+
            },
+
            {
+
                "description": "a boolean is not a string",
+
                "data": true,
+
                "valid": false
+
            },
+
            {
+
                "description": "null is not a string",
+
                "data": null,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "object type matches objects",
+
        "schema": {"type": "object"},
+
        "tests": [
+
            {
+
                "description": "an integer is not an object",
+
                "data": 1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a float is not an object",
+
                "data": 1.1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a string is not an object",
+
                "data": "foo",
+
                "valid": false
+
            },
+
            {
+
                "description": "an object is an object",
+
                "data": {},
+
                "valid": true
+
            },
+
            {
+
                "description": "an array is not an object",
+
                "data": [],
+
                "valid": false
+
            },
+
            {
+
                "description": "a boolean is not an object",
+
                "data": true,
+
                "valid": false
+
            },
+
            {
+
                "description": "null is not an object",
+
                "data": null,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "array type matches arrays",
+
        "schema": {"type": "array"},
+
        "tests": [
+
            {
+
                "description": "an integer is not an array",
+
                "data": 1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a float is not an array",
+
                "data": 1.1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a string is not an array",
+
                "data": "foo",
+
                "valid": false
+
            },
+
            {
+
                "description": "an object is not an array",
+
                "data": {},
+
                "valid": false
+
            },
+
            {
+
                "description": "an array is not an array",
+
                "data": [],
+
                "valid": true
+
            },
+
            {
+
                "description": "a boolean is not an array",
+
                "data": true,
+
                "valid": false
+
            },
+
            {
+
                "description": "null is not an array",
+
                "data": null,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "boolean type matches booleans",
+
        "schema": {"type": "boolean"},
+
        "tests": [
+
            {
+
                "description": "an integer is not a boolean",
+
                "data": 1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a float is not a boolean",
+
                "data": 1.1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a string is not a boolean",
+
                "data": "foo",
+
                "valid": false
+
            },
+
            {
+
                "description": "an object is not a boolean",
+
                "data": {},
+
                "valid": false
+
            },
+
            {
+
                "description": "an array is not a boolean",
+
                "data": [],
+
                "valid": false
+
            },
+
            {
+
                "description": "a boolean is not a boolean",
+
                "data": true,
+
                "valid": true
+
            },
+
            {
+
                "description": "null is not a boolean",
+
                "data": null,
+
                "valid": false
+
            }
+
        ]
+
    },
+
    {
+
        "description": "null type matches only the null object",
+
        "schema": {"type": "null"},
+
        "tests": [
+
            {
+
                "description": "an integer is not null",
+
                "data": 1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a float is not null",
+
                "data": 1.1,
+
                "valid": false
+
            },
+
            {
+
                "description": "a string is not null",
+
                "data": "foo",
+
                "valid": false
+
            },
+
            {
+
                "description": "an object is not null",
+
                "data": {},
+
                "valid": false
+
            },
+
            {
+
                "description": "an array is not null",
+
                "data": [],
+
                "valid": false
+
            },
+
            {
+
                "description": "a boolean is not null",
+
                "data": true,
+
                "valid": false
+
            },
+
            {
+
                "description": "null is null",
+
                "data": null,
+
                "valid": true
+
            }
+
        ]
+
    },
+
    {
+
        "description": "multiple types can be specified in an array",
+
        "schema": {"type": ["integer", "string"]},
+
        "tests": [
+
            {
+
                "description": "an integer is valid",
+
                "data": 1,
+
                "valid": true
+
            },
+
            {
+
                "description": "a string is valid",
+
                "data": "foo",
+
                "valid": true
+
            },
+
            {
+
                "description": "a float is invalid",
+
                "data": 1.1,
+
                "valid": false
+
            },
+
            {
+
                "description": "an object is invalid",
+
                "data": {},
+
                "valid": false
+
            },
+
            {
+
                "description": "an array is invalid",
+
                "data": [],
+
                "valid": false
+
            },
+
            {
+
                "description": "a boolean is invalid",
+
                "data": true,
+
                "valid": false
+
            },
+
            {
+
                "description": "null is invalid",
+
                "data": null,
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/schema/uniqueItems.json
@@ -0,0 +1,79 @@
+
[
+
    {
+
        "description": "uniqueItems validation",
+
        "schema": {"uniqueItems": true},
+
        "tests": [
+
            {
+
                "description": "unique array of integers is valid",
+
                "data": [1, 2],
+
                "valid": true
+
            },
+
            {
+
                "description": "non-unique array of integers is invalid",
+
                "data": [1, 1],
+
                "valid": false
+
            },
+
            {
+
                "description": "numbers are unique if mathematically unequal",
+
                "data": [1.0, 1.00, 1],
+
                "valid": false
+
            },
+
            {
+
                "description": "unique array of objects is valid",
+
                "data": [{"foo": "bar"}, {"foo": "baz"}],
+
                "valid": true
+
            },
+
            {
+
                "description": "non-unique array of objects is invalid",
+
                "data": [{"foo": "bar"}, {"foo": "bar"}],
+
                "valid": false
+
            },
+
            {
+
                "description": "unique array of nested objects is valid",
+
                "data": [
+
                    {"foo": {"bar" : {"baz" : true}}},
+
                    {"foo": {"bar" : {"baz" : false}}}
+
                ],
+
                "valid": true
+
            },
+
            {
+
                "description": "non-unique array of nested objects is invalid",
+
                "data": [
+
                    {"foo": {"bar" : {"baz" : true}}},
+
                    {"foo": {"bar" : {"baz" : true}}}
+
                ],
+
                "valid": false
+
            },
+
            {
+
                "description": "unique array of arrays is valid",
+
                "data": [["foo"], ["bar"]],
+
                "valid": true
+
            },
+
            {
+
                "description": "non-unique array of arrays is invalid",
+
                "data": [["foo"], ["foo"]],
+
                "valid": false
+
            },
+
            {
+
                "description": "1 and true are unique",
+
                "data": [1, true],
+
                "valid": true
+
            },
+
            {
+
                "description": "0 and false are unique",
+
                "data": [0, false],
+
                "valid": true
+
            },
+
            {
+
                "description": "unique heterogeneous types are valid",
+
                "data": [{}, [1], true, null, 1],
+
                "valid": true
+
            },
+
            {
+
                "description": "non-unique heterogeneous types are invalid",
+
                "data": [{}, [1], true, null, {}, 1],
+
                "valid": false
+
            }
+
        ]
+
    }
+
]
added external/libucl/tests/speed.test
@@ -0,0 +1,21 @@
+
#!/bin/sh
+

+
PROG=test_speed
+

+
sh -c "xz -c < /dev/null > /dev/null"
+
echo 'Running speed tests'
+
for _tin in ${TEST_DIR}/*.xz ; do
+
	echo "Unpacking $_tin..."
+
	xz -cd < $_tin > ${TEST_DIR}/test_file
+
	# Preread file to cheat benchmark!
+
	cat ${TEST_DIR}/test_file > /dev/null
+
	echo "Starting benchmarking for $_tin..."
+
	$PROG ${TEST_DIR}/test_file
+
	if [ $? -ne 0 ] ; then
+
		echo "Test: $_tin failed"
+
		rm ${TEST_DIR}/test_file
+
		exit 1
+
	fi
+
	rm ${TEST_DIR}/test_file
+
done
+

modified external/libucl/tests/test_basic.c
@@ -21,10 +21,8 @@
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

-
#include <stdio.h>
-
#include <errno.h>
-
#include <unistd.h>
#include "ucl.h"
+
#include "ucl_internal.h"

int
main (int argc, char **argv)
added external/libucl/tests/test_schema.c
@@ -0,0 +1,157 @@
+
/* Copyright (c) 2014, Vsevolod Stakhov
+
 * All rights reserved.
+
 *
+
 * Redistribution and use in source and binary forms, with or without
+
 * modification, are permitted provided that the following conditions are met:
+
 *       * Redistributions of source code must retain the above copyright
+
 *         notice, this list of conditions and the following disclaimer.
+
 *       * Redistributions in binary form must reproduce the above copyright
+
 *         notice, this list of conditions and the following disclaimer in the
+
 *         documentation and/or other materials provided with the distribution.
+
 *
+
 * THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY
+
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+
 * DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY
+
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
 */
+

+
#include <stdio.h>
+
#include <errno.h>
+
#include <unistd.h>
+
#include "ucl.h"
+

+
static int
+
read_stdin (char **buf)
+
{
+
	int size = BUFSIZ, remain, ret;
+
	char *p;
+

+
	*buf = malloc (size);
+
	if (*buf == NULL) {
+
		return -1;
+
	}
+

+
	p = *buf;
+
	remain = size;
+

+
	while ((ret = read (STDIN_FILENO, p, remain)) > 0) {
+
		remain -= ret;
+
		p += ret;
+
		if (remain == 0) {
+
			*buf = realloc (*buf, size * 2);
+
			if (*buf == NULL) {
+
				return -1;
+
			}
+
			p = *buf + size;
+
			remain = size;
+
			size *= 2;
+
		}
+
	}
+

+
	return ret;
+
}
+

+
static bool
+
perform_test (ucl_object_t *schema, ucl_object_t *obj,
+
		struct ucl_schema_error *err)
+
{
+
	ucl_object_t *valid, *data, *description;
+
	bool match;
+

+
	data = ucl_object_find_key (obj, "data");
+
	description = ucl_object_find_key (obj, "description");
+
	valid = ucl_object_find_key (obj, "valid");
+

+
	if (data == NULL || description == NULL || valid == NULL) {
+
		fprintf (stdout, "Bad test case\n");
+
		return false;
+
	}
+

+
	match = ucl_object_validate (schema, data, err);
+
	if (match != ucl_object_toboolean (valid)) {
+
		fprintf (stdout, "Test case '%s' failed (expected %s): '%s'\n",
+
				ucl_object_tostring (description),
+
				ucl_object_toboolean (valid) ? "valid" : "invalid",
+
						err->msg);
+
		return false;
+
	}
+

+
	return true;
+
}
+

+
static int
+
perform_tests (ucl_object_t *obj)
+
{
+
	struct ucl_schema_error err;
+
	ucl_object_iter_t iter = NULL;
+
	ucl_object_t *schema, *tests, *description, *test;
+

+
	if (obj->type != UCL_OBJECT) {
+
		fprintf (stdout, "Bad test case\n");
+
		return EXIT_FAILURE;
+
	}
+

+
	schema = ucl_object_find_key (obj, "schema");
+
	tests = ucl_object_find_key (obj, "tests");
+
	description = ucl_object_find_key (obj, "description");
+

+
	if (schema == NULL || tests == NULL || description == NULL) {
+
		fprintf (stdout, "Bad test case\n");
+
		return EXIT_FAILURE;
+
	}
+

+
	memset (&err, 0, sizeof (err));
+

+
	while ((test = ucl_iterate_object (tests, &iter, true)) != NULL) {
+
		if (!perform_test (schema, test, &err)) {
+
			fprintf (stdout, "Test suite '%s' failed\n",
+
							ucl_object_tostring (description));
+
			return EXIT_FAILURE;
+
		}
+
	}
+

+
	return 0;
+
}
+

+
int
+
main (int argc, char **argv)
+
{
+
	char *buf = NULL;
+
	struct ucl_parser *parser;
+
	ucl_object_t *obj = NULL, *elt;
+
	ucl_object_iter_t iter = NULL;
+
	int ret = 0;
+

+
	if (read_stdin (&buf) == -1) {
+
		exit (EXIT_FAILURE);
+
	}
+

+
	parser = ucl_parser_new (0);
+

+
	ucl_parser_add_string (parser, buf, 0);
+

+
	if (ucl_parser_get_error (parser) != NULL) {
+
		fprintf (stdout, "Error occurred: %s\n", ucl_parser_get_error (parser));
+
		ret = 1;
+
		return EXIT_FAILURE;
+
	}
+
	obj = ucl_parser_get_object (parser);
+
	ucl_parser_free (parser);
+

+
	while ((elt = ucl_iterate_object (obj, &iter, true)) != NULL) {
+
		ret = perform_tests (elt);
+
		if (ret != 0) {
+
			break;
+
		}
+
	}
+

+
	ucl_object_unref (obj);
+

+
	return ret;
+
}
deleted external/libyaml/config.h
@@ -1,81 +0,0 @@
-
/* config.h.  Generated from config.h.in by configure.  */
-
/* config.h.in.  Generated from configure.ac by autoheader.  */
-

-
/* Define to 1 if you have the <dlfcn.h> header file. */
-
#define HAVE_DLFCN_H 1
-

-
/* Define to 1 if you have the <inttypes.h> header file. */
-
#define HAVE_INTTYPES_H 1
-

-
/* Define to 1 if you have the <memory.h> header file. */
-
#define HAVE_MEMORY_H 1
-

-
/* Define to 1 if you have the <stdint.h> header file. */
-
#define HAVE_STDINT_H 1
-

-
/* Define to 1 if you have the <stdlib.h> header file. */
-
#define HAVE_STDLIB_H 1
-

-
/* Define to 1 if you have the <strings.h> header file. */
-
#define HAVE_STRINGS_H 1
-

-
/* Define to 1 if you have the <string.h> header file. */
-
#define HAVE_STRING_H 1
-

-
/* Define to 1 if you have the <sys/stat.h> header file. */
-
#define HAVE_SYS_STAT_H 1
-

-
/* Define to 1 if you have the <sys/types.h> header file. */
-
#define HAVE_SYS_TYPES_H 1
-

-
/* Define to 1 if you have the <unistd.h> header file. */
-
#define HAVE_UNISTD_H 1
-

-
/* Define to the sub-directory in which libtool stores uninstalled libraries.
-
   */
-
#define LT_OBJDIR ".libs/"
-

-
/* Name of package */
-
#define PACKAGE "yaml"
-

-
/* Define to the address where bug reports for this package should be sent. */
-
#define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component=libyaml"
-

-
/* Define to the full name of this package. */
-
#define PACKAGE_NAME "yaml"
-

-
/* Define to the full name and version of this package. */
-
#define PACKAGE_STRING "yaml 0.1.4"
-

-
/* Define to the one symbol short name of this package. */
-
#define PACKAGE_TARNAME "yaml"
-

-
/* Define to the home page for this package. */
-
#define PACKAGE_URL ""
-

-
/* Define to the version of this package. */
-
#define PACKAGE_VERSION "0.1.4"
-

-
/* Define to 1 if you have the ANSI C header files. */
-
#define STDC_HEADERS 1
-

-
/* Version number of package */
-
#define VERSION "0.1.4"
-

-
/* Define the major version number. */
-
#define YAML_VERSION_MAJOR 0
-

-
/* Define the minor version number. */
-
#define YAML_VERSION_MINOR 1
-

-
/* Define the patch version number. */
-
#define YAML_VERSION_PATCH 4
-

-
/* Define the version string. */
-
#define YAML_VERSION_STRING "0.1.4"
-

-
/* Define to empty if `const' does not conform to ANSI C. */
-
/* #undef const */
-

-
/* Define to `unsigned int' if <sys/types.h> does not define. */
-
/* #undef size_t */
deleted external/sqlite/config.h
@@ -1,3 +0,0 @@
-
#ifdef HAVE_CONFIG_H
-
#include "pkg_config.h"
-
#endif