summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am8
-rw-r--r--include/Makefile.in567
-rw-r--r--include/libHX.h27
-rw-r--r--include/libHX/ctype_helper.h86
-rw-r--r--include/libHX/defs.h230
-rw-r--r--include/libHX/deque.h86
-rw-r--r--include/libHX/init.h15
-rw-r--r--include/libHX/io.h46
-rw-r--r--include/libHX/libxml_helper.h113
-rw-r--r--include/libHX/list.h172
-rw-r--r--include/libHX/map.h140
-rw-r--r--include/libHX/misc.h113
-rw-r--r--include/libHX/option.h260
-rw-r--r--include/libHX/proc.h49
-rw-r--r--include/libHX/string.h116
-rw-r--r--include/libHX/wx_helper.hpp20
16 files changed, 2048 insertions, 0 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..b70eebd
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,8 @@
+# -*- Makefile -*-
+
+nobase_include_HEADERS = libHX.h \
+ libHX/ctype_helper.h libHX/defs.h libHX/deque.h libHX/init.h \
+ libHX/io.h libHX/list.h \
+ libHX/map.h libHX/misc.h libHX/option.h libHX/proc.h libHX/string.h \
+ libHX/libxml_helper.h libHX/wx_helper.hpp
+
diff --git a/include/Makefile.in b/include/Makefile.in
new file mode 100644
index 0000000..b763858
--- /dev/null
+++ b/include/Makefile.in
@@ -0,0 +1,567 @@
+# Makefile.in generated by automake 1.13.4 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = include
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(nobase_include_HEADERS)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gcc4_visibility.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(nobase_include_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LYX = @LYX@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libdl_LIBS = @libdl_LIBS@
+libexecdir = @libexecdir@
+libpthread_LIBS = @libpthread_LIBS@
+librt_LIBS = @librt_LIBS@
+libsocket_LIBS = @libsocket_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+regular_CFLAGS = @regular_CFLAGS@
+regular_CPPFLAGS = @regular_CPPFLAGS@
+regular_CXXFLAGS = @regular_CXXFLAGS@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+nobase_include_HEADERS = libHX.h \
+ libHX/ctype_helper.h libHX/defs.h libHX/deque.h libHX/init.h \
+ libHX/io.h libHX/list.h \
+ libHX/map.h libHX/misc.h libHX/option.h libHX/proc.h libHX/string.h \
+ libHX/libxml_helper.h libHX/wx_helper.hpp
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-nobase_includeHEADERS: $(nobase_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
+ $(am__nobase_list) | while read dir files; do \
+ xfiles=; for file in $$files; do \
+ if test -f "$$file"; then xfiles="$$xfiles $$file"; \
+ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
+ test -z "$$xfiles" || { \
+ test "x$$dir" = x. || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \
+ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \
+ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \
+ done
+
+uninstall-nobase_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-nobase_includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-nobase_includeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool cscopelist-am ctags ctags-am distclean \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man \
+ install-nobase_includeHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-nobase_includeHEADERS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/include/libHX.h b/include/libHX.h
new file mode 100644
index 0000000..a334871
--- /dev/null
+++ b/include/libHX.h
@@ -0,0 +1,27 @@
+#ifndef _LIBHX_H
+#define _LIBHX_H 20110115
+
+/*
+ * This file is for programs that really need about everything. The presence of
+ * this file is undocumented, but you can rely on its presence and that it
+ * always includes a given feature set. (Once an "#include" is added, it shall
+ * be considered documented behavior that feature xyz is available merely by
+ * inclusion of this file. Henceforth, "#includes" may not be removed from here
+ * unless the implementation really went away.
+ */
+
+#include <libHX/ctype_helper.h>
+#include <libHX/defs.h>
+#include <libHX/deque.h>
+#include <libHX/list.h>
+#include <libHX/init.h>
+#include <libHX/io.h>
+#include <libHX/map.h>
+#include <libHX/misc.h>
+#include <libHX/option.h>
+#include <libHX/proc.h>
+#include <libHX/string.h>
+
+/* not libxml_helper, because that requires libxml2 */
+
+#endif /* _LIBHX_H */
diff --git a/include/libHX/ctype_helper.h b/include/libHX/ctype_helper.h
new file mode 100644
index 0000000..2ba0a7a
--- /dev/null
+++ b/include/libHX/ctype_helper.h
@@ -0,0 +1,86 @@
+#ifndef _LIBHX_CTYPE_H
+#define _LIBHX_CTYPE_H 1
+
+#ifdef __cplusplus
+# include <cctype>
+#else
+# include <ctype.h>
+# include <stdbool.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * ctype.h workarounds. The is*() functions takes an int, but people
+ * commonly pass in a char. Because char can technically be signed, the
+ * value would be sign-extended during promotion to the int type which the
+ * ctype family functions take.
+ *
+ * The HX_ ctype related functions therefore explicitly take an unsigned char,
+ * and thus knowingly make it impossible to pass in stdio's "EOF" (-1).
+ * [When was the last time you did a isalpha(EOF) anyway?]
+ *
+ * Because, again, this all works due to implicit type conversion, these
+ * wrappers look rather plain. Oh, also note we are returning the much
+ * more modern "bool".
+ *
+ * And not all ctype functions are provided - no need so far, and I do not
+ * want to clutter it before needing it.
+ */
+static __inline__ bool HX_isalnum(unsigned char c)
+{
+ return isalnum(c);
+}
+
+static __inline__ bool HX_isalpha(unsigned char c)
+{
+ return isalpha(c);
+}
+
+static __inline__ bool HX_isdigit(unsigned char c)
+{
+ return isdigit(c);
+}
+
+static __inline__ bool HX_islower(unsigned char c)
+{
+ return islower(c);
+}
+
+static __inline__ bool HX_isprint(unsigned char c)
+{
+ return isprint(c);
+}
+
+static __inline__ bool HX_isspace(unsigned char c)
+{
+ return isspace(c);
+}
+
+static __inline__ bool HX_isupper(unsigned char c)
+{
+ return isupper(c);
+}
+
+static __inline__ bool HX_isxdigit(unsigned char c)
+{
+ return isxdigit(c);
+}
+
+static __inline__ unsigned char HX_tolower(unsigned char c)
+{
+ return tolower(c);
+}
+
+static __inline__ unsigned char HX_toupper(unsigned char c)
+{
+ return toupper(c);
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _LIBHX_CTYPE_H */
diff --git a/include/libHX/defs.h b/include/libHX/defs.h
new file mode 100644
index 0000000..bb03f40
--- /dev/null
+++ b/include/libHX/defs.h
@@ -0,0 +1,230 @@
+#ifndef _LIBHX_DEFS_H
+#define _LIBHX_DEFS_H 1
+
+#ifdef __cplusplus
+# define FIELD_SIZEOF(type, member) \
+ sizeof(static_cast<type *>(NULL)->member)
+# define HXsizeof_member(type, member) FIELD_SIZEOF(type, member)
+# define HXtypeof_member(type, member) \
+ __typeof__(static_cast<type *>(NULL)->member)
+# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(offsetof)
+ /*
+ * This is here so most programs can skip inclusion
+ * of stddef.h just to get offsetof.
+ */
+# define offsetof(type, member) __builtin_offsetof(type, member)
+# endif
+# ifndef offsetof
+# define offsetof(type, member) \
+ reinterpret_cast<long>(&(static_cast<type *>(NULL)->member))
+# endif
+# ifndef containerof
+# define containerof(var, type, member) reinterpret_cast<type *>( \
+ reinterpret_cast<char *>(var) - offsetof(type, member))
+# endif
+
+template<typename new_type>
+static __inline__ new_type signed_cast(const char *expr)
+{
+ return reinterpret_cast<new_type>(expr);
+}
+
+template<typename new_type>
+static __inline__ new_type signed_cast(const signed char *expr)
+{
+ return reinterpret_cast<new_type>(expr);
+}
+
+template<typename new_type>
+static __inline__ new_type signed_cast(const unsigned char *expr)
+{
+ return reinterpret_cast<new_type>(expr);
+}
+
+template<typename new_type>
+static __inline__ new_type signed_cast(char *expr)
+{
+ return reinterpret_cast<new_type>(expr);
+}
+
+template<typename new_type>
+static __inline__ new_type signed_cast(signed char *expr)
+{
+ return reinterpret_cast<new_type>(expr);
+}
+
+template<typename new_type>
+static __inline__ new_type signed_cast(unsigned char *expr)
+{
+ return reinterpret_cast<new_type>(expr);
+}
+#else
+# define HXsizeof_member(type, member) sizeof(((type *)NULL)->member)
+# define HXtypeof_member(type, member) __typeof__(((type *)NULL)->member)
+ /* N.B. signed_cast<> does not exist in C++. */
+# define __signed_cast_compatible(a, b) \
+ __builtin_choose_expr( \
+ __builtin_types_compatible_p(b, const char *) || \
+ __builtin_types_compatible_p(b, const signed char *) || \
+ __builtin_types_compatible_p(b, const unsigned char *), \
+ /* if src has a const qualifier */ \
+ __builtin_types_compatible_p(a, const char *) || \
+ __builtin_types_compatible_p(a, const signed char *) || \
+ __builtin_types_compatible_p(a, const unsigned char *), \
+ /* and if it has none... */ \
+ __builtin_types_compatible_p(a, const char *) || \
+ __builtin_types_compatible_p(a, const signed char *) || \
+ __builtin_types_compatible_p(a, const unsigned char *) || \
+ __builtin_types_compatible_p(a, char *) || \
+ __builtin_types_compatible_p(a, signed char *) || \
+ __builtin_types_compatible_p(a, unsigned char *) \
+ )
+
+# if defined(__GNUC__) && !defined(__clang__) && !defined(signed_cast)
+# define signed_cast(type, expr) ({ \
+ BUILD_BUG_ON(!__signed_cast_compatible(__typeof__(type), __typeof__(expr))); \
+ (type)(expr); \
+ })
+# endif
+# if defined(__GNUC__) && !defined(__clang__) && !defined(static_cast)
+# define static_cast(type, expr) \
+ ((struct { type x; }){(expr)}.x)
+# endif
+# if defined(__GNUC__) && !defined(__clang__) && !defined(const_cast1)
+# define __const_cast_strip1(expr) \
+ __typeof__(*(union { int z; __typeof__(expr) x; }){0}.x)
+# define __const_cast_strip2(expr) \
+ __typeof__(**(union { int z; __typeof__(expr) x; }){0}.x)
+# define __const_cast_strip3(expr) \
+ __typeof__(***(union { int z; __typeof__(expr) x; }){0}.x)
+# define const_cast1(new_type, expr) ({ \
+ BUILD_BUG_ON(!__builtin_types_compatible_p(__const_cast_strip1(expr), __const_cast_strip1(new_type))); \
+ (new_type)(expr); \
+ })
+# define const_cast2(new_type, expr) ({ \
+ BUILD_BUG_ON(!__builtin_types_compatible_p(__const_cast_strip2(expr), __const_cast_strip2(new_type))); \
+ (new_type)(expr); \
+ })
+# define const_cast3(new_type, expr) ({ \
+ BUILD_BUG_ON(!__builtin_types_compatible_p(__const_cast_strip3(expr), __const_cast_strip3(new_type))); \
+ (new_type)(expr); \
+ })
+# endif
+# ifndef signed_cast
+# define signed_cast(type, expr) ((type)(expr))
+# endif
+# ifndef static_cast
+# define static_cast(type, expr) ((type)(expr))
+# endif
+# ifndef const_cast
+# define const_cast(type, expr) ((type)(expr))
+# endif
+# ifndef const_cast1
+# define const_cast1(type, expr) ((type)(expr))
+# define const_cast2(type, expr) ((type)(expr))
+# define const_cast3(type, expr) ((type)(expr))
+# endif
+# ifndef reinterpret_cast
+# define reinterpret_cast(type, expr) ((type)(expr))
+# endif
+# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(offsetof)
+# define offsetof(type, member) __builtin_offsetof(type, member)
+# endif
+# ifndef offsetof
+# define offsetof(type, member) \
+ reinterpret_cast(long, &(static_cast(type *, NULL)->member))
+# endif
+# ifndef containerof
+# define containerof(var, type, member) reinterpret_cast(type *, \
+ reinterpret_cast(char *, var) - offsetof(type, member))
+# endif
+#endif
+
+#if defined(__GNUC__) && !defined(__cplusplus)
+ /*
+ * If typeof @a stays the same through a demotion to pointer,
+ * @a cannot be an array.
+ */
+# define __array_size_check(a) BUILD_BUG_ON_EXPR(\
+ __builtin_types_compatible_p(__typeof__(a), \
+ __typeof__(DEMOTE_TO_PTR(a))))
+#else
+# define __array_size_check(a) 0
+#endif
+#ifndef ARRAY_SIZE
+# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)) + __array_size_check(x))
+#endif
+#ifndef BUILD_BUG_ON_EXPR
+# define BUILD_BUG_ON_EXPR(condition) (sizeof(char[1 - 2 * !!(condition)]) - 1)
+#endif
+#ifndef BUILD_BUG_ON
+# define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_EXPR(condition))
+#endif
+#ifndef DEMOTE_TO_PTR
+ /*
+ * An alternative approach is also (p+0), but that does not ensure that
+ * @p is a pointer. Since functions "support" infinite dereferencing,
+ * "&*" also works on them.
+ */
+# define DEMOTE_TO_PTR(p) (&*(p))
+#endif
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+#ifndef S_IRGRP
+ /* Can happen in mingw */
+# define S_IRGRP (S_IRUSR >> 3)
+#endif
+#ifndef S_IWGRP
+# define S_IWGRP (S_IWUSR >> 3)
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP (S_IXUSR >> 3)
+#endif
+#ifndef S_IROTH
+# define S_IROTH (S_IRUSR >> 6)
+#endif
+#ifndef S_IWOTH
+# define S_IWOTH (S_IWUSR >> 6)
+#endif
+#ifndef S_IXOTH
+# define S_IXOTH (S_IXUSR >> 6)
+#endif
+#ifndef S_IRUGO
+# define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH)
+#endif
+#ifndef S_IWUGO
+# define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH)
+#endif
+#ifndef S_IXUGO
+# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
+#endif
+#ifndef S_IRWXUGO
+# define S_IRWXUGO (S_IRUGO | S_IWUGO | S_IXUGO)
+#endif
+
+#define HXSIZEOF_Z16 sizeof("-65536")
+/* 2^32 and -2^31 have differing length */
+#define HXSIZEOF_Z32 sizeof("-4294967296")
+/* 2^64 and -2^63 have same length */
+#define HXSIZEOF_Z64 sizeof("18446744073709551616")
+
+#define __HX_STRINGIFY_EXPAND(s) #s
+#define HX_STRINGIFY(s) __HX_STRINGIFY_EXPAND(s)
+
+#ifndef container_of
+# define container_of(v, s, m) containerof((v), s, m)
+#endif
+
+#ifdef _WIN32
+ /*
+ * Sufficiently old versions of the VC runtime do not even support %ll.
+ */
+# define HX_LONGLONG_FMT "I64"
+# define HX_SIZET_FMT "I"
+#else
+# define HX_LONGLONG_FMT "ll"
+# define HX_SIZET_FMT "z"
+#endif
+
+#endif /* _LIBHX_DEFS_H */
diff --git a/include/libHX/deque.h b/include/libHX/deque.h
new file mode 100644
index 0000000..f43def9
--- /dev/null
+++ b/include/libHX/deque.h
@@ -0,0 +1,86 @@
+#ifndef _LIBHX_DEQUE_H
+#define _LIBHX_DEQUE_H 1
+
+#ifdef __cplusplus
+# include <cstdlib>
+#else
+# include <stdlib.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct HXdeque_node {
+ struct HXdeque_node *next;
+ union {
+ void *ptr;
+ char *sptr;
+ };
+ struct HXdeque *parent;
+ struct HXdeque_node *prev;
+};
+
+struct HXdeque {
+ struct HXdeque_node *first;
+ void *ptr;
+ struct HXdeque_node *last;
+ unsigned int items;
+};
+
+extern struct HXdeque *HXdeque_init(void);
+extern struct HXdeque_node *HXdeque_push(struct HXdeque *, const void *);
+extern struct HXdeque_node *HXdeque_unshift(struct HXdeque *, const void *);
+extern void *HXdeque_pop(struct HXdeque *);
+extern void *HXdeque_shift(struct HXdeque *);
+extern void HXdeque_move(struct HXdeque_node *, struct HXdeque_node *);
+extern struct HXdeque_node *HXdeque_find(struct HXdeque *, const void *);
+extern void *HXdeque_get(struct HXdeque *, const void *);
+extern void *HXdeque_del(struct HXdeque_node *);
+extern void HXdeque_free(struct HXdeque *);
+extern void HXdeque_genocide2(struct HXdeque *, void (*)(void *));
+extern void **HXdeque_to_vec(const struct HXdeque *, unsigned int *);
+
+static __inline__ void HXdeque_genocide(struct HXdeque *dq)
+{
+ HXdeque_genocide2(dq, free);
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+
+extern "C++" {
+
+template<typename type> static __inline__ type HXdeque_pop(struct HXdeque *dq)
+{
+ return reinterpret_cast<type>(HXdeque_pop(dq));
+}
+
+template<typename type> static __inline__ type
+HXdeque_shift(struct HXdeque *dq)
+{
+ return reinterpret_cast<type>(HXdeque_shift(dq));
+}
+
+template<typename type> static __inline__ type
+HXdeque_get(struct HXdeque *dq, const void *ptr)
+{
+ return reinterpret_cast<type>(HXdeque_get(dq, ptr));
+}
+
+template<typename type> static __inline__ type
+HXdeque_del(struct HXdeque_node *nd)
+{
+ return reinterpret_cast<type>(HXdeque_del(nd));
+}
+
+template<typename type> static __inline__ type *
+HXdeque_to_vec(struct HXdeque *dq, unsigned int *n)
+{
+ return reinterpret_cast<type *>(HXdeque_to_vec(dq, n));
+}
+
+} /* extern "C++" */
+#endif
+
+#endif /* _LIBHX_DEQUE_H */
diff --git a/include/libHX/init.h b/include/libHX/init.h
new file mode 100644
index 0000000..c584209
--- /dev/null
+++ b/include/libHX/init.h
@@ -0,0 +1,15 @@
+#ifndef _LIBHX_INIT_H
+#define _LIBHX_INIT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int HX_init(void);
+extern void HX_exit(void);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _LIBHX_INIT_H */
diff --git a/include/libHX/io.h b/include/libHX/io.h
new file mode 100644
index 0000000..c86af72
--- /dev/null
+++ b/include/libHX/io.h
@@ -0,0 +1,46 @@
+#ifndef _LIBHX_IO_H
+#define _LIBHX_IO_H 1
+
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __libhx_internal_hxmc_t_defined
+#define __libhx_internal_hxmc_t_defined 1
+typedef char hxmc_t;
+#endif
+
+enum {
+ HXF_UID = 1 << 0,
+ HXF_GID = 1 << 1,
+ HXF_KEEP = 1 << 2,
+ HX_REALPATH_NOFLAGS = 0,
+ HX_REALPATH_ABSOLUTE = 1 << 0,
+ HX_REALPATH_SELF = 1 << 1,
+ HX_REALPATH_PARENT = 1 << 2,
+ /* HX_REALPATH_SYMLINK = 1 << 3, removed in v3.13, thus blocked */
+ HX_REALPATH_DEFAULT = HX_REALPATH_SELF | HX_REALPATH_PARENT,
+};
+
+struct HXdir;
+
+extern struct HXdir *HXdir_open(const char *);
+extern const char *HXdir_read(struct HXdir *);
+extern void HXdir_close(struct HXdir *);
+extern int HX_copy_dir(const char *, const char *, unsigned int, ...);
+extern int HX_copy_file(const char *, const char *, unsigned int, ...);
+extern int HX_mkdir(const char *, unsigned int);
+extern int HX_readlink(hxmc_t **, const char *);
+extern int HX_realpath(hxmc_t **, const char *, unsigned int);
+extern int HX_rrmdir(const char *);
+
+extern ssize_t HXio_fullread(int, void *, size_t);
+extern ssize_t HXio_fullwrite(int, const void *, size_t);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _LIBHX_IO_H */
diff --git a/include/libHX/libxml_helper.h b/include/libHX/libxml_helper.h
new file mode 100644
index 0000000..599ede1
--- /dev/null
+++ b/include/libHX/libxml_helper.h
@@ -0,0 +1,113 @@
+#ifndef _LIBHX_LIBXML_HELPER_H
+#define _LIBHX_LIBXML_HELPER_H 1
+
+#ifdef __cplusplus
+# include <cstring>
+#else
+# include <string.h>
+#endif
+#include <libHX/defs.h>
+#include <libxml/parser.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static __inline__ int xml_strcmp(const xmlChar *a, const char *b)
+{
+#ifdef __cplusplus
+ return strcmp(signed_cast<const char *>(a), b);
+#else
+ return strcmp(signed_cast(const char *, a), b);
+#endif
+}
+
+static __inline__ int xml_strcasecmp(const xmlChar *a, const char *b)
+{
+#ifdef __cplusplus
+ return strcasecmp(signed_cast<const char *>(a), b);
+#else
+ return strcasecmp(signed_cast(const char *, a), b);
+#endif
+}
+
+static __inline__ char *xml_getprop(xmlNode *node, const char *attr)
+{
+#ifdef __cplusplus
+ return signed_cast<char *>(xmlGetProp(node,
+ signed_cast<const xmlChar *>(attr)));
+#else
+ return signed_cast(char *, xmlGetProp(node,
+ signed_cast(const xmlChar *, attr)));
+#endif
+}
+
+/**
+ * xmlGetNsProp takes, as 3rd argument, a full namespace string.
+ * That is unwieldy.
+ */
+static __inline__ char *xml_getnsprop(xmlNode *node, const char *nsprefix,
+ const char *key)
+{
+ const struct _xmlAttr *attr = NULL;
+ for (attr = node->properties; attr != NULL; attr = attr->next)
+ if (attr->ns != NULL && attr->ns->prefix != NULL &&
+ xml_strcmp(attr->ns->prefix, nsprefix) == 0)
+ break;
+ if (attr == NULL)
+ return NULL;
+#ifdef __cplusplus
+ return signed_cast<char *>(xmlGetNsProp(node,
+ signed_cast<const xmlChar *>(key), attr->ns->href));
+#else
+ return signed_cast(char *, xmlGetNsProp(node,
+ signed_cast(const xmlChar *, key), attr->ns->href));
+#endif
+}
+
+static __inline__ xmlAttr *
+xml_newprop(xmlNode *node, const char *name, const char *value)
+{
+#ifdef __cplusplus
+ return xmlNewProp(node, signed_cast<const xmlChar *>(name),
+ signed_cast<const xmlChar *>(value));
+#else
+ return xmlNewProp(node, signed_cast(const xmlChar *, name),
+ signed_cast(const xmlChar *, value));
+#endif
+}
+
+/**
+ * @ptr: parent node
+ * @name: name of new node
+ * @value: string, or %NULL
+ */
+static __inline__ xmlNode *
+xml_newnode(xmlNode *ptr, const char *name, const char *value)
+{
+#ifdef __cplusplus
+ return xmlNewTextChild(ptr, NULL, signed_cast<const xmlChar *>(name),
+ signed_cast<const xmlChar *>(value));
+#else
+ return xmlNewTextChild(ptr, NULL, signed_cast(const xmlChar *, name),
+ signed_cast(const xmlChar *, value));
+#endif
+}
+
+static __inline__ xmlAttr *
+xml_setprop(xmlNode *node, const char *name, const char *value)
+{
+#ifdef __cplusplus
+ return xmlSetProp(node, signed_cast<const xmlChar *>(name),
+ signed_cast<const xmlChar *>(value));
+#else
+ return xmlSetProp(node, signed_cast(const xmlChar *, name),
+ signed_cast(const xmlChar *, value));
+#endif
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _LIBHX_LIBXML_HELPER_H */
diff --git a/include/libHX/list.h b/include/libHX/list.h
new file mode 100644
index 0000000..a18b17e
--- /dev/null
+++ b/include/libHX/list.h
@@ -0,0 +1,172 @@
+#ifndef _LIBHX_LIST_H
+#define _LIBHX_LIST_H 1
+
+#ifdef __cplusplus
+# include <cstddef>
+#else
+# include <stdbool.h>
+# include <stddef.h>
+#endif
+#include <libHX/defs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define HXlist_entry(ptr, type, member) containerof((ptr), type, member)
+
+struct HXlist_head {
+ struct HXlist_head *next, *prev;
+};
+
+#define HXLIST_HEAD_INIT(name) {&(name), &(name)}
+#define HXLIST_HEAD(name) \
+ struct HXlist_head name = HXLIST_HEAD_INIT(name)
+
+static __inline__ void HXlist_init(struct HXlist_head *list)
+{
+ list->next = list->prev = list;
+}
+
+static __inline__ void __HXlist_add(struct HXlist_head *nu,
+ struct HXlist_head *prev, struct HXlist_head *next)
+{
+ nu->next = next;
+ nu->prev = prev;
+ next->prev = nu;
+ prev->next = nu;
+}
+
+static __inline__ void
+HXlist_add(struct HXlist_head *head, struct HXlist_head *entry)
+{
+ __HXlist_add(entry, head, head->next);
+}
+
+static __inline__ void
+HXlist_add_tail(struct HXlist_head *head, struct HXlist_head *entry)
+{
+ __HXlist_add(entry, head->prev, head);
+}
+
+static __inline__ void HXlist_del(struct HXlist_head *entry)
+{
+ entry->prev->next = entry->next;
+ entry->next->prev = entry->prev;
+ entry->next = NULL;
+ entry->prev = NULL;
+}
+
+static __inline__ bool HXlist_empty(const struct HXlist_head *head)
+{
+ return head->next == head;
+}
+
+#define HXlist_for_each(pos, head) \
+ for ((pos) = (head)->next; (pos) != (void *)(head); \
+ (pos) = (pos)->next)
+
+#define HXlist_for_each_rev(pos, head) \
+ for ((pos) = (head)->prev; (pos) != (void *)(head); \
+ (pos) = (pos)->prev)
+
+#define HXlist_for_each_safe(pos, n, head) \
+ for ((pos) = (head)->next, (n) = (pos)->next; (pos) != (void *)(head); \
+ (pos) = (n), (n) = (pos)->next)
+
+#define HXlist_for_each_rev_safe(pos, n, head) \
+ for ((pos) = (head)->prev, (n) = (pos)->prev; (pos) != (void *)(head); \
+ (pos) = (n), (n) = (pos)->prev)
+
+#define HXlist_for_each_entry(pos, head, member) \
+ for ((pos) = HXlist_entry((head)->next, __typeof__(*(pos)), member); \
+ &(pos)->member != (void *)(head); \
+ (pos) = HXlist_entry((pos)->member.next, __typeof__(*(pos)), member))
+
+#define HXlist_for_each_entry_rev(pos, head, member) \
+ for ((pos) = HXlist_entry((head)->prev, __typeof__(*(pos)), member); \
+ &(pos)->member != (void *)(head); \
+ (pos) = HXlist_entry((pos)->member.prev, __typeof__(*(pos)), member))
+
+#define HXlist_for_each_entry_safe(pos, n, head, member) \
+ for ((pos) = HXlist_entry((head)->next, __typeof__(*(pos)), member), \
+ (n) = HXlist_entry((pos)->member.next, __typeof__(*(pos)), member); \
+ &(pos)->member != (void *)(head); \
+ (pos) = (n), (n) = HXlist_entry((n)->member.next, __typeof__(*(n)), \
+ member))
+
+struct HXclist_head {
+ union {
+ struct HXlist_head list;
+ struct {
+ struct HXlist_head *next, *prev;
+ };
+ };
+ unsigned int items;
+};
+
+#define HXCLIST_HEAD_INIT(name) {{{&(name).list, &(name).list}}, 0}
+#define HXCLIST_HEAD(name) \
+ struct HXclist_head name = HXCLIST_HEAD_INIT(name)
+
+static __inline__ void HXclist_init(struct HXclist_head *head)
+{
+ head->list.next = head->list.prev = &head->list;
+ head->items = 0;
+}
+
+static __inline__ void
+HXclist_del(struct HXclist_head *head, struct HXlist_head *node)
+{
+ --head->items;
+ HXlist_del(node);
+}
+
+static __inline__ void
+HXclist_unshift(struct HXclist_head *head, struct HXlist_head *nu)
+{
+ ++head->items;
+ __HXlist_add(nu, &head->list, head->list.next);
+}
+
+static __inline__ void
+HXclist_push(struct HXclist_head *head, struct HXlist_head *nu)
+{
+ ++head->items;
+ __HXlist_add(nu, head->list.prev, &head->list);
+}
+
+static __inline__ struct HXlist_head *__HXclist_pop(struct HXclist_head *head)
+{
+ struct HXlist_head *p;
+ if ((const void *)head == head->list.next)
+ return NULL;
+ p = head->list.prev;
+ HXlist_del(p);
+ --head->items;
+ return p;
+}
+
+#define HXclist_pop(head, type, member) \
+ HXlist_entry(__HXclist_pop(head), type, member)
+
+static __inline__ struct HXlist_head *
+__HXclist_shift(struct HXclist_head *head)
+{
+ struct HXlist_head *p;
+ if ((const void *)head == head->list.next)
+ return NULL;
+ p = head->list.next;
+ HXlist_del(p);
+ --head->items;
+ return p;
+}
+
+#define HXclist_shift(head, type, member) \
+ HXlist_entry(__HXclist_shift(head), type, member)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _LIBHX_LIST_H */
diff --git a/include/libHX/map.h b/include/libHX/map.h
new file mode 100644
index 0000000..ecbf703
--- /dev/null
+++ b/include/libHX/map.h
@@ -0,0 +1,140 @@
+#ifndef _LIBHX_MAP_H
+#define _LIBHX_MAP_H 1
+
+#ifdef __cplusplus
+# include <cstddef>
+#else
+# include <stdbool.h>
+# include <stddef.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Abstract:
+ * %HXMAPT_DEFAULT: whatever is fast and maps k-v, without preference
+ * %HXMAPT_ORDERED: anything ordered, no further preference
+ *
+ * Specific:
+ * %HXMAPT_HASH: map based on hash
+ * %HXMAPT_RBTREE: map based on red-black binary tree
+ */
+enum HXmap_type {
+ HXMAPT_HASH = 1,
+ HXMAPT_RBTREE,
+
+ /* aliases - assignments may change */
+ HXMAPT_DEFAULT = HXMAPT_HASH,
+ HXMAPT_ORDERED = HXMAPT_RBTREE,
+};
+
+/**
+ * Flags changable at runtime:
+ * %HXMAP_NOREPLACE: Calling HXmap_add() for an already existing key will
+ * throw an error (no-overwrite semantics)
+ *
+ * Initialization-time flags only:
+ * %HXMAP_NONE: mnemonic for no flags
+ * %HXMAP_SINGULAR: Instead of an associative map, provide a set
+ * %HXMAP_SKEY: Key will be a C-style string (sets ops->k_*)
+ * %HXMAP_CKEY: Make a copy of the key on HXmap_add
+ * %HXMAP_SDATA: Data will be a C-style string (presets ops->d_*)
+ * %HXMAP_CDATA: Make a copy of the data on HXmap_add
+ */
+enum {
+ HXMAP_NONE = 0,
+ HXMAP_NOREPLACE = 1 << 0,
+ HXMAP_SINGULAR = 1 << 1,
+ HXMAP_SKEY = 1 << 2,
+ HXMAP_CKEY = 1 << 3,
+ HXMAP_SDATA = 1 << 4,
+ HXMAP_CDATA = 1 << 5,
+
+ HXMAP_SCKEY = HXMAP_SKEY | HXMAP_CKEY,
+ HXMAP_SCDATA = HXMAP_SDATA | HXMAP_CDATA,
+};
+
+/**
+ * Flags for the traverser
+ * %HXMAP_NOFLAGS: Mnemonic for no flags
+ * %HXMAP_DTRAV: Support deletion of elements while traversing
+ */
+enum {
+ HXMAP_NOFLAGS = 0,
+ HXMAP_DTRAV = 1 << 0,
+};
+
+struct HXmap_trav;
+
+/**
+ * @items: number of items in the map
+ * @flags: flags for this map
+ */
+struct HXmap {
+ unsigned int items, flags;
+};
+
+struct HXmap_ops {
+ /* k_compare: the size argument is needed for memcmp. */
+ int (*k_compare)(const void *, const void *, size_t);
+ void *(*k_clone)(const void *, size_t);
+ void (*k_free)(void *);
+ void *(*d_clone)(const void *, size_t);
+ void (*d_free)(void *);
+ unsigned long (*k_hash)(const void *, size_t);
+};
+
+struct HXmap_node {
+ union {
+ void *key;
+ const char *const skey;
+ };
+ union {
+ void *data;
+ char *sdata;
+ };
+};
+
+extern struct HXmap *HXmap_init(enum HXmap_type, unsigned int);
+extern struct HXmap *HXmap_init5(enum HXmap_type, unsigned int,
+ const struct HXmap_ops *, size_t, size_t);
+
+extern int HXmap_add(struct HXmap *, const void *, const void *);
+extern const struct HXmap_node *HXmap_find(const struct HXmap *, const void *);
+extern void *HXmap_get(const struct HXmap *, const void *);
+extern void *HXmap_del(struct HXmap *, const void *);
+extern struct HXmap_node *HXmap_keysvalues(const struct HXmap *);
+extern struct HXmap_trav *HXmap_travinit(const struct HXmap *, unsigned int);
+extern const struct HXmap_node *HXmap_traverse(struct HXmap_trav *);
+extern void HXmap_travfree(struct HXmap_trav *);
+extern void HXmap_qfe(const struct HXmap *,
+ bool (*)(const struct HXmap_node *, void *), void *);
+extern void HXmap_free(struct HXmap *);
+
+extern unsigned long HXhash_jlookup3(const void *, size_t);
+extern unsigned long HXhash_jlookup3s(const void *, size_t);
+extern unsigned long HXhash_djb2(const void *, size_t);
+
+#ifdef __cplusplus
+} /* extern "C" */
+
+extern "C++" {
+
+template<typename type> static __inline__ type
+HXmap_get(const struct HXmap *map, const void *key)
+{
+ return reinterpret_cast<type>(HXmap_get(map, key));
+}
+
+template<typename type> static __inline__ type
+HXmap_del(struct HXmap *map, const void *key)
+{
+ return reinterpret_cast<type>(HXmap_del(map, key));
+}
+
+}
+#endif
+
+#endif /* _LIBHX_MAP_H */
diff --git a/include/libHX/misc.h b/include/libHX/misc.h
new file mode 100644
index 0000000..3f68917
--- /dev/null
+++ b/include/libHX/misc.h
@@ -0,0 +1,113 @@
+#ifndef _LIBHX_MISC_H
+#define _LIBHX_MISC_H 1
+
+#ifndef __cplusplus
+# include <limits.h>
+# include <stdarg.h>
+# include <stdbool.h>
+# include <stdio.h>
+#else
+# include <climits>
+# include <cstdarg>
+# include <cstdio>
+#endif
+#include <libHX/defs.h>
+#include <libHX/io.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * BITMAP.H
+ */
+#define __HXbitmap_bpq(type) \
+ (sizeof(type) * CHAR_BIT)
+#define HXbitmap_size(type, bits) \
+ (((bits) + __HXbitmap_bpq(type) - 1) / __HXbitmap_bpq(type))
+#define __HXbitmap_quant(map, bit) \
+ ((map)[(bit) / __HXbitmap_bpq(*(map))])
+#define HXbitmap_set(map, bit) \
+ ((void)(__HXbitmap_quant((map), (bit)) |= (1ULL << ((bit) % __HXbitmap_bpq(*(map))))))
+#define HXbitmap_clear(map, bit) \
+ ((void)(__HXbitmap_quant((map), (bit)) &= ~(1ULL << ((bit) % __HXbitmap_bpq(*(map))))))
+#define HXbitmap_test(map, bit) \
+ ((bool)(__HXbitmap_quant((map), (bit)) & (1ULL << ((bit) % __HXbitmap_bpq(*(map))))))
+
+#define HX_TIMESPEC_FMT "%ld.%09ld"
+#define HX_TIMEVAL_FMT "%ld.%06ld"
+#ifdef __cplusplus
+# define HX_TIMESPEC_EXP(p) static_cast<long>((p)->tv_sec), (p)->tv_nsec
+# define HX_TIMEVAL_EXP(p) static_cast<long>((p)->tv_sec), (p)->tv_usec
+#else
+# define HX_TIMESPEC_EXP(p) static_cast(long, (p)->tv_sec), (p)->tv_nsec
+# define HX_TIMEVAL_EXP(p) static_cast(long, (p)->tv_sec), (p)->tv_usec
+#endif
+
+struct stat;
+struct timespec;
+struct timeval;
+
+/*
+ * DL.C
+ */
+extern void *HX_dlopen(const char *);
+extern void *HX_dlsym(void *, const char *);
+extern void HX_dlclose(void *);
+extern const char *HX_dlerror(void);
+
+/*
+ * MISC.C
+ */
+extern int HX_ffs(unsigned long);
+extern int HX_fls(unsigned long);
+extern void HX_hexdump(FILE *, const void *, unsigned int);
+extern bool HX_timespec_isneg(const struct timespec *);
+extern struct timespec *HX_timespec_neg(struct timespec *,
+ const struct timespec *);
+extern struct timespec *HX_timespec_add(struct timespec *,
+ const struct timespec *, const struct timespec *);
+extern struct timespec *HX_timespec_sub(struct timespec *,
+ const struct timespec *, const struct timespec *);
+extern struct timespec *HX_timespec_mul(struct timespec *,
+ const struct timespec *, int);
+extern struct timespec *HX_timespec_mulf(struct timespec *,
+ const struct timespec *, double);
+extern struct timeval *HX_timeval_sub(struct timeval *,
+ const struct timeval *, const struct timeval *);
+extern long HX_time_compare(const struct stat *, const struct stat *, char);
+extern void HX_zvecfree(char **);
+
+/*
+ * RAND.C
+ */
+extern int HX_rand(void);
+extern unsigned int HX_irand(unsigned int, unsigned int);
+extern double HX_drand(double, double);
+
+/*
+ * INLINE FUNCTIONS
+ */
+static __inline__ unsigned int HX_zveclen(const char *const *args)
+{
+ unsigned int argk = 0;
+ while (*args++ != NULL)
+ ++argk;
+ return argk;
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+
+extern "C++" {
+
+template<typename type> static __inline__ type
+HX_dlsym(void *handle, const char *symbol)
+{
+ return reinterpret_cast<type>(HX_dlsym(handle, symbol));
+}
+
+} /* extern "C++" */
+#endif
+
+#endif /* _LIBHX_MISC_H */
diff --git a/include/libHX/option.h b/include/libHX/option.h
new file mode 100644
index 0000000..3b8187f
--- /dev/null
+++ b/include/libHX/option.h
@@ -0,0 +1,260 @@
+#ifndef _LIBHX_OPTION_H
+#define _LIBHX_OPTION_H 1
+
+#ifdef __cplusplus
+# include <cstddef>
+# include <cstdio>
+#else
+# include <stddef.h>
+# include <stdio.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __libhx_internal_hxmc_t_defined
+#define __libhx_internal_hxmc_t_defined 1
+typedef char hxmc_t;
+#endif
+
+struct HXoption;
+
+/*
+ * FORMAT.C
+ */
+extern struct HXformat_map *HXformat_init(void);
+extern void HXformat_free(struct HXformat_map *);
+extern int HXformat_add(struct HXformat_map *, const char *, const void *,
+ unsigned int);
+extern int HXformat_aprintf(const struct HXformat_map *,
+ hxmc_t **, const char *);
+extern int HXformat_sprintf(const struct HXformat_map *,
+ char *, size_t, const char *);
+extern int HXformat_fprintf(const struct HXformat_map *,
+ FILE *, const char *);
+
+/*
+ * OPT.C
+ */
+
+/**
+ * Available types for struct HXoption.type.
+ * %HXTYPE_NONE: [-o] (int *) No argument; counts presence.
+ * %HXTYPE_VAL: [-o] (int *) Set to value in .val.
+ * %HXTYPE_SVAL: [-o] (const char *) Set to value in .uptr.
+ * %HXTYPE_BOOL: [fo] (int *) Parse argument as boolean
+ * ("yes", "no", "true", "false", 0 or non-zero)
+ * %HXTYPE_BYTE: [fo] (unsigned char *) Take first char of argument
+ * %HXTYPE_UCHAR: [fo] (unsigned char *) An integer.
+ * %HXTYPE_CHAR: [fo] (char *) An integer.
+ * %HXTYPE_USHORT: [fo] (unsigned short *) An integer.
+ * %HXTYPE_SHORT: [fo] (short *) An integer.
+ * %HXTYPE_UINT: [fo] (unsigned int *) An integer.
+ * %HXTYPE_INT: [fo] (int *) An integer.
+ * %HXTYPE_ULONG: [fo] (unsigned long *) An integer.
+ * %HXTYPE_LONG: [fo] (long *) An integer.
+ * %HXTYPE_ULLONG: [fo] (unsigned long long *) An integer.
+ * %HXTYPE_LLONG: [fo] (long long *) An integer.
+ * %HXTYPE_FLOAT: [fo] (float *) Read a floating point number
+ * %HXTYPE_DOUBLE: [fo] (double *) Read a floating point number
+ * %HXTYPE_STRING: [fo] (char **) Any string.
+ * %HXTYPE_STRP: [f-] (const char *const *) A string.
+ * %HXTYPE_STRDQ: [-o] (struct HXdeque *) A string.
+ * %HXTYPE_UINT8: [-o] (uint8_t *) An integer.
+ * %HXTYPE_UINT16: [-o] (uint8_t *) An integer.
+ * %HXTYPE_UINT32: [-o] (uint8_t *) An integer.
+ * %HXTYPE_UINT64: [-o] (uint8_t *) An integer.
+ * %HXTYPE_INT8: [-o] (uint8_t *) An integer.
+ * %HXTYPE_INT16: [-o] (uint8_t *) An integer.
+ * %HXTYPE_INT32: [-o] (uint8_t *) An integer.
+ * %HXTYPE_INT64: [-o] (uint8_t *) An integer.
+ * %HXTYPE_MCSTR: [-o] (hxmc_t *) A string.
+ * %HXTYPE_XSNTMARK: [-o] Internal sentinal marker (used in HXOPT_TABLEEND)
+ * %HXTYPE_XHELP: [-o] Internal helper marker (used in HXOPT_AUTOHELP)
+ * %HXTYPE_SIZE_T: [-o] (size_t *) An integer.
+ *
+ * Type expected of struct HXoption.ptr is given in ().
+ * HX_getopt (o) and HXformat_* (f) support different sets, marked with [].
+ */
+enum HX_option_type {
+ HXTYPE_NONE = 0,
+ HXTYPE_VAL,
+ HXTYPE_SVAL,
+ HXTYPE_BOOL,
+ HXTYPE_BYTE,
+ HXTYPE_UCHAR, /* 5 */
+ HXTYPE_CHAR,
+ HXTYPE_USHORT,
+ HXTYPE_SHORT,
+ HXTYPE_UINT,
+ HXTYPE_INT, /* 10 */
+ HXTYPE_ULONG,
+ HXTYPE_LONG,
+ HXTYPE_ULLONG,
+ HXTYPE_LLONG,
+ HXTYPE_FLOAT, /* 15 */
+ HXTYPE_DOUBLE,
+ HXTYPE_STRING,
+ HXTYPE_STRP, /* (const char **) */
+ HXTYPE_STRDQ,
+ HXTYPE_UINT8, /* 20 */
+ HXTYPE_UINT16,
+ HXTYPE_UINT32,
+ HXTYPE_UINT64,
+ HXTYPE_INT8,
+ HXTYPE_INT16, /* 25 */
+ HXTYPE_INT32,
+ HXTYPE_INT64,
+ HXTYPE_MCSTR,
+ HXTYPE_XSNTMARK,
+ HXTYPE_XHELP, /* 30 */
+ HXTYPE_SIZE_T,
+};
+
+/**
+ * Extra flags to be OR'ed into struct HXoption.type.
+ * %HXOPT_OPTIONAL: argument to option is optional
+ * (it's bad taste to use this)
+ * %HXOPT_INC: increase variable pointed to by .ptr.
+ * (only applies to %HXTYPE_NONE)
+ * %HXOPT_DEC: increase variable pointed to by .ptr.
+ * (only applies to %HXTYPE_NONE)
+ * %HXOPT_NOT: negate input (*ptr), this is done before OR/AND
+ * %HXOPT_OR: OR *ptr by argument
+ * %HXOPT_AND: AND *ptr by argument
+ * %HXOPT_XOR: XOR *ptr by argument
+ */
+enum {
+ HXOPT_OPTIONAL = 1 << 6,
+ HXOPT_INC = 1 << 7,
+ HXOPT_DEC = 1 << 8,
+ HXOPT_NOT = 1 << 9,
+ HXOPT_OR = 1 << 10,
+ HXOPT_AND = 1 << 11,
+ HXOPT_XOR = 1 << 12,
+};
+
+/**
+ * Flags (4th arg) to HX_getopt.
+ * %HXOPT_PTHRU: pass-through unknown options to new argv
+ * %HXOPT_DESTROY_OLD: destroy old argv after parsing is successful
+ * %HXOPT_QUIET: do not output any warnings to stderr
+ * %HXOPT_HELPONERR: print out help when a parsing error occurs
+ * %HXOPT_USAGEONERR: print out short usage when a parsing error occurs
+ * %HXOPT_RQ_ORDER: require option order/POSIX mode:
+ * first non-option terminates option processing
+ */
+enum {
+ HXOPT_PTHRU = 1 << 0,
+ HXOPT_DESTROY_OLD = 1 << 1,
+ HXOPT_QUIET = 1 << 2,
+ HXOPT_HELPONERR = 1 << 3,
+ HXOPT_USAGEONERR = 1 << 4,
+ HXOPT_RQ_ORDER = 1 << 5,
+};
+
+/**
+ * (Positive-ranged) return values for HX_getopt.
+ * %HXOPT_ERR_SUCCESS: success
+ * %HXOPT_ERR_UNKN: unknown option was encountered
+ * %HXOPT_ERR_VOID: long option takes no value
+ * %HXOPT_ERR_MIS: option requires a value argument
+ */
+enum {
+ HXOPT_ERR_SUCCESS = 0,
+ HXOPT_ERR_UNKN,
+ HXOPT_ERR_VOID,
+ HXOPT_ERR_MIS,
+};
+
+/**
+ * Extra flags to be OR'ed into HXformat_add()'s 4th arg.
+ * %HXFORMAT_IMMED: do not dereference the 4th arg to get at the value
+ */
+enum {
+ HXFORMAT_IMMED = 1 << 13,
+};
+
+/**
+ * Flags for HX_shconfig_pv()
+ * %SHCONF_ONE: only read one configuration file
+ */
+enum {
+ SHCONF_ONE = 1 << 0,
+};
+
+/**
+ * Flags in struct HXoptcb.flags
+ * %HXOPTCB_BY_LONG: cb was called by invocation of @current->ln
+ * %HXOPTCB_BY_SHORT: cb was called by invocation of @current->sh
+ */
+enum {
+ HXOPTCB_BY_LONG = 1 << 0,
+ HXOPTCB_BY_SHORT = 1 << 1,
+};
+
+struct HXoptcb {
+ const struct HXoption *table, *current;
+ const char *data;
+ union {
+ double data_dbl;
+ long data_long;
+ };
+ unsigned int flags;
+};
+
+/**
+ * @ln: long option string (without "--"), or %NULL
+ * @sh: short option character, or '\0'
+ * @type: type of variable pointed to by .ptr
+ * @ptr: pointer to variable to set/update
+ * @uptr: freeform user-supplied pointer;
+ * in case of %HXTYPE_SVAL, this is the specific value to set
+ * @cb: callback function to invoke, or %NULL
+ * @val: specific value to set if type == HXTYPE_VAL
+ * @help: help string to display
+ * @htyp: type string to show in option's help
+ */
+struct HXoption {
+ const char *ln;
+ char sh;
+ unsigned int type;
+ void *ptr, *uptr;
+ void (*cb)(const struct HXoptcb *);
+ int val;
+ const char *help, *htyp;
+};
+
+extern int HX_getopt(const struct HXoption *, int *, const char ***,
+ unsigned int);
+extern void HX_getopt_help(const struct HXoptcb *, FILE *);
+extern void HX_getopt_help_cb(const struct HXoptcb *);
+extern void HX_getopt_usage(const struct HXoptcb *, FILE *);
+extern void HX_getopt_usage_cb(const struct HXoptcb *);
+extern int HX_shconfig(const char *, const struct HXoption *);
+extern struct HXmap *HX_shconfig_map(const char *);
+extern int HX_shconfig_pv(const char **, const char *,
+ const struct HXoption *, unsigned int);
+extern void HX_shconfig_free(const struct HXoption *);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#ifndef __cplusplus
+# define HXOPT_AUTOHELP \
+ {.ln = "help", .sh = '?', .type = HXTYPE_XHELP, \
+ .cb = HX_getopt_help_cb, .help = "Show this help message"}, \
+ {.ln = "usage", .type = HXTYPE_NONE, \
+ .cb = HX_getopt_usage_cb, \
+ .help = "Display brief usage message"}
+# define HXOPT_TABLEEND {.type = HXTYPE_XSNTMARK}
+#else
+# define HXOPT_AUTOHELP \
+ {NULL, '?', HXTYPE_XHELP, NULL, NULL, HX_getopt_help_cb, \
+ 0, "Show this help message"}
+# define HXOPT_TABLEEND {NULL, 0, HXTYPE_XSNTMARK}
+#endif
+
+#endif /* _LIBHX_OPTION_H */
diff --git a/include/libHX/proc.h b/include/libHX/proc.h
new file mode 100644
index 0000000..cb682ed
--- /dev/null
+++ b/include/libHX/proc.h
@@ -0,0 +1,49 @@
+#ifndef _LIBHX_PROC_H
+#define _LIBHX_PROC_H
+
+#ifndef __cplusplus
+# include <stdbool.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ HXPROC_VERBOSE = 1 << 0,
+ HXPROC_EXECV = 1 << 1,
+ HXPROC_A0 = 1 << 2,
+ HXPROC_STDIN = 1 << 3,
+ HXPROC_STDOUT = 1 << 4,
+ HXPROC_STDERR = 1 << 5,
+ HXPROC_NULL_STDIN = 1 << 6,
+ HXPROC_NULL_STDOUT = 1 << 7,
+ HXPROC_NULL_STDERR = 1 << 8,
+};
+
+struct HXproc_ops {
+ void (*p_prefork)(void *);
+ void (*p_postfork)(void *);
+ void (*p_complete)(void *);
+};
+
+struct HXproc {
+ const struct HXproc_ops *p_ops;
+ void *p_data;
+ unsigned int p_flags;
+
+ int p_stdin, p_stdout, p_stderr;
+ int p_pid;
+ char p_status;
+ bool p_exited, p_terminated;
+};
+
+extern int HXproc_run_async(const char *const *, struct HXproc *);
+extern int HXproc_run_sync(const char *const *, unsigned int);
+extern int HXproc_wait(struct HXproc *);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _LIBHX_PROC_H */
diff --git a/include/libHX/string.h b/include/libHX/string.h
new file mode 100644
index 0000000..f7146b5
--- /dev/null
+++ b/include/libHX/string.h
@@ -0,0 +1,116 @@
+#ifndef _LIBHX_STRING_H
+#define _LIBHX_STRING_H 1
+
+#ifdef __cplusplus
+# include <cstddef>
+# include <cstdio>
+# include <cstdlib>
+# include <cstring>
+#else
+# include <stddef.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#endif
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ HXQUOTE_SQUOTE = 1,
+ HXQUOTE_DQUOTE,
+ HXQUOTE_HTML,
+ HXQUOTE_LDAPFLT,
+ HXQUOTE_LDAPRDN,
+ HXQUOTE_BASE64,
+ HXQUOTE_URIENC,
+ HXQUOTE_SQLSQUOTE,
+ HXQUOTE_SQLBQUOTE,
+ _HXQUOTE_MAX,
+};
+
+#ifndef __libhx_internal_hxmc_t_defined
+#define __libhx_internal_hxmc_t_defined 1
+typedef char hxmc_t;
+#endif
+
+/*
+ * MC.C
+ */
+extern hxmc_t *HXmc_strinit(const char *);
+extern hxmc_t *HXmc_meminit(const void *, size_t);
+extern hxmc_t *HXmc_strcpy(hxmc_t **, const char *);
+extern hxmc_t *HXmc_memcpy(hxmc_t **, const void *, size_t);
+extern size_t HXmc_length(const hxmc_t *);
+extern hxmc_t *HXmc_setlen(hxmc_t **, size_t);
+extern hxmc_t *HXmc_trunc(hxmc_t **, size_t);
+extern hxmc_t *HXmc_strcat(hxmc_t **, const char *);
+extern hxmc_t *HXmc_memcat(hxmc_t **, const void *, size_t);
+extern hxmc_t *HXmc_strpcat(hxmc_t **, const char *);
+extern hxmc_t *HXmc_mempcat(hxmc_t **, const void *, size_t);
+extern hxmc_t *HXmc_strins(hxmc_t **, size_t, const char *);
+extern hxmc_t *HXmc_memins(hxmc_t **, size_t, const void *, size_t);
+extern hxmc_t *HXmc_memdel(hxmc_t *, size_t, size_t);
+extern void HXmc_free(hxmc_t *);
+extern void HXmc_zvecfree(hxmc_t **);
+
+/*
+ * STRING.C
+ */
+extern char *HX_basename(const char *);
+extern char *HX_basename_exact(const char *);
+extern char *HX_chomp(char *);
+extern char *HX_dirname(const char *);
+extern hxmc_t *HX_getl(hxmc_t **, FILE *);
+extern void *HX_memmem(const void *, size_t, const void *, size_t);
+extern char **HX_split(const char *, const char *, int *, int);
+extern char **HX_split4(char *, const char *, int *, int);
+extern int HX_split5(char *, const char *, int, char **);
+extern char *HX_strbchr(const char *, const char *, char);
+extern char *HX_strchr2(const char *, const char *);
+extern char *HX_strclone(char **, const char *);
+extern char *HX_strdup(const char *);
+extern char *HX_strlcat(char *, const char *, size_t);
+extern char *HX_strlcpy(char *, const char *, size_t);
+extern char *HX_strlncat(char *, const char *, size_t, size_t);
+extern char *HX_strlower(char *);
+extern size_t HX_strltrim(char *);
+extern char *HX_stpltrim(const char *);
+extern char *HX_strmid(const char *, long, long);
+extern char *HX_strndup(const char *, size_t);
+extern size_t HX_strnlen(const char *, size_t);
+extern char *HX_strquote(const char *, unsigned int, char **);
+extern size_t HX_strrcspn(const char *, const char *);
+extern char *HX_strrev(char *);
+extern size_t HX_strrtrim(char *);
+extern char *HX_strsep(char **, const char *);
+extern char *HX_strsep2(char **, const char *);
+extern char *HX_strupper(char *);
+
+static __inline__ void *HX_memdup(const void *buf, size_t len)
+{
+ void *ret;
+ if ((ret = malloc(len)) == NULL)
+ return NULL;
+ return memcpy(ret, buf, len);
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#ifdef __cplusplus
+extern "C++" {
+
+template<typename type> static __inline__ type
+HX_memdup(const void *data, size_t n)
+{
+ return reinterpret_cast<type>(HX_memdup(data, n));
+}
+
+} /* extern "C++" */
+#endif
+
+#endif /* _LIBHX_STRING_H */
diff --git a/include/libHX/wx_helper.hpp b/include/libHX/wx_helper.hpp
new file mode 100644
index 0000000..07d7802
--- /dev/null
+++ b/include/libHX/wx_helper.hpp
@@ -0,0 +1,20 @@
+#ifndef _LIBHX_WXHELPER_HPP
+#define _LIBHX_WXHELPER_HPP 1
+
+/* Convert from UTF-8 to wxString; only valid within the scope of the result */
+#define wxfu8(s) wxString((s), wxConvUTF8)
+
+/* Convert from UTF-8 to wxString for varargs/wxPrintf */
+#define wxfv8(s) (wxfu8(s).c_str())
+
+/* Convert from wxString to UTF-8; limited validity */
+#define wxtu8(s) static_cast<const char *>((s).ToUTF8())
+
+/* Common dialog flags */
+#define wxCDF (wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR)
+#define wxACV wxALIGN_CENTER_VERTICAL
+#define wxDPOS wxDefaultPosition
+#define wxDSIZE wxDefaultSize
+#define wxDSPAN wxDefaultSpan
+
+#endif /* _LIBHX_WXHELPER_HPP */