From owner-svn-src-all@FreeBSD.ORG Sat Mar 22 17:25:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4EBB3ADE; Sat, 22 Mar 2014 17:25:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 38E062D1; Sat, 22 Mar 2014 17:25:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2MHP3AI018354; Sat, 22 Mar 2014 17:25:03 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2MHP1ec018341; Sat, 22 Mar 2014 17:25:01 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201403221725.s2MHP1ec018341@svn.freebsd.org> From: Baptiste Daroussin Date: Sat, 22 Mar 2014 17:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r263647 - in vendor/libucl/20140321: . cmake doc include src tests tests/basic tests/schema utils X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Mar 2014 17:25:03 -0000 Author: bapt Date: Sat Mar 22 17:25:01 2014 New Revision: 263647 URL: http://svnweb.freebsd.org/changeset/base/263647 Log: tag import of libucl 20140302 Added: vendor/libucl/20140321/ - copied from r263639, vendor/libucl/dist/ vendor/libucl/20140321/Makefile.am - copied unchanged from r263646, vendor/libucl/dist/Makefile.am vendor/libucl/20140321/autogen.sh - copied unchanged from r263646, vendor/libucl/dist/autogen.sh vendor/libucl/20140321/cmake/ - copied from r263646, vendor/libucl/dist/cmake/ vendor/libucl/20140321/configure.ac - copied unchanged from r263646, vendor/libucl/dist/configure.ac vendor/libucl/20140321/doc/Makefile.am - copied unchanged from r263646, vendor/libucl/dist/doc/Makefile.am vendor/libucl/20140321/doc/libucl.3 - copied unchanged from r263646, vendor/libucl/dist/doc/libucl.3 vendor/libucl/20140321/doc/pandoc.template - copied unchanged from r263646, vendor/libucl/dist/doc/pandoc.template vendor/libucl/20140321/libucl.pc.in - copied unchanged from r263646, vendor/libucl/dist/libucl.pc.in vendor/libucl/20140321/src/Makefile.am - copied unchanged from r263646, vendor/libucl/dist/src/Makefile.am vendor/libucl/20140321/src/tree.h - copied unchanged from r263646, vendor/libucl/dist/src/tree.h vendor/libucl/20140321/src/ucl_schema.c - copied unchanged from r263646, vendor/libucl/dist/src/ucl_schema.c vendor/libucl/20140321/stamp-h.in - copied unchanged from r263646, vendor/libucl/dist/stamp-h.in vendor/libucl/20140321/tests/.gitignore - copied unchanged from r263646, vendor/libucl/dist/tests/.gitignore vendor/libucl/20140321/tests/Makefile.am - copied unchanged from r263646, vendor/libucl/dist/tests/Makefile.am vendor/libucl/20140321/tests/basic/ - copied from r263646, vendor/libucl/dist/tests/basic/ vendor/libucl/20140321/tests/basic.test - copied unchanged from r263646, vendor/libucl/dist/tests/basic.test vendor/libucl/20140321/tests/generate.test - copied unchanged from r263646, vendor/libucl/dist/tests/generate.test vendor/libucl/20140321/tests/schema/ - copied from r263646, vendor/libucl/dist/tests/schema/ vendor/libucl/20140321/tests/schema.test - copied unchanged from r263646, vendor/libucl/dist/tests/schema.test vendor/libucl/20140321/tests/speed.test - copied unchanged from r263646, vendor/libucl/dist/tests/speed.test vendor/libucl/20140321/tests/test_schema.c - copied unchanged from r263646, vendor/libucl/dist/tests/test_schema.c vendor/libucl/20140321/utils/Makefile.am - copied unchanged from r263646, vendor/libucl/dist/utils/Makefile.am Replaced: vendor/libucl/20140321/Makefile.unix - copied unchanged from r263646, vendor/libucl/dist/Makefile.unix vendor/libucl/20140321/Makefile.w32 - copied unchanged from r263646, vendor/libucl/dist/Makefile.w32 vendor/libucl/20140321/README.md - copied unchanged from r263646, vendor/libucl/dist/README.md vendor/libucl/20140321/doc/api.md - copied unchanged from r263646, vendor/libucl/dist/doc/api.md vendor/libucl/20140321/include/ucl.h - copied unchanged from r263646, vendor/libucl/dist/include/ucl.h vendor/libucl/20140321/src/ucl_emitter.c - copied unchanged from r263646, vendor/libucl/dist/src/ucl_emitter.c vendor/libucl/20140321/src/ucl_hash.c - copied unchanged from r263646, vendor/libucl/dist/src/ucl_hash.c vendor/libucl/20140321/src/ucl_internal.h - copied unchanged from r263646, vendor/libucl/dist/src/ucl_internal.h vendor/libucl/20140321/src/ucl_parser.c - copied unchanged from r263646, vendor/libucl/dist/src/ucl_parser.c vendor/libucl/20140321/src/ucl_util.c - copied unchanged from r263646, vendor/libucl/dist/src/ucl_util.c vendor/libucl/20140321/tests/run_tests.sh - copied unchanged from r263646, vendor/libucl/dist/tests/run_tests.sh vendor/libucl/20140321/tests/test_basic.c - copied unchanged from r263646, vendor/libucl/dist/tests/test_basic.c vendor/libucl/20140321/tests/test_speed.c - copied unchanged from r263646, vendor/libucl/dist/tests/test_speed.c Deleted: vendor/libucl/20140321/.gitignore vendor/libucl/20140321/tests/1.in vendor/libucl/20140321/tests/1.res vendor/libucl/20140321/tests/10.in vendor/libucl/20140321/tests/2.in vendor/libucl/20140321/tests/2.res vendor/libucl/20140321/tests/3.in vendor/libucl/20140321/tests/3.res vendor/libucl/20140321/tests/4.in vendor/libucl/20140321/tests/4.res vendor/libucl/20140321/tests/5.in vendor/libucl/20140321/tests/5.res vendor/libucl/20140321/tests/6.in vendor/libucl/20140321/tests/6.res vendor/libucl/20140321/tests/7.in vendor/libucl/20140321/tests/7.res vendor/libucl/20140321/tests/8.in vendor/libucl/20140321/tests/8.res vendor/libucl/20140321/tests/9-comment.inc vendor/libucl/20140321/tests/9-empty.inc vendor/libucl/20140321/tests/9.in vendor/libucl/20140321/tests/9.inc vendor/libucl/20140321/tests/9.res Copied: vendor/libucl/20140321/Makefile.am (from r263646, vendor/libucl/dist/Makefile.am) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libucl/20140321/Makefile.am Sat Mar 22 17:25:01 2014 (r263647, copy of r263646, vendor/libucl/dist/Makefile.am) @@ -0,0 +1,7 @@ +ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = uthash README.md + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libucl.pc + +SUBDIRS = src tests utils doc \ No newline at end of file Copied: vendor/libucl/20140321/Makefile.unix (from r263646, vendor/libucl/dist/Makefile.unix) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libucl/20140321/Makefile.unix Sat Mar 22 17:25:01 2014 (r263647, copy of r263646, vendor/libucl/dist/Makefile.unix) @@ -0,0 +1,92 @@ +CC ?= gcc +DESTDIR ?= /usr/local +LD ?= gcc +C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-pointer-sign -I./include -I./uthash -I./src +MAJOR_VERSION = 0 +MINOR_VERSION = 2 +PATCH_VERSION = 9 +VERSION = "$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)" +SONAME = libucl.so +SONAME_FULL = $(SONAME).$(MAJOR_VERSION) +OBJDIR ?= .obj +TESTDIR ?= tests +SRCDIR ?= src +INCLUDEDIR ?= include +MKDIR ?= mkdir +INSTALL ?= install +RM ?= rm +RMDIR ?= rmdir +LN ?= ln +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)/ucl_schema.o \ + $(OBJDIR)/xxhash.o + +all: $(OBJDIR) $(OBJDIR)/$(SONAME) + +$(OBJDIR)/$(SONAME): $(OBJDIR)/$(SONAME_FULL) + $(LN) -sf $(SONAME_FULL) $(OBJDIR)/$(SONAME) + +$(OBJDIR)/$(SONAME_FULL): $(OBJECTS) + $(CC) -o $(OBJDIR)/$(SONAME_FULL) $(OBJECTS) $(LD_SHARED_FLAGS) $(LDFLAGS) $(SSL_LIBS) $(FETCH_LIBS) + +$(OBJDIR): + @$(MKDIR) -p $(OBJDIR) + +# Compile rules +$(OBJDIR)/ucl_util.o: $(SRCDIR)/ucl_util.c $(HDEPS) + $(CC) -o $(OBJDIR)/ucl_util.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_util.c +$(OBJDIR)/ucl_parser.o: $(SRCDIR)/ucl_parser.c $(HDEPS) + $(CC) -o $(OBJDIR)/ucl_parser.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_parser.c +$(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 $(OBJDIR)/test_schema || true + $(RMDIR) $(OBJDIR) + +# Utils + +chargen: utils/chargen.c $(OBJDIR)/$(SONAME) + $(CC) -o $(OBJDIR)/chargen $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) utils/chargen.c +objdump: utils/objdump.c $(OBJDIR)/$(SONAME) + $(CC) -o $(OBJDIR)/objdump $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) utils/objdump.c $(LD_UCL_FLAGS) + +# Tests + +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 $(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) + $(CC) -o $(OBJDIR)/test_generate $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_generate.c $(LD_UCL_FLAGS) $(LD_ADD) + +install: $(OBJDIR)/$(SONAME) + $(INSTALL) -m0755 $(SONAME) $(DESTDIR)/lib/$(SONAME) + $(INSTALL) -m0644 include/ucl.h $(DESTDIR)/include/ucl.h + +.PHONY: clean $(OBJDIR) Copied: vendor/libucl/20140321/Makefile.w32 (from r263646, vendor/libucl/dist/Makefile.w32) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libucl/20140321/Makefile.w32 Sat Mar 22 17:25:01 2014 (r263647, copy of r263646, vendor/libucl/dist/Makefile.w32) @@ -0,0 +1,90 @@ +CC ?= gcc +DESTDIR ?= /usr/local +LD ?= gcc +C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-pointer-sign -I./include -I./uthash -I./src +MAJOR_VERSION = 0 +MINOR_VERSION = 2 +PATCH_VERSION = 9 +VERSION = "$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)" +SONAME = libucl.dll +OBJDIR ?= .obj +TESTDIR ?= tests +SRCDIR ?= src +INCLUDEDIR ?= include +MKDIR ?= mkdir +INSTALL ?= install +RM ?= rm +RMDIR ?= rmdir +ifeq (Windows_NT, $(OS)) +LN ?= ln +else +LN ?= rem ln +endif +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)/ucl_schema.o \ + $(OBJDIR)/xxhash.o + +all: $(OBJDIR) $(OBJDIR)/$(SONAME) + +$(OBJDIR)/$(SONAME): $(OBJECTS) + $(CC) -o $(OBJDIR)/$(SONAME) $(OBJECTS) $(LD_SHARED_FLAGS) $(LDFLAGS) $(SSL_LIBS) $(FETCH_LIBS) + +$(OBJDIR): + @$(MKDIR) -p $(OBJDIR) + +# Compile rules +$(OBJDIR)/ucl_util.o: $(SRCDIR)/ucl_util.c $(HDEPS) + $(CC) -o $(OBJDIR)/ucl_util.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_util.c +$(OBJDIR)/ucl_parser.o: $(SRCDIR)/ucl_parser.c $(HDEPS) + $(CC) -o $(OBJDIR)/ucl_parser.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_parser.c +$(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) $(OBJDIR)/$(SONAME) $(OBJDIR)/chargen $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/objdump $(OBJDIR)/test_generate + $(RMDIR) $(OBJDIR) + +# Utils + +chargen: utils/chargen.c $(OBJDIR)/$(SONAME) + $(CC) -o $(OBJDIR)/chargen $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) utils/chargen.c +objdump: utils/objdump.c $(OBJDIR)/$(SONAME) + $(CC) -o $(OBJDIR)/objdump $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) utils/objdump.c $(LD_UCL_FLAGS) + +# Tests + +test: $(OBJDIR) $(OBJDIR)/$(SONAME) $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate + +run-test: test + TEST_DIR=$(TESTDIR) $(TESTDIR)/run_tests.sh $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate + +$(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_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) + $(CC) -o $(OBJDIR)/test_generate $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_generate.c $(LD_UCL_FLAGS) $(LD_ADD) + +install: $(OBJDIR)/$(SONAME) + $(INSTALL) -m0755 $(SONAME) $(DESTDIR)/lib/$(SONAME) + $(INSTALL) -m0644 include/ucl.h $(DESTDIR)/include/ucl.h + +.PHONY: clean $(OBJDIR) Copied: vendor/libucl/20140321/README.md (from r263646, vendor/libucl/dist/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libucl/20140321/README.md Sat Mar 22 17:25:01 2014 (r263647, copy of r263646, vendor/libucl/dist/README.md) @@ -0,0 +1,327 @@ +# LIBUCL + +[![Build Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl) + +**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* + +- [Introduction](#introduction) +- [Basic structure](#basic-structure) +- [Improvements to the json notation](#improvements-to-the-json-notation) + - [General syntax sugar](#general-syntax-sugar) + - [Automatic arrays creation](#automatic-arrays-creation) + - [Named keys hierarchy](#named-keys-hierarchy) + - [Convenient numbers and booleans](#convenient-numbers-and-booleans) +- [General improvements](#general-improvements) + - [Commments](#commments) + - [Macros support](#macros-support) + - [Variables support](#variables-support) + - [Multiline strings](#multiline-strings) +- [Emitter](#emitter) +- [Validation](#validation) +- [Performance](#performance) +- [Conclusion](#conclusion) + +## Introduction + +This document describes the main features and principles of the configuration +language called `UCL` - universal configuration language. + +If you are looking for the libucl API documentation you can find it at [this page](doc/api.md). + +## Basic structure + +UCL is heavily infused by `nginx` configuration as the example of a convenient configuration +system. However, UCL is fully compatible with `JSON` format and is able to parse json files. +For example, you can write the same configuration in the following ways: + +* in nginx like: + +```nginx +param = value; +section { + param = value; + param1 = value1; + flag = true; + number = 10k; + time = 0.2s; + string = "something"; + subsection { + host = { + host = "hostname"; + port = 900; + } + host = { + host = "hostname"; + port = 901; + } + } +} +``` + +* or in JSON: + +```json +{ + "param": "value", + "param1": "value1", + "flag": true, + "subsection": { + "host": [ + { + "host": "hostname", + "port": 900 + }, + { + "host": "hostname", + "port": 901 + } + ] + } +} +``` + +## Improvements to the json notation. + +There are various things that make ucl configuration more convenient for editing than strict json: + +### General syntax sugar + +* Braces are not necessary to enclose a top object: it is automatically treated as an object: + +```json +"key": "value" +``` +is equal to: +```json +{"key": "value"} +``` + +* There is no requirement of quotes for strings and keys, moreover, `:` may be replaced `=` or even be skipped for objects: + +```nginx +key = value; +section { + key = value; +} +``` +is equal to: +```json +{ + "key": "value", + "section": { + "key": "value" + } +} +``` + +* No commas mess: you can safely place a comma or semicolon for the last element in an array or an object: + +```json +{ + "key1": "value", + "key2": "value", +} +``` +### Automatic arrays creation + +* Non-unique keys in an object are allowed and are automatically converted to the arrays internally: + +```json +{ + "key": "value1", + "key": "value2" +} +``` +is converted to: +```json +{ + "key": ["value1", "value2"] +} +``` + +### Named keys hierarchy + +UCL accepts named keys and organize them into objects hierarchy internally. Here is an example of this process: +```nginx +section "blah" { + key = value; +} +section foo { + key = value; +} +``` + +is converted to the following object: + +```nginx +section { + blah { + key = value; + } + foo { + key = value; + } +} +``` + +Plain definitions may be more complex and contain more than a single level of nested objects: + +```nginx +section "blah" "foo" { + key = value; +} +``` + +is presented as: + +```nginx +section { + blah { + foo { + key = value; + } + } +} +``` + +### Convenient numbers and booleans + +* Numbers can have suffixes to specify standard multipliers: + + `[kKmMgG]` - standard 10 base multipliers (so `1k` is translated to 1000) + + `[kKmMgG]b` - 2 power multipliers (so `1kb` is translated to 1024) + + `[s|min|d|w|y]` - time multipliers, all time values are translated to float number of seconds, for example `10min` is translated to 600.0 and `10ms` is translated to 0.01 +* Hexadecimal integers can be used by `0x` prefix, for example `key = 0xff`. However, floating point values can use decimal base only. +* Booleans can be specified as `true` or `yes` or `on` and `false` or `no` or `off`. +* It is still possible to treat numbers and booleans as strings by enclosing them in double quotes. + +## General improvements + +### Commments + +UCL supports different style of comments: + +* single line: `#` +* multiline: `/* ... */` + +Multiline comments may be nested: +```c +# Sample single line comment +/* + some comment + /* nested comment */ + end of comment +*/ +``` + +### Macros support + +UCL supports external macros both multiline and single line ones: +```nginx +.macro "sometext"; +.macro { + Some long text + .... +}; +``` +There are two internal macros provided by UCL: + +* `include` - read a file `/path/to/file` or an url `http://example.com/file` and include it to the current place of +UCL configuration; +* `try\_include` - try to read a file or url and include it but do not create a fatal error if a file or url is not accessible; +* `includes` - read a file or an url like the previous macro, but fetch and check the signature file (which is obtained +by `.sig` suffix appending). + +Public keys which are used for the last command are specified by the concrete UCL user. + +### Variables support + +UCL supports variables in input. Variables are registered by a user of the UCL parser and can be presented in the following forms: + +* `${VARIABLE}` +* `$VARIABLE` + +UCL currently does not support nested variables. To escape variables one could use double dollar signs: + +* `$${VARIABLE}` is converted to `${VARIABLE}` +* `$$VARIABLE` is converted to `$VARIABLE` + +However, if no valid variables are found in a string, no expansion will be performed (and `$$` thus remains unchanged). This may be a subject +to change in future libucl releases. + +### Multiline strings + +UCL can handle multiline strings as well as single line ones. It uses shell/perl like notation for such objects: +``` +key = < header file.]) + ], + [AC_MSG_ERROR([unable to find the regex.h header])], + [#include ]) + +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 header file.]) + AC_CHECK_LIB(fetch, fetchXGet, [ + AC_DEFINE(HAVE_LIBFETCH, 1, [Define to 1 if you have the 'fetch' library (-lfetch).]) + LIBFETCH_LIBS="-lfetch" + have_libfetch="yes" + LIBS_EXTRA="${LIBS_EXTRA} -lfetch" + ]) + ], [],[ + #include + #ifdef HAVE_SYS_PARAM_H + #include + #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_SUBST(LIBS_EXTRA) + +AC_CONFIG_FILES(Makefile \ + src/Makefile \ + tests/Makefile \ + utils/Makefile \ + doc/Makefile \ + libucl.pc) +AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) +AC_OUTPUT Copied: vendor/libucl/20140321/doc/Makefile.am (from r263646, vendor/libucl/dist/doc/Makefile.am) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libucl/20140321/doc/Makefile.am Sat Mar 22 17:25:01 2014 (r263647, copy of r263646, vendor/libucl/dist/doc/Makefile.am) @@ -0,0 +1,8 @@ +EXTRA_DIST = api.md + +dist_man_MANS = libucl.3 + +gen-man: @PANDOC@ + tail -n +$$(grep -n '# Synopsis' api.md | cut -d':' -f1) api.md | \ + cat pandoc.template - | sed -e 's/^# \(.*\)/# \U\1/' | \ + @PANDOC@ -s -f markdown -t man -o libucl.3 \ No newline at end of file Copied: vendor/libucl/20140321/doc/api.md (from r263646, vendor/libucl/dist/doc/api.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libucl/20140321/doc/api.md Sat Mar 22 17:25:01 2014 (r263647, copy of r263646, vendor/libucl/dist/doc/api.md) @@ -0,0 +1,439 @@ +# API documentation + +**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* + +- [Synopsis](#synopsis) +- [Description](#description) + - [Parser functions](#parser-functions) + - [Emitting functions](#emitting-functions) + - [Conversion functions](#conversion-functions) + - [Generation functions](#generation-functions) + - [Iteration functions](#iteration-functions) + - [Validation functions](#validation-functions) + - [Utility functions](#utility-functions) +- [Parser functions](#parser-functions-1) + - [ucl_parser_new](#ucl_parser_new) + - [ucl_parser_register_macro](#ucl_parser_register_macro) + - [ucl_parser_register_variable](#ucl_parser_register_variable) + - [ucl_parser_add_chunk](#ucl_parser_add_chunk) + - [ucl_parser_add_string](#ucl_parser_add_string) + - [ucl_parser_add_file](#ucl_parser_add_file) + - [ucl_parser_get_object](#ucl_parser_get_object) + - [ucl_parser_get_error](#ucl_parser_get_error) + - [ucl_parser_free](#ucl_parser_free) + - [ucl_pubkey_add](#ucl_pubkey_add) + - [ucl_parser_set_filevars](#ucl_parser_set_filevars) + - [Parser usage example](#parser-usage-example) +- [Emitting functions](#emitting-functions-1) + - [ucl_object_emit](#ucl_object_emit) + - [ucl_object_emit_full](#ucl_object_emit_full) +- [Conversion functions](#conversion-functions-1) +- [Generation functions](#generation-functions-1) + - [ucl_object_new](#ucl_object_new) + - [ucl_object_typed_new](#ucl_object_typed_new) + - [Primitive objects generation](#primitive-objects-generation) + - [ucl_object_fromstring_common](#ucl_object_fromstring_common) +- [Iteration functions](#iteration-functions-1) + - [ucl_iterate_object](#ucl_iterate_object) +- [Validation functions](#validation-functions-1) + - [ucl_object_validate](#ucl_object_validate) + +# Synopsis + +`#include ` + +# Description + +Libucl is a parser and `C` API to parse and generate `ucl` objects. Libucl consist of several groups of functions: + +### Parser functions +Used to parse `ucl` files and provide interface to extract `ucl` object. Currently, `libucl` can parse only full `ucl` documents, for instance, it is impossible to parse a part of document and therefore it is impossible to use `libucl` as a streaming parser. In future, this limitation can be removed. + +### Emitting functions +Convert `ucl` objects to some textual or binary representation. Currently, libucl supports the following exports: + +- `JSON` - valid json format (can possibly loose some original data, such as implicit arrays) +- `Config` - human-readable configuration format (losseless) +- `YAML` - embedded yaml format (has the same limitations as `json` output) + +### Conversion functions +Help to convert `ucl` objects to C types. These functions are used to convert `ucl_object_t` to C primitive types, such as numbers, strings or boolean values. + +### Generation functions +Allow creating of `ucl` objects from C types and creating of complex `ucl` objects, such as hashes or arrays from primitive `ucl` objects, such as numbers or strings. + +### Iteration functions +Iterate over `ucl` complex objects or over a chain of values, for example when a key in an object has multiple values (that can be treated as implicit array or implicit consolidation). + +### Validation functions +Validation functions are used to validate some object `obj` using json-schema compatible object `schema`. Both input and schema must be UCL objects to perform validation. + +### Utility functions +Provide basic utilities to manage `ucl` objects: creating, removing, retaining and releasing reference count and so on. + +# Parser functions + +Parser functions operates with `struct ucl_parser`. + +### ucl_parser_new + +~~~C +struct ucl_parser* ucl_parser_new (int flags); +~~~ + +Creates new parser with the specified flags: + +- `UCL_PARSER_KEY_LOWERCASE` - lowercase keys parsed +- `UCL_PARSER_ZEROCOPY` - try to use zero-copy mode when reading files (in zero-copy mode text chunk being parsed without copying strings so it should exist till any object parsed is used) +- `UCL_PARSER_NO_TIME` - treat time values as strings without parsing them as floats + +### ucl_parser_register_macro + +~~~C +void ucl_parser_register_macro (struct ucl_parser *parser, + const char *macro, ucl_macro_handler handler, void* ud); +~~~ + +Register new macro with name .`macro` parsed by handler `handler` that accepts opaque data pointer `ud`. Macro handler should be of the following type: + +~~~C +bool (*ucl_macro_handler) (const unsigned char *data, + size_t len, void* ud);` +~~~ + +Handler function accepts macro text `data` of length `len` and the opaque pointer `ud`. If macro is parsed successfully the handler should return `true`. `false` indicates parsing failure and the parser can be terminated. + +### ucl_parser_register_variable + +~~~C +void ucl_parser_register_variable (struct ucl_parser *parser, + const char *var, const char *value); +~~~ + +Register new variable $`var` that should be replaced by the parser to the `value` string. + +### ucl_parser_add_chunk + +~~~C +bool ucl_parser_add_chunk (struct ucl_parser *parser, + const unsigned char *data, size_t len); +~~~ + +Add new text chunk with `data` of length `len` to the parser. At the moment, `libucl` parser is not a streamlined parser and chunk *must* contain the *valid* ucl object. For example, this object should be valid: + +~~~json +{ "var": "value" } +~~~ + +while this one won't be parsed correctly: + +~~~json +{ "var": +~~~ + +This limitation may possible be removed in future. + +### ucl_parser_add_string +~~~C +bool ucl_parser_add_string (struct ucl_parser *parser, + const char *data, size_t len); +~~~ + +This function acts exactly like `ucl_parser_add_chunk` does but if `len` argument is zero, then the string `data` must be zero-terminated and the actual length is calculated up to `\0` character. + +### ucl_parser_add_file + +~~~C +bool ucl_parser_add_file (struct ucl_parser *parser, + const char *filename); +~~~ + +Load file `filename` and parse it with the specified `parser`. This function uses `mmap` call to load file, therefore, it should not be `shrinked` during parsing. Otherwise, `libucl` can cause memory corruption and terminate the calling application. This function is also used by the internal handler of `include` macro, hence, this macro has the same limitation. + +### ucl_parser_get_object + +~~~C +ucl_object_t* ucl_parser_get_object (struct ucl_parser *parser); +~~~ + +If the `ucl` data has been parsed correctly this function returns the top object for the parser. Otherwise, this function returns the `NULL` pointer. The reference count for `ucl` object returned is increased by one, therefore, a caller should decrease reference by using `ucl_object_unref` to free object after usage. + +### ucl_parser_get_error + +~~~C +const char *ucl_parser_get_error(struct ucl_parser *parser); +~~~ + +Returns the constant error string for the parser object. If no error occurred during parsing a `NULL` object is returned. A caller should not try to free or modify this string. + +### ucl_parser_free + +~~~C +void ucl_parser_free (struct ucl_parser *parser); +~~~ + +Frees memory occupied by the parser object. The reference count for top object is decreased as well, however if the function `ucl_parser_get_object` was called previously then the top object won't be freed. + +### ucl_pubkey_add + +~~~C +bool ucl_pubkey_add (struct ucl_parser *parser, + const unsigned char *key, size_t len); +~~~ + +This function adds a public key from text blob `key` of length `len` to the `parser` object. This public key should be in the `PEM` format and can be used by `.includes` macro for checking signatures of files included. `Openssl` support should be enabled to make this function working. If a key cannot be added (e.g. due to format error) or `openssl` was not linked to `libucl` then this function returns `false`. + +### ucl_parser_set_filevars + +~~~C +bool ucl_parser_set_filevars (struct ucl_parser *parser, + const char *filename, bool need_expand); +~~~ + +Add the standard file variables to the `parser` based on the `filename` specified: + +- `$FILENAME` - a filename of `ucl` input +- `$CURDIR` - a current directory of the input + +For example, if a `filename` param is `../something.conf` then the variables will have the following values: + +- `$FILENAME` - "../something.conf" +- `$CURDIR` - ".." + +if `need_expand` parameter is `true` then all relative paths are expanded using `realpath` call. In this example if `..` is `/etc/dir` then variables will have these values: + +- `$FILENAME` - "/etc/something.conf" +- `$CURDIR` - "/etc" + +## Parser usage example + +The following example loads, parses and extracts `ucl` object from stdin using `libucl` parser functions (the length of input is limited to 8K): + +~~~C +char inbuf[8192]; +struct ucl_parser *parser = NULL; +int ret = 0, r = 0; +ucl_object_t *obj = NULL; +FILE *in; + +in = stdin; +parser = ucl_parser_new (0); +while (!feof (in) && r < (int)sizeof (inbuf)) { + r += fread (inbuf + r, 1, sizeof (inbuf) - r, in); +} +ucl_parser_add_chunk (parser, inbuf, r); +fclose (in); + +if (ucl_parser_get_error (parser)) { + printf ("Error occured: %s\n", ucl_parser_get_error (parser)); + ret = 1; +} +else { + obj = ucl_parser_get_object (parser); +} + +if (parser != NULL) { + ucl_parser_free (parser); +} +if (obj != NULL) { + ucl_object_unref (obj); +} +return ret; +~~~ + +# Emitting functions + +Libucl can transform UCL objects to a number of tectual formats: + +- configuration (`UCL_EMIT_CONFIG`) - nginx like human readable configuration file where implicit arrays are transformed to the duplicate keys +- compact json: `UCL_EMIT_JSON_COMPACT` - single line valid json without spaces +- formatted json: `UCL_EMIT_JSON` - pretty formatted JSON with newlines and spaces +- compact yaml: `UCL_EMIT_YAML` - compact YAML output + +Moreover, libucl API allows to select a custom set of emitting functions allowing +efficent and zero-copy output of libucl objects. Libucl uses the following structure to support this feature: + +~~~C +struct ucl_emitter_functions { + /** Append a single character */ + int (*ucl_emitter_append_character) (unsigned char c, size_t nchars, void *ud); + /** Append a string of a specified length */ + int (*ucl_emitter_append_len) (unsigned const char *str, size_t len, void *ud); + /** Append a 64 bit integer */ + int (*ucl_emitter_append_int) (int64_t elt, void *ud); + /** Append floating point element */ + int (*ucl_emitter_append_double) (double elt, void *ud); + /** Opaque userdata pointer */ + void *ud; +}; +~~~ + +This structure defines the following callbacks: + +- `ucl_emitter_append_character` - a function that is called to append `nchars` characters equal to `c` +- `ucl_emitter_append_len` - used to append a string of length `len` starting from pointer `str` +- `ucl_emitter_append_int` - this function applies to integer numbers +- `ucl_emitter_append_double` - this function is intended to output floating point variable + +The set of these functions could be used to output text formats of `UCL` objects to different structures or streams. + +Libucl provides the following functions for emitting UCL objects: + +### ucl_object_emit + +~~~C +unsigned char *ucl_object_emit (ucl_object_t *obj, enum ucl_emitter emit_type); +~~~ + +Allocate a string that is suitable to fit the underlying UCL object `obj` and fill it with the textual representation of the object `obj` according to style `emit_type`. The caller should free the returned string after using. + +### ucl_object_emit_full + +~~~C +bool ucl_object_emit_full (ucl_object_t *obj, enum ucl_emitter emit_type, + struct ucl_emitter_functions *emitter); +~~~ + +This function is similar to the previous with the exception that it accepts the additional argument `emitter` that defines the concrete set of output functions. This emit function could be useful for custom structures or streams emitters (including C++ ones, for example). + +# Conversion functions + +Conversion functions are used to convert UCL objects to primitive types, such as strings, numbers or boolean values. There are two types of conversion functions: + +- safe: try to convert an ucl object to a primitive type and fail if such a conversion is not possible +- unsafe: return primitive type without additional checks, if the object cannot be converted then some reasonable default is returned (NULL for strings and 0 for numbers) + +Also there is a single `ucl_object_tostring_forced` function that converts any UCL object (including compound types - arrays and objects) to a string representation. For compound and numeric types this function performs emitting to a compact json format actually. + +Here is a list of all conversion functions: + +- `ucl_object_toint` - returns `int64_t` of UCL object +- `ucl_object_todouble` - returns `double` of UCL object +- `ucl_object_toboolean` - returns `bool` of UCL object +- `ucl_object_tostring` - returns `const char *` of UCL object (this string is NULL terminated) +- `ucl_object_tolstring` - returns `const char *` and `size_t` len of UCL object (string can be not NULL terminated) +- `ucl_object_tostring_forced` - returns string representation of any UCL object + +Strings returned by these pointers are associated with the UCL object and exist over its lifetime. A caller should not free this memory. + +# Generation functions + +It is possible to generate UCL objects from C primitive types. Moreover, libucl permits to create and modify complex UCL objects, such as arrays or associative objects. + +## ucl_object_new +~~~C *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***