Import libxo 0.1.4

Obtained from:	https://github.com/Juniper/libxo
Sponsored by:	Juniper Networks, Inc.
This commit is contained in:
marcel 2014-10-23 22:30:14 +00:00
parent bc4f095bf4
commit fefcd296e4
204 changed files with 37851 additions and 0 deletions

43
contrib/libxo/.gitignore vendored Normal file
View File

@ -0,0 +1,43 @@
# Object files
*.o
# Libraries
*.lib
*.a
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.app
*~
*.orig
aclocal.m4
ar-lib
autom4te.cache
build
compile
config.guess
config.h.in
config.sub
depcomp
ltmain.sh
missing
Makefile.in
configure
.DS_Store
xoconfig.h.in
.gdbinit
.gdbinit.local
xtest
xtest.dSYM
tests/w

12
contrib/libxo/.travis.yml Normal file
View File

@ -0,0 +1,12 @@
language: c
script: printenv && uname -a && /bin/sh ./bin/setup.sh && cd build && ../configure --enable-warnings && make && sudo make install && make test
notifications:
recipients:
- libslax-noise@googlegroups.com
branches:
only:
- master
- develop

23
contrib/libxo/Copyright Normal file
View File

@ -0,0 +1,23 @@
Copyright (c) 2014 Juniper Networks, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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.

23
contrib/libxo/LICENSE Normal file
View File

@ -0,0 +1,23 @@
Copyright (c) 2014, Juniper Networks
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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.

102
contrib/libxo/Makefile.am Normal file
View File

@ -0,0 +1,102 @@
#
# $Id$
#
# Copyright 2014, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = libxo xo xolint tests doc
bin_SCRIPTS=libxo-config
dist_doc_DATA = Copyright
EXTRA_DIST = \
libxo-config.in \
warnings.mk \
README.md \
INSTALL.md \
packaging/libxo.spec
.PHONY: test tests
test tests:
@(cd tests ; ${MAKE} test)
errors:
@(cd tests/errors ; ${MAKE} test)
docs:
@(cd doc ; ${MAKE} docs)
DIST_FILES_DIR = ~/Dropbox/dist-files/
GH_PAGES_DIR = gh-pages/
PACKAGE_FILE = ${PACKAGE_TARNAME}-${PACKAGE_VERSION}.tar.gz
upload: dist upload-docs
@echo "Remember to run:"
@echo " gt tag ${PACKAGE_VERSION}"
upload-docs: docs
@echo "Uploading libxo-manual.html ... "
@-[ -d ${GH_PAGES_DIR} ] \
&& echo "Updating manual on gh-pages ..." \
&& cp doc/libxo-manual.html ${GH_PAGES_DIR} \
&& (cd ${GH_PAGES_DIR} \
&& git commit -m 'new docs' \
libxo-manual.html \
&& git push origin gh-pages ) ; true
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA = packaging/${PACKAGE_NAME}.pc
get-wiki:
git clone https://github.com/Juniper/${PACKAGE_NAME}.wiki.git wiki
get-gh-pages:
git clone https://github.com/Juniper/${PACKAGE_NAME}.git \
gh-pages -b gh-pages
UPDATE_PACKAGE_FILE = \
-e "s;__SHA1__;$$SHA1;" \
-e "s;__SHA256__;SHA256 (textproc/${PACKAGE_FILE}) = $$SHA256;" \
-e "s;__SIZE__;SIZE (textproc/${PACKAGE_FILE}) = $$SIZE;"
GH_PACKAGING_DIR = packaging/${PACKAGE_VERSION}
GH_PAGES_PACKAGE_DIR = ${GH_PAGES_DIR}/${GH_PACKAGING_DIR}
packages:
@-[ -d ${GH_PAGES_DIR} ] && set -x \
&& echo "Updating packages on gh-pages ..." \
&& SHA1="`openssl sha1 ${PACKAGE_FILE} | awk '{print $$2}'`" \
&& SHA256="`openssl sha256 ${PACKAGE_FILE} | awk '{print $$2}'`" \
&& SIZE="`ls -l ${PACKAGE_FILE} | awk '{print $$5}'`" \
&& mkdir -p ${GH_PAGES_PACKAGE_DIR}/freebsd \
&& echo "... ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.rb ..." \
&& sed ${UPDATE_PACKAGE_FILE} \
packaging/${PACKAGE_NAME}.rb.base \
> ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.rb \
&& echo "... ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.spec ..." \
&& cp packaging/${PACKAGE_NAME}.spec \
${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.spec \
&& echo "... ${GH_PAGES_PACKAGE_DIR}/freebsd ..." \
&& sed ${UPDATE_PACKAGE_FILE} \
${srcdir}/packaging/freebsd/distinfo.base \
> ${GH_PAGES_PACKAGE_DIR}/freebsd/distinfo \
&& cp ${srcdir}/packaging/freebsd/pkg-descr \
${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-descr \
&& cp ${srcdir}/packaging/freebsd/pkg-plist \
${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-plist \
&& cp ${srcdir}/packaging/freebsd/pkg-plist \
${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-plist \
&& cp packaging/freebsd/port-Makefile \
${GH_PAGES_PACKAGE_DIR}/freebsd/Makefile \
&& (cd ${GH_PAGES_DIR} \
&& git add ${GH_PACKAGING_DIR} \
&& git commit -m 'new packaging data' \
${GH_PACKAGING_DIR} \
&& git push origin gh-pages ) ; true

62
contrib/libxo/README.md Normal file
View File

@ -0,0 +1,62 @@
libxo
=====
libxo - A Library for Generating Text, XML, JSON, and HTML Output
The libxo library allows an application to generate text, XML, JSON,
and HTML output using a common set of function calls. The application
decides at run time which output style should be produced. The
application calls a function "xo_emit" to product output that is
described in a format string. A "field descriptor" tells libxo what
the field is and what it means.
```
xo_emit(" {:lines/%7ju/%ju} {:words/%7ju/%ju} "
"{:characters/%7ju/%ju}{d:filename/%s}\n",
linect, wordct, charct, file);
```
Output can then be generated in various style, using the "--libxo"
option:
```
% wc /etc/motd
25 165 1140 /etc/motd
% wc --libxo xml,pretty,warn /etc/motd
<wc>
<file>
<filename>/etc/motd</filename>
<lines>25</lines>
<words>165</words>
<characters>1140</characters>
</file>
</wc>
% wc --libxo json,pretty,warn /etc/motd
{
"wc": {
"file": [
{
"filename": "/etc/motd",
"lines": 25,
"words": 165,
"characters": 1140
}
]
}
}
% wc --libxo html,pretty,warn /etc/motd
<div class="line">
<div class="text"> </div>
<div class="data" data-tag="lines"> 25</div>
<div class="text"> </div>
<div class="data" data-tag="words"> 165</div>
<div class="text"> </div>
<div class="data" data-tag="characters"> 1140</div>
<div class="text"> </div>
<div class="data" data-tag="filename">/etc/motd</div>
</div>
```
View the beautiful documentation at:
http://juniper.github.io/libxo/libxo-manual.html

View File

@ -0,0 +1,29 @@
#
# Copyright 2013, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = gt setup.sh
GT_INSTALL_DIR = ${prefix}/bin
GT_INSTALL_FILES = gt
install-data-hook:
@echo "Installing gt ... "
@-mkdir -p ${GT_INSTALL_DIR}
@for file in ${GT_INSTALL_FILES} ; do \
if [ -f $$file ]; then \
rfile=$$file ; \
else \
rfile=${srcdir}/$$file ; \
fi ; \
mdir=${GT_INSTALL_DIR}/ ; \
mkdir -p $$mdir ; \
cp $$rfile $$mdir/ ; \
done
@${CHMOD} a+x ${GT_INSTALL_DIR}/gt

View File

@ -0,0 +1,24 @@
set top_src=`pwd`
alias Zautoreconf "(cd $top_src ; autoreconf --install)"
set opts=' \
--with-libslax-prefix=/Users/phil/work/root \
--enable-debug \
--enable-warnings \
--enable-printflike \
--prefix ${HOME}/work/root \
'
set opts=`echo $opts`
setenv CONFIGURE_OPTS "$opts"
setenv ADB_PATH $top_src/build/libxo/.libs
alias Zconfigure "(cd $top_src/build; ../configure $opts)"
alias Zbuild "(cd $top_src/build; make \!* )"
alias mi "(cd $top_src/build; make && make install); ."
mkdir -p build
cd build
alias xx 'cc -I.. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wnested-externs -Wparentheses -Wreturn-type -Wshadow -Wswitch -Wtrigraphs -Wuninitialized -Wunused -Wwrite-strings -fno-inline-functions-called-once -g -O2 -o xtest -DUNIT_TEST libxo.c'

31
contrib/libxo/bin/setup.sh Executable file
View File

@ -0,0 +1,31 @@
#
# Copyright 2013, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
if [ ! -f configure ]; then
vers=`autoreconf --version | head -1`
echo "Using" $vers
autoreconf --install
if [ ! -f configure ]; then
echo "Failed to create configure script"
exit 1
fi
fi
echo "Creating build directory ..."
mkdir build
echo "Setup is complete. To build libslax:"
echo " 1) Type 'cd build ; ../configure' to configure libslax"
echo " 2) Type 'make' to build libslax"
echo " 3) Type 'make install' to install libslax"
exit 0

View File

263
contrib/libxo/configure.ac Normal file
View File

@ -0,0 +1,263 @@
#
# $Id$
#
# See ./INSTALL for more info
#
#
# Release numbering: even numbered dot releases are official ones, and
# odd numbers are development ones. The svn version of this file will
# only (ONLY!) ever (EVER!) contain odd numbers, so I'll always know if
# a particular user has the dist or svn release.
#
AC_PREREQ(2.2)
AC_INIT([libxo], [0.1.4], [phil@juniper.net])
AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
# Support silent build rules. Requires at least automake-1.11.
# Disable with "configure --disable-silent-rules" or "make V=1"
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PROG_CC
AM_PROG_AR
AC_PROG_INSTALL
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_LN_S
# Must be after AC_PROG_AR
LT_INIT([dlopen shared])
AC_PATH_PROG(BASENAME, basename, /usr/bin/basename)
AC_PATH_PROG(BISON, bison, /usr/bin/bison)
AC_PATH_PROG(CAT, cat, /bin/cat)
AC_PATH_PROG(CHMOD, chmod, /bin/chmod)
AC_PATH_PROG(CP, cp, /bin/cp)
AC_PATH_PROG(DIFF, diff, /usr/bin/diff)
AC_PATH_PROG(MKDIR, mkdir, /bin/mkdir)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(SED, sed, /bin/sed)
AC_STDC_HEADERS
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([bzero memmove strchr strcspn strerror strspn])
AC_CHECK_FUNCS([sranddev srand strlcpy])
AC_CHECK_FUNCS([fdopen getrusage])
AC_CHECK_FUNCS([gettimeofday ctime])
AC_CHECK_FUNCS([getpass])
AC_CHECK_FUNCS([sysctlbyname])
AC_CHECK_FUNCS([flock])
AC_CHECK_FUNCS([asprintf])
AC_CHECK_HEADERS([dlfcn.h])
AC_CHECK_HEADERS([tzfile.h])
AC_CHECK_HEADERS([stdtime/tzfile.h])
AC_CHECK_FUNCS([dlfunc])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([ctype.h errno.h stdio.h stdlib.h])
AC_CHECK_HEADERS([string.h sys/param.h unistd.h ])
AC_CHECK_HEADERS([sys/sysctl.h])
AC_CHECK_LIB([crypto], [MD5_Init])
AM_CONDITIONAL([HAVE_LIBCRYPTO], [test "$HAVE_LIBCRYPTO" != "no"])
dnl
dnl Some packages need to be checked against version numbers so we
dnl define a function here for later use
dnl
AC_DEFUN([VERSION_TO_NUMBER],
[`$1 | sed -e 's/lib.* //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
LIBSLAX_CONFIG_PREFIX=""
LIBSLAX_SRC=""
AC_ARG_WITH(libslax-prefix,
[ --with-libslax-prefix=[PFX] Specify location of libslax config],
LIBSLAX_CONFIG_PREFIX=$withval
)
AC_MSG_CHECKING(for libslax)
if test "x$LIBSLAX_CONFIG_PREFIX" != "x"
then
SLAX_CONFIG=${LIBSLAX_CONFIG_PREFIX}/bin/slax-config
else
SLAX_CONFIG=slax-config
fi
dnl
dnl make sure slax-config is executable,
dnl test version and init our variables
dnl
if ${SLAX_CONFIG} --libs > /dev/null 2>&1
then
LIBSLAX_VERSION=`$SLAX_CONFIG --version`
SLAX_BINDIR="`$SLAX_CONFIG --bindir | head -1`"
SLAX_OXTRADOCDIR="`$SLAX_CONFIG --oxtradoc | head -1`"
AC_MSG_RESULT($LIBSLAX_VERSION found)
else
LIBSLAX_VERSION=
SLAX_BINDIR=
SLAX_OXTRADOCDIR=
AC_MSG_RESULT([no])
fi
AC_SUBST(SLAX_BINDIR)
AC_SUBST(SLAX_OXTRADOCDIR)
AC_MSG_CHECKING([whether to build with warnings])
AC_ARG_ENABLE([warnings],
[ --enable-warnings Turn on compiler warnings],
[LIBXO_WARNINGS=$enableval],
[LIBXO_WARNINGS=no])
AC_MSG_RESULT([$LIBXO_WARNINGS])
AM_CONDITIONAL([LIBXO_WARNINGS_HIGH], [test "$LIBXO_WARNINGS" != "no"])
AC_MSG_CHECKING([whether to build with debugging])
AC_ARG_ENABLE([debug],
[ --enable-debug Turn on debugging],
[LIBXO_DEBUG=yes; AC_DEFINE([LIBXO_DEBUG], [1], [Enable debugging])],
[LIBXO_DEBUG=no])
AC_MSG_RESULT([$LIBXO_DEBUG])
AM_CONDITIONAL([LIBXO_DEBUG], [test "$LIBXO_DEBUG" != "no"])
AC_CHECK_LIB([m], [lrint])
AM_CONDITIONAL([HAVE_LIBM], [test "$HAVE_LIBM" != "no"])
AC_MSG_CHECKING([compiler for gcc])
HAVE_GCC=no
if test "${CC}" != ""; then
HAVE_GCC=`${CC} --version 2>&1 | grep GCC`
if test "${HAVE_GCC}" != ""; then
HAVE_GCC=yes
else
HAVE_GCC=no
fi
fi
AC_MSG_RESULT([$HAVE_GCC])
AM_CONDITIONAL([HAVE_GCC], [test "$HAVE_GCC" = "yes"])
AC_MSG_CHECKING([whether to build with printflike])
AC_ARG_ENABLE([printflike],
[ --enable-printflike Enable use of GCC __printflike attribute],
[HAVE_PRINTFLIKE=yes;
AC_DEFINE([HAVE_PRINTFLIKE], [1], [Support printflike])],
[HAVE_PRINTFLIKE=no])
AC_MSG_RESULT([$HAVE_PRINTFLIKE])
AM_CONDITIONAL([HAVE_PRINTFLIKE], [test "$HAVE_PRINTFLIKE" != ""])
AC_MSG_CHECKING([whether to build with LIBXO_OPTIONS])
AC_ARG_ENABLE([libxo-options],
[ --disable-libxo-options Turn off support for LIBXO_OPTIONS],
[LIBXO_OPTS=$enableval],
[LIBXO_OPTS=yes])
AC_MSG_RESULT([$LIBXO_OPTS])
AM_CONDITIONAL([NO_LIBXO_OPTIONS], [test "$LIBXO_OPTS" != "yes"])
case $host_os in
darwin*)
LIBTOOL=glibtool
;;
Linux*|linux*)
CFLAGS="-D_GNU_SOURCE $CFLAGS"
LDFLAGS=-ldl
;;
cygwin*|CYGWIN*)
LDFLAGS=-no-undefined
;;
esac
case $prefix in
NONE)
prefix=/usr/local
;;
esac
XO_LIBS=-lxo
XO_SRCDIR=${srcdir}
XO_LIBDIR=${libdir}
XO_BINDIR=${bindir}
XO_INCLUDEDIR=${includedir}
AC_SUBST(XO_SRCDIR)
AC_SUBST(XO_LIBDIR)
AC_SUBST(XO_BINDIR)
AC_SUBST(XO_INCLUDEDIR)
AC_ARG_WITH(share-dir,
[ --with-share-dir=[DIR] Specify location of shared files],
[XO_SHAREDIR=$withval],
[XO_SHAREDIR=$datarootdir/libxo]
)
XO_SHAREDIR=`echo $XO_SHAREDIR | sed "s;\\${prefix};$prefix;"`
AC_SUBST(XO_SHAREDIR)
dnl for the spec file
RELDATE=`date +'%Y-%m-%d%n'`
AC_SUBST(RELDATE)
AC_MSG_RESULT(Using configure dir $ac_abs_confdir)
if test -d $ac_abs_confdir/.git ; then
extra=`git branch | awk '/\*/ { print $2 }'`
if test "$extra" != "" -a "$extra" != "master"
then
LIBXO_VERSION_EXTRA="-git-$extra"
fi
fi
LIBXO_VERSION=$PACKAGE_VERSION
LIBXO_VERSION_NUMBER=VERSION_TO_NUMBER(echo $PACKAGE_VERSION)
AC_SUBST(LIBXO_VERSION)
AC_SUBST(LIBXO_VERSION_NUMBER)
AC_SUBST(LIBXO_VERSION_EXTRA)
AC_CONFIG_HEADERS([libxo/xoconfig.h])
AC_CONFIG_FILES([
Makefile
libxo-config
xohtml/xohtml.sh
libxo/Makefile
libxo/xoversion.h
xo/Makefile
xolint/Makefile
packaging/libxo.pc
doc/Makefile
tests/Makefile
tests/core/Makefile
tests/xo/Makefile
packaging/libxo.spec
])
AC_OUTPUT
AC_MSG_NOTICE([summary of build options:
libxo version: ${VERSION} ${LIBXO_VERSION_EXTRA}
host type: ${host} / ${host_os}
install prefix: ${prefix}
srcdir: ${XO_SRCDIR}
libdir: ${XO_LIBDIR}
bindir: ${XO_BINDIR}
includedir: ${XO_INCLUDEDIR}
share dir: ${XO_SHAREDIR}
compiler: ${CC} (${HAVE_GCC:-no})
compiler flags: ${CFLAGS}
library types: Shared=${enable_shared}, Static=${enable_static}
warnings: ${LIBXO_WARNINGS:-no}
debug: ${LIBXO_DEBUG:-no}
printf-like: ${HAVE_PRINTFLIKE:-no}
libxo-options: ${LIBXO_OPTS:-no}
])

View File

@ -0,0 +1,65 @@
#
# $Id$
#
# Copyright 2014, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
OXTRADOC_DIR = ${SLAX_OXTRADOCDIR}
OXTRADOC_PREFIX = ${OXTRADOC_DIR}
OXTRADOC = ${OXTRADOC_DIR}/oxtradoc
SLAXPROC_BINDIR = ${SLAX_BINDIR}
XML2RFC = ${OXTRADOC_DIR}/xml2rfc.tcl
XML2HTMLDIR = ${OXTRADOC_DIR}
XML2HTMLBIN = ${XML2HTMLDIR}/rfc2629-to-html.slax
SLAXPROC = ${SLAX_BINDIR}/slaxproc
SLAXPROC_ARGS = \
-a oxtradoc-dir ${OXTRADOC_DIR} \
-a oxtradoc-install-dir ${OXTRADOC_DIR} \
-a anchor-prefix docs
SLAXPROC_ARGS_INLINE = \
-a oxtradoc-inline yes
SLAXPROC_ARGS += ${SLAXPROC_ARGS_INLINE}
XML2HTML = \
${SLAXPROC} -g -e -I ${OXTRADOC_DIR} -I . \
${SLAXPROC_ARGS} \
${XML2HTMLBIN}
OX_ARGS = -P ${OXTRADOC_PREFIX} -L ${OXTRADOC_PREFIX}
OX_ARGS += -S ${SLAXPROC} -p doc
OX_CMD = ${PERL} ${PERLOPTS} ${OXTRADOC} ${OX_ARGS}
OXTRADOC_CMD = ${OX_CMD}
OUTPUT = libxo-manual
INPUT = libxo.txt
EXTRA_DIST = \
${INPUT} \
${OUTPUT}.html \
${OUTPUT}.txt
doc docs: ${OUTPUT}.txt ${OUTPUT}.html
${OUTPUT}.txt: ${INPUT} ${OXTRADOC} xolint.txt
${OXTRADOC_CMD} -m text -o $@ $<
${OUTPUT}.html: ${INPUT} ${OXTRADOC} ${XML2HTMLBIN} xolint.txt
${OXTRADOC_CMD} -m html -o $@ $<
xolint.txt: ${top_srcdir}/xolint/xolint.pl
perl ${top_srcdir}/xolint/xolint.pl -D > xolint.txt
CLEANFILES = \
${OUTPUT}.xml \
${OUTPUT}.txt \
${OUTPUT}.fxml \
${OUTPUT}.html

2400
contrib/libxo/doc/libxo.txt Normal file

File diff suppressed because it is too large Load Diff

527
contrib/libxo/install-sh Executable file
View File

@ -0,0 +1,527 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# 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, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -0,0 +1,119 @@
#! /bin/sh
#
# $Id$
#
# Copyright 2011-2014, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
libdir=@libdir@
usage()
{
cat <<EOF
Usage: libxo-config [OPTION]
Known values for OPTION are:
--prefix=DIR change libxo prefix [default $prefix]
--exec-prefix=DIR change libxo exec prefix [default $exec_prefix]
--libs print library linking information
--bindir print the bin directory
--cflags print pre-processor and compiler flags
--share print share directory
--help display this help and exit
--version output version information
EOF
exit $1
}
if test $# -eq 0; then
usage 1
fi
cflags=false
libs=false
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
--prefix=*)
prefix=$optarg
includedir=$prefix/include
libdir=$prefix/lib
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
libdir=$exec_prefix/lib
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo @VERSION@
exit 0
;;
--help)
usage 0
;;
--cflags)
echo -I@LIBXO_INCLUDEDIR@ @LIBXO_CFLAGS@
;;
--share)
echo @LIBXO_SHAREDIR@
;;
--bindir)
echo @LIBXO_BINDIR@
;;
--libdir)
echo @LIBXO_LIBDIR@
;;
--libs)
if [ "`uname`" = "Linux" ]
then
if [ "@LIBXO_LIBDIR@" = "-L/usr/lib" -o "@LIBXO_LIBDIR@" = "-L/usr/lib64" ]
then
echo @LIBXO_LIBS@
else
echo -L@LIBXO_LIBDIR@ @LIBXO_LIBS@
fi
else
echo -L@LIBXO_LIBDIR@ @LIBXO_LIBS@ @WIN32_EXTRA_LIBADD@
fi
;;
*)
usage
exit 1
;;
esac
shift
done
exit 0

View File

@ -0,0 +1,49 @@
#
# Copyright 2014, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
if LIBXO_WARNINGS_HIGH
LIBXO_WARNINGS = HIGH
endif
if HAVE_GCC
GCC_WARNINGS = yes
endif
include ${top_srcdir}/warnings.mk
libxoincdir = ${includedir}/libxo
AM_CFLAGS = -I${top_srcdir} ${WARNINGS}
lib_LTLIBRARIES = libxo.la
libxoinc_HEADERS = \
xo.h
libxo_la_SOURCES = \
libxo.c
man_MANS = \
libxo.3 \
xo_attr.3 \
xo_create.3 \
xo_emit.3 \
xo_err.3 \
xo_finish.3 \
xo_flush.3 \
xo_format.5 \
xo_no_setlocale.3 \
xo_open_container.3 \
xo_open_list.3 \
xo_parse_args.3 \
xo_set_allocator.3 \
xo_set_flags.3 \
xo_set_info.3 \
xo_set_options.3 \
xo_set_style.3 \
xo_set_writer.3
EXTRA_DIST =

76
contrib/libxo/libxo/gen-wide.sh Executable file
View File

@ -0,0 +1,76 @@
#!/bin/sh
FILE=$1
SYMBOLS="
xo_buffer_s
xo_buffer_t
xo_stack_s
xo_stack_t
xo_handle_s
xo_handle_t
xo_default_handle
xo_default_inited
xo_realloc
xo_free
xo_write_to_file
xo_close_file
xo_buf_init
xo_init_handle
xo_default_init
xo_buf_has_room
xo_printf
xo_escape_xml
xo_escape_json
xo_buf_append
xo_buf_escape
xo_data_append
xo_data_escape
xo_default
xo_indent
xo_warn
xo_create
xo_create_to_file
xo_destroy
xo_set_style
xo_set_flags
xo_set_info
xo_set_formatter
xo_clear_flags
xo_buf_indent
xo_line_ensure_open
xo_line_close
xo_info_compare
xo_info_find
xo_format_data
xo_buf_append_div
xo_format_text
xo_format_label
xo_format_title
xo_format_prep
xo_format_value
xo_format_decoration
xo_format_padding
xo_do_emit
xo_emit_hv
xo_emit_h
xo_emit
xo_attr_hv
xo_attr_h
xo_attr
xo_depth_change
xo_open_container_h
xo_open_container
xo_close_container_h
xo_close_container
xo_open_list_h
xo_open_list
xo_close_list_h
xo_close_list
xo_open_instance_h
xo_open_instance
xo_close_instance_h
xo_close_instance
xo_set_writer
xo_set_allocator
"

149
contrib/libxo/libxo/libxo.3 Normal file
View File

@ -0,0 +1,149 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm libxo
.Nd library for emitting text, XML, JSON, or HTML output
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Sh DESCRIPTION
The functions defined in
.Lb libxo
are used to generate a choice of
.Em TEXT ,
.Em XML ,
.Em JSON ,
or
.Em HTML
output. A common set of functions are used, with
command line switches passed to the library to control the details of
the output.
.Pp
Most commands emit text output aimed at humans. It is designed
to be parsed and understood by a user. Humans are gifted at extracted
details and pattern matching. Often programmers need to extract
information from this human-oriented output. Programmers use tools
like grep, awk, and regular expressions to ferret out the pieces of
information they need. Such solutions are fragile and require
updates when output contents change or evolve, requiring testing and
validation.
.Pp
Modern tool developers favors encoding schemes like XML and JSON,
which allow trivial parsing and extraction of data. Such formats are
simple, well understood, hierarchical, easily parsed, and often
integrate easier with common tools and environments.
.Pp
In addition, modern reality means that more output ends up in web
browsers than in terminals, making HTML output valuable.
.Pp
.Em libxo
allows a single set of function calls in source code to generate
traditional text output, as well as XML and JSON formatted data. HTML
can also be generated; "<div>" elements surround the traditional text
output, with attributes that detail how to render the data.
.Pp
There are four encoding styles supported by libxo: TEXT, HTML, JSON,
and XML. JSON and XML are suitable for encoding data, while TEXT and
HTML are suited for display to the user. TEXT output can be display
on a terminal session, allowing compatibility with traditional usage.
HTML can be matched with a small CSS file to permit rendering in any
HTML5 browser. XML output is suitable for tools like XPath and
protocols like NETCONF. JSON output can be used for RESTful APIs.
.Pp
The
.Em libxo
library allows an application to generate text, XML, JSON,
and HTML output using a common set of function calls. The application
decides at run time which output style should be produced. The
application calls a function
.Fn xo_emit
to product output that is
described in a format string. A "field descriptor" tells libxo what
the field is and what it means. Each field descriptor is placed in
braces with a printf-like format string:
.Bd -literal -offset indent
xo_emit(" {:lines/%7ju} {:words/%7ju} "
"{:characters/%7ju}{d:filename/%s}\\n",
linect, wordct, charct, file);
.Ed
.Pp
Each field can have a role, with the 'value' role being the default,
and the role tells libxo how and when to render that field, as well as
a
.Xr printf 3 -like
format string.
.Pp
Output
can then be generated in various style, using the "--libxo" option.
.Sh DEFAULT HANDLE
Handles give an abstraction for libxo that encapsulates the state of a
stream of output. Handles have the data type "xo_handle_t" and are
opaque to the caller.
The library has a default handle that is automatically initialized.
By default, this handle will send text style output to standard output.
The xo_set_style and xo_set_flags functions can be used to change this
behavior.
Many libxo functions take a handle as their first parameter; most that
do not use the default handle. Any function taking a handle can
be passed NULL to access the default handle.
For the typical command that is generating output on standard output,
there is no need to create an explicit handle, but they are available
when needed, e.g. for daemons that generate multiple streams of
output.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_attr 3 ,
.Xr xo_create 3 ,
.Xr xo_emit 3 ,
.Xr xo_err 3 ,
.Xr xo_finish 3 ,
.Xr xo_flush 3 ,
.Xr xo_format 5 ,
.Xr xo_no_setlocale 3 ,
.Xr xo_open_container 3 ,
.Xr xo_open_list 3 ,
.Xr xo_parse_args 3 ,
.Xr xo_set_allocator 3 ,
.Xr xo_set_flags 3 ,
.Xr xo_set_info 3 ,
.Xr xo_set_options 3 ,
.Xr xo_set_style 3 ,
.Xr xo_set_writer 3 ,
.Xr xo 1 ,
and
.Xr xolint 1 .
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

4353
contrib/libxo/libxo/libxo.c Normal file

File diff suppressed because it is too large Load Diff

300
contrib/libxo/libxo/xo.h Normal file
View File

@ -0,0 +1,300 @@
/*
* Copyright (c) 2014, Juniper Networks, Inc.
* All rights reserved.
* This SOFTWARE is licensed under the LICENSE provided in the
* ../Copyright file. By downloading, installing, copying, or otherwise
* using the SOFTWARE, you agree to be bound by the terms of that
* LICENSE.
* Phil Shafer, July 2014
*/
/**
* libxo provides a means of generating text, XML, and JSON output
* using a single set of function calls, maximizing the value of output
* while minimizing the cost/impact on the code.
*/
#ifndef INCLUDE_XO_H
#define INCLUDE_XO_H
/** Formatting types */
typedef unsigned xo_style_t;
#define XO_STYLE_TEXT 0 /** Generate text output */
#define XO_STYLE_XML 1 /** Generate XML output */
#define XO_STYLE_JSON 2 /** Generate JSON output */
#define XO_STYLE_HTML 3 /** Generate HTML output */
/** Flags for libxo */
typedef unsigned long xo_xof_flags_t;
#define XOF_CLOSE_FP (1<<0) /** Close file pointer on xo_close() */
#define XOF_PRETTY (1<<1) /** Make 'pretty printed' output */
#define XOF_DIV_OPEN (1<<2) /** Internal use only: a <div> is open */
#define XOF_LINE_OPEN (1<<3) /** Internal use only: a <div class="line"> */
#define XOF_WARN (1<<4) /** Generate warnings for broken calls */
#define XOF_XPATH (1<<5) /** Emit XPath attributes in HTML */
#define XOF_INFO (1<<6) /** Emit additional info fields (HTML) */
#define XOF_WARN_XML (1<<7) /** Emit warnings in XML (on stdout) */
#define XOF_NO_ENV (1<<8) /** Don't look at the LIBXO_OPTIONS env var */
#define XOF_NO_VA_ARG (1<<9) /** Don't advance va_list w/ va_arg() */
#define XOF_DTRT (1<<10) /** Enable "do the right thing" mode */
#define XOF_KEYS (1<<11) /** Flag 'key' fields for xml and json */
#define XOF_IGNORE_CLOSE (1<<12) /** Ignore errors on close tags */
#define XOF_NOT_FIRST (1<<13) /* Not the first item (JSON) */
#define XOF_NO_LOCALE (1<<14) /** Don't bother with locale */
#define XOF_TOP_EMITTED (1<<15) /* The top JSON braces have been emitted */
#define XOF_NO_TOP (1<<16) /** Don't emit the top braces in JSON */
#define XOF_ANCHOR (1<<17) /** An anchor is in place */
#define XOF_UNITS (1<<18) /** Encode units in XML */
#define XOF_UNITS_PENDING (1<<19) /** We have a units-insertion pending */
#define XOF_UNDERSCORES (1<<20) /** Replace dashes with underscores (JSON) */
#define XOF_COLUMNS (1<<21) /** xo_emit should return a column count */
#define XOF_FLUSH (1<<22) /** Flush after each xo_emit call */
/*
* The xo_info_t structure provides a mapping between names and
* additional data emitted via HTML.
*/
typedef struct xo_info_s {
const char *xi_name; /* Name of the element */
const char *xi_type; /* Type of field */
const char *xi_help; /* Description of field */
} xo_info_t;
struct xo_handle_s; /* Opaque structure forward */
typedef struct xo_handle_s xo_handle_t; /* Handle for XO output */
typedef int (*xo_write_func_t)(void *, const char *);
typedef void (*xo_close_func_t)(void *);
typedef void *(*xo_realloc_func_t)(void *, size_t);
typedef void (*xo_free_func_t)(void *);
/*
* The formatter function mirrors "vsnprintf", with an additional argument
* of the xo handle. The caller should return the number of bytes _needed_
* to fit the data, even if this exceeds 'len'.
*/
typedef int (*xo_formatter_t)(xo_handle_t *, char *, int,
const char *, va_list);
typedef void (*xo_checkpointer_t)(xo_handle_t *, va_list, int);
xo_handle_t *
xo_create (xo_style_t style, xo_xof_flags_t flags);
xo_handle_t *
xo_create_to_file (FILE *fp, xo_style_t style, xo_xof_flags_t flags);
void
xo_destroy (xo_handle_t *xop);
void
xo_set_writer (xo_handle_t *xop, void *opaque, xo_write_func_t write_func,
xo_close_func_t close_func);
void
xo_set_allocator (xo_realloc_func_t realloc_func, xo_free_func_t free_func);
void
xo_set_style (xo_handle_t *xop, xo_style_t style);
xo_style_t
xo_get_style (xo_handle_t *xop);
int
xo_set_style_name (xo_handle_t *xop, const char *style);
int
xo_set_options (xo_handle_t *xop, const char *input);
xo_xof_flags_t
xo_get_flags (xo_handle_t *xop);
void
xo_set_flags (xo_handle_t *xop, xo_xof_flags_t flags);
void
xo_clear_flags (xo_handle_t *xop, xo_xof_flags_t flags);
void
xo_set_info (xo_handle_t *xop, xo_info_t *infop, int count);
void
xo_set_formatter (xo_handle_t *xop, xo_formatter_t func, xo_checkpointer_t);
void
xo_set_depth (xo_handle_t *xop, int depth);
int
xo_emit_hv (xo_handle_t *xop, const char *fmt, va_list vap);
int
xo_emit_h (xo_handle_t *xop, const char *fmt, ...);
int
xo_emit (const char *fmt, ...);
int
xo_open_container_h (xo_handle_t *xop, const char *name);
int
xo_open_container (const char *name);
int
xo_open_container_hd (xo_handle_t *xop, const char *name);
int
xo_open_container_d (const char *name);
int
xo_close_container_h (xo_handle_t *xop, const char *name);
int
xo_close_container (const char *name);
int
xo_close_container_hd (xo_handle_t *xop);
int
xo_close_container_d (void);
int
xo_open_list_h (xo_handle_t *xop, const char *name);
int
xo_open_list (const char *name);
int
xo_open_list_hd (xo_handle_t *xop, const char *name);
int
xo_open_list_d (const char *name);
int
xo_close_list_h (xo_handle_t *xop, const char *name);
int
xo_close_list (const char *name);
int
xo_close_list_hd (xo_handle_t *xop);
int
xo_close_list_d (void);
int
xo_open_instance_h (xo_handle_t *xop, const char *name);
int
xo_open_instance (const char *name);
int
xo_open_instance_hd (xo_handle_t *xop, const char *name);
int
xo_open_instance_d (const char *name);
int
xo_close_instance_h (xo_handle_t *xop, const char *name);
int
xo_close_instance (const char *name);
int
xo_close_instance_hd (xo_handle_t *xop);
int
xo_close_instance_d (void);
int
xo_attr_h (xo_handle_t *xop, const char *name, const char *fmt, ...);
int
xo_attr_hv (xo_handle_t *xop, const char *name, const char *fmt, va_list vap);
int
xo_attr (const char *name, const char *fmt, ...);
void
xo_error_hv (xo_handle_t *xop, const char *fmt, va_list vap);
void
xo_error_h (xo_handle_t *xop, const char *fmt, ...);
void
xo_error (const char *fmt, ...);
void
xo_flush_h (xo_handle_t *xop);
void
xo_flush (void);
void
xo_finish_h (xo_handle_t *xop);
void
xo_finish (void);
void
xo_set_leading_xpath (xo_handle_t *xop, const char *path);
void
xo_warn_hc (xo_handle_t *xop, int code, const char *fmt, ...);
void
xo_warn_c (int code, const char *fmt, ...);
void
xo_warn (const char *fmt, ...);
void
xo_warnx (const char *fmt, ...);
void
xo_err (int eval, const char *fmt, ...);
void
xo_errx (int eval, const char *fmt, ...);
void
xo_errc (int eval, int code, const char *fmt, ...);
void
xo_message_hcv (xo_handle_t *xop, int code, const char *fmt, va_list vap);
void
xo_message_hc (xo_handle_t *xop, int code, const char *fmt, ...);
void
xo_message_c (int code, const char *fmt, ...);
void
xo_message (const char *fmt, ...);
void
xo_no_setlocale (void);
int
xo_parse_args (int argc, char **argv);
/*
* This is the "magic" number returned by libxo-supporting commands
* when passed the equally magic "--libxo-check" option. If you
* return this, we can assume that since you know the magic handshake,
* you'll happily handle future --libxo options and not do something
* violent like reboot the box or create another hole in the ozone
* layer.
*/
#define XO_HAS_LIBXO 121
/*
* externs for our version number strings
*/
extern const char xo_version[];
extern const char xo_version_extra[];
#endif /* INCLUDE_XO_H */

View File

@ -0,0 +1,77 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft int
.Fn xo_attr "const char *name" "const char *fmt" "..."
.Ft int
.Fn xo_attr_h "xo_handle_t *handle" "const char *name, const char *fmt" "..."
.Ft int
.Fn xo_attr_hv "xo_handle_t *handle" "const char *name" "const char *fmt" "va_list vap"
.Sh DESCRIPTION
The
.Fn xo_attr
function emits attributes for the XML output style. The attribute
value is recorded in the
.Fa handle
and is attached to the next field that is emitted via a
.Xr xo_emit 3
call.
.Pp
The
.Fa name
parameter give the name of the attribute to be encoded. The
.Fa fmt
parameter gives a printf-style format string used to format the
value of the attribute using any remaining arguments, or the
.Fa vap
parameter as passed to
.Fn xo_attr_hv .
.Bd -literal -offset indent
EXAMPLE:
xo_attr("seconds", "%ld", (unsigned long) login_time);
struct tm *tmp = localtime(login_time);
strftime(buf, sizeof(buf), "%R", tmp);
xo_emit("Logged in at {:login-time}\\n", buf);
XML:
<login-time seconds="1408336270">00:14</login-time>
.Ed
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,85 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft xo_handle_t *
.Fn xo_create "unsigned style" "unsigned flags"
.Ft xo_handle_t *
.Fn xo_create_to_file "FILE *fp" "unsigned style" "unsigned flags"
.Ft void
.Fn xo_destroy "xo_handle_t *handle"
.Sh DESCRIPTION
A
.Em libxo
handle can be allocated using the
.Fn xo_create
function.
.Bd -literal -offset indent
Example:
xo_handle_t *xop = xo_create(XO_STYLE_JSON, XOF_WARN);
....
xo_emit_h(xop, "testing\n");
.Ed
.Pp
By default,
.Em libxo
writes output to standard output. A convenience
function is provided for situations when output should be written to
different file.
.Pp
Use the
.Em XOF_CLOSE_FP
flag to trigger a call to
.Em fclose 3
for the FILE pointer when the handle is destroyed.
.Pp
The
.Fn xo_destroy
function releases a handle and any resources it is
using. Calling
.Fn xo_destroy
with a
.Em NULL
handle will release any
resources associated with the default handle.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
and
.Xf xo_set_options 3 .
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,71 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft int
.Fn xo_emit "const char *fmt" "..."
.Ft int
.Fn xo_emit_h "xo_handle_t *xop" "const char *fmt" "..."
.Ft int
.Fn xo_emit_hv "xo_handle_t *xop" "const char *fmt" "va_list vap"
.Sh DESCRIPTION
The
.Fn xo_emit
function emits formatted output using the description in a format
string along with a set of zero or more arguments, in a style similar
to
.Xr printf 3
but using a more complex format description string, as described in
.Xr xo_format 5 .
.Pp
.Fn xo_emit
uses the default output handle, as described in
.Xf libxo 3 ,
where
.Fn xo_emit_h
uses an explicit handle.
.Fn xo_emit_hv
accepts a
.Fa va_list
for additional flexibility.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_open_container 3 ,
.Xr xo_open_list 3 , and
.Xr xo_format 5 .
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,84 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_err
.Nd emit errors and warnings in multiple formats
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft void
.Fn xo_warn "const char *fmt" "..."
.Ft void
.Fn xo_warnx "const char *fmt" "..."
.Ft void
.Fn xo_warn_c "int code" "const char *fmt" "..."
.Ft void
.Fn xo_warn_hc "xo_handle_t *xop" "int code, const char *fmt" "..."
.Ft void
.Fn xo_err "int eval" "const char *fmt" "..."
.Ft void
.Fn xo_errc "int eval" "int code" "const char *fmt" "..."
.Ft void
.Fn xo_errx "int eval" "const char *fmt" "..."
.Ft void
.Fn xo_message "const char *fmt" "..."
.Ft void
.Fn xo_message_c "int code" "const char *fmt" "..."
.Ft void
.Fn xo_message_hc "xo_handle_t *xop" "int code, const char *fmt" "..."
.Ft void
.Fn xo_message_hcv "xo_handle_t *xop" "int code" "const char *fmt" "va_list vap"
.Sh DESCRIPTION
Many programs make use of the standard library functions
.Xr err 3
and
.Xr warn 3
to generate errors and warnings for the user.
.Em libxo
wants to
pass that information via the current output style, and provides
compatible functions to allow this.
.Pp
These functions display the program name, a colon, a formatted message
based on the arguments, and then optionally a colon and an error
message associated with either "errno" or the "code" parameter.
.Bd -literal -offset indent
EXAMPLE:
if (open(filename, O_RDONLY) < 0)
xo_err(1, "cannot open file '%s'", filename);
.Ed
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,59 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft void
.Fn xo_finish "void"
.Ft void
.Fn xo_finish_h "xo_handle_t *xop"
.Sh DESCRIPTION
When the program is ready to exit or close a handle, a call to
.Fn xo_finish
is required. This flushes any buffered data, closes
open
.Em libxo
constructs, and completes any pending operations.
.Pp
Calling this function is
.Em vital
to the proper operation of libxo,
especially for the non-TEXT output styles.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,54 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft void
.Fn xo_flush "void"
.Ft void
.Fn xo_flush_h "xo_handle_t *handle"
.Sh DESCRIPTION
.Em libxo
buffers data, both for performance and consistency, but also to
allow some advanced features to work properly. At various times, the
caller may wish to flush any data buffered within the library. The
.Fn xo_flush
function is used for this.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,657 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_format
.Nd content of format descriptors for xo_emit
.Sh DESCRIPTION
.Pp
.Em libxo
uses format strings to control the rendering of data into
various output styles, including
.Em text ,
.Em XML ,
.EM JSON ,
and
.Em HTML .
Each format string contains a set of zero or more
.Dq field descriptions ,
which describe independent data fields. Each
field description contains a set of
.Dq modifiers ,
a
.Dq content string ,
and zero, one, or two
.Dq format descriptors .
The modifiers tell
.Em libxo
what the field is and how to treat it, while the format descriptors are
formatting instructions using
.Xr printf 3 -style
format strings, telling
libxo how to format the field. The field description is placed inside
a set of braces, with a colon
.Ql ( \&: )
after the modifiers and a slash
.Ql ( \&/ )
before each format descriptors. Text may be intermixed with
field descriptions within the format string.
.Pp
The field description is given as follows:
.Bd -literal -offset indent
'{' [ role | modifier ]* ':' [ content ]
[ '/' field-format [ '/' encoding-format ]] '}'
.Ed
.Pp
The role describes the function of the field, while the modifiers
enable optional behaviors. The contents, field-format, and
encoding-format are used in varying ways, based on the role. These
are described in the following sections.
.Pp
In the following example, three field descriptors appear. The first
is a padding field containing three spaces of padding, the second is a
label ("In stock"), and the third is a value field ("in-stock"). The
in-stock field has a "%u" format that will parse the next argument
passed to the xo_emit function as an unsigned integer.
.Bd -literal -offset indent
xo_emit("{P: }{Lwc:In stock}{:in-stock/%u}\\n", 65);
.Ed
.Pp
This single line of code can generate text ("In stock: 65\\n"), XML
("<in-stock>65</in-stock>"), JSON ('"in-stock": 6'), or HTML (too
lengthy to be listed here).
.Ss Modifier Roles
Modifiers are optional, and indicate the role and formatting of the
content. The roles are listed below; only one role is permitted:
.Pp
.Bl -column "M" "Name12341234"
.It Sy "M Name Description"
.It D "decoration " "Field is non-text (e.g. colon, comma)"
.It E "error " "Field is an error message"
.It L "label " "Field is text that prefixes a value"
.It N "note " "Field is text that follows a value"
.It P "padding " "Field is spaces needed for vertical alignment"
.It T "title " "Field is a title value for headings"
.It U "units " "Field is the units for the previous value field"
.It V "value " "Field is the name of field (the default)"
.It W "warning " "Field is a warning message"
.It \&[ "start anchor" "Begin a section of anchored variable-width text"
.It \&] "stop anchor " "End a section of anchored variable-width text"
.El
.Pp
.Ss The Decoration Role ({D:})
Decorations are typically punctuation marks such as colons,
semi-colons, and commas used to decorate the text and make it simpler
for human readers. By marking these distinctly, HTML usage scenarios
can use CSS to direct their display parameters.
.Bd -literal -offset indent
xo_emit("{D:((}{:name}{D:))}\\n", name);
.Ed
.Ss The Label Role ({L:})
Labels are text that appears before a value.
.Bd -literal -offset indent
xo_emit("{Lwc:Cost}{:cost/%u}\\n", cost);
.Ed
.Ss The Note Role ({N:})
Notes are text that appears after a value.
.Bd -literal -offset indent
xo_emit("{:cost/%u} {N:per year}\\n", cost);
.Ed
.Ss The Padding Role ({P:})
Padding represents whitespace used before and between fields.
The padding content can be either static, when placed directly within
the field descriptor, or a printf-style format descriptor can be used,
if preceded by a slash ("/"):
.Bd -literal -offset indent
xo_emit("{P: }{Lwc:Cost}{:cost/%u}\\n", cost);
xo_emit("{P:/30s}{Lwc:Cost}{:cost/%u}\\n", "", cost);
.Ed
.Ss The Title Role ({T:})
Title are heading or column headers that are meant to be displayed to
the user. The title can be either static, when placed directly within
the field descriptor, or a printf-style format descriptor can be used,
if preceded by a slash ("/"):
.Bd -literal -offset indent
xo_emit("{T:Interface Statistics}\\n");
xo_emit("{T:/%20.20s}{T:/%6.6s}\\n", "Item Name", "Cost");
.Ed
.Ss The Units Role ({U:})
Units are the dimension by which values are measured, such as degrees,
miles, bytes, and decibels. The units field carries this information
for the previous value field.
.Bd -literal -offset indent
xo_emit("{Lwc:Distance}{:distance/%u}{Uw:miles}\\n", miles);
.Ed
.Pp
Note that the sense of the 'w' modifier is reversed for units;
a blank is added before the contents, rather than after it.
.Pp
When the
.Em XOF_UNITS
flag is set, units are rendered in XML as the
.Dq units
attribute:
.Bd -literal -offset indent
<distance units="miles">50</distance>
.Ed
.Pp
Units can also be rendered in HTML as the "data-units" attribute:
.Bd -literal -offset indent
<div class="data" data-tag="distance" data-units="miles"
data-xpath="/top/data/distance">50</div>
.Ed
.Ss The Value Role ({V:} and {:})
The value role is used to represent the a data value that is
interesting for the non-display output styles (XML and JSON). Value
is the default role; if no other role designation is given, the field
is a value. The field name must appear within the field descriptor,
followed by one or two format descriptors. The first format
descriptor is used for display styles (TEXT and HTML), while the
second one is used for encoding styles (XML and JSON). If no second
format is given, the encoding format defaults to the first format,
with any minimum width removed. If no first format is given, both
format descriptors default to "%s".
.Bd -literal -offset indent
xo_emit("{:length/%02u}x{:width/%02u}x{:height/%02u}\\n",
length, width, height);
xo_emit("{:author} wrote \"{:poem}\" in {:year/%4d}\\n,
author, poem, year);
.Ed
.Ss The Anchor Modifiers ({[:} and {]:})
The anchor roles allow a set of strings by be padded as a group,
but still be visible to xo_emit as distinct fields. Either the start
or stop anchor can give a field width and it can be either directly in
the descriptor or passed as an argument. Any fields between the start
and stop anchor are padded to meet the minimum width given.
.Pp
To give a width directly, encode it as the content of the anchor tag:
.Bd -literal -offset indent
xo_emit("({[:10}{:min/%d}/{:max/%d}{]:})\\n", min, max);
.Ed
.Pp
To pass a width as an argument, use "%d" as the format, which must
appear after the "/". Note that only "%d" is supported for widths.
Using any other value could ruin your day.
.Bd -literal -offset indent
xo_emit("({[:/%d}{:min/%d}/{:max/%d}{]:})\\n", width, min, max);
.Ed
.Pp
If the width is negative, padding will be added on the right, suitable
for left justification. Otherwise the padding will be added to the
left of the fields between the start and stop anchors, suitable for
right justification. If the width is zero, nothing happens. If the
number of columns of output between the start and stop anchors is less
than the absolute value of the given width, nothing happens.
.Pp
Widths over 8k are considered probable errors and not supported. If
.Em XOF_WARN
is set, a warning will be generated.
.Ss Modifier Flags
The modifiers can also include the following flags, which modify the
content emitted for some output styles:
.Pp
.Bl -column M "Name12341234"
.It Sy M "Name Description"
.It c "colon " "A colon (":") is appended after the label"
.It d "display " "Only emit field for display styles (text/HTML)"
.It e "encoding " "Only emit for encoding styles (XML/JSON)"
.It k "key " "Field is a key, suitable for XPath predicates"
.It n "no-quotes " "Do not quote the field when using JSON style"
.It q "quotes " "Quote the field when using JSON style"
.It w "white space " "A blank (" ") is appended after the label"
.El
.Pp
For example, the modifier string "Lwc" means the field has a label
role (text that describes the next field) and should be followed by a
colon ('c') and a space ('w'). The modifier string "Vkq" means the
field is has value role, that it is a key for the current instance, and
that the value should be quoted when encoded for JSON.
.Ss The Colon Modifier ({c:})
The colon modifier appends a single colon to the data value:
.Bd -literal -offset indent
EXAMPLE:
xo_emit("{Lc:Name}{:name}\\n", "phil");
TEXT:
Name:phil
.Ed
.Pp
The colon modifier is only used for the TEXT and HTML output
styles. It is commonly combined with the space modifier ('{w:').
It is purely a convenience feature.
.Ss The Display Modifier ({d:})
The display modifier indicated the field should only be generated for
the display output styles, TEXT and HTML.
.Bd -literal -offset indent
EXAMPLE:
xo_emit("{Lcw:Name}{d:name} {:id/%d}\\n", "phil", 1);
TEXT:
Name: phil 1
XML:
<id>1</id>
.Ed
.Pp
The display modifier is the opposite of the encoding modifier, and
they are often used to give to distinct views of the underlying data.
.Ss The Encoding Modifier ({e:})
The display modifier indicated the field should only be generated for
the display output styles, TEXT and HTML.
.Bd -literal -offset indent
EXAMPLE:
xo_emit("{Lcw:Name}{:name} {e:id/%d}\\n", "phil", 1);
TEXT:
Name: phil
XML:
<name>phil</name><id>1</id>
.Ed
.Pp
The encoding modifier is the opposite of the display modifier, and
they are often used to give to distinct views of the underlying data.
.Ss The Key Modifier ({k:})
The key modifier is used to indicate that a particular field helps
uniquely identify an instance of list data.
.Bd -literal -offset indent
EXAMPLE:
xo_open_list("user");
for (i = 0; i < num_users; i++) {
xo_open_instance("user");
xo_emit("User {k:name} has {:count} tickets\\n",
user[i].u_name, user[i].u_tickets);
xo_close_instance("user");
}
xo_close_list("user");
.Ed
.Pp
Currently the key modifier is only used when generating XPath value
for the HTML output style when
.Em XOF_XPATH
is set, but other uses are likely in the near future.
.Ss The No-Quotes Modifier ({n:})
The no-quotes modifier (and its twin, the 'quotes' modifier) affect
the quoting of values in the JSON output style. JSON uses quotes for
string value, but no quotes for numeric, boolean, and null data.
xo_emit applies a simple heuristic to determine whether quotes are
needed, but often this needs to be controlled by the caller.
.Bd -literal -offset indent
EXAMPLE:
const char *bool = is_true ? "true" : "false";
xo_emit("{n:fancy/%s}", bool);
JSON:
"fancy": true
.Ed
.Ss The Quotes Modifier ({q:})
The quotes modifier (and its twin, the 'no-quotes' modifier) affect
the quoting of values in the JSON output style. JSON uses quotes for
string value, but no quotes for numeric, boolean, and null data.
xo_emit applies a simple heuristic to determine whether quotes are
needed, but often this needs to be controlled by the caller.
.Bd -literal -offset indent
EXAMPLE:
xo_emit("{q:time/%d}", 2014);
JSON:
"year": "2014"
.Ed
.Ss The White Space Modifier ({w:})
The white space modifier appends a single space to the data value:
.Bd -literal -offset indent
EXAMPLE:
xo_emit("{Lw:Name}{:name}\\n", "phil");
TEXT:
Name phil
.Ed
.Pp
The white space modifier is only used for the TEXT and HTML output
styles. It is commonly combined with the colon modifier ('{c:').
It is purely a convenience feature.
.Pp
Note that the sense of the 'w' modifier is reversed for the units role
({Uw:}); a blank is added before the contents, rather than after it.
.Ss Field Formatting
The field format is similar to the format string for
.Xr printf 3 .
It's used varies based on the role of the field, but generally is used to
format the field's contents.
.Pp
If not provided, the format string defaults to "%s".
.Pp
Note a field definition can contain zero or more printf-style
.Dq directives ,
which are sequences that start with a '%' and end with a
one of following characters: "diouxXDOUeEfFgGaAcCsSp". Each directive
is matched by one of more arguments to the xo_emit function.
.Pp
The format string has the form:
.Bd -literal -offset indent
'%' format-modifier * format-character
.Ed
.Pp
The format- modifier can be:
.Bl -bullet
.It
a '#' character, indicating the output value should be prefixed with
'0x', typically to indicate a base 16 (hex) value.
.It
a minus sign ('-'), indicating the output value should be padded on
the right instead of the left.
.It
a leading zero ('0') indicating the output value should be padded on the
left with zeroes instead of spaces (' ').
.It
one or more digits ('0' - '9') indicating the minimum width of the
argument. If the width in columns of the output value is less that
the minumum width, the value will be padded to reach the minimum.
.It
a period followed by one or more digits indicating the maximum
number of bytes which will be examined for a string argument, or the maximum
width for a non-string argument. When handling ASCII strings this is
functions as the field width but for multi-byte characters, a single
character may be composed of multiple bytes.
xo_emit will never dereference memory beyond the given number of bytes.
.It
a second period followed by one or more digits indicating the maximum
width for a string argument. This modifier cannot be given for non-string
arguments.
.It
one or more 'h' characters, indicating shorter input data.
.It
one or more 'l' characters, indicating longer input data.
.It
a 'z' character, indicating a 'size_t' argument.
.It
a 't' character, indicating a 'ptrdiff_t' argument.
.It
a ' ' character, indicating a space should be emitted before
positive numbers.
.It
a '+' character, indicating sign should emitted before any number.
.El
.Pp
Note that 'q', 'D', 'O', and 'U' are considered deprecated and will be
removed eventually.
.Pp
The format character is described in the following table:
.Pp
.Bl -column C "Argument Type12"
.It Sy "C Argument Type Format"
.It d "int " "base 10 (decimal)"
.It i "int " "base 10 (decimal)"
.It o "int " "base 8 (octal)"
.It u "unsigned " "base 10 (decimal)"
.It x "unsigned " "base 16 (hex)"
.It X "unsigned long " "base 16 (hex)"
.It D "long " "base 10 (decimal)"
.It O "unsigned long " "base 8 (octal)"
.It U "unsigned long " "base 10 (decimal)"
.It e "double " "[-]d.ddde+-dd"
.It E "double " "[-]d.dddE+-dd"
.It f "double " "[-]ddd.ddd"
.It F "double " "[-]ddd.ddd"
.It g "double " "as 'e' or 'f'"
.It G "double " "as 'E' or 'F'"
.It a "double " "[-]0xh.hhhp[+-]d"
.It A "double " "[-]0Xh.hhhp[+-]d"
.It c "unsigned char " "a character"
.It C "wint_t " "a character"
.It s "char * " "a UTF-8 string"
.It S "wchar_t * " "a unicode/WCS string"
.It p "void * " "'%#lx'"
.El
.Pp
The 'h' and 'l' modifiers affect the size and treatment of the
argument:
.Bl -column "Mod" "d, i " "o, u, x, X "
.It Sy "Mod" "d, i " "o, u, x, X"
.It "hh " "signed char " "unsigned char"
.It "h " "short " "unsigned short"
.It "l " "long " "unsigned long"
.It "ll " "long long " "unsigned long long"
.It "j " "intmax_t " "uintmax_t"
.It "t " "ptrdiff_t " "ptrdiff_t"
.It "z " "size_t " "size_t"
.It "q " "quad_t " "u_quad_t"
.El
.Pp
.Ss UTF-8 and Locale Strings
All strings for libxo must be UTF-8. libxo will handle turning them
into locale-based strings for display to the user.
.Pp
For strings, the 'h' and 'l' modifiers affect the interpretation of
the bytes pointed to argument. The default '%s' string is a 'char *'
pointer to a string encoded as UTF-8. Since UTF-8 is compatible with
.Em ASCII
data, a normal 7-bit
.Em ASCII
string can be used. '%ls' expects a
'wchar_t *' pointer to a wide-character string, encoded as a 32-bit
Unicode values. '%hs' expects a 'char *' pointer to a multi-byte
string encoded with the current locale, as given by the
.Em LC_CTYPE ,
.Em LANG ,
or
.Em LC_ALL
environment varibles. The first of this list of
variables is used and if none of the variables, the locale defaults to
.Em UTF-8.
.Pp
libxo will
convert these arguments as needed to either UTF-8 (for XML, JSON, and
HTML styles) or locale-based strings for display in text style.
.Bd -literal -offset indent
xo_emit("Alll strings are utf-8 content {:tag/%ls}",
L"except for wide strings");
.Ed
.Pp
"%S" is equivalent to "%ls".
.Pp
For example, a function is passed a locale-base name, a hat size,
and a time value. The hat size is formatted in a UTF-8 (ASCII)
string, and the time value is formatted into a wchar_t string.
.Bd -literal -offset indent
void print_order (const char *name, int size,
struct tm *timep) {
char buf[32];
const char *size_val = "unknown";
if (size > 0)
snprintf(buf, sizeof(buf), "%d", size);
size_val = buf;
}
wchar_t when[32];
wcsftime(when, sizeof(when), L"%d%b%y", timep);
xo_emit("The hat for {:name/%hs} is {:size/%s}.\\n",
name, size_val);
xo_emit("It was ordered on {:order-time/%ls}.\\n",
when);
}
.Ed
.Pp
It is important to note that xo_emit will perform the conversion
required to make appropriate output. Text style output uses the
current locale (as described above), while XML, JSON, and HTML use
UTF-8.
.Pp
UTF-8 and locale-encoded strings can use multiple bytes to encode one
column of data. The traditional "precision'" (aka "max-width") value
for "%s" printf formatting becomes overloaded since it specifies both
the number of bytes that can be safely referenced and the maximum
number of columns to emit. xo_emit uses the precision as the former,
and adds a third value for specifying the maximum number of columns.
.Pp
In this example, the name field is printed with a minimum of 3 columns
and a maximum of 6. Up to ten bytes are in used in filling those
columns.
.Bd -literal -offset indent
xo_emit("{:name/%3.10.6s}", name);
.Ed
.Ss Characters Outside of Field Definitions
Characters in the format string are not part of a field definition are
copied to the output for the TEXT style, and are ignored for the JSON
and XML styles. For HTML, these characters are placed in a <div> with
class "text".
.Bd -literal -offset indent
EXAMPLE:
xo_emit("The hat is {:size/%s}.\\n", size_val);
TEXT:
The hat is extra small.
XML:
<size>extra small</size>
JSON:
"size": "extra small"
HTML:
<div class="text">The hat is </div>
<div class="data" data-tag="size">extra small</div>
<div class="text">.</div>
.Ed
.Ss "%n" is Not Supported
libxo does not support the '%n' directive. It's a bad idea and we
just don't do it.
.Ss The Encoding Format (eformat)
The "eformat" string is the format string used when encoding the field
for JSON and XML. If not provided, it defaults to the primary format
with any minimum width removed. If the primary is not given, both
default to "%s".
.Sh EXAMPLE
In this example, the value for the number of items in stock is emitted:
.Bd -literal -offset indent
xo_emit("{P: }{Lwc:In stock}{:in-stock/%u}\\n",
instock);
.Ed
.Pp
This call will generate the following output:
.Bd -literal -offset indent
TEXT:
In stock: 144
XML:
<in-stock>144</in-stock>
JSON:
"in-stock": 144,
HTML:
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock">144</div>
</div>
.Ed
.Pp
Clearly HTML wins the verbosity award, and this output does
not include
.Em XOF_XPATH
or
.Em XOF_INFO
data, which would expand the penultimate line to:
.Bd -literal -offset indent
<div class="data" data-tag="in-stock"
data-xpath="/top/data/item/in-stock"
data-type="number"
data-help="Number of items in stock">144</div>
.Ed
.Sh WHAT MAKES A GOOD FIELD NAME?
To make useful, consistent field names, follow these guidelines:
.Pp
.Ss Use lower case, even for TLAs
Lower case is more civilized. Even TLAs should be lower case
to avoid scenarios where the differences between "XPath" and
"Xpath" drive your users crazy. Using "xpath" is simpler and better.
.Ss Use hyphens, not underscores
Use of hyphens is traditional in XML, and the
.Em XOF_UNDERSCORES
flag can be used to generate underscores in JSON, if desired.
But the raw field name should use hyphens.
.Se Use full words
Don't abbreviate especially when the abbreviation is not obvious or
not widely used. Use "data-size", not "dsz" or "dsize". Use
"interface" instead of "ifname", "if-name", "iface", "if", or "intf".
.Se Use <verb>-<units>
Using the form <verb>-<units> or <verb>-<classifier>-<units> helps in
making consistent, useful names, avoiding the situation where one app
uses "sent-packet" and another "packets-sent" and another
"packets-we-have-sent". The <units> can be dropped when it is
obvious, as can obvious words in the classification.
Use "receive-after-window-packets" instead of
"received-packets-of-data-after-window".
.Se Reuse existing field names
Nothing's worse than writing expressions like:
.Bd -literal -offset indent
if ($src1/process[pid == $pid]/name ==
$src2/proc-table/proc/p[process-id == $pid]/proc-name) {
...
}
.Ed
.Pp
Find someone else who is expressing similar data and follow their
field's and hierarchy. Remember the quote is not
.Dq Consistency is the hobgoblin of little minds
but
.Dq A foolish consistency is the hobgoblin of little minds.
.Ss Think about your users
Have empathy for your users, choosing clear and useful fields that
contain clear and useful data. You may need to augment the display
content with
.Xr xo_attr 3
calls or "{e:}" fields to make the data useful.
.Ss Don't use an arbitrary number postfix
What does "errors2" mean? No one will know. "errors-after-restart"
would be a better choice. Think of you users, and think of the
future. If you make "errors2", the next guy will happily make
"errors3" and before you know it, someone will be asking what's the
difference between errors37 and errors63.
.Ss Be consistent, uniform, unsurprising, and predictable
Think of your field vocabulary as an API. You want it useful,
expressive, meaningful, direct, and obvious. You want the client
application's programmer to move between without the need to
understand a variety of opinions on how fields are named. They should
see the system as a single cohesive whole, not a sack of cats.
.Pp
Field names constitute the means by which client programmers interact
with our system. By choosing wise names now, you are making their
lives better.
.Pp
After using
.Xr xolint 1
to find errors in your field descriptors, use
.Dq "xolint -V"
to spell check your field names and to detect different
names for the same data.
.Dq dropped-short
and
.Dq dropped-too-short
are both reasonable names, but using them both will lead users to ask the
difference between the two fields. If there isn't a difference,
use only one of the field names. If there is a difference, change the
names to make that difference more obvious.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,63 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_no_setlocale
.Nd prevent implicit call to setlocale()
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft void
.Fn xo_no_setlocale "void"
.Sh DESCRIPTION
.Em libxo
automatically initializes the locale based on setting of the
environment variables
.Em LC_CTYPE ,
.Em LANG ,
and
.Em LC_ALL .
The first of this
list of variables is used and if none of the variables, the locale
defaults to
.Em UTF-8. The caller may wish to avoid this behavior, and
can do so by calling the
.Fn xo_no_setlocale
function.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr xo_open_container 3 ,
.Xr xo_open_list 3 , and
.Xr xo_format 5 .
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,216 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Sh NAME
.Nm xo_open_container
.Nm xo_open_container_h
.Nm xo_open_container_hd
.Nm xo_open_container_d
.Nm xo_close_container
.Nm xo_close_container_h
.Nm xo_close_container_hd
.Nm xo_close_container_d
.Nd open and close containers
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.Ft int
.Fn xo_open_container "const char *name"
.Ft int
.Fn xo_open_container_h "xo_handle_t *handle" "const char *name"
.Ft int
.Fn xo_open_container_hd "xo_handle_t *handle" "const char *name"
.Ft int
.Fn xo_open_container_d "const char *name"
.Ft int
.Fn xo_close_container "const char *name"
.Ft int
.Fn xo_close_container_h "xo_handle_t *handle" "const char *name"
.Ft int
.Fn xo_close_container_hd "xo_handle_t *handle"
.Ft int
.Fn xo_close_container_d "void"
.Sh DESCRIPTION
.Fa libxo
represents to types of hierarchy:
.Dq containers
and
.Dq lists .
A container appears once under a given parent where a list contains
instances that can appear multiple times. A container is used to hold
related fields and to give the data organization and scope.
The container has no value, but serves to
contain other nodes.
.Pp
To open a container, call
.Fn xo_open_container
or
.Fn xo_open_container_h .
The former uses the default handle and
the latter accepts a specific handle.
.Pp
To close a level, use the
.Fn xo_close_container
or
.Fn xo_close_container_h
functions.
.Pp
Each open call must have a matching close call. If the
.Fa XOF_WARN
flag is set and the name given does not match the name of
the currently open
container, a warning will be generated.
.Bd -literal -offset indent -compact
Example:
xo_open_container("top");
xo_open_container("system");
xo_emit("{:host-name/%s%s%s", hostname,
domainname ? "." : "", domainname ?: "");
xo_close_container("system");
xo_close_container("top");
Sample Output:
Text:
my-host.example.org
XML:
<top>
<system>
<host-name>my-host.example.org</host-name>
</system>
</top>
JSON:
"top" : {
"system" : {
"host-name": "my-host.example.org"
}
}
HTML:
<div class="data"
data-tag="host-name">my-host.example.org</div>
.Ed
.SH EMITTING HIERARCHY
To create a container, use the
.Fn xo_open_container
and
.Fn xo_close_container
set of functions.
The
.Fa handle
parameter contains a handle such as returned by
.Xr xo_create 3
or a
.Em NULL
to use the default handle.
The
.Fa name
parameter gives the name of the container, encoded in
.Em UTF-8 .
Since
.Em ASCII
is a proper subset of
.Em UTF-8 ,
traditional C strings can be used directly.
.Pp
The close functions with the
.Dq _d
suffix are used in
.Dq Do The Right Thing
mode, where the name of the open containers, lists, and
instances are maintained internally by
.Em libxo
to allow the caller to
avoid keeping track of the open container name.
.Pp
Use the
.Em XOF_WARN
flag to generate a warning if the name given on the
close does not match the current open container.
.Pp
For TEXT and HTML output, containers are not rendered into output
text, though for HTML they are used when the
.Em XOF_XPATH
flag is set.
.Pp
.Bd -literal -offset indent -compact
EXAMPLE:
xo_open_container("system");
xo_emit("The host name is {:host-name}\n", hn);
xo_close_container("system");
XML:
<system><host-name>foo</host-name></system>
.Ed
.Sh DTRT MODE
Some user may find tracking the names of open containers, lists, and
instances inconvenient.
.Em libxo
offers
.Dq Do The Right Thing
mode, where
.Em libxo
will track the names of open containers, lists, and instances so
the close function can be called without a name. To enable
.Em DTRT
mode,
turn on the
.Em XOF_DTRT
flag prior to making any other
.Em libxo
output.
.Bd -literal -offset indent -compact
xo_set_flags(NULL, XOF_DTRT);
.Ed
Each open and close function has a version with the suffix
.Dq _d ,
which will close the open container, list, or instance:
.Bd -literal -offset indent -compact
xo_open_container("top");
...
xo_close_container_d();
.Ed
Note that the
.Em XOF_WARN
flag will also cause libxo to track open
containers, lists, and instances.
A warning is generated with the name given to the close function
and the name recorded do not match.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,169 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Sh NAME
.Nm xo_open_list
.Nm xo_open_list_h
.Nm xo_open_list_hd
.Nm xo_open_list_d
.Nm xo_open_instance
.Nm xo_open_instance_h
.Nm xo_open_instance_hd
.Nm xo_open_instance_d
.Nm xo_close_instance
.Nm xo_close_instance_h
.Nm xo_close_instance_hd
.Nm xo_close_instance_d
.Nm xo_close_list
.Nm xo_close_list_h
.Nm xo_close_list_hd
.Nm xo_close_list_d
.Nd open and close lists and instances
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.Ft int
.Fn xo_open_list_h "xo_handle_t *xop" "const char *name"
.Ft int
.Fn xo_open_list "const char *name"
.Ft int
.Fn xo_open_list_hd "xo_handle_t *xop" "const char *name"
.Ft int
.Fn xo_open_list_d "const char *name"
.Ft int
.Fn xo_open_instance_h "xo_handle_t *xop" "const char *name"
.Ft int
.Fn xo_open_instance "const char *name"
.Ft int
.Fn xo_open_instance_hd "xo_handle_t *xop" "const char *name"
.Ft int
.Fn xo_open_instance_d "const char *name"
.Ft int
.Fn xo_close_instance_h "xo_handle_t *xop" "const char *name"
.Ft int
.Fn xo_close_instance "const char *name"
.Ft int
.Fn xo_close_instance_hd "xo_handle_t *xop"
.Ft int
.Fn xo_close_instance_d "void"
.Ft int
.Fn xo_close_list_h "xo_handle_t *xop" "const char *name"
.Ft int
.Fn xo_close_list "const char *name"
.Ft int
.Fn xo_close_list_hd "xo_handle_t *xop"
.Ft int
.Fn xo_close_list_d "void"
.Sh DESCRIPTION
Lists are sequences of instances of homogeneous data objects. Two
distinct levels of calls are needed to represent them in our output
styles. Calls must be made to open and close a list, and for each
instance of data in that list, calls must be make to open and close
that instance.
.Pp
The name given to all calls must be identical, and it is strong
suggested that the name be singular, not plural, as a matter of
style and usage expectations.
.Pp
A list is set of one or more instances that appear under the same
parent. The instances contains details about a specific object. One
can think of instances as objects or records. A call is needed to
open and close the list, while a distinct call is needed to open and
close each instance of the list:
.Bd -literal -offset indent -compact
xo_open_list("item");
for (ip = list; ip->i_title; ip++) {
xo_open_instance("item");
xo_emit("{L:Item} '{:name/%s}':\n", ip->i_title);
xo_close_instance("item");
}
xo_close_list("item");
.Ed
Getting the list and instance calls correct is critical to the proper
generation of XML and JSON data.
.Pp
.Bd -literal -offset indent -compact
EXAMPLE:
xo_open_list("user");
for (i = 0; i < num_users; i++) {
xo_open_instance("user");
xo_emit("{k:name}:{:uid/%u}:{:gid/%u}:{:home}\n",
pw[i].pw_name, pw[i].pw_uid,
pw[i].pw_gid, pw[i].pw_dir);
xo_close_instance("user");
}
xo_close_list("user");
TEXT:
phil:1001:1001:/home/phil
pallavi:1002:1002:/home/pallavi
XML:
<user>
<name>phil</name>
<uid>1001</uid>
<gid>1001</gid>
<home>/home/phil</home>
</user>
<user>
<name>pallavi</name>
<uid>1002</uid>
<gid>1002</gid>
<home>/home/pallavi</home>
</user>
JSON:
user: [
{
"name": "phil",
"uid": 1001,
"gid": 1001,
"home": "/home/phil",
},
{
"name": "pallavi",
"uid": 1002,
"gid": 1002,
"home": "/home/pallavi",
}
]
.Ed
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,133 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_parse_args
.Nd detect, parse, and remove arguments for libxo
.Sh LIBRARY
.Nm libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft int
.Fn xo_parse_args "int argc" "char **argv"
.Sh DESCRIPTION
The
.Fn xo_parse_args
function is used to process command-line arguments.
.Em libxo -specific
options are processed and removed
from the argument list so the calling application does not
need to process them. If successful, a new value for argc
is returned. On failure, a message it emitted and -1 is returned.
.Bd -literal -offset indent
argc = xo_parse_args(argc, argv);
if (argc < 0)
exit(1);
.Ed
.Pp
Following the call to
.Fn xo_parse_args ,
the application can process the remaining arguments in a normal manner.
.Pp
.Em libxo
uses command line options to trigger rendering behavior. The
following options are recognised:
.Pp
.Bl -tag -width "--libxo"
.It
\-\^\-libxo <options>
.It
\-\^\-libxo=<options>
.It
\-\^\-libxo:<brief-options>
.El
.Pp
Options is a comma-separated list of tokens that correspond to output
styles, flags, or features:
.Pp
.Bl -tag -width "12345678"
.It Sy "Token Action"
.It dtrt
Enable "Do The Right Thing" mode
.It html
Emit HTML output
.It indent=xx
Set the indentation level
.It info
Add info attributes (HTML)
.It json
Emit JSON output
.It keys
Emit the key attribute for keys (XML)
.It no-locale
Do not initialize the locale setting
.It no-top
Do not emit a top set of braces (JSON)
.It not-first
Pretend the 1st output item was not 1st (JSON)
.It pretty
Emit pretty-printed output
.It text
Emit TEXT output
.It units
Add the 'units' (XML) or 'data-units (HTML) attribute
.It warn
Emit warnings when libxo detects bad calls
.It warn-xml
Emit warnings in XML
.It xml
Emit XML output
.It xpath
Add XPath expressions (HTML)
.El
.Pp
The
.Dq brief-options
are single letter commands, designed for those with
too little patience to use real tokens. No comma separator is used.
.Bl -column "i<num>"
.It Sy "Token Action"
.It "H " "Enable HTML output (XO_STYLE_HTML)"
.It "I " "Enable info output (XOF_INFO)"
.It "i<num> " "Indent by <number>"
.It "J " "Enable JSON output (XO_STYLE_JSON)"
.It "P " "Enable pretty-printed output (XOF_PRETTY)"
.It "T " "Enable text output (XO_STYLE_TEXT)"
.It "W " "Enable warnings (XOF_WARN)"
.It "X " "Enable XML output (XO_STYLE_XML)"
.It "x " "Enable XPath data (XOF_XPATH)"
.El
.Pp
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,73 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Sy typedef void *(*xo_realloc_func_t)(void *, size_t);
.Pp
.Sy typedef void (*xo_free_func_t)(void *);
.Ft void
.Fn xo_set_allocator "xo_realloc_func_t realloc_func" "xo_free_func_t free_func"
.Sh DESCRIPTION
The
.Fn xo_set_allocator
function allows libxo to be used in environments
where the standard
.Xr realloc 3
and
.Xr free 3
functions are not available.
.Pp
.Fa realloc_func
should expect the same arguments as
.Xr realloc 3
and return
a pointer to memory following the same convention.
.Fa free_func
will receive the same argument as
.Xr free 3
and should release it, asappropriate for the environment.
.Pp
By default, the standard
.Xr realloc 3
and
.Xr free 3
functions are used.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,128 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft void
.Fn xo_set_flags "xo_handle_t *handle" "unsigned flags"
.Ft void
.Fn xo_clear_flags "xo_handle_t *handle" "xo_xof_flags_t flags"
.Sh DESCRIPTION
Use the
.Fn xo_set_flags
function to set the flags for a
.Em libxo
handle. To use the default handle, pass a NULL handle.
.Pp
The set of valid flags include:
.Bl -tag -width "XOF_UNDERSCORES"
.It Sy "Flag Description"
.It XOF_CLOSE_FP
Close file pointer on xo_destroy(). This
flag will trigger the call of the close_func
(provided via
.Fn xo_set_writer 3 )
when the handle is destroyed.
.It XOF_DTRT
Enable "do the right thing" mode
.It XOF_INFO
Display info data attributes (HTML)
.It XOF_KEYS
Emit the key attribute (XML)
.It XOF_NO_ENV
Do not use the LIBXO_OPTIONS env var
.It XOF_PRETTY
Make 'pretty printed' output, with the
addition of indentation and newlines to enhance the readability of
XML, JSON, and HTML output. Text output is not affected.
.It XOF_UNDERSCORES
Replaces hyphens with underscores
.It XOF_UNITS
Display units (XML and HMTL)
.It XOF_WARN
Generate warnings for broken calls, triggering diagnostic
output (on standard error) when the library notices errors during
operations, or with arguments to functions. Without warning enabled,
such conditions are ignored.
Warnings allow developers to debug their interaction with libxo.
The function "xo_failure" can used as a breakpoint for a debugger,
regardless of whether warnings are enabled.
.It XOF_WARN_XML
Generate warnings in XML on stdout
.It XOF_XPATH
Emit XPath expressions (HTML)
.It XOF_COLUMNS
Force xo_emit to return columns used
.It XOF_FLUSH
Flush output after each xo_emit call
.El
.Pp
If the style is XO_STYLE_HTML, the following additional flags can be
used:
.Bl -tag -width "XOF_UNDERSCORES"
.It Sy "Flag Description"
.It XOF_XPATH
Emit "data-xpath" attributes
.It XOF_INFO
Emit additional informational fields for HTML
output. See
.Xr xo_set_info 3
for details.
.El
.Pp
The
.Em XOF_XPATH
flag enables the emission of XPath expressions detailing
the hierarchy of XML elements used to encode the data field, if the
XPATH style of output were requested.
.Pp
If the style is XO_STYLE_XML, the following additional flags can be
used:
.Bl -tag -width "XOF_UNDERSCORES"
.It Sy "Flag Description"
.It XOF_KEYS
Add 'key' attribute to the XML encoding for
field definitions that use the 'k' modifier. The key attribute has
the value "key".
.El
.Pp
The xo_clear_flags() function turns off the given flags in a specific
handle.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,113 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft void
.Fn xo_set_info "xo_handle_t *handle" "xo_info_t *info" "int count"
.Sh DESCRIPTION
HTML data can include additional information in attributes that
begin with "data-". To enable this, three things must occur:
.Pp
First the application must build an array of xo_info_t structures,
one per tag. The array must be sorted by name, since
.Em libxo
uses a
binary search to find the entry that matches names from format
instructions.
.Pp
The
.Em xo_info_t
structure is defined in
.Em <libxo/xo.h> :
.Bd -literal -offset indent
typedef struct xo_info_s {
const char *xi_name; /* Name of the element */
const char *xi_type; /* Type of field */
const char *xi_help; /* Description of field */
} xo_info_t;
.Ed
.Pp
Second, the application must inform
.Em libxo
about this information using the
.Fn xo_set_info
call. Like other libxo calls, passing NULL for the handle tells
.Em libxo
to use the default handle.
.Pp
If the
.Fa count
is -1,
.Em libxo
will count the elements of
.Fa info ,
but there
must be an empty element at the end. More typically, the number is
known to the application:
.Bd -literal -offset indent
xo_info_t info[] = {
{ "in-stock", "number", "Number of items in stock" },
{ "name", "string", "Name of the item" },
{ "on-order", "number", "Number of items on order" },
{ "sku", "string", "Stock Keeping Unit" },
{ "sold", "number", "Number of items sold" },
};
int info_count = (sizeof(info) / sizeof(info[0]));
...
xo_set_info(NULL, info, info_count);
.Ed
.Pp
Third, the emitting of info must be triggered with the
.Em XOF_INFO
flag
using either the
.Fn xo_set_flags
function or the
.Dq --libxo=info
command line argument.
.Pp
The type and help values, if present, are emitted as the "data-type"
and "data-help" attributes:
.Bd -literal -offset indent
<div class="data" data-tag="sku" data-type="string"
data-help="Stock Keeping Unit">GRO-000-533</div>
.Ed
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,52 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft int
.Fn xo_set_options "xo_handle_t *xop" "const char *input"
.Sh DESCRIPTION
The
.Fn xo_set_options
function accepts a comma-separated list of styles
and flags and enables them for a specific handle.
The options are identical to those listed in
.Xr xo_parse_args 3 .
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,72 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft void
.Fn xo_set_style "xo_handle_t *handle" "unsigned style"
.Ft int
.Fn xo_set_style_name "xo_handle_t *handle" "const char *style"
.Sh DESCRIPTION
Use the
.Fn xo_set_style
function to set the output style for a handle.
To use the default handle, pass a NULL handle.
The set of output styles used by
.Em libxo
is:
.Bl -column "XO_STYLE_TEXT12"
.It Sy "Flag Description"
.It "XO_STYLE_TEXT Traditional text output"
.It "XO_STYLE_XML XML encoded data"
.It "XO_STYLE_JSON JSON encoded data"
.It "XO_STYLE_HTML HTML encoded data"
.El
.Pp
The
.Fn xo_set_style_name
function can be used to set the style based on a name
encoded as a string.
The name can be any of the styles: "text", "xml", "json", or "html".
.Bd -literal -offset indent
EXAMPLE:
xo_set_style_name(NULL, "html");
.Ed
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,68 @@
.\" #
.\" # Copyright (c) 2014, Juniper Networks, Inc.
.\" # All rights reserved.
.\" # This SOFTWARE is licensed under the LICENSE provided in the
.\" # ../Copyright file. By downloading, installing, copying, or
.\" # using the SOFTWARE, you agree to be bound by the terms of that
.\" # LICENSE.
.\" # Phil Shafer, July 2014
.\"
.Dd July, 2014
.Dt LIBXO 3
.Os
.Sh NAME
.Nm xo_emit
.Nd emit formatted output based on format string and arguments
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft void
.Sy typedef int (*xo_write_func_t)(void *, const char *);
.Pp
.Sy typedef void (*xo_close_func_t)(void *);
.Fn xo_set_writer "xo_handle_t *handle" "void *opaque"
"xo_write_func_t write_func"
"xo_close_func_t close_func"
.Sh DESCRIPTION
The
.Fn xo_set_writer
function allows custom
.Dq write
functions
which can tailor how
.Em libxo
writes data. An
.Fa opaque
argument is
recorded and passed back to the
.Fa write_func
function, allowing the function
to acquire context information. The
.Fa close_func
function can
release this opaque data and any other resources as needed.
.Sh ADDITIONAL DOCUMENTATION
.Pp
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/libxo-manual.html
.Ed
.Pp
libxo lives on github as:
.Bd -literal -offset indent
https://github.com/Juniper/libxo
.Ed
.Pp
The latest release of libxo is available at:
.Bd -literal -offset indent
https://github.com/Juniper/libxo/releases
.Ed
.Sh SEE ALSO
.Xr xo_emit 3
.Sh HISTORY
The
.Fa libxo
library was added in FreeBSD 11.0.
.Sh AUTHOR
Phil Shafer

View File

@ -0,0 +1,198 @@
/* libxo/xoconfig.h.in. Generated from configure.ac by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
/* Define to 1 if you have the `bzero' function. */
#undef HAVE_BZERO
/* Define to 1 if you have the `ctime' function. */
#undef HAVE_CTIME
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `dlfunc' function. */
#undef HAVE_DLFUNC
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the `fdopen' function. */
#undef HAVE_FDOPEN
/* Define to 1 if you have the `flock' function. */
#undef HAVE_FLOCK
/* Define to 1 if you have the `getpass' function. */
#undef HAVE_GETPASS
/* Define to 1 if you have the `getrusage' function. */
#undef HAVE_GETRUSAGE
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Support printflike */
#undef HAVE_PRINTFLIKE
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
/* Define to 1 if you have the `srand' function. */
#undef HAVE_SRAND
/* Define to 1 if you have the `sranddev' function. */
#undef HAVE_SRANDDEV
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <stdtime/tzfile.h> header file. */
#undef HAVE_STDTIME_TZFILE_H
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the `strcspn' function. */
#undef HAVE_STRCSPN
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strspn' function. */
#undef HAVE_STRSPN
/* Define to 1 if you have the `sysctlbyname' function. */
#undef HAVE_SYSCTLBYNAME
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <tzfile.h> header file. */
#undef HAVE_TZFILE_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Enable debugging */
#undef LIBXO_DEBUG
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

View File

@ -0,0 +1,38 @@
/*
* $Id$
*
* Copyright (c) 2014, Juniper Networks, Inc.
* All rights reserved.
* This SOFTWARE is licensed under the LICENSE provided in the
* ../Copyright file. By downloading, installing, copying, or otherwise
* using the SOFTWARE, you agree to be bound by the terms of that
* LICENSE.
*
* xoversion.h -- compile time constants for libxo
* NOTE: This file is generated from xoversion.h.in.
*/
#ifndef LIBXO_XOVERSION_H
#define LIBXO_XOVERSION_H
/**
* The version string
*/
#define LIBXO_VERSION "@PACKAGE_VERSION@"
/**
* The version number
*/
#define LIBXO_VERSION_NUMBER @LIBXO_VERSION_NUMBER@
/**
* The version number as a string
*/
#define LIBXO_VERSION_STRING "@LIBXO_VERSION_NUMBER@"
/**
* The version number extra info as a string
*/
#define LIBXO_VERSION_EXTRA "@LIBXO_VERSION_EXTRA@"
#endif /* LIBXO_XOVERSION_H */

7982
contrib/libxo/m4/libtool.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

384
contrib/libxo/m4/ltoptions.m4 vendored Normal file
View File

@ -0,0 +1,384 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 7 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option `$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl `shared' nor `disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the `shared' and
# `disable-shared' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the `static' and
# `disable-static' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the `fast-install'
# and `disable-fast-install' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
# LT_INIT options.
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for lt_pkg in $withval; do
IFS="$lt_save_ifs"
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[pic_mode=default])
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])

123
contrib/libxo/m4/ltsugar.m4 vendored Normal file
View File

@ -0,0 +1,123 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59 which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])

23
contrib/libxo/m4/ltversion.m4 vendored Normal file
View File

@ -0,0 +1,23 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 3337 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.2])
m4_define([LT_PACKAGE_REVISION], [1.3337])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.2'
macro_revision='1.3337'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])

98
contrib/libxo/m4/lt~obsolete.m4 vendored Normal file
View File

@ -0,0 +1,98 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])

View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libxo
Version: @VERSION@
Description: The XML Output Library
Libs: @LIBXO_LIBDIR@ @LIBXO_LIBS@
Cflags: @LIBXO_INCLUDEDIR@

View File

@ -0,0 +1,44 @@
Name: @PACKAGE_NAME@
Version: @PACKAGE_VERSION@
Release: 1%{?dist}
Summary: The libxo library
Prefix: /usr
Vendor: Juniper Networks, Inc.
Packager: Phil Shafer <phil@juniper.net>
License: BSD
Group: Development/Libraries
URL: https://github.com/Juniper/libxo
Source0: https://github.com/Juniper/@PACKAGE_NAME@/releases/@PACKAGE_VERSION@/@PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz
%description
Welcome to libxo, a library that generates text, XML, JSON, and HTML
from a single source code path.
%prep
%setup -q
%build
%configure
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
%make_install
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%files
%{_bindir}/*
%{_includedir}/libxo/*
%{_libdir}/*
%{_datadir}/doc/libxo/*
%docdir %{_datadir}/doc/libxo/*
%{_mandir}/*/*
%docdir %{_mandir}/*/*

View File

@ -0,0 +1,28 @@
#
# Copyright 2014, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
SUBDIRS=core xo
test tests:
@(cur=`pwd` ; for dir in $(SUBDIRS) ; do \
cd $$dir ; \
$(MAKE) tests ; \
cd $$cur ; \
done)
accept:
@(cur=`pwd` ; for dir in $(SUBDIRS) ; do \
cd $$dir ; \
$(MAKE) accept ; \
cd $$cur ; \
done)
valgrind:
@echo '## Running the regression tests under Valgrind'
@echo '## Go get a cup of coffee it is gonna take a while ...'
${MAKE} VALGRIND='valgrind -q' tests

View File

@ -0,0 +1,107 @@
#
# $Id$
#
# Copyright 2014, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
AM_CFLAGS = -I${top_srcdir} -I${top_srcdir}/libxo
# Ick: maintained by hand!
TEST_CASES = \
test_01.c \
test_02.c \
test_03.c \
test_04.c \
test_05.c \
test_06.c \
test_07.c
test_01_test_SOURCES = test_01.c
test_02_test_SOURCES = test_02.c
test_03_test_SOURCES = test_03.c
test_04_test_SOURCES = test_04.c
test_05_test_SOURCES = test_05.c
test_06_test_SOURCES = test_06.c
test_07_test_SOURCES = test_07.c
# TEST_CASES := $(shell cd ${srcdir} ; echo *.c )
bin_PROGRAMS = ${TEST_CASES:.c=.test}
LDADD = \
${top_builddir}/libxo/libxo.la
EXTRA_DIST = \
${TEST_CASES} \
${addprefix saved/, ${TEST_CASES:.c=.T.err}} \
${addprefix saved/, ${TEST_CASES:.c=.T.out}} \
${addprefix saved/, ${TEST_CASES:.c=.XP.err}} \
${addprefix saved/, ${TEST_CASES:.c=.XP.out}} \
${addprefix saved/, ${TEST_CASES:.c=.JP.err}} \
${addprefix saved/, ${TEST_CASES:.c=.JP.out}} \
${addprefix saved/, ${TEST_CASES:.c=.HP.err}} \
${addprefix saved/, ${TEST_CASES:.c=.HP.out}} \
${addprefix saved/, ${TEST_CASES:.c=.X.err}} \
${addprefix saved/, ${TEST_CASES:.c=.X.out}} \
${addprefix saved/, ${TEST_CASES:.c=.J.err}} \
${addprefix saved/, ${TEST_CASES:.c=.J.out}} \
${addprefix saved/, ${TEST_CASES:.c=.H.err}} \
${addprefix saved/, ${TEST_CASES:.c=.H.out}} \
${addprefix saved/, ${TEST_CASES:.c=.HIPx.err}} \
${addprefix saved/, ${TEST_CASES:.c=.HIPx.out}}
S2O = | ${SED} '1,/@@/d'
all:
valgrind:
@echo '## Running the regression tests under Valgrind'
${MAKE} CHECKER='valgrind -q' tests
#TEST_TRACE = set -x ;
TEST_ONE = \
LIBXO_OPTIONS=:W$$fmt \
${CHECKER} $$base.test ${TEST_OPTS} \
> out/$$base.$$fmt.out 2> out/$$base.$$fmt.err ; \
${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.out out/$$base.$$fmt.out ${S2O} ; \
${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.err out/$$base.$$fmt.err ${S2O}
TEST_FORMATS = T XP JP HP X J H HIPx
test tests: ${bin_PROGRAMS}
@${MKDIR} -p out
-@ ${TEST_TRACE} (for test in ${TEST_CASES} ; do \
base=`${BASENAME} $$test .c` ; \
(for fmt in ${TEST_FORMATS}; do \
echo "... $$test ... $$fmt ..."; \
${TEST_ONE}; \
true; \
done) \
done)
one:
-@(test=${TEST_CASE}; data=${TEST_DATA}; ${TEST_ONE} ; true)
accept:
-@(for test in ${TEST_CASES} ; do \
base=`${BASENAME} $$test .c` ; \
(for fmt in ${TEST_FORMATS}; do \
echo "... $$test ... $$fmt ..."; \
${CP} out/$$base.$$fmt.out ${srcdir}/saved/$$base.$$fmt.out ; \
${CP} out/$$base.$$fmt.err ${srcdir}/saved/$$base.$$fmt.err ; \
done) \
done)
.c.test:
$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -o $@ $<
CLEANFILES = ${TEST_CASES:.c=.test}
CLEANDIRS = out
clean-local:
rm -rf ${CLEANDIRS}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,238 @@
<div class="line">
<div class="title">Item </div>
<div class="title"> Total Sold</div>
<div class="title"> In Stock</div>
<div class="title"> On Order</div>
<div class="title"> SKU</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">gum </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'GRO-000-415'][name = 'gum']/sold" data-type="number" data-help="Number of items sold"> 1412</div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'GRO-000-415'][name = 'gum']/in-stock" data-type="number" data-help="Number of items in stock"> 54</div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'GRO-000-415'][name = 'gum']/on-order" data-type="number" data-help="Number of items on order"> 10</div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key"> GRO-000-415</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">rope </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'HRD-000-212'][name = 'rope']/sold" data-type="number" data-help="Number of items sold"> 85</div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'HRD-000-212'][name = 'rope']/in-stock" data-type="number" data-help="Number of items in stock"> 4</div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'HRD-000-212'][name = 'rope']/on-order" data-type="number" data-help="Number of items on order"> 2</div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key"> HRD-000-212</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">ladder </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'HRD-000-517'][name = 'ladder']/sold" data-type="number" data-help="Number of items sold"> 0</div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'HRD-000-517'][name = 'ladder']/in-stock" data-type="number" data-help="Number of items in stock"> 2</div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'HRD-000-517'][name = 'ladder']/on-order" data-type="number" data-help="Number of items on order"> 1</div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key"> HRD-000-517</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">bolt </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'HRD-000-632'][name = 'bolt']/sold" data-type="number" data-help="Number of items sold"> 4123</div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'HRD-000-632'][name = 'bolt']/in-stock" data-type="number" data-help="Number of items in stock"> 144</div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'HRD-000-632'][name = 'bolt']/on-order" data-type="number" data-help="Number of items on order"> 42</div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key"> HRD-000-632</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">water </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'GRO-000-2331'][name = 'water']/sold" data-type="number" data-help="Number of items sold"> 17</div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'GRO-000-2331'][name = 'water']/in-stock" data-type="number" data-help="Number of items in stock"> 14</div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'GRO-000-2331'][name = 'water']/on-order" data-type="number" data-help="Number of items on order"> 2</div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key"> GRO-000-2331</div>
</div>
<div class="line">
</div>
<div class="line">
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">gum</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'GRO-000-415'][name = 'gum']/sold" data-type="number" data-help="Number of items sold">1412.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'GRO-000-415'][name = 'gum']/in-stock" data-type="number" data-help="Number of items in stock">54</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'GRO-000-415'][name = 'gum']/on-order" data-type="number" data-help="Number of items on order">10</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key">GRO-000-415</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">rope</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'HRD-000-212'][name = 'rope']/sold" data-type="number" data-help="Number of items sold">85.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'HRD-000-212'][name = 'rope']/in-stock" data-type="number" data-help="Number of items in stock">4</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'HRD-000-212'][name = 'rope']/on-order" data-type="number" data-help="Number of items on order">2</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key">HRD-000-212</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">ladder</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'HRD-000-517'][name = 'ladder']/sold" data-type="number" data-help="Number of items sold">0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'HRD-000-517'][name = 'ladder']/in-stock" data-type="number" data-help="Number of items in stock">2</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'HRD-000-517'][name = 'ladder']/on-order" data-type="number" data-help="Number of items on order">1</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key">HRD-000-517</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">bolt</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'HRD-000-632'][name = 'bolt']/sold" data-type="number" data-help="Number of items sold">4123.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'HRD-000-632'][name = 'bolt']/in-stock" data-type="number" data-help="Number of items in stock">144</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'HRD-000-632'][name = 'bolt']/on-order" data-type="number" data-help="Number of items on order">42</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key">HRD-000-632</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">water</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'GRO-000-2331'][name = 'water']/sold" data-type="number" data-help="Number of items sold">17.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'GRO-000-2331'][name = 'water']/in-stock" data-type="number" data-help="Number of items in stock">14</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'GRO-000-2331'][name = 'water']/on-order" data-type="number" data-help="Number of items on order">2</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key">GRO-000-2331</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-xpath="/top/data/item/name" data-type="string" data-help="Name of the item" data-key="key">fish</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold" data-xpath="/top/data/item[sku = 'GRO-000-533'][name = 'fish']/sold" data-type="number" data-help="Number of items sold">1321.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock" data-xpath="/top/data/item[sku = 'GRO-000-533'][name = 'fish']/in-stock" data-type="number" data-help="Number of items in stock">45</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order" data-xpath="/top/data/item[sku = 'GRO-000-533'][name = 'fish']/on-order" data-type="number" data-help="Number of items on order">1</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-xpath="/top/data/item/sku" data-type="string" data-help="Stock Keeping Unit" data-key="key">GRO-000-533</div>
</div>

View File

@ -0,0 +1,238 @@
<div class="line">
<div class="title">Item </div>
<div class="title"> Total Sold</div>
<div class="title"> In Stock</div>
<div class="title"> On Order</div>
<div class="title"> SKU</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-key="key">gum </div>
<div class="data" data-tag="sold"> 1412</div>
<div class="data" data-tag="in-stock"> 54</div>
<div class="data" data-tag="on-order"> 10</div>
<div class="data" data-tag="sku" data-key="key"> GRO-000-415</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-key="key">rope </div>
<div class="data" data-tag="sold"> 85</div>
<div class="data" data-tag="in-stock"> 4</div>
<div class="data" data-tag="on-order"> 2</div>
<div class="data" data-tag="sku" data-key="key"> HRD-000-212</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-key="key">ladder </div>
<div class="data" data-tag="sold"> 0</div>
<div class="data" data-tag="in-stock"> 2</div>
<div class="data" data-tag="on-order"> 1</div>
<div class="data" data-tag="sku" data-key="key"> HRD-000-517</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-key="key">bolt </div>
<div class="data" data-tag="sold"> 4123</div>
<div class="data" data-tag="in-stock"> 144</div>
<div class="data" data-tag="on-order"> 42</div>
<div class="data" data-tag="sku" data-key="key"> HRD-000-632</div>
</div>
<div class="line">
<div class="data" data-tag="name" data-key="key">water </div>
<div class="data" data-tag="sold"> 17</div>
<div class="data" data-tag="in-stock"> 14</div>
<div class="data" data-tag="on-order"> 2</div>
<div class="data" data-tag="sku" data-key="key"> GRO-000-2331</div>
</div>
<div class="line">
</div>
<div class="line">
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-key="key">gum</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold">1412.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock">54</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order">10</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-key="key">GRO-000-415</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-key="key">rope</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold">85.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock">4</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order">2</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-key="key">HRD-000-212</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-key="key">ladder</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold">0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock">2</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order">1</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-key="key">HRD-000-517</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-key="key">bolt</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold">4123.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock">144</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order">42</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-key="key">HRD-000-632</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-key="key">water</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold">17.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock">14</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order">2</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-key="key">GRO-000-2331</div>
</div>
<div class="line">
<div class="label">Item</div>
<div class="text"> '</div>
<div class="data" data-tag="name" data-key="key">fish</div>
<div class="text">':</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">Total sold</div>
<div class="text">: </div>
<div class="data" data-tag="sold">1321.0</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">In stock</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="in-stock">45</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">On order</div>
<div class="decoration">:</div>
<div class="padding"> </div>
<div class="data" data-tag="on-order">1</div>
</div>
<div class="line">
<div class="padding"> </div>
<div class="label">SKU</div>
<div class="text">: </div>
<div class="data" data-tag="sku" data-key="key">GRO-000-533</div>
</div>

View File

@ -0,0 +1,2 @@
{"top": {"data": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"water","sold":17,"in-stock":14,"on-order":2}]}, "data": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412.0,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85.0,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123.0,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"water","sold":17.0,"in-stock":14,"on-order":2}]}, "data": {"item": [{"sku":"GRO-000-533","name":"fish","sold":1321.0,"in-stock":45,"on-order":1}]}}
}

View File

@ -0,0 +1,93 @@
{
"top": {
"data": {
"item": [
{
"sku": "GRO-000-415",
"name": "gum",
"sold": 1412,
"in-stock": 54,
"on-order": 10
},
{
"sku": "HRD-000-212",
"name": "rope",
"sold": 85,
"in-stock": 4,
"on-order": 2
},
{
"sku": "HRD-000-517",
"name": "ladder",
"sold": 0,
"in-stock": 2,
"on-order": 1
},
{
"sku": "HRD-000-632",
"name": "bolt",
"sold": 4123,
"in-stock": 144,
"on-order": 42
},
{
"sku": "GRO-000-2331",
"name": "water",
"sold": 17,
"in-stock": 14,
"on-order": 2
}
]
},
"data": {
"item": [
{
"sku": "GRO-000-415",
"name": "gum",
"sold": 1412.0,
"in-stock": 54,
"on-order": 10
},
{
"sku": "HRD-000-212",
"name": "rope",
"sold": 85.0,
"in-stock": 4,
"on-order": 2
},
{
"sku": "HRD-000-517",
"name": "ladder",
"sold": 0,
"in-stock": 2,
"on-order": 1
},
{
"sku": "HRD-000-632",
"name": "bolt",
"sold": 4123.0,
"in-stock": 144,
"on-order": 42
},
{
"sku": "GRO-000-2331",
"name": "water",
"sold": 17.0,
"in-stock": 14,
"on-order": 2
}
]
},
"data": {
"item": [
{
"sku": "GRO-000-533",
"name": "fish",
"sold": 1321.0,
"in-stock": 45,
"on-order": 1
}
]
}
}
}

View File

@ -0,0 +1,38 @@
Item Total Sold In Stock On Order SKU
gum 1412 54 10 GRO-000-415
rope 85 4 2 HRD-000-212
ladder 0 2 1 HRD-000-517
bolt 4123 144 42 HRD-000-632
water 17 14 2 GRO-000-2331
Item 'gum':
Total sold: 1412.0
In stock: 54
On order: 10
SKU: GRO-000-415
Item 'rope':
Total sold: 85.0
In stock: 4
On order: 2
SKU: HRD-000-212
Item 'ladder':
Total sold: 0
In stock: 2
On order: 1
SKU: HRD-000-517
Item 'bolt':
Total sold: 4123.0
In stock: 144
On order: 42
SKU: HRD-000-632
Item 'water':
Total sold: 17.0
In stock: 14
On order: 2
SKU: GRO-000-2331
Item 'fish':
Total sold: 1321.0
In stock: 45
On order: 1
SKU: GRO-000-533

View File

@ -0,0 +1 @@
<top><data><item><sku key="key">GRO-000-415</sku><name key="key">gum</name><sold>1412</sold><in-stock>54</in-stock><on-order>10</on-order></item><item><sku key="key">HRD-000-212</sku><name key="key">rope</name><sold>85</sold><in-stock>4</in-stock><on-order>2</on-order></item><item><sku key="key">HRD-000-517</sku><name key="key">ladder</name><sold>0</sold><in-stock>2</in-stock><on-order>1</on-order></item><item><sku key="key">HRD-000-632</sku><name key="key">bolt</name><sold>4123</sold><in-stock>144</in-stock><on-order>42</on-order></item><item><sku key="key">GRO-000-2331</sku><name key="key">water</name><sold>17</sold><in-stock>14</in-stock><on-order>2</on-order></item></data><data><item><sku key="key">GRO-000-415</sku><name key="key">gum</name><sold>1412.0</sold><in-stock>54</in-stock><on-order>10</on-order></item><item><sku key="key">HRD-000-212</sku><name key="key">rope</name><sold>85.0</sold><in-stock>4</in-stock><on-order>2</on-order></item><item><sku key="key">HRD-000-517</sku><name key="key">ladder</name><sold>0</sold><in-stock>2</in-stock><on-order>1</on-order></item><item><sku key="key">HRD-000-632</sku><name key="key">bolt</name><sold>4123.0</sold><in-stock>144</in-stock><on-order>42</on-order></item><item><sku key="key">GRO-000-2331</sku><name key="key">water</name><sold>17.0</sold><in-stock>14</in-stock><on-order>2</on-order></item></data><data><item><sku key="key">GRO-000-533</sku><name key="key">fish</name><sold>1321.0</sold><in-stock>45</in-stock><on-order>1</on-order></item></data></top>

View File

@ -0,0 +1,85 @@
<top>
<data>
<item>
<sku key="key">GRO-000-415</sku>
<name key="key">gum</name>
<sold>1412</sold>
<in-stock>54</in-stock>
<on-order>10</on-order>
</item>
<item>
<sku key="key">HRD-000-212</sku>
<name key="key">rope</name>
<sold>85</sold>
<in-stock>4</in-stock>
<on-order>2</on-order>
</item>
<item>
<sku key="key">HRD-000-517</sku>
<name key="key">ladder</name>
<sold>0</sold>
<in-stock>2</in-stock>
<on-order>1</on-order>
</item>
<item>
<sku key="key">HRD-000-632</sku>
<name key="key">bolt</name>
<sold>4123</sold>
<in-stock>144</in-stock>
<on-order>42</on-order>
</item>
<item>
<sku key="key">GRO-000-2331</sku>
<name key="key">water</name>
<sold>17</sold>
<in-stock>14</in-stock>
<on-order>2</on-order>
</item>
</data>
<data>
<item>
<sku key="key">GRO-000-415</sku>
<name key="key">gum</name>
<sold>1412.0</sold>
<in-stock>54</in-stock>
<on-order>10</on-order>
</item>
<item>
<sku key="key">HRD-000-212</sku>
<name key="key">rope</name>
<sold>85.0</sold>
<in-stock>4</in-stock>
<on-order>2</on-order>
</item>
<item>
<sku key="key">HRD-000-517</sku>
<name key="key">ladder</name>
<sold>0</sold>
<in-stock>2</in-stock>
<on-order>1</on-order>
</item>
<item>
<sku key="key">HRD-000-632</sku>
<name key="key">bolt</name>
<sold>4123.0</sold>
<in-stock>144</in-stock>
<on-order>42</on-order>
</item>
<item>
<sku key="key">GRO-000-2331</sku>
<name key="key">water</name>
<sold>17.0</sold>
<in-stock>14</in-stock>
<on-order>2</on-order>
</item>
</data>
<data>
<item>
<sku key="key">GRO-000-533</sku>
<name key="key">fish</name>
<sold>1321.0</sold>
<in-stock>45</in-stock>
<on-order>1</on-order>
</item>
</data>
</top>

View File

@ -0,0 +1,38 @@
Item Total Sold In Stock On Order SKU
gum 1412 54 10 GRO-000-415
rope 85 4 2 HRD-000-212
ladder 0 2 1 HRD-000-517
bolt 4123 144 42 HRD-000-632
water 17 14 2 GRO-000-2331
Item 'gum':
Total sold: 1412.0
In stock: 54
On order: 10
SKU: GRO-000-415
Item 'rope':
Total sold: 85.0
In stock: 4
On order: 2
SKU: HRD-000-212
Item 'ladder':
Total sold: 0
In stock: 2
On order: 1
SKU: HRD-000-517
Item 'bolt':
Total sold: 4123.0
In stock: 144
On order: 42
SKU: HRD-000-632
Item 'water':
Total sold: 17.0
In stock: 14
On order: 2
SKU: GRO-000-2331
Item 'fish':
Total sold: 1321.0
In stock: 45
On order: 1
SKU: GRO-000-533

View File

@ -0,0 +1,3 @@
<div class="line"><div class="data" data-tag="mbuf-current">10</div><div class="text">/</div><div class="data" data-tag="mbuf-cache">20</div><div class="text">/</div><div class="data" data-tag="mbuf-total">30</div><div class="text"> </div><div class="note">mbufs &lt;&amp;&gt; in use (current/cache/total)</div></div><div class="line"><div class="data" data-tag="distance" data-units="miles">50</div><div class="padding"> </div><div class="text"> from </div><div class="data" data-tag="location">Boston</div></div><div class="line"><div class="data" data-tag="memory" data-units="k">64</div><div class="text"> left out of </div><div class="data" data-tag="total" data-units="kb">640</div></div><div class="line"><div class="data" data-tag="memory" data-units="k">64</div><div class="text"> left out of </div><div class="data" data-tag="total" data-units="kilobytes">640</div></div><div class="line"><div class="title">beforeworkingafter:</div></div><div class="line"><div class="data" data-tag="some">string</div><div class="data" data-tag="ten">10</div><div class="data" data-tag="eleven">11</div></div><div class="line"><div class="data" data-tag="unknown">1010</div><div class="text"> </div><div class="note">packets here/there/everywhere</div></div><div class="line"><div class="text">(</div><div class="padding"> </div><div class="data" data-tag="min">15</div><div class="text">/</div><div class="data" data-tag="cur">20</div><div class="text">/</div><div class="data" data-tag="max">125</div><div class="text">)</div></div><div class="line"><div class="text">(</div><div class="padding"> </div><div class="data" data-tag="min">15</div><div class="text">/</div><div class="data" data-tag="cur">20</div><div class="text">/</div><div class="data" data-tag="max">125</div><div class="text">)</div></div><div class="line"><div class="text">(</div><div class="data" data-tag="min">15</div><div class="text">/</div><div class="data" data-tag="cur">20</div><div class="text">/</div><div class="data" data-tag="max">125</div><div class="padding"> </div><div class="text">)</div></div><div class="line"><div class="text">(</div><div class="data" data-tag="min">15</div><div class="text">/</div><div class="data" data-tag="cur">20</div><div class="text">/</div><div class="data" data-tag="max">125</div><div class="padding"> </div><div class="text">)</div></div><div class="line"><div class="data" data-tag="flag">one</div><div class="text"> </div><div class="data" data-tag="flag">two</div><div class="text"> </div><div class="data" data-tag="flag">three</div></div><div class="line"><div class="text">1:</div><div class="data" data-tag="t1"> 1000</div><div class="text"> 2:</div><div class="data" data-tag="t2">test5000 </div><div class="text"> 3:</div><div class="data" data-tag="t3"> ten-longx</div><div class="text"> 4:</div><div class="data" data-tag="t4">xtest </div></div><div class="line"><div class="error">this is an error</div></div><div class="line"><div class="error">two more errors</div></div><div class="line"><div class="warning">this is an warning</div></div><div class="line"><div class="warning">two more warnings</div></div><div class="line"><div class="label">V1/V2 packets</div><div class="text">: </div><div class="data" data-tag="count">10</div></div><div class="line"><div class="data" data-tag="test">0004</div><div class="text"> </div><div class="label">tries</div></div><div class="line"><div class="message">improper use of profanity; ten yard penalty; first down
</div></div><div class="line"><div class="error">Shut 'er down, Clancey! She's a-pumpin' mud! &lt;&gt;!,"!&lt;&gt;
</div></div>

View File

@ -0,0 +1,125 @@
<div class="line">
<div class="data" data-tag="mbuf-current" data-xpath="/top/data/mbuf-current">10</div>
<div class="text">/</div>
<div class="data" data-tag="mbuf-cache" data-xpath="/top/data/mbuf-cache">20</div>
<div class="text">/</div>
<div class="data" data-tag="mbuf-total" data-xpath="/top/data/mbuf-total">30</div>
<div class="text"> </div>
<div class="note">mbufs &lt;&amp;&gt; in use (current/cache/total)</div>
</div>
<div class="line">
<div class="data" data-tag="distance" data-units="miles" data-xpath="/top/data/distance">50</div>
<div class="padding"> </div>
<div class="text"> from </div>
<div class="data" data-tag="location" data-xpath="/top/data/location">Boston</div>
</div>
<div class="line">
<div class="data" data-tag="memory" data-units="k" data-xpath="/top/data/memory">64</div>
<div class="text"> left out of </div>
<div class="data" data-tag="total" data-units="kb" data-xpath="/top/data/total">640</div>
</div>
<div class="line">
<div class="data" data-tag="memory" data-units="k" data-xpath="/top/data/memory">64</div>
<div class="text"> left out of </div>
<div class="data" data-tag="total" data-units="kilobytes" data-xpath="/top/data/total">640</div>
</div>
<div class="line">
<div class="title">beforeworkingafter:</div>
</div>
<div class="line">
<div class="data" data-tag="some" data-xpath="/top/data/some">string</div>
<div class="data" data-tag="ten" data-xpath="/top/data/ten">10</div>
<div class="data" data-tag="eleven" data-xpath="/top/data/eleven">11</div>
</div>
<div class="line">
<div class="data" data-tag="unknown" data-xpath="/top/data/unknown">1010</div>
<div class="text"> </div>
<div class="note">packets here/there/everywhere</div>
</div>
<div class="line">
<div class="text">(</div>
<div class="padding"> </div>
<div class="data" data-tag="min" data-xpath="/top/data/min">15</div>
<div class="text">/</div>
<div class="data" data-tag="cur" data-xpath="/top/data/cur">20</div>
<div class="text">/</div>
<div class="data" data-tag="max" data-xpath="/top/data/max">125</div>
<div class="text">)</div>
</div>
<div class="line">
<div class="text">(</div>
<div class="padding"> </div>
<div class="data" data-tag="min" data-xpath="/top/data/min">15</div>
<div class="text">/</div>
<div class="data" data-tag="cur" data-xpath="/top/data/cur">20</div>
<div class="text">/</div>
<div class="data" data-tag="max" data-xpath="/top/data/max">125</div>
<div class="text">)</div>
</div>
<div class="line">
<div class="text">(</div>
<div class="data" data-tag="min" data-xpath="/top/data/min">15</div>
<div class="text">/</div>
<div class="data" data-tag="cur" data-xpath="/top/data/cur">20</div>
<div class="text">/</div>
<div class="data" data-tag="max" data-xpath="/top/data/max">125</div>
<div class="padding"> </div>
<div class="text">)</div>
</div>
<div class="line">
<div class="text">(</div>
<div class="data" data-tag="min" data-xpath="/top/data/min">15</div>
<div class="text">/</div>
<div class="data" data-tag="cur" data-xpath="/top/data/cur">20</div>
<div class="text">/</div>
<div class="data" data-tag="max" data-xpath="/top/data/max">125</div>
<div class="padding"> </div>
<div class="text">)</div>
</div>
<div class="line">
<div class="data" data-tag="flag" data-xpath="/top/data/flag">one</div>
<div class="text"> </div>
<div class="data" data-tag="flag" data-xpath="/top/data/flag">two</div>
<div class="text"> </div>
<div class="data" data-tag="flag" data-xpath="/top/data/flag">three</div>
</div>
<div class="line">
<div class="text">1:</div>
<div class="data" data-tag="t1" data-xpath="/top/data/t1"> 1000</div>
<div class="text"> 2:</div>
<div class="data" data-tag="t2" data-xpath="/top/data/t2">test5000 </div>
<div class="text"> 3:</div>
<div class="data" data-tag="t3" data-xpath="/top/data/t3"> ten-longx</div>
<div class="text"> 4:</div>
<div class="data" data-tag="t4" data-xpath="/top/data/t4">xtest </div>
</div>
<div class="line">
<div class="error">this is an error</div>
</div>
<div class="line">
<div class="error">two more errors</div>
</div>
<div class="line">
<div class="warning">this is an warning</div>
</div>
<div class="line">
<div class="warning">two more warnings</div>
</div>
<div class="line">
<div class="label">V1/V2 packets</div>
<div class="text">: </div>
<div class="data" data-tag="count" data-xpath="/top/data/count">10</div>
</div>
<div class="line">
<div class="data" data-tag="test" data-xpath="/top/data/test">0004</div>
<div class="text"> </div>
<div class="label">tries</div>
</div>
<div class="line">
<div class="message">improper use of profanity; ten yard penalty; first down
</div>
</div>
<div class="line">
<div class="error">Shut 'er down, Clancey! She's a-pumpin' mud! &lt;&gt;!,"!&lt;&gt;
</div>
</div>

View File

@ -0,0 +1,125 @@
<div class="line">
<div class="data" data-tag="mbuf-current">10</div>
<div class="text">/</div>
<div class="data" data-tag="mbuf-cache">20</div>
<div class="text">/</div>
<div class="data" data-tag="mbuf-total">30</div>
<div class="text"> </div>
<div class="note">mbufs &lt;&amp;&gt; in use (current/cache/total)</div>
</div>
<div class="line">
<div class="data" data-tag="distance" data-units="miles">50</div>
<div class="padding"> </div>
<div class="text"> from </div>
<div class="data" data-tag="location">Boston</div>
</div>
<div class="line">
<div class="data" data-tag="memory" data-units="k">64</div>
<div class="text"> left out of </div>
<div class="data" data-tag="total" data-units="kb">640</div>
</div>
<div class="line">
<div class="data" data-tag="memory" data-units="k">64</div>
<div class="text"> left out of </div>
<div class="data" data-tag="total" data-units="kilobytes">640</div>
</div>
<div class="line">
<div class="title">beforeworkingafter:</div>
</div>
<div class="line">
<div class="data" data-tag="some">string</div>
<div class="data" data-tag="ten">10</div>
<div class="data" data-tag="eleven">11</div>
</div>
<div class="line">
<div class="data" data-tag="unknown">1010</div>
<div class="text"> </div>
<div class="note">packets here/there/everywhere</div>
</div>
<div class="line">
<div class="text">(</div>
<div class="padding"> </div>
<div class="data" data-tag="min">15</div>
<div class="text">/</div>
<div class="data" data-tag="cur">20</div>
<div class="text">/</div>
<div class="data" data-tag="max">125</div>
<div class="text">)</div>
</div>
<div class="line">
<div class="text">(</div>
<div class="padding"> </div>
<div class="data" data-tag="min">15</div>
<div class="text">/</div>
<div class="data" data-tag="cur">20</div>
<div class="text">/</div>
<div class="data" data-tag="max">125</div>
<div class="text">)</div>
</div>
<div class="line">
<div class="text">(</div>
<div class="data" data-tag="min">15</div>
<div class="text">/</div>
<div class="data" data-tag="cur">20</div>
<div class="text">/</div>
<div class="data" data-tag="max">125</div>
<div class="padding"> </div>
<div class="text">)</div>
</div>
<div class="line">
<div class="text">(</div>
<div class="data" data-tag="min">15</div>
<div class="text">/</div>
<div class="data" data-tag="cur">20</div>
<div class="text">/</div>
<div class="data" data-tag="max">125</div>
<div class="padding"> </div>
<div class="text">)</div>
</div>
<div class="line">
<div class="data" data-tag="flag">one</div>
<div class="text"> </div>
<div class="data" data-tag="flag">two</div>
<div class="text"> </div>
<div class="data" data-tag="flag">three</div>
</div>
<div class="line">
<div class="text">1:</div>
<div class="data" data-tag="t1"> 1000</div>
<div class="text"> 2:</div>
<div class="data" data-tag="t2">test5000 </div>
<div class="text"> 3:</div>
<div class="data" data-tag="t3"> ten-longx</div>
<div class="text"> 4:</div>
<div class="data" data-tag="t4">xtest </div>
</div>
<div class="line">
<div class="error">this is an error</div>
</div>
<div class="line">
<div class="error">two more errors</div>
</div>
<div class="line">
<div class="warning">this is an warning</div>
</div>
<div class="line">
<div class="warning">two more warnings</div>
</div>
<div class="line">
<div class="label">V1/V2 packets</div>
<div class="text">: </div>
<div class="data" data-tag="count">10</div>
</div>
<div class="line">
<div class="data" data-tag="test">0004</div>
<div class="text"> </div>
<div class="label">tries</div>
</div>
<div class="line">
<div class="message">improper use of profanity; ten yard penalty; first down
</div>
</div>
<div class="line">
<div class="error">Shut 'er down, Clancey! She's a-pumpin' mud! &lt;&gt;!,"!&lt;&gt;
</div>
</div>

View File

@ -0,0 +1,2 @@
{"top": {"data": {"mbuf-current":10,"mbuf-cache":20,"mbuf-total":30,"distance":50,"location":"Boston","memory":64,"total":640,"memory":64,"total":640,"ten":10,"eleven":11,"unknown":1010,"min":15,"cur":20,"max":30,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125, "flag": ["one","two","three"],"empty-tag":true,"t1":"1000","t2":"test5000","t3":"ten-longx","t4":"xtest","count":10,"test":4}}
}

View File

@ -0,0 +1,40 @@
{
"top": {
"data": {
"mbuf-current": 10,
"mbuf-cache": 20,
"mbuf-total": 30,
"distance": 50,
"location": "Boston",
"memory": 64,
"total": 640,
"memory": 64,
"total": 640,
"ten": 10,
"eleven": 11,
"unknown": 1010,
"min": 15,
"cur": 20,
"max": 30,
"min": 15,
"cur": 20,
"max": 125,
"min": 15,
"cur": 20,
"max": 125,
"min": 15,
"cur": 20,
"max": 125,
"flag": [
"one", "two", "three"
],
"empty-tag": true,
"t1": "1000",
"t2": "test5000",
"t3": "ten-longx",
"t4": "xtest",
"count": 10,
"test": 4
}
}
}

View File

@ -0,0 +1 @@
Shut 'er down, Clancey! She's a-pumpin' mud! <>!,"!<>

View File

@ -0,0 +1,20 @@
10/20/30 mbufs <&> in use (current/cache/total)
50 miles from Boston
64k left out of 640kb
64k left out of 640kilobytes
beforeworkingafter:
string1011
1010 packets here/there/everywhere
( 15/20/125)
( 15/20/125)
(15/20/125 )
(15/20/125 )
one two three
1: 1000 2:test5000 3: ten-longx 4:xtest
this is an error
two more errors
this is an warning
two more warnings
V1/V2 packets: 10
0004 tries
improper use of profanity; ten yard penalty; first down

View File

@ -0,0 +1,3 @@
<top><data><mbuf-current>10</mbuf-current><mbuf-cache>20</mbuf-cache><mbuf-total>30</mbuf-total><distance units="miles">50</distance><location>Boston</location><memory units="k">64</memory><total units="kb">640</total><memory units="k">64</memory><total units="kilobytes">640</total><ten>10</ten><eleven>11</eleven><unknown>1010</unknown><min>15</min><cur>20</cur><max>30</max><min>15</min><cur>20</cur><max>125</max><min>15</min><cur>20</cur><max>125</max><min>15</min><cur>20</cur><max>125</max><flag>one</flag><flag>two</flag><flag>three</flag><empty-tag></empty-tag><t1>1000</t1><t2>test5000</t2><t3>ten-longx</t3><t4>xtest</t4><error><message>this is an error</message></error><error><message>two more errors</message></error><warning><message>this is an warning</message></warning><warning><message>two more warnings</message></warning><count>10</count><test>4</test><message>improper use of profanity; ten yard penalty; first down</message>
<error><message>Shut 'er down, Clancey! She's a-pumpin' mud! &lt;&gt;!,"!&lt;&gt;
</message></error></data></top>

View File

@ -0,0 +1,55 @@
<top>
<data>
<mbuf-current>10</mbuf-current>
<mbuf-cache>20</mbuf-cache>
<mbuf-total>30</mbuf-total>
<distance units="miles">50</distance>
<location>Boston</location>
<memory units="k">64</memory>
<total units="kb">640</total>
<memory units="k">64</memory>
<total units="kilobytes">640</total>
<ten>10</ten>
<eleven>11</eleven>
<unknown>1010</unknown>
<min>15</min>
<cur>20</cur>
<max>30</max>
<min>15</min>
<cur>20</cur>
<max>125</max>
<min>15</min>
<cur>20</cur>
<max>125</max>
<min>15</min>
<cur>20</cur>
<max>125</max>
<flag>one</flag>
<flag>two</flag>
<flag>three</flag>
<empty-tag></empty-tag>
<t1>1000</t1>
<t2>test5000</t2>
<t3>ten-longx</t3>
<t4>xtest</t4>
<error>
<message>this is an error</message>
</error>
<error>
<message>two more errors</message>
</error>
<warning>
<message>this is an warning</message>
</warning>
<warning>
<message>two more warnings</message>
</warning>
<count>10</count>
<test>4</test>
<message>improper use of profanity; ten yard penalty; first down</message>
<error>
<message>Shut 'er down, Clancey! She's a-pumpin' mud! &lt;&gt;!,"!&lt;&gt;
</message>
</error>
</data>
</top>

View File

@ -0,0 +1,38 @@
Item Total Sold In Stock On Order SKU
gum 1412 54 10 GRO-000-415
rope 85 4 2 HRD-000-212
ladder 0 2 1 HRD-000-517
bolt 4123 144 42 HRD-000-632
water 17 14 2 GRO-000-2331
Item 'gum':
Total sold: 1412.0
In stock: 54
On order: 10
SKU: GRO-000-415
Item 'rope':
Total sold: 85.0
In stock: 4
On order: 2
SKU: HRD-000-212
Item 'ladder':
Total sold: 0
In stock: 2
On order: 1
SKU: HRD-000-517
Item 'bolt':
Total sold: 4123.0
In stock: 144
On order: 42
SKU: HRD-000-632
Item 'water':
Total sold: 17.0
In stock: 14
On order: 2
SKU: GRO-000-2331
Item 'fish':
Total sold: 1321.0
In stock: 45
On order: 1
SKU: GRO-000-533

View File

@ -0,0 +1 @@
<div class="line"><div class="data" data-tag="first-name">Terry</div><div class="text"> </div><div class="data" data-tag="last-name">Jones</div><div class="text"> works in dept #</div><div class="data" data-tag="department">660</div></div><div class="line"><div class="data" data-tag="first-name">Leslie</div><div class="text"> </div><div class="data" data-tag="last-name">Patterson</div><div class="text"> works in dept #</div><div class="data" data-tag="department">341</div></div><div class="line"><div class="data" data-tag="first-name">Ashley</div><div class="text"> </div><div class="data" data-tag="last-name">Smith</div><div class="text"> works in dept #</div><div class="data" data-tag="department">1440</div></div>

View File

@ -0,0 +1,21 @@
<div class="line">
<div class="data" data-tag="first-name" data-xpath="/employees/employee/first-name" data-type="string" data-help="First name of employee">Terry</div>
<div class="text"> </div>
<div class="data" data-tag="last-name" data-xpath="/employees/employee/last-name" data-type="string" data-help="Last name of employee">Jones</div>
<div class="text"> works in dept #</div>
<div class="data" data-tag="department" data-xpath="/employees/employee/department">660</div>
</div>
<div class="line">
<div class="data" data-tag="first-name" data-xpath="/employees/employee/first-name" data-type="string" data-help="First name of employee">Leslie</div>
<div class="text"> </div>
<div class="data" data-tag="last-name" data-xpath="/employees/employee/last-name" data-type="string" data-help="Last name of employee">Patterson</div>
<div class="text"> works in dept #</div>
<div class="data" data-tag="department" data-xpath="/employees/employee/department">341</div>
</div>
<div class="line">
<div class="data" data-tag="first-name" data-xpath="/employees/employee/first-name" data-type="string" data-help="First name of employee">Ashley</div>
<div class="text"> </div>
<div class="data" data-tag="last-name" data-xpath="/employees/employee/last-name" data-type="string" data-help="Last name of employee">Smith</div>
<div class="text"> works in dept #</div>
<div class="data" data-tag="department" data-xpath="/employees/employee/department">1440</div>
</div>

View File

@ -0,0 +1,21 @@
<div class="line">
<div class="data" data-tag="first-name">Terry</div>
<div class="text"> </div>
<div class="data" data-tag="last-name">Jones</div>
<div class="text"> works in dept #</div>
<div class="data" data-tag="department">660</div>
</div>
<div class="line">
<div class="data" data-tag="first-name">Leslie</div>
<div class="text"> </div>
<div class="data" data-tag="last-name">Patterson</div>
<div class="text"> works in dept #</div>
<div class="data" data-tag="department">341</div>
</div>
<div class="line">
<div class="data" data-tag="first-name">Ashley</div>
<div class="text"> </div>
<div class="data" data-tag="last-name">Smith</div>
<div class="text"> works in dept #</div>
<div class="data" data-tag="department">1440</div>
</div>

View File

@ -0,0 +1,2 @@
{"employees": {"employee": [{"first-name":"Terry","last-name":"Jones","department":660}, {"first-name":"Leslie","last-name":"Patterson","department":341}, {"first-name":"Ashley","last-name":"Smith","department":1440}]}
}

View File

@ -0,0 +1,21 @@
{
"employees": {
"employee": [
{
"first-name": "Terry",
"last-name": "Jones",
"department": 660
},
{
"first-name": "Leslie",
"last-name": "Patterson",
"department": 341
},
{
"first-name": "Ashley",
"last-name": "Smith",
"department": 1440
}
]
}
}

View File

@ -0,0 +1,3 @@
Terry Jones works in dept #660
Leslie Patterson works in dept #341
Ashley Smith works in dept #1440

View File

@ -0,0 +1 @@
<employees><employee><first-name>Terry</first-name><last-name>Jones</last-name><department>660</department></employee><employee><first-name>Leslie</first-name><last-name>Patterson</last-name><department>341</department></employee><employee><first-name>Ashley</first-name><last-name>Smith</last-name><department>1440</department></employee></employees>

View File

@ -0,0 +1,17 @@
<employees>
<employee>
<first-name>Terry</first-name>
<last-name>Jones</last-name>
<department>660</department>
</employee>
<employee>
<first-name>Leslie</first-name>
<last-name>Patterson</last-name>
<department>341</department>
</employee>
<employee>
<first-name>Ashley</first-name>
<last-name>Smith</last-name>
<department>1440</department>
</employee>
</employees>

Some files were not shown because too many files have changed in this diff Show More