[cogl/wip/rib/introspection: 7/14] Add deps/eglib library from the mono project
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/rib/introspection: 7/14] Add deps/eglib library from the mono project
- Date: Thu, 20 Feb 2014 18:00:08 +0000 (UTC)
commit 25c291f6a48bd62ea154993449dc0d7d355ac0e2
Author: Robert Bragg <robert linux intel com>
Date: Sat Feb 8 13:14:40 2014 +0000
Add deps/eglib library from the mono project
This adds a deps/eglib api which is a small MIT licensed library that is
api compatible with enough of the glib api to run Cogl. This replaces
deps/glib and deps/gmodule for use when Cogl is built with
--enable-standalone.
This code is based on eglib from the mono project, with a few updates
and additions to handle apis that Cogl uses that mono doesn't.
As a reference point for monitoring eglib changes in the mono project,
this code is based on commit d50c836721f22df74a45185d51d0b9d37c370e33
COPYING | 12 +-
README.in | 20 +-
cogl-path/cogl-path.c | 9 +-
cogl/Makefile.am | 7 +-
cogl/cogl-debug.c | 3 +-
cogl/cogl-pipeline.c | 1 -
cogl/cogl-profile.c | 8 +-
cogl/driver/gl/cogl-pipeline-fragend-fixed.c | 5 +-
cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c | 5 +-
configure.ac | 237 ++-
deps/Makefile.am | 2 +-
deps/eglib/.gitignore | 22 +
deps/eglib/COPYING | 17 +
deps/eglib/ChangeLog | 7 +
deps/eglib/Makefile.am | 17 +
deps/eglib/README | 30 +
deps/eglib/TODO | 33 +
deps/eglib/acinclude.m4 | 182 ++
deps/eglib/autogen.sh | 136 +
deps/eglib/config.rpath | 672 ++++
deps/eglib/configure.ac | 268 ++
deps/eglib/m4/.gitignore | 7 +
deps/eglib/m4/Makefile.am | 1 +
deps/eglib/m4/iconv.m4 | 214 ++
deps/eglib/m4/lib-ld.m4 | 110 +
deps/eglib/m4/lib-link.m4 | 774 +++++
deps/eglib/m4/lib-prefix.m4 | 224 ++
deps/eglib/src/.gitignore | 11 +
deps/eglib/src/Makefile.am | 85 +
deps/eglib/src/eglib-config.h.in | 46 +
deps/eglib/src/eglib-config.hw | 76 +
deps/eglib/src/garray.c | 242 ++
deps/eglib/src/gbytearray.c | 62 +
deps/eglib/src/gdate-unix.c | 58 +
deps/eglib/src/gdate-win32.c | 52 +
deps/eglib/src/gdebugkey.c | 71 +
deps/eglib/src/gdir-unix.c | 151 +
deps/eglib/src/gdir-win32.c | 148 +
deps/eglib/src/gerror.c | 127 +
deps/eglib/src/gfile-posix.c | 200 ++
deps/eglib/src/gfile-unix.c | 80 +
deps/eglib/src/gfile-win32.c | 120 +
deps/eglib/src/gfile.c | 155 +
deps/eglib/src/ghashtable.c | 674 ++++
deps/eglib/src/ghooklist.c | 124 +
deps/eglib/src/giconv.c | 1368 ++++++++
deps/eglib/src/glib.h | 1290 ++++++++
deps/eglib/src/glist.c | 359 +++
deps/eglib/src/gmarkup.c | 487 +++
deps/eglib/src/gmem.c | 108 +
deps/eglib/src/gmisc-unix.c | 152 +
deps/eglib/src/gmisc-win32.c | 166 +
deps/eglib/src/gmodule-unix.c | 290 ++
deps/eglib/src/gmodule-win32.c | 189 ++
deps/eglib/src/gmodule.h | 37 +
deps/eglib/src/goutput.c | 199 ++
deps/eglib/src/gpath.c | 296 ++
deps/eglib/src/gpattern.c | 216 ++
deps/eglib/src/gptrarray.c | 248 ++
deps/eglib/src/gqsort.c | 168 +
deps/eglib/src/gquark.c | 57 +
deps/eglib/src/gqueue.c | 187 ++
deps/eglib/src/gshell.c | 304 ++
deps/eglib/src/gslist.c | 365 +++
deps/eglib/src/gspawn.c | 495 +++
deps/eglib/src/gstr.c | 932 ++++++
deps/eglib/src/gstring.c | 293 ++
deps/eglib/src/gtimer-unix.c | 99 +
deps/eglib/src/gtimer-win32.c | 97 +
deps/eglib/src/gunicode.c | 253 ++
deps/eglib/src/gutf8.c | 376 +++
deps/eglib/src/sort.frag.h | 184 ++
deps/eglib/src/unicode-data.h | 2152 +++++++++++++
deps/eglib/src/vasprintf.c | 34 +
deps/eglib/test/.gitignore | 12 +
deps/eglib/test/Makefile.am | 51 +
deps/eglib/test/README | 113 +
deps/eglib/test/UTF-16BE.txt | Bin 0 -> 15242 bytes
deps/eglib/test/UTF-16LE.txt | Bin 0 -> 15242 bytes
deps/eglib/test/UTF-32BE.txt | Bin 0 -> 30484 bytes
deps/eglib/test/UTF-32LE.txt | Bin 0 -> 30484 bytes
deps/eglib/test/UTF-8.txt | 212 ++
deps/eglib/test/array.c | 163 +
deps/eglib/test/dir.c | 66 +
deps/eglib/test/driver.c | 248 ++
deps/eglib/test/endian.c | 38 +
deps/eglib/test/fake.c | 19 +
deps/eglib/test/file.c | 228 ++
deps/eglib/test/hashtable.c | 177 ++
deps/eglib/test/list.c | 438 +++
deps/eglib/test/markup.c | 234 ++
deps/eglib/test/memory.c | 40 +
deps/eglib/test/module.c | 64 +
deps/eglib/test/path.c | 357 +++
deps/eglib/test/pattern.c | 61 +
deps/eglib/test/ptrarray.c | 349 ++
deps/eglib/test/queue.c | 184 ++
deps/eglib/test/shell.c | 331 ++
deps/eglib/test/sizes.c | 108 +
deps/eglib/test/slist.c | 345 ++
deps/eglib/test/spawn.c | 82 +
deps/eglib/test/string-util.c | 698 ++++
deps/eglib/test/string.c | 237 ++
deps/eglib/test/test-both | 74 +
deps/eglib/test/test.c | 282 ++
deps/eglib/test/test.h | 82 +
deps/eglib/test/tests.h | 57 +
deps/eglib/test/timer.c | 55 +
deps/eglib/test/unicode.c | 99 +
deps/eglib/test/utf8.c | 935 ++++++
deps/eglib/test/whats-implemented | 83 +
deps/eglib/winconfig.h | 76 +
deps/glib/COPYING | 482 ---
deps/glib/Makefile.am | 75 -
deps/glib/README | 14 -
deps/glib/galloca.h | 108 -
deps/glib/garray.c | 1622 ----------
deps/glib/garray.h | 179 --
deps/glib/gatomic.c | 846 -----
deps/glib/gatomic.h | 215 --
deps/glib/gbacktrace.h | 59 -
deps/glib/gbitlock.c | 533 ----
deps/glib/gbitlock.h | 70 -
deps/glib/gconvert.c | 31 -
deps/glib/gconvert.h | 92 -
deps/glib/gdataset.c | 1360 --------
deps/glib/gdataset.h | 120 -
deps/glib/gdatasetprivate.h | 42 -
deps/glib/gdebug.h | 57 -
deps/glib/gerror.c | 709 -----
deps/glib/gerror.h | 106 -
deps/glib/gfileutils.c | 2327 --------------
deps/glib/gfileutils.h | 149 -
deps/glib/ghash.c | 1573 ---------
deps/glib/ghash.h | 166 -
deps/glib/ghook.c | 634 ----
deps/glib/ghook.h | 179 --
deps/glib/gi18n-lib.h | 36 -
deps/glib/glib-object.h | 6 -
deps/glib/glib.h | 29 -
deps/glib/glib_trace.h | 41 -
deps/glib/glibintl.h | 42 -
deps/glib/glist.c | 1168 -------
deps/glib/glist.h | 120 -
deps/glib/gmacros.h | 291 --
deps/glib/gmain.c | 86 -
deps/glib/gmain.h | 35 -
deps/glib/gmem.c | 1395 --------
deps/glib/gmem.h | 307 --
deps/glib/gmessages.c | 1082 -------
deps/glib/gmessages.h | 403 ---
deps/glib/gprintf.c | 338 --
deps/glib/gprintf.h | 50 -
deps/glib/gprintfint.h | 57 -
deps/glib/gqsort.c | 298 --
deps/glib/gqsort.h | 44 -
deps/glib/gquark.h | 50 -
deps/glib/gqueue.c | 1045 ------
deps/glib/gqueue.h | 148 -
deps/glib/gslice.c | 1493 ---------
deps/glib/gslice.h | 84 -
deps/glib/gslist.c | 1080 -------
deps/glib/gslist.h | 114 -
deps/glib/gstdio.c | 831 -----
deps/glib/gstdio.h | 148 -
deps/glib/gstrfuncs.c | 3249 -------------------
deps/glib/gstrfuncs.h | 267 --
deps/glib/gstring.c | 1446 ---------
deps/glib/gstring.h | 184 --
deps/glib/gtestutils.c | 514 ---
deps/glib/gtestutils.h | 159 -
deps/glib/gthread.c | 2599 ---------------
deps/glib/gthread.h | 405 ---
deps/glib/gthreadprivate.h | 68 -
deps/glib/gtypes.h | 459 ---
deps/glib/gunicode.h | 728 -----
deps/glib/gutils.c | 3870 -----------------------
deps/glib/gutils.h | 526 ---
deps/gmodule/Makefile.am | 32 -
deps/gmodule/README | 4 -
deps/gmodule/gmodule-dl.c | 166 -
deps/gmodule/gmodule-dld.c | 161 -
deps/gmodule/gmodule-dyld.c | 152 -
deps/gmodule/gmodule-win32.c | 200 --
deps/gmodule/gmodule.c | 580 ----
deps/gmodule/gmodule.h | 99 -
deps/gmodule/gmoduleconf.h.in | 52 -
deps/gmodule/gmoduleconf.h.win32 | 42 -
examples/Makefile.am | 6 +-
tests/conform/Makefile.am | 3 +-
tests/unit/Makefile.am | 3 +-
191 files changed, 23443 insertions(+), 38604 deletions(-)
---
diff --git a/COPYING b/COPYING
index 1a61f8e..832a7d2 100644
--- a/COPYING
+++ b/COPYING
@@ -7,16 +7,11 @@ A few exceptions are:
This license is essentially identical to the MIT license with
the option to refer to a web address for a copy of the notice
in documentation.
-- cogl-point-in-poly.c is under a 3 clause BSD license
+- cogl-point-in-poly.c is under a permissive 3 clause BSD license
- stb_image.c is public domain.
Please see individual files for details.
-deps/glib is licensed under the LGPL (please see individual files for
-details and deps/glib/COPYING for a copy of the LGPL license) This
-code is only referenced when building Cogl with the --standalone
-configure option.
-
--
The MIT License
@@ -25,7 +20,10 @@ Copyright (C) 2009-2014 Intel Corporation.
Copyright (C) 2010,2012 Red Hat, Inc.
Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
Copyright (C) 2011,2012 Collabora Ltd.
-Copyright (c) 2008-2011 Kristian Høgsberg
+Copyright (C) 2008-2011 Kristian Høgsberg
+Copyright (C) 2006-2011 Novell, Inc.
+Copyright (C) 2011-2012 Xamarin Inc.
+Copyright (C) 2011 Jeffrey Stedfast
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.in b/README.in
index 245bc60..e7f34e2 100644
--- a/README.in
+++ b/README.in
@@ -111,15 +111,17 @@ The experimental 2.0 API is documented here:
LICENSE
-------------------------------------------------------------------------------
-Most of Cogl is licensed under the terms of the MIT license. There are
-also some files under the SGI Free Software License B, version 2.0,
-cogl-point-in-poly.c is under a 3 clause BSD license and stb_image.c
-is public domain. Please see individual files for details.
-
-deps/glib is licensed under the LGPL (please see individual files for
-details and deps/glib/COPYING for a copy of the LGPL license) This
-code is only referenced when building Cogl with the --standalone
-configure option.
+Most of Cogl is licensed under the terms of the MIT license.
+
+The tesselator used by cogl-path is under the SGI Free Software License B,
+version 2.0 (basically identical to the MIT license except you can choose
+to refer to a web address for a copy of the notice in documentation).
+
+cogl-point-in-poly.c is under a permissive 3 clause BSD license.
+
+stb_image.c is public domain.
+
+Please refer to the COPYING file and individual files for details.
--
BUILDING AND INSTALLATION
diff --git a/cogl-path/cogl-path.c b/cogl-path/cogl-path.c
index a5287c4..37f344d 100644
--- a/cogl-path/cogl-path.c
+++ b/cogl-path/cogl-path.c
@@ -32,7 +32,12 @@
* Robert Bragg <robert linux intel com>
*/
-#include "config.h"
+#include <config.h>
+
+#include <glib.h>
+
+#include <string.h>
+#include <math.h>
#include "cogl-util.h"
#include "cogl-object.h"
@@ -49,8 +54,6 @@
#include "cogl-primitive-private.h"
#include "tesselator/tesselator.h"
-#include <string.h>
-#include <math.h>
#define _COGL_MAX_BEZ_RECURSE_DEPTH 16
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 9521b60..a99ae04 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -24,10 +24,6 @@ AM_CPPFLAGS = \
-I$(srcdir)/driver/gl/gles \
$(NULL)
-if !USE_GLIB
- AM_CPPFLAGS += -I$(top_builddir)/deps/glib
-endif
-
AM_CPPFLAGS += \
-DG_LOG_DOMAIN=\"Cogl\" \
-DCOGL_COMPILATION \
@@ -490,8 +486,7 @@ lib_LTLIBRARIES += libcogl2.la
libcogl2_la_LIBADD = $(LIBM) $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
if !USE_GLIB
-libcogl2_la_LIBADD += $(top_builddir)/deps/glib/libglib.la
-libcogl2_la_LIBADD += $(top_builddir)/deps/gmodule/libgmodule.la
+libcogl2_la_LIBADD += $(top_builddir)/deps/eglib/src/libeglib.la
endif
if UNIT_TESTS
libcogl2_la_LIBADD += $(top_builddir)/test-fixtures/libtest-fixtures.la
diff --git a/cogl/cogl-debug.c b/cogl/cogl-debug.c
index 80a3669..e748a7e 100644
--- a/cogl/cogl-debug.c
+++ b/cogl/cogl-debug.c
@@ -179,8 +179,7 @@ _cogl_parse_debug_string (const char *value,
{
g_printerr ("\n\n%28s\n", _("Supported debug values:"));
#define OPT(MASK_NAME, GROUP, NAME, NAME_FORMATTED, DESCRIPTION) \
- g_printerr ("%28s %s\n", NAME ":", g_dgettext (GETTEXT_PACKAGE, \
- DESCRIPTION));
+ g_printerr ("%28s %s\n", NAME ":", _(DESCRIPTION));
#include "cogl-debug-options.h"
g_printerr ("\n%28s\n", _("Special debug values:"));
OPT (IGNORED, "ignored", "all", "ignored", \
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index 062fa7e..29c5928 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -53,7 +53,6 @@
#include "cogl-private.h"
#include <glib.h>
-#include <glib/gprintf.h>
#include <string.h>
static void _cogl_pipeline_free (CoglPipeline *tex);
diff --git a/cogl/cogl-profile.c b/cogl/cogl-profile.c
index ce687a2..3cab783 100644
--- a/cogl/cogl-profile.c
+++ b/cogl/cogl-profile.c
@@ -93,12 +93,10 @@ _cogl_uprof_init (void)
G_STMT_START { \
int shift = COGL_DEBUG_ ## MASK_NAME; \
uprof_context_add_boolean_option (_cogl_uprof_context, \
- g_dgettext (GETTEXT_PACKAGE, GROUP), \
+ _(GROUP), \
NAME, \
- g_dgettext (GETTEXT_PACKAGE, \
- NAME_FORMATTED), \
- g_dgettext (GETTEXT_PACKAGE, \
- DESCRIPTION), \
+ _(NAME_FORMATTED), \
+ _(DESCRIPTION), \
debug_option_getter, \
debug_option_setter, \
GUINT_TO_POINTER (shift)); \
diff --git a/cogl/driver/gl/cogl-pipeline-fragend-fixed.c b/cogl/driver/gl/cogl-pipeline-fragend-fixed.c
index d19430e..12d14ff 100644
--- a/cogl/driver/gl/cogl-pipeline-fragend-fixed.c
+++ b/cogl/driver/gl/cogl-pipeline-fragend-fixed.c
@@ -31,9 +31,7 @@
* Robert Bragg <robert linux intel com>
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
#include "cogl-context-private.h"
#include "cogl-util-gl-private.h"
@@ -51,7 +49,6 @@
#include "cogl-profile.h"
#include <glib.h>
-#include <glib/gprintf.h>
#include <string.h>
#ifndef GL_TEXTURE_RECTANGLE_ARB
diff --git a/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c
index e90161b..7b2d67f 100644
--- a/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c
+++ b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c
@@ -31,9 +31,7 @@
* Robert Bragg <robert linux intel com>
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
#include "cogl-debug.h"
#include "cogl-context-private.h"
@@ -54,7 +52,6 @@
#include "cogl-profile.h"
#include <glib.h>
-#include <glib/gprintf.h>
#include <string.h>
/* This might not be defined on GLES */
diff --git a/configure.ac b/configure.ac
index a024234..b2e2ed7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,10 @@ dnl ================================================================
# updating the version number in advance of a release.
m4_define([cogl_release_status], [git])
+
+dnl ================================================================
+dnl Setup autoconf
+dnl ================================================================
AC_INIT(cogl, [cogl_version])
AC_CONFIG_SRCDIR(cogl/cogl.h)
AC_CONFIG_AUX_DIR([build])
@@ -73,6 +77,9 @@ AC_CONFIG_MACRO_DIR([build/autotools])
AC_CONFIG_HEADERS(config.h)
AC_GNU_SOURCE
+AC_CANONICAL_SYSTEM
+AC_CANONICAL_HOST
+
dnl ================================================================
dnl Required versions for dependencies
dnl ================================================================
@@ -178,23 +185,93 @@ AC_SUBST(LIBM)
dnl ================================================================
dnl See what platform we are building for
dnl ================================================================
-AC_CANONICAL_HOST
-AC_MSG_CHECKING([if building for some Win32 platform])
-AS_CASE([$host],
- [*-*-mingw*|*-*-cygwin*],
- [
- COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -no-undefined"
- platform_win32=yes
- ],
- [platform_win32=no]
-)
-AC_MSG_RESULT([$platform_win32])
-AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"])
+AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
+AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
+
+platform_darwin=no
+platform_android=no
+platform_win32=no
AC_CHECK_HEADER([OpenGL/gl.h], [platform_quartz=yes], [platform_quartz=no])
+
+case $host in
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+ PATHSEP='\\'
+ SEARCHSEP=';'
+ OS="WIN32"
+ PIDTYPE='void *'
+ COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -no-undefined"
+ platform_win32=yes
+ ;;
+*-*darwin*)
+ platform_darwin=yes
+ PATHSEP='/'
+ SEARCHSEP=':'
+ OS="UNIX"
+ PIDTYPE='int'
+ ;;
+*-*-linux-android*)
+ platform_android=yes
+ AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
+ PATHSEP='/'
+ SEARCHSEP=':'
+ OS="UNIX"
+ PIDTYPE='int'
+ ;;
+*)
+ PATHSEP='/'
+ SEARCHSEP=':'
+ OS="UNIX"
+ PIDTYPE='int'
+ ;;
+esac
+
+AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"])
AM_CONDITIONAL(OS_QUARTZ, [test "$platform_quartz" = "yes"])
+case $target in
+arm*-darwin*)
+ CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
+ ;;
+i*86-*-darwin*)
+ ORDER=G_LITTLE_ENDIAN
+ ;;
+esac
+
+target_osx=no
+target_ios=no
+
+if test "x$platform_darwin" = "xyes"; then
+ AC_TRY_COMPILE([#include "TargetConditionals.h"],[
+ #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
+ #error fail this for ios
+ #endif
+ return 0;
+ ], [
+ AC_DEFINE(TARGET_OSX,1,[The JIT/AOT targets OSX])
+ target_osx=yes
+ ], [
+ AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
+ target_ios=yes
+ ])
+ AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
+fi
+
+AC_SUBST(ORDER)
+AC_SUBST(CFLAGS)
+AC_SUBST(PATHSEP)
+AC_SUBST(SEARCHSEP)
+AC_SUBST(OS)
+AC_SUBST(PIDTYPE)
+AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
+AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
+AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
+AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
+
+
+
+
dnl ================================================================
dnl Handle extra configure options
dnl ================================================================
@@ -452,13 +529,8 @@ AS_IF([test "x$enable_glib" = "xyes"],
COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gobject-2.0 gmodule-no-export-2.0"
],
[
- AS_GLIBCONFIG([deps/glib])
- COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps"
- COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps"
- COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/glib"
- COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/glib"
- COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/gmodule"
- COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/gmodule"
+ COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/eglib/src"
+ COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/eglib/src"
EXPERIMENTAL_CONFIG=yes
EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib,"
enable_nls=no
@@ -1331,12 +1403,131 @@ AS_IF([test "x$enable_emscripten" = "xno"],
dnl 'memmem' is a GNU extension but we have a simple fallback
AC_CHECK_FUNCS([memmem])
+
dnl This is used in the cogl-gles2-gears example but it is a GNU extension
save_libs="$LIBS"
LIBS="$LIBS $LIBM"
AC_CHECK_FUNCS([sincos])
LIBS="$save_libs"
+
+dnl ================================================================
+dnl eglib checks.
+dnl ================================================================
+
+GNUC_PRETTY=
+GNUC_UNUSED=
+BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
+if test x$GCC = xyes; then
+ GNUC_UNUSED='__attribute__((__unused__))'
+ GNUC_NORETURN='__attribute__((__noreturn__))'
+ case $host_cpu in
+ i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
+ esac
+fi
+AC_SUBST(GNUC_PRETTY)
+AC_SUBST(GNUC_UNUSED)
+AC_SUBST(GNUC_NORETURN)
+AC_SUBST(BREAKPOINT)
+
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(void *)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
+
+#
+# iOS detection of strndup and getpwuid_r is faulty for some reason
+# so let's simply avoid it
+#
+if test x$target_ios = xno; then
+AC_CHECK_FUNCS(strndup getpwuid_r)
+fi
+
+AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
+AM_ICONV()
+AC_SEARCH_LIBS(sqrtf, m)
+
+# nanosleep may not be part of libc, also search it in other libraries
+AC_SEARCH_LIBS(nanosleep, rt)
+
+AC_SEARCH_LIBS(dlopen, dl)
+old_ldflags="${LDFLAGS}"
+LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
+AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
+if test $found_export_dynamic = no; then
+ LDFLAGS="${old_ldflags}"
+fi
+
+AC_MSG_CHECKING(for varargs macros)
+AC_TRY_COMPILE([],[
+int foo (int i, int j);
+#define bar(...) foo (1, __VA_ARGS__)
+void main () {
+ bar (2);
+}
+],have_iso_varargs=yes,have_iso_varargs=no)
+AC_MSG_RESULT($have_iso_varargs)
+G_HAVE_ISO_VARARGS=0
+if test "x$have_iso_varargs" = "xyes"; then
+ G_HAVE_ISO_VARARGS=1
+fi
+AC_SUBST(G_HAVE_ISO_VARARGS)
+
+AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
+AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
+AC_SUBST(HAVE_ALLOCA_H)
+
+
+if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
+ GPOINTER_TO_INT="((gint) (ptr))"
+ GPOINTER_TO_UINT="((guint) (ptr))"
+ GINT_TO_POINTER="((gpointer) (v))"
+ GUINT_TO_POINTER="((gpointer) (v))"
+ GSIZE="int"
+ GSIZE_FORMAT='"u"'
+ G_GUINT64_FORMAT='"llu"'
+ G_GINT64_FORMAT='"lld"'
+ G_GUINT32_FORMAT='"lu"'
+ G_GINT32_FORMAT='"ld"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
+ GPOINTER_TO_INT="((gint)(long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(glong) (v))"
+ GUINT_TO_POINTER="((gpointer)(gulong) (v))"
+ GSIZE="long"
+ GSIZE_FORMAT='"lu"'
+ G_GUINT64_FORMAT='"lu"'
+ G_GINT64_FORMAT='"ld"'
+ G_GUINT32_FORMAT='"u"'
+ G_GINT32_FORMAT='"d"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
+ GPOINTER_TO_INT="((gint)(long long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(long long) (v))"
+ GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
+ GSIZE="long long"
+ GSIZE_FORMAT='"I64u"'
+ G_GUINT64_FORMAT='"I64u"'
+ G_GINT64_FORMAT='"I64i"'
+ G_GUINT32_FORMAT='"I32u"'
+ G_GINT32_FORMAT='"I32i"'
+else
+ AC_MSG_ERROR([unsupported pointer size])
+fi
+
+AC_SUBST(GPOINTER_TO_INT)
+AC_SUBST(GPOINTER_TO_UINT)
+AC_SUBST(GINT_TO_POINTER)
+AC_SUBST(GUINT_TO_POINTER)
+AC_SUBST(GSIZE)
+AC_SUBST(GSIZE_FORMAT)
+AC_SUBST(G_GUINT64_FORMAT)
+AC_SUBST(G_GINT64_FORMAT)
+AC_SUBST(G_GUINT32_FORMAT)
+AC_SUBST(G_GINT32_FORMAT)
+
+
dnl ================================================================
dnl Platform values
dnl ================================================================
@@ -1439,9 +1630,11 @@ build/win32/Makefile
build/win32/vs9/Makefile
build/win32/vs10/Makefile
deps/Makefile
-deps/glib/Makefile
-deps/gmodule/Makefile
-deps/gmodule/gmoduleconf.h
+deps/eglib/Makefile
+deps/eglib/m4/Makefile
+deps/eglib/src/Makefile
+deps/eglib/src/eglib-config.h
+deps/eglib/test/Makefile
test-fixtures/Makefile
cogl/Makefile
cogl/cogl2.pc
diff --git a/deps/Makefile.am b/deps/Makefile.am
index 2cd3cb5..759c810 100644
--- a/deps/Makefile.am
+++ b/deps/Makefile.am
@@ -1,5 +1,5 @@
SUBDIRS =
if !USE_GLIB
-SUBDIRS += glib gmodule
+SUBDIRS += eglib
endif
diff --git a/deps/eglib/.gitignore b/deps/eglib/.gitignore
new file mode 100644
index 0000000..61e1af8
--- /dev/null
+++ b/deps/eglib/.gitignore
@@ -0,0 +1,22 @@
+/
+/depcomp
+/config.guess
+/config.sub
+/ltmain.sh
+/eglib-*.tar.gz
+/missing
+/install-sh
+/compile
+/Makefile
+/Makefile.in
+/stamp-h1
+/config.h.in
+/libtool
+/autom4te.cache
+/aclocal.m4
+/config.log
+/configure
+/config.h
+/config.status
+/INSTALL
+dolt*
diff --git a/deps/eglib/AUTHORS b/deps/eglib/AUTHORS
new file mode 100644
index 0000000..e69de29
diff --git a/deps/eglib/COPYING b/deps/eglib/COPYING
new file mode 100644
index 0000000..1bb5a44
--- /dev/null
+++ b/deps/eglib/COPYING
@@ -0,0 +1,17 @@
+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
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/deps/eglib/ChangeLog b/deps/eglib/ChangeLog
new file mode 100644
index 0000000..de86816
--- /dev/null
+++ b/deps/eglib/ChangeLog
@@ -0,0 +1,7 @@
+Please refer to the Git history for a log of source code changes.
+
+This eglib api was originally copied from the mono project:
+
+https://github.com/mono/mono/tree/master/eglib
+
+Our inital snapshot was taken from commit d50c836721f22df7
diff --git a/deps/eglib/Makefile.am b/deps/eglib/Makefile.am
new file mode 100644
index 0000000..b7e5cd6
--- /dev/null
+++ b/deps/eglib/Makefile.am
@@ -0,0 +1,17 @@
+ACLOCAL_AMFLAGS = -I m4
+
+if HOST_WIN32
+SUBDIRS = m4 src
+else
+if PLATFORM_DARWIN
+SUBDIRS = m4 src
+else
+if CROSS_COMPILING
+SUBDIRS = m4 src
+else
+SUBDIRS = m4 src test
+endif
+endif
+endif
+
+EXTRA_DIST = autogen.sh README NEWS AUTHORS ChangeLog winconfig.h
diff --git a/deps/eglib/NEWS b/deps/eglib/NEWS
new file mode 100644
index 0000000..e69de29
diff --git a/deps/eglib/README b/deps/eglib/README
new file mode 100644
index 0000000..ad04e32
--- /dev/null
+++ b/deps/eglib/README
@@ -0,0 +1,30 @@
+
+The purpose of eglib is to be a small MIT licensed subset of glib.
+
+The implementation is done from the public documentation available here:
+
+ http://developer.gnome.org/doc/API/2.0/glib/
+
+Currently all the definitions go into a single file: glib.h, there are
+no separate files, please try to follow the convetions in the source code
+
+* Tests
+
+ Please read the README in tests/
+
+* Features
+
+ The source code is designed to allow for different operating
+ system builds of the eglib code.
+
+ Files in src that:
+
+ * Have a plain name: are cross platform, and should work on
+ every operating system.
+
+ * That end in -unix.c: These files contain Unix specific code.
+
+ * That end in -win32.c: These files contain Win32 specific code.
+
+ * That end in -posix.c: Will work on both Windows and Unix,
+ but should not be included for other operating systems.
diff --git a/deps/eglib/TODO b/deps/eglib/TODO
new file mode 100644
index 0000000..bbbb49b
--- /dev/null
+++ b/deps/eglib/TODO
@@ -0,0 +1,33 @@
+* Missing code
+
+ * Process launching
+ 3 g_shell_quote
+ 1 g_shell_unquote
+
+----------------------------------------------------------------------
+
+* Should implement, for better performance:
+
+Macros:
+ 6 G_UNLIKELY
+ 4 G_LIKELY
+
+* Unimplemented, not supported currently:
+
+ (none as yet.)
+
+* Dead Code
+
+ The GMainLoop code was no longer in use in Mono.
+
+* Windows implementations needed
+
+ Directory, File manipulation:
+
+ g_dir_open, g_dir_close, g_dir_read_name
+
+ We're missing a native windows implementation. The unix one is in place.
+
+ * Information retrieval
+ 1 g_win32_getlocale
+
diff --git a/deps/eglib/acinclude.m4 b/deps/eglib/acinclude.m4
new file mode 100644
index 0000000..526d00c
--- /dev/null
+++ b/deps/eglib/acinclude.m4
@@ -0,0 +1,182 @@
+dnl dolt, a replacement for libtool
+dnl Copyright © 2007-2008 Josh Triplett <josh freedesktop org>
+dnl Copying and distribution of this file, with or without modification,
+dnl are permitted in any medium without royalty provided the copyright
+dnl notice and this notice are preserved.
+dnl
+dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
+dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
+dnl installed when running autoconf on your project.
+
+AC_DEFUN([DOLT], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+# dolt, a replacement for libtool
+# Josh Triplett <josh freedesktop org>
+AC_PATH_PROG(DOLT_BASH, bash)
+AC_MSG_CHECKING([if dolt supports this host])
+dolt_supported=yes
+if test x$DOLT_BASH = x; then
+ dolt_supported=no
+fi
+if test x$GCC != xyes; then
+ dolt_supported=no
+fi
+case $host in
+i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
+|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*)
+ pic_options='-fPIC'
+ ;;
+?86-pc-cygwin*|i?86-pc-cygwin*)
+ pic_options='-DDLL_EXPORT'
+ ;;
+i?86-apple-darwin*|arm-apple-darwin*)
+ pic_options='-fno-common'
+ ;;
+*)
+ dolt_supported=no
+ ;;
+esac
+if test x$dolt_supported = xno ; then
+ AC_MSG_RESULT([no, falling back to libtool])
+ LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
+ LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
+else
+ AC_MSG_RESULT([yes, replacing libtool])
+
+dnl Start writing out doltcompile.
+ cat <<__DOLTCOMPILE__EOF__ >doltcompile
+#!$DOLT_BASH
+__DOLTCOMPILE__EOF__
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+args=("$[]@")
+for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do
+ if test x"${args@<:@$arg@:>@}" = x-o ; then
+ objarg=$((arg+1))
+ break
+ fi
+done
+if test x$objarg = x ; then
+ echo 'Error: no -o on compiler command line' 1>&2
+ exit 1
+fi
+lo="${args@<:@$objarg@:>@}"
+obj="${lo%.lo}"
+if test x"$lo" = x"$obj" ; then
+ echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2
+ exit 1
+fi
+objbase="${obj##*/}"
+__DOLTCOMPILE__EOF__
+
+dnl Write out shared compilation code.
+ if test x$enable_shared = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+libobjdir="${obj%$objbase}.libs"
+if test ! -d "$libobjdir" ; then
+ mkdir_out="$(mkdir "$libobjdir" 2>&1)"
+ mkdir_ret=$?
+ if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
+ echo "$mkdir_out" 1>&2
+ exit $mkdir_ret
+ fi
+fi
+pic_object="$libobjdir/$objbase.o"
+args@<:@$objarg@:>@="$pic_object"
+__DOLTCOMPILE__EOF__
+ cat <<__DOLTCOMPILE__EOF__ >>doltcompile
+"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$?
+__DOLTCOMPILE__EOF__
+ fi
+
+dnl Write out static compilation code.
+dnl Avoid duplicate compiler output if also building shared objects.
+ if test x$enable_static = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+non_pic_object="$obj.o"
+args@<:@$objarg@:>@="$non_pic_object"
+__DOLTCOMPILE__EOF__
+ if test x$enable_shared = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $?
+__DOLTCOMPILE__EOF__
+ else
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+"${args@<:@@@:>@}" || exit $?
+__DOLTCOMPILE__EOF__
+ fi
+ fi
+
+dnl Write out the code to write the .lo file.
+dnl The second line of the .lo file must match "^# Generated by .*libtool"
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+{
+echo "# $lo - a libtool object file"
+echo "# Generated by doltcompile, not libtool"
+__DOLTCOMPILE__EOF__
+
+ if test x$enable_shared = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+echo "pic_object='.libs/${objbase}.o'"
+__DOLTCOMPILE__EOF__
+ else
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+echo pic_object=none
+__DOLTCOMPILE__EOF__
+ fi
+
+ if test x$enable_static = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+echo "non_pic_object='${objbase}.o'"
+__DOLTCOMPILE__EOF__
+ else
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+echo non_pic_object=none
+__DOLTCOMPILE__EOF__
+ fi
+
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+} > "$lo"
+__DOLTCOMPILE__EOF__
+
+dnl Done writing out doltcompile; substitute it for libtool compilation.
+ chmod +x doltcompile
+ LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
+ LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
+
+dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for
+dnl a target, so write out a libtool wrapper to handle that case.
+dnl Note that doltlibtool does not handle inferred tags or option arguments
+dnl without '=', because automake does not use them.
+ cat <<__DOLTLIBTOOL__EOF__ > doltlibtool
+#!$DOLT_BASH
+__DOLTLIBTOOL__EOF__
+ cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool
+top_builddir_slash="${0%%doltlibtool}"
+: ${top_builddir_slash:=./}
+args=()
+modeok=false
+tagok=false
+for arg in "$[]@"; do
+ case "$arg" in
+ --silent) ;;
+ --mode=compile) modeok=true ;;
+ --tag=CC|--tag=CXX) tagok=true ;;
+ --quiet) ;;
+ *) args@<:@${#args[ ]}@:>@="$arg" ;;
+ esac
+done
+if $modeok && $tagok ; then
+ . ${top_builddir_slash}doltcompile "${args@<:@@@:>@}"
+else
+ exec ${top_builddir_slash}libtool "$[]@"
+fi
+__DOLTLIBTOOL__EOF__
+
+dnl Done writing out doltlibtool; substitute it for libtool.
+ chmod +x doltlibtool
+ LIBTOOL='$(top_builddir)/doltlibtool'
+fi
+AC_SUBST(LTCOMPILE)
+AC_SUBST(LTCXXCOMPILE)
+# end dolt
+])
diff --git a/deps/eglib/autogen.sh b/deps/eglib/autogen.sh
new file mode 100755
index 0000000..66f980a
--- /dev/null
+++ b/deps/eglib/autogen.sh
@@ -0,0 +1,136 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+# Ripped off from GNOME macros version
+
+DIE=0
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+if [ -n "$MONO_PATH" ]; then
+ # from -> /mono/lib:/another/mono/lib
+ # to -> /mono /another/mono
+ for i in `echo ${MONO_PATH} | tr ":" " "`; do
+ i=`dirname ${i}`
+ if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
+ ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
+ fi
+ if [ -n "{i}" -a -d "${i}/bin" ]; then
+ PATH="${i}/bin:$PATH"
+ fi
+ done
+ export PATH
+fi
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`autoconf' installed to compile Mono."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+if [ -z "$LIBTOOL" ]; then
+ LIBTOOL=`which glibtool 2>/dev/null`
+ if [ ! -x "$LIBTOOL" ]; then
+ LIBTOOL=`which libtool`
+ fi
+fi
+
+(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
+ ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`libtool' installed to compile Mono."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
+ grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
+ (gettext --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`gettext' installed to compile Mono."
+ echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`automake' installed to compile Mono."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ NO_AUTOMAKE=yes
+}
+
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: Missing \`aclocal'. The version of \`automake'"
+ echo "installed doesn't appear recent enough."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+if test x$NOCONFIGURE = x && test -z "$*"; then
+ echo "**Warning**: I am going to run \`configure' with no arguments."
+ echo "If you wish to pass any to it, please specify them on the"
+ echo \`$0\'" command line."
+ echo
+fi
+
+case $CC in
+xlc )
+ am_opt=--include-deps;;
+esac
+
+
+if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
+ if test -z "$NO_LIBTOOLIZE" ; then
+ echo "Running libtoolize..."
+ ${LIBTOOL}ize --force --copy
+ fi
+fi
+
+echo "Running aclocal -I m4 $ACLOCAL_FLAGS ..."
+aclocal -I m4 $ACLOCAL_FLAGS || {
+ echo
+ echo "**Error**: aclocal failed. This may mean that you have not"
+ echo "installed all of the packages you need, or you may need to"
+ echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
+ echo "for the prefix where you installed the packages whose"
+ echo "macros were not found"
+ exit 1
+}
+
+if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
+ echo "Running autoheader..."
+ autoheader || { echo "**Error**: autoheader failed."; exit 1; }
+fi
+
+echo "Running automake --gnu $am_opt ..."
+automake --add-missing --gnu $am_opt ||
+ { echo "**Error**: automake failed."; exit 1; }
+echo "Running autoconf ..."
+autoconf || { echo "**Error**: autoconf failed."; exit 1; }
+
+
+conf_flags="--enable-maintainer-mode" #--enable-compile-warnings --enable-iso-c
+
+if test x$NOCONFIGURE = x; then
+ echo Running $srcdir/configure $conf_flags "$@" ...
+ $srcdir/configure $conf_flags "$@" \
+ && echo Now type \`make\' to compile $PKG_NAME || exit 1
+else
+ echo Skipping configure process.
+fi
diff --git a/deps/eglib/config.rpath b/deps/eglib/config.rpath
new file mode 100755
index 0000000..17298f2
--- /dev/null
+++ b/deps/eglib/config.rpath
@@ -0,0 +1,672 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+# Copyright 1996-2010 Free Software Foundation, Inc.
+# Taken from GNU libtool, 2001
+# Originally by Gordon Matzigkeit <gord gnu ai mit edu>, 1996
+#
+# 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.
+#
+# The first argument passed to this file is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+# than 256 bytes, otherwise the compiler driver will dump core. The only
+# known workaround is to choose shorter directory names for the build
+# directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's _LT_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+ wl='-Wl,'
+else
+ case "$host_os" in
+ aix*)
+ wl='-Wl,'
+ ;;
+ darwin*)
+ case $cc_basename in
+ xlc*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ wl='-Wl,'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ wl='-Wl,'
+ ;;
+ newsos6)
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ ecc*)
+ wl='-Wl,'
+ ;;
+ icc* | ifort*)
+ wl='-Wl,'
+ ;;
+ lf95*)
+ wl='-Wl,'
+ ;;
+ pgcc | pgf77 | pgf90)
+ wl='-Wl,'
+ ;;
+ ccc*)
+ wl='-Wl,'
+ ;;
+ como)
+ wl='-lopt='
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ osf3* | osf4* | osf5*)
+ wl='-Wl,'
+ ;;
+ rdos*)
+ ;;
+ solaris*)
+ wl='-Wl,'
+ ;;
+ sunos4*)
+ wl='-Qoption ld '
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ wl='-Wl,'
+ ;;
+ sysv4*MP*)
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ wl='-Wl,'
+ ;;
+ unicos*)
+ wl='-Wl,'
+ ;;
+ uts4*)
+ ;;
+ esac
+fi
+
+# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ # Unlike libtool, we use -rpath here, not --rpath, since the documented
+ # option of GNU ld is called -rpath, not --rpath.
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ case "$host_os" in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # Samuel A. Falvo II <kc5tja dolphin openprojects net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we cannot use
+ # them.
+ ld_shlibs=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ cygwin* | mingw* | pw32* | cegcc*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ gnu* | linux* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ netbsd*)
+ ;;
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+ sunos4*)
+ hardcode_direct=yes
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ if test "$ld_shlibs" = no; then
+ hardcode_libdir_flag_spec=
+ fi
+else
+ case "$host_os" in
+ aix3*)
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ else
+ aix_use_runtimelinking=no
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+ fi
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ fi
+ # Begin _LT_AC_SYS_LIBPATH_AIX.
+ echo 'int main () { return 0; }' > conftest.c
+ ${CC} ${LDFLAGS} conftest.c -o conftest
+ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0
*\(.*\)$/\1/; p; }
+}'`
+ if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0
*\(.*\)$/\1/; p; }
+}'`
+ fi
+ if test -z "$aix_libpath"; then
+ aix_libpath="/usr/lib:/lib"
+ fi
+ rm -f conftest.c conftest
+ # End _LT_AC_SYS_LIBPATH_AIX.
+ if test "$aix_use_runtimelinking" = yes; then
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ fi
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+ bsdi[45]*)
+ ;;
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ libext=lib
+ ;;
+ darwin* | rhapsody*)
+ hardcode_direct=no
+ if test "$GCC" = yes ; then
+ :
+ else
+ case $cc_basename in
+ xlc*)
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+ dgux*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+ freebsd2.2*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ freebsd2*)
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ freebsd* | dragonfly*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ hpux10*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+ hpux11*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ ;;
+ *)
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+ irix5* | irix6* | nonstopux*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ netbsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ newsos6)
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" =
"openbsd2.8-powerpc"; then
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ else
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ osf3*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ osf4* | osf5*)
+ if test "$GCC" = yes; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ # Both cc and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+ solaris*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ sunos4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ hardcode_direct=no
+ ;;
+ motorola)
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ ;;
+ sysv4.3*)
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ ld_shlibs=yes
+ fi
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator=':'
+ ;;
+ uts4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
+# only about the one the linker finds when passed -lNAME. This is the last
+# element of library_names_spec in libtool.m4, or possibly two of them if the
+# linker has special search rules.
+library_names_spec= # the last element of library_names_spec in libtool.m4
+libname_spec='lib$name'
+case "$host_os" in
+ aix3*)
+ library_names_spec='$libname.a'
+ ;;
+ aix[4-9]*)
+ library_names_spec='$libname$shrext'
+ ;;
+ amigaos*)
+ library_names_spec='$libname.a'
+ ;;
+ beos*)
+ library_names_spec='$libname$shrext'
+ ;;
+ bsdi[45]*)
+ library_names_spec='$libname$shrext'
+ ;;
+ cygwin* | mingw* | pw32* | cegcc*)
+ shrext=.dll
+ library_names_spec='$libname.dll.a $libname.lib'
+ ;;
+ darwin* | rhapsody*)
+ shrext=.dylib
+ library_names_spec='$libname$shrext'
+ ;;
+ dgux*)
+ library_names_spec='$libname$shrext'
+ ;;
+ freebsd1*)
+ ;;
+ freebsd* | dragonfly*)
+ case "$host_os" in
+ freebsd[123]*)
+ library_names_spec='$libname$shrext$versuffix' ;;
+ *)
+ library_names_spec='$libname$shrext' ;;
+ esac
+ ;;
+ gnu*)
+ library_names_spec='$libname$shrext'
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $host_cpu in
+ ia64*)
+ shrext=.so
+ ;;
+ hppa*64*)
+ shrext=.sl
+ ;;
+ *)
+ shrext=.sl
+ ;;
+ esac
+ library_names_spec='$libname$shrext'
+ ;;
+ interix[3-9]*)
+ library_names_spec='$libname$shrext'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ library_names_spec='$libname$shrext'
+ case "$host_os" in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+ *) libsuff= shlibsuff= ;;
+ esac
+ ;;
+ esac
+ ;;
+ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+ linux* | k*bsd*-gnu)
+ library_names_spec='$libname$shrext'
+ ;;
+ knetbsd*-gnu)
+ library_names_spec='$libname$shrext'
+ ;;
+ netbsd*)
+ library_names_spec='$libname$shrext'
+ ;;
+ newsos6)
+ library_names_spec='$libname$shrext'
+ ;;
+ nto-qnx*)
+ library_names_spec='$libname$shrext'
+ ;;
+ openbsd*)
+ library_names_spec='$libname$shrext$versuffix'
+ ;;
+ os2*)
+ libname_spec='$name'
+ shrext=.dll
+ library_names_spec='$libname.a'
+ ;;
+ osf3* | osf4* | osf5*)
+ library_names_spec='$libname$shrext'
+ ;;
+ rdos*)
+ ;;
+ solaris*)
+ library_names_spec='$libname$shrext'
+ ;;
+ sunos4*)
+ library_names_spec='$libname$shrext$versuffix'
+ ;;
+ sysv4 | sysv4.3*)
+ library_names_spec='$libname$shrext'
+ ;;
+ sysv4*MP*)
+ library_names_spec='$libname$shrext'
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ library_names_spec='$libname$shrext'
+ ;;
+ uts4*)
+ library_names_spec='$libname$shrext'
+ ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e
"$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Format of library name prefix.
+libname_spec="$escaped_libname_spec"
+
+# Library names that the linker finds when passed -lNAME.
+library_names_spec="$escaped_library_names_spec"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
diff --git a/deps/eglib/configure.ac b/deps/eglib/configure.ac
new file mode 100644
index 0000000..fdbce13
--- /dev/null
+++ b/deps/eglib/configure.ac
@@ -0,0 +1,268 @@
+#
+# Copyright 2012 Xamarin Inc
+#
+AC_INIT(eglib, [0.3],
+ [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
+
+AC_CONFIG_SRCDIR([README])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CANONICAL_SYSTEM
+AC_CANONICAL_HOST
+
+AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign])
+AC_CONFIG_HEADERS([config.h])
+AM_MAINTAINER_MODE
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AC_PROG_CC
+AM_PROG_LIBTOOL
+# Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
+DOLT
+GNUC_PRETTY=
+GNUC_UNUSED=
+BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
+if test x$GCC = xyes; then
+ GNUC_UNUSED='__attribute__((__unused__))'
+ GNUC_NORETURN='__attribute__((__noreturn__))'
+ case $host_cpu in
+ i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
+ esac
+fi
+AC_SUBST(GNUC_PRETTY)
+AC_SUBST(GNUC_UNUSED)
+AC_SUBST(GNUC_NORETURN)
+AC_SUBST(BREAKPOINT)
+
+# We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono
+# configure, because of autoconf brokeness
+if test "x$CPPFLAGS_FOR_EGLIB" != "x"; then
+ CPPFLAGS=$CPPFLAGS_FOR_EGLIB
+fi
+if test "x$CFLAGS_FOR_EGLIB" != "x"; then
+ CFLAGS=$CFLAGS_FOR_EGLIB
+fi
+
+CFLAGS="$CFLAGS -g -D_GNU_SOURCE"
+
+AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
+AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
+
+platform_darwin=no
+platform_android=no
+
+case $host in
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+ PATHSEP='\\'
+ SEARCHSEP=';'
+ OS="WIN32"
+ PIDTYPE='void *'
+ ;;
+*-*darwin*)
+ platform_darwin=yes
+ PATHSEP='/'
+ SEARCHSEP=':'
+ OS="UNIX"
+ PIDTYPE='int'
+ ;;
+*-*-linux-android*)
+ platform_android=yes
+ AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
+ PATHSEP='/'
+ SEARCHSEP=':'
+ OS="UNIX"
+ PIDTYPE='int'
+ ;;
+*)
+ PATHSEP='/'
+ SEARCHSEP=':'
+ OS="UNIX"
+ PIDTYPE='int'
+ ;;
+esac
+
+case $host in
+ *-*-solaris*)
+ CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+ ;;
+esac
+
+case $target in
+arm*-darwin*)
+ CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
+ ;;
+i*86-*-darwin*)
+ ORDER=G_LITTLE_ENDIAN
+ ;;
+*-*-openbsd*)
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ ;;
+esac
+
+target_osx=no
+target_ios=no
+
+if test "x$platform_darwin" = "xyes"; then
+ AC_TRY_COMPILE([#include "TargetConditionals.h"],[
+ #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
+ #error fail this for ios
+ #endif
+ return 0;
+ ], [
+ AC_DEFINE(TARGET_OSX,1,[The JIT/AOT targets OSX])
+ target_osx=yes
+ ], [
+ AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
+ target_ios=yes
+ ])
+ AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
+fi
+
+AC_SUBST(ORDER)
+AC_SUBST(CFLAGS)
+AC_SUBST(PATHSEP)
+AC_SUBST(SEARCHSEP)
+AC_SUBST(OS)
+AC_SUBST(PIDTYPE)
+AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
+AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
+AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
+AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
+
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(void *)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
+
+#
+# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
+# the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
+# removed once support for 10.6 is dropped.
+#
+# iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
+#
+if test x$target_osx = xyes; then
+AC_CHECK_FUNCS(getpwuid_r)
+elif test x$target_ios = xno; then
+AC_CHECK_FUNCS(strndup getpwuid_r)
+fi
+
+AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
+AM_ICONV()
+AC_SEARCH_LIBS(sqrtf, m)
+
+# nanosleep may not be part of libc, also search it in other libraries
+AC_SEARCH_LIBS(nanosleep, rt)
+
+AC_SEARCH_LIBS(dlopen, dl)
+old_ldflags="${LDFLAGS}"
+LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
+AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
+if test $found_export_dynamic = no; then
+ LDFLAGS="${old_ldflags}"
+fi
+
+AC_MSG_CHECKING(for varargs macros)
+AC_TRY_COMPILE([],[
+int foo (int i, int j);
+#define bar(...) foo (1, __VA_ARGS__)
+void main () {
+ bar (2);
+}
+],have_iso_varargs=yes,have_iso_varargs=no)
+AC_MSG_RESULT($have_iso_varargs)
+G_HAVE_ISO_VARARGS=0
+if test "x$have_iso_varargs" = "xyes"; then
+ G_HAVE_ISO_VARARGS=1
+fi
+AC_SUBST(G_HAVE_ISO_VARARGS)
+
+AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
+AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
+AC_SUBST(HAVE_ALLOCA_H)
+
+if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
+ GPOINTER_TO_INT="((gint) (ptr))"
+ GPOINTER_TO_UINT="((guint) (ptr))"
+ GINT_TO_POINTER="((gpointer) (v))"
+ GUINT_TO_POINTER="((gpointer) (v))"
+ GSIZE="int"
+ GSIZE_FORMAT='"u"'
+ G_GUINT64_FORMAT='"llu"'
+ G_GINT64_FORMAT='"lld"'
+ G_GUINT32_FORMAT='"lu"'
+ G_GINT32_FORMAT='"ld"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
+ GPOINTER_TO_INT="((gint)(long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(glong) (v))"
+ GUINT_TO_POINTER="((gpointer)(gulong) (v))"
+ GSIZE="long"
+ GSIZE_FORMAT='"lu"'
+ G_GUINT64_FORMAT='"lu"'
+ G_GINT64_FORMAT='"ld"'
+ G_GUINT32_FORMAT='"u"'
+ G_GINT32_FORMAT='"d"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
+ GPOINTER_TO_INT="((gint)(long long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(long long) (v))"
+ GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
+ GSIZE="long long"
+ GSIZE_FORMAT='"I64u"'
+ G_GUINT64_FORMAT='"I64u"'
+ G_GINT64_FORMAT='"I64i"'
+ G_GUINT32_FORMAT='"I32u"'
+ G_GINT32_FORMAT='"I32i"'
+else
+ AC_MSG_ERROR([unsupported pointer size])
+fi
+
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+pkg_config_path=
+AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir Change pkg-config dir to custom
dir],
+ if test x$with_crosspkgdir = "x"; then
+ if test -s $PKG_CONFIG_PATH; then
+ pkg_config_path=$PKG_CONFIG_PATH
+ fi
+ else
+ pkg_config_path=$with_crosspkgdir
+ PKG_CONFIG_PATH=$pkg_config_path
+ export PKG_CONFIG_PATH
+ fi
+)
+
+dnl
+dnl No, you can not replace the call below with a pkg.m4 macro
+dnl
+have_glib=false
+if test "x$PKG_CONFIG" != "xno"; then
+ if $PKG_CONFIG --atleast-version=$GLIB_REQUIRED_VERSION glib-2.0; then
+ have_glib=true;
+ else
+ have_glib=false;
+ fi
+fi
+AM_CONDITIONAL(HAVE_GLIB, $have_glib)
+
+AC_SUBST(GPOINTER_TO_INT)
+AC_SUBST(GPOINTER_TO_UINT)
+AC_SUBST(GINT_TO_POINTER)
+AC_SUBST(GUINT_TO_POINTER)
+AC_SUBST(GSIZE)
+AC_SUBST(GSIZE_FORMAT)
+AC_SUBST(G_GUINT64_FORMAT)
+AC_SUBST(G_GINT64_FORMAT)
+AC_SUBST(G_GUINT32_FORMAT)
+AC_SUBST(G_GINT32_FORMAT)
+
+AC_OUTPUT([
+Makefile
+m4/Makefile
+src/Makefile
+src/eglib-config.h
+test/Makefile
+])
diff --git a/deps/eglib/m4/.gitignore b/deps/eglib/m4/.gitignore
new file mode 100644
index 0000000..7a0b214
--- /dev/null
+++ b/deps/eglib/m4/.gitignore
@@ -0,0 +1,7 @@
+Makefile
+Makefile.in
+libtool.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+lt~obsolete.m4
diff --git a/deps/eglib/m4/Makefile.am b/deps/eglib/m4/Makefile.am
new file mode 100644
index 0000000..af864e3
--- /dev/null
+++ b/deps/eglib/m4/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = $(wildcard *.m4)
diff --git a/deps/eglib/m4/iconv.m4 b/deps/eglib/m4/iconv.m4
new file mode 100644
index 0000000..e2041b9
--- /dev/null
+++ b/deps/eglib/m4/iconv.m4
@@ -0,0 +1,214 @@
+# iconv.m4 serial 11 (gettext-0.18.1)
+dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+ dnl those with the standalone portable GNU libiconv installed).
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+ dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed libiconv and not disabled its use
+ dnl via --without-libiconv-prefix, he wants to use it. The first
+ dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+ am_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+ AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
+ am_cv_func_iconv="no, consider installing GNU libiconv"
+ am_cv_lib_iconv=no
+ AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+ [iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);],
+ [am_cv_func_iconv=yes])
+ if test "$am_cv_func_iconv" != yes; then
+ am_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBICONV"
+ AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+ [iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);],
+ [am_cv_lib_iconv=yes]
+ [am_cv_func_iconv=yes])
+ LIBS="$am_save_LIBS"
+ fi
+ ])
+ if test "$am_cv_func_iconv" = yes; then
+ AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
+ dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
+ am_save_LIBS="$LIBS"
+ if test $am_cv_lib_iconv = yes; then
+ LIBS="$LIBS $LIBICONV"
+ fi
+ AC_TRY_RUN([
+#include <iconv.h>
+#include <string.h>
+int main ()
+{
+ /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+ returns. */
+ {
+ iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+ if (cd_utf8_to_88591 != (iconv_t)(-1))
+ {
+ static const char input[] = "\342\202\254"; /* EURO SIGN */
+ char buf[10];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_utf8_to_88591,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res == 0)
+ return 1;
+ }
+ }
+ /* Test against Solaris 10 bug: Failures are not distinguishable from
+ successful returns. */
+ {
+ iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+ if (cd_ascii_to_88591 != (iconv_t)(-1))
+ {
+ static const char input[] = "\263";
+ char buf[10];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_ascii_to_88591,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res == 0)
+ return 1;
+ }
+ }
+#if 0 /* This bug could be worked around by the caller. */
+ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
+ {
+ iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+ if (cd_88591_to_utf8 != (iconv_t)(-1))
+ {
+ static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+ char buf[50];
+ const char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_88591_to_utf8,
+ (char **) &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if ((int)res > 0)
+ return 1;
+ }
+ }
+#endif
+ /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+ provided. */
+ if (/* Try standardized names. */
+ iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+ /* Try IRIX, OSF/1 names. */
+ && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+ /* Try AIX names. */
+ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+ /* Try HP-UX names. */
+ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+ return 1;
+ return 0;
+}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
+ [case "$host_os" in
+ aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+ *) am_cv_func_iconv_works="guessing yes" ;;
+ esac])
+ LIBS="$am_save_LIBS"
+ ])
+ case "$am_cv_func_iconv_works" in
+ *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+ *) am_func_iconv=yes ;;
+ esac
+ else
+ am_func_iconv=no am_cv_lib_iconv=no
+ fi
+ if test "$am_func_iconv" = yes; then
+ AC_DEFINE([HAVE_ICONV], [1],
+ [Define if you have the iconv() function and it works.])
+ fi
+ if test "$am_cv_lib_iconv" = yes; then
+ AC_MSG_CHECKING([how to link with libiconv])
+ AC_MSG_RESULT([$LIBICONV])
+ else
+ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+ dnl either.
+ CPPFLAGS="$am_save_CPPFLAGS"
+ LIBICONV=
+ LTLIBICONV=
+ fi
+ AC_SUBST([LIBICONV])
+ AC_SUBST([LTLIBICONV])
+])
+
+dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
+dnl avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+dnl This is tricky because of the way 'aclocal' is implemented:
+dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
+dnl Otherwise aclocal's initial scan pass would miss the macro definition.
+dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
+dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
+dnl warnings.
+m4_define([gl_iconv_AC_DEFUN],
+ m4_version_prereq([2.64],
+ [[AC_DEFUN_ONCE(
+ [$1], [$2])]],
+ [[AC_DEFUN(
+ [$1], [$2])]]))
+gl_iconv_AC_DEFUN([AM_ICONV],
+[
+ AM_ICONV_LINK
+ if test "$am_cv_func_iconv" = yes; then
+ AC_MSG_CHECKING([for iconv declaration])
+ AC_CACHE_VAL([am_cv_proto_iconv], [
+ AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
+ am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t
*inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+ am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+ AC_MSG_RESULT([
+ $am_cv_proto_iconv])
+ AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
+ [Define as const if the declaration of iconv() needs const.])
+ fi
+])
diff --git a/deps/eglib/m4/lib-ld.m4 b/deps/eglib/m4/lib-ld.m4
new file mode 100644
index 0000000..ebb3052
--- /dev/null
+++ b/deps/eglib/m4/lib-ld.m4
@@ -0,0 +1,110 @@
+# lib-ld.m4 serial 4 (gettext-0.18)
+dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
+dnl with libtool.m4.
+
+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ acl_cv_prog_gnu_ld=yes ;;
+*)
+ acl_cv_prog_gnu_ld=no ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-1.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]* | [A-Za-z]:[\\/]*)]
+ [re_direlt='/[^/][^/]*/\.\./']
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL([acl_cv_path_LD],
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ acl_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break ;;
+ *)
+ test "$with_gnu_ld" != yes && break ;;
+ esac
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT([$LD])
+else
+ AC_MSG_RESULT([no])
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])
diff --git a/deps/eglib/m4/lib-link.m4 b/deps/eglib/m4/lib-link.m4
new file mode 100644
index 0000000..c73bd8e
--- /dev/null
+++ b/deps/eglib/m4/lib-link.m4
@@ -0,0 +1,774 @@
+# lib-link.m4 serial 21 (gettext-0.18)
+dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_PREREQ([2.54])
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ pushdef([Name],[translit([$1],[./-], [___])])
+ pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+ ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+ ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+ ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
+ ])
+ LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+ INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+ LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ AC_SUBST([LIB]NAME[_PREFIX])
+ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+ dnl results of this search when this library appears as a dependency.
+ HAVE_LIB[]NAME=yes
+ popdef([NAME])
+ popdef([Name])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. The missing-message
+dnl defaults to 'no' and may contain additional hints for the user.
+dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
+dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ pushdef([Name],[translit([$1],[./-], [___])])
+ pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+
+ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed lib[]Name and not disabled its use
+ dnl via --without-lib[]Name-prefix, he wants to use it.
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+ ac_save_LIBS="$LIBS"
+ dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+ dnl because these -l options might require -L options that are present in
+ dnl LIBS. -l options benefit only from the -L options listed before it.
+ dnl Otherwise, add it to the front of LIBS, because it may be a static
+ dnl library that depends on another static library that is present in LIBS.
+ dnl Static libraries benefit only from the static libraries listed after
+ dnl it.
+ case " $LIB[]NAME" in
+ *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+ *) LIBS="$LIB[]NAME $LIBS" ;;
+ esac
+ AC_TRY_LINK([$3], [$4],
+ [ac_cv_lib[]Name=yes],
+ [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
+ LIBS="$ac_save_LIBS"
+ ])
+ if test "$ac_cv_lib[]Name" = yes; then
+ HAVE_LIB[]NAME=yes
+ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
+ AC_MSG_CHECKING([how to link with lib[]$1])
+ AC_MSG_RESULT([$LIB[]NAME])
+ else
+ HAVE_LIB[]NAME=no
+ dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+ dnl $INC[]NAME either.
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIB[]NAME=
+ LTLIB[]NAME=
+ LIB[]NAME[]_PREFIX=
+ fi
+ AC_SUBST([HAVE_LIB]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ AC_SUBST([LIB]NAME[_PREFIX])
+ popdef([NAME])
+ popdef([Name])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl acl_libext,
+dnl acl_shlibext,
+dnl acl_hardcode_libdir_flag_spec,
+dnl acl_hardcode_libdir_separator,
+dnl acl_hardcode_direct,
+dnl acl_hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+ dnl Tell automake >= 1.10 to complain if config.rpath is missing.
+ m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
+ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
+ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
+ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+ AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+ . ./conftest.sh
+ rm -f ./conftest.sh
+ acl_cv_rpath=done
+ ])
+ wl="$acl_cv_wl"
+ acl_libext="$acl_cv_libext"
+ acl_shlibext="$acl_cv_shlibext"
+ acl_libname_spec="$acl_cv_libname_spec"
+ acl_library_names_spec="$acl_cv_library_names_spec"
+ acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+ acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+ acl_hardcode_direct="$acl_cv_hardcode_direct"
+ acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+ dnl Determine whether the user wants rpath handling at all.
+ AC_ARG_ENABLE([rpath],
+ [ --disable-rpath do not hardcode runtime library paths],
+ :, enable_rpath=yes)
+])
+
+dnl AC_LIB_FROMPACKAGE(name, package)
+dnl declares that libname comes from the given package. The configure file
+dnl will then not have a --with-libname-prefix option but a
+dnl --with-package-prefix option. Several libraries can come from the same
+dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+dnl macro call that searches for libname.
+AC_DEFUN([AC_LIB_FROMPACKAGE],
+[
+ pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ define([acl_frompackage_]NAME, [$2])
+ popdef([NAME])
+ pushdef([PACK],[$2])
+ pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ define([acl_libsinpackage_]PACKUP,
+ m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
+ popdef([PACKUP])
+ popdef([PACK])
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
+ pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
+ dnl Autoconf >= 2.61 supports dots in --with options.
+
pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_ARG_WITH(P_A_C_K[-prefix],
+[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
+ --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ if test "$acl_libdirstem2" != "$acl_libdirstem" \
+ && ! test -d "$withval/$acl_libdirstem"; then
+ additional_libdir="$withval/$acl_libdirstem2"
+ fi
+ fi
+ fi
+])
+ dnl Search the library and its dependencies in $additional_libdir and
+ dnl $LDFLAGS. Using breadth-first-seach.
+ LIB[]NAME=
+ LTLIB[]NAME=
+ INC[]NAME=
+ LIB[]NAME[]_PREFIX=
+ dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+ dnl computed. So it has to be reset here.
+ HAVE_LIB[]NAME=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='$1 $2'
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+ dnl or AC_LIB_HAVE_LINKFLAGS call.
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+ else
+ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+ dnl that this library doesn't exist. So just drop it.
+ :
+ fi
+ else
+ dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+ dnl and the already constructed $LIBNAME/$LTLIBNAME.
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
+ if test -n "$acl_shlibext"; then
+ shrext=".$acl_shlibext" # typically: shrext=.so
+ else
+ shrext=
+ fi
+ if test $use_additional = yes; then
+ dir="$additional_libdir"
+ dnl The same code as in the loop below:
+ dnl First look for a shared library.
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ dnl Then look for a static library.
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ dnl First look for a shared library.
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ dnl Then look for a static library.
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ dnl Found the library.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ dnl Linking with a shared library. We attempt to hardcode its
+ dnl directory into the executable's runpath, unless it's the
+ dnl standard /usr/lib.
+ if test "$enable_rpath" = no \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+ dnl No hardcoding is needed.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ dnl The hardcoding into $LIBNAME is system dependent.
+ if test "$acl_hardcode_direct" = yes; then
+ dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+ dnl resulting binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ dnl Rely on "-L$found_dir".
+ dnl But don't add it if it's already contained in the LDFLAGS
+ dnl or the already constructed $LIBNAME
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+ fi
+ if test "$acl_hardcode_minus_L" != no; then
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
+ dnl here, because this doesn't fit in flags passed to the
+ dnl compiler. So give up. No hardcoding. This affects only
+ dnl very old systems.
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ dnl Linking with a static library.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+ else
+ dnl We shouldn't come here, but anyway it's good to have a
+ dnl fallback.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+ fi
+ fi
+ dnl Assume the include files are nearby.
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ if test "$name" = '$1'; then
+ LIB[]NAME[]_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ */$acl_libdirstem2 | */$acl_libdirstem2/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+ if test "$name" = '$1'; then
+ LIB[]NAME[]_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ dnl Potentially add $additional_includedir to $INCNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 3. if it's already present in $CPPFLAGS or the already
+ dnl constructed $INCNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INC[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $INCNAME.
+ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ dnl Look for dependencies.
+ if test -n "$found_la"; then
+ dnl Read the .la file. It defines the variables
+ dnl dlname, library_names, old_library, dependency_libs, current,
+ dnl age, revision, installed, dlopen, dlpreopen, libdir.
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ dnl We use only dependency_libs.
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 3. if it's already present in $LDFLAGS or the already
+ dnl constructed $LIBNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LIBNAME.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LTLIBNAME.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ dnl Handle this in the next round.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ dnl Handle this in the next round. Throw away the .la's
+ dnl directory; it is already contained in a preceding -L
+ dnl option.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e
's,\.la$,,'`
+ ;;
+ *)
+ dnl Most likely an immediate library name.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ dnl Didn't find the library; assume it is in the system directories
+ dnl known to the linker and runtime loader. (All the system
+ dnl directories known to the linker should also be known to the
+ dnl runtime loader, otherwise the system is severely misconfigured.)
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$acl_hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user must
+ dnl pass all path elements in one option. We can arrange that for a
+ dnl single library, but not when more than one $LIBNAMEs are used.
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+ done
+ dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ dnl When using libtool, the option that works for both libraries and
+ dnl executables is -R. The -R options are cumulative.
+ for found_dir in $ltrpathdirs; do
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+ done
+ fi
+ popdef([P_A_C_K])
+ popdef([PACKLIBS])
+ popdef([PACKUP])
+ popdef([PACK])
+ popdef([NAME])
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+ for element in [$2]; do
+ haveit=
+ for x in $[$1]; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ [$1]="${[$1]}${[$1]:+ }$element"
+ fi
+ done
+])
+
+dnl For those cases where a variable contains several -L and -l options
+dnl referring to unknown libraries and directories, this macro determines the
+dnl necessary additional linker options for the runtime path.
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
+dnl otherwise linking without libtool is assumed.
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+[
+ AC_REQUIRE([AC_LIB_RPATH])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ $1=
+ if test "$enable_rpath" != no; then
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode directories into the resulting
+ dnl binary.
+ rpathdirs=
+ next=
+ for opt in $2; do
+ if test -n "$next"; then
+ dir="$next"
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem" \
+ && test "X$dir" != "X/usr/$acl_libdirstem2"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next=
+ else
+ case $opt in
+ -L) next=yes ;;
+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem" \
+ && test "X$dir" != "X/usr/$acl_libdirstem2"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next= ;;
+ *) next= ;;
+ esac
+ fi
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n ""$3""; then
+ dnl libtool is used for linking. Use -R options.
+ for dir in $rpathdirs; do
+ $1="${$1}${$1:+ }-R$dir"
+ done
+ else
+ dnl The linker is used for linking directly.
+ if test -n "$acl_hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user
+ dnl must pass all path elements in one option.
+ alldirs=
+ for dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="${$1}${$1:+ }$flag"
+ done
+ fi
+ fi
+ fi
+ fi
+ fi
+ AC_SUBST([$1])
+])
diff --git a/deps/eglib/m4/lib-prefix.m4 b/deps/eglib/m4/lib-prefix.m4
new file mode 100644
index 0000000..1601cea
--- /dev/null
+++ b/deps/eglib/m4/lib-prefix.m4
@@ -0,0 +1,224 @@
+# lib-prefix.m4 serial 7 (gettext-0.18)
+dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+ AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_LIB_ARG_WITH([lib-prefix],
+[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+ --without-lib-prefix don't search for libraries in includedir and libdir],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ if test $use_additional = yes; then
+ dnl Potentially add $additional_includedir to $CPPFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's already present in $CPPFLAGS,
+ dnl 3. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ for x in $CPPFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $CPPFLAGS.
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ dnl Potentially add $additional_libdir to $LDFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's already present in $LDFLAGS,
+ dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ for x in $LDFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux*) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LDFLAGS.
+ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+ dnl Unfortunately, prefix and exec_prefix get only finally determined
+ dnl at the end of configure.
+ if test "X$prefix" = "XNONE"; then
+ acl_final_prefix="$ac_default_prefix"
+ else
+ acl_final_prefix="$prefix"
+ fi
+ if test "X$exec_prefix" = "XNONE"; then
+ acl_final_exec_prefix='${prefix}'
+ else
+ acl_final_exec_prefix="$exec_prefix"
+ fi
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ $1
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates
+dnl - a variable acl_libdirstem, containing the basename of the libdir, either
+dnl "lib" or "lib64" or "lib/64",
+dnl - a variable acl_libdirstem2, as a secondary possible value for
+dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
+dnl "lib/amd64".
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+ dnl There is no formal standard regarding lib and lib64.
+ dnl On glibc systems, the current practice is that on a system supporting
+ dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+ dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
+ dnl the compiler's default mode by looking at the compiler's library search
+ dnl path. If at least one of its elements ends in /lib64 or points to a
+ dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
+ dnl Otherwise we use the default, namely "lib".
+ dnl On Solaris systems, the current practice is that on a system supporting
+ dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+ dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
+ dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ acl_libdirstem=lib
+ acl_libdirstem2=
+ case "$host_os" in
+ solaris*)
+ dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development
Environment
+ dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
+ dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
+ dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
+ dnl symlink is missing, so we set acl_libdirstem2 too.
+ AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
+ [AC_EGREP_CPP([sixtyfour bits], [
+#ifdef _LP64
+sixtyfour bits
+#endif
+ ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
+ ])
+ if test $gl_cv_solaris_64bit = yes; then
+ acl_libdirstem=lib/64
+ case "$host_cpu" in
+ sparc*) acl_libdirstem2=lib/sparcv9 ;;
+ i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
+ esac
+ fi
+ ;;
+ *)
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e
's,^=,,'`
+ if test -n "$searchpath"; then
+ acl_save_IFS="${IFS= }"; IFS=":"
+ for searchdir in $searchpath; do
+ if test -d "$searchdir"; then
+ case "$searchdir" in
+ */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+ */../ | */.. )
+ # Better ignore directories of this form. They are misleading.
+ ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib64 ) acl_libdirstem=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ fi
+ ;;
+ esac
+ test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
+])
diff --git a/deps/eglib/src/.gitignore b/deps/eglib/src/.gitignore
new file mode 100644
index 0000000..6635df1
--- /dev/null
+++ b/deps/eglib/src/.gitignore
@@ -0,0 +1,11 @@
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/*.lo
+/*.la
+/*.o
+/semantic.cache
+/.project
+/.cproject
+/eglib-config.h
diff --git a/deps/eglib/src/Makefile.am b/deps/eglib/src/Makefile.am
new file mode 100644
index 0000000..2efca84
--- /dev/null
+++ b/deps/eglib/src/Makefile.am
@@ -0,0 +1,85 @@
+noinst_LTLIBRARIES = libeglib.la libeglib-static.la
+
+win_files = \
+ eglib-config.hw \
+ gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
+ gmodule-win32.c gtimer-win32.c
+
+unix_files = \
+ gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \
+ gmodule-unix.c gtimer-unix.c
+
+# some unices and windows do not have an implementation of vasprintf
+# used by eglib, use provided implementation instead
+if NEED_VASPRINTF
+vasprintf_files = vasprintf.c
+else
+vaprinttf_files = foo.c
+endif
+
+if HOST_WIN32
+os_files = $(win_files)
+else
+os_files = $(unix_files)
+endif
+
+libeglib_la_SOURCES = \
+ sort.frag.h \
+ glib.h \
+ gdebugkey.c \
+ gquark.c \
+ garray.c \
+ gbytearray.c \
+ gerror.c \
+ ghashtable.c \
+ giconv.c \
+ gmem.c \
+ gmodule.h \
+ goutput.c \
+ gqsort.c \
+ gstr.c \
+ gslist.c \
+ gstring.c \
+ gptrarray.c \
+ glist.c \
+ ghooklist.c \
+ gqueue.c \
+ gpath.c \
+ gshell.c \
+ gspawn.c \
+ gfile.c \
+ gfile-posix.c \
+ gpattern.c \
+ gmarkup.c \
+ gutf8.c \
+ gunicode.c \
+ unicode-data.h \
+ $(os_files) \
+ $(vasprintf_files)
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -I$(srcdir) \
+ -Wall \
+ $(NULL)
+
+#libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
+#libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
+libeglib_static_la_SOURCES=$(libeglib_la_SOURCES)
+libeglib_static_la_CFLAGS = $(libeglib_la_CFLAGS)
+
+if HOST_WIN32
+libeglib_la_LIBADD = -lm $(LIBICONV) -lpsapi
+else
+if PLATFORM_ANDROID
+libeglib_la_LIBADD = -llog
+endif
+endif
+
+libeglib_static_la_LIBADD = $(libeglib_la_LIBADD) $(LIBICONV)
+libeglib_static_la_LDFLAGS = -static
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = eglib-config.h.in $(win_files) $(unix_files)
diff --git a/deps/eglib/src/eglib-config.h.in b/deps/eglib/src/eglib-config.h.in
new file mode 100644
index 0000000..ba0f93f
--- /dev/null
+++ b/deps/eglib/src/eglib-config.h.in
@@ -0,0 +1,46 @@
+#ifndef __EGLIB_CONFIG_H
+#define __EGLIB_CONFIG_H
+
+/*
+ * System-dependent settings
+ */
+#define G_GNUC_PRETTY_FUNCTION @GNUC_PRETTY@
+#define G_GNUC_UNUSED @GNUC_UNUSED@
+#define G_BYTE_ORDER @ORDER@
+#define G_GNUC_NORETURN @GNUC_NORETURN@
+#define G_SEARCHPATH_SEPARATOR_S "@SEARCHSEP@"
+#define G_SEARCHPATH_SEPARATOR '@SEARCHSEP@'
+#define G_DIR_SEPARATOR '@PATHSEP@'
+#define G_DIR_SEPARATOR_S "@PATHSEP@"
+#define G_BREAKPOINT() @BREAKPOINT@
+#define G_OS_ OS@
+#define GPOINTER_TO_INT(ptr) @GPOINTER_TO_INT@
+#define GPOINTER_TO_UINT(ptr) @GPOINTER_TO_UINT@
+#define GINT_TO_POINTER(v) @GINT_TO_POINTER@
+#define GUINT_TO_POINTER(v) @GUINT_TO_POINTER@
+
+#if @HAVE_ALLOCA_H@ == 1
+#define G_HAVE_ALLOCA_H
+#endif
+
+typedef unsigned @GSIZE@ gsize;
+typedef signed @GSIZE@ gssize;
+
+#define G_GSIZE_FORMAT @GSIZE_FORMAT@
+#define G_GUINT64_FORMAT @G_GUINT64_FORMAT@
+#define G_GINT64_FORMAT @G_GINT64_FORMAT@
+#define G_GUINT32_FORMAT @G_GUINT32_FORMAT@
+#define G_GINT32_FORMAT @G_GINT32_FORMAT@
+
+#if @G_HAVE_ISO_VARARGS@ == 1
+#define G_HAVE_ISO_VARARGS
+#endif
+
+#if defined (__native_client__)
+#undef G_BREAKPOINT
+#define G_BREAKPOINT()
+#endif
+
+typedef @PIDTYPE@ GPid;
+
+#endif
diff --git a/deps/eglib/src/eglib-config.hw b/deps/eglib/src/eglib-config.hw
new file mode 100644
index 0000000..192d393
--- /dev/null
+++ b/deps/eglib/src/eglib-config.hw
@@ -0,0 +1,76 @@
+#ifndef __EGLIB_CONFIG_H
+#define __EGLIB_CONFIG_H
+
+/*
+ * System-dependent settings
+ */
+#define G_OS_WIN32 1
+
+#ifdef _MSC_VER
+
+#include <io.h>
+
+#define G_GNUC_PRETTY_FUNCTION __FUNCTION__
+#define G_GNUC_UNUSED
+#define G_BYTE_ORDER 1234
+#define G_GNUC_NORETURN
+#define G_BREAKPOINT() __debugbreak()
+#define MAXPATHLEN 242
+
+typedef uintptr_t gsize;
+typedef intptr_t gssize;
+typedef int pid_t;
+
+#define G_DIR_SEPARATOR '\\'
+#define G_DIR_SEPARATOR_S "\\"
+#define G_SEARCHPATH_SEPARATOR_S ";"
+#define G_SEARCHPATH_SEPARATOR ';'
+#define G_GSIZE_FORMAT "d"
+#define G_GUINT64_FORMAT "d"
+#define G_GINT64_FORMAT "d"
+#define GPOINTER_TO_INT(ptr) ((gint)(intptr_t) (ptr))
+#define GPOINTER_TO_UINT(ptr) ((guint)(intptr_t) (ptr))
+#define GINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
+#define GUINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
+
+/* VS 2010 and later have stdint.h */
+#if defined(_MSC_VER) && _MSC_VER < 1600
+#define INT32_MAX 2147483647
+#define INT32_MIN (~ INT32_MAX)
+#define INT64_MAX 9223372036854775807i64
+#define INT64_MIN (~INT64_MAX)
+#define UINT32_MAX 0xffffffffU
+#define UINT64_MAX 0xffffffffffffffffULL
+#endif
+
+#define STDOUT_FILENO (int)(intptr_t)stdout
+#define STDERR_FILENO (int)(intptr_t)stderr
+
+
+/* FIXME: what should this be ?*/
+#define X_OK 4 /* This is really read */
+#define WNOHANG 1
+#define F_SETFD 1
+#define FD_CLOEXEC 1
+
+#undef inline
+#define inline __inline
+
+#define strtok_r strtok_s
+
+#undef G_HAVE_UNISTD_H
+#undef G_HAVE_SYS_TIME_H
+#undef G_HAVE_SYS_WAIT_H
+#undef G_HAVE_PWD_H
+#undef G_HAVE_STRNDUP
+#define G_HAVE_GETOPT_H 1
+
+/* disable the following warnings
+ * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is
ignored.
+ * C4127: conditional expression is constant
+*/
+#pragma warning(disable:4100 4127)
+#endif
+
+typedef void * GPid;
+#endif
diff --git a/deps/eglib/src/garray.c b/deps/eglib/src/garray.c
new file mode 100644
index 0000000..a1c0761
--- /dev/null
+++ b/deps/eglib/src/garray.c
@@ -0,0 +1,242 @@
+/*
+ * Arrays
+ *
+ * Author:
+ * Chris Toshok (toshok novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <glib.h>
+
+#define INITIAL_CAPACITY 16
+
+#define element_offset(p,i) ((p)->array.data + (i) * (p)->element_size)
+#define element_length(p,i) ((i) * (p)->element_size)
+
+typedef struct {
+ GArray array;
+ gboolean clear_;
+ guint element_size;
+ gboolean zero_terminated;
+ guint capacity;
+} GArrayPriv;
+
+static void
+ensure_capacity (GArrayPriv *priv, guint capacity)
+{
+ guint new_capacity;
+
+ if (capacity <= priv->capacity)
+ return;
+
+ new_capacity = (capacity + 63) & ~63;
+
+ priv->array.data = g_realloc (priv->array.data, element_length (priv, new_capacity));
+
+ if (priv->clear_) {
+ memset (element_offset (priv, priv->capacity),
+ 0,
+ element_length (priv, new_capacity - priv->capacity));
+ }
+
+ priv->capacity = new_capacity;
+}
+
+GArray *
+g_array_new (gboolean zero_terminated,
+ gboolean clear_,
+ guint element_size)
+{
+ GArrayPriv *rv = g_new0 (GArrayPriv, 1);
+ rv->zero_terminated = zero_terminated;
+ rv->clear_ = clear_;
+ rv->element_size = element_size;
+
+ ensure_capacity (rv, INITIAL_CAPACITY);
+
+ return (GArray*)rv;
+}
+
+GArray *
+g_array_sized_new (gboolean zero_terminated,
+ gboolean clear_,
+ guint element_size,
+ guint reserved_size)
+{
+ GArrayPriv *rv = g_new0 (GArrayPriv, 1);
+ rv->zero_terminated = zero_terminated;
+ rv->clear_ = clear_;
+ rv->element_size = element_size;
+
+ ensure_capacity (rv, reserved_size);
+
+ return (GArray*)rv;
+}
+
+gchar*
+g_array_free (GArray *array,
+ gboolean free_segment)
+{
+ gchar* rv = NULL;
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ if (free_segment)
+ g_free (array->data);
+ else
+ rv = array->data;
+
+ g_free (array);
+
+ return rv;
+}
+
+GArray *
+g_array_append_vals (GArray *array,
+ gconstpointer data,
+ guint len)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ ensure_capacity (priv, priv->array.len + len + (priv->zero_terminated ? 1 : 0));
+
+ memmove (element_offset (priv, priv->array.len),
+ data,
+ element_length (priv, len));
+
+ priv->array.len += len;
+
+ if (priv->zero_terminated) {
+ memset (element_offset (priv, priv->array.len),
+ 0,
+ priv->element_size);
+ }
+
+ return array;
+}
+
+GArray*
+g_array_insert_vals (GArray *array,
+ guint index_,
+ gconstpointer data,
+ guint len)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+ guint extra = (priv->zero_terminated ? 1 : 0);
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ ensure_capacity (priv, array->len + len + extra);
+
+ /* first move the existing elements out of the way */
+ memmove (element_offset (priv, index_ + len),
+ element_offset (priv, index_),
+ element_length (priv, array->len - index_));
+
+ /* then copy the new elements into the array */
+ memmove (element_offset (priv, index_),
+ data,
+ element_length (priv, len));
+
+ array->len += len;
+
+ if (priv->zero_terminated) {
+ memset (element_offset (priv, priv->array.len),
+ 0,
+ priv->element_size);
+ }
+
+ return array;
+}
+
+GArray*
+g_array_remove_index (GArray *array,
+ guint index_)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ memmove (element_offset (priv, index_),
+ element_offset (priv, index_ + 1),
+ element_length (priv, array->len - index_));
+
+ array->len --;
+
+ if (priv->zero_terminated) {
+ memset (element_offset (priv, priv->array.len),
+ 0,
+ priv->element_size);
+ }
+
+ return array;
+}
+
+GArray*
+g_array_remove_index_fast (GArray *array,
+ guint index_)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ memmove (element_offset (priv, index_),
+ element_offset (priv, array->len - 1),
+ element_length (priv, 1));
+
+ array->len --;
+
+ if (priv->zero_terminated) {
+ memset (element_offset (priv, priv->array.len),
+ 0,
+ priv->element_size);
+ }
+
+ return array;
+}
+
+GArray *
+g_array_set_size (GArray *array, gint length)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+
+ g_return_val_if_fail (array != NULL, NULL);
+ g_return_val_if_fail (length >= 0, NULL);
+
+ if (length == priv->capacity)
+ return array; // nothing to be done
+
+ if (length > priv->capacity) {
+ // grow the array
+ ensure_capacity (priv, length);
+ }
+
+ array->len = length;
+
+ return array;
+}
diff --git a/deps/eglib/src/gbytearray.c b/deps/eglib/src/gbytearray.c
new file mode 100644
index 0000000..837e15e
--- /dev/null
+++ b/deps/eglib/src/gbytearray.c
@@ -0,0 +1,62 @@
+/*
+ * Arrays
+ *
+ * Author:
+ * Geoff Norton (gnorton novell com)
+ *
+ * (C) 2010 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <glib.h>
+
+GByteArray *
+g_byte_array_new ()
+{
+ return (GByteArray *) g_array_new (FALSE, TRUE, 1);
+}
+
+guint8*
+g_byte_array_free (GByteArray *array,
+ gboolean free_segment)
+{
+ return (guint8*) g_array_free ((GArray *)array, free_segment);
+}
+
+GByteArray *
+g_byte_array_append (GByteArray *array,
+ const guint8 *data,
+ guint len)
+{
+ return (GByteArray *)g_array_append_vals ((GArray *)array, data, len);
+}
+
+GByteArray *
+g_byte_array_set_size (GByteArray *array,
+ guint len)
+{
+ g_array_set_size ((GArray*)array, len);
+ return array;
+}
diff --git a/deps/eglib/src/gdate-unix.c b/deps/eglib/src/gdate-unix.c
new file mode 100644
index 0000000..5d3dfc8
--- /dev/null
+++ b/deps/eglib/src/gdate-unix.c
@@ -0,0 +1,58 @@
+/*
+ * gdate-unix.c: Date and time utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <glib.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/time.h>
+
+void
+g_get_current_time (GTimeVal *result)
+{
+ struct timeval tv;
+
+ g_return_if_fail (result != NULL);
+ gettimeofday (&tv, NULL);
+ result->tv_sec = tv.tv_sec;
+ result->tv_usec = tv.tv_usec;
+}
+
+void
+g_usleep (gulong microseconds)
+{
+ struct timespec req, rem;
+
+ req.tv_sec = microseconds / 1000000;
+ req.tv_nsec = (microseconds % 1000000) * 1000;
+
+ while (nanosleep (&req, &rem) == -1 && errno == EINTR)
+ req = rem;
+}
diff --git a/deps/eglib/src/gdate-win32.c b/deps/eglib/src/gdate-win32.c
new file mode 100644
index 0000000..2b21698
--- /dev/null
+++ b/deps/eglib/src/gdate-win32.c
@@ -0,0 +1,52 @@
+/*
+ * gdate-win32.c: Date and time utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <glib.h>
+
+#include <winsock2.h>
+
+void
+g_get_current_time (GTimeVal *result)
+{
+ long int l;
+
+ g_return_if_fail (result != NULL);
+ l = GetTickCount();
+
+ result->tv_sec = l / 1000;
+ result->tv_usec = (l % 1000) * 1000;
+}
+
+void
+g_usleep (gulong microseconds)
+{
+ Sleep (microseconds/1000);
+}
diff --git a/deps/eglib/src/gdebugkey.c b/deps/eglib/src/gdebugkey.c
new file mode 100644
index 0000000..0cf79d4
--- /dev/null
+++ b/deps/eglib/src/gdebugkey.c
@@ -0,0 +1,71 @@
+/*
+ * ghooklist.c: API for manipulating a list of hook functions
+ *
+ * Copyright (C) 2014 Intel Corporation.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Robert Bragg <robert linux intel com>
+ */
+
+#include <config.h>
+
+#include <glib.h>
+
+guint
+g_parse_debug_string (const gchar *string,
+ const GDebugKey *keys,
+ guint nkeys)
+{
+ char **strv = g_strsplit_set (string, ":;, \t", 0);
+ gboolean needs_invert = FALSE;
+ guint value = 0;
+ int i;
+
+ if (strcasecmp (string, "help") == 0)
+ {
+ g_printerr ("Supported debug keys:\n");
+ for (i = 0; strv[i]; i++)
+ {
+ g_printerr (" %s:\n", keys[i].key);
+ }
+ g_printerr (" all\n");
+ g_printerr (" help\n");
+ }
+
+ for (i = 0; strv[i]; i++)
+ {
+ int j;
+
+ for (j = 0; j < nkeys; j++)
+ if (strcasecmp (keys[j].key, strv[i]) == 0)
+ value |= keys[j].value;
+ else if (strcasecmp (keys[j].key, "all") == 0)
+ needs_invert = TRUE;
+ }
+
+ if (needs_invert)
+ value = value ^ (~0);
+
+ g_strfreev (strv);
+
+ return value;
+}
diff --git a/deps/eglib/src/gdir-unix.c b/deps/eglib/src/gdir-unix.c
new file mode 100644
index 0000000..5dfb275
--- /dev/null
+++ b/deps/eglib/src/gdir-unix.c
@@ -0,0 +1,151 @@
+/*
+ * Directory utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dirent.h>
+
+struct _GDir {
+ DIR *dir;
+#ifndef HAVE_REWINDDIR
+ char *path;
+#endif
+};
+
+GDir *
+g_dir_open (const gchar *path, guint flags, GError **error)
+{
+ GDir *dir;
+
+ g_return_val_if_fail (path != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ (void) flags; /* this is not used */
+ dir = g_new (GDir, 1);
+ dir->dir = opendir (path);
+ if (dir->dir == NULL) {
+ if (error) {
+ gint err = errno;
+ *error = g_error_new (G_FILE_ERROR,
+ g_file_error_from_errno (err),
+ g_strerror (err));
+ }
+ g_free (dir);
+ return NULL;
+ }
+#ifndef HAVE_REWINDDIR
+ dir->path = g_strdup (path);
+#endif
+ return dir;
+}
+
+const gchar *
+g_dir_read_name (GDir *dir)
+{
+ struct dirent *entry;
+
+ g_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
+ do {
+ entry = readdir (dir->dir);
+ if (entry == NULL)
+ return NULL;
+ } while ((strcmp (entry->d_name, ".") == 0) || (strcmp (entry->d_name, "..") == 0));
+
+ return entry->d_name;
+}
+
+void
+g_dir_rewind (GDir *dir)
+{
+ g_return_if_fail (dir != NULL && dir->dir != NULL);
+#ifndef HAVE_REWINDDIR
+ closedir (dir->dir);
+ dir->dir = opendir (dir->path);
+#else
+ rewinddir (dir->dir);
+#endif
+}
+
+void
+g_dir_close (GDir *dir)
+{
+ g_return_if_fail (dir != NULL && dir->dir != 0);
+ closedir (dir->dir);
+#ifndef HAVE_REWINDDIR
+ g_free (dir->path);
+#endif
+ dir->dir = NULL;
+ g_free (dir);
+}
+
+int
+g_mkdir_with_parents (const gchar *pathname, int mode)
+{
+ char *path, *d;
+ int rv;
+
+ if (!pathname || *pathname == '\0') {
+ errno = EINVAL;
+ return -1;
+ }
+
+ d = path = g_strdup (pathname);
+ if (*d == '/')
+ d++;
+
+ while (TRUE) {
+ if (*d == '/' || *d == '\0') {
+ char orig = *d;
+ *d = '\0';
+ rv = mkdir (path, mode);
+ if (rv == -1 && errno != EEXIST) {
+ g_free (path);
+ return -1;
+ }
+
+ *d++ = orig;
+ while (orig == '/' && *d == '/')
+ d++;
+ if (orig == '\0')
+ break;
+ } else {
+ d++;
+ }
+ }
+
+ g_free (path);
+
+ return 0;
+}
diff --git a/deps/eglib/src/gdir-win32.c b/deps/eglib/src/gdir-win32.c
new file mode 100644
index 0000000..1d61e34
--- /dev/null
+++ b/deps/eglib/src/gdir-win32.c
@@ -0,0 +1,148 @@
+/*
+ * Directory utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <io.h>
+
+#include <winsock2.h>
+
+struct _GDir {
+ HANDLE handle;
+ gchar* current;
+ gchar* next;
+};
+
+GDir *
+g_dir_open (const gchar *path, guint flags, GError **error)
+{
+ GDir *dir;
+ gunichar2* path_utf16;
+ gunichar2* path_utf16_search;
+ WIN32_FIND_DATAW find_data;
+
+ g_return_val_if_fail (path != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ dir = g_new0 (GDir, 1);
+ path_utf16 = u8to16 (path);
+ path_utf16_search = g_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(gunichar2));
+ wcscpy (path_utf16_search, path_utf16);
+ wcscat (path_utf16_search, L"\\*");
+
+ dir->handle = FindFirstFileW (path_utf16_search, &find_data);
+ if (dir->handle == INVALID_HANDLE_VALUE) {
+ if (error) {
+ gint err = errno;
+ *error = g_error_new (G_FILE_ERROR,
+ g_file_error_from_errno (err),
+ g_strerror (err));
+ }
+ g_free (path_utf16_search);
+ g_free (path_utf16);
+ g_free (dir);
+ return NULL;
+ }
+ g_free (path_utf16_search);
+ g_free (path_utf16);
+
+ while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *)
find_data.cFileName, L"..") == 0)) {
+ if (!FindNextFileW (dir->handle, &find_data)) {
+ if (error) {
+ gint err = errno;
+ *error = g_error_new (G_FILE_ERROR,
+ g_file_error_from_errno (err),
+ g_strerror (err));
+ }
+ g_free (dir);
+ return NULL;
+ }
+ }
+
+ dir->current = NULL;
+ dir->next = u16to8 (find_data.cFileName);
+ return dir;
+}
+
+const gchar *
+g_dir_read_name (GDir *dir)
+{
+ WIN32_FIND_DATAW find_data;
+
+ g_return_val_if_fail (dir != NULL && dir->handle != 0, NULL);
+
+ if (dir->current)
+ g_free (dir->current);
+ dir->current = NULL;
+
+ dir->current = dir->next;
+
+ if (!dir->current)
+ return NULL;
+
+ dir->next = NULL;
+
+ do {
+ if (!FindNextFileW (dir->handle, &find_data)) {
+ dir->next = NULL;
+ return dir->current;
+ }
+ } while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *)
find_data.cFileName, L"..") == 0));
+
+ dir->next = u16to8 (find_data.cFileName);
+ return dir->current;
+}
+
+void
+g_dir_rewind (GDir *dir)
+{
+}
+
+void
+g_dir_close (GDir *dir)
+{
+ g_return_if_fail (dir != NULL && dir->handle != 0);
+
+ if (dir->current)
+ g_free (dir->current);
+ dir->current = NULL;
+ if (dir->next)
+ g_free (dir->next);
+ dir->next = NULL;
+ FindClose (dir->handle);
+ dir->handle = 0;
+ g_free (dir);
+}
+
+
diff --git a/deps/eglib/src/gerror.c b/deps/eglib/src/gerror.c
new file mode 100644
index 0000000..927bb16
--- /dev/null
+++ b/deps/eglib/src/gerror.c
@@ -0,0 +1,127 @@
+/*
+ * gerror.c: Error support.
+ *
+ * Author:
+ * Miguel de Icaza (miguel novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <glib.h>
+
+GError *
+g_error_new (GQuark domain, gint code, const char *format, ...)
+{
+ va_list args;
+ GError *err = g_new (GError, 1);
+
+ err->domain = domain;
+ err->code = code;
+
+ va_start (args, format);
+ if (vasprintf (&err->message, format, args) == -1)
+ err->message = g_strdup_printf ("internal: invalid format string %s", format);
+ va_end (args);
+
+ return err;
+}
+
+GError *
+g_error_new_valist (GQuark domain, gint code, const char *format, va_list ap)
+{
+ GError *err = g_new (GError, 1);
+
+ err->domain = domain;
+ err->code = code;
+
+ err->message = g_strdup_vprintf (format, ap);
+
+ return err;
+}
+
+void
+g_clear_error (GError **error)
+{
+ if (error && *error) {
+ g_error_free (*error);
+ *error = NULL;
+ }
+}
+
+void
+g_error_free (GError *error)
+{
+ g_return_if_fail (error != NULL);
+
+ g_free (error->message);
+ g_free (error);
+}
+
+void
+g_set_error (GError **err, GQuark domain, gint code, const gchar *format, ...)
+{
+ va_list args;
+
+ if (err) {
+ va_start (args, format);
+ *err = g_error_new_valist (domain, code, format, args);
+ va_end (args);
+ }
+}
+
+void
+g_propagate_error (GError **dest, GError *src)
+{
+ if (dest == NULL) {
+ if (src)
+ g_error_free (src);
+ } else {
+ *dest = src;
+ }
+}
+
+GError *
+g_error_copy (const GError *error)
+{
+ GError *copy = g_new (GError, 1);
+ copy->domain = error->domain;
+ copy->code = error->code;
+ copy->message = g_strdup (error->message);
+ return copy;
+}
+
+gboolean
+g_error_matches (const GError *error, GQuark domain, gint code)
+{
+ if (error)
+ {
+ if (error->domain == domain && error->code == code)
+ return TRUE;
+ return FALSE;
+ }
+ else
+ return FALSE;
+}
diff --git a/deps/eglib/src/gfile-posix.c b/deps/eglib/src/gfile-posix.c
new file mode 100644
index 0000000..fdc8982
--- /dev/null
+++ b/deps/eglib/src/gfile-posix.c
@@ -0,0 +1,200 @@
+/*
+ * File utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#include <errno.h>
+
+#ifdef _MSC_VER
+#include <direct.h>
+#endif
+#ifdef G_OS_WIN32
+int mkstemp (char *tmp_template);
+#endif
+
+#ifndef O_LARGEFILE
+#define OPEN_FLAGS (O_RDONLY)
+#else
+#define OPEN_FLAGS (O_RDONLY | O_LARGEFILE)
+#endif
+gboolean
+g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error)
+{
+ gchar *str;
+ int fd;
+ struct stat st;
+ long offset;
+ int nread;
+
+ g_return_val_if_fail (filename != NULL, FALSE);
+ g_return_val_if_fail (contents != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ *contents = NULL;
+ if (length)
+ *length = 0;
+
+ fd = open (filename, OPEN_FLAGS);
+ if (fd == -1) {
+ if (error != NULL) {
+ int err = errno;
+ *error = g_error_new (G_FILE_ERROR,
+ g_file_error_from_errno (err),
+ "Error opening file '%s': %s",
+ filename,
+ g_strerror (err));
+ }
+ return FALSE;
+ }
+
+ if (fstat (fd, &st) != 0) {
+ if (error != NULL) {
+ int err = errno;
+ *error = g_error_new (G_FILE_ERROR,
+ g_file_error_from_errno (err),
+ "Error in fstat() for file '%s': %s",
+ filename,
+ g_strerror (err));
+ }
+ close (fd);
+ return FALSE;
+ }
+
+ str = g_malloc (st.st_size + 1);
+ offset = 0;
+ do {
+ nread = read (fd, str + offset, st.st_size - offset);
+ if (nread > 0) {
+ offset += nread;
+ }
+ } while ((nread > 0 && offset < st.st_size) || (nread == -1 && errno == EINTR));
+
+ close (fd);
+ str [st.st_size] = '\0';
+ if (length) {
+ *length = st.st_size;
+ }
+ *contents = str;
+ return TRUE;
+}
+
+gint
+g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
+{
+ const static gchar *default_tmpl = ".XXXXXX";
+ gchar *t;
+ gint fd;
+ size_t len;
+
+ g_return_val_if_fail (error == NULL || *error == NULL, -1);
+
+ if (tmpl == NULL)
+ tmpl = default_tmpl;
+
+ if (strchr (tmpl, G_DIR_SEPARATOR) != NULL) {
+ if (error) {
+ *error = g_error_new (G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ "Template should not have any " G_DIR_SEPARATOR_S);
+ }
+ return -1;
+ }
+
+ len = strlen (tmpl);
+ if (len < 6 || strcmp (tmpl + len - 6, "XXXXXX")) {
+ if (error) {
+ *error = g_error_new (G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ "Template should end with XXXXXX");
+ }
+ return -1;
+ }
+
+ t = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
+
+ fd = mkstemp (t);
+
+ if (fd == -1) {
+ if (error) {
+ int err = errno;
+ *error = g_error_new (G_FILE_ERROR,
+ g_file_error_from_errno (err),
+ "Error in mkstemp(): %s",
+ g_strerror (err));
+ }
+ g_free (t);
+ return -1;
+ }
+
+ if (name_used) {
+ *name_used = t;
+ } else {
+ g_free (t);
+ }
+ return fd;
+}
+
+gchar *
+g_get_current_dir (void)
+{
+#ifdef __native_client__
+ char *buffer;
+ if ((buffer = g_getenv("NACL_PWD"))) {
+ buffer = g_strdup(buffer);
+ } else {
+ buffer = g_strdup(".");
+ }
+ return buffer;
+#else
+ int s = 32;
+ char *buffer = NULL, *r;
+ gboolean fail;
+
+ do {
+ buffer = g_realloc (buffer, s);
+ r = getcwd (buffer, s);
+ fail = (r == NULL && errno == ERANGE);
+ if (fail) {
+ s <<= 1;
+ }
+ } while (fail);
+
+ /* On amd64 sometimes the bottom 32-bits of r == the bottom 32-bits of buffer
+ * but the top 32-bits of r have overflown to 0xffffffff (seriously wtf getcwd
+ * so we return the buffer here since it has a pointer to the valid string
+ */
+ return buffer;
+#endif
+}
diff --git a/deps/eglib/src/gfile-unix.c b/deps/eglib/src/gfile-unix.c
new file mode 100644
index 0000000..4e17a08
--- /dev/null
+++ b/deps/eglib/src/gfile-unix.c
@@ -0,0 +1,80 @@
+/*
+ * File utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+gboolean
+g_file_test (const gchar *filename, GFileTest test)
+{
+ struct stat st;
+ gboolean have_stat;
+
+ if (filename == NULL || test == 0)
+ return FALSE;
+
+ have_stat = FALSE;
+
+ if ((test & G_FILE_TEST_EXISTS) != 0) {
+ if (access (filename, F_OK) == 0)
+ return TRUE;
+ }
+
+ if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
+ if (access (filename, X_OK) == 0)
+ return TRUE;
+ }
+ if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
+ have_stat = (lstat (filename, &st) == 0);
+ if (have_stat && S_ISLNK (st.st_mode))
+ return TRUE;
+ }
+
+ if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
+ if (!have_stat)
+ have_stat = (stat (filename, &st) == 0);
+ if (have_stat && S_ISREG (st.st_mode))
+ return TRUE;
+ }
+ if ((test & G_FILE_TEST_IS_DIR) != 0) {
+ if (!have_stat)
+ have_stat = (stat (filename, &st) == 0);
+ if (have_stat && S_ISDIR (st.st_mode))
+ return TRUE;
+ }
+ return FALSE;
+}
diff --git a/deps/eglib/src/gfile-win32.c b/deps/eglib/src/gfile-win32.c
new file mode 100644
index 0000000..a2e41ea
--- /dev/null
+++ b/deps/eglib/src/gfile-win32.c
@@ -0,0 +1,120 @@
+/*
+ * File utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+#include <windows.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#define open _open
+#ifndef S_ISREG
+#define S_ISREG(x) ((x & _S_IFMT) == _S_IFREG)
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(x) ((x & _S_IFMT) == _S_IFDIR)
+#endif
+#endif
+
+int mkstemp (char *tmp_template)
+{
+ int fd;
+ gunichar2* utf16_template;
+
+ utf16_template = u8to16 (tmp_template);
+
+ fd = -1;
+ utf16_template = _wmktemp( utf16_template);
+ if (utf16_template && *utf16_template) {
+ /* FIXME: _O_TEMPORARY causes file to disappear on close causing a test to fail */
+ fd = _wopen( utf16_template, _O_BINARY | _O_CREAT /*| _O_TEMPORARY*/ | _O_EXCL, _S_IREAD |
_S_IWRITE);
+ }
+
+ /* FIXME: this will crash if utf16_template == NULL */
+ sprintf (tmp_template + strlen (tmp_template) - 6, "%S", utf16_template + wcslen (utf16_template) -
6);
+
+ g_free (utf16_template);
+ return fd;
+}
+
+#ifdef _MSC_VER
+#pragma warning(disable:4701)
+#endif
+
+gboolean
+g_file_test (const gchar *filename, GFileTest test)
+{
+ gunichar2* utf16_filename = NULL;
+ DWORD attr;
+
+ if (filename == NULL || test == 0)
+ return FALSE;
+
+ utf16_filename = u8to16 (filename);
+ attr = GetFileAttributesW (utf16_filename);
+ g_free (utf16_filename);
+
+ if (attr == INVALID_FILE_ATTRIBUTES)
+ return FALSE;
+
+ if ((test & G_FILE_TEST_EXISTS) != 0) {
+ return TRUE;
+ }
+
+ if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
+ size_t len = strlen (filename);
+ if (len > 4 && strcmp (filename + len-3, "exe"))
+ return TRUE;
+
+ return FALSE;
+ }
+
+ if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
+ if (attr & (FILE_ATTRIBUTE_DEVICE|FILE_ATTRIBUTE_DIRECTORY))
+ return FALSE;
+ return TRUE;
+ }
+
+ if ((test & G_FILE_TEST_IS_DIR) != 0) {
+ if (attr & FILE_ATTRIBUTE_DIRECTORY)
+ return TRUE;
+ }
+
+ /* make this last in case it is OR'd with something else */
+ if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
+ return FALSE;
+ }
+
+ return FALSE;
+}
diff --git a/deps/eglib/src/gfile.c b/deps/eglib/src/gfile.c
new file mode 100644
index 0000000..ab0c912
--- /dev/null
+++ b/deps/eglib/src/gfile.c
@@ -0,0 +1,155 @@
+/*
+ * File utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <stdio.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <errno.h>
+
+GQuark
+g_file_error_quark (void)
+{
+ return g_quark_from_static_string ("g-file-error-quark");
+}
+
+GFileError
+g_file_error_from_errno (gint err_no)
+{
+ switch (err_no) {
+ case EEXIST:
+ return G_FILE_ERROR_EXIST;
+ case EISDIR:
+ return G_FILE_ERROR_ISDIR;
+ case EACCES:
+ return G_FILE_ERROR_ACCES;
+ case ENAMETOOLONG:
+ return G_FILE_ERROR_NAMETOOLONG;
+ case ENOENT:
+ return G_FILE_ERROR_NOENT;
+ case ENOTDIR:
+ return G_FILE_ERROR_NOTDIR;
+ case ENXIO:
+ return G_FILE_ERROR_NXIO;
+ case ENODEV:
+ return G_FILE_ERROR_NODEV;
+ case EROFS:
+ return G_FILE_ERROR_ROFS;
+#ifdef ETXTBSY
+ case ETXTBSY:
+ return G_FILE_ERROR_TXTBSY;
+#endif
+ case EFAULT:
+ return G_FILE_ERROR_FAULT;
+#ifdef ELOOP
+ case ELOOP:
+ return G_FILE_ERROR_LOOP;
+#endif
+ case ENOSPC:
+ return G_FILE_ERROR_NOSPC;
+ case ENOMEM:
+ return G_FILE_ERROR_NOMEM;
+ case EMFILE:
+ return G_FILE_ERROR_MFILE;
+ case ENFILE:
+ return G_FILE_ERROR_NFILE;
+ case EBADF:
+ return G_FILE_ERROR_BADF;
+ case EINVAL:
+ return G_FILE_ERROR_INVAL;
+ case EPIPE:
+ return G_FILE_ERROR_PIPE;
+ case EAGAIN:
+ return G_FILE_ERROR_AGAIN;
+ case EINTR:
+ return G_FILE_ERROR_INTR;
+ case EIO:
+ return G_FILE_ERROR_IO;
+ case EPERM:
+ return G_FILE_ERROR_PERM;
+ case ENOSYS:
+ return G_FILE_ERROR_NOSYS;
+ default:
+ return G_FILE_ERROR_FAILED;
+ }
+}
+
+#ifdef G_OS_WIN32
+#define TMP_FILE_FORMAT "%.*s%s.tmp"
+#else
+#define TMP_FILE_FORMAT "%.*s.%s~"
+#endif
+
+gboolean
+g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **err)
+{
+ const char *name;
+ char *path;
+ FILE *fp;
+
+ if (!(name = strrchr (filename, G_DIR_SEPARATOR)))
+ name = filename;
+ else
+ name++;
+
+ path = g_strdup_printf (TMP_FILE_FORMAT, name - filename, filename, name);
+ if (!(fp = fopen (path, "wb"))) {
+ g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
+ g_free (path);
+ return FALSE;
+ }
+
+ if (length < 0)
+ length = strlen (contents);
+
+ if (fwrite (contents, 1, length, fp) < length) {
+ g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (ferror (fp)), "%s", g_strerror
(ferror (fp)));
+ g_unlink (path);
+ g_free (path);
+ fclose (fp);
+
+ return FALSE;
+ }
+
+ fclose (fp);
+
+ if (g_rename (path, filename) != 0) {
+ g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
+ g_unlink (path);
+ g_free (path);
+ return FALSE;
+ }
+
+ g_free (path);
+
+ return TRUE;
+}
diff --git a/deps/eglib/src/ghashtable.c b/deps/eglib/src/ghashtable.c
new file mode 100644
index 0000000..35db6e6
--- /dev/null
+++ b/deps/eglib/src/ghashtable.c
@@ -0,0 +1,674 @@
+/*
+ * ghashtable.c: Hashtable implementation
+ *
+ * Author:
+ * Miguel de Icaza (miguel novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <math.h>
+#include <glib.h>
+
+typedef struct _Slot Slot;
+
+struct _Slot {
+ gpointer key;
+ gpointer value;
+ Slot *next;
+};
+
+static gpointer KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
+
+struct _GHashTable {
+ GHashFunc hash_func;
+ GEqualFunc key_equal_func;
+
+ Slot **table;
+ int table_size;
+ int in_use;
+ int threshold;
+ int last_rehash;
+ GDestroyNotify value_destroy_func, key_destroy_func;
+};
+
+typedef struct {
+ GHashTable *ht;
+ int slot_index;
+ Slot *slot;
+} Iter;
+
+static const guint prime_tbl[] = {
+ 11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237,
+ 1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627,
+ 47431, 71143, 106721, 160073, 240101, 360163,
+ 540217, 810343, 1215497, 1823231, 2734867, 4102283,
+ 6153409, 9230113, 13845163
+};
+
+static gboolean
+test_prime (int x)
+{
+ if ((x & 1) != 0) {
+ int n;
+ for (n = 3; n< (int)sqrt (x); n += 2) {
+ if ((x % n) == 0)
+ return FALSE;
+ }
+ return TRUE;
+ }
+ // There is only one even prime - 2.
+ return (x == 2);
+}
+
+static int
+calc_prime (int x)
+{
+ int i;
+
+ for (i = (x & (~1))-1; i< G_MAXINT32; i += 2) {
+ if (test_prime (i))
+ return i;
+ }
+ return x;
+}
+
+guint
+g_spaced_primes_closest (guint x)
+{
+ int i;
+
+ for (i = 0; i < G_N_ELEMENTS (prime_tbl); i++) {
+ if (x <= prime_tbl [i])
+ return prime_tbl [i];
+ }
+ return calc_prime (x);
+}
+
+GHashTable *
+g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func)
+{
+ GHashTable *hash;
+
+ if (hash_func == NULL)
+ hash_func = g_direct_hash;
+ if (key_equal_func == NULL)
+ key_equal_func = g_direct_equal;
+ hash = g_new0 (GHashTable, 1);
+
+ hash->hash_func = hash_func;
+ hash->key_equal_func = key_equal_func;
+
+ hash->table_size = g_spaced_primes_closest (1);
+ hash->table = g_new0 (Slot *, hash->table_size);
+ hash->last_rehash = hash->table_size;
+
+ return hash;
+}
+
+GHashTable *
+g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
+{
+ GHashTable *hash = g_hash_table_new (hash_func, key_equal_func);
+ if (hash == NULL)
+ return NULL;
+
+ hash->key_destroy_func = key_destroy_func;
+ hash->value_destroy_func = value_destroy_func;
+
+ return hash;
+}
+
+#if 0
+static void
+dump_hash_table (GHashTable *hash)
+{
+ int i;
+
+ for (i = 0; i < hash->table_size; i++) {
+ Slot *s;
+
+ for (s = hash->table [i]; s != NULL; s = s->next){
+ guint hashcode = (*hash->hash_func) (s->key);
+ guint slot = (hashcode) % hash->table_size;
+ printf ("key %p hash %x on slot %d correct slot %d tb size %d\n", s->key, hashcode,
i, slot, hash->table_size);
+ }
+ }
+}
+#endif
+
+#ifdef SANITY_CHECK
+static void
+sanity_check (GHashTable *hash)
+{
+ int i;
+
+ for (i = 0; i < hash->table_size; i++) {
+ Slot *s;
+
+ for (s = hash->table [i]; s != NULL; s = s->next){
+ guint hashcode = (*hash->hash_func) (s->key);
+ guint slot = (hashcode) % hash->table_size;
+ if (slot != i) {
+ dump_hashcode_func = 1;
+ hashcode = (*hash->hash_func) (s->key);
+ dump_hashcode_func = 0;
+ g_error ("Key %p (bucket %d) on invalid bucket %d (hashcode %x) (tb size
%d)", s->key, slot, i, hashcode, hash->table_size);
+ }
+ }
+ }
+}
+#else
+
+#define sanity_check(HASH) do {}while(0)
+
+#endif
+
+static void
+do_rehash (GHashTable *hash)
+{
+ int current_size, i;
+ Slot **table;
+
+ /* printf ("Resizing diff=%d slots=%d\n", hash->in_use - hash->last_rehash, hash->table_size); */
+ hash->last_rehash = hash->table_size;
+ current_size = hash->table_size;
+ hash->table_size = g_spaced_primes_closest (hash->in_use);
+ /* printf ("New size: %d\n", hash->table_size); */
+ table = hash->table;
+ hash->table = g_new0 (Slot *, hash->table_size);
+
+ for (i = 0; i < current_size; i++){
+ Slot *s, *next;
+
+ for (s = table [i]; s != NULL; s = next){
+ guint hashcode = ((*hash->hash_func) (s->key)) % hash->table_size;
+ next = s->next;
+
+ s->next = hash->table [hashcode];
+ hash->table [hashcode] = s;
+ }
+ }
+ g_free (table);
+}
+
+static void
+rehash (GHashTable *hash)
+{
+ int diff = ABS (hash->last_rehash - hash->in_use);
+
+ /* These are the factors to play with to change the rehashing strategy */
+ /* I played with them with a large range, and could not really get */
+ /* something that was too good, maybe the tests are not that great */
+ if (!(diff * 0.75 > hash->table_size * 2))
+ return;
+ do_rehash (hash);
+ sanity_check (hash);
+}
+
+void
+g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean replace)
+{
+ guint hashcode;
+ Slot *s;
+ GEqualFunc equal;
+
+ g_return_if_fail (hash != NULL);
+ sanity_check (hash);
+
+ equal = hash->key_equal_func;
+ if (hash->in_use >= hash->threshold)
+ rehash (hash);
+
+ hashcode = ((*hash->hash_func) (key)) % hash->table_size;
+ for (s = hash->table [hashcode]; s != NULL; s = s->next){
+ if ((*equal) (s->key, key)){
+ if (replace){
+ if (hash->key_destroy_func != NULL)
+ (*hash->key_destroy_func)(s->key);
+ s->key = key;
+ }
+ if (hash->value_destroy_func != NULL)
+ (*hash->value_destroy_func) (s->value);
+ s->value = value;
+ sanity_check (hash);
+ return;
+ }
+ }
+ s = g_new (Slot, 1);
+ s->key = key;
+ s->value = value;
+ s->next = hash->table [hashcode];
+ hash->table [hashcode] = s;
+ hash->in_use++;
+ sanity_check (hash);
+}
+
+GList*
+g_hash_table_get_keys (GHashTable *hash)
+{
+ GHashTableIter iter;
+ GList *rv = NULL;
+ gpointer key;
+
+ g_hash_table_iter_init (&iter, hash);
+
+ while (g_hash_table_iter_next (&iter, &key, NULL))
+ rv = g_list_prepend (rv, key);
+
+ return g_list_reverse (rv);
+}
+
+GList*
+g_hash_table_get_values (GHashTable *hash)
+{
+ GHashTableIter iter;
+ GList *rv = NULL;
+ gpointer value;
+
+ g_hash_table_iter_init (&iter, hash);
+
+ while (g_hash_table_iter_next (&iter, NULL, &value))
+ rv = g_list_prepend (rv, value);
+
+ return g_list_reverse (rv);
+}
+
+
+guint
+g_hash_table_size (GHashTable *hash)
+{
+ g_return_val_if_fail (hash != NULL, 0);
+
+ return hash->in_use;
+}
+
+gpointer
+g_hash_table_lookup (GHashTable *hash, gconstpointer key)
+{
+ gpointer orig_key, value;
+
+ if (g_hash_table_lookup_extended (hash, key, &orig_key, &value))
+ return value;
+ else
+ return NULL;
+}
+
+gboolean
+g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value)
+{
+ GEqualFunc equal;
+ Slot *s;
+ guint hashcode;
+
+ g_return_val_if_fail (hash != NULL, FALSE);
+ sanity_check (hash);
+ equal = hash->key_equal_func;
+
+ hashcode = ((*hash->hash_func) (key)) % hash->table_size;
+
+ for (s = hash->table [hashcode]; s != NULL; s = s->next){
+ if ((*equal)(s->key, key)){
+ if (orig_key)
+ *orig_key = s->key;
+ if (value)
+ *value = s->value;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+void
+g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data)
+{
+ int i;
+
+ g_return_if_fail (hash != NULL);
+ g_return_if_fail (func != NULL);
+
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s;
+
+ for (s = hash->table [i]; s != NULL; s = s->next)
+ (*func)(s->key, s->value, user_data);
+ }
+}
+
+gpointer
+g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data)
+{
+ int i;
+
+ g_return_val_if_fail (hash != NULL, NULL);
+ g_return_val_if_fail (predicate != NULL, NULL);
+
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s;
+
+ for (s = hash->table [i]; s != NULL; s = s->next)
+ if ((*predicate)(s->key, s->value, user_data))
+ return s->value;
+ }
+ return NULL;
+}
+
+void
+g_hash_table_remove_all (GHashTable *hash)
+{
+ int i;
+
+ g_return_if_fail (hash != NULL);
+
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s;
+
+ while (hash->table [i]) {
+ s = hash->table [i];
+ g_hash_table_remove (hash, s->key);
+ }
+ }
+}
+
+gboolean
+g_hash_table_remove (GHashTable *hash, gconstpointer key)
+{
+ GEqualFunc equal;
+ Slot *s, *last;
+ guint hashcode;
+
+ g_return_val_if_fail (hash != NULL, FALSE);
+ sanity_check (hash);
+ equal = hash->key_equal_func;
+
+ hashcode = ((*hash->hash_func)(key)) % hash->table_size;
+ last = NULL;
+ for (s = hash->table [hashcode]; s != NULL; s = s->next){
+ if ((*equal)(s->key, key)){
+ if (hash->key_destroy_func != NULL)
+ (*hash->key_destroy_func)(s->key);
+ if (hash->value_destroy_func != NULL)
+ (*hash->value_destroy_func)(s->value);
+ if (last == NULL)
+ hash->table [hashcode] = s->next;
+ else
+ last->next = s->next;
+ g_free (s);
+ hash->in_use--;
+ sanity_check (hash);
+ return TRUE;
+ }
+ last = s;
+ }
+ sanity_check (hash);
+ return FALSE;
+}
+
+guint
+g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data)
+{
+ int i;
+ int count = 0;
+
+ g_return_val_if_fail (hash != NULL, 0);
+ g_return_val_if_fail (func != NULL, 0);
+
+ sanity_check (hash);
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s, *last;
+
+ last = NULL;
+ for (s = hash->table [i]; s != NULL; ){
+ if ((*func)(s->key, s->value, user_data)){
+ Slot *n;
+
+ if (hash->key_destroy_func != NULL)
+ (*hash->key_destroy_func)(s->key);
+ if (hash->value_destroy_func != NULL)
+ (*hash->value_destroy_func)(s->value);
+ if (last == NULL){
+ hash->table [i] = s->next;
+ n = s->next;
+ } else {
+ last->next = s->next;
+ n = last->next;
+ }
+ g_free (s);
+ hash->in_use--;
+ count++;
+ s = n;
+ } else {
+ last = s;
+ s = s->next;
+ }
+ }
+ }
+ sanity_check (hash);
+ if (count > 0)
+ rehash (hash);
+ return count;
+}
+
+gboolean
+g_hash_table_steal (GHashTable *hash, gconstpointer key)
+{
+ GEqualFunc equal;
+ Slot *s, *last;
+ guint hashcode;
+
+ g_return_val_if_fail (hash != NULL, FALSE);
+ sanity_check (hash);
+ equal = hash->key_equal_func;
+
+ hashcode = ((*hash->hash_func)(key)) % hash->table_size;
+ last = NULL;
+ for (s = hash->table [hashcode]; s != NULL; s = s->next){
+ if ((*equal)(s->key, key)) {
+ if (last == NULL)
+ hash->table [hashcode] = s->next;
+ else
+ last->next = s->next;
+ g_free (s);
+ hash->in_use--;
+ sanity_check (hash);
+ return TRUE;
+ }
+ last = s;
+ }
+ sanity_check (hash);
+ return FALSE;
+
+}
+
+guint
+g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data)
+{
+ int i;
+ int count = 0;
+
+ g_return_val_if_fail (hash != NULL, 0);
+ g_return_val_if_fail (func != NULL, 0);
+
+ sanity_check (hash);
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s, *last;
+
+ last = NULL;
+ for (s = hash->table [i]; s != NULL; ){
+ if ((*func)(s->key, s->value, user_data)){
+ Slot *n;
+
+ if (last == NULL){
+ hash->table [i] = s->next;
+ n = s->next;
+ } else {
+ last->next = s->next;
+ n = last->next;
+ }
+ g_free (s);
+ hash->in_use--;
+ count++;
+ s = n;
+ } else {
+ last = s;
+ s = s->next;
+ }
+ }
+ }
+ sanity_check (hash);
+ if (count > 0)
+ rehash (hash);
+ return count;
+}
+
+void
+g_hash_table_destroy (GHashTable *hash)
+{
+ int i;
+
+ g_return_if_fail (hash != NULL);
+
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s, *next;
+
+ for (s = hash->table [i]; s != NULL; s = next){
+ next = s->next;
+
+ if (hash->key_destroy_func != NULL)
+ (*hash->key_destroy_func)(s->key);
+ if (hash->value_destroy_func != NULL)
+ (*hash->value_destroy_func)(s->value);
+ g_free (s);
+ }
+ }
+ g_free (hash->table);
+
+ g_free (hash);
+}
+
+void
+g_hash_table_print_stats (GHashTable *table)
+{
+ int i, max_chain_index, chain_size, max_chain_size;
+ Slot *node;
+
+ max_chain_size = 0;
+ max_chain_index = -1;
+ for (i = 0; i < table->table_size; i++) {
+ chain_size = 0;
+ for (node = table->table [i]; node; node = node->next)
+ chain_size ++;
+ if (chain_size > max_chain_size) {
+ max_chain_size = chain_size;
+ max_chain_index = i;
+ }
+ }
+
+ printf ("Size: %d Table Size: %d Max Chain Length: %d at %d\n", table->in_use, table->table_size,
max_chain_size, max_chain_index);
+}
+
+void
+g_hash_table_iter_init (GHashTableIter *it, GHashTable *hash_table)
+{
+ Iter *iter = (Iter*)it;
+
+ memset (iter, 0, sizeof (Iter));
+ iter->ht = hash_table;
+ iter->slot_index = -1;
+}
+
+gboolean g_hash_table_iter_next (GHashTableIter *it, gpointer *key, gpointer *value)
+{
+ Iter *iter = (Iter*)it;
+
+ GHashTable *hash = iter->ht;
+
+ g_assert (iter->slot_index != -2);
+ g_assert (sizeof (Iter) <= sizeof (GHashTableIter));
+
+ if (!iter->slot) {
+ while (TRUE) {
+ iter->slot_index ++;
+ if (iter->slot_index >= hash->table_size) {
+ iter->slot_index = -2;
+ return FALSE;
+ }
+ if (hash->table [iter->slot_index])
+ break;
+ }
+ iter->slot = hash->table [iter->slot_index];
+ }
+
+ if (key)
+ *key = iter->slot->key;
+ if (value)
+ *value = iter->slot->value;
+ iter->slot = iter->slot->next;
+
+ return TRUE;
+}
+
+gboolean
+g_direct_equal (gconstpointer v1, gconstpointer v2)
+{
+ return v1 == v2;
+}
+
+guint
+g_direct_hash (gconstpointer v1)
+{
+ return GPOINTER_TO_UINT (v1);
+}
+
+gboolean
+g_int_equal (gconstpointer v1, gconstpointer v2)
+{
+ return *(gint *)v1 == *(gint *)v2;
+}
+
+guint
+g_int_hash (gconstpointer v1)
+{
+ return *(guint *)v1;
+}
+
+gboolean
+g_str_equal (gconstpointer v1, gconstpointer v2)
+{
+ return strcmp (v1, v2) == 0;
+}
+
+guint
+g_str_hash (gconstpointer v1)
+{
+ guint hash = 0;
+ char *p = (char *) v1;
+
+ while (*p++)
+ hash = (hash << 5) - (hash + *p);
+
+ return hash;
+}
diff --git a/deps/eglib/src/ghooklist.c b/deps/eglib/src/ghooklist.c
new file mode 100644
index 0000000..88eba73
--- /dev/null
+++ b/deps/eglib/src/ghooklist.c
@@ -0,0 +1,124 @@
+/*
+ * ghooklist.c: API for manipulating a list of hook functions
+ *
+ * Copyright (C) 2014 Intel Corporation.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Robert Bragg <robert linux intel com>
+ */
+
+#include <config.h>
+
+#include <glib.h>
+
+void
+g_hook_list_init (GHookList *hook_list,
+ guint hook_size)
+{
+ hook_list->hooks = NULL;
+}
+
+void
+g_hook_list_invoke (GHookList *hook_list,
+ gboolean may_recurse)
+{
+ GHook *h;
+
+ if (may_recurse)
+ {
+ for (h = hook_list->hooks; h; h = h->next)
+ {
+ GHookFunc func = h->func;
+ func (h->data);
+ }
+ }
+ else
+ {
+ for (h = hook_list->hooks; h && !h->in_call; h = h->next)
+ {
+ GHookFunc func = h->func;
+ h->in_call = TRUE;
+ func (h->data);
+ h->in_call = FALSE;
+ }
+ }
+}
+
+void
+g_hook_list_clear (GHookList *hook_list)
+{
+ while (hook_list->hooks)
+ g_hook_destroy_link (hook_list, hook_list->hooks);
+}
+
+GHook *
+g_hook_alloc (GHookList *hook_list)
+{
+ return g_new (GHook, 1);
+}
+
+GHook *
+g_hook_find_func_data (GHookList *hook_list,
+ gboolean need_valids,
+ gpointer func,
+ gpointer data)
+{
+ GHook *h;
+
+ for (h = hook_list->hooks; h; h = h->next)
+ {
+ if (h->func == func && h->data == data)
+ return h;
+ }
+
+ return NULL;
+}
+
+void
+g_hook_destroy_link (GHookList *hook_list,
+ GHook *hook)
+{
+ if (hook_list->hooks == hook)
+ hook_list->hooks = hook->next;
+
+ if (hook->next)
+ hook->next->prev = hook->prev;
+ if (hook->prev)
+ hook->prev->next = hook->next;
+
+ g_free (hook);
+}
+
+void
+g_hook_prepend (GHookList *hook_list,
+ GHook *hook)
+{
+ GHook *prev = hook_list->hooks ? hook_list->hooks->prev : NULL;
+ GHook *next = hook_list->hooks;
+
+ hook->prev = prev;
+ hook->next = next;
+ if (prev)
+ prev->next = hook;
+ if (next)
+ next->prev = hook;
+}
diff --git a/deps/eglib/src/giconv.c b/deps/eglib/src/giconv.c
new file mode 100644
index 0000000..f9da4a6
--- /dev/null
+++ b/deps/eglib/src/giconv.c
@@ -0,0 +1,1368 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2011 Jeffrey Stedfast
+ *
+ * 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 AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <string.h>
+#ifdef HAVE_ICONV_H
+#include <iconv.h>
+#endif
+#include <errno.h>
+
+#ifdef _MSC_VER
+#define FORCE_INLINE(RET_TYPE) __forceinline RET_TYPE
+#else
+#define FORCE_INLINE(RET_TYPE) inline RET_TYPE __attribute__((always_inline))
+#endif
+
+
+#define UNROLL_DECODE_UTF8 0
+#define UNROLL_ENCODE_UTF8 0
+
+typedef int (* Decoder) (char *inbuf, size_t inleft, gunichar *outchar);
+typedef int (* Encoder) (gunichar c, char *outbuf, size_t outleft);
+
+struct _GIConv {
+ Decoder decode;
+ Encoder encode;
+ gunichar c;
+#ifdef HAVE_ICONV
+ iconv_t cd;
+#endif
+};
+
+static int decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf32be (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf32le (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf16be (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf16le (gunichar c, char *outbuf, size_t outleft);
+
+static FORCE_INLINE (int) decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf8 (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_latin1 (gunichar c, char *outbuf, size_t outleft);
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define decode_utf32 decode_utf32le
+#define encode_utf32 encode_utf32le
+#define decode_utf16 decode_utf16le
+#define encode_utf16 encode_utf16le
+#else
+#define decode_utf32 decode_utf32be
+#define encode_utf32 encode_utf32be
+#define decode_utf16 decode_utf16be
+#define encode_utf16 encode_utf16be
+#endif
+
+static struct {
+ const char *name;
+ Decoder decoder;
+ Encoder encoder;
+} charsets[] = {
+ { "ISO-8859-1", decode_latin1, encode_latin1 },
+ { "ISO8859-1", decode_latin1, encode_latin1 },
+ { "UTF-32BE", decode_utf32be, encode_utf32be },
+ { "UTF-32LE", decode_utf32le, encode_utf32le },
+ { "UTF-16BE", decode_utf16be, encode_utf16be },
+ { "UTF-16LE", decode_utf16le, encode_utf16le },
+ { "UTF-32", decode_utf32, encode_utf32 },
+ { "UTF-16", decode_utf16, encode_utf16 },
+ { "UTF-8", decode_utf8, encode_utf8 },
+ { "US-ASCII", decode_latin1, encode_latin1 },
+ { "Latin1", decode_latin1, encode_latin1 },
+ { "ASCII", decode_latin1, encode_latin1 },
+ { "UTF32", decode_utf32, encode_utf32 },
+ { "UTF16", decode_utf16, encode_utf16 },
+ { "UTF8", decode_utf8, encode_utf8 },
+};
+
+
+GIConv
+g_iconv_open (const char *to_charset, const char *from_charset)
+{
+#ifdef HAVE_ICONV
+ iconv_t icd = (iconv_t) -1;
+#endif
+ Decoder decoder = NULL;
+ Encoder encoder = NULL;
+ GIConv cd;
+ guint i;
+
+ if (!to_charset || !from_charset || !to_charset[0] || !from_charset[0]) {
+ errno = EINVAL;
+
+ return (GIConv) -1;
+ }
+
+ for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
+ if (!g_ascii_strcasecmp (charsets[i].name, from_charset))
+ decoder = charsets[i].decoder;
+
+ if (!g_ascii_strcasecmp (charsets[i].name, to_charset))
+ encoder = charsets[i].encoder;
+ }
+
+ if (!encoder || !decoder) {
+#ifdef HAVE_ICONV
+ if ((icd = iconv_open (to_charset, from_charset)) == (iconv_t) -1)
+ return (GIConv) -1;
+#else
+ errno = EINVAL;
+
+ return (GIConv) -1;
+#endif
+ }
+
+ cd = (GIConv) g_malloc (sizeof (struct _GIConv));
+ cd->decode = decoder;
+ cd->encode = encoder;
+ cd->c = -1;
+
+#ifdef HAVE_ICONV
+ cd->cd = icd;
+#endif
+
+ return cd;
+}
+
+int
+g_iconv_close (GIConv cd)
+{
+#ifdef HAVE_ICONV
+ if (cd->cd != (iconv_t) -1)
+ iconv_close (cd->cd);
+#endif
+
+ g_free (cd);
+
+ return 0;
+}
+
+gsize
+g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
+ gchar **outbytes, gsize *outbytesleft)
+{
+ gsize inleft, outleft;
+ char *inptr, *outptr;
+ gunichar c;
+ int rc = 0;
+
+#ifdef HAVE_ICONV
+ if (cd->cd != (iconv_t) -1) {
+ /* Note: gsize may have a different size than size_t, so we need to
+ remap inbytesleft and outbytesleft to size_t's. */
+ size_t *outleftptr, *inleftptr;
+ size_t n_outleft, n_inleft;
+
+ if (inbytesleft) {
+ n_inleft = *inbytesleft;
+ inleftptr = &n_inleft;
+ } else {
+ inleftptr = NULL;
+ }
+
+ if (outbytesleft) {
+ n_outleft = *outbytesleft;
+ outleftptr = &n_outleft;
+ } else {
+ outleftptr = NULL;
+ }
+
+ return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);
+ }
+#endif
+
+ if (outbytes == NULL || outbytesleft == NULL) {
+ /* reset converter */
+ cd->c = -1;
+ return 0;
+ }
+
+ inleft = inbytesleft ? *inbytesleft : 0;
+ inptr = inbytes ? *inbytes : NULL;
+ outleft = *outbytesleft;
+ outptr = *outbytes;
+
+ if ((c = cd->c) != (gunichar) -1)
+ goto encode;
+
+ while (inleft > 0) {
+ if ((rc = cd->decode (inptr, inleft, &c)) < 0)
+ break;
+
+ inleft -= rc;
+ inptr += rc;
+
+ encode:
+ if ((rc = cd->encode (c, outptr, outleft)) < 0)
+ break;
+
+ c = (gunichar) -1;
+ outleft -= rc;
+ outptr += rc;
+ }
+
+ if (inbytesleft)
+ *inbytesleft = inleft;
+
+ if (inbytes)
+ *inbytes = inptr;
+
+ *outbytesleft = outleft;
+ *outbytes = outptr;
+ cd->c = c;
+
+ return rc < 0 ? -1 : 0;
+}
+
+/*
+ * Unicode encoders and decoders
+ */
+
+static int
+decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar c;
+
+ if (inleft < 4) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ c = (inptr[0] << 24) | (inptr[1] << 16) | (inptr[2] << 8) | inptr[3];
+
+ if (c >= 0xd800 && c < 0xe000) {
+ errno = EILSEQ;
+ return -1;
+ } else if (c >= 0x110000) {
+ errno = EILSEQ;
+ return -1;
+ }
+
+ *outchar = c;
+
+ return 4;
+}
+
+static int
+decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar c;
+
+ if (inleft < 4) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ c = (inptr[3] << 24) | (inptr[2] << 16) | (inptr[1] << 8) | inptr[0];
+
+ if (c >= 0xd800 && c < 0xe000) {
+ errno = EILSEQ;
+ return -1;
+ } else if (c >= 0x110000) {
+ errno = EILSEQ;
+ return -1;
+ }
+
+ *outchar = c;
+
+ return 4;
+}
+
+static int
+encode_utf32be (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+
+ if (outleft < 4) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ outptr[0] = (c >> 24) & 0xff;
+ outptr[1] = (c >> 16) & 0xff;
+ outptr[2] = (c >> 8) & 0xff;
+ outptr[3] = c & 0xff;
+
+ return 4;
+}
+
+static int
+encode_utf32le (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+
+ if (outleft < 4) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ outptr[0] = c & 0xff;
+ outptr[1] = (c >> 8) & 0xff;
+ outptr[2] = (c >> 16) & 0xff;
+ outptr[3] = (c >> 24) & 0xff;
+
+ return 4;
+}
+
+static int
+decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar2 c;
+ gunichar u;
+
+ if (inleft < 2) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ u = (inptr[0] << 8) | inptr[1];
+
+ if (u < 0xd800) {
+ /* 0x0000 -> 0xd7ff */
+ *outchar = u;
+ return 2;
+ } else if (u < 0xdc00) {
+ /* 0xd800 -> 0xdbff */
+ if (inleft < 4) {
+ errno = EINVAL;
+ return -2;
+ }
+
+ c = (inptr[2] << 8) | inptr[3];
+
+ if (c < 0xdc00 || c > 0xdfff) {
+ errno = EILSEQ;
+ return -2;
+ }
+
+ u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
+ *outchar = u;
+
+ return 4;
+ } else if (u < 0xe000) {
+ /* 0xdc00 -> 0xdfff */
+ errno = EILSEQ;
+ return -1;
+ } else {
+ /* 0xe000 -> 0xffff */
+ *outchar = u;
+ return 2;
+ }
+}
+
+static int
+decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar2 c;
+ gunichar u;
+
+ if (inleft < 2) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ u = (inptr[1] << 8) | inptr[0];
+
+ if (u < 0xd800) {
+ /* 0x0000 -> 0xd7ff */
+ *outchar = u;
+ return 2;
+ } else if (u < 0xdc00) {
+ /* 0xd800 -> 0xdbff */
+ if (inleft < 4) {
+ errno = EINVAL;
+ return -2;
+ }
+
+ c = (inptr[3] << 8) | inptr[2];
+
+ if (c < 0xdc00 || c > 0xdfff) {
+ errno = EILSEQ;
+ return -2;
+ }
+
+ u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
+ *outchar = u;
+
+ return 4;
+ } else if (u < 0xe000) {
+ /* 0xdc00 -> 0xdfff */
+ errno = EILSEQ;
+ return -1;
+ } else {
+ /* 0xe000 -> 0xffff */
+ *outchar = u;
+ return 2;
+ }
+}
+
+static int
+encode_utf16be (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+ gunichar2 ch;
+ gunichar c2;
+
+ if (c < 0x10000) {
+ if (outleft < 2) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ outptr[0] = (c >> 8) & 0xff;
+ outptr[1] = c & 0xff;
+
+ return 2;
+ } else {
+ if (outleft < 4) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ c2 = c - 0x10000;
+
+ ch = (gunichar2) ((c2 >> 10) + 0xd800);
+ outptr[0] = (ch >> 8) & 0xff;
+ outptr[1] = ch & 0xff;
+
+ ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+ outptr[2] = (ch >> 8) & 0xff;
+ outptr[3] = ch & 0xff;
+
+ return 4;
+ }
+}
+
+static int
+encode_utf16le (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+ gunichar2 ch;
+ gunichar c2;
+
+ if (c < 0x10000) {
+ if (outleft < 2) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ outptr[0] = c & 0xff;
+ outptr[1] = (c >> 8) & 0xff;
+
+ return 2;
+ } else {
+ if (outleft < 4) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ c2 = c - 0x10000;
+
+ ch = (gunichar2) ((c2 >> 10) + 0xd800);
+ outptr[0] = ch & 0xff;
+ outptr[1] = (ch >> 8) & 0xff;
+
+ ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+ outptr[2] = ch & 0xff;
+ outptr[3] = (ch >> 8) & 0xff;
+
+ return 4;
+ }
+}
+
+static FORCE_INLINE (int)
+decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar u;
+ int n, i;
+
+ u = *inptr;
+
+ if (u < 0x80) {
+ /* simple ascii case */
+ *outchar = u;
+ return 1;
+ } else if (u < 0xc2) {
+ errno = EILSEQ;
+ return -1;
+ } else if (u < 0xe0) {
+ u &= 0x1f;
+ n = 2;
+ } else if (u < 0xf0) {
+ u &= 0x0f;
+ n = 3;
+ } else if (u < 0xf8) {
+ u &= 0x07;
+ n = 4;
+ } else if (u < 0xfc) {
+ u &= 0x03;
+ n = 5;
+ } else if (u < 0xfe) {
+ u &= 0x01;
+ n = 6;
+ } else {
+ errno = EILSEQ;
+ return -1;
+ }
+
+ if (n > inleft) {
+ errno = EINVAL;
+ return -1;
+ }
+
+#if UNROLL_DECODE_UTF8
+ switch (n) {
+ case 6: u = (u << 6) | (*++inptr ^ 0x80);
+ case 5: u = (u << 6) | (*++inptr ^ 0x80);
+ case 4: u = (u << 6) | (*++inptr ^ 0x80);
+ case 3: u = (u << 6) | (*++inptr ^ 0x80);
+ case 2: u = (u << 6) | (*++inptr ^ 0x80);
+ }
+#else
+ for (i = 1; i < n; i++)
+ u = (u << 6) | (*++inptr ^ 0x80);
+#endif
+
+ *outchar = u;
+
+ return n;
+}
+
+static int
+encode_utf8 (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+ int base, n, i;
+
+ if (c < 0x80) {
+ outptr[0] = c;
+ return 1;
+ } else if (c < 0x800) {
+ base = 192;
+ n = 2;
+ } else if (c < 0x10000) {
+ base = 224;
+ n = 3;
+ } else if (c < 0x200000) {
+ base = 240;
+ n = 4;
+ } else if (c < 0x4000000) {
+ base = 248;
+ n = 5;
+ } else {
+ base = 252;
+ n = 6;
+ }
+
+ if (outleft < n) {
+ errno = E2BIG;
+ return -1;
+ }
+
+#if UNROLL_ENCODE_UTF8
+ switch (n) {
+ case 6: outptr[5] = (c & 0x3f) | 0x80; c >>= 6;
+ case 5: outptr[4] = (c & 0x3f) | 0x80; c >>= 6;
+ case 4: outptr[3] = (c & 0x3f) | 0x80; c >>= 6;
+ case 3: outptr[2] = (c & 0x3f) | 0x80; c >>= 6;
+ case 2: outptr[1] = (c & 0x3f) | 0x80; c >>= 6;
+ case 1: outptr[0] = c | base;
+ }
+#else
+ for (i = n - 1; i > 0; i--) {
+ outptr[i] = (c & 0x3f) | 0x80;
+ c >>= 6;
+ }
+
+ outptr[0] = c | base;
+#endif
+
+ return n;
+}
+
+static int
+decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ *outchar = (unsigned char) *inbuf;
+ return 1;
+}
+
+static int
+encode_latin1 (gunichar c, char *outbuf, size_t outleft)
+{
+ if (outleft < 1) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ if (c > 0xff) {
+ errno = EILSEQ;
+ return -1;
+ }
+
+ *outbuf = (char) c;
+
+ return 1;
+}
+
+
+/*
+ * Simple conversion API
+ */
+
+GQuark
+g_convert_error_quark (void)
+{
+ return g_quark_from_static_string ("g-convert-error-quark");
+}
+
+gchar *
+g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset,
+ gsize *bytes_read, gsize *bytes_written, GError **err)
+{
+ gsize outsize, outused, outleft, inleft, grow, rc;
+ char *result, *outbuf, *inbuf;
+ gboolean flush = FALSE;
+ gboolean done = FALSE;
+ GIConv cd;
+
+ g_return_val_if_fail (str != NULL, NULL);
+ g_return_val_if_fail (to_charset != NULL, NULL);
+ g_return_val_if_fail (from_charset != NULL, NULL);
+
+ if ((cd = g_iconv_open (to_charset, from_charset)) == (GIConv) -1) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_CONVERSION,
+ "Conversion from %s to %s not supported.",
+ from_charset, to_charset);
+
+ if (bytes_written)
+ *bytes_written = 0;
+
+ if (bytes_read)
+ *bytes_read = 0;
+
+ return NULL;
+ }
+
+ inleft = len < 0 ? strlen (str) : len;
+ inbuf = (char *) str;
+
+ outleft = outsize = MAX (inleft, 8);
+ outbuf = result = g_malloc (outsize + 4);
+
+ do {
+ if (!flush)
+ rc = g_iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
+ else
+ rc = g_iconv (cd, NULL, NULL, &outbuf, &outleft);
+
+ if (rc == (gsize) -1) {
+ switch (errno) {
+ case E2BIG:
+ /* grow our result buffer */
+ grow = MAX (inleft, 8) << 1;
+ outused = outbuf - result;
+ outsize += grow;
+ outleft += grow;
+ result = g_realloc (result, outsize + 4);
+ outbuf = result + outused;
+ break;
+ case EINVAL:
+ /* incomplete input, stop converting and terminate here */
+ if (flush)
+ done = TRUE;
+ else
+ flush = TRUE;
+ break;
+ case EILSEQ:
+ /* illegal sequence in the input */
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "%s",
g_strerror (errno));
+
+ if (bytes_read) {
+ /* save offset of the illegal input sequence */
+ *bytes_read = (inbuf - str);
+ }
+
+ if (bytes_written)
+ *bytes_written = 0;
+
+ g_iconv_close (cd);
+ g_free (result);
+ return NULL;
+ default:
+ /* unknown errno */
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "%s", g_strerror
(errno));
+
+ if (bytes_written)
+ *bytes_written = 0;
+
+ if (bytes_read)
+ *bytes_read = 0;
+
+ g_iconv_close (cd);
+ g_free (result);
+ return NULL;
+ }
+ } else if (flush) {
+ /* input has been converted and output has been flushed */
+ break;
+ } else {
+ /* input has been converted, need to flush the output */
+ flush = TRUE;
+ }
+ } while (!done);
+
+ g_iconv_close (cd);
+
+ /* Note: not all charsets can be null-terminated with a single
+ null byte. UCS2, for example, needs 2 null bytes and UCS4
+ needs 4. I hope that 4 null bytes is enough to terminate all
+ multibyte charsets? */
+
+ /* null-terminate the result */
+ memset (outbuf, 0, 4);
+
+ if (bytes_written)
+ *bytes_written = outbuf - result;
+
+ if (bytes_read)
+ *bytes_read = inbuf - str;
+
+ return result;
+}
+
+
+/*
+ * Unicode conversion
+ */
+
+/**
+ * from http://home.tiscali.nl/t876506/utf8tbl.html
+ *
+ * From Unicode UCS-4 to UTF-8:
+ * Start with the Unicode number expressed as a decimal number and call this ud.
+ *
+ * If ud <128 (7F hex) then UTF-8 is 1 byte long, the value of ud.
+ *
+ * If ud >=128 and <=2047 (7FF hex) then UTF-8 is 2 bytes long.
+ * byte 1 = 192 + (ud div 64)
+ * byte 2 = 128 + (ud mod 64)
+ *
+ * If ud >=2048 and <=65535 (FFFF hex) then UTF-8 is 3 bytes long.
+ * byte 1 = 224 + (ud div 4096)
+ * byte 2 = 128 + ((ud div 64) mod 64)
+ * byte 3 = 128 + (ud mod 64)
+ *
+ * If ud >=65536 and <=2097151 (1FFFFF hex) then UTF-8 is 4 bytes long.
+ * byte 1 = 240 + (ud div 262144)
+ * byte 2 = 128 + ((ud div 4096) mod 64)
+ * byte 3 = 128 + ((ud div 64) mod 64)
+ * byte 4 = 128 + (ud mod 64)
+ *
+ * If ud >=2097152 and <=67108863 (3FFFFFF hex) then UTF-8 is 5 bytes long.
+ * byte 1 = 248 + (ud div 16777216)
+ * byte 2 = 128 + ((ud div 262144) mod 64)
+ * byte 3 = 128 + ((ud div 4096) mod 64)
+ * byte 4 = 128 + ((ud div 64) mod 64)
+ * byte 5 = 128 + (ud mod 64)
+ *
+ * If ud >=67108864 and <=2147483647 (7FFFFFFF hex) then UTF-8 is 6 bytes long.
+ * byte 1 = 252 + (ud div 1073741824)
+ * byte 2 = 128 + ((ud div 16777216) mod 64)
+ * byte 3 = 128 + ((ud div 262144) mod 64)
+ * byte 4 = 128 + ((ud div 4096) mod 64)
+ * byte 5 = 128 + ((ud div 64) mod 64)
+ * byte 6 = 128 + (ud mod 64)
+ **/
+gint
+g_unichar_to_utf8 (gunichar c, gchar *outbuf)
+{
+ int base, n, i;
+
+ if (c < 0x80) {
+ base = 0;
+ n = 1;
+ } else if (c < 0x800) {
+ base = 192;
+ n = 2;
+ } else if (c < 0x10000) {
+ base = 224;
+ n = 3;
+ } else if (c < 0x200000) {
+ base = 240;
+ n = 4;
+ } else if (c < 0x4000000) {
+ base = 248;
+ n = 5;
+ } else if (c < 0x80000000) {
+ base = 252;
+ n = 6;
+ } else {
+ return -1;
+ }
+
+ if (outbuf != NULL) {
+ for (i = n - 1; i > 0; i--) {
+ /* mask off 6 bits worth and add 128 */
+ outbuf[i] = (c & 0x3f) | 0x80;
+ c >>= 6;
+ }
+
+ /* first character has a different base */
+ outbuf[0] = c | base;
+ }
+
+ return n;
+}
+
+static FORCE_INLINE (int)
+g_unichar_to_utf16 (gunichar c, gunichar2 *outbuf)
+{
+ gunichar c2;
+
+ if (c < 0xd800) {
+ if (outbuf)
+ *outbuf = (gunichar2) c;
+
+ return 1;
+ } else if (c < 0xe000) {
+ return -1;
+ } else if (c < 0x10000) {
+ if (outbuf)
+ *outbuf = (gunichar2) c;
+
+ return 1;
+ } else if (c < 0x110000) {
+ if (outbuf) {
+ c2 = c - 0x10000;
+
+ outbuf[0] = (gunichar2) ((c2 >> 10) + 0xd800);
+ outbuf[1] = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+ }
+
+ return 2;
+ } else {
+ return -1;
+ }
+}
+
+gunichar *
+g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written)
+{
+ gunichar *outbuf, *outptr;
+ char *inptr;
+ glong n, i;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ n = g_utf8_strlen (str, len);
+
+ if (items_written)
+ *items_written = n;
+
+ outptr = outbuf = g_malloc ((n + 1) * sizeof (gunichar));
+ inptr = (char *) str;
+
+ for (i = 0; i < n; i++) {
+ *outptr++ = g_utf8_get_char (inptr);
+ inptr = g_utf8_next_char (inptr);
+ }
+
+ *outptr = 0;
+
+ return outbuf;
+}
+
+static gunichar2 *
+eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong *items_written, gboolean
include_nuls, GError **err)
+{
+ gunichar2 *outbuf, *outptr;
+ size_t outlen = 0;
+ size_t inleft;
+ char *inptr;
+ gunichar c;
+ int u, n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ if (include_nuls) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "Conversions with embedded
nulls must pass the string length");
+ return NULL;
+ }
+
+ len = strlen (str);
+ }
+
+ inptr = (char *) str;
+ inleft = len;
+
+ while (inleft > 0) {
+ if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
+ goto error;
+
+ if (c == 0 && !include_nuls)
+ break;
+
+ if ((u = g_unichar_to_utf16 (c, NULL)) < 0) {
+ errno = EILSEQ;
+ goto error;
+ }
+
+ outlen += u;
+ inleft -= n;
+ inptr += n;
+ }
+
+ if (items_read)
+ *items_read = inptr - str;
+
+ if (items_written)
+ *items_written = outlen;
+
+ outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
+ inptr = (char *) str;
+ inleft = len;
+
+ while (inleft > 0) {
+ if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
+ break;
+
+ if (c == 0 && !include_nuls)
+ break;
+
+ outptr += g_unichar_to_utf16 (c, outptr);
+ inleft -= n;
+ inptr += n;
+ }
+
+ *outptr = '\0';
+
+ return outbuf;
+
+ error:
+ if (errno == EILSEQ) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+ } else if (items_read) {
+ /* partial input is ok if we can let our caller know... */
+ } else {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ "Partial byte sequence encountered in the input.");
+ }
+
+ if (items_read)
+ *items_read = inptr - str;
+
+ if (items_written)
+ *items_written = 0;
+
+ return NULL;
+}
+
+gunichar2 *
+g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ return eg_utf8_to_utf16_general (str, len, items_read, items_written, FALSE, err);
+}
+
+gunichar2 *
+eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError
**err)
+{
+ return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, err);
+}
+
+gunichar *
+g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ gunichar *outbuf, *outptr;
+ size_t outlen = 0;
+ size_t inleft;
+ char *inptr;
+ gunichar c;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0)
+ len = strlen (str);
+
+ inptr = (char *) str;
+ inleft = len;
+
+ while (inleft > 0) {
+ if ((n = decode_utf8 (inptr, inleft, &c)) < 0) {
+ if (errno == EILSEQ) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+ } else if (items_read) {
+ /* partial input is ok if we can let our caller know... */
+ break;
+ } else {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ "Partial byte sequence encountered in the input.");
+ }
+
+ if (items_read)
+ *items_read = inptr - str;
+
+ if (items_written)
+ *items_written = 0;
+
+ return NULL;
+ } else if (c == 0)
+ break;
+
+ outlen += 4;
+ inleft -= n;
+ inptr += n;
+ }
+
+ if (items_written)
+ *items_written = outlen / 4;
+
+ if (items_read)
+ *items_read = inptr - str;
+
+ outptr = outbuf = g_malloc (outlen + 4);
+ inptr = (char *) str;
+ inleft = len;
+
+ while (inleft > 0) {
+ if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
+ break;
+ else if (c == 0)
+ break;
+
+ *outptr++ = c;
+ inleft -= n;
+ inptr += n;
+ }
+
+ *outptr = 0;
+
+ return outbuf;
+}
+
+gchar *
+g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ char *inptr, *outbuf, *outptr;
+ size_t outlen = 0;
+ size_t inleft;
+ gunichar c;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ len = 0;
+ while (str[len])
+ len++;
+ }
+
+ inptr = (char *) str;
+ inleft = len * 2;
+
+ while (inleft > 0) {
+ if ((n = decode_utf16 (inptr, inleft, &c)) < 0) {
+ if (n == -2 && inleft > 2) {
+ /* This means that the first UTF-16 char was read, but second failed */
+ inleft -= 2;
+ inptr += 2;
+ }
+
+ if (errno == EILSEQ) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+ } else if (items_read) {
+ /* partial input is ok if we can let our caller know... */
+ break;
+ } else {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ "Partial byte sequence encountered in the input.");
+ }
+
+ if (items_read)
+ *items_read = (inptr - (char *) str) / 2;
+
+ if (items_written)
+ *items_written = 0;
+
+ return NULL;
+ } else if (c == 0)
+ break;
+
+ outlen += g_unichar_to_utf8 (c, NULL);
+ inleft -= n;
+ inptr += n;
+ }
+
+ if (items_read)
+ *items_read = (inptr - (char *) str) / 2;
+
+ if (items_written)
+ *items_written = outlen;
+
+ outptr = outbuf = g_malloc (outlen + 1);
+ inptr = (char *) str;
+ inleft = len * 2;
+
+ while (inleft > 0) {
+ if ((n = decode_utf16 (inptr, inleft, &c)) < 0)
+ break;
+ else if (c == 0)
+ break;
+
+ outptr += g_unichar_to_utf8 (c, outptr);
+ inleft -= n;
+ inptr += n;
+ }
+
+ *outptr = '\0';
+
+ return outbuf;
+}
+
+gunichar *
+g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ gunichar *outbuf, *outptr;
+ size_t outlen = 0;
+ size_t inleft;
+ char *inptr;
+ gunichar c;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ len = 0;
+ while (str[len])
+ len++;
+ }
+
+ inptr = (char *) str;
+ inleft = len * 2;
+
+ while (inleft > 0) {
+ if ((n = decode_utf16 (inptr, inleft, &c)) < 0) {
+ if (n == -2 && inleft > 2) {
+ /* This means that the first UTF-16 char was read, but second failed */
+ inleft -= 2;
+ inptr += 2;
+ }
+
+ if (errno == EILSEQ) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+ } else if (items_read) {
+ /* partial input is ok if we can let our caller know... */
+ break;
+ } else {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ "Partial byte sequence encountered in the input.");
+ }
+
+ if (items_read)
+ *items_read = (inptr - (char *) str) / 2;
+
+ if (items_written)
+ *items_written = 0;
+
+ return NULL;
+ } else if (c == 0)
+ break;
+
+ outlen += 4;
+ inleft -= n;
+ inptr += n;
+ }
+
+ if (items_read)
+ *items_read = (inptr - (char *) str) / 2;
+
+ if (items_written)
+ *items_written = outlen / 4;
+
+ outptr = outbuf = g_malloc (outlen + 4);
+ inptr = (char *) str;
+ inleft = len * 2;
+
+ while (inleft > 0) {
+ if ((n = decode_utf16 (inptr, inleft, &c)) < 0)
+ break;
+ else if (c == 0)
+ break;
+
+ *outptr++ = c;
+ inleft -= n;
+ inptr += n;
+ }
+
+ *outptr = 0;
+
+ return outbuf;
+}
+
+gchar *
+g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ char *outbuf, *outptr;
+ size_t outlen = 0;
+ glong i;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ for (i = 0; str[i] != 0; i++) {
+ if ((n = g_unichar_to_utf8 (str[i], NULL)) < 0) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+
+ if (items_written)
+ *items_written = 0;
+
+ if (items_read)
+ *items_read = i;
+
+ return NULL;
+ }
+
+ outlen += n;
+ }
+ } else {
+ for (i = 0; i < len && str[i] != 0; i++) {
+ if ((n = g_unichar_to_utf8 (str[i], NULL)) < 0) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+
+ if (items_written)
+ *items_written = 0;
+
+ if (items_read)
+ *items_read = i;
+
+ return NULL;
+ }
+
+ outlen += n;
+ }
+ }
+
+ len = i;
+
+ outptr = outbuf = g_malloc (outlen + 1);
+ for (i = 0; i < len; i++)
+ outptr += g_unichar_to_utf8 (str[i], outptr);
+ *outptr = 0;
+
+ if (items_written)
+ *items_written = outlen;
+
+ if (items_read)
+ *items_read = i;
+
+ return outbuf;
+}
+
+gunichar2 *
+g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ gunichar2 *outbuf, *outptr;
+ size_t outlen = 0;
+ glong i;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ for (i = 0; str[i] != 0; i++) {
+ if ((n = g_unichar_to_utf16 (str[i], NULL)) < 0) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+
+ if (items_written)
+ *items_written = 0;
+
+ if (items_read)
+ *items_read = i;
+
+ return NULL;
+ }
+
+ outlen += n;
+ }
+ } else {
+ for (i = 0; i < len && str[i] != 0; i++) {
+ if ((n = g_unichar_to_utf16 (str[i], NULL)) < 0) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+
+ if (items_written)
+ *items_written = 0;
+
+ if (items_read)
+ *items_read = i;
+
+ return NULL;
+ }
+
+ outlen += n;
+ }
+ }
+
+ len = i;
+
+ outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
+ for (i = 0; i < len; i++)
+ outptr += g_unichar_to_utf16 (str[i], outptr);
+ *outptr = 0;
+
+ if (items_written)
+ *items_written = outlen;
+
+ if (items_read)
+ *items_read = i;
+
+ return outbuf;
+}
diff --git a/deps/eglib/src/glib.h b/deps/eglib/src/glib.h
new file mode 100644
index 0000000..c717eed
--- /dev/null
+++ b/deps/eglib/src/glib.h
@@ -0,0 +1,1290 @@
+#ifndef __GLIB_H
+#define __GLIB_H
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <limits.h>
+#include <float.h>
+
+#ifdef _MSC_VER
+#pragma include_alias(<eglib-config.h>, <eglib-config.hw>)
+#endif
+
+/* VS 2010 and later have stdint.h */
+#if defined(_MSC_VER) && _MSC_VER < 1600
+#else
+#include <stdint.h>
+#endif
+
+#include <eglib-config.h>
+
+#ifdef G_HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
+#ifdef WIN32
+/* For alloca */
+#include <malloc.h>
+#endif
+
+#ifndef offsetof
+# define offsetof(s_name,n_name) (size_t)(char *)&(((s_name*)0)->m_name)
+#endif
+
+#define __EGLIB_X11 1
+
+#ifdef __cplusplus
+#define G_BEGIN_DECLS extern "C" {
+#define G_END_DECLS }
+#else
+#define G_BEGIN_DECLS
+#define G_END_DECLS
+#endif
+
+G_BEGIN_DECLS
+
+#ifdef G_OS_WIN32
+/* MSC and Cross-compilatin will use this */
+int vasprintf (char **strp, const char *fmt, va_list ap);
+#endif
+
+
+/*
+ * Basic data types
+ */
+typedef int gint;
+typedef unsigned int guint;
+typedef short gshort;
+typedef unsigned short gushort;
+typedef long glong;
+typedef unsigned long gulong;
+typedef void * gpointer;
+typedef const void * gconstpointer;
+typedef char gchar;
+typedef unsigned char guchar;
+
+/* VS 2010 and later have stdint.h */
+#if defined(_MSC_VER) && _MSC_VER < 1600
+typedef __int8 gint8;
+typedef unsigned __int8 guint8;
+typedef __int16 gint16;
+typedef unsigned __int16 guint16;
+typedef __int32 gint32;
+typedef unsigned __int32 guint32;
+typedef __int64 gint64;
+typedef unsigned __int64 guint64;
+typedef float gfloat;
+typedef double gdouble;
+typedef int gboolean;
+#else
+/* Types defined in terms of the stdint.h */
+typedef int8_t gint8;
+typedef uint8_t guint8;
+typedef int16_t gint16;
+typedef uint16_t guint16;
+typedef int32_t gint32;
+typedef uint32_t guint32;
+typedef int64_t gint64;
+typedef uint64_t guint64;
+typedef float gfloat;
+typedef double gdouble;
+typedef int32_t gboolean;
+#endif
+
+typedef guint16 gunichar2;
+typedef guint32 gunichar;
+
+/*
+ * Macros
+ */
+#define G_N_ELEMENTS(s) (sizeof(s) / sizeof ((s) [0]))
+#define G_STRINGIFY_ARG(arg) #arg
+#define G_STRINGIFY(arg) G_STRINGIFY_ARG(arg)
+#define G_PASTE_ARGS(part0, part1) part0 ## part1
+#define G_PASTE(part0, part1) G_PASTE_ARGS (part0, part1)
+
+#define FALSE 0
+#define TRUE 1
+
+#define G_MINSHORT SHRT_MIN
+#define G_MAXSHORT SHRT_MAX
+#define G_MAXUSHORT USHRT_MAX
+#define G_MAXINT INT_MAX
+#define G_MININT INT_MIN
+#define G_MAXINT32 INT32_MAX
+#define G_MAXUINT32 UINT32_MAX
+#define G_MININT32 INT32_MIN
+#define G_MININT64 INT64_MIN
+#define G_MAXINT64 INT64_MAX
+#define G_MAXUINT64 UINT64_MAX
+#define G_MAXFLOAT FLT_MAX
+
+#define G_LITTLE_ENDIAN 1234
+#define G_BIG_ENDIAN 4321
+#define G_STMT_START do
+#define G_STMT_END while (0)
+
+#define G_USEC_PER_SEC 1000000
+#define G_PI 3.141592653589793238462643383279502884L
+#define G_PI_2 1.570796326794896619231321691639751442L
+
+#define G_GINT64_CONSTANT(val) (val##LL)
+#define G_GUINT64_CONSTANT(val) (val##UL)
+
+#ifndef ABS
+#define ABS(a) ((a) > 0 ? (a) : -(a))
+#endif
+
+#define G_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
+
+#define G_STRLOC __FILE__ ":" G_STRINGIFY(__LINE__) ":"
+
+#define G_CONST_RETURN const
+
+/*
+ * Allocation
+ */
+void g_free (void *ptr);
+gpointer g_realloc (gpointer obj, gsize size);
+gpointer g_malloc (gsize x);
+gpointer g_malloc0 (gsize x);
+gpointer g_try_malloc (gsize x);
+gpointer g_try_realloc (gpointer obj, gsize size);
+gpointer g_memdup (gconstpointer mem, guint byte_size);
+
+#define g_new(type,size) ((type *) g_malloc (sizeof (type) * (size)))
+#define g_new0(type,size) ((type *) g_malloc0 (sizeof (type)* (size)))
+#define g_newa(type,size) ((type *) alloca (sizeof (type) * (size)))
+
+#define g_memmove(dest,src,len) memmove (dest, src, len)
+#define g_renew(struct_type, mem, n_structs) g_realloc (mem, sizeof (struct_type) * n_structs)
+#define g_alloca(size) alloca (size)
+
+#define g_slice_new(type) ((type *) g_malloc (sizeof (type)))
+#define g_slice_new0(type) ((type *) g_malloc0 (sizeof (type)))
+#define g_slice_free(type, mem) g_free (mem)
+#define g_slice_free1(size, mem) g_free (mem)
+#define g_slice_alloc(size) g_malloc (size)
+#define g_slice_alloc0(size) g_malloc0 (size)
+#define g_slice_dup(type, mem) g_memdup (mem, sizeof (type))
+#define g_slice_copy(size, mem) g_memdup (mem, size)
+
+static inline gchar *g_strdup (const gchar *str) { if (str) {return strdup (str);} return NULL; }
+gchar **g_strdupv (gchar **str_array);
+
+typedef struct {
+ gpointer (*malloc) (gsize n_bytes);
+ gpointer (*realloc) (gpointer mem, gsize n_bytes);
+ void (*free) (gpointer mem);
+ gpointer (*calloc) (gsize n_blocks, gsize n_block_bytes);
+ gpointer (*try_malloc) (gsize n_bytes);
+ gpointer (*try_realloc) (gpointer mem, gsize n_bytes);
+} GMemVTable;
+
+#define g_mem_set_vtable(x)
+
+struct _GMemChunk {
+ guint alloc_size;
+};
+
+typedef struct _GMemChunk GMemChunk;
+/*
+ * Misc.
+ */
+#define g_atexit(func) ((void) atexit (func))
+
+const gchar * g_getenv(const gchar *variable);
+gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
+void g_unsetenv(const gchar *variable);
+
+gchar* g_win32_getlocale(void);
+
+/*
+ * Precondition macros
+ */
+#define g_warn_if_fail(x) G_STMT_START { if (!(x)) { g_warning ("%s:%d: assertion '%s' failed", __FILE__,
__LINE__, #x); } } G_STMT_END
+#define g_warn_if_reached() g_warning ("%s:%d: code should not be reached!", __FILE__, __LINE__)
+
+#define g_return_if_fail(x) G_STMT_START { if (!(x)) { g_critical ("%s:%d: assertion '%s' failed",
__FILE__, __LINE__, #x); return; } } G_STMT_END
+#define g_return_val_if_fail(x,e) G_STMT_START { if (!(x)) { g_critical ("%s:%d: assertion '%s' failed",
__FILE__, __LINE__, #x); return (e); } } G_STMT_END
+#define g_return_if_reached(e) G_STMT_START { g_warning ("%s:%d: code should not be reached, returning!",
__FILE__, __LINE__); return; } G_STMT_END
+#define g_return_val_if_reached(e) G_STMT_START { g_warning ("%s:%d: code should not be reached,
returning!", __FILE__, __LINE__); return (e); } G_STMT_END
+
+/*
+ * DebugKeys
+ */
+typedef struct _GDebugKey {
+ const gchar *key;
+ guint value;
+} GDebugKey;
+
+guint g_parse_debug_string (const gchar *string, const GDebugKey *keys, guint nkeys);
+
+/*
+ * Quark
+ */
+
+typedef guint32 GQuark;
+
+GQuark
+g_quark_from_static_string (const gchar *string);
+
+/*
+ * Errors
+ */
+typedef struct {
+ GQuark domain;
+ gint code;
+ gchar *message;
+} GError;
+
+void g_clear_error (GError **error);
+void g_error_free (GError *error);
+GError *g_error_new (GQuark domain, gint code, const char *format, ...);
+GError *g_error_new_valist (GQuark domain, gint code, const char *format, va_list ap);
+void g_set_error (GError **err, GQuark domain, gint code, const gchar *format, ...);
+void g_propagate_error (GError **dest, GError *src);
+GError *g_error_copy (const GError *error);
+gboolean g_error_matches (const GError *error, GQuark domain, gint code);
+
+/*
+ * Strings utility
+ */
+gchar *g_strdup_printf (const gchar *format, ...);
+gchar *g_strdup_vprintf (const gchar *format, va_list args);
+gchar *g_strndup (const gchar *str, gsize n);
+const gchar *g_strerror (gint errnum);
+gchar *g_strndup (const gchar *str, gsize n);
+void g_strfreev (gchar **str_array);
+gchar *g_strconcat (const gchar *first, ...);
+gchar **g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
+gchar **g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens);
+gchar *g_strreverse (gchar *str);
+gboolean g_str_has_prefix (const gchar *str, const gchar *prefix);
+gboolean g_str_has_suffix (const gchar *str, const gchar *suffix);
+guint g_strv_length (gchar **str_array);
+gchar *g_strjoin (const gchar *separator, ...);
+gchar *g_strjoinv (const gchar *separator, gchar **str_array);
+gchar *g_strchug (gchar *str);
+gchar *g_strchomp (gchar *str);
+void g_strdown (gchar *string);
+gchar *g_strnfill (gsize length, gchar fill_char);
+
+gchar *g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter);
+gchar *g_strescape (const gchar *source, const gchar *exceptions);
+
+gchar *g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error);
+gchar *g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error);
+
+gint g_printf (gchar const *format, ...);
+gint g_fprintf (FILE *file, gchar const *format, ...);
+gint g_sprintf (gchar *string, gchar const *format, ...);
+gint g_snprintf (gchar *string, gulong n, gchar const *format, ...);
+#define g_vprintf vprintf
+#define g_vfprintf vfprintf
+#define g_vsprintf vsprintf
+#define g_vsnprintf vsnprintf
+#define g_vasprintf vasprintf
+
+gsize g_strlcpy (gchar *dest, const gchar *src, gsize dest_size);
+gchar *g_stpcpy (gchar *dest, const char *src);
+
+
+gchar g_ascii_tolower (gchar c);
+gchar g_ascii_toupper (gchar c);
+gchar *g_ascii_strdown (const gchar *str, gssize len);
+gchar *g_ascii_strup (const gchar *str, gssize len);
+gint g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n);
+gint g_ascii_strcasecmp (const gchar *s1, const gchar *s2);
+gint g_ascii_xdigit_value (gchar c);
+#define g_ascii_isspace(c) (isspace (c) != 0)
+#define g_ascii_isalpha(c) (isalpha (c) != 0)
+#define g_ascii_isprint(c) (isprint (c) != 0)
+#define g_ascii_isxdigit(c) (isxdigit (c) != 0)
+
+/* FIXME: g_strcasecmp supports utf8 unicode stuff */
+#ifdef _MSC_VER
+#define g_strcasecmp stricmp
+#define g_strncasecmp strnicmp
+#define g_strstrip(a) g_strchug (g_strchomp (a))
+#else
+#define g_strcasecmp strcasecmp
+#define g_ascii_strtoull strtoull
+#define g_strncasecmp strncasecmp
+#define g_strstrip(a) g_strchug (g_strchomp (a))
+#endif
+#define g_ascii_strdup strdup
+
+
+#define G_STR_DELIMITERS "_-|> <."
+
+/*
+ * String type
+ */
+typedef struct {
+ char *str;
+ gsize len;
+ gsize allocated_len;
+} GString;
+
+GString *g_string_new (const gchar *init);
+GString *g_string_new_len (const gchar *init, gssize len);
+GString *g_string_sized_new (gsize default_size);
+gchar *g_string_free (GString *string, gboolean free_segment);
+GString *g_string_assign (GString *string, const gchar *val);
+GString *g_string_append (GString *string, const gchar *val);
+void g_string_printf (GString *string, const gchar *format, ...);
+void g_string_append_printf (GString *string, const gchar *format, ...);
+void g_string_append_vprintf (GString *string, const gchar *format, va_list args);
+GString *g_string_append_unichar (GString *string, gunichar c);
+GString *g_string_append_c (GString *string, gchar c);
+GString *g_string_append (GString *string, const gchar *val);
+GString *g_string_append_len (GString *string, const gchar *val, gssize len);
+GString *g_string_truncate (GString *string, gsize len);
+GString *g_string_prepend (GString *string, const gchar *val);
+GString *g_string_insert (GString *string, gssize pos, const gchar *val);
+GString *g_string_set_size (GString *string, gsize len);
+GString *g_string_erase (GString *string, gssize pos, gssize len);
+
+#define g_string_sprintfa g_string_append_printf
+
+typedef void (*GFunc) (gpointer data, gpointer user_data);
+typedef gint (*GCompareFunc) (gconstpointer a, gconstpointer b);
+typedef gint (*GCompareDataFunc) (gconstpointer a, gconstpointer b, gpointer user_data);
+typedef void (*GHFunc) (gpointer key, gpointer value, gpointer user_data);
+typedef gboolean (*GHRFunc) (gpointer key, gpointer value, gpointer user_data);
+typedef void (*GDestroyNotify) (gpointer data);
+typedef guint (*GHashFunc) (gconstpointer key);
+typedef gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b);
+typedef void (*GFreeFunc) (gpointer data);
+
+/*
+ * Lists
+ */
+typedef struct _GSList GSList;
+struct _GSList {
+ gpointer data;
+ GSList *next;
+};
+
+GSList *g_slist_alloc (void);
+GSList *g_slist_append (GSList *list,
+ gpointer data);
+GSList *g_slist_prepend (GSList *list,
+ gpointer data);
+void g_slist_free (GSList *list);
+void g_slist_free_1 (GSList *list);
+GSList *g_slist_copy (GSList *list);
+GSList *g_slist_concat (GSList *list1,
+ GSList *list2);
+void g_slist_foreach (GSList *list,
+ GFunc func,
+ gpointer user_data);
+GSList *g_slist_last (GSList *list);
+GSList *g_slist_find (GSList *list,
+ gconstpointer data);
+GSList *g_slist_find_custom (GSList *list,
+ gconstpointer data,
+ GCompareFunc func);
+GSList *g_slist_remove (GSList *list,
+ gconstpointer data);
+GSList *g_slist_remove_all (GSList *list,
+ gconstpointer data);
+GSList *g_slist_reverse (GSList *list);
+guint g_slist_length (GSList *list);
+GSList *g_slist_remove_link (GSList *list,
+ GSList *link);
+GSList *g_slist_delete_link (GSList *list,
+ GSList *link);
+GSList *g_slist_insert_sorted (GSList *list,
+ gpointer data,
+ GCompareFunc func);
+GSList *g_slist_insert_before (GSList *list,
+ GSList *sibling,
+ gpointer data);
+GSList *g_slist_sort (GSList *list,
+ GCompareFunc func);
+gint g_slist_index (GSList *list,
+ gconstpointer data);
+GSList *g_slist_nth (GSList *list,
+ guint n);
+gpointer g_slist_nth_data (GSList *list,
+ guint n);
+
+#define g_slist_next(slist) ((slist) ? (((GSList *) (slist))->next) : NULL)
+
+
+typedef struct _GList GList;
+struct _GList {
+ gpointer data;
+ GList *next;
+ GList *prev;
+};
+
+#define g_list_next(list) ((list) ? (((GList *) (list))->next) : NULL)
+#define g_list_previous(list) ((list) ? (((GList *) (list))->prev) : NULL)
+
+GList *g_list_alloc (void);
+GList *g_list_append (GList *list,
+ gpointer data);
+GList *g_list_prepend (GList *list,
+ gpointer data);
+void g_list_free (GList *list);
+void g_list_free_full (GList *list,
+ GDestroyNotify free_func);
+void g_list_free_1 (GList *list);
+GList *g_list_copy (GList *list);
+guint g_list_length (GList *list);
+gint g_list_index (GList *list,
+ gconstpointer data);
+GList *g_list_nth (GList *list,
+ guint n);
+gpointer g_list_nth_data (GList *list,
+ guint n);
+GList *g_list_last (GList *list);
+GList *g_list_concat (GList *list1,
+ GList *list2);
+void g_list_foreach (GList *list,
+ GFunc func,
+ gpointer user_data);
+GList *g_list_first (GList *list);
+GList *g_list_find (GList *list,
+ gconstpointer data);
+GList *g_list_find_custom (GList *list,
+ gconstpointer data,
+ GCompareFunc func);
+GList *g_list_remove (GList *list,
+ gconstpointer data);
+GList *g_list_remove_all (GList *list,
+ gconstpointer data);
+GList *g_list_reverse (GList *list);
+GList *g_list_remove_link (GList *list,
+ GList *link);
+GList *g_list_delete_link (GList *list,
+ GList *link);
+GList *g_list_insert_sorted (GList *list,
+ gpointer data,
+ GCompareFunc func);
+GList *g_list_insert_before (GList *list,
+ GList *sibling,
+ gpointer data);
+GList *g_list_sort (GList *sort,
+ GCompareFunc func);
+
+/*
+ * HookLists
+ */
+typedef void (*GHookFunc) (gpointer data);
+
+typedef struct _GHook GHook;
+typedef struct _GHookList GHookList;
+
+struct _GHook {
+ GHook *next;
+ GHook *prev;
+ gpointer data;
+ gpointer func;
+ gboolean in_call;
+};
+
+struct _GHookList {
+ GHook *hooks;
+};
+
+void
+g_hook_list_init (GHookList *hook_list,
+ guint hook_size);
+
+void
+g_hook_list_invoke (GHookList *hook_list,
+ gboolean may_recurse);
+
+void
+g_hook_list_clear (GHookList *hook_list);
+
+GHook *
+g_hook_alloc (GHookList *hook_list);
+
+GHook *
+g_hook_find_func_data (GHookList *hook_list,
+ gboolean need_valids,
+ gpointer func,
+ gpointer data);
+
+void
+g_hook_destroy_link (GHookList *hook_list,
+ GHook *hook);
+
+void
+g_hook_prepend (GHookList *hook_list,
+ GHook *hook);
+
+
+/*
+ * Hashtables
+ */
+typedef struct _GHashTable GHashTable;
+typedef struct _GHashTableIter GHashTableIter;
+
+/* Private, but needed for stack allocation */
+struct _GHashTableIter
+{
+ gpointer dummy [8];
+};
+
+GHashTable *g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func);
+GHashTable *g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func, GDestroyNotify
value_destroy_func);
+void g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean
replace);
+guint g_hash_table_size (GHashTable *hash);
+GList *g_hash_table_get_keys (GHashTable *hash);
+GList *g_hash_table_get_values (GHashTable *hash);
+gpointer g_hash_table_lookup (GHashTable *hash, gconstpointer key);
+gboolean g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key,
gpointer *value);
+void g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data);
+gpointer g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data);
+gboolean g_hash_table_remove (GHashTable *hash, gconstpointer key);
+gboolean g_hash_table_steal (GHashTable *hash, gconstpointer key);
+void g_hash_table_remove_all (GHashTable *hash);
+guint g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data);
+guint g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data);
+void g_hash_table_destroy (GHashTable *hash);
+void g_hash_table_print_stats (GHashTable *table);
+
+void g_hash_table_iter_init (GHashTableIter *iter, GHashTable *hash_table);
+gboolean g_hash_table_iter_next (GHashTableIter *iter, gpointer *key, gpointer *value);
+
+guint g_spaced_primes_closest (guint x);
+
+#define g_hash_table_insert(h,k,v) g_hash_table_insert_replace ((h),(k),(v),FALSE)
+#define g_hash_table_replace(h,k,v) g_hash_table_insert_replace ((h),(k),(v),TRUE)
+
+gboolean g_direct_equal (gconstpointer v1, gconstpointer v2);
+guint g_direct_hash (gconstpointer v1);
+gboolean g_int_equal (gconstpointer v1, gconstpointer v2);
+guint g_int_hash (gconstpointer v1);
+gboolean g_str_equal (gconstpointer v1, gconstpointer v2);
+guint g_str_hash (gconstpointer v1);
+
+/*
+ * ByteArray
+ */
+
+typedef struct _GByteArray GByteArray;
+struct _GByteArray {
+ guint8 *data;
+ gint len;
+};
+
+GByteArray *g_byte_array_new (void);
+GByteArray *g_byte_array_append (GByteArray *array, const guint8 *data, guint len);
+GByteArray *g_byte_array_set_size (GByteArray *array, guint len);
+guint8 *g_byte_array_free (GByteArray *array, gboolean free_segment);
+
+/*
+ * Array
+ */
+
+typedef struct _GArray GArray;
+struct _GArray {
+ gchar *data;
+ gint len;
+};
+
+GArray *g_array_new (gboolean zero_terminated, gboolean clear_, guint element_size);
+GArray *g_array_sized_new (gboolean zero_terminated, gboolean clear_, guint element_size, guint
reserved_size);
+gchar* g_array_free (GArray *array, gboolean free_segment);
+GArray *g_array_append_vals (GArray *array, gconstpointer data, guint len);
+GArray* g_array_insert_vals (GArray *array, guint index_, gconstpointer data, guint len);
+GArray* g_array_remove_index (GArray *array, guint index_);
+GArray* g_array_remove_index_fast (GArray *array, guint index_);
+GArray *g_array_set_size (GArray *array, gint length);
+
+#define g_array_append_val(a,v) (g_array_append_vals((a),&(v),1))
+#define g_array_insert_val(a,i,v) (g_array_insert_vals((a),(i),&(v),1))
+#define g_array_index(a,t,i) (((t*)(a)->data)[(i)])
+
+/*
+ * QSort
+*/
+
+void g_qsort_with_data (gpointer base, size_t nmemb, size_t size, GCompareDataFunc compare, gpointer
user_data);
+
+/*
+ * Pointer Array
+ */
+
+typedef struct _GPtrArray GPtrArray;
+struct _GPtrArray {
+ gpointer *pdata;
+ guint len;
+};
+
+GPtrArray *g_ptr_array_new (void);
+GPtrArray *g_ptr_array_sized_new (guint reserved_size);
+GPtrArray *g_ptr_array_new_with_free_func (GDestroyNotify element_free_func);
+void g_ptr_array_add (GPtrArray *array, gpointer data);
+gboolean g_ptr_array_remove (GPtrArray *array, gpointer data);
+gpointer g_ptr_array_remove_index (GPtrArray *array, guint index);
+gboolean g_ptr_array_remove_fast (GPtrArray *array, gpointer data);
+gpointer g_ptr_array_remove_index_fast (GPtrArray *array, guint index);
+void g_ptr_array_sort (GPtrArray *array, GCompareFunc compare_func);
+void g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare_func, gpointer
user_data);
+void g_ptr_array_set_size (GPtrArray *array, gint length);
+gpointer *g_ptr_array_free (GPtrArray *array, gboolean free_seg);
+void g_ptr_array_foreach (GPtrArray *array, GFunc func, gpointer user_data);
+#define g_ptr_array_index(array,index) (array)->pdata[(index)]
+
+/*
+ * Queues
+ */
+typedef struct {
+ GList *head;
+ GList *tail;
+ guint length;
+} GQueue;
+
+#define G_QUEUE_INIT { NULL, NULL, 0 }
+
+void g_queue_init (GQueue *queue);
+gpointer g_queue_peek_head (GQueue *queue);
+gpointer g_queue_pop_head (GQueue *queue);
+gpointer g_queue_peek_tail (GQueue *queue);
+gpointer g_queue_pop_tail (GQueue *queue);
+void g_queue_push_head (GQueue *queue,
+ gpointer data);
+void g_queue_push_tail (GQueue *queue,
+ gpointer data);
+gboolean g_queue_is_empty (GQueue *queue);
+GQueue *g_queue_new (void);
+void g_queue_free (GQueue *queue);
+void g_queue_foreach (GQueue *queue, GFunc func, gpointer user_data);
+GList *g_queue_find (GQueue *queue, gconstpointer data);
+void g_queue_clear (GQueue *queue);
+
+/*
+ * Messages
+ */
+#ifndef G_LOG_DOMAIN
+#define G_LOG_DOMAIN ((gchar*) 0)
+#endif
+
+typedef enum {
+ G_LOG_FLAG_RECURSION = 1 << 0,
+ G_LOG_FLAG_FATAL = 1 << 1,
+
+ G_LOG_LEVEL_ERROR = 1 << 2,
+ G_LOG_LEVEL_CRITICAL = 1 << 3,
+ G_LOG_LEVEL_WARNING = 1 << 4,
+ G_LOG_LEVEL_MESSAGE = 1 << 5,
+ G_LOG_LEVEL_INFO = 1 << 6,
+ G_LOG_LEVEL_DEBUG = 1 << 7,
+
+ G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL)
+} GLogLevelFlags;
+
+void g_print (const gchar *format, ...);
+void g_printerr (const gchar *format, ...);
+GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);
+GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask);
+void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar
*format, va_list args);
+void g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar
*format, ...);
+void g_assertion_message (const gchar *format, ...) G_GNUC_NORETURN;
+
+#ifdef HAVE_C99_SUPPORT
+/* The for (;;) tells gc thats g_error () doesn't return, avoiding warnings */
+#define g_error(format, ...) do { g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, __VA_ARGS__); for (;;);
} while (0)
+#define g_critical(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, __VA_ARGS__)
+#define g_warning(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, __VA_ARGS__)
+#define g_message(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, __VA_ARGS__)
+#define g_debug(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, __VA_ARGS__)
+#else /* HAVE_C99_SUPPORT */
+#define g_error(...) do { g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, __VA_ARGS__); for (;;); } while (0)
+#define g_critical(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, __VA_ARGS__)
+#define g_warning(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, __VA_ARGS__)
+#define g_message(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
+#define g_debug(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#endif /* ndef HAVE_C99_SUPPORT */
+#define g_log_set_handler(a,b,c,d)
+
+#define G_GNUC_INTERNAL
+
+/*
+ * Conversions
+ */
+
+GQuark g_convert_error_quark(void);
+
+
+/*
+ * Unicode Manipulation: most of this is not used by Mono by default, it is
+ * only used if the old collation code is activated, so this is only the
+ * bare minimum to build.
+ */
+
+typedef enum {
+ G_UNICODE_CONTROL,
+ G_UNICODE_FORMAT,
+ G_UNICODE_UNASSIGNED,
+ G_UNICODE_PRIVATE_USE,
+ G_UNICODE_SURROGATE,
+ G_UNICODE_LOWERCASE_LETTER,
+ G_UNICODE_MODIFIER_LETTER,
+ G_UNICODE_OTHER_LETTER,
+ G_UNICODE_TITLECASE_LETTER,
+ G_UNICODE_UPPERCASE_LETTER,
+ G_UNICODE_COMBINING_MARK,
+ G_UNICODE_ENCLOSING_MARK,
+ G_UNICODE_NON_SPACING_MARK,
+ G_UNICODE_DECIMAL_NUMBER,
+ G_UNICODE_LETTER_NUMBER,
+ G_UNICODE_OTHER_NUMBER,
+ G_UNICODE_CONNECT_PUNCTUATION,
+ G_UNICODE_DASH_PUNCTUATION,
+ G_UNICODE_CLOSE_PUNCTUATION,
+ G_UNICODE_FINAL_PUNCTUATION,
+ G_UNICODE_INITIAL_PUNCTUATION,
+ G_UNICODE_OTHER_PUNCTUATION,
+ G_UNICODE_OPEN_PUNCTUATION,
+ G_UNICODE_CURRENCY_SYMBOL,
+ G_UNICODE_MODIFIER_SYMBOL,
+ G_UNICODE_MATH_SYMBOL,
+ G_UNICODE_OTHER_SYMBOL,
+ G_UNICODE_LINE_SEPARATOR,
+ G_UNICODE_PARAGRAPH_SEPARATOR,
+ G_UNICODE_SPACE_SEPARATOR
+} GUnicodeType;
+
+typedef enum {
+ G_UNICODE_BREAK_MANDATORY,
+ G_UNICODE_BREAK_CARRIAGE_RETURN,
+ G_UNICODE_BREAK_LINE_FEED,
+ G_UNICODE_BREAK_COMBINING_MARK,
+ G_UNICODE_BREAK_SURROGATE,
+ G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
+ G_UNICODE_BREAK_INSEPARABLE,
+ G_UNICODE_BREAK_NON_BREAKING_GLUE,
+ G_UNICODE_BREAK_CONTINGENT,
+ G_UNICODE_BREAK_SPACE,
+ G_UNICODE_BREAK_AFTER,
+ G_UNICODE_BREAK_BEFORE,
+ G_UNICODE_BREAK_BEFORE_AND_AFTER,
+ G_UNICODE_BREAK_HYPHEN,
+ G_UNICODE_BREAK_NON_STARTER,
+ G_UNICODE_BREAK_OPEN_PUNCTUATION,
+ G_UNICODE_BREAK_CLOSE_PUNCTUATION,
+ G_UNICODE_BREAK_QUOTATION,
+ G_UNICODE_BREAK_EXCLAMATION,
+ G_UNICODE_BREAK_IDEOGRAPHIC,
+ G_UNICODE_BREAK_NUMERIC,
+ G_UNICODE_BREAK_INFIX_SEPARATOR,
+ G_UNICODE_BREAK_SYMBOL,
+ G_UNICODE_BREAK_ALPHABETIC,
+ G_UNICODE_BREAK_PREFIX,
+ G_UNICODE_BREAK_POSTFIX,
+ G_UNICODE_BREAK_COMPLEX_CONTEXT,
+ G_UNICODE_BREAK_AMBIGUOUS,
+ G_UNICODE_BREAK_UNKNOWN,
+ G_UNICODE_BREAK_NEXT_LINE,
+ G_UNICODE_BREAK_WORD_JOINER,
+ G_UNICODE_BREAK_HANGUL_L_JAMO,
+ G_UNICODE_BREAK_HANGUL_V_JAMO,
+ G_UNICODE_BREAK_HANGUL_T_JAMO,
+ G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
+ G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
+} GUnicodeBreakType;
+
+gunichar g_unichar_toupper (gunichar c);
+gunichar g_unichar_tolower (gunichar c);
+gunichar g_unichar_totitle (gunichar c);
+GUnicodeType g_unichar_type (gunichar c);
+gboolean g_unichar_isspace (gunichar c);
+gboolean g_unichar_isxdigit (gunichar c);
+gint g_unichar_xdigit_value (gunichar c);
+GUnicodeBreakType g_unichar_break_type (gunichar c);
+
+#ifndef MAX
+#define MAX(a,b) (((a)>(b)) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#define MIN(a,b) (((a)<(b)) ? (a) : (b))
+#endif
+
+#ifndef CLAMP
+#define CLAMP(a,low,high) (((a) < (low)) ? (low) : (((a) > (high)) ? (high) : (a)))
+#endif
+
+#if defined(__GNUC__)
+# define G_LIKELY(expr) (__builtin_expect ((expr) != 0, 1))
+# define G_UNLIKELY(expr) (__builtin_expect ((expr) != 0, 0))
+# define G_GNUC_PRINTF(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#else
+# define G_LIKELY(expr) (expr)
+# define G_UNLIKELY(expr) (expr)
+# define G_GNUC_PRINTF(format_idx, arg_idx)
+#endif
+
+#if defined(__GNUC__)
+# define G_STRFUNC ((const char *)(__PRETTY_FUNCTION__))
+#elif defined (_MSC_VER)
+# define G_STRFUNC ((const char*) (__FUNCTION__))
+#else
+# define G_STRFUNC ((const char*) (__func__))
+#endif
+
+#if defined (_MSC_VER)
+# define G_VA_COPY(dest, src) ((dest) = (src))
+#else
+# define G_VA_COPY(dest, src) va_copy (dest, src)
+#endif
+
+#define g_assert(x) G_STMT_START { if (G_UNLIKELY (!(x))) g_assertion_message ("* Assertion at %s:%d,
condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END
+#define g_assert_not_reached() G_STMT_START { g_assertion_message ("* Assertion: should not be reached at
%s:%d\n", __FILE__, __LINE__); } G_STMT_END
+
+#define g_assert_cmpstr(s1, cmp, s2) \
+ G_STMT_START { \
+ const char *_s1 = s1; \
+ const char *_s2 = s2; \
+ if (!(strcmp (_s1, _s2) cmp 0)) \
+ g_assertion_message ("* Assertion at %s:%d, condition \"%s\" " #cmp " \"%s\" failed\n", __FILE__,
__LINE__, _s1, _s2); \
+ } G_STMT_END
+#define g_assert_cmpint(n1, cmp, n2) \
+ G_STMT_START { \
+ int _n1 = n1; \
+ int _n2 = n2; \
+ if (!(_n1 cmp _n2)) \
+ g_assertion_message ("* Assertion at %s:%d, condition %d " #cmp " %d failed\n", __FILE__, __LINE__,
_n1, _n2); \
+ } G_STMT_END
+#define g_assert_cmpuint(n1, cmp, n2) \
+ G_STMT_START { \
+ int _n1 = n1; \
+ int _n2 = n2; \
+ if (!(_n1 cmp _n2)) \
+ g_assertion_message ("* Assertion at %s:%d, condition %u " #cmp " %u failed\n", __FILE__, __LINE__,
_n1, _n2); \
+ } G_STMT_END
+#define g_assert_cmpfloat(n1, cmp, n2) \
+ G_STMT_START { \
+ float _n1 = n1; \
+ float _n2 = n2; \
+ if (!(_n1 cmp _n2)) \
+ g_assertion_message ("* Assertion at %s:%d, condition %f " #cmp " %f failed\n", __FILE__, __LINE__,
_n1, _n2); \
+ } G_STMT_END
+
+/*
+ * Unicode conversion
+ */
+
+#define G_CONVERT_ERROR g_convert_error_quark()
+
+typedef enum {
+ G_CONVERT_ERROR_NO_CONVERSION,
+ G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ G_CONVERT_ERROR_FAILED,
+ G_CONVERT_ERROR_PARTIAL_INPUT,
+ G_CONVERT_ERROR_BAD_URI,
+ G_CONVERT_ERROR_NOT_ABSOLUTE_PATH
+} GConvertError;
+
+gchar *g_utf8_strup (const gchar *str, gssize len);
+gchar *g_utf8_strdown (const gchar *str, gssize len);
+gint g_unichar_to_utf8 (gunichar c, gchar *outbuf);
+gunichar *g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written);
+gunichar *g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, GError
**err);
+gunichar2 *g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError
**err);
+gunichar2 *eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written,
GError **err);
+gchar *g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError
**err);
+gunichar *g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError
**err);
+gchar *g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError
**err);
+gunichar2 *g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError
**err);
+
+#define u8to16(str) g_utf8_to_utf16(str, (glong)strlen(str), NULL, NULL, NULL)
+
+#ifdef G_OS_WIN32
+#define u16to8(str) g_utf16_to_utf8((gunichar2 *) (str), (glong)wcslen((wchar_t *) (str)), NULL, NULL, NULL)
+#else
+#define u16to8(str) g_utf16_to_utf8(str, (glong)strlen(str), NULL, NULL, NULL)
+#endif
+
+/*
+ * Path
+ */
+gchar *g_build_path (const gchar *separator, const gchar *first_element, ...);
+#define g_build_filename(x, ...) g_build_path(G_DIR_SEPARATOR_S, x, __VA_ARGS__)
+gchar *g_path_get_dirname (const gchar *filename);
+gchar *g_path_get_basename (const char *filename);
+gchar *g_find_program_in_path (const gchar *program);
+gchar *g_get_current_dir (void);
+gboolean g_path_is_absolute (const char *filename);
+
+const gchar *g_get_home_dir (void);
+const gchar *g_get_tmp_dir (void);
+const gchar *g_get_user_name (void);
+gchar *g_get_prgname (void);
+void g_set_prgname (const gchar *prgname);
+
+/*
+ * Shell
+ */
+
+GQuark g_shell_error_get_quark (void);
+
+#define G_SHELL_ERROR g_shell_error_get_quark ()
+
+typedef enum {
+ G_SHELL_ERROR_BAD_QUOTING,
+ G_SHELL_ERROR_EMPTY_STRING,
+ G_SHELL_ERROR_FAILED
+} GShellError;
+
+
+gboolean g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error);
+gchar *g_shell_unquote (const gchar *quoted_string, GError **error);
+gchar *g_shell_quote (const gchar *unquoted_string);
+
+/*
+ * Spawn
+ */
+GQuark g_shell_error_get_quark (void);
+
+#define G_SPAWN_ERROR g_shell_error_get_quark ()
+
+typedef enum {
+ G_SPAWN_ERROR_FORK,
+ G_SPAWN_ERROR_READ,
+ G_SPAWN_ERROR_CHDIR,
+ G_SPAWN_ERROR_ACCES,
+ G_SPAWN_ERROR_PERM,
+ G_SPAWN_ERROR_TOO_BIG,
+ G_SPAWN_ERROR_NOEXEC,
+ G_SPAWN_ERROR_NAMETOOLONG,
+ G_SPAWN_ERROR_NOENT,
+ G_SPAWN_ERROR_NOMEM,
+ G_SPAWN_ERROR_NOTDIR,
+ G_SPAWN_ERROR_LOOP,
+ G_SPAWN_ERROR_TXTBUSY,
+ G_SPAWN_ERROR_IO,
+ G_SPAWN_ERROR_NFILE,
+ G_SPAWN_ERROR_MFILE,
+ G_SPAWN_ERROR_INVAL,
+ G_SPAWN_ERROR_ISDIR,
+ G_SPAWN_ERROR_LIBBAD,
+ G_SPAWN_ERROR_FAILED
+} GSpawnError;
+
+typedef enum {
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1,
+ G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1,
+ G_SPAWN_SEARCH_PATH = 1 << 2,
+ G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3,
+ G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4,
+ G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5,
+ G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6
+} GSpawnFlags;
+
+typedef void (*GSpawnChildSetupFunc) (gpointer user_data);
+
+gboolean g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar
**standard_error, gint *exit_status, GError **error);
+gboolean g_spawn_async_with_pipes (const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags
flags, GSpawnChildSetupFunc child_setup,
+ gpointer user_data, GPid *child_pid, gint *standard_input, gint
*standard_output, gint *standard_error, GError **error);
+
+
+/*
+ * Timer
+ */
+typedef struct _GTimer GTimer;
+
+GTimer *g_timer_new (void);
+void g_timer_destroy (GTimer *timer);
+gdouble g_timer_elapsed (GTimer *timer, gulong *microseconds);
+void g_timer_stop (GTimer *timer);
+void g_timer_start (GTimer *timer);
+
+/*
+ * Date and time
+ */
+typedef struct {
+ glong tv_sec;
+ glong tv_usec;
+} GTimeVal;
+
+void g_get_current_time (GTimeVal *result);
+void g_usleep (gulong microseconds);
+
+/*
+ * File
+ */
+
+GQuark g_file_error_quark (void);
+
+#define G_FILE_ERROR g_file_error_quark ()
+
+typedef enum {
+ G_FILE_ERROR_EXIST,
+ G_FILE_ERROR_ISDIR,
+ G_FILE_ERROR_ACCES,
+ G_FILE_ERROR_NAMETOOLONG,
+ G_FILE_ERROR_NOENT,
+ G_FILE_ERROR_NOTDIR,
+ G_FILE_ERROR_NXIO,
+ G_FILE_ERROR_NODEV,
+ G_FILE_ERROR_ROFS,
+ G_FILE_ERROR_TXTBSY,
+ G_FILE_ERROR_FAULT,
+ G_FILE_ERROR_LOOP,
+ G_FILE_ERROR_NOSPC,
+ G_FILE_ERROR_NOMEM,
+ G_FILE_ERROR_MFILE,
+ G_FILE_ERROR_NFILE,
+ G_FILE_ERROR_BADF,
+ G_FILE_ERROR_INVAL,
+ G_FILE_ERROR_PIPE,
+ G_FILE_ERROR_AGAIN,
+ G_FILE_ERROR_INTR,
+ G_FILE_ERROR_IO,
+ G_FILE_ERROR_PERM,
+ G_FILE_ERROR_NOSYS,
+ G_FILE_ERROR_FAILED
+} GFileError;
+
+typedef enum {
+ G_FILE_TEST_IS_REGULAR = 1 << 0,
+ G_FILE_TEST_IS_SYMLINK = 1 << 1,
+ G_FILE_TEST_IS_DIR = 1 << 2,
+ G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
+ G_FILE_TEST_EXISTS = 1 << 4
+} GFileTest;
+
+
+gboolean g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **error);
+gboolean g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error);
+GFileError g_file_error_from_errno (gint err_no);
+gint g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error);
+gboolean g_file_test (const gchar *filename, GFileTest test);
+
+#define g_open open
+#define g_rename rename
+#define g_stat stat
+#define g_unlink unlink
+#define g_fopen fopen
+#define g_lstat lstat
+#define g_rmdir rmdir
+#define g_mkstemp mkstemp
+#define g_ascii_isdigit isdigit
+#define g_ascii_strtod strtod
+#define g_ascii_isalnum isalnum
+
+/*
+ * Pattern matching
+ */
+typedef struct _GPatternSpec GPatternSpec;
+GPatternSpec * g_pattern_spec_new (const gchar *pattern);
+void g_pattern_spec_free (GPatternSpec *pspec);
+gboolean g_pattern_match_string (GPatternSpec *pspec, const gchar *string);
+
+/*
+ * Directory
+ */
+typedef struct _GDir GDir;
+GDir *g_dir_open (const gchar *path, guint flags, GError **error);
+const gchar *g_dir_read_name (GDir *dir);
+void g_dir_rewind (GDir *dir);
+void g_dir_close (GDir *dir);
+
+int g_mkdir_with_parents (const gchar *pathname, int mode);
+#define g_mkdir mkdir
+
+/*
+ * GMarkup
+ */
+
+GQuark g_markup_error_quark (void);
+
+#define G_MARKUP_ERROR g_markup_error_quark()
+
+typedef enum {
+ G_MARKUP_ERROR_BAD_UTF8,
+ G_MARKUP_ERROR_EMPTY,
+ G_MARKUP_ERROR_PARSE,
+ G_MARKUP_ERROR_UNKNOWN_ELEMENT,
+ G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ G_MARKUP_ERROR_MISSING_ATTRIBUTE
+} GMarkupError;
+
+typedef struct _GMarkupParseContext GMarkupParseContext;
+
+typedef enum
+{
+ G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0,
+ G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1
+} GMarkupParseFlags;
+
+typedef struct {
+ void (*start_element) (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error);
+
+ void (*end_element) (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error);
+
+ void (*text) (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error);
+
+ void (*passthrough) (GMarkupParseContext *context,
+ const gchar *passthrough_text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error);
+ void (*error) (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data);
+} GMarkupParser;
+
+GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser,
+ GMarkupParseFlags flags,
+ gpointer user_data,
+ GDestroyNotify user_data_dnotify);
+void g_markup_parse_context_free (GMarkupParseContext *context);
+gboolean g_markup_parse_context_parse (GMarkupParseContext *context,
+ const gchar *text, gssize text_len,
+ GError **error);
+gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context,
+ GError **error);
+
+/*
+ * Character set conversion
+ */
+typedef struct _GIConv *GIConv;
+
+gsize g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft, gchar **outbytes, gsize *outbytesleft);
+GIConv g_iconv_open (const gchar *to_charset, const gchar *from_charset);
+int g_iconv_close (GIConv cd);
+
+gboolean g_get_charset (G_CONST_RETURN char **charset);
+gchar *g_locale_to_utf8 (const gchar *opsysstring, gssize len,
+ gsize *bytes_read, gsize *bytes_written,
+ GError **error);
+gchar *g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read,
+ gsize *bytes_written, GError **error);
+gchar *g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read,
+ gsize *bytes_written, GError **error);
+gchar *g_convert (const gchar *str, gssize len,
+ const gchar *to_codeset, const gchar *from_codeset,
+ gsize *bytes_read, gsize *bytes_written, GError **error);
+
+/*
+ * Unicode manipulation
+ */
+extern const guchar g_utf8_jump_table[256];
+
+gboolean g_utf8_validate (const gchar *str, gssize max_len, const gchar **end);
+gunichar g_utf8_get_char_validated (const gchar *str, gssize max_len);
+gchar *g_utf8_find_prev_char (const char *str, const char *p);
+gchar *g_utf8_prev_char (const char *str);
+#define g_utf8_next_char(p) ((p) + g_utf8_jump_table[(guchar)(*p)])
+gunichar g_utf8_get_char (const gchar *src);
+glong g_utf8_strlen (const gchar *str, gssize max);
+gchar *g_utf8_offset_to_pointer (const gchar *str, glong offset);
+glong g_utf8_pointer_to_offset (const gchar *str, const gchar *pos);
+
+/*
+ * priorities
+ */
+#define G_PRIORITY_DEFAULT 0
+#define G_PRIORITY_DEFAULT_IDLE 200
+
+/*
+ * Empty thread functions, not used by eglib
+ */
+#define g_thread_supported() TRUE
+#define g_thread_init(x) G_STMT_START { if (x != NULL) { g_error ("No vtable supported in
g_thread_init"); } } G_STMT_END
+
+#define G_LOCK_DEFINE(name) int name;
+#define G_LOCK_DEFINE_STATIC(name) static int name;
+#define G_LOCK_EXTERN(name)
+#define G_LOCK(name)
+#define G_TRYLOCK(name)
+#define G_UNLOCK(name)
+
+#define GUINT16_SWAP_LE_BE_CONSTANT(x) ((((guint16) x) >> 8) | ((((guint16) x) << 8)))
+
+#define GUINT16_SWAP_LE_BE(x) ((guint16) (((guint16) x) >> 8) | ((((guint16)(x)) & 0xff) << 8))
+#define GUINT32_SWAP_LE_BE(x) ((guint32) \
+ ( (((guint32) (x)) << 24)| \
+ ((((guint32) (x)) & 0xff0000) >> 8) | \
+ ((((guint32) (x)) & 0xff00) << 8) | \
+ (((guint32) (x)) >> 24)) )
+
+#define GUINT64_SWAP_LE_BE(x) ((guint64) (((guint64)(GUINT32_SWAP_LE_BE(((guint64)x) & 0xffffffff))) << 32)
| \
+ GUINT32_SWAP_LE_BE(((guint64)x) >> 32))
+
+
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+# define GUINT64_FROM_BE(x) GUINT64_SWAP_LE_BE(x)
+# define GUINT32_FROM_BE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT16_FROM_BE(x) GUINT16_SWAP_LE_BE(x)
+# define GUINT_FROM_BE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT64_FROM_LE(x) (x)
+# define GUINT32_FROM_LE(x) (x)
+# define GUINT16_FROM_LE(x) (x)
+# define GUINT_FROM_LE(x) (x)
+# define GUINT64_TO_BE(x) GUINT64_SWAP_LE_BE(x)
+# define GUINT32_TO_BE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT16_TO_BE(x) GUINT16_SWAP_LE_BE(x)
+# define GUINT_TO_BE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT64_TO_LE(x) (x)
+# define GUINT32_TO_LE(x) (x)
+# define GUINT16_TO_LE(x) (x)
+# define GUINT_TO_LE(x) (x)
+#else
+# define GUINT64_FROM_BE(x) (x)
+# define GUINT32_FROM_BE(x) (x)
+# define GUINT16_FROM_BE(x) (x)
+# define GUINT_FROM_BE(x) (x)
+# define GUINT64_FROM_LE(x) GUINT64_SWAP_LE_BE(x)
+# define GUINT32_FROM_LE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT16_FROM_LE(x) GUINT16_SWAP_LE_BE(x)
+# define GUINT_FROM_LE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT64_TO_BE(x) (x)
+# define GUINT32_TO_BE(x) (x)
+# define GUINT16_TO_BE(x) (x)
+# define GUINT_TO_BE(x) (x)
+# define GUINT64_TO_LE(x) GUINT64_SWAP_LE_BE(x)
+# define GUINT32_TO_LE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT16_TO_LE(x) GUINT16_SWAP_LE_BE(x)
+# define GUINT_TO_LE(x) GUINT32_SWAP_LE_BE(x)
+#endif
+
+#define GINT64_FROM_BE(x) (GUINT64_TO_BE (x))
+#define GINT32_FROM_BE(x) (GUINT32_TO_BE (x))
+#define GINT16_FROM_BE(x) (GUINT16_TO_BE (x))
+#define GINT64_FROM_LE(x) (GUINT64_TO_LE (x))
+#define GINT32_FROM_LE(x) (GUINT32_TO_LE (x))
+#define GINT16_FROM_LE(x) (GUINT16_TO_LE (x))
+
+#define _EGLIB_MAJOR 2
+#define _EGLIB_MIDDLE 4
+#define _EGLIB_MINOR 0
+
+#define GLIB_CHECK_VERSION(a,b,c) ((a < _EGLIB_MAJOR) || (a == _EGLIB_MAJOR && (b < _EGLIB_MIDDLE || (b ==
_EGLIB_MIDDLE && c <= _EGLIB_MINOR))))
+
+G_END_DECLS
+
+#endif
+
+
+
diff --git a/deps/eglib/src/glist.c b/deps/eglib/src/glist.c
new file mode 100644
index 0000000..0bf2113
--- /dev/null
+++ b/deps/eglib/src/glist.c
@@ -0,0 +1,359 @@
+/*
+ * glist.c: Doubly-linked list implementation
+ *
+ * Authors:
+ * Duncan Mak (duncan novell com)
+ * Raja R Harinath (rharinath novell com)
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * (C) 2006 Novell, Inc.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <glib.h>
+
+GList*
+g_list_alloc ()
+{
+ return g_new0 (GList, 1);
+}
+
+static inline GList*
+new_node (GList *prev, gpointer data, GList *next)
+{
+ GList *node = g_list_alloc ();
+ node->data = data;
+ node->prev = prev;
+ node->next = next;
+ if (prev)
+ prev->next = node;
+ if (next)
+ next->prev = node;
+ return node;
+}
+
+static inline GList*
+disconnect_node (GList *node)
+{
+ if (node->next)
+ node->next->prev = node->prev;
+ if (node->prev)
+ node->prev->next = node->next;
+ return node;
+}
+
+GList *
+g_list_prepend (GList *list, gpointer data)
+{
+ return new_node (list ? list->prev : NULL, data, list);
+}
+
+void
+g_list_free_1 (GList *list)
+{
+ g_free (list);
+}
+
+void
+g_list_free (GList *list)
+{
+ while (list){
+ GList *next = list->next;
+ g_list_free_1 (list);
+ list = next;
+ }
+}
+
+void
+g_list_free_full (GList *list, GDestroyNotify free_func)
+{
+ while (list){
+ GList *next = list->next;
+ free_func (list->data);
+ g_list_free_1 (list);
+ list = next;
+ }
+}
+
+GList*
+g_list_append (GList *list, gpointer data)
+{
+ GList *node = new_node (g_list_last (list), data, NULL);
+ return list ? list : node;
+}
+
+GList *
+g_list_concat (GList *list1, GList *list2)
+{
+ if (list1 && list2) {
+ list2->prev = g_list_last (list1);
+ list2->prev->next = list2;
+ }
+ return list1 ? list1 : list2;
+}
+
+guint
+g_list_length (GList *list)
+{
+ guint length = 0;
+
+ while (list) {
+ length ++;
+ list = list->next;
+ }
+
+ return length;
+}
+
+GList*
+g_list_remove (GList *list, gconstpointer data)
+{
+ GList *current = g_list_find (list, data);
+ if (!current)
+ return list;
+
+ if (current == list)
+ list = list->next;
+ g_list_free_1 (disconnect_node (current));
+
+ return list;
+}
+
+GList*
+g_list_remove_all (GList *list, gconstpointer data)
+{
+ GList *current = g_list_find (list, data);
+
+ if (!current)
+ return list;
+
+ while (current) {
+ if (current == list)
+ list = list->next;
+ g_list_free_1 (disconnect_node (current));
+
+ current = g_list_find (list, data);
+ }
+
+ return list;
+}
+
+GList*
+g_list_remove_link (GList *list, GList *link)
+{
+ if (list == link)
+ list = list->next;
+
+ disconnect_node (link);
+ link->next = NULL;
+ link->prev = NULL;
+
+ return list;
+}
+
+GList*
+g_list_delete_link (GList *list, GList *link)
+{
+ list = g_list_remove_link (list, link);
+ g_list_free_1 (link);
+
+ return list;
+}
+
+GList*
+g_list_find (GList *list, gconstpointer data)
+{
+ while (list){
+ if (list->data == data)
+ return list;
+
+ list = list->next;
+ }
+
+ return NULL;
+}
+
+GList*
+g_list_find_custom (GList *list, gconstpointer data, GCompareFunc func)
+{
+ if (!func)
+ return NULL;
+
+ while (list) {
+ if (func (list->data, data) == 0)
+ return list;
+
+ list = list->next;
+ }
+
+ return NULL;
+}
+
+GList*
+g_list_reverse (GList *list)
+{
+ GList *reverse = NULL;
+
+ while (list) {
+ reverse = list;
+ list = reverse->next;
+
+ reverse->next = reverse->prev;
+ reverse->prev = list;
+ }
+
+ return reverse;
+}
+
+GList*
+g_list_first (GList *list)
+{
+ if (!list)
+ return NULL;
+
+ while (list->prev)
+ list = list->prev;
+
+ return list;
+}
+
+GList*
+g_list_last (GList *list)
+{
+ if (!list)
+ return NULL;
+
+ while (list->next)
+ list = list->next;
+
+ return list;
+}
+
+GList*
+g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func)
+{
+ GList *prev = NULL;
+ GList *current;
+ GList *node;
+
+ if (!func)
+ return list;
+
+ /* Invariant: !prev || func (prev->data, data) <= 0) */
+ for (current = list; current; current = current->next) {
+ if (func (current->data, data) > 0)
+ break;
+ prev = current;
+ }
+
+ node = new_node (prev, data, current);
+ return list == current ? node : list;
+}
+
+GList*
+g_list_insert_before (GList *list, GList *sibling, gpointer data)
+{
+ if (sibling) {
+ GList *node = new_node (sibling->prev, data, sibling);
+ return list == sibling ? node : list;
+ }
+ return g_list_append (list, data);
+}
+
+void
+g_list_foreach (GList *list, GFunc func, gpointer user_data)
+{
+ while (list){
+ (*func) (list->data, user_data);
+ list = list->next;
+ }
+}
+
+gint
+g_list_index (GList *list, gconstpointer data)
+{
+ gint index = 0;
+
+ while (list){
+ if (list->data == data)
+ return index;
+
+ index ++;
+ list = list->next;
+ }
+
+ return -1;
+}
+
+GList*
+g_list_nth (GList *list, guint n)
+{
+ for (; list; list = list->next) {
+ if (n == 0)
+ break;
+ n--;
+ }
+ return list;
+}
+
+gpointer
+g_list_nth_data (GList *list, guint n)
+{
+ GList *node = g_list_nth (list, n);
+ return node ? node->data : NULL;
+}
+
+GList*
+g_list_copy (GList *list)
+{
+ GList *copy = NULL;
+
+ if (list) {
+ GList *tmp = new_node (NULL, list->data, NULL);
+ copy = tmp;
+
+ for (list = list->next; list; list = list->next)
+ tmp = new_node (tmp, list->data, NULL);
+ }
+
+ return copy;
+}
+
+typedef GList list_node;
+#include "sort.frag.h"
+
+GList*
+g_list_sort (GList *list, GCompareFunc func)
+{
+ GList *current;
+ if (!list || !list->next)
+ return list;
+ list = do_sort (list, func);
+
+ /* Fixup: do_sort doesn't update 'prev' pointers */
+ list->prev = NULL;
+ for (current = list; current->next; current = current->next)
+ current->next->prev = current;
+
+ return list;
+}
diff --git a/deps/eglib/src/gmarkup.c b/deps/eglib/src/gmarkup.c
new file mode 100644
index 0000000..7a1c096
--- /dev/null
+++ b/deps/eglib/src/gmarkup.c
@@ -0,0 +1,487 @@
+/*
+ * gmakrup.c: Minimal XML markup reader.
+ *
+ * Unlike the GLib one, this can not be restarted with more text
+ * as the Mono use does not require it.
+ *
+ * Actually, with further thought, I think that this could be made
+ * to restart very easily. The pos == end condition would mean
+ * "return to caller" and only at end parse this would be a fatal
+ * error.
+ *
+ * Not that it matters to Mono, but it is very simple to change, there
+ * is a tricky situation: there are a few places where we check p+n
+ * in the source, and that would have to change to be progressive, instead
+ * of depending on the string to be complete at that point, so we would
+ * have to introduce extra states to cope with that.
+ *
+ * Author:
+ * Miguel de Icaza (miguel novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <ctype.h>
+#include <glib.h>
+
+GQuark
+g_markup_error_quark (void)
+{
+ return g_quark_from_static_string ("g-markup-error-quark");
+}
+
+#define set_error(code, msg, ...) do { \
+ if (error != NULL) *error = \
+ g_error_new (g_markup_error_quark (), \
+ G_MARKUP_ERROR_ ## code, msg, __VA_ARGS__); \
+} while (0);
+
+typedef enum {
+ START,
+ START_ELEMENT,
+ TEXT,
+ FLUSH_TEXT,
+ CLOSING_ELEMENT,
+ COMMENT,
+ SKIP_XML_DECLARATION
+} ParseState;
+
+struct _GMarkupParseContext {
+ GMarkupParser parser;
+ gpointer user_data;
+ GDestroyNotify user_data_dnotify;
+ ParseState state;
+
+ /* Stores the name of the current element, so we can issue the end_element */
+ GSList *level;
+
+ GString *text;
+};
+
+GMarkupParseContext *
+g_markup_parse_context_new (const GMarkupParser *parser,
+ GMarkupParseFlags flags,
+ gpointer user_data,
+ GDestroyNotify user_data_dnotify)
+{
+ GMarkupParseContext *context = g_new0 (GMarkupParseContext, 1);
+
+ context->parser = *parser;
+ context->user_data = user_data;
+ context->user_data_dnotify = user_data_dnotify;
+
+ return context;
+}
+
+void
+g_markup_parse_context_free (GMarkupParseContext *context)
+{
+ GSList *l;
+
+ g_return_if_fail (context != NULL);
+
+ if (context->user_data_dnotify != NULL)
+ (context->user_data_dnotify) (context->user_data);
+
+ if (context->text != NULL)
+ g_string_free (context->text, TRUE);
+ for (l = context->level; l; l = l->next)
+ g_free (l->data);
+ g_slist_free (context->level);
+ g_free (context);
+}
+
+static gboolean
+my_isspace (char c)
+{
+ if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\v')
+ return TRUE;
+ return FALSE;
+}
+
+static gboolean
+my_isalnum (char c)
+{
+ if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
+ return TRUE;
+ if (c >= '0' && c <= '9')
+ return TRUE;
+
+ return FALSE;
+}
+
+static gboolean
+my_isalpha (char c)
+{
+ if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
+ return TRUE;
+ return FALSE;
+}
+
+static const char *
+skip_space (const char *p, const char *end)
+{
+ for (; p < end && my_isspace (*p); p++)
+ ;
+ return p;
+}
+
+static const char *
+parse_value (const char *p, const char *end, char **value, GError **error)
+{
+ const char *start;
+ int l;
+
+ if (*p != '"'){
+ set_error (PARSE, "%s", "Expected the attribute value to start with a quote");
+ return end;
+ }
+ start = ++p;
+ for (; p < end && *p != '"'; p++)
+ ;
+ if (p == end)
+ return end;
+ l = (int)(p - start);
+ p++;
+ *value = g_malloc (l + 1);
+ if (*value == NULL)
+ return end;
+ strncpy (*value, start, l);
+ (*value) [l] = 0;
+ return p;
+}
+
+static const char *
+parse_name (const char *p, const char *end, char **value)
+{
+ const char *start = p;
+ int l;
+
+ for (; p < end && my_isalnum (*p); p++)
+ ;
+ if (p == end)
+ return end;
+
+ l = (int)(p - start);
+ *value = g_malloc (l + 1);
+ if (*value == NULL)
+ return end;
+ strncpy (*value, start, l);
+ (*value) [l] = 0;
+ return p;
+}
+
+static const char *
+parse_attributes (const char *p, const char *end, char ***names, char ***values, GError **error, int
*full_stop, int state)
+{
+ int nnames = 0;
+
+ while (TRUE){
+ p = skip_space (p, end);
+ if (p == end)
+ return end;
+
+ if (*p == '>'){
+ *full_stop = 0;
+ return p;
+ }
+ if (state == SKIP_XML_DECLARATION && *p == '?' && ((p+1) < end) && *(p+1) == '>'){
+ *full_stop = 0;
+ return p+1;
+ }
+
+ if (*p == '/' && ((p+1) < end && *(p+1) == '>')){
+ *full_stop = 1;
+ return p+1;
+ } else {
+ char *name, *value;
+
+ p = parse_name (p, end, &name);
+ if (p == end)
+ return p;
+
+ p = skip_space (p, end);
+ if (p == end){
+ g_free (name);
+ return p;
+ }
+ if (*p != '='){
+ set_error (PARSE, "Expected an = after the attribute name `%s'", name);
+ g_free (name);
+ return end;
+ }
+ p++;
+ p = skip_space (p, end);
+ if (p == end){
+ g_free (name);
+ return end;
+ }
+
+ p = parse_value (p, end, &value, error);
+ if (p == end){
+ g_free (name);
+ return p;
+ }
+
+ ++nnames;
+ *names = g_realloc (*names, sizeof (char **) * (nnames+1));
+ *values = g_realloc (*values, sizeof (char **) * (nnames+1));
+ (*names) [nnames-1] = name;
+ (*values) [nnames-1] = value;
+ (*names) [nnames] = NULL;
+ (*values) [nnames] = NULL;
+ }
+ }
+}
+
+static void
+destroy_parse_state (GMarkupParseContext *context)
+{
+ GSList *p;
+
+ for (p = context->level; p != NULL; p = p->next)
+ g_free (p->data);
+
+ g_slist_free (context->level);
+ if (context->text != NULL)
+ g_string_free (context->text, TRUE);
+ context->text = NULL;
+ context->level = NULL;
+}
+
+gboolean
+g_markup_parse_context_parse (GMarkupParseContext *context,
+ const gchar *text, gssize text_len,
+ GError **error)
+{
+ const char *p, *end;
+
+ g_return_val_if_fail (context != NULL, FALSE);
+ g_return_val_if_fail (text != NULL, FALSE);
+ g_return_val_if_fail (text_len >= 0, FALSE);
+
+ end = text + text_len;
+
+ for (p = text; p < end; p++){
+ char c = *p;
+
+ switch (context->state){
+ case START:
+ if (c == ' ' || c == '\t' || c == '\f' || c == '\n' || (c & 0x80))
+ continue;
+ if (c == '<'){
+ if (p+1 < end && p [1] == '?'){
+ context->state = SKIP_XML_DECLARATION;
+ p++;
+ } else
+ context->state = START_ELEMENT;
+ continue;
+ }
+ set_error (PARSE, "%s", "Expected < to start the document");
+ goto fail;
+
+ case SKIP_XML_DECLARATION:
+ case START_ELEMENT: {
+ const char *element_start = p, *element_end;
+ char *ename = NULL;
+ int full_stop = 0, l;
+ gchar **names = NULL, **values = NULL;
+
+ for (; p < end && my_isspace (*p); p++)
+ ;
+ if (p == end){
+ set_error (PARSE, "%s", "Unfinished element");
+ goto fail;
+ }
+
+ if (*p == '!' && (p+2 < end) && (p [1] == '-') && (p [2] == '-')){
+ context->state = COMMENT;
+ p += 2;
+ break;
+ }
+
+ if (!my_isalpha (*p)){
+ set_error (PARSE, "%s", "Expected an element name");
+ goto fail;
+ }
+
+ for (++p; p < end && (my_isalnum (*p) || (*p == '.')); p++)
+ ;
+ if (p == end){
+ set_error (PARSE, "%s", "Expected an element");
+ goto fail;
+ }
+ element_end = p;
+
+ for (; p < end && my_isspace (*p); p++)
+ ;
+ if (p == end){
+ set_error (PARSE, "%s", "Unfinished element");
+ goto fail;
+ }
+ p = parse_attributes (p, end, &names, &values, error, &full_stop, context->state);
+ if (p == end){
+ if (names != NULL) {
+ g_strfreev (names);
+ g_strfreev (values);
+ }
+ /* Only set the error if parse_attributes did not */
+ if (error != NULL && *error == NULL)
+ set_error (PARSE, "%s", "Unfinished sequence");
+ goto fail;
+ }
+ l = (int)(element_end - element_start);
+ ename = g_malloc (l + 1);
+ if (ename == NULL)
+ goto fail;
+ strncpy (ename, element_start, l);
+ ename [l] = 0;
+
+ if (context->state == START_ELEMENT)
+ if (context->parser.start_element != NULL)
+ context->parser.start_element (context, ename,
+ (const gchar **) names,
+ (const gchar **) values,
+ context->user_data, error);
+
+ if (names != NULL){
+ g_strfreev (names);
+ g_strfreev (values);
+ }
+
+ if (error != NULL && *error != NULL){
+ g_free (ename);
+ goto fail;
+ }
+
+ if (full_stop){
+ if (context->parser.end_element != NULL && context->state == START_ELEMENT){
+ context->parser.end_element (context, ename, context->user_data,
error);
+ if (error != NULL && *error != NULL){
+ free (ename);
+ goto fail;
+ }
+ }
+ g_free (ename);
+ } else {
+ context->level = g_slist_prepend (context->level, ename);
+ }
+
+ context->state = TEXT;
+ break;
+ } /* case START_ELEMENT */
+
+ case TEXT: {
+ if (c == '<'){
+ context->state = FLUSH_TEXT;
+ break;
+ }
+ if (context->parser.text != NULL){
+ if (context->text == NULL)
+ context->text = g_string_new ("");
+ g_string_append_c (context->text, c);
+ }
+ break;
+ }
+
+ case COMMENT:
+ if (*p != '-')
+ break;
+ if (p+2 < end && (p [1] == '-') && (p [2] == '>')){
+ context->state = TEXT;
+ p += 2;
+ break;
+ }
+ break;
+
+ case FLUSH_TEXT:
+ if (context->parser.text != NULL && context->text != NULL){
+ context->parser.text (context, context->text->str, context->text->len,
+ context->user_data, error);
+ if (error != NULL && *error != NULL)
+ goto fail;
+ }
+
+ if (c == '/')
+ context->state = CLOSING_ELEMENT;
+ else {
+ p--;
+ context->state = START_ELEMENT;
+ }
+ break;
+
+ case CLOSING_ELEMENT: {
+ GSList *current = context->level;
+ char *text;
+
+ if (context->level == NULL){
+ set_error (PARSE, "%s", "Too many closing tags, not enough open tags");
+ goto fail;
+ }
+
+ text = current->data;
+ if (context->parser.end_element != NULL){
+ context->parser.end_element (context, text, context->user_data, error);
+ if (error != NULL && *error != NULL){
+ g_free (text);
+ goto fail;
+ }
+ }
+ g_free (text);
+
+ while (p < end && *p != '>')
+ p++;
+
+ context->level = context->level->next;
+ g_slist_free_1 (current);
+ context->state = TEXT;
+ break;
+ } /* case CLOSING_ELEMENT */
+
+ } /* switch */
+ }
+
+
+ return TRUE;
+ fail:
+ if (context->parser.error && error != NULL && *error)
+ context->parser.error (context, *error, context->user_data);
+
+ destroy_parse_state (context);
+ return FALSE;
+}
+
+gboolean
+g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **error)
+{
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ /*
+ * In our case, we always signal errors during parse, not at the end
+ * see the notes at the top of this file for details on how this
+ * could be moved here
+ */
+ return TRUE;
+}
diff --git a/deps/eglib/src/gmem.c b/deps/eglib/src/gmem.c
new file mode 100644
index 0000000..a59a438
--- /dev/null
+++ b/deps/eglib/src/gmem.c
@@ -0,0 +1,108 @@
+/*
+ * gmem.c: memory utility functions
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+
+void
+g_free (void *ptr)
+{
+ if (ptr != NULL)
+ free (ptr);
+}
+
+gpointer
+g_memdup (gconstpointer mem, guint byte_size)
+{
+ gpointer ptr;
+
+ if (mem == NULL)
+ return NULL;
+
+ ptr = g_malloc (byte_size);
+ if (ptr != NULL)
+ memcpy (ptr, mem, byte_size);
+
+ return ptr;
+}
+
+gpointer g_realloc (gpointer obj, gsize size)
+{
+ gpointer ptr;
+ if (!size) {
+ g_free (obj);
+ return 0;
+ }
+ ptr = realloc (obj, size);
+ if (ptr)
+ return ptr;
+ g_error ("Could not allocate %i bytes", size);
+}
+
+gpointer
+g_malloc (gsize x)
+{
+ gpointer ptr;
+ if (!x)
+ return 0;
+ ptr = malloc (x);
+ if (ptr)
+ return ptr;
+ g_error ("Could not allocate %i bytes", x);
+}
+
+gpointer g_malloc0 (gsize x)
+{
+ gpointer ptr;
+ if (!x)
+ return 0;
+ ptr = calloc(1,x);
+ if (ptr)
+ return ptr;
+ g_error ("Could not allocate %i bytes", x);
+}
+
+gpointer g_try_malloc (gsize x)
+{
+ if (x)
+ return malloc (x);
+ return 0;
+}
+
+
+gpointer g_try_realloc (gpointer obj, gsize size)
+{
+ if (!size) {
+ g_free (obj);
+ return 0;
+ }
+ return realloc (obj, size);
+}
diff --git a/deps/eglib/src/gmisc-unix.c b/deps/eglib/src/gmisc-unix.c
new file mode 100644
index 0000000..860b930
--- /dev/null
+++ b/deps/eglib/src/gmisc-unix.c
@@ -0,0 +1,152 @@
+/*
+ * gmisc.c: Misc functions with no place to go (right now)
+ *
+ * Author:
+ * Aaron Bockover (abockover novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <pthread.h>
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+
+const gchar *
+g_getenv(const gchar *variable)
+{
+ return getenv(variable);
+}
+
+gboolean
+g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
+{
+ return setenv(variable, value, overwrite) == 0;
+}
+
+void
+g_unsetenv(const gchar *variable)
+{
+ unsetenv(variable);
+}
+
+gchar*
+g_win32_getlocale(void)
+{
+ return NULL;
+}
+
+gboolean
+g_path_is_absolute (const char *filename)
+{
+ g_return_val_if_fail (filename != NULL, FALSE);
+
+ return (*filename == '/');
+}
+
+static pthread_mutex_t pw_lock = PTHREAD_MUTEX_INITIALIZER;
+static const gchar *home_dir;
+static const gchar *user_name;
+
+static void
+get_pw_data (void)
+{
+#ifdef HAVE_GETPWUID_R
+ struct passwd pw;
+ struct passwd *result;
+ char buf [4096];
+#endif
+
+ if (user_name != NULL)
+ return;
+
+ pthread_mutex_lock (&pw_lock);
+ if (user_name != NULL) {
+ pthread_mutex_unlock (&pw_lock);
+ return;
+ }
+#ifdef HAVE_GETPWUID_R
+ if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
+ home_dir = g_strdup (pw.pw_dir);
+ user_name = g_strdup (pw.pw_name);
+ }
+#endif
+ if (home_dir == NULL)
+ home_dir = g_getenv ("HOME");
+
+ if (user_name == NULL) {
+ user_name = g_getenv ("USER");
+ if (user_name == NULL)
+ user_name = "somebody";
+ }
+ pthread_mutex_unlock (&pw_lock);
+}
+
+/* Give preference to /etc/passwd than HOME */
+const gchar *
+g_get_home_dir (void)
+{
+ get_pw_data ();
+ return home_dir;
+}
+
+const char *
+g_get_user_name (void)
+{
+ get_pw_data ();
+ return user_name;
+}
+
+static const char *tmp_dir;
+
+static pthread_mutex_t tmp_lock = PTHREAD_MUTEX_INITIALIZER;
+
+const gchar *
+g_get_tmp_dir (void)
+{
+ if (tmp_dir == NULL){
+ pthread_mutex_lock (&tmp_lock);
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TMPDIR");
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TMP");
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TEMP");
+ if (tmp_dir == NULL)
+ tmp_dir = "/tmp";
+ }
+ }
+ }
+ pthread_mutex_unlock (&tmp_lock);
+ }
+ return tmp_dir;
+}
+
diff --git a/deps/eglib/src/gmisc-win32.c b/deps/eglib/src/gmisc-win32.c
new file mode 100644
index 0000000..35bb43d
--- /dev/null
+++ b/deps/eglib/src/gmisc-win32.c
@@ -0,0 +1,166 @@
+/*
+ * gmisc.c: Misc functions with no place to go (right now)
+ *
+ * Author:
+ * Aaron Bockover (abockover novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <glib.h>
+
+#include <windows.h>
+#include <direct.h>
+#include <io.h>
+
+const gchar *
+g_getenv(const gchar *variable)
+{
+ gunichar2 *var, *buffer;
+ gchar* val = NULL;
+ gint32 buffer_size = 1024;
+ gint32 retval;
+ var = u8to16(variable);
+ buffer = g_malloc(buffer_size*sizeof(gunichar2));
+ retval = GetEnvironmentVariableW (var, buffer, buffer_size);
+ if (retval != 0) {
+ if (retval > buffer_size) {
+ g_free (buffer);
+ buffer_size = retval;
+ buffer = g_malloc(buffer_size*sizeof(gunichar2));
+ retval = GetEnvironmentVariableW (var, buffer, buffer_size);
+ }
+ val = u16to8 (buffer);
+ } else {
+ if (GetLastError () != ERROR_ENVVAR_NOT_FOUND){
+ val = g_malloc (1);
+ *val = 0;
+ }
+ }
+ g_free(var);
+ g_free(buffer);
+ return val;
+}
+
+gboolean
+g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
+{
+ gunichar2 *var, *val;
+ gboolean result;
+ var = u8to16(variable);
+ val = u8to16(value);
+ result = (SetEnvironmentVariableW(var, val) != 0) ? TRUE : FALSE;
+ g_free(var);
+ g_free(val);
+ return result;
+}
+
+void
+g_unsetenv(const gchar *variable)
+{
+ gunichar2 *var;
+ var = u8to16(variable);
+ SetEnvironmentVariableW(var, L"");
+ g_free(var);
+}
+
+gchar*
+g_win32_getlocale(void)
+{
+ LCID lcid = GetThreadLocale();
+ gchar buf[19];
+ gint ccBuf = GetLocaleInfo(lcid, LOCALE_SISO639LANGNAME, buf, 9);
+ buf[ccBuf - 1] = '-';
+ ccBuf += GetLocaleInfo(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+ return strdup(buf);
+}
+
+gboolean
+g_path_is_absolute (const char *filename)
+{
+ g_return_val_if_fail (filename != NULL, FALSE);
+
+ if (filename[0] != '\0' && filename[1] != '\0') {
+ if (filename[1] == ':' && filename[2] != '\0' &&
+ (filename[2] == '\\' || filename[2] == '/'))
+ return TRUE;
+ /* UNC paths */
+ else if (filename[0] == '\\' && filename[1] == '\\' &&
+ filename[2] != '\0')
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+const gchar *
+g_get_home_dir (void)
+{
+ /* FIXME */
+ const gchar *drive = g_getenv ("HOMEDRIVE");
+ const gchar *path = g_getenv ("HOMEPATH");
+ gchar *home_dir = NULL;
+
+ if (drive && path) {
+ home_dir = g_malloc(strlen(drive) + strlen(path) +1);
+ if (home_dir) {
+ sprintf(home_dir, "%s%s", drive, path);
+ }
+ }
+
+ return home_dir;
+}
+
+const char *
+g_get_user_name (void)
+{
+ const char * retName = g_getenv ("USER");
+ if (!retName)
+ retName = g_getenv ("USERNAME");
+ return retName;
+}
+
+static const char *tmp_dir;
+
+const gchar *
+g_get_tmp_dir (void)
+{
+ if (tmp_dir == NULL){
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TMPDIR");
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TMP");
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TEMP");
+ if (tmp_dir == NULL)
+ tmp_dir = "C:\\temp";
+ }
+ }
+ }
+ }
+ return tmp_dir;
+}
+
diff --git a/deps/eglib/src/gmodule-unix.c b/deps/eglib/src/gmodule-unix.c
new file mode 100644
index 0000000..9dd5eaa
--- /dev/null
+++ b/deps/eglib/src/gmodule-unix.c
@@ -0,0 +1,290 @@
+/*
+ * gmodule.c: dl* functions, glib style
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ * Jonathan Chambers (joncham gmail com)
+ * Robert Jordan (robertj gmx net)
+ *
+ * (C) 2006 Novell, Inc.
+ * (C) 2006 Jonathan Chambers
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+
+#include <glib.h>
+#include <gmodule.h>
+
+#if defined(G_OS_UNIX) && defined(HAVE_DLFCN_H)
+#include <dlfcn.h>
+
+/* For Linux and Solaris, need to add others as we port this */
+#define LIBPREFIX "lib"
+#define LIBSUFFIX ".so"
+
+struct _GModule {
+ void *handle;
+};
+
+GModule *
+g_module_open (const gchar *file, GModuleFlags flags)
+{
+ int f = 0;
+ GModule *module;
+ void *handle;
+
+ flags &= G_MODULE_BIND_MASK;
+ if ((flags & G_MODULE_BIND_LAZY) != 0)
+ f |= RTLD_LAZY;
+ if ((flags & G_MODULE_BIND_LOCAL) != 0)
+ f |= RTLD_LOCAL;
+
+ handle = dlopen (file, f);
+ if (handle == NULL)
+ return NULL;
+
+ module = g_new (GModule,1);
+ module->handle = handle;
+
+ return module;
+}
+
+gboolean
+g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+{
+ if (symbol_name == NULL || symbol == NULL)
+ return FALSE;
+
+ if (module == NULL || module->handle == NULL)
+ return FALSE;
+
+ *symbol = dlsym (module->handle, symbol_name);
+ return (*symbol != NULL);
+}
+
+const gchar *
+g_module_error (void)
+{
+ return dlerror ();
+}
+
+gboolean
+g_module_close (GModule *module)
+{
+ void *handle;
+ if (module == NULL || module->handle == NULL)
+ return FALSE;
+
+ handle = module->handle;
+ module->handle = NULL;
+ g_free (module);
+ return (0 == dlclose (handle));
+}
+
+#elif defined (G_OS_WIN32)
+#include <windows.h>
+#include <psapi.h>
+
+#define LIBSUFFIX ".dll"
+#define LIBPREFIX ""
+
+struct _GModule {
+ HMODULE handle;
+ int main_module;
+};
+
+GModule *
+g_module_open (const gchar *file, GModuleFlags flags)
+{
+ GModule *module;
+ module = g_malloc (sizeof (GModule));
+ if (module == NULL)
+ return NULL;
+
+ if (file != NULL) {
+ gunichar2 *file16;
+ file16 = u8to16(file);
+ module->main_module = FALSE;
+ module->handle = LoadLibrary (file16);
+ g_free(file16);
+ if (!module->handle) {
+ g_free (module);
+ return NULL;
+ }
+
+ } else {
+ module->main_module = TRUE;
+ module->handle = GetModuleHandle (NULL);
+ }
+
+ return module;
+}
+
+static gpointer
+w32_find_symbol (const gchar *symbol_name)
+{
+ HMODULE *modules;
+ DWORD buffer_size = sizeof (HMODULE) * 1024;
+ DWORD needed, i;
+
+ modules = (HMODULE *) g_malloc (buffer_size);
+
+ if (modules == NULL)
+ return NULL;
+
+ if (!EnumProcessModules (GetCurrentProcess (), modules,
+ buffer_size, &needed)) {
+ g_free (modules);
+ return NULL;
+ }
+
+ /* check whether the supplied buffer was too small, realloc, retry */
+ if (needed > buffer_size) {
+ g_free (modules);
+
+ buffer_size = needed;
+ modules = (HMODULE *) g_malloc (buffer_size);
+
+ if (modules == NULL)
+ return NULL;
+
+ if (!EnumProcessModules (GetCurrentProcess (), modules,
+ buffer_size, &needed)) {
+ g_free (modules);
+ return NULL;
+ }
+ }
+
+ for (i = 0; i < needed / sizeof (HANDLE); i++) {
+ gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
+ if (proc != NULL) {
+ g_free (modules);
+ return proc;
+ }
+ }
+
+ g_free (modules);
+ return NULL;
+}
+
+gboolean
+g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+{
+ if (module == NULL || symbol_name == NULL || symbol == NULL)
+ return FALSE;
+
+ if (module->main_module) {
+ *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+ if (*symbol != NULL)
+ return TRUE;
+
+ *symbol = w32_find_symbol (symbol_name);
+ return *symbol != NULL;
+ } else {
+ *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+ return *symbol != NULL;
+ }
+}
+
+const gchar *
+g_module_error (void)
+{
+ gchar* ret = NULL;
+ TCHAR* buf = NULL;
+ DWORD code = GetLastError ();
+
+ FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
+ code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
+
+ ret = u16to8 (buf);
+ LocalFree(buf);
+
+ return ret;
+}
+
+gboolean
+g_module_close (GModule *module)
+{
+ HMODULE handle;
+ int main_module;
+
+ if (module == NULL || module->handle == NULL)
+ return FALSE;
+
+ handle = module->handle;
+ main_module = module->main_module;
+ module->handle = NULL;
+ g_free (module);
+ return (main_module ? 1 : (0 == FreeLibrary (handle)));
+}
+
+#else
+
+#define LIBSUFFIX ""
+#define LIBPREFIX ""
+
+GModule *
+g_module_open (const gchar *file, GModuleFlags flags)
+{
+ g_error ("%s", "g_module_open not implemented on this platform");
+ return NULL;
+}
+
+gboolean
+g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+{
+ g_error ("%s", "g_module_open not implemented on this platform");
+ return FALSE;
+}
+
+const gchar *
+g_module_error (void)
+{
+ g_error ("%s", "g_module_open not implemented on this platform");
+ return NULL;
+}
+
+gboolean
+g_module_close (GModule *module)
+{
+ g_error ("%s", "g_module_open not implemented on this platform");
+ return FALSE;
+}
+#endif
+
+gchar *
+g_module_build_path (const gchar *directory, const gchar *module_name)
+{
+ char *lib_prefix = "";
+
+ if (module_name == NULL)
+ return NULL;
+
+ if (strncmp (module_name, "lib", 3) != 0)
+ lib_prefix = LIBPREFIX;
+
+ if (directory && *directory){
+
+ return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
+ }
+ return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
+}
+
diff --git a/deps/eglib/src/gmodule-win32.c b/deps/eglib/src/gmodule-win32.c
new file mode 100644
index 0000000..7dcaa05
--- /dev/null
+++ b/deps/eglib/src/gmodule-win32.c
@@ -0,0 +1,189 @@
+/*
+ * gmodule.c: dl* functions, glib style
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ * Jonathan Chambers (joncham gmail com)
+ * Robert Jordan (robertj gmx net)
+ *
+ * (C) 2006 Novell, Inc.
+ * (C) 2006 Jonathan Chambers
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <gmodule.h>
+#include <windows.h>
+#include <psapi.h>
+
+#define LIBSUFFIX ".dll"
+#define LIBPREFIX ""
+
+struct _GModule {
+ HMODULE handle;
+ int main_module;
+};
+
+GModule *
+g_module_open (const gchar *file, GModuleFlags flags)
+{
+ GModule *module;
+ module = g_malloc (sizeof (GModule));
+ if (module == NULL)
+ return NULL;
+
+ if (file != NULL) {
+ gunichar2 *file16;
+ file16 = u8to16(file);
+ module->main_module = FALSE;
+ module->handle = LoadLibraryW (file16);
+ g_free(file16);
+ if (!module->handle) {
+ g_free (module);
+ return NULL;
+ }
+
+ } else {
+ module->main_module = TRUE;
+ module->handle = GetModuleHandle (NULL);
+ }
+
+ return module;
+}
+
+static gpointer
+w32_find_symbol (const gchar *symbol_name)
+{
+ HMODULE *modules;
+ DWORD buffer_size = sizeof (HMODULE) * 1024;
+ DWORD needed, i;
+
+ modules = (HMODULE *) g_malloc (buffer_size);
+
+ if (modules == NULL)
+ return NULL;
+
+ if (!EnumProcessModules (GetCurrentProcess (), modules,
+ buffer_size, &needed)) {
+ g_free (modules);
+ return NULL;
+ }
+
+ /* check whether the supplied buffer was too small, realloc, retry */
+ if (needed > buffer_size) {
+ g_free (modules);
+
+ buffer_size = needed;
+ modules = (HMODULE *) g_malloc (buffer_size);
+
+ if (modules == NULL)
+ return NULL;
+
+ if (!EnumProcessModules (GetCurrentProcess (), modules,
+ buffer_size, &needed)) {
+ g_free (modules);
+ return NULL;
+ }
+ }
+
+ for (i = 0; i < needed / sizeof (HANDLE); i++) {
+ gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
+ if (proc != NULL) {
+ g_free (modules);
+ return proc;
+ }
+ }
+
+ g_free (modules);
+ return NULL;
+}
+
+gboolean
+g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+{
+ if (module == NULL || symbol_name == NULL || symbol == NULL)
+ return FALSE;
+
+ if (module->main_module) {
+ *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+ if (*symbol != NULL)
+ return TRUE;
+
+ *symbol = w32_find_symbol (symbol_name);
+ return *symbol != NULL;
+ } else {
+ *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+ return *symbol != NULL;
+ }
+}
+
+const gchar *
+g_module_error (void)
+{
+ gchar* ret = NULL;
+ TCHAR* buf = NULL;
+ DWORD code = GetLastError ();
+
+ /* FIXME: buf must not be NULL! */
+ FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
+ code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
+
+ ret = u16to8 (buf);
+ LocalFree(buf);
+
+ return ret;
+}
+
+gboolean
+g_module_close (GModule *module)
+{
+ HMODULE handle;
+ int main_module;
+
+ if (module == NULL || module->handle == NULL)
+ return FALSE;
+
+ handle = module->handle;
+ main_module = module->main_module;
+ module->handle = NULL;
+ g_free (module);
+ return (main_module ? 1 : (0 == FreeLibrary (handle)));
+}
+
+gchar *
+g_module_build_path (const gchar *directory, const gchar *module_name)
+{
+ char *lib_prefix = "";
+
+ if (module_name == NULL)
+ return NULL;
+
+ if (strncmp (module_name, "lib", 3) != 0)
+ lib_prefix = LIBPREFIX;
+
+ if (directory && *directory){
+
+ return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
+ }
+ return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
+}
diff --git a/deps/eglib/src/gmodule.h b/deps/eglib/src/gmodule.h
new file mode 100644
index 0000000..ee89683
--- /dev/null
+++ b/deps/eglib/src/gmodule.h
@@ -0,0 +1,37 @@
+#ifndef __GLIB_GMODULE_H
+#define __GLIB_GMODULE_H
+
+#include <glib.h>
+
+#define G_MODULE_IMPORT extern
+#ifdef G_OS_WIN32
+#define G_MODULE_EXPORT __declspec(dllexport)
+#else
+#define G_MODULE_EXPORT
+#endif
+
+G_BEGIN_DECLS
+
+/*
+ * Modules
+ */
+typedef enum {
+ G_MODULE_BIND_LAZY = 0x01,
+ G_MODULE_BIND_LOCAL = 0x02,
+ G_MODULE_BIND_MASK = 0x03
+} GModuleFlags;
+typedef struct _GModule GModule;
+
+GModule *g_module_open (const gchar *file, GModuleFlags flags);
+gboolean g_module_symbol (GModule *module, const gchar *symbol_name,
+ gpointer *symbol);
+const gchar *g_module_error (void);
+gboolean g_module_close (GModule *module);
+gchar * g_module_build_path (const gchar *directory, const gchar *module_name);
+
+extern char *gmodule_libprefix;
+extern char *gmodule_libsuffix;
+
+G_END_DECLS
+
+#endif
diff --git a/deps/eglib/src/goutput.c b/deps/eglib/src/goutput.c
new file mode 100644
index 0000000..aff9f46
--- /dev/null
+++ b/deps/eglib/src/goutput.c
@@ -0,0 +1,199 @@
+/*
+ * Output and debugging functions
+ *
+ * Author:
+ * Miguel de Icaza (miguel novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ * Copyright 2011 Xamarin Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+
+/* The current fatal levels, error is always fatal */
+static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
+
+#if PLATFORM_ANDROID
+#include <android/log.h>
+
+static android_LogPriority
+to_android_priority (GLogLevelFlags log_level)
+{
+ switch (log_level & G_LOG_LEVEL_MASK)
+ {
+ case G_LOG_LEVEL_ERROR: return ANDROID_LOG_FATAL;
+ case G_LOG_LEVEL_CRITICAL: return ANDROID_LOG_ERROR;
+ case G_LOG_LEVEL_WARNING: return ANDROID_LOG_WARN;
+ case G_LOG_LEVEL_MESSAGE: return ANDROID_LOG_INFO;
+ case G_LOG_LEVEL_INFO: return ANDROID_LOG_DEBUG;
+ case G_LOG_LEVEL_DEBUG: return ANDROID_LOG_VERBOSE;
+ }
+ return ANDROID_LOG_UNKNOWN;
+}
+
+static void
+out_vfprintf (FILE *ignore, const gchar *format, va_list args)
+{
+ /* TODO: provide a proper app name */
+ __android_log_vprint (ANDROID_LOG_ERROR, "mono", format, args);
+}
+#elif MONOTOUCH && defined(__arm__)
+#include <asl.h>
+
+static int
+to_asl_priority (GLogLevelFlags log_level)
+{
+ switch (log_level & G_LOG_LEVEL_MASK)
+ {
+ case G_LOG_LEVEL_ERROR: return ASL_LEVEL_CRIT;
+ case G_LOG_LEVEL_CRITICAL: return ASL_LEVEL_ERR;
+ case G_LOG_LEVEL_WARNING: return ASL_LEVEL_WARNING;
+ case G_LOG_LEVEL_MESSAGE: return ASL_LEVEL_NOTICE;
+ case G_LOG_LEVEL_INFO: return ASL_LEVEL_INFO;
+ case G_LOG_LEVEL_DEBUG: return ASL_LEVEL_DEBUG;
+ }
+ return ASL_LEVEL_ERR;
+}
+
+static void
+out_vfprintf (FILE *ignore, const gchar *format, va_list args)
+{
+ asl_vlog (NULL, NULL, ASL_LEVEL_WARNING, format, args);
+}
+
+#else
+static void
+out_vfprintf (FILE *file, const gchar *format, va_list args)
+{
+ vfprintf (file, format, args);
+}
+#endif
+
+void
+g_print (const gchar *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+
+ out_vfprintf (stdout, format, args);
+
+ va_end (args);
+}
+
+void
+g_printerr (const gchar *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+
+ out_vfprintf (stderr, format, args);
+
+ va_end (args);
+}
+
+GLogLevelFlags
+g_log_set_always_fatal (GLogLevelFlags fatal_mask)
+{
+ GLogLevelFlags old_fatal = fatal;
+
+ fatal |= fatal_mask;
+
+ return old_fatal;
+}
+
+GLogLevelFlags
+g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
+{
+ /*
+ * Mono does not use a G_LOG_DOMAIN currently, so we just assume things are fatal
+ * if we decide to set G_LOG_DOMAIN (we probably should) we should implement
+ * this.
+ */
+ return fatal_mask;
+}
+
+void
+g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
+{
+#if PLATFORM_ANDROID
+ __android_log_vprint (to_android_priority (log_level), log_domain, format, args);
+#elif MONOTOUCH && defined(__arm__)
+ asl_vlog (NULL, NULL, to_asl_priority (log_level), format, args);
+#else
+ char *msg;
+
+ if (vasprintf (&msg, format, args) < 0)
+ return;
+
+#ifdef G_OS_WIN32
+ printf ("%s%s%s\n",
+ log_domain != NULL ? log_domain : "",
+ log_domain != NULL ? ": " : "",
+ msg);
+#else
+#if MONOTOUCH
+ FILE *target = stderr;
+#else
+ FILE *target = stdout;
+#endif
+
+ fprintf (target, "%s%s%s\n",
+ log_domain != NULL ? log_domain : "",
+ log_domain != NULL ? ": " : "",
+ msg);
+#endif
+ free (msg);
+ if (log_level & fatal){
+ fflush (stdout);
+ fflush (stderr);
+ }
+#endif
+ if (log_level & fatal){
+ abort ();
+ }
+}
+
+void
+g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ g_logv (log_domain, log_level, format, args);
+ va_end (args);
+}
+
+void
+g_assertion_message (const gchar *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
+ va_end (args);
+ abort ();
+}
+
diff --git a/deps/eglib/src/gpath.c b/deps/eglib/src/gpath.c
new file mode 100644
index 0000000..5302f42
--- /dev/null
+++ b/deps/eglib/src/gpath.c
@@ -0,0 +1,296 @@
+/*
+ * Portable Utility Functions
+ *
+ * Author:
+ * Miguel de Icaza (miguel novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <glib.h>
+#include <errno.h>
+
+#ifdef G_OS_WIN32
+#include <direct.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+gchar *
+g_build_path (const gchar *separator, const gchar *first_element, ...)
+{
+ const char *elem, *next, *endptr;
+ gboolean trimmed;
+ GString *path;
+ va_list args;
+ size_t slen;
+
+ g_return_val_if_fail (separator != NULL, NULL);
+
+ path = g_string_sized_new (48);
+ slen = strlen (separator);
+
+ va_start (args, first_element);
+ for (elem = first_element; elem != NULL; elem = next) {
+ /* trim any trailing separators from @elem */
+ endptr = elem + strlen (elem);
+ trimmed = FALSE;
+
+ while (endptr >= elem + slen) {
+ if (strncmp (endptr - slen, separator, slen) != 0)
+ break;
+
+ endptr -= slen;
+ trimmed = TRUE;
+ }
+
+ /* append elem, not including any trailing separators */
+ if (endptr > elem)
+ g_string_append_len (path, elem, endptr - elem);
+
+ /* get the next element */
+ do {
+ if (!(next = va_arg (args, char *)))
+ break;
+
+ /* remove leading separators */
+ while (!strncmp (next, separator, slen))
+ next += slen;
+ } while (*next == '\0');
+
+ if (next || trimmed)
+ g_string_append_len (path, separator, slen);
+ }
+ va_end (args);
+
+ return g_string_free (path, FALSE);
+}
+
+static gchar*
+strrchr_seperator (const gchar* filename)
+{
+#ifdef G_OS_WIN32
+ char *p2;
+#endif
+ char *p;
+
+ p = strrchr (filename, G_DIR_SEPARATOR);
+#ifdef G_OS_WIN32
+ p2 = strrchr (filename, '/');
+ if (p2 > p)
+ p = p2;
+#endif
+
+ return p;
+}
+
+gchar *
+g_path_get_dirname (const gchar *filename)
+{
+ char *p, *r;
+ size_t count;
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ p = strrchr_seperator (filename);
+ if (p == NULL)
+ return g_strdup (".");
+ if (p == filename)
+ return g_strdup ("/");
+ count = p - filename;
+ r = g_malloc (count + 1);
+ strncpy (r, filename, count);
+ r [count] = 0;
+
+ return r;
+}
+
+gchar *
+g_path_get_basename (const char *filename)
+{
+ char *r;
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ /* Empty filename -> . */
+ if (!*filename)
+ return g_strdup (".");
+
+ /* No separator -> filename */
+ r = strrchr_seperator (filename);
+ if (r == NULL)
+ return g_strdup (filename);
+
+ /* Trailing slash, remove component */
+ if (r [1] == 0){
+ char *copy = g_strdup (filename);
+ copy [r-filename] = 0;
+ r = strrchr_seperator (copy);
+
+ if (r == NULL){
+ g_free (copy);
+ return g_strdup ("/");
+ }
+ r = g_strdup (&r[1]);
+ g_free (copy);
+ return r;
+ }
+
+ return g_strdup (&r[1]);
+}
+
+#ifndef HAVE_STRTOK_R
+// This is from BSD's strtok_r
+
+char *
+strtok_r(char *s, const char *delim, char **last)
+{
+ char *spanp;
+ int c, sc;
+ char *tok;
+
+ if (s == NULL && (s = *last) == NULL)
+ return NULL;
+
+ /*
+ * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
+ */
+cont:
+ c = *s++;
+ for (spanp = (char *)delim; (sc = *spanp++) != 0; ){
+ if (c == sc)
+ goto cont;
+ }
+
+ if (c == 0){ /* no non-delimiter characters */
+ *last = NULL;
+ return NULL;
+ }
+ tok = s - 1;
+
+ /*
+ * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
+ * Note that delim must have one NUL; we stop if we see that, too.
+ */
+ for (;;){
+ c = *s++;
+ spanp = (char *)delim;
+ do {
+ if ((sc = *spanp++) == c) {
+ if (c == 0)
+ s = NULL;
+ else {
+ char *w = s - 1;
+ *w = '\0';
+ }
+ *last = s;
+ return tok;
+ }
+ }
+ while (sc != 0);
+ }
+ /* NOTREACHED */
+}
+#endif
+
+gchar *
+g_find_program_in_path (const gchar *program)
+{
+ char *p;
+ char *x, *l;
+ gchar *curdir = NULL;
+ char *save = NULL;
+#ifdef G_OS_WIN32
+ char *program_exe;
+ char *suffix_list[5] = {".exe",".cmd",".bat",".com",NULL};
+ int listx;
+ gboolean hasSuffix;
+#endif
+
+ g_return_val_if_fail (program != NULL, NULL);
+ x = p = g_strdup (g_getenv ("PATH"));
+
+ if (x == NULL || *x == '\0') {
+ curdir = g_get_current_dir ();
+ x = curdir;
+ }
+
+#ifdef G_OS_WIN32
+ /* see if program already has a suffix */
+ listx = 0;
+ hasSuffix = FALSE;
+ while (!hasSuffix && suffix_list[listx]) {
+ hasSuffix = g_str_has_suffix(program,suffix_list[listx++]);
+ }
+#endif
+
+ while ((l = strtok_r (x, G_SEARCHPATH_SEPARATOR_S, &save)) != NULL){
+ char *probe_path;
+
+ x = NULL;
+ probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program, NULL);
+ if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions
test */
+ g_free (curdir);
+ g_free (p);
+ return probe_path;
+ }
+ g_free (probe_path);
+
+#ifdef G_OS_WIN32
+ /* check for program with a suffix attached */
+ if (!hasSuffix) {
+ listx = 0;
+ while (suffix_list[listx]) {
+ program_exe = g_strjoin(NULL,program,suffix_list[listx],NULL);
+ probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program_exe, NULL);
+ if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read
permissions test */
+ g_free (curdir);
+ g_free (p);
+ g_free (program_exe);
+ return probe_path;
+ }
+ listx++;
+ g_free (probe_path);
+ g_free (program_exe);
+ }
+ }
+#endif
+ }
+ g_free (curdir);
+ g_free (p);
+ return NULL;
+}
+
+static char *name;
+
+void
+g_set_prgname (const gchar *prgname)
+{
+ name = g_strdup (prgname);
+}
+
+gchar *
+g_get_prgname (void)
+{
+ return name;
+}
diff --git a/deps/eglib/src/gpattern.c b/deps/eglib/src/gpattern.c
new file mode 100644
index 0000000..aef45de
--- /dev/null
+++ b/deps/eglib/src/gpattern.c
@@ -0,0 +1,216 @@
+/*
+ * Simple pattern matching
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#ifndef _MSC_VER
+#include <unistd.h>
+#endif
+
+typedef enum {
+ MATCH_LITERAL,
+ MATCH_ANYCHAR,
+ MATCH_ANYTHING,
+ MATCH_ANYTHING_END,
+ MATCH_INVALID = -1
+} MatchType;
+
+typedef struct {
+ MatchType type;
+ gchar *str;
+} PData;
+
+struct _GPatternSpec {
+ GSList *pattern;
+};
+
+static GSList *
+compile_pattern (const gchar *pattern)
+{
+ GSList *list;
+ size_t i, len;
+ PData *data;
+ gchar c;
+ MatchType last = MATCH_INVALID;
+ GString *str;
+ gboolean free_str;
+
+ if (pattern == NULL)
+ return NULL;
+
+ data = NULL;
+ list = NULL;
+ free_str = TRUE;
+ str = g_string_new ("");
+ for (i = 0, len = strlen (pattern); i < len; i++) {
+ c = pattern [i];
+ if (c == '*' || c == '?') {
+ if (str->len > 0) {
+ data = g_new0 (PData, 1);
+ data->type = MATCH_LITERAL;
+ data->str = g_string_free (str, FALSE);
+ list = g_slist_append (list, data);
+ str = g_string_new ("");
+ }
+
+ if (last == MATCH_ANYTHING && c == '*')
+ continue;
+
+ data = g_new0 (PData, 1);
+ data->type = (c == '*') ? MATCH_ANYTHING : MATCH_ANYCHAR;
+ list = g_slist_append (list, data);
+ last = data->type;
+ } else {
+ g_string_append_c (str, c);
+ last = MATCH_LITERAL;
+ }
+ }
+
+ if (last == MATCH_ANYTHING && str->len == 0) {
+ data->type = MATCH_ANYTHING_END;
+ free_str = TRUE;
+ } else if (str->len > 0) {
+ data = g_new0 (PData, 1);
+ data->type = MATCH_LITERAL;
+ data->str = str->str;
+ free_str = FALSE;
+ list = g_slist_append (list, data);
+ }
+ g_string_free (str, free_str);
+ return list;
+}
+
+#ifdef DEBUG_PATTERN
+static void
+print_pattern (gpointer data, gpointer user_data)
+{
+ PData *d = (PData *) data;
+
+ printf ("Type: %s", d->type == MATCH_LITERAL ? "literal" : d->type == MATCH_ANYCHAR ? "any char" :
"anything");
+ if (d->type == MATCH_LITERAL)
+ printf (" String: %s", d->str);
+ printf ("\n");
+}
+#endif
+
+GPatternSpec *
+g_pattern_spec_new (const gchar *pattern)
+{
+ GPatternSpec *spec;
+
+ g_return_val_if_fail (pattern != NULL, NULL);
+ spec = g_new0 (GPatternSpec, 1);
+ if (pattern) {
+ spec->pattern = compile_pattern (pattern);
+#ifdef DEBUG_PATTERN
+ g_slist_foreach (spec->pattern, print_pattern, NULL);
+ printf ("\n");
+#endif
+ }
+ return spec;
+}
+
+static void
+free_pdata (gpointer data, gpointer user_data)
+{
+ PData *d = (PData *) data;
+
+ if (d->str)
+ g_free (d->str);
+ g_free (d);
+}
+
+void
+g_pattern_spec_free (GPatternSpec *pspec)
+{
+ if (pspec) {
+ g_slist_foreach (pspec->pattern, free_pdata, NULL);
+ g_slist_free (pspec->pattern);
+ pspec->pattern = NULL;
+ }
+ g_free (pspec);
+}
+
+static gboolean
+match_string (GSList *list, const gchar *str, size_t idx, size_t max)
+{
+ size_t len;
+
+ while (list && idx < max) {
+ PData *data = (PData *) list->data;
+
+ if (data->type == MATCH_ANYTHING_END)
+ return TRUE;
+
+ if (data->type == MATCH_LITERAL) {
+ len = strlen (data->str);
+ if (strncmp (&str [idx], data->str, len) != 0)
+ return FALSE;
+ idx += len;
+ list = list->next;
+ if (list) {
+ /*
+ * When recursing, we need this to avoid returning FALSE
+ * because 'list' will not be NULL
+ */
+ data = (PData *) list->data;
+ if (data->type == MATCH_ANYTHING_END)
+ return TRUE;
+ }
+ } else if (data->type == MATCH_ANYCHAR) {
+ idx++;
+ list = list->next;
+ } else if (data->type == MATCH_ANYTHING) {
+ while (idx < max) {
+ if (match_string (list->next, str, idx++, max))
+ return TRUE;
+ }
+ return FALSE;
+ } else {
+ g_assert_not_reached ();
+ }
+ }
+
+ return (list == NULL && idx >= max);
+}
+gboolean
+g_pattern_match_string (GPatternSpec *pspec, const gchar *string)
+{
+ g_return_val_if_fail (pspec != NULL, FALSE);
+ g_return_val_if_fail (string != NULL, FALSE);
+
+ if (pspec->pattern == NULL)
+ return FALSE;
+ return match_string (pspec->pattern, string, 0, strlen (string));
+}
+
+
diff --git a/deps/eglib/src/gptrarray.c b/deps/eglib/src/gptrarray.c
new file mode 100644
index 0000000..1caa354
--- /dev/null
+++ b/deps/eglib/src/gptrarray.c
@@ -0,0 +1,248 @@
+/*
+ * Pointer Array
+ *
+ * Author:
+ * Aaron Bockover (abockover novell com)
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ * Jeffrey Stedfast (fejj novell com)
+ *
+ * (C) 2006,2011 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <glib.h>
+
+typedef struct _GPtrArrayPriv {
+ gpointer *pdata;
+ guint len;
+ guint size;
+ GDestroyNotify element_free_func;
+} GPtrArrayPriv;
+
+static void
+g_ptr_array_grow(GPtrArrayPriv *array, guint length)
+{
+ guint new_length = array->len + length;
+
+ g_return_if_fail(array != NULL);
+
+ if(new_length <= array->size) {
+ return;
+ }
+
+ array->size = 1;
+
+ while(array->size < new_length) {
+ array->size <<= 1;
+ }
+
+ array->size = MAX(array->size, 16);
+ array->pdata = g_realloc(array->pdata, array->size * sizeof(gpointer));
+}
+
+GPtrArray *
+g_ptr_array_new(void)
+{
+ return g_ptr_array_sized_new(0);
+}
+
+GPtrArray *
+g_ptr_array_sized_new(guint reserved_size)
+{
+ GPtrArrayPriv *array = g_new0(GPtrArrayPriv, 1);
+
+ array->pdata = NULL;
+ array->len = 0;
+ array->size = 0;
+
+ if(reserved_size > 0) {
+ g_ptr_array_grow(array, reserved_size);
+ }
+
+ return (GPtrArray *)array;
+}
+
+GPtrArray *
+g_ptr_array_new_with_free_func(GDestroyNotify element_free_func)
+{
+ GPtrArrayPriv *array = (GPtrArrayPriv *)g_ptr_array_sized_new (0);
+ array->element_free_func = element_free_func;
+ return (GPtrArray *)array;
+}
+
+gpointer *
+g_ptr_array_free(GPtrArray *array, gboolean free_seg)
+{
+ gpointer *data = NULL;
+
+ g_return_val_if_fail(array != NULL, NULL);
+
+ if(free_seg) {
+ GPtrArrayPriv *priv = (GPtrArrayPriv *)array;
+ gpointer *pdata = priv->pdata;
+
+ if (priv->element_free_func) {
+ GDestroyNotify free_func = priv->element_free_func;
+ int i;
+
+ for (i = priv->len - 1; i > 0; i--)
+ free_func (pdata[i]);
+ }
+ g_free(pdata);
+ } else {
+ data = array->pdata;
+ }
+
+ g_free(array);
+
+ return data;
+}
+
+void
+g_ptr_array_set_size(GPtrArray *array, gint length)
+{
+ g_return_if_fail(array != NULL);
+
+ if((size_t)length > array->len) {
+ g_ptr_array_grow((GPtrArrayPriv *)array, length);
+ memset(array->pdata + array->len, 0, (length - array->len)
+ * sizeof(gpointer));
+ }
+
+ array->len = length;
+}
+
+void
+g_ptr_array_add(GPtrArray *array, gpointer data)
+{
+ g_return_if_fail(array != NULL);
+ g_ptr_array_grow((GPtrArrayPriv *)array, 1);
+ array->pdata[array->len++] = data;
+}
+
+gpointer
+g_ptr_array_remove_index(GPtrArray *array, guint index)
+{
+ gpointer removed_node;
+
+ g_return_val_if_fail(array != NULL, NULL);
+ g_return_val_if_fail(index >= 0 || index < array->len, NULL);
+
+ removed_node = array->pdata[index];
+
+ if(index != array->len - 1) {
+ g_memmove(array->pdata + index, array->pdata + index + 1,
+ (array->len - index - 1) * sizeof(gpointer));
+ }
+
+ array->len--;
+ array->pdata[array->len] = NULL;
+
+ return removed_node;
+}
+
+gpointer
+g_ptr_array_remove_index_fast(GPtrArray *array, guint index)
+{
+ gpointer removed_node;
+
+ g_return_val_if_fail(array != NULL, NULL);
+ g_return_val_if_fail(index >= 0 || index < array->len, NULL);
+
+ removed_node = array->pdata[index];
+
+ if(index != array->len - 1) {
+ g_memmove(array->pdata + index, array->pdata + array->len - 1,
+ sizeof(gpointer));
+ }
+
+ array->len--;
+ array->pdata[array->len] = NULL;
+
+ return removed_node;
+}
+
+gboolean
+g_ptr_array_remove(GPtrArray *array, gpointer data)
+{
+ guint i;
+
+ g_return_val_if_fail(array != NULL, FALSE);
+
+ for(i = 0; i < array->len; i++) {
+ if(array->pdata[i] == data) {
+ g_ptr_array_remove_index(array, i);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+gboolean
+g_ptr_array_remove_fast(GPtrArray *array, gpointer data)
+{
+ guint i;
+
+ g_return_val_if_fail(array != NULL, FALSE);
+
+ for(i = 0; i < array->len; i++) {
+ if(array->pdata[i] == data) {
+ array->len--;
+ if (array->len > 0)
+ array->pdata [i] = array->pdata [array->len];
+ else
+ array->pdata [i] = NULL;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+void
+g_ptr_array_foreach(GPtrArray *array, GFunc func, gpointer user_data)
+{
+ guint i;
+
+ for(i = 0; i < array->len; i++) {
+ func(g_ptr_array_index(array, i), user_data);
+ }
+}
+
+void
+g_ptr_array_sort(GPtrArray *array, GCompareFunc compare)
+{
+ g_return_if_fail(array != NULL);
+ qsort(array->pdata, array->len, sizeof(gpointer), compare);
+}
+
+void
+g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare, gpointer user_data)
+{
+ g_return_if_fail (array != NULL);
+
+ g_qsort_with_data (array->pdata, array->len, sizeof (gpointer), compare, user_data);
+}
diff --git a/deps/eglib/src/gqsort.c b/deps/eglib/src/gqsort.c
new file mode 100644
index 0000000..771edb8
--- /dev/null
+++ b/deps/eglib/src/gqsort.c
@@ -0,0 +1,168 @@
+/*
+ * QuickSort
+ *
+ * Author: Jeffrey Stedfast <fejj novell com>
+ *
+ * (C) 2011 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <glib.h>
+
+/* Any segment <= this threshold will be sorted using insertion
+ * sort. OpenBSD seems to use a value of 7 so we'll go with that for
+ * now... */
+#define MAX_THRESHOLD 7
+
+#define STACK_SIZE (8 * sizeof (size_t))
+
+typedef struct _QSortStack {
+ char *array;
+ size_t count;
+} QSortStack;
+
+#define QSORT_PUSH(sp, a, c) (sp->array = a, sp->count = c, sp++)
+#define QSORT_POP(sp, a, c) (sp--, a = sp->array, c = sp->count)
+
+#define SWAPTYPE(TYPE, a, b) { \
+ long __n = size / sizeof (TYPE); \
+ register TYPE *__a = (TYPE *) (a); \
+ register TYPE *__b = (TYPE *) (b); \
+ register TYPE t; \
+ \
+ do { \
+ t = *__a; \
+ *__a++ = *__b; \
+ *__b++ = t; \
+ } while (--__n > 0); \
+}
+
+#define SWAPBYTE(a, b) SWAPTYPE(char, (a), (b))
+#define SWAPLONG(a, b) SWAPTYPE(long, (a), (b))
+#define SWAP(a, b) if (swaplong) SWAPLONG((a), (b)) else SWAPBYTE((a), (b))
+
+/* check if we can swap by longs rather than bytes by making sure that
+ * memory is properly aligned and that the element size is a multiple
+ * of sizeof (long) */
+#define SWAP_INIT() swaplong = (((char *) base) - ((char *) 0)) % sizeof (long) == 0 && (size % sizeof
(long)) == 0
+
+void
+g_qsort_with_data (gpointer base, size_t nmemb, size_t size, GCompareDataFunc compare, gpointer user_data)
+{
+ QSortStack stack[STACK_SIZE], *sp;
+ register char *i, *k, *mid;
+ size_t n, n1, n2;
+ char *lo, *hi;
+ int swaplong;
+
+ if (nmemb <= 1)
+ return;
+
+ SWAP_INIT ();
+
+ /* initialize our stack */
+ sp = stack;
+ QSORT_PUSH (sp, base, nmemb);
+
+ do {
+ QSORT_POP (sp, lo, n);
+
+ hi = lo + (n - 1) * size;
+
+ if (n < MAX_THRESHOLD) {
+ /* switch to insertion sort */
+ for (i = lo + size; i <= hi; i += size)
+ for (k = i; k > lo && compare (k - size, k, user_data) > 0; k -= size)
+ SWAP (k - size, k);
+
+ continue;
+ }
+
+ /* calculate the middle element */
+ mid = lo + (n / 2) * size;
+
+ /* once we re-order the lo, mid, and hi elements to be in
+ * ascending order, we'll use mid as our pivot. */
+ if (compare (mid, lo, user_data) < 0) {
+ SWAP (mid, lo);
+ }
+
+ if (compare (hi, mid, user_data) < 0) {
+ SWAP (mid, hi);
+ if (compare (mid, lo, user_data) < 0) {
+ SWAP (mid, lo);
+ }
+ }
+
+ /* since we've already guaranteed that lo <= mid and mid <= hi,
+ * we can skip comparing them again */
+ i = lo + size;
+ k = hi - size;
+
+ do {
+ /* find the first element with a value > pivot value */
+ while (i < k && compare (i, mid, user_data) <= 0)
+ i += size;
+
+ /* find the last element with a value <= pivot value */
+ while (k >= i && compare (mid, k, user_data) < 0)
+ k -= size;
+
+ if (k <= i)
+ break;
+
+ SWAP (i, k);
+
+ /* make sure we keep track of our pivot element */
+ if (mid == i) {
+ mid = k;
+ } else if (mid == k) {
+ mid = i;
+ }
+
+ i += size;
+ k -= size;
+ } while (1);
+
+ if (k != mid) {
+ /* swap the pivot with the last element in the first partition */
+ SWAP (mid, k);
+ }
+
+ /* calculate segment sizes */
+ n2 = (hi - k) / size;
+ n1 = (k - lo) / size;
+
+ /* push our partitions onto the stack, largest first
+ * (to make sure we don't run out of stack space) */
+ if (n2 > n1) {
+ if (n2 > 1) QSORT_PUSH (sp, k + size, n2);
+ if (n1 > 1) QSORT_PUSH (sp, lo, n1);
+ } else {
+ if (n1 > 1) QSORT_PUSH (sp, lo, n1);
+ if (n2 > 1) QSORT_PUSH (sp, k + size, n2);
+ }
+ } while (sp > stack);
+}
diff --git a/deps/eglib/src/gquark.c b/deps/eglib/src/gquark.c
new file mode 100644
index 0000000..cb1a95d
--- /dev/null
+++ b/deps/eglib/src/gquark.c
@@ -0,0 +1,57 @@
+/*
+ * ghooklist.c: API for manipulating a list of hook functions
+ *
+ * Copyright (C) 2014 Intel Corporation.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Robert Bragg <robert linux intel com>
+ */
+
+#include <config.h>
+
+#include <glib.h>
+
+static GHashTable *_quark_hash_table;
+static guint32 _next_quark;
+
+GQuark
+g_quark_from_static_string (const gchar *string)
+{
+ void *quark_ptr;
+
+ if (G_UNLIKELY (_quark_hash_table == NULL))
+ {
+ _quark_hash_table = g_hash_table_new (g_str_hash, g_str_equal);
+ _next_quark++;
+ }
+
+ quark_ptr = g_hash_table_lookup (_quark_hash_table, string);
+ if (!quark_ptr)
+ {
+ GQuark new_quark = _next_quark++;
+ g_hash_table_insert (_quark_hash_table,
+ GUINT_TO_POINTER (new_quark), (gpointer)string);
+ return new_quark;
+ }
+ else
+ return GPOINTER_TO_UINT (quark_ptr);
+}
diff --git a/deps/eglib/src/gqueue.c b/deps/eglib/src/gqueue.c
new file mode 100644
index 0000000..f6c71fe
--- /dev/null
+++ b/deps/eglib/src/gqueue.c
@@ -0,0 +1,187 @@
+/*
+ * gqueue.c: Queue
+ *
+ * Author:
+ * Duncan Mak (duncan novell com)
+ * Gonzalo Paniagua Javier (gonzalo novell com)
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ *
+ */
+
+
+#include <config.h>
+
+#include <stdio.h>
+#include <glib.h>
+
+void
+g_queue_init (GQueue *queue)
+{
+ queue->head = NULL;
+ queue->tail = NULL;
+ queue->length = 0;
+}
+
+gpointer
+g_queue_peek_head (GQueue *queue)
+{
+ g_return_val_if_fail (queue, NULL);
+ return queue->head->data;
+}
+
+gpointer
+g_queue_pop_head (GQueue *queue)
+{
+ gpointer result;
+ GList *old_head;
+
+ g_return_val_if_fail (queue, NULL);
+
+ if (!queue->head)
+ return NULL;
+
+ result = queue->head->data;
+ old_head = queue->head;
+ queue->head = old_head->next;
+ g_list_free_1 (old_head);
+
+ if (--queue->length)
+ queue->head->prev = NULL;
+ else
+ queue->tail = NULL;
+
+ return result;
+}
+
+gpointer
+g_queue_peek_tail (GQueue *queue)
+{
+ g_return_val_if_fail (queue, NULL);
+ return queue->tail->data;
+}
+
+gpointer
+g_queue_pop_tail (GQueue *queue)
+{
+ gpointer result;
+ GList *old_tail;
+
+ g_return_val_if_fail (queue, NULL);
+
+ if (!queue->tail)
+ return NULL;
+
+ result = queue->tail->data;
+ old_tail = queue->tail;
+ queue->tail = old_tail->prev;
+
+ if (old_tail->prev)
+ old_tail->prev->next = NULL;
+ else
+ queue->head = NULL;
+
+ queue->length--;
+ g_list_free_1 (old_tail);
+
+ return result;
+}
+
+gboolean
+g_queue_is_empty (GQueue *queue)
+{
+ g_return_val_if_fail (queue, TRUE);
+ return queue->length == 0;
+}
+
+void
+g_queue_push_head (GQueue *queue, gpointer head)
+{
+ g_return_if_fail (queue);
+
+ queue->head = g_list_prepend (queue->head, head);
+
+ if (!queue->tail)
+ queue->tail = queue->head;
+
+ queue->length ++;
+}
+
+void
+g_queue_push_tail (GQueue *queue, gpointer data)
+{
+ g_return_if_fail (queue);
+
+ queue->tail = g_list_append (queue->tail, data);
+ if (queue->head == NULL)
+ queue->head = queue->tail;
+ else
+ queue->tail = queue->tail->next;
+ queue->length++;
+}
+
+GQueue *
+g_queue_new (void)
+{
+ return g_new0 (GQueue, 1);
+}
+
+void
+g_queue_free (GQueue *queue)
+{
+ g_return_if_fail (queue);
+
+ g_list_free (queue->head);
+ g_free (queue);
+}
+
+void
+g_queue_foreach (GQueue *queue, GFunc func, gpointer user_data)
+{
+ g_return_if_fail (queue);
+ g_return_if_fail (func);
+
+ g_list_foreach (queue->head, func, user_data);
+}
+
+GList *
+g_queue_find (GQueue *queue, gconstpointer data)
+{
+ GList *l;
+
+ for (l = queue->head; l; l = l->next)
+ if (l->data == data)
+ return l;
+
+ return NULL;
+}
+
+void
+g_queue_clear (GQueue *queue)
+{
+ g_return_if_fail (queue);
+
+ g_list_free (queue->head);
+ queue->length = 0;
+ queue->head = NULL;
+ queue->tail = NULL;
+}
diff --git a/deps/eglib/src/gshell.c b/deps/eglib/src/gshell.c
new file mode 100644
index 0000000..c2ea5b5
--- /dev/null
+++ b/deps/eglib/src/gshell.c
@@ -0,0 +1,304 @@
+/*
+ * Shell utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <glib.h>
+
+GQuark
+g_shell_error_get_quark (void)
+{
+ return g_quark_from_static_string ("g-shell-error-quark");
+}
+
+static int
+split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
+{
+ gchar *ptr;
+ gchar c;
+ gboolean escaped = FALSE, fresh = TRUE;
+ gchar quote_char = '\0';
+ GString *str;
+
+ str = g_string_new ("");
+ ptr = (gchar *) cmdline;
+ while ((c = *ptr++) != '\0') {
+ if (escaped) {
+ /*
+ * \CHAR is only special inside a double quote if CHAR is
+ * one of: $`"\ and newline
+ */
+ if (quote_char == '\"'){
+ if (!(c == '$' || c == '`' || c == '"' || c == '\\'))
+ g_string_append_c (str, '\\');
+ g_string_append_c (str, c);
+ } else {
+ if (!g_ascii_isspace (c))
+ g_string_append_c (str, c);
+ }
+ escaped = FALSE;
+ } else if (quote_char) {
+ if (c == quote_char) {
+ quote_char = '\0';
+ if (fresh && (g_ascii_isspace (*ptr) || *ptr == '\0')){
+ g_ptr_array_add (array, g_string_free (str, FALSE));
+ str = g_string_new ("");
+ }
+ } else if (c == '\\'){
+ escaped = TRUE;
+ } else
+ g_string_append_c (str, c);
+ } else if (g_ascii_isspace (c)) {
+ if (str->len > 0) {
+ g_ptr_array_add (array, g_string_free (str, FALSE));
+ str = g_string_new ("");
+ }
+ } else if (c == '\\') {
+ escaped = TRUE;
+ } else if (c == '\'' || c == '"') {
+ fresh = str->len == 0;
+ quote_char = c;
+ } else {
+ g_string_append_c (str, c);
+ }
+ }
+
+ if (escaped) {
+ if (error)
+ *error = g_error_new (G_SHELL_ERROR,
+ G_SHELL_ERROR_BAD_QUOTING,
+ "Unfinished escape.");
+ g_string_free (str, TRUE);
+ return -1;
+ }
+
+ if (quote_char) {
+ if (error)
+ *error = g_error_new (G_SHELL_ERROR,
+ G_SHELL_ERROR_BAD_QUOTING,
+ "Unfinished quote.");
+ g_string_free (str, TRUE);
+ return -1;
+ }
+
+ if (str->len > 0) {
+ g_ptr_array_add (array, g_string_free (str, FALSE));
+ } else {
+ g_string_free (str, TRUE);
+ }
+ g_ptr_array_add (array, NULL);
+ return 0;
+}
+
+gboolean
+g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error)
+{
+ GPtrArray *array;
+ gint argc;
+ gchar **argv;
+
+ g_return_val_if_fail (command_line, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ array = g_ptr_array_new();
+ if (split_cmdline (command_line, array, error)) {
+ g_ptr_array_add (array, NULL);
+ g_strfreev ((gchar **) array->pdata);
+ g_ptr_array_free (array, FALSE);
+ return FALSE;
+ }
+
+ argc = array->len;
+ argv = (gchar **) array->pdata;
+
+ if (argc == 1) {
+ g_strfreev (argv);
+ g_ptr_array_free (array, FALSE);
+ return FALSE;
+ }
+
+ if (argcp) {
+ *argcp = array->len - 1;
+ }
+
+ if (argvp) {
+ *argvp = argv;
+ } else {
+ g_strfreev (argv);
+ }
+
+ g_ptr_array_free (array, FALSE);
+ return TRUE;
+}
+
+gchar *
+g_shell_quote (const gchar *unquoted_string)
+{
+ GString *result = g_string_new ("'");
+ const gchar *p;
+
+ for (p = unquoted_string; *p; p++){
+ if (*p == '\'')
+ g_string_append (result, "'\\'");
+ g_string_append_c (result, *p);
+ }
+ g_string_append_c (result, '\'');
+ return g_string_free (result, FALSE);
+}
+
+gchar *
+g_shell_unquote (const gchar *quoted_string, GError **error)
+{
+ GString *result;
+ const char *p;
+ int do_unquote = 0;
+
+ if (quoted_string == NULL)
+ return NULL;
+
+ /* Quickly try to determine if we need to unquote or not */
+ for (p = quoted_string; *p; p++){
+ if (*p == '\'' || *p == '"' || *p == '\\'){
+ do_unquote = 1;
+ break;
+ }
+ }
+
+ if (!do_unquote)
+ return g_strdup (quoted_string);
+
+ /* We do need to unquote */
+ result = g_string_new ("");
+ for (p = quoted_string; *p; p++){
+
+ if (*p == '\''){
+ /* Process single quote, not even \ is processed by glib's version */
+ for (p++; *p; p++){
+ if (*p == '\'')
+ break;
+ g_string_append_c (result, *p);
+ }
+ if (!*p){
+ g_set_error (error, 0, 0, "Open quote");
+ return NULL;
+ }
+ } else if (*p == '"'){
+ /* Process double quote, allows some escaping */
+ for (p++; *p; p++){
+ if (*p == '"')
+ break;
+ if (*p == '\\'){
+ p++;
+ if (*p == 0){
+ g_set_error (error, 0, 0, "Open quote");
+ return NULL;
+ }
+ switch (*p){
+ case '$':
+ case '"':
+ case '\\':
+ case '`':
+ break;
+ default:
+ g_string_append_c (result, '\\');
+ break;
+ }
+ }
+ g_string_append_c (result, *p);
+ }
+ if (!*p){
+ g_set_error (error, 0, 0, "Open quote");
+ return NULL;
+ }
+ } else if (*p == '\\'){
+ char c = *(++p);
+ if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == '\'' || c == 0 ))
+ g_string_append_c (result, '\\');
+ if (c == 0)
+ break;
+ else
+ g_string_append_c (result, c);
+ } else
+ g_string_append_c (result, *p);
+ }
+ return g_string_free (result, FALSE);
+}
+
+#if JOINT_TEST
+/*
+ * This test is designed to be built with the 2 glib/eglib to compare
+ */
+
+char *args [] = {
+ "\\",
+ "\"Foo'bar\"",
+ "'foo'",
+ "'fo\'b'",
+ "'foo\"bar'",
+ "'foo' dingus bar",
+ "'foo' 'bar' 'baz'",
+ "\"foo\" 'bar' \"baz\"",
+ "\"f\\$\\\'",
+ "\"\\",
+ "\\\\",
+ "'\\\\'",
+ "\"f\\$\"\\\"\\\\", // /\\\"\\\\"
+ "'f\\$'\\\"\\\\",
+ "'f\\$\\\\'",
+ NULL
+};
+
+
+int
+main ()
+{
+ char **s = args;
+ int i;
+
+ while (*s){
+ char *r1 = g_shell_unquote (*s, NULL);
+ char *r2 = g2_shell_unquote (*s, NULL);
+ char *ok = r1 == r2 ? "ok" : (r1 != NULL && r2 != NULL && strcmp (r1, r2) == 0) ? "ok" :
"fail";
+
+ printf ("%s [%s] -> [%s] - [%s]\n", ok, *s, r1, r2);
+ s++;
+ }
+ return;
+ char buffer [10];
+ buffer [0] = '\"';
+ buffer [1] = '\\';
+ buffer [3] = '\"';
+ buffer [4] = 0;
+
+ for (i = 32; i < 255; i++){
+ buffer [2] = i;
+ printf ("%d [%s] -> [%s]\n", i, buffer, g_shell_unquote (buffer, NULL));
+ }
+}
+#endif
diff --git a/deps/eglib/src/gslist.c b/deps/eglib/src/gslist.c
new file mode 100644
index 0000000..1b12e47
--- /dev/null
+++ b/deps/eglib/src/gslist.c
@@ -0,0 +1,365 @@
+/*
+ * gslist.c: Singly-linked list implementation
+ *
+ * Authors:
+ * Duncan Mak (duncan novell com)
+ * Raja R Harinath (rharinath novell com)
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * (C) 2006 Novell, Inc.
+ */
+
+
+#include <config.h>
+
+#include <stdio.h>
+#include <glib.h>
+
+GSList*
+g_slist_alloc (void)
+{
+ return g_new0 (GSList, 1);
+}
+
+void
+g_slist_free_1 (GSList *list)
+{
+ g_free (list);
+}
+
+GSList*
+g_slist_append (GSList *list, gpointer data)
+{
+ return g_slist_concat (list, g_slist_prepend (NULL, data));
+}
+
+/* This is also a list node constructor. */
+GSList*
+g_slist_prepend (GSList *list, gpointer data)
+{
+ GSList *head = g_slist_alloc ();
+ head->data = data;
+ head->next = list;
+
+ return head;
+}
+
+/*
+ * Insert the given data in a new node after the current node.
+ * Return new node.
+ */
+static inline GSList *
+insert_after (GSList *list, gpointer data)
+{
+ list->next = g_slist_prepend (list->next, data);
+ return list->next;
+}
+
+/*
+ * Return the node prior to the node containing 'data'.
+ * If the list is empty, or the first node contains 'data', return NULL.
+ * If no node contains 'data', return the last node.
+ */
+static inline GSList*
+find_prev (GSList *list, gconstpointer data)
+{
+ GSList *prev = NULL;
+ while (list) {
+ if (list->data == data)
+ break;
+ prev = list;
+ list = list->next;
+ }
+ return prev;
+}
+
+/* like 'find_prev', but searches for node 'link' */
+static inline GSList*
+find_prev_link (GSList *list, GSList *link)
+{
+ GSList *prev = NULL;
+ while (list) {
+ if (list == link)
+ break;
+ prev = list;
+ list = list->next;
+ }
+ return prev;
+}
+
+GSList*
+g_slist_insert_before (GSList *list, GSList *sibling, gpointer data)
+{
+ GSList *prev = find_prev_link (list, sibling);
+
+ if (!prev)
+ return g_slist_prepend (list, data);
+
+ insert_after (prev, data);
+ return list;
+}
+
+void
+g_slist_free (GSList *list)
+{
+ while (list) {
+ GSList *next = list->next;
+ g_slist_free_1 (list);
+ list = next;
+ }
+}
+
+GSList*
+g_slist_copy (GSList *list)
+{
+ GSList *copy, *tmp;
+
+ if (!list)
+ return NULL;
+
+ copy = g_slist_prepend (NULL, list->data);
+ tmp = copy;
+
+ for (list = list->next; list; list = list->next)
+ tmp = insert_after (tmp, list->data);
+
+ return copy;
+}
+
+GSList*
+g_slist_concat (GSList *list1, GSList *list2)
+{
+ if (!list1)
+ return list2;
+
+ g_slist_last (list1)->next = list2;
+ return list1;
+}
+
+void
+g_slist_foreach (GSList *list, GFunc func, gpointer user_data)
+{
+ while (list) {
+ (*func) (list->data, user_data);
+ list = list->next;
+ }
+}
+
+GSList*
+g_slist_last (GSList *list)
+{
+ if (!list)
+ return NULL;
+
+ while (list->next)
+ list = list->next;
+
+ return list;
+}
+
+GSList*
+g_slist_find (GSList *list, gconstpointer data)
+{
+ for (; list; list = list->next)
+ if (list->data == data)
+ return list;
+ return NULL;
+}
+
+GSList *
+g_slist_find_custom (GSList *list, gconstpointer data, GCompareFunc func)
+{
+ if (!func)
+ return NULL;
+
+ while (list) {
+ if (func (list->data, data) == 0)
+ return list;
+
+ list = list->next;
+ }
+
+ return NULL;
+}
+
+guint
+g_slist_length (GSList *list)
+{
+ guint length = 0;
+
+ while (list) {
+ length ++;
+ list = list->next;
+ }
+
+ return length;
+}
+
+GSList*
+g_slist_remove (GSList *list, gconstpointer data)
+{
+ GSList *prev = find_prev (list, data);
+ GSList *current = prev ? prev->next : list;
+
+ if (current) {
+ if (prev)
+ prev->next = current->next;
+ else
+ list = current->next;
+ g_slist_free_1 (current);
+ }
+
+ return list;
+}
+
+GSList*
+g_slist_remove_all (GSList *list, gconstpointer data)
+{
+ GSList *next = list;
+ GSList *prev = NULL;
+ GSList *current;
+
+ while (next) {
+ GSList *tmp_prev = find_prev (next, data);
+ if (tmp_prev)
+ prev = tmp_prev;
+ current = prev ? prev->next : list;
+
+ if (!current)
+ break;
+
+ next = current->next;
+
+ if (prev)
+ prev->next = next;
+ else
+ list = next;
+ g_slist_free_1 (current);
+ }
+
+ return list;
+}
+
+GSList*
+g_slist_remove_link (GSList *list, GSList *link)
+{
+ GSList *prev = find_prev_link (list, link);
+ GSList *current = prev ? prev->next : list;
+
+ if (current) {
+ if (prev)
+ prev->next = current->next;
+ else
+ list = current->next;
+ current->next = NULL;
+ }
+
+ return list;
+}
+
+GSList*
+g_slist_delete_link (GSList *list, GSList *link)
+{
+ list = g_slist_remove_link (list, link);
+ g_slist_free_1 (link);
+
+ return list;
+}
+
+GSList*
+g_slist_reverse (GSList *list)
+{
+ GSList *prev = NULL;
+ while (list){
+ GSList *next = list->next;
+ list->next = prev;
+ prev = list;
+ list = next;
+ }
+
+ return prev;
+}
+
+GSList*
+g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func)
+{
+ GSList *prev = NULL;
+
+ if (!func)
+ return list;
+
+ if (!list || func (list->data, data) > 0)
+ return g_slist_prepend (list, data);
+
+ /* Invariant: func (prev->data, data) <= 0) */
+ for (prev = list; prev->next; prev = prev->next)
+ if (func (prev->next->data, data) > 0)
+ break;
+
+ /* ... && (prev->next == 0 || func (prev->next->data, data) > 0)) */
+ insert_after (prev, data);
+ return list;
+}
+
+gint
+g_slist_index (GSList *list, gconstpointer data)
+{
+ gint index = 0;
+
+ while (list) {
+ if (list->data == data)
+ return index;
+
+ index++;
+ list = list->next;
+ }
+
+ return -1;
+}
+
+GSList*
+g_slist_nth (GSList *list, guint n)
+{
+ for (; list; list = list->next) {
+ if (n == 0)
+ break;
+ n--;
+ }
+ return list;
+}
+
+gpointer
+g_slist_nth_data (GSList *list, guint n)
+{
+ GSList *node = g_slist_nth (list, n);
+ return node ? node->data : NULL;
+}
+
+typedef GSList list_node;
+#include "sort.frag.h"
+
+GSList*
+g_slist_sort (GSList *list, GCompareFunc func)
+{
+ if (!list || !list->next)
+ return list;
+ return do_sort (list, func);
+}
diff --git a/deps/eglib/src/gspawn.c b/deps/eglib/src/gspawn.c
new file mode 100644
index 0000000..3bb9390
--- /dev/null
+++ b/deps/eglib/src/gspawn.c
@@ -0,0 +1,495 @@
+/*
+ * Spawning processes.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include <glib.h>
+
+#ifdef HAVE_UNISTD_H
+#ifndef __USE_GNU
+#define __USE_GNU
+#endif
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#include <winsock2.h>
+#define open _open
+#define close _close
+#define read _read
+#define write _write
+/* windows pipe api details: http://msdn2.microsoft.com/en-us/library/edze9h7e(VS.80).aspx */
+#define pipe(x) _pipe(x, 256, 0)
+#endif
+
+#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (G_SPAWN_ERROR, 1, msg,
__VA_ARGS__); } while (0)
+#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error = g_error_new (G_SPAWN_ERROR,
1, msg, __VA_ARGS__); } while (0)
+#define set_error_status(status,msg, ...) do { if (error != NULL) *error = g_error_new (G_SPAWN_ERROR,
status, msg, __VA_ARGS__); } while (0)
+#define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR)
+#define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0)
+
+#if defined(__APPLE__) && !defined (__arm__)
+/* Apple defines this in crt_externs.h but doesn't provide that header for
+ * arm-apple-darwin9. We'll manually define the symbol on Apple as it does
+ * in fact exist on all implementations (so far)
+ */
+gchar ***_NSGetEnviron();
+#define environ (*_NSGetEnviron())
+#elif defined(_MSC_VER)
+/* MS defines this in stdlib.h */
+#else
+extern char **environ;
+#endif
+
+GQuark
+g_spawn_error_get_quark (void)
+{
+ return g_quark_from_static_string ("g-spawn-error-quark");
+}
+
+
+#ifndef G_OS_WIN32
+static int
+safe_read (int fd, gchar *buffer, gint count, GError **error)
+{
+ int res;
+
+ NO_INTR (res, read (fd, buffer, count));
+ set_error_cond (res == -1, "%s", "Error reading from pipe.");
+ return res;
+}
+
+static int
+read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **error)
+{
+ fd_set rfds;
+ int res;
+ gboolean out_closed;
+ gboolean err_closed;
+ GString *out = NULL;
+ GString *err = NULL;
+ gchar *buffer = NULL;
+ gint nread;
+
+ out_closed = (outfd < 0);
+ err_closed = (errfd < 0);
+ if (out_str) {
+ *out_str = NULL;
+ out = g_string_new ("");
+ }
+
+ if (err_str) {
+ *err_str = NULL;
+ err = g_string_new ("");
+ }
+
+ do {
+ if (out_closed && err_closed)
+ break;
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4389)
+#endif
+
+ FD_ZERO (&rfds);
+ if (!out_closed && outfd >= 0)
+ FD_SET (outfd, &rfds);
+ if (!err_closed && errfd >= 0)
+ FD_SET (errfd, &rfds);
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+ res = select (MAX (outfd, errfd) + 1, &rfds, NULL, NULL, NULL);
+ if (res > 0) {
+ if (buffer == NULL)
+ buffer = g_malloc (1024);
+ if (!out_closed && FD_ISSET (outfd, &rfds)) {
+ nread = safe_read (outfd, buffer, 1024, error);
+ if (nread < 0) {
+ close (errfd);
+ close (outfd);
+ return -1;
+ }
+ g_string_append_len (out, buffer, nread);
+ if (nread <= 0) {
+ out_closed = TRUE;
+ close (outfd);
+ }
+ }
+
+ if (!err_closed && FD_ISSET (errfd, &rfds)) {
+ nread = safe_read (errfd, buffer, 1024, error);
+ if (nread < 0) {
+ close (errfd);
+ close (outfd);
+ return -1;
+ }
+ g_string_append_len (err, buffer, nread);
+ if (nread <= 0) {
+ err_closed = TRUE;
+ close (errfd);
+ }
+ }
+ }
+ } while (res > 0 || (res == -1 && errno == EINTR));
+
+ g_free (buffer);
+ if (out_str)
+ *out_str = g_string_free (out, FALSE);
+
+ if (err_str)
+ *err_str = g_string_free (err, FALSE);
+
+ return 0;
+}
+
+static gboolean
+create_pipe (int *fds, GError **error)
+{
+ if (pipe (fds) == -1) {
+ set_error ("%s", "Error creating pipe.");
+ return FALSE;
+ }
+ return TRUE;
+}
+#endif /* G_OS_WIN32 */
+
+static int
+write_all (int fd, const void *vbuf, size_t n)
+{
+ const char *buf = (const char *) vbuf;
+ size_t nwritten = 0;
+ int w;
+
+ do {
+ do {
+ w = write (fd, buf + nwritten, n - nwritten);
+ } while (w == -1 && errno == EINTR);
+
+ if (w == -1)
+ return -1;
+
+ nwritten += w;
+ } while (nwritten < n);
+
+ return nwritten;
+}
+
+gboolean
+g_spawn_command_line_sync (const gchar *command_line,
+ gchar **standard_output,
+ gchar **standard_error,
+ gint *exit_status,
+ GError **error)
+{
+#ifdef G_OS_WIN32
+#else
+ pid_t pid;
+ gchar **argv;
+ gint argc;
+ int stdout_pipe [2] = { -1, -1 };
+ int stderr_pipe [2] = { -1, -1 };
+ int status;
+ int res;
+
+ if (!g_shell_parse_argv (command_line, &argc, &argv, error))
+ return FALSE;
+
+ if (standard_output && !create_pipe (stdout_pipe, error))
+ return FALSE;
+
+ if (standard_error && !create_pipe (stderr_pipe, error)) {
+ if (standard_output) {
+ CLOSE_PIPE (stdout_pipe);
+ }
+ return FALSE;
+ }
+
+ pid = fork ();
+ if (pid == 0) {
+ gint i;
+
+ if (standard_output) {
+ close (stdout_pipe [0]);
+ dup2 (stdout_pipe [1], STDOUT_FILENO);
+ }
+
+ if (standard_error) {
+ close (stderr_pipe [0]);
+ dup2 (stderr_pipe [1], STDERR_FILENO);
+ }
+ for (i = getdtablesize () - 1; i >= 3; i--)
+ close (i);
+
+ /* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
+ if (!g_path_is_absolute (argv [0])) {
+ gchar *arg0;
+
+ arg0 = g_find_program_in_path (argv [0]);
+ if (arg0 == NULL) {
+ exit (1);
+ }
+ //g_free (argv [0]);
+ argv [0] = arg0;
+ }
+ execv (argv [0], argv);
+ exit (1); /* TODO: What now? */
+ }
+
+ g_strfreev (argv);
+ if (standard_output)
+ close (stdout_pipe [1]);
+
+ if (standard_error)
+ close (stderr_pipe [1]);
+
+ if (standard_output || standard_error) {
+ res = read_pipes (stdout_pipe [0], standard_output, stderr_pipe [0], standard_error, error);
+ if (res) {
+ waitpid (pid, &status, WNOHANG); /* avoid zombie */
+ return FALSE;
+ }
+ }
+
+ NO_INTR (res, waitpid (pid, &status, 0));
+
+ /* TODO: What if error? */
+ if (WIFEXITED (status) && exit_status) {
+ *exit_status = WEXITSTATUS (status);
+ }
+#endif
+ return TRUE;
+}
+
+/*
+ * This is the only use we have in mono/metadata
+!g_spawn_async_with_pipes (NULL, (char**)addr_argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid,
&ch_in, &ch_out, NULL, NULL)
+*/
+gboolean
+g_spawn_async_with_pipes (const gchar *working_directory,
+ gchar **argv,
+ gchar **envp,
+ GSpawnFlags flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ GPid *child_pid,
+ gint *standard_input,
+ gint *standard_output,
+ gint *standard_error,
+ GError **error)
+{
+#ifdef G_OS_WIN32
+#else
+ pid_t pid;
+ int info_pipe [2];
+ int in_pipe [2] = { -1, -1 };
+ int out_pipe [2] = { -1, -1 };
+ int err_pipe [2] = { -1, -1 };
+ int status;
+
+ g_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
+
+ if (!create_pipe (info_pipe, error))
+ return FALSE;
+
+ if (standard_output && !create_pipe (out_pipe, error)) {
+ CLOSE_PIPE (info_pipe);
+ return FALSE;
+ }
+
+ if (standard_error && !create_pipe (err_pipe, error)) {
+ CLOSE_PIPE (info_pipe);
+ CLOSE_PIPE (out_pipe);
+ return FALSE;
+ }
+
+ if (standard_input && !create_pipe (in_pipe, error)) {
+ CLOSE_PIPE (info_pipe);
+ CLOSE_PIPE (out_pipe);
+ CLOSE_PIPE (err_pipe);
+ return FALSE;
+ }
+
+ pid = fork ();
+ if (pid == -1) {
+ CLOSE_PIPE (info_pipe);
+ CLOSE_PIPE (out_pipe);
+ CLOSE_PIPE (err_pipe);
+ CLOSE_PIPE (in_pipe);
+ set_error ("%s", "Error in fork ()");
+ return FALSE;
+ }
+
+ if (pid == 0) {
+ /* No zombie left behind */
+ if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ pid = fork ();
+ }
+
+ if (pid != 0) {
+ exit (pid == -1 ? 1 : 0);
+ } else {
+ gint i;
+ int fd;
+ gchar *arg0;
+ gchar **actual_args;
+ gint unused;
+
+ close (info_pipe [0]);
+ close (in_pipe [1]);
+ close (out_pipe [0]);
+ close (err_pipe [0]);
+
+ /* when exec* succeeds, we want to close this fd, which will return
+ * a 0 read on the parent. We're not supposed to keep it open forever.
+ * If exec fails, we still can write the error to it before closing.
+ */
+ fcntl (info_pipe [1], F_SETFD, FD_CLOEXEC);
+
+ if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ pid = getpid ();
+ NO_INTR (unused, write_all (info_pipe [1], &pid, sizeof (pid_t)));
+ }
+
+ if (working_directory && chdir (working_directory) == -1) {
+ int err = errno;
+ NO_INTR (unused, write_all (info_pipe [1], &err, sizeof (int)));
+ exit (0);
+ }
+
+ if (standard_output) {
+ dup2 (out_pipe [1], STDOUT_FILENO);
+ } else if ((flags & G_SPAWN_STDOUT_TO_DEV_NULL) != 0) {
+ fd = open ("/dev/null", O_WRONLY);
+ dup2 (fd, STDOUT_FILENO);
+ }
+
+ if (standard_error) {
+ dup2 (err_pipe [1], STDERR_FILENO);
+ } else if ((flags & G_SPAWN_STDERR_TO_DEV_NULL) != 0) {
+ fd = open ("/dev/null", O_WRONLY);
+ dup2 (fd, STDERR_FILENO);
+ }
+
+ if (standard_input) {
+ dup2 (in_pipe [0], STDIN_FILENO);
+ } else if ((flags & G_SPAWN_CHILD_INHERITS_STDIN) == 0) {
+ fd = open ("/dev/null", O_RDONLY);
+ dup2 (fd, STDIN_FILENO);
+ }
+
+ if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
+ for (i = getdtablesize () - 1; i >= 3; i--)
+ close (i);
+ }
+
+ actual_args = ((flags & G_SPAWN_FILE_AND_ARGV_ZERO) == 0) ? argv : argv + 1;
+ if (envp == NULL)
+ envp = environ;
+
+ if (child_setup)
+ child_setup (user_data);
+
+ arg0 = argv [0];
+ if (!g_path_is_absolute (arg0) || (flags & G_SPAWN_SEARCH_PATH) != 0) {
+ arg0 = g_find_program_in_path (argv [0]);
+ if (arg0 == NULL) {
+ int err = ENOENT;
+ write_all (info_pipe [1], &err, sizeof (int));
+ exit (0);
+ }
+ }
+
+ execve (arg0, actual_args, envp);
+ write_all (info_pipe [1], &errno, sizeof (int));
+ exit (0);
+ }
+ } else if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ int w;
+ /* Wait for the first child if two are created */
+ NO_INTR (w, waitpid (pid, &status, 0));
+ if (status == 1 || w == -1) {
+ CLOSE_PIPE (info_pipe);
+ CLOSE_PIPE (out_pipe);
+ CLOSE_PIPE (err_pipe);
+ CLOSE_PIPE (in_pipe);
+ set_error ("Error in fork (): %d", status);
+ return FALSE;
+ }
+ }
+ close (info_pipe [1]);
+ close (in_pipe [0]);
+ close (out_pipe [1]);
+ close (err_pipe [1]);
+
+ if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ int x;
+ NO_INTR (x, read (info_pipe [0], &pid, sizeof (pid_t))); /* if we read < sizeof (pid_t)... */
+ }
+
+ if (child_pid) {
+ *child_pid = pid;
+ }
+
+ if (read (info_pipe [0], &status, sizeof (int)) != 0) {
+ close (info_pipe [0]);
+ close (in_pipe [0]);
+ close (out_pipe [1]);
+ close (err_pipe [1]);
+ set_error_status (status, "Error in exec (%d -> %s)", status, strerror (status));
+ return FALSE;
+ }
+
+ close (info_pipe [0]);
+ if (standard_input)
+ *standard_input = in_pipe [1];
+ if (standard_output)
+ *standard_output = out_pipe [0];
+ if (standard_error)
+ *standard_error = err_pipe [0];
+#endif
+ return TRUE;
+}
+
+
diff --git a/deps/eglib/src/gstr.c b/deps/eglib/src/gstr.c
new file mode 100644
index 0000000..e8e449c
--- /dev/null
+++ b/deps/eglib/src/gstr.c
@@ -0,0 +1,932 @@
+/*
+ * gstr.c: String Utility Functions.
+ *
+ * Author:
+ * Miguel de Icaza (miguel novell com)
+ * Aaron Bockover (abockover novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <glib.h>
+
+/* This is not a macro, because I dont want to put _GNU_SOURCE in the glib.h header */
+gchar *
+g_strndup (const gchar *str, gsize n)
+{
+#ifdef HAVE_STRNDUP
+ return strndup (str, n);
+#else
+ if (str) {
+ char *retval = g_malloc(n+1);
+ if (retval) {
+ strncpy(retval, str, n)[n] = 0;
+ }
+ return retval;
+ }
+ return NULL;
+#endif
+}
+
+void
+g_strfreev (gchar **str_array)
+{
+ gchar **orig = str_array;
+ if (str_array == NULL)
+ return;
+ while (*str_array != NULL){
+ g_free (*str_array);
+ str_array++;
+ }
+ g_free (orig);
+}
+
+gchar **
+g_strdupv (gchar **str_array)
+{
+ guint length;
+ gchar **ret;
+ guint i;
+
+ if (!str_array)
+ return NULL;
+
+ length = g_strv_length(str_array);
+ ret = g_new0(gchar *, length + 1);
+ for (i = 0; str_array[i]; i++) {
+ ret[i] = g_strdup(str_array[i]);
+ }
+ ret[length] = NULL;
+ return ret;
+}
+
+guint
+g_strv_length(gchar **str_array)
+{
+ gint length = 0;
+ g_return_val_if_fail(str_array != NULL, 0);
+ for(length = 0; str_array[length] != NULL; length++);
+ return length;
+}
+
+gboolean
+g_str_has_suffix(const gchar *str, const gchar *suffix)
+{
+ size_t str_length;
+ size_t suffix_length;
+
+ g_return_val_if_fail(str != NULL, FALSE);
+ g_return_val_if_fail(suffix != NULL, FALSE);
+
+ str_length = strlen(str);
+ suffix_length = strlen(suffix);
+
+ return suffix_length <= str_length ?
+ strncmp(str + str_length - suffix_length, suffix, suffix_length) == 0 :
+ FALSE;
+}
+
+gboolean
+g_str_has_prefix(const gchar *str, const gchar *prefix)
+{
+ size_t str_length;
+ size_t prefix_length;
+
+ g_return_val_if_fail(str != NULL, FALSE);
+ g_return_val_if_fail(prefix != NULL, FALSE);
+
+ str_length = strlen(str);
+ prefix_length = strlen(prefix);
+
+ return prefix_length <= str_length ?
+ strncmp(str, prefix, prefix_length) == 0 :
+ FALSE;
+}
+
+gchar *
+g_strdup_vprintf (const gchar *format, va_list args)
+{
+ int n;
+ char *ret;
+
+ n = vasprintf (&ret, format, args);
+ if (n == -1)
+ return NULL;
+
+ return ret;
+}
+
+gchar *
+g_strdup_printf (const gchar *format, ...)
+{
+ gchar *ret;
+ va_list args;
+ int n;
+
+ va_start (args, format);
+ n = vasprintf (&ret, format, args);
+ va_end (args);
+ if (n == -1)
+ return NULL;
+
+ return ret;
+}
+
+const gchar *
+g_strerror (gint errnum)
+{
+ return strerror (errnum);
+}
+
+gchar *
+g_strconcat (const gchar *first, ...)
+{
+ va_list args;
+ size_t total = 0;
+ char *s, *ret;
+ g_return_val_if_fail (first != NULL, NULL);
+
+ total += strlen (first);
+ va_start (args, first);
+ for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
+ total += strlen (s);
+ }
+ va_end (args);
+
+ ret = g_malloc (total + 1);
+ if (ret == NULL)
+ return NULL;
+
+ ret [total] = 0;
+ strcpy (ret, first);
+ va_start (args, first);
+ for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
+ strcat (ret, s);
+ }
+ va_end (args);
+
+ return ret;
+}
+
+static void
+add_to_vector (gchar ***vector, int size, gchar *token)
+{
+ *vector = *vector == NULL ?
+ (gchar **)g_malloc(2 * sizeof(*vector)) :
+ (gchar **)g_realloc(*vector, (size + 1) * sizeof(*vector));
+
+ (*vector)[size - 1] = token;
+}
+
+gchar **
+g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
+{
+ const gchar *c;
+ gchar *token, **vector;
+ gint size = 1;
+
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (delimiter != NULL, NULL);
+ g_return_val_if_fail (delimiter[0] != 0, NULL);
+
+ if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
+ vector = (gchar **)g_malloc (2 * sizeof(vector));
+ vector[0] = g_strdup ("");
+ size++;
+ string += strlen (delimiter);
+ } else {
+ vector = NULL;
+ }
+
+ while (*string && !(max_tokens > 0 && size >= max_tokens)) {
+ c = string;
+ if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
+ token = g_strdup ("");
+ string += strlen (delimiter);
+ } else {
+ while (*string && strncmp (string, delimiter, strlen (delimiter)) != 0) {
+ string++;
+ }
+
+ if (*string) {
+ gsize toklen = (string - c);
+ token = g_strndup (c, toklen);
+
+ /* Need to leave a trailing empty
+ * token if the delimiter is the last
+ * part of the string
+ */
+ if (strcmp (string, delimiter) != 0) {
+ string += strlen (delimiter);
+ }
+ } else {
+ token = g_strdup (c);
+ }
+ }
+
+ add_to_vector (&vector, size, token);
+ size++;
+ }
+
+ if (*string) {
+ if (strcmp (string, delimiter) == 0)
+ add_to_vector (&vector, size, g_strdup (""));
+ else {
+ /* Add the rest of the string as the last element */
+ add_to_vector (&vector, size, g_strdup (string));
+ }
+ size++;
+ }
+
+ if (vector == NULL) {
+ vector = (gchar **) g_malloc (2 * sizeof (vector));
+ vector [0] = NULL;
+ } else if (size > 0) {
+ vector[size - 1] = NULL;
+ }
+
+ return vector;
+}
+
+static gboolean
+charcmp (gchar testchar, const gchar *compare)
+{
+ while(*compare) {
+ if (*compare == testchar) {
+ return TRUE;
+ }
+ compare++;
+ }
+
+ return FALSE;
+}
+
+gchar **
+g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens)
+{
+ const gchar *c;
+ gchar *token, **vector;
+ gint size = 1;
+
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (delimiter != NULL, NULL);
+ g_return_val_if_fail (delimiter[0] != 0, NULL);
+
+ if (charcmp (*string, delimiter)) {
+ vector = (gchar **)g_malloc (2 * sizeof(vector));
+ vector[0] = g_strdup ("");
+ size++;
+ string++;
+ } else {
+ vector = NULL;
+ }
+
+ c = string;
+ while (*string && !(max_tokens > 0 && size >= max_tokens)) {
+ if (charcmp (*string, delimiter)) {
+ gsize toklen = (string - c);
+ if (toklen == 0) {
+ token = g_strdup ("");
+ } else {
+ token = g_strndup (c, toklen);
+ }
+
+ c = string + 1;
+
+ add_to_vector (&vector, size, token);
+ size++;
+ }
+
+ string++;
+ }
+
+ if (max_tokens > 0 && size >= max_tokens) {
+ if (*string) {
+ /* Add the rest of the string as the last element */
+ add_to_vector (&vector, size, g_strdup (string));
+ size++;
+ }
+ } else {
+ if (*c) {
+ /* Fill in the trailing last token */
+ add_to_vector (&vector, size, g_strdup (c));
+ size++;
+ } else {
+ /* Need to leave a trailing empty token if the
+ * delimiter is the last part of the string
+ */
+ add_to_vector (&vector, size, g_strdup (""));
+ size++;
+ }
+ }
+
+ if (vector == NULL) {
+ vector = (gchar **) g_malloc (2 * sizeof (vector));
+ vector [0] = NULL;
+ } else if (size > 0) {
+ vector[size - 1] = NULL;
+ }
+
+ return vector;
+}
+
+gchar *
+g_strreverse (gchar *str)
+{
+ size_t i, j;
+ gchar c;
+
+ if (str == NULL)
+ return NULL;
+
+ if (*str == 0)
+ return str;
+
+ for (i = 0, j = strlen (str) - 1; i < j; i++, j--) {
+ c = str [i];
+ str [i] = str [j];
+ str [j] = c;
+ }
+
+ return str;
+}
+
+gchar *
+g_strjoin (const gchar *separator, ...)
+{
+ va_list args;
+ char *res, *s, *r;
+ size_t len, slen;
+
+ if (separator != NULL)
+ slen = strlen (separator);
+ else
+ slen = 0;
+
+ len = 0;
+ va_start (args, separator);
+ for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
+ len += strlen (s);
+ len += slen;
+ }
+ va_end (args);
+
+ if (len == 0)
+ return g_strdup ("");
+
+ /* Remove the last separator */
+ if (slen > 0 && len > 0)
+ len -= slen;
+
+ res = g_malloc (len + 1);
+ va_start (args, separator);
+ s = va_arg (args, char *);
+ r = g_stpcpy (res, s);
+ for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
+ if (separator != NULL)
+ r = g_stpcpy (r, separator);
+ r = g_stpcpy (r, s);
+ }
+ va_end (args);
+
+ return res;
+}
+
+gchar *
+g_strjoinv (const gchar *separator, gchar **str_array)
+{
+ char *res, *r;
+ size_t slen, len, i;
+
+ if (separator != NULL)
+ slen = strlen (separator);
+ else
+ slen = 0;
+
+ len = 0;
+ for (i = 0; str_array [i] != NULL; i++){
+ len += strlen (str_array [i]);
+ len += slen;
+ }
+
+ if (len == 0)
+ return g_strdup ("");
+
+ if (slen > 0 && len > 0)
+ len -= slen;
+
+ res = g_malloc (len + 1);
+ r = g_stpcpy (res, str_array [0]);
+ for (i = 1; str_array [i] != NULL; i++){
+ if (separator != NULL)
+ r = g_stpcpy (r, separator);
+ r = g_stpcpy (r, str_array [i]);
+ }
+
+ return res;
+}
+
+gchar *
+g_strchug (gchar *str)
+{
+ size_t len;
+ gchar *tmp;
+
+ if (str == NULL)
+ return NULL;
+
+ tmp = str;
+ while (*tmp && isspace (*tmp)) tmp++;
+ if (str != tmp) {
+ len = strlen (str) - (tmp - str - 1);
+ memmove (str, tmp, len);
+ }
+ return str;
+}
+
+gchar *
+g_strchomp (gchar *str)
+{
+ gchar *tmp;
+
+ if (str == NULL)
+ return NULL;
+
+ tmp = str + strlen (str) - 1;
+ while (*tmp && isspace (*tmp)) tmp--;
+ *(tmp + 1) = '\0';
+ return str;
+}
+
+gint
+g_printf(gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vprintf(format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_fprintf(FILE *file, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vfprintf(file, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_sprintf(gchar *string, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vsprintf(string, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_snprintf(gchar *string, gulong n, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vsnprintf(string, n, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+static const char hx [] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+
+static gboolean
+char_needs_encoding (char c)
+{
+ if (((unsigned char)c) >= 0x80)
+ return TRUE;
+
+ if ((c >= '@' && c <= 'Z') ||
+ (c >= 'a' && c <= 'z') ||
+ (c >= '&' && c < 0x3b) ||
+ (c == '!') || (c == '$') || (c == '_') || (c == '=') || (c == '~'))
+ return FALSE;
+ return TRUE;
+}
+
+gchar *
+g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
+{
+ size_t n;
+ char *ret, *rp;
+ const char *p;
+#ifdef G_OS_WIN32
+ const char *uriPrefix = "file:///";
+#else
+ const char *uriPrefix = "file://";
+#endif
+
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ if (hostname != NULL)
+ g_warning ("%s", "eglib: g_filename_to_uri: hostname not handled");
+
+ if (!g_path_is_absolute (filename)){
+ if (error != NULL) {
+ *error = g_error_new (G_CONVERT_ERROR,
+ G_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
+ "Not an absolute filename");
+ }
+
+ return NULL;
+ }
+
+ n = strlen (uriPrefix) + 1;
+ for (p = filename; *p; p++){
+#ifdef G_OS_WIN32
+ if (*p == '\\') {
+ n++;
+ continue;
+ }
+#endif
+ if (char_needs_encoding (*p))
+ n += 3;
+ else
+ n++;
+ }
+ ret = g_malloc (n);
+ strcpy (ret, uriPrefix);
+ for (p = filename, rp = ret + strlen (ret); *p; p++){
+#ifdef G_OS_WIN32
+ if (*p == '\\') {
+ *rp++ = '/';
+ continue;
+ }
+#endif
+ if (char_needs_encoding (*p)){
+ *rp++ = '%';
+ *rp++ = hx [((unsigned char)(*p)) >> 4];
+ *rp++ = hx [((unsigned char)(*p)) & 0xf];
+ } else
+ *rp++ = *p;
+ }
+ *rp = 0;
+ return ret;
+}
+
+static int
+decode (char p)
+{
+ if (p >= '0' && p <= '9')
+ return p - '0';
+ if (p >= 'A' && p <= 'F')
+ return p - 'A';
+ if (p >= 'a' && p <= 'f')
+ return p - 'a';
+ g_assert_not_reached ();
+ return 0;
+}
+
+gchar *
+g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
+{
+ const char *p;
+ char *r, *result;
+ int flen = 0;
+
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ if (hostname != NULL)
+ g_warning ("%s", "eglib: g_filename_from_uri: hostname not handled");
+
+ if (strncmp (uri, "file:///", 8) != 0){
+ if (error != NULL) {
+ *error = g_error_new (G_CONVERT_ERROR,
+ G_CONVERT_ERROR_BAD_URI,
+ "URI does not start with the file: scheme");
+ }
+ return NULL;
+ }
+
+ for (p = uri + 8; *p; p++){
+ if (*p == '%'){
+ if (p [1] && p [2] && isxdigit (p [1]) && isxdigit (p [2])){
+ p += 2;
+ } else {
+ if (error != NULL) {
+ *error = g_error_new (G_CONVERT_ERROR,
+ G_CONVERT_ERROR_BAD_URI,
+ "URI contains an invalid escape sequence");
+ }
+ return NULL;
+ }
+ }
+ flen++;
+ }
+#ifndef G_OS_WIN32
+ flen++;
+#endif
+
+ result = g_malloc (flen + 1);
+ result [flen] = 0;
+
+#ifndef G_OS_WIN32
+ *result = '/';
+ r = result + 1;
+#else
+ r = result;
+#endif
+
+ for (p = uri + 8; *p; p++){
+ if (*p == '%'){
+ *r++ = (char)((decode (p [1]) << 4) | decode (p [2]));
+ p += 2;
+ } else
+ *r++ = *p;
+ flen++;
+ }
+ return result;
+}
+
+void
+g_strdown (gchar *string)
+{
+ g_return_if_fail (string != NULL);
+
+ while (*string){
+ *string = (gchar)tolower (*string);
+ string++;
+ }
+}
+
+gchar
+g_ascii_tolower (gchar c)
+{
+ return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c;
+}
+
+gchar *
+g_ascii_strdown (const gchar *str, gssize len)
+{
+ char *ret;
+ int i;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len == -1)
+ len = strlen (str);
+
+ ret = g_malloc (len + 1);
+ for (i = 0; i < len; i++)
+ ret [i] = (guchar) g_ascii_tolower (str [i]);
+ ret [i] = 0;
+
+ return ret;
+}
+
+gchar
+g_ascii_toupper (gchar c)
+{
+ return c >= 'a' && c <= 'z' ? c + ('A' - 'a') : c;
+}
+
+gchar *
+g_ascii_strup (const gchar *str, gssize len)
+{
+ char *ret;
+ int i;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len == -1)
+ len = strlen (str);
+
+ ret = g_malloc (len + 1);
+ for (i = 0; i < len; i++)
+ ret [i] = (guchar) g_ascii_toupper (str [i]);
+ ret [i] = 0;
+
+ return ret;
+}
+
+gint
+g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n)
+{
+ gsize i;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ for (i = 0; i < n; i++) {
+ gchar c1 = g_ascii_tolower (*s1++);
+ gchar c2 = g_ascii_tolower (*s2++);
+
+ if (c1 != c2)
+ return c1 - c2;
+ }
+
+ return 0;
+}
+
+gint
+g_ascii_strcasecmp (const gchar *s1, const gchar *s2)
+{
+ const char *sp1 = s1;
+ const char *sp2 = s2;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ while (*sp1 != '\0') {
+ char c1 = g_ascii_tolower (*sp1++);
+ char c2 = g_ascii_tolower (*sp2++);
+
+ if (c1 != c2)
+ return c1 - c2;
+ }
+
+ return (*sp1) - (*sp2);
+}
+
+gchar *
+g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter)
+{
+ gchar *ptr;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if (delimiters == NULL)
+ delimiters = G_STR_DELIMITERS;
+
+ for (ptr = string; *ptr; ptr++) {
+ if (strchr (delimiters, *ptr))
+ *ptr = new_delimiter;
+ }
+
+ return string;
+}
+
+gsize
+g_strlcpy (gchar *dest, const gchar *src, gsize dest_size)
+{
+#ifdef HAVE_STRLCPY
+ return strlcpy (dest, src, dest_size);
+#else
+ gchar *d;
+ const gchar *s;
+ gchar c;
+ gsize len;
+
+ g_return_val_if_fail (src != NULL, 0);
+ g_return_val_if_fail (dest != NULL, 0);
+
+ len = dest_size;
+ if (len == 0)
+ return 0;
+
+ s = src;
+ d = dest;
+ while (--len) {
+ c = *s++;
+ *d++ = c;
+ if (c == '\0')
+ return (dest_size - len - 1);
+ }
+
+ /* len is 0 i we get here */
+ *d = '\0';
+ /* we need to return the length of src here */
+ while (*s++) ; /* instead of a plain strlen, we use 's' */
+ return s - src - 1;
+#endif
+}
+
+gchar *
+g_stpcpy (gchar *dest, const char *src)
+{
+ g_return_val_if_fail (dest != NULL, dest);
+ g_return_val_if_fail (src != NULL, dest);
+
+#if HAVE_STPCPY
+ return stpcpy (dest, src);
+#else
+ while (*src)
+ *dest++ = *src++;
+
+ *dest = '\0';
+
+ return dest;
+#endif
+}
+
+static const gchar escaped_dflt [256] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 'b', 't', 'n', 1, 'f', 'r', 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, '"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+};
+
+gchar *
+g_strescape (const gchar *source, const gchar *exceptions)
+{
+ gchar escaped [256];
+ const gchar *ptr;
+ gchar c;
+ gchar op;
+ gchar *result;
+ gchar *res_ptr;
+
+ g_return_val_if_fail (source != NULL, NULL);
+
+ memcpy (escaped, escaped_dflt, 256);
+ if (exceptions != NULL) {
+ for (ptr = exceptions; *ptr; ptr++)
+ escaped [(int) *ptr] = 0;
+ }
+ result = g_malloc (strlen (source) * 4 + 1); /* Worst case: everything octal. */
+ res_ptr = result;
+ for (ptr = source; *ptr; ptr++) {
+ c = *ptr;
+ op = escaped [(int) c];
+ if (op == 0) {
+ *res_ptr++ = c;
+ } else {
+ *res_ptr++ = '\\';
+ if (op != 1) {
+ *res_ptr++ = op;
+ } else {
+ *res_ptr++ = '0' + ((c >> 6) & 3);
+ *res_ptr++ = '0' + ((c >> 3) & 7);
+ *res_ptr++ = '0' + (c & 7);
+ }
+ }
+ }
+ *res_ptr = '\0';
+ return result;
+}
+
+gint
+g_ascii_xdigit_value (gchar c)
+{
+ return ((isxdigit (c) == 0) ? -1 :
+ ((c >= '0' && c <= '9') ? (c - '0') :
+ ((c >= 'a' && c <= 'f') ? (c - 'a' + 10) :
+ (c - 'A' + 10))));
+}
+
+gchar *
+g_strnfill (gsize length, gchar fill_char)
+{
+ gchar *ret = g_new (gchar, length + 1);
+
+ memset (ret, fill_char, length);
+ ret [length] = 0;
+ return ret;
+}
diff --git a/deps/eglib/src/gstring.c b/deps/eglib/src/gstring.c
new file mode 100644
index 0000000..38dfc45
--- /dev/null
+++ b/deps/eglib/src/gstring.c
@@ -0,0 +1,293 @@
+/*
+ * String functions
+ *
+ * Author:
+ * Miguel de Icaza (miguel novell com)
+ * Aaron Bockover (abockover novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <glib.h>
+
+#define GROW_IF_NECESSARY(s,l) { \
+ if(s->len + l >= s->allocated_len) { \
+ s->allocated_len = (s->allocated_len + l + 16) * 2; \
+ s->str = g_realloc(s->str, s->allocated_len); \
+ } \
+}
+
+GString *
+g_string_new_len (const gchar *init, gssize len)
+{
+ GString *ret = g_new (GString, 1);
+
+ if (init == NULL)
+ ret->len = 0;
+ else
+ ret->len = len < 0 ? strlen(init) : len;
+ ret->allocated_len = MAX(ret->len + 1, 16);
+ ret->str = g_malloc(ret->allocated_len);
+ if (init)
+ memcpy(ret->str, init, ret->len);
+ ret->str[ret->len] = 0;
+
+ return ret;
+}
+
+GString *
+g_string_new (const gchar *init)
+{
+ return g_string_new_len(init, -1);
+}
+
+GString *
+g_string_sized_new (gsize default_size)
+{
+ GString *ret = g_new (GString, 1);
+
+ ret->str = g_malloc (default_size);
+ ret->str [0] = 0;
+ ret->len = 0;
+ ret->allocated_len = default_size;
+
+ return ret;
+}
+
+gchar *
+g_string_free (GString *string, gboolean free_segment)
+{
+ gchar *data;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ data = string->str;
+ g_free(string);
+
+ if(!free_segment) {
+ return data;
+ }
+
+ g_free(data);
+ return NULL;
+}
+
+GString *
+g_string_assign (GString *string, const gchar *val)
+{
+ g_return_val_if_fail(string != NULL, NULL);
+ g_return_val_if_fail(val != NULL, string);
+
+ if (string->str == val)
+ return string;
+
+ g_string_truncate (string, 0);
+ g_string_append (string, val);
+ return string;
+}
+
+GString *
+g_string_append_len (GString *string, const gchar *val, gssize len)
+{
+ g_return_val_if_fail(string != NULL, NULL);
+ g_return_val_if_fail(val != NULL, string);
+
+ if(len < 0) {
+ len = strlen(val);
+ }
+
+ GROW_IF_NECESSARY(string, len);
+ memcpy(string->str + string->len, val, len);
+ string->len += len;
+ string->str[string->len] = 0;
+
+ return string;
+}
+
+GString *
+g_string_append (GString *string, const gchar *val)
+{
+ g_return_val_if_fail(string != NULL, NULL);
+ g_return_val_if_fail(val != NULL, string);
+
+ return g_string_append_len(string, val, -1);
+}
+
+GString *
+g_string_append_c (GString *string, gchar c)
+{
+ g_return_val_if_fail(string != NULL, NULL);
+
+ GROW_IF_NECESSARY(string, 1);
+
+ string->str[string->len] = c;
+ string->str[string->len + 1] = 0;
+ string->len++;
+
+ return string;
+}
+
+GString *
+g_string_append_unichar (GString *string, gunichar c)
+{
+ gchar utf8[6];
+ gint len;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if ((len = g_unichar_to_utf8 (c, utf8)) <= 0)
+ return string;
+
+ return g_string_append_len (string, utf8, len);
+}
+
+GString *
+g_string_prepend (GString *string, const gchar *val)
+{
+ gssize len;
+
+ g_return_val_if_fail (string != NULL, string);
+ g_return_val_if_fail (val != NULL, string);
+
+ len = strlen (val);
+
+ GROW_IF_NECESSARY(string, len);
+ memmove(string->str + len, string->str, string->len + 1);
+ memcpy(string->str, val, len);
+
+ return string;
+}
+
+GString *
+g_string_insert (GString *string, gssize pos, const gchar *val)
+{
+ gssize len;
+
+ g_return_val_if_fail (string != NULL, string);
+ g_return_val_if_fail (val != NULL, string);
+ g_return_val_if_fail (pos <= string->len, string);
+
+ len = strlen (val);
+
+ GROW_IF_NECESSARY(string, len);
+ memmove(string->str + pos + len, string->str + pos, string->len - pos - len + 1);
+ memcpy(string->str + pos, val, len);
+
+ return string;
+}
+
+void
+g_string_append_printf (GString *string, const gchar *format, ...)
+{
+ char *ret;
+ va_list args;
+
+ g_return_if_fail (string != NULL);
+ g_return_if_fail (format != NULL);
+
+ va_start (args, format);
+ ret = g_strdup_vprintf (format, args);
+ va_end (args);
+ g_string_append (string, ret);
+
+ g_free (ret);
+}
+
+void
+g_string_append_vprintf (GString *string, const gchar *format, va_list args)
+{
+ char *ret;
+
+ g_return_if_fail (string != NULL);
+ g_return_if_fail (format != NULL);
+
+ ret = g_strdup_vprintf (format, args);
+ g_string_append (string, ret);
+ g_free (ret);
+}
+
+void
+g_string_printf (GString *string, const gchar *format, ...)
+{
+ va_list args;
+
+ g_return_if_fail (string != NULL);
+ g_return_if_fail (format != NULL);
+
+ g_free (string->str);
+
+ va_start (args, format);
+ string->str = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ string->len = strlen (string->str);
+ string->allocated_len = string->len+1;
+}
+
+GString *
+g_string_truncate (GString *string, gsize len)
+{
+ g_return_val_if_fail (string != NULL, string);
+
+ /* Silent return */
+ if (len >= string->len)
+ return string;
+
+ string->len = len;
+ string->str[len] = 0;
+ return string;
+}
+
+GString *
+g_string_set_size (GString *string, gsize len)
+{
+ g_return_val_if_fail (string != NULL, string);
+
+ GROW_IF_NECESSARY(string, len);
+
+ string->len = len;
+ string->str[len] = 0;
+ return string;
+}
+
+GString *
+g_string_erase (GString *string, gssize pos, gssize len)
+{
+ g_return_val_if_fail (string != NULL, string);
+
+ /* Silent return */
+ if (pos >= string->len)
+ return string;
+
+ if (len == -1 || (pos + len) >= string->len) {
+ string->str[pos] = 0;
+ }
+ else {
+ memmove (string->str + pos, string->str + pos + len, string->len - (pos + len) + 1);
+ string->len -= len;
+ }
+
+ return string;
+}
diff --git a/deps/eglib/src/gtimer-unix.c b/deps/eglib/src/gtimer-unix.c
new file mode 100644
index 0000000..901f921
--- /dev/null
+++ b/deps/eglib/src/gtimer-unix.c
@@ -0,0 +1,99 @@
+/*
+ * Timer
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <sys/time.h>
+
+struct _GTimer {
+ struct timeval start;
+ struct timeval stop;
+};
+
+GTimer *g_timer_new (void)
+{
+ GTimer *timer;
+
+ timer = g_new0 (GTimer, 1);
+ g_timer_start (timer);
+ return timer;
+}
+
+void
+g_timer_destroy (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+ g_free (timer);
+}
+
+void
+g_timer_start (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+ gettimeofday (&timer->start, NULL);
+ memset (&timer->stop, 0, sizeof (struct timeval));
+}
+
+void
+g_timer_stop (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+ gettimeofday (&timer->stop, NULL);
+}
+
+gdouble
+g_timer_elapsed (GTimer *timer, gulong *microseconds)
+{
+ struct timeval tv;
+ gulong seconds;
+ long usec;
+ gdouble result;
+
+ g_return_val_if_fail (timer != NULL, 0.0);
+
+ if (timer->stop.tv_sec == 0 && timer->stop.tv_usec == 0) {
+ gettimeofday (&tv, NULL);
+ } else {
+ tv = timer->stop;
+ }
+
+ usec = (tv.tv_usec) - (timer->start.tv_usec);
+ seconds = tv.tv_sec - timer->start.tv_sec;
+ if (microseconds) {
+ if (usec < 0) {
+ usec += 1000000;
+ seconds--;
+ }
+ *microseconds = usec;
+ }
+ result = seconds * 1000000 + usec;
+ return (result / 1000000);
+}
+
+
diff --git a/deps/eglib/src/gtimer-win32.c b/deps/eglib/src/gtimer-win32.c
new file mode 100644
index 0000000..2025eee
--- /dev/null
+++ b/deps/eglib/src/gtimer-win32.c
@@ -0,0 +1,97 @@
+/*
+ * Timer
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo novell com
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <windows.h>
+
+struct _GTimer {
+ guint64 start;
+ guint64 stop;
+};
+
+GTimer *g_timer_new (void)
+{
+ GTimer *timer;
+
+ timer = g_new0 (GTimer, 1);
+ g_timer_start (timer);
+ return timer;
+}
+
+void
+g_timer_destroy (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+ g_free (timer);
+}
+
+void
+g_timer_start (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+
+ QueryPerformanceCounter ((LARGE_INTEGER*)&timer->start);
+}
+
+void
+g_timer_stop (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+
+ QueryPerformanceCounter ((LARGE_INTEGER*)&timer->stop);
+}
+
+gdouble
+g_timer_elapsed (GTimer *timer, gulong *microseconds)
+{
+ static guint64 freq = 0;
+ guint64 delta, stop;
+
+ if (freq == 0) {
+ if (!QueryPerformanceFrequency ((LARGE_INTEGER *)&freq))
+ freq = 1;
+ }
+
+ if (timer->stop == 0) {
+ QueryPerformanceCounter ((LARGE_INTEGER*)&stop);
+ }
+ else {
+ stop = timer->stop;
+ }
+
+ delta = stop - timer->start;
+
+ if (microseconds)
+ *microseconds = (gulong) (delta * (1000000.0 / freq));
+
+ return (gdouble) delta / (gdouble) freq;
+}
+
+
diff --git a/deps/eglib/src/gunicode.c b/deps/eglib/src/gunicode.c
new file mode 100644
index 0000000..c3a9000
--- /dev/null
+++ b/deps/eglib/src/gunicode.c
@@ -0,0 +1,253 @@
+/*
+ * gunicode.c: Some Unicode routines
+ *
+ * Author:
+ * Miguel de Icaza (miguel novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * utf8 validation code came from:
+ * libxml2-2.6.26 licensed under the MIT X11 license
+ *
+ * Authors credit in libxml's string.c:
+ * William Brack <wbrack mmm com hk>
+ * daniel veillard com
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#include <config.h>
+#include <stdio.h>
+#include <glib.h>
+#include <unicode-data.h>
+#include <errno.h>
+
+#if defined(_MSC_VER) || defined(G_OS_WIN32)
+/* FIXME */
+# define CODESET 1
+# include <windows.h>
+#else
+# ifdef HAVE_LANGINFO_H
+# include <langinfo.h>
+# endif
+# ifdef HAVE_LOCALCHARSET_H
+# include <localcharset.h>
+# endif
+#endif
+
+static const char *my_charset;
+static gboolean is_utf8;
+
+/*
+ * Character set conversion
+ */
+
+GUnicodeType
+g_unichar_type (gunichar c)
+{
+ int i;
+
+ guint16 cp = (guint16) c;
+ for (i = 0; i < unicode_category_ranges_count; i++) {
+ if (cp < unicode_category_ranges [i].start)
+ continue;
+ if (unicode_category_ranges [i].end <= cp)
+ continue;
+ return unicode_category [i] [cp - unicode_category_ranges [i].start];
+ }
+
+ /*
+ // 3400-4DB5: OtherLetter
+ // 4E00-9FC3: OtherLetter
+ // AC00-D7A3: OtherLetter
+ // D800-DFFF: OtherSurrogate
+ // E000-F8FF: OtherPrivateUse
+ // 20000-2A6D6 OtherLetter
+ // F0000-FFFFD OtherPrivateUse
+ // 100000-10FFFD OtherPrivateUse
+ */
+ if (0x3400 <= cp && cp < 0x4DB5)
+ return G_UNICODE_OTHER_LETTER;
+ if (0x4E00 <= cp && cp < 0x9FC3)
+ return G_UNICODE_OTHER_LETTER;
+ if (0xAC00<= cp && cp < 0xD7A3)
+ return G_UNICODE_OTHER_LETTER;
+ if (0xD800 <= cp && cp < 0xDFFF)
+ return G_UNICODE_SURROGATE;
+ if (0xE000 <= cp && cp < 0xF8FF)
+ return G_UNICODE_PRIVATE_USE;
+ /* since the argument is UTF-16, we cannot check beyond FFFF */
+
+ /* It should match any of above */
+ return 0;
+}
+
+GUnicodeBreakType
+g_unichar_break_type (gunichar c)
+{
+ // MOONLIGHT_FIXME
+ return G_UNICODE_BREAK_UNKNOWN;
+}
+
+gunichar
+g_unichar_case (gunichar c, gboolean upper)
+{
+ gint8 i, i2;
+ guint32 cp = (guint32) c, v;
+
+ for (i = 0; i < simple_case_map_ranges_count; i++) {
+ if (cp < simple_case_map_ranges [i].start)
+ return c;
+ if (simple_case_map_ranges [i].end <= cp)
+ continue;
+ if (c < 0x10000) {
+ const guint16 *tab = upper ? simple_upper_case_mapping_lowarea [i] :
simple_lower_case_mapping_lowarea [i];
+ v = tab [cp - simple_case_map_ranges [i].start];
+ } else {
+ const guint32 *tab;
+ i2 = (gint8)(i - (upper ? simple_upper_case_mapping_lowarea_table_count :
simple_lower_case_mapping_lowarea_table_count));
+ tab = upper ? simple_upper_case_mapping_higharea [i2] :
simple_lower_case_mapping_higharea [i2];
+ v = tab [cp - simple_case_map_ranges [i].start];
+ }
+ return v != 0 ? (gunichar) v : c;
+ }
+ return c;
+}
+
+gunichar
+g_unichar_toupper (gunichar c)
+{
+ return g_unichar_case (c, TRUE);
+}
+
+gunichar
+g_unichar_tolower (gunichar c)
+{
+ return g_unichar_case (c, FALSE);
+}
+
+gunichar
+g_unichar_totitle (gunichar c)
+{
+ guint8 i;
+ guint32 cp;
+
+ cp = (guint32) c;
+ for (i = 0; i < simple_titlecase_mapping_count; i++) {
+ if (simple_titlecase_mapping [i].codepoint == cp)
+ return simple_titlecase_mapping [i].title;
+ if (simple_titlecase_mapping [i].codepoint > cp)
+ /* it is ordered, hence no more match */
+ break;
+ }
+ return g_unichar_toupper (c);
+}
+
+gboolean
+g_unichar_isxdigit (gunichar c)
+{
+ return (g_unichar_xdigit_value (c) != -1);
+
+}
+
+gint
+g_unichar_xdigit_value (gunichar c)
+{
+ if (c >= 0x30 && c <= 0x39) /*0-9*/
+ return (c - 0x30);
+ if (c >= 0x41 && c <= 0x46) /*A-F*/
+ return (c - 0x37);
+ if (c >= 0x61 && c <= 0x66) /*a-f*/
+ return (c - 0x57);
+ return -1;
+}
+
+gboolean
+g_unichar_isspace (gunichar c)
+{
+ GUnicodeType type = g_unichar_type (c);
+ if (type == G_UNICODE_LINE_SEPARATOR ||
+ type == G_UNICODE_PARAGRAPH_SEPARATOR ||
+ type == G_UNICODE_SPACE_SEPARATOR)
+ return TRUE;
+
+ return FALSE;
+}
+
+
+/*
+ * This is broken, and assumes an UTF8 system, but will do for eglib's first user
+ */
+gchar *
+g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError
**error)
+{
+ char *res;
+
+ if (len == -1)
+ len = strlen (utf8string);
+
+ res = g_malloc (len + 1);
+ g_strlcpy (res, utf8string, len + 1);
+ return res;
+}
+
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+ if (my_charset == NULL) {
+#ifdef G_OS_WIN32
+ static char buf [14];
+ sprintf (buf, "CP%u", GetACP ());
+ my_charset = buf;
+ is_utf8 = FALSE;
+#else
+ /* These shouldn't be heap allocated */
+#if HAVE_LOCALCHARSET_H
+ my_charset = locale_charset ();
+#elif defined(HAVE_LANGINFO_H)
+ my_charset = nl_langinfo (CODESET);
+#else
+ my_charset = "UTF-8";
+#endif
+ is_utf8 = strcmp (my_charset, "UTF-8") == 0;
+#endif
+ }
+
+ if (charset != NULL)
+ *charset = my_charset;
+
+ return is_utf8;
+}
+
+gchar *
+g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError
**error)
+{
+ g_get_charset (NULL);
+
+ return g_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error);
+}
+
+gchar *
+g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError
**error)
+{
+ g_get_charset (NULL);
+
+ return g_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error);
+}
diff --git a/deps/eglib/src/gutf8.c b/deps/eglib/src/gutf8.c
new file mode 100644
index 0000000..e6a47ac
--- /dev/null
+++ b/deps/eglib/src/gutf8.c
@@ -0,0 +1,376 @@
+/*
+ * gutf8.c: UTF-8 conversion
+ *
+ * Author:
+ * Atsushi Enomoto <atsushi ximian com>
+ *
+ * (C) 2006 Novell, Inc.
+ * Copyright 2012 Xamarin Inc
+ */
+
+
+#include <config.h>
+
+#include <stdio.h>
+#include <glib.h>
+
+/*
+ * Index into the table below with the first byte of a UTF-8 sequence to get
+ * the number of bytes that are supposed to follow it to complete the sequence.
+ *
+ * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is left
+ * as-is for anyone who may want to do such conversion, which was allowed in
+ * earlier algorithms.
+*/
+const guchar g_utf8_jump_table[256] = {
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
+};
+
+static gchar *
+utf8_case_conv (const gchar *str, gssize len, gboolean upper)
+{
+ gunichar *ustr;
+ glong i, ulen;
+ gchar *utf8;
+
+ ustr = g_utf8_to_ucs4_fast (str, (glong) len, &ulen);
+ for (i = 0; i < ulen; i++)
+ ustr[i] = upper ? g_unichar_toupper (ustr[i]) : g_unichar_tolower (ustr[i]);
+ utf8 = g_ucs4_to_utf8 (ustr, ulen, NULL, NULL, NULL);
+ g_free (ustr);
+
+ return utf8;
+}
+
+gchar *
+g_utf8_strup (const gchar *str, gssize len)
+{
+ return utf8_case_conv (str, len, TRUE);
+}
+
+gchar *
+g_utf8_strdown (const gchar *str, gssize len)
+{
+ return utf8_case_conv (str, len, FALSE);
+}
+
+static gboolean
+utf8_validate (const unsigned char *inptr, size_t len)
+{
+ const unsigned char *ptr = inptr + len;
+ unsigned char c;
+
+ /* Everything falls through when TRUE... */
+ switch (len) {
+ default:
+ return FALSE;
+ case 4:
+ if ((c = (*--ptr)) < 0x80 || c > 0xBF)
+ return FALSE;
+
+ if ((c == 0xBF || c == 0xBE) && ptr[-1] == 0xBF) {
+ if (ptr[-2] == 0x8F || ptr[-2] == 0x9F ||
+ ptr[-2] == 0xAF || ptr[-2] == 0xBF)
+ return FALSE;
+ }
+ case 3:
+ if ((c = (*--ptr)) < 0x80 || c > 0xBF)
+ return FALSE;
+ case 2:
+ if ((c = (*--ptr)) < 0x80 || c > 0xBF)
+ return FALSE;
+
+ /* no fall-through in this inner switch */
+ switch (*inptr) {
+ case 0xE0: if (c < 0xA0) return FALSE; break;
+ case 0xED: if (c > 0x9F) return FALSE; break;
+ case 0xEF: if (c == 0xB7 && (ptr[1] > 0x8F && ptr[1] < 0xB0)) return FALSE;
+ if (c == 0xBF && (ptr[1] == 0xBE || ptr[1] == 0xBF)) return FALSE;
+ break;
+ case 0xF0: if (c < 0x90) return FALSE; break;
+ case 0xF4: if (c > 0x8F) return FALSE; break;
+ default: if (c < 0x80) return FALSE; break;
+ }
+ case 1: if (*inptr >= 0x80 && *inptr < 0xC2) return FALSE;
+ }
+
+ if (*inptr > 0xF4)
+ return FALSE;
+
+ return TRUE;
+}
+
+/**
+ * g_utf8_validate:
+ * @str: a utf-8 encoded string
+ * @max_len: max number of bytes to validate (or -1 to validate the entire null-terminated string)
+ * @end: output parameter to mark the end of the valid input
+ *
+ * Checks @utf for being valid UTF-8. @str is assumed to be
+ * null-terminated. This function is not super-strict, as it will
+ * allow longer UTF-8 sequences than necessary. Note that Java is
+ * capable of producing these sequences if provoked. Also note, this
+ * routine checks for the 4-byte maximum size, but does not check for
+ * 0x10ffff maximum value.
+ *
+ * Return value: %TRUE if @str is valid or %FALSE otherwise.
+ **/
+gboolean
+g_utf8_validate (const gchar *str, gssize max_len, const gchar **end)
+{
+ guchar *inptr = (guchar *) str;
+ gboolean valid = TRUE;
+ guint length, min;
+ gssize n = 0;
+
+ if (max_len == 0)
+ return FALSE;
+
+ if (max_len < 0) {
+ while (*inptr != 0) {
+ length = g_utf8_jump_table[*inptr];
+ if (!utf8_validate (inptr, length)) {
+ valid = FALSE;
+ break;
+ }
+
+ inptr += length;
+ }
+ } else {
+ while (n < max_len) {
+ if (*inptr == 0) {
+ /* Note: return FALSE if we encounter nul-byte
+ * before max_len is reached. */
+ valid = FALSE;
+ break;
+ }
+
+ length = g_utf8_jump_table[*inptr];
+ min = MIN (length, max_len - n);
+
+ if (!utf8_validate (inptr, min)) {
+ valid = FALSE;
+ break;
+ }
+
+ if (min < length) {
+ valid = FALSE;
+ break;
+ }
+
+ inptr += length;
+ n += length;
+ }
+ }
+
+ if (end != NULL)
+ *end = (gchar *) inptr;
+
+ return valid;
+}
+
+gunichar
+g_utf8_get_char_validated (const gchar *str, gssize max_len)
+{
+ unsigned char *inptr = (unsigned char *) str;
+ gunichar u = *inptr;
+ int n, i;
+
+ if (max_len == 0)
+ return -2;
+
+ if (u < 0x80) {
+ /* simple ascii case */
+ return u;
+ } else if (u < 0xc2) {
+ return -1;
+ } else if (u < 0xe0) {
+ u &= 0x1f;
+ n = 2;
+ } else if (u < 0xf0) {
+ u &= 0x0f;
+ n = 3;
+ } else if (u < 0xf8) {
+ u &= 0x07;
+ n = 4;
+ } else if (u < 0xfc) {
+ u &= 0x03;
+ n = 5;
+ } else if (u < 0xfe) {
+ u &= 0x01;
+ n = 6;
+ } else {
+ return -1;
+ }
+
+ if (max_len > 0) {
+ if (!utf8_validate (inptr, MIN (max_len, n)))
+ return -1;
+
+ if (max_len < n)
+ return -2;
+ } else {
+ if (!utf8_validate (inptr, n))
+ return -1;
+ }
+
+ for (i = 1; i < n; i++)
+ u = (u << 6) | (*++inptr ^ 0x80);
+
+ return u;
+}
+
+glong
+g_utf8_strlen (const gchar *str, gssize max_len)
+{
+ const guchar *inptr = (const guchar *) str;
+ glong clen = 0, len = 0, n;
+
+ if (max_len == 0)
+ return 0;
+
+ if (max_len < 0) {
+ while (*inptr) {
+ inptr += g_utf8_jump_table[*inptr];
+ len++;
+ }
+ } else {
+ while (len < max_len && *inptr) {
+ n = g_utf8_jump_table[*inptr];
+ if ((clen + n) > max_len)
+ break;
+
+ inptr += n;
+ clen += n;
+ len++;
+ }
+ }
+
+ return len;
+}
+
+gunichar
+g_utf8_get_char (const gchar *src)
+{
+ unsigned char *inptr = (unsigned char *) src;
+ gunichar u = *inptr;
+ int n, i;
+
+ if (u < 0x80) {
+ /* simple ascii case */
+ return u;
+ } else if (u < 0xe0) {
+ u &= 0x1f;
+ n = 2;
+ } else if (u < 0xf0) {
+ u &= 0x0f;
+ n = 3;
+ } else if (u < 0xf8) {
+ u &= 0x07;
+ n = 4;
+ } else if (u < 0xfc) {
+ u &= 0x03;
+ n = 5;
+ } else {
+ u &= 0x01;
+ n = 6;
+ }
+
+ for (i = 1; i < n; i++)
+ u = (u << 6) | (*++inptr ^ 0x80);
+
+ return u;
+}
+
+gchar *
+g_utf8_find_prev_char (const gchar *str, const gchar *p)
+{
+ while (p > str) {
+ p--;
+ if ((*p & 0xc0) != 0xb0)
+ return (gchar *)p;
+ }
+ return NULL;
+}
+
+gchar *
+g_utf8_prev_char (const gchar *str)
+{
+ const gchar *p = str;
+ do {
+ p--;
+ } while ((*p & 0xc0) == 0xb0);
+
+ return (gchar *)p;
+}
+
+gchar *
+g_utf8_offset_to_pointer (const gchar *str, glong offset)
+{
+ const gchar *p = str;
+
+ if (offset > 0) {
+ do {
+ p = g_utf8_next_char (p);
+ offset --;
+ } while (offset > 0);
+ }
+ else if (offset < 0) {
+ const gchar *jump = str;
+ do {
+ // since the minimum size of a character is 1
+ // we know we can step back at least offset bytes
+ jump = jump + offset;
+
+ // if we land in the middle of a character
+ // walk to the beginning
+ while ((*jump & 0xc0) == 0xb0)
+ jump --;
+
+ // count how many characters we've actually walked
+ // by going forward
+ p = jump;
+ do {
+ p = g_utf8_next_char (p);
+ offset ++;
+ } while (p < jump);
+
+ } while (offset < 0);
+ }
+
+ return (gchar *)p;
+}
+
+glong
+g_utf8_pointer_to_offset (const gchar *str, const gchar *pos)
+{
+ const gchar *inptr, *inend;
+ glong offset = 0;
+ glong sign = 1;
+
+ if (pos == str)
+ return 0;
+
+ if (str < pos) {
+ inptr = str;
+ inend = pos;
+ } else {
+ inptr = pos;
+ inend = str;
+ sign = -1;
+ }
+
+ do {
+ inptr = g_utf8_next_char (inptr);
+ offset++;
+ } while (inptr < inend);
+
+ return offset * sign;
+}
diff --git a/deps/eglib/src/sort.frag.h b/deps/eglib/src/sort.frag.h
new file mode 100644
index 0000000..2cf5a9b
--- /dev/null
+++ b/deps/eglib/src/sort.frag.h
@@ -0,0 +1,184 @@
+/*
+ * sort.frag.h: Common implementation of linked-list sorting
+ *
+ * Author:
+ * Raja R Harinath (rharinath novell com)
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * (C) 2006 Novell, Inc.
+ */
+
+/*
+ * This code requires a typedef named 'list_node' for the list node. It
+ * is assumed that the list type is the type of a pointer to a list
+ * node, and that the node has a field named 'next' that implements to
+ * the linked list. No additional invariant is maintained (e.g. the
+ * 'prev' pointer of a doubly-linked list node is _not_ updated). Any
+ * invariant would require a post-processing pass to fix matters if
+ * necessary.
+ */
+typedef list_node *digit;
+
+/*
+ * The maximum possible depth of the merge tree
+ * = ceiling (log2 (maximum number of list nodes))
+ * = ceiling (log2 (maximum possible memory size/size of each list node))
+ * = number of bits in 'size_t' - floor (log2 (sizeof digit))
+ * Also, each list in sort_info is at least 2 nodes long: we can reduce the depth by 1
+ */
+#define FLOOR_LOG2(x) (((x)>=2) + ((x)>=4) + ((x)>=8) + ((x)>=16) + ((x)>=32) + ((x)>=64) + ((x)>=128))
+#define MAX_RANKS ((sizeof (size_t) * 8) - FLOOR_LOG2(sizeof (list_node)) - 1)
+
+struct sort_info
+{
+ int min_rank, n_ranks;
+ GCompareFunc func;
+
+ /* Invariant: ranks[i] == NULL || length(ranks[i]) >= 2**(i+1) */
+ list_node *ranks [MAX_RANKS]; /* ~ 128 bytes on 32bit, ~ 512 bytes on 64bit */
+};
+
+static inline void
+init_sort_info (struct sort_info *si, GCompareFunc func)
+{
+ si->min_rank = si->n_ranks = 0;
+ si->func = func;
+ /* we don't need to initialize si->ranks, since we never lookup past si->n_ranks. */
+}
+
+static inline list_node *
+merge_lists (list_node *first, list_node *second, GCompareFunc func)
+{
+ /* merge the two lists */
+ list_node *list = NULL;
+ list_node **pos = &list;
+ while (first && second) {
+ if (func (first->data, second->data) > 0) {
+ *pos = second;
+ second = second->next;
+ } else {
+ *pos = first;
+ first = first->next;
+ }
+ pos = &((*pos)->next);
+ }
+ *pos = first ? first : second;
+ return list;
+}
+
+/* Pre-condition: upto <= si->n_ranks, list == NULL || length(list) == 1 */
+static inline list_node *
+sweep_up (struct sort_info *si, list_node *list, int upto)
+{
+ int i;
+ for (i = si->min_rank; i < upto; ++i) {
+ list = merge_lists (si->ranks [i], list, si->func);
+ si->ranks [i] = NULL;
+ }
+ return list;
+}
+
+/*
+ * The 'ranks' array essentially captures the recursion stack of a mergesort.
+ * The merge tree is built in a bottom-up manner. The control loop for
+ * updating the 'ranks' array is analogous to incrementing a binary integer,
+ * and the O(n) time for counting upto n translates to O(n) merges when
+ * inserting rank-0 lists. When we plug in the sizes of the lists involved in
+ * those merges, we get the O(n log n) time for the sort.
+ *
+ * Inserting higher-ranked lists reduce the height of the merge tree, and also
+ * eliminate a lot of redundant comparisons when merging two lists that would've
+ * been part of the same run. Adding a rank-i list is analogous to incrementing
+ * a binary integer by 2**i in one operation, thus sharing a similar speedup.
+ *
+ * When inserting higher-ranked lists, we choose to clear out the lower ranks
+ * in the interests of keeping the sort stable, but this makes analysis harder.
+ * Note that clearing the lower-ranked lists is O(length(list))-- thus it
+ * shouldn't affect the O(n log n) behaviour. IOW, inserting one rank-i list
+ * is equivalent to inserting 2**i rank-0 lists, thus even if we do i additional
+ * merges in the clearing-out (taking at most 2**i time) we are still fine.
+ */
+
+#define stringify2(x) #x
+#define stringify(x) stringify2(x)
+
+/* Pre-condition: 2**(rank+1) <= length(list) < 2**(rank+2) (therefore: length(list) >= 2) */
+static inline void
+insert_list (struct sort_info *si, list_node* list, int rank)
+{
+ int i;
+
+ if (rank > si->n_ranks) {
+ if (rank > MAX_RANKS) {
+ g_warning ("Rank '%d' should not exceed " stringify (MAX_RANKS), rank);
+ rank = MAX_RANKS;
+ }
+ list = merge_lists (sweep_up (si, NULL, si->n_ranks), list, si->func);
+ for (i = si->n_ranks; i < rank; ++i)
+ si->ranks [i] = NULL;
+ } else {
+ if (rank)
+ list = merge_lists (sweep_up (si, NULL, rank), list, si->func);
+ for (i = rank; i < si->n_ranks && si->ranks [i]; ++i) {
+ list = merge_lists (si->ranks [i], list, si->func);
+ si->ranks [i] = NULL;
+ }
+ }
+
+ if (i == MAX_RANKS) /* Will _never_ happen: so we can just devolve into quadratic ;-) */
+ --i;
+ if (i >= si->n_ranks)
+ si->n_ranks = i + 1;
+ si->min_rank = i;
+ si->ranks [i] = list;
+}
+
+#undef stringify2
+#undef stringify
+#undef MAX_RANKS
+#undef FLOOR_LOG2
+
+/* A non-recursive mergesort */
+static inline digit
+do_sort (list_node* list, GCompareFunc func)
+{
+ struct sort_info si;
+
+ init_sort_info (&si, func);
+
+ while (list && list->next) {
+ list_node* next = list->next;
+ list_node* tail = next->next;
+
+ if (func (list->data, next->data) > 0) {
+ next->next = list;
+ next = list;
+ list = list->next;
+ }
+ next->next = NULL;
+
+ insert_list (&si, list, 0);
+
+ list = tail;
+ }
+
+ return sweep_up (&si, list, si.n_ranks);
+}
diff --git a/deps/eglib/src/unicode-data.h b/deps/eglib/src/unicode-data.h
new file mode 100644
index 0000000..1cd75f3
--- /dev/null
+++ b/deps/eglib/src/unicode-data.h
@@ -0,0 +1,2152 @@
+/*
+This file is automatically generated by ucd.exe.
+The source for this generator should be in Mono repository
+(mcs/class/corlib/Mono.Globalization.Unicode directory).
+*/
+
+#ifndef __UNICODE_DATA_H
+#define __UNICODE_DATA_H
+
+#include <glib.h>
+
+
+/* ======== Structures ======== */
+typedef struct {
+ guint32 codepoint;
+ guint32 upper;
+ guint32 title;
+} SimpleTitlecaseMapping;
+typedef struct {
+ guint32 start;
+ guint32 end;
+} CodePointRange;
+typedef struct {
+ guint32 upper;
+ guint32 lower;
+} SimpleCaseMapping;
+
+/* ======== Unicode Categories ======== */
+static const guint8 unicode_category_ranges_count = 11;
+static const CodePointRange unicode_category_ranges [] = {
+{0x000000, 0x003400},
+{0x004DC0, 0x004E00},
+{0x00A000, 0x00AA80},
+{0x00F900, 0x010000},
+{0x010000, 0x0104C0},
+{0x010800, 0x010A80},
+{0x012000, 0x012480},
+{0x01D000, 0x01D800},
+{0x01F000, 0x01F0C0},
+{0x02F800, 0x02FA40},
+{0x0E0000, 0x0E0200},
+{0, 0}};
+static const guint8 unicode_category_table0 [] = {
+ /* ==== 0-3400 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 29,21,21,21,23,21,21,21,22,18,21,25,21,17,21,21,
+ 13,13,13,13,13,13,13,13,13,13,21,21,25,25,25,21,
+ 21,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,22,21,18,24,16,
+ 24,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,22,25,18,25,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 29,21,23,23,23,23,26,26,24,26,5,20,25,1,26,24,
+ 26,25,15,15,24,5,26,21,24,15,5,19,15,15,15,21,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,25,9,9,9,9,9,9,9,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,25,5,5,5,5,5,5,5,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,5,9,5,9,5,9,5,9,
+ 5,9,5,9,5,9,5,9,5,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,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0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,10,10,21,0,0,0,0,0,0,0,0,0,0,0,
+ 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,12,7,7,12,12,12,12,12,12,12,0,0,0,0,23,
+ 7,7,7,7,7,7,6,12,12,12,12,12,12,12,12,21,
+ 13,13,13,13,13,13,13,13,13,13,21,21,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,7,7,0,7,0,0,7,7,0,7,0,0,7,0,0,
+ 0,0,0,0,7,7,7,7,0,7,7,7,7,7,7,7,
+ 0,7,7,7,0,7,0,7,0,0,7,7,0,7,7,7,
+ 7,12,7,7,12,12,12,12,12,12,0,12,12,7,0,0,
+ 7,7,7,7,7,0,6,0,12,12,12,12,12,12,0,0,
+ 13,13,13,13,13,13,13,13,13,13,0,0,7,7,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,26,26,26,21,21,21,21,21,21,21,21,21,21,21,21,
+ 21,21,21,26,26,26,26,26,12,12,26,26,26,26,26,26,
+ 13,13,13,13,13,13,13,13,13,13,15,15,15,15,15,15,
+ 15,15,15,15,26,12,26,12,26,12,22,18,22,18,10,10,
+ 7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
+ 0,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,
+ 12,12,12,12,12,21,12,12,7,7,7,7,0,0,0,0,
+ 12,12,12,12,12,12,12,12,0,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,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8,8,8,8,8,
+ 5,5,5,5,5,0,5,5,9,9,9,9,8,24,5,24,
+ 24,24,5,5,5,0,5,5,9,9,9,9,8,24,24,24,
+ 5,5,5,5,0,0,5,5,9,9,9,9,0,24,24,24,
+ 5,5,5,5,5,5,5,5,9,9,9,9,9,24,24,24,
+ 0,0,5,5,5,0,5,5,9,9,9,9,8,24,24,0,
+ 29,29,29,29,29,29,29,29,29,29,29,1,1,1,1,1,
+ 17,17,17,17,17,17,21,21,20,19,22,20,20,19,22,20,
+ 21,21,21,21,21,21,21,21,27,28,1,1,1,1,1,29,
+ 21,21,21,21,21,21,21,21,21,20,19,21,21,21,21,16,
+ 16,21,21,21,25,22,18,21,21,21,21,21,21,21,21,21,
+ 21,21,25,21,16,21,21,21,21,21,21,21,21,21,21,29,
+ 1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,
+ 15,5,0,0,15,15,15,15,15,15,25,25,25,22,18,5,
+ 15,15,15,15,15,15,15,15,15,15,25,25,25,22,18,0,
+ 6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,
+ 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
+ 23,23,23,23,23,23,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,
+ 11,12,11,11,11,12,12,12,12,12,12,12,12,12,12,12,
+ 12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,9,26,26,26,26,9,26,26,5,9,9,9,5,5,
+ 9,9,9,5,26,9,26,26,26,9,9,9,9,9,26,26,
+ 26,26,26,26,9,26,9,26,9,26,9,9,9,9,26,5,
+ 9,9,9,9,5,7,7,7,7,5,26,26,5,5,9,9,
+ 25,25,25,25,25,9,5,5,5,5,26,25,26,26,5,26,
+ 0,0,0,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,9,5,14,14,14,14,0,0,0,0,0,0,0,
+ 25,25,25,25,25,26,26,26,26,26,25,25,26,26,26,26,
+ 25,26,26,25,26,26,25,26,26,26,26,26,26,26,25,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,
+ 26,26,25,26,25,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 26,26,26,26,26,26,26,26,25,25,25,25,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 25,25,26,26,26,26,26,26,26,22,18,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,25,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,
+ 25,25,26,26,26,26,26,26,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,25,26,26,26,26,26,26,26,26,
+ 26,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,
+ 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,26,26,26,26,0,26,26,26,26,0,0,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,0,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,0,26,0,26,
+ 26,26,26,0,0,0,26,0,26,26,26,26,26,26,26,0,
+ 0,26,26,26,26,26,26,26,22,18,22,18,22,18,22,18,
+ 22,18,22,18,22,18,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,26,0,0,0,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 0,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
+ 25,25,25,25,25,22,18,25,25,25,25,0,25,0,0,0,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,22,18,22,18,22,18,22,18,22,18,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,22,18,22,18,22,18,22,18,22,18,22,18,22,
+ 18,22,18,22,18,22,18,22,18,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,22,18,22,18,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,22,18,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,26,26,25,25,25,25,25,25,0,0,0,
+ 26,26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,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12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 21,21,20,19,20,19,21,21,21,20,19,21,20,19,21,21,
+ 21,21,21,21,21,21,21,17,21,21,17,21,20,19,21,21,
+ 20,19,22,18,22,18,22,18,22,18,21,21,21,21,21,6,
+ 21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,0,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,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7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
+ 26,26,15,15,15,15,26,26,26,26,26,26,26,26,26,26,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
+ 15,15,15,15,15,15,15,15,15,15,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 15,15,15,15,15,15,15,15,15,15,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 0};
+static const guint8 unicode_category_table1 [] = {
+ /* ==== 4DC0-4E00 ==== */
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 0};
+static const guint8 unicode_category_table2 [] = {
+ /* ==== A000-AA80 ==== */
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7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,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,
+ 21,21,26,0,0,0,0,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,0,0,0,26,26,26,26,26,26,26,26,26,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,15,15,15,15,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,15,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,12,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0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14,14,14,14,14,14,14,14,
+ 14,14,14,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 21,21,21,21,0};
+static const guint8 unicode_category_table7 [] = {
+ /* ==== 1D000-1D800 ==== */
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,0,0,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,10,10,12,12,12,26,26,26,10,10,10,
+ 10,10,10,1,1,1,1,1,1,1,1,12,12,12,12,12,
+ 12,12,12,26,26,12,12,12,12,12,12,12,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,12,12,12,12,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,12,12,12,26,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,0,0,0,0,0,0,0,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9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,25,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,25,5,5,5,5,5,5,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,25,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,25,
+ 5,5,5,5,5,5,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,25,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,25,5,5,5,5,5,5,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,25,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,25,5,5,5,5,5,5,9,5,0,0,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 0};
+static const guint8 unicode_category_table8 [] = {
+ /* ==== 1F000-1F0C0 ==== */
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,0};
+static const guint8 unicode_category_table9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 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 0};
+static const guint8 *unicode_category [11] = {
+ unicode_category_table0,
+ unicode_category_table1,
+ unicode_category_table2,
+ unicode_category_table3,
+ unicode_category_table4,
+ unicode_category_table5,
+ unicode_category_table6,
+ unicode_category_table7,
+ unicode_category_table8,
+ unicode_category_table9,
+ unicode_category_table10
+};
+
+static const guint8 simple_case_map_ranges_count = 9;
+static const CodePointRange simple_case_map_ranges [] = {
+{0x000040, 0x000600},
+{0x001000, 0x0010D0},
+{0x001D00, 0x002000},
+{0x002100, 0x0021C0},
+{0x002480, 0x002500},
+{0x002C00, 0x002D80},
+{0x00A640, 0x00A7C0},
+{0x00FF20, 0x00FF80},
+{0x010400, 0x010480},
+{0, 0}};
+static const guint16 simple_upper_case_mapping_lowarea_table0 [] = {
+ /* ==== 40-600 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+ 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0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,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0x399,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0x370,0,0x372,0,0,0,0x376,0,0,0,0x3FD,0x3FE,0x3FF,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0x386,0x388,0x389,0x38A,
+ 0,0x391,0x392,0x393,0x394,0x395,0x396,0x397,0x398,0x399,0x39A,0x39B,0x39C,0x39D,0x39E,0x39F,
+ 0x3A0,0x3A1,0x3A3,0x3A3,0x3A4,0x3A5,0x3A6,0x3A7,0x3A8,0x3A9,0x3AA,0x3AB,0x38C,0x38E,0x38F,0,
+ 0x392,0x398,0,0,0,0x3A6,0x3A0,0x3CF,0,0x3D8,0,0x3DA,0,0x3DC,0,0x3DE,
+ 0,0x3E0,0,0x3E2,0,0x3E4,0,0x3E6,0,0x3E8,0,0x3EA,0,0x3EC,0,0x3EE,
+ 0x39A,0x3A1,0x3F9,0,0,0x395,0,0,0x3F7,0,0,0x3FA,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x410,0x411,0x412,0x413,0x414,0x415,0x416,0x417,0x418,0x419,0x41A,0x41B,0x41C,0x41D,0x41E,0x41F,
+ 0x420,0x421,0x422,0x423,0x424,0x425,0x426,0x427,0x428,0x429,0x42A,0x42B,0x42C,0x42D,0x42E,0x42F,
+ 0x400,0x401,0x402,0x403,0x404,0x405,0x406,0x407,0x408,0x409,0x40A,0x40B,0x40C,0x40D,0x40E,0x40F,
+ 0,0x460,0,0x462,0,0x464,0,0x466,0,0x468,0,0x46A,0,0x46C,0,0x46E,
+ 0,0x470,0,0x472,0,0x474,0,0x476,0,0x478,0,0x47A,0,0x47C,0,0x47E,
+ 0,0x480,0,0,0,0,0,0,0,0,0,0x48A,0,0x48C,0,0x48E,
+ 0,0x490,0,0x492,0,0x494,0,0x496,0,0x498,0,0x49A,0,0x49C,0,0x49E,
+ 0,0x4A0,0,0x4A2,0,0x4A4,0,0x4A6,0,0x4A8,0,0x4AA,0,0x4AC,0,0x4AE,
+ 0,0x4B0,0,0x4B2,0,0x4B4,0,0x4B6,0,0x4B8,0,0x4BA,0,0x4BC,0,0x4BE,
+ 0,0,0x4C1,0,0x4C3,0,0x4C5,0,0x4C7,0,0x4C9,0,0x4CB,0,0x4CD,0x4C0,
+ 0,0x4D0,0,0x4D2,0,0x4D4,0,0x4D6,0,0x4D8,0,0x4DA,0,0x4DC,0,0x4DE,
+ 0,0x4E0,0,0x4E2,0,0x4E4,0,0x4E6,0,0x4E8,0,0x4EA,0,0x4EC,0,0x4EE,
+ 0,0x4F0,0,0x4F2,0,0x4F4,0,0x4F6,0,0x4F8,0,0x4FA,0,0x4FC,0,0x4FE,
+ 0,0x500,0,0x502,0,0x504,0,0x506,0,0x508,0,0x50A,0,0x50C,0,0x50E,
+ 0,0x510,0,0x512,0,0x514,0,0x516,0,0x518,0,0x51A,0,0x51C,0,0x51E,
+ 0,0x520,0,0x522,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0x531,0x532,0x533,0x534,0x535,0x536,0x537,0x538,0x539,0x53A,0x53B,0x53C,0x53D,0x53E,0x53F,
+ 0x540,0x541,0x542,0x543,0x544,0x545,0x546,0x547,0x548,0x549,0x54A,0x54B,0x54C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,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_upper_case_mapping_lowarea_table4 [] = {
+ /* ==== 2480-2500 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+
0x24B6,0x24B7,0x24B8,0x24B9,0x24BA,0x24BB,0x24BC,0x24BD,0x24BE,0x24BF,0x24C0,0x24C1,0x24C2,0x24C3,0x24C4,0x24C5,
+ 0x24C6,0x24C7,0x24C8,0x24C9,0x24CA,0x24CB,0x24CC,0x24CD,0x24CE,0x24CF,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_upper_case_mapping_lowarea_table5 [] = {
+ /* ==== 2C00-2D80 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x2C00,0x2C01,0x2C02,0x2C03,0x2C04,0x2C05,0x2C06,0x2C07,0x2C08,0x2C09,0x2C0A,0x2C0B,0x2C0C,0x2C0D,0x2C0E,0x2C0F,
+
0x2C10,0x2C11,0x2C12,0x2C13,0x2C14,0x2C15,0x2C16,0x2C17,0x2C18,0x2C19,0x2C1A,0x2C1B,0x2C1C,0x2C1D,0x2C1E,0x2C1F,
+
0x2C20,0x2C21,0x2C22,0x2C23,0x2C24,0x2C25,0x2C26,0x2C27,0x2C28,0x2C29,0x2C2A,0x2C2B,0x2C2C,0x2C2D,0x2C2E,0,
+0,0x2C60,0,0,0,0x23A,0x23E,0,0x2C67,0,0x2C69,0,0x2C6B,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7C0 ==== */
+ 0,0xA640,0,0xA642,0,0xA644,0,0xA646,0,0xA648,0,0xA64A,0,0xA64C,0,0xA64E,
+ 0,0xA650,0,0xA652,0,0xA654,0,0xA656,0,0xA658,0,0xA65A,0,0xA65C,0,0xA65E,
+ 0,0,0,0xA662,0,0xA664,0,0xA666,0,0xA668,0,0xA66A,0,0xA66C,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0xA680,0,0xA682,0,0xA684,0,0xA686,0,0xA688,0,0xA68A,0,0xA68C,0,0xA68E,
+ 0,0xA690,0,0xA692,0,0xA694,0,0xA696,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0xA722,0,0xA724,0,0xA726,0,0xA728,0,0xA72A,0,0xA72C,0,0xA72E,
+ 0,0,0,0xA732,0,0xA734,0,0xA736,0,0xA738,0,0xA73A,0,0xA73C,0,0xA73E,
+ 0,0xA740,0,0xA742,0,0xA744,0,0xA746,0,0xA748,0,0xA74A,0,0xA74C,0,0xA74E,
+ 0,0xA750,0,0xA752,0,0xA754,0,0xA756,0,0xA758,0,0xA75A,0,0xA75C,0,0xA75E,
+ 0,0xA760,0,0xA762,0,0xA764,0,0xA766,0,0xA768,0,0xA76A,0,0xA76C,0,0xA76E,
+ 0,0,0,0,0,0,0,0,0,0,0xA779,0,0xA77B,0,0,0xA77E,
+ 0,0xA780,0,0xA782,0,0xA784,0,0xA786,0,0,0,0,0xA78B,0};
+static const guint16 simple_upper_case_mapping_lowarea_table7 [] = {
+ /* ==== FF20-FF80 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+
0,0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28,0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,
+ 0xFF30,0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38,0xFF39,0xFF3A,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 *simple_upper_case_mapping_lowarea [] = {
+ simple_upper_case_mapping_lowarea_table0,
+ simple_upper_case_mapping_lowarea_table1,
+ simple_upper_case_mapping_lowarea_table2,
+ simple_upper_case_mapping_lowarea_table3,
+ simple_upper_case_mapping_lowarea_table4,
+ simple_upper_case_mapping_lowarea_table5,
+ simple_upper_case_mapping_lowarea_table6,
+ simple_upper_case_mapping_lowarea_table7};
+static const int simple_upper_case_mapping_lowarea_table_count = 8;
+
+static const guint32 simple_upper_case_mapping_higharea_table0 [] = {
+ /* ==== 10400-10480 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0x10400,0x10401,0x10402,0x10403,0x10404,0x10405,0x10406,0x10407,
+
0x10408,0x10409,0x1040A,0x1040B,0x1040C,0x1040D,0x1040E,0x1040F,0x10410,0x10411,0x10412,0x10413,0x10414,0x10415,0x10416,0x10417,
+
0x10418,0x10419,0x1041A,0x1041B,0x1041C,0x1041D,0x1041E,0x1041F,0x10420,0x10421,0x10422,0x10423,0x10424,0x10425,0x10426,0x10427,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint32 *simple_upper_case_mapping_higharea [] = {
+ simple_upper_case_mapping_higharea_table0};
+
+static const guint16 simple_lower_case_mapping_lowarea_table0 [] = {
+ /* ==== 40-600 ==== */
+ 0,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+ 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
+ 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x101,0,0x103,0,0x105,0,0x107,0,0x109,0,0x10B,0,0x10D,0,0x10F,0,
+ 0x111,0,0x113,0,0x115,0,0x117,0,0x119,0,0x11B,0,0x11D,0,0x11F,0,
+ 0x121,0,0x123,0,0x125,0,0x127,0,0x129,0,0x12B,0,0x12D,0,0x12F,0,
+ 0x69,0,0x133,0,0x135,0,0x137,0,0,0x13A,0,0x13C,0,0x13E,0,0x140,
+ 0,0x142,0,0x144,0,0x146,0,0x148,0,0,0x14B,0,0x14D,0,0x14F,0,
+ 0x151,0,0x153,0,0x155,0,0x157,0,0x159,0,0x15B,0,0x15D,0,0x15F,0,
+ 0x161,0,0x163,0,0x165,0,0x167,0,0x169,0,0x16B,0,0x16D,0,0x16F,0,
+ 0x171,0,0x173,0,0x175,0,0x177,0,0xFF,0x17A,0,0x17C,0,0x17E,0,0,
+ 0,0x253,0x183,0,0x185,0,0x254,0x188,0,0x256,0x257,0x18C,0,0,0x1DD,0x259,
+ 0x25B,0x192,0,0x260,0x263,0,0x269,0x268,0x199,0,0,0,0x26F,0x272,0,0x275,
+ 0x1A1,0,0x1A3,0,0x1A5,0,0x280,0x1A8,0,0x283,0,0,0x1AD,0,0x288,0x1B0,
+ 0,0x28A,0x28B,0x1B4,0,0x1B6,0,0x292,0x1B9,0,0,0,0x1BD,0,0,0,
+ 0,0,0,0,0x1C6,0x1C6,0,0x1C9,0x1C9,0,0x1CC,0x1CC,0,0x1CE,0,0x1D0,
+ 0,0x1D2,0,0x1D4,0,0x1D6,0,0x1D8,0,0x1DA,0,0x1DC,0,0,0x1DF,0,
+ 0x1E1,0,0x1E3,0,0x1E5,0,0x1E7,0,0x1E9,0,0x1EB,0,0x1ED,0,0x1EF,0,
+ 0,0x1F3,0x1F3,0,0x1F5,0,0x195,0x1BF,0x1F9,0,0x1FB,0,0x1FD,0,0x1FF,0,
+ 0x201,0,0x203,0,0x205,0,0x207,0,0x209,0,0x20B,0,0x20D,0,0x20F,0,
+ 0x211,0,0x213,0,0x215,0,0x217,0,0x219,0,0x21B,0,0x21D,0,0x21F,0,
+ 0x19E,0,0x223,0,0x225,0,0x227,0,0x229,0,0x22B,0,0x22D,0,0x22F,0,
+ 0x231,0,0x233,0,0,0,0,0,0,0,0x2C65,0x23C,0,0x19A,0x2C66,0,
+ 0,0x242,0,0x180,0x289,0x28C,0x247,0,0x249,0,0x24B,0,0x24D,0,0x24F,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0x3E9,0,0x3EB,0,0x3ED,0,0x3EF,0,
+ 0,0,0,0,0x3B8,0,0,0x3F8,0,0x3F2,0x3FB,0,0,0x37B,0x37C,0x37D,
+ 0x450,0x451,0x452,0x453,0x454,0x455,0x456,0x457,0x458,0x459,0x45A,0x45B,0x45C,0x45D,0x45E,0x45F,
+ 0x430,0x431,0x432,0x433,0x434,0x435,0x436,0x437,0x438,0x439,0x43A,0x43B,0x43C,0x43D,0x43E,0x43F,
+ 0x440,0x441,0x442,0x443,0x444,0x445,0x446,0x447,0x448,0x449,0x44A,0x44B,0x44C,0x44D,0x44E,0x44F,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x461,0,0x463,0,0x465,0,0x467,0,0x469,0,0x46B,0,0x46D,0,0x46F,0,
+ 0x471,0,0x473,0,0x475,0,0x477,0,0x479,0,0x47B,0,0x47D,0,0x47F,0,
+ 0x481,0,0,0,0,0,0,0,0,0,0x48B,0,0x48D,0,0x48F,0,
+ 0x491,0,0x493,0,0x495,0,0x497,0,0x499,0,0x49B,0,0x49D,0,0x49F,0,
+ 0x4A1,0,0x4A3,0,0x4A5,0,0x4A7,0,0x4A9,0,0x4AB,0,0x4AD,0,0x4AF,0,
+ 0x4B1,0,0x4B3,0,0x4B5,0,0x4B7,0,0x4B9,0,0x4BB,0,0x4BD,0,0x4BF,0,
+ 0x4CF,0x4C2,0,0x4C4,0,0x4C6,0,0x4C8,0,0x4CA,0,0x4CC,0,0x4CE,0,0,
+ 0x4D1,0,0x4D3,0,0x4D5,0,0x4D7,0,0x4D9,0,0x4DB,0,0x4DD,0,0x4DF,0,
+ 0x4E1,0,0x4E3,0,0x4E5,0,0x4E7,0,0x4E9,0,0x4EB,0,0x4ED,0,0x4EF,0,
+ 0x4F1,0,0x4F3,0,0x4F5,0,0x4F7,0,0x4F9,0,0x4FB,0,0x4FD,0,0x4FF,0,
+ 0x501,0,0x503,0,0x505,0,0x507,0,0x509,0,0x50B,0,0x50D,0,0x50F,0,
+ 0x511,0,0x513,0,0x515,0,0x517,0,0x519,0,0x51B,0,0x51D,0,0x51F,0,
+ 0x521,0,0x523,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0x561,0x562,0x563,0x564,0x565,0x566,0x567,0x568,0x569,0x56A,0x56B,0x56C,0x56D,0x56E,0x56F,
+ 0x570,0x571,0x572,0x573,0x574,0x575,0x576,0x577,0x578,0x579,0x57A,0x57B,0x57C,0x57D,0x57E,0x57F,
+ 0x580,0x581,0x582,0x583,0x584,0x585,0x586,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0};
+static const guint16 simple_lower_case_mapping_lowarea_table1 [] = {
+ /* ==== 1000-10D0 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0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x1FF3,0,0,0};
+static const guint16 simple_lower_case_mapping_lowarea_table3 [] = {
+ /* ==== 2100-21C0 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0x3C9,0,0,0,0x6B,0xE5,0,0,0,0,
+ 0,0,0x214E,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+
0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,0x2178,0x2179,0x217A,0x217B,0x217C,0x217D,0x217E,0x217F,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0x2184,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_lower_case_mapping_lowarea_table4 [] = {
+ /* ==== 2480-2500 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0x24D0,0x24D1,0x24D2,0x24D3,0x24D4,0x24D5,0x24D6,0x24D7,0x24D8,0x24D9,
+
0x24DA,0x24DB,0x24DC,0x24DD,0x24DE,0x24DF,0x24E0,0x24E1,0x24E2,0x24E3,0x24E4,0x24E5,0x24E6,0x24E7,0x24E8,0x24E9,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_lower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0xA72D,0,0xA72F,0,
+ 0,0,0xA733,0,0xA735,0,0xA737,0,0xA739,0,0xA73B,0,0xA73D,0,0xA73F,0,
+ 0xA741,0,0xA743,0,0xA745,0,0xA747,0,0xA749,0,0xA74B,0,0xA74D,0,0xA74F,0,
+ 0xA751,0,0xA753,0,0xA755,0,0xA757,0,0xA759,0,0xA75B,0,0xA75D,0,0xA75F,0,
+ 0xA761,0,0xA763,0,0xA765,0,0xA767,0,0xA769,0,0xA76B,0,0xA76D,0,0xA76F,0,
+ 0,0,0,0,0,0,0,0,0,0xA77A,0,0xA77C,0,0x1D79,0xA77F,0,
+ 0xA781,0,0xA783,0,0xA785,0,0xA787,0,0,0,0,0xA78C,0,0};
+static const guint16 simple_lower_case_mapping_lowarea_table7 [] = {
+ /* ==== FF20-FF80 ==== */
+
0,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47,0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F,
+ 0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57,0xFF58,0xFF59,0xFF5A,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 *simple_lower_case_mapping_lowarea [] = {
+ simple_lower_case_mapping_lowarea_table0,
+ simple_lower_case_mapping_lowarea_table1,
+ simple_lower_case_mapping_lowarea_table2,
+ simple_lower_case_mapping_lowarea_table3,
+ simple_lower_case_mapping_lowarea_table4,
+ simple_lower_case_mapping_lowarea_table5,
+ simple_lower_case_mapping_lowarea_table6,
+ simple_lower_case_mapping_lowarea_table7};
+static const int simple_lower_case_mapping_lowarea_table_count = 8;
+
+static const guint32 simple_lower_case_mapping_higharea_table0 [] = {
+ /* ==== 10400-10480 ==== */
+
0x10428,0x10429,0x1042A,0x1042B,0x1042C,0x1042D,0x1042E,0x1042F,0x10430,0x10431,0x10432,0x10433,0x10434,0x10435,0x10436,0x10437,
+
0x10438,0x10439,0x1043A,0x1043B,0x1043C,0x1043D,0x1043E,0x1043F,0x10440,0x10441,0x10442,0x10443,0x10444,0x10445,0x10446,0x10447,
+ 0x10448,0x10449,0x1044A,0x1044B,0x1044C,0x1044D,0x1044E,0x1044F,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint32 *simple_lower_case_mapping_higharea [] = {
+ simple_lower_case_mapping_higharea_table0};
+
+
+static const SimpleTitlecaseMapping simple_titlecase_mapping [] = {
+ {0x0001C4, 0x000000, 0x0001C5},
+ {0x0001C5, 0x0001C4, 0x0001C5},
+ {0x0001C6, 0x0001C4, 0x0001C5},
+ {0x0001C7, 0x000000, 0x0001C8},
+ {0x0001C8, 0x0001C7, 0x0001C8},
+ {0x0001C9, 0x0001C7, 0x0001C8},
+ {0x0001CA, 0x000000, 0x0001CB},
+ {0x0001CB, 0x0001CA, 0x0001CB},
+ {0x0001CC, 0x0001CA, 0x0001CB},
+ {0x0001F1, 0x000000, 0x0001F2},
+ {0x0001F2, 0x0001F1, 0x0001F2},
+ {0x0001F3, 0x0001F1, 0x0001F2}
+};
+static const guint8 simple_titlecase_mapping_count = 12;
+
+#endif
+
diff --git a/deps/eglib/src/vasprintf.c b/deps/eglib/src/vasprintf.c
new file mode 100644
index 0000000..297afbe
--- /dev/null
+++ b/deps/eglib/src/vasprintf.c
@@ -0,0 +1,34 @@
+#include <stdarg.h>
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int vasprintf(char **ret, const char *fmt, va_list ap)
+{
+ char *buf;
+ int len;
+ size_t buflen;
+ va_list ap2;
+
+#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
+ ap2 = ap;
+ len = _vscprintf(fmt, ap2); // NOTE MS specific extension ( :-( )
+#else
+ va_copy(ap2, ap);
+ len = vsnprintf(NULL, 0, fmt, ap2);
+#endif
+
+ if (len >= 0 && (buf = malloc ((buflen = (size_t) (len + 1)))) != NULL) {
+ len = vsnprintf(buf, buflen, fmt, ap);
+ *ret = buf;
+ } else {
+ *ret = NULL;
+ len = -1;
+ }
+
+ va_end(ap2);
+ return len;
+}
+
diff --git a/deps/eglib/test/.gitignore b/deps/eglib/test/.gitignore
new file mode 100644
index 0000000..2d669e1
--- /dev/null
+++ b/deps/eglib/test/.gitignore
@@ -0,0 +1,12 @@
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/*.lo
+/*.la
+/*.o
+/semantic.cache
+/.project
+/.cproject
+/test-eglib
+/test-glib
diff --git a/deps/eglib/test/Makefile.am b/deps/eglib/test/Makefile.am
new file mode 100644
index 0000000..14aa233
--- /dev/null
+++ b/deps/eglib/test/Makefile.am
@@ -0,0 +1,51 @@
+EXTRA_DIST = UTF-8.txt UTF-16BE.txt UTF-16LE.txt UTF-32BE.txt UTF-32LE.txt
+
+SOURCES = \
+ test.c \
+ test.h \
+ tests.h \
+ driver.c \
+ hashtable.c \
+ string-util.c \
+ string.c \
+ slist.c \
+ sizes.c \
+ ptrarray.c \
+ list.c \
+ array.c \
+ fake.c \
+ path.c \
+ queue.c \
+ shell.c \
+ spawn.c \
+ timer.c \
+ file.c \
+ pattern.c \
+ dir.c \
+ markup.c \
+ unicode.c \
+ utf8.c \
+ endian.c \
+ module.c \
+ memory.c
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -I$(srcdir) \
+ -Wall \
+ $(NULL)
+
+test_eglib_SOURCES = $(SOURCES)
+
+test_eglib_CFLAGS = -DEGLIB_TESTS=1 -I$(srcdir)/../src -I../src -DDRIVER_NAME=\"EGlib\"
+test_eglib_LDADD = ../src/libeglib.la $(LIBICONV)
+
+run-eglib: all
+ srcdir=`readlink -f $(srcdir)` ./test-eglib
+
+noinst_PROGRAMS = test-eglib
+
+run-both: run-eglib
+
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/deps/eglib/test/README b/deps/eglib/test/README
new file mode 100644
index 0000000..7c28d03
--- /dev/null
+++ b/deps/eglib/test/README
@@ -0,0 +1,113 @@
+EGlib Unit Testing
+===============================================================================
+
+ 1. Writing new tests
+ 2. Using the test driver
+
+===============================================================================
+1. Writing new tests
+===============================================================================
+
+Tests are easy to write, but must be grouped in to logical cases. For instance,
+the GPtrArray group has a number of tests that cover the entire GPtrArray
+implementation.
+
+These logical case groups should be in a single C file, and must have
+three elements:
+
+ #include <glib.h>
+ #include "test.h"
+
+ ...
+ <define test implementations>
+ ...
+
+ static Test groupname_tests [] = {
+ {"groupname_test1", groupname_test1},
+ {"groupname_test1", groupname_test2},
+ {NULL, NULL}
+ };
+
+ DEFINE_TEST_GROUP_INIT(groupname_tests_init, groupname_tests)
+
+A test implementation should look like:
+
+ RESULT groupname_test1()
+ {
+ <perform the test>
+
+ if(test_failed) {
+ return FAILED("reason: %s", "this works like printf");
+ }
+
+ return OK; /* just NULL, but OK is cute */
+ }
+
+Once a test group is written, it needs to be added to the groups table
+in tests.h:
+
+ DEFINE_TEST_GROUP_INIT_H(groupname_tests_init) // same as in impl
+
+ static Group test_groups [] = {
+ ...
+ {"groupname", groupname_tests_init}
+ ...
+ };
+
+===============================================================================
+2. Using the test driver
+===============================================================================
+
+When tests are written, they are rebuilt with make. Two programs will be
+built:
+
+ test-eglib: the test driver and tests linked against eglib
+ test-glib: the test driver and tests linked against system glib-2.0
+
+Each driver program works exactly the same. Running test-eglib will run
+the tests against eglib, and test-glib against glib-2.0.
+
+The test driver supports a few options to allow for performance measuring:
+
+ --help show all options and available test groups
+ --time time the overall run and report it, even if --quiet is set
+ --quiet do not print test results, useful for timing
+ --iterations N run all or specified test groups N times
+
+Run "test-eglib --help" for more details.
+
+Example: run the ptrarray test group 100000 times and only print the time
+ it took to perform all iterations
+
+ ./test-eglib -tqi 100000 ptrarray
+
+Example: show single iteration of test output for two groups
+
+ ./test-eglib ptrarray hashtable
+
+Example: show test output of all available groups
+
+ ./test-eglib
+
+The 'test-both' script can be used to run both test-eglib and test-glib
+with the same options back to back:
+
+ $ ./test-both -tqi 100000 ptrarray
+ EGlib Total Time: 1.1961s
+ GLib Total Time: 0.955957s
+
+test-both also has a nice --speed-compare mode that shows comparison
+information about EGlib vs GLib. It can run all tests or specific tests
+with a configurable number of iterations. --speed-compare mode always runs
+the drivers with -qtni
+
+The syntax for --speed-compare is:
+
+ ./test-both --speed-compare [ITERATIONS] [GROUPS...]
+
+ $ ./test-both --speed-compare Runs all tests with default iterations
+ $ ./test-both --speed-compare 500 Runs all tests with 500 iterations
+ $ ./test-both --speed-compare ptrarray Runs ptrarray test with default
+ iterations
+
+
diff --git a/deps/eglib/test/UTF-16BE.txt b/deps/eglib/test/UTF-16BE.txt
new file mode 100644
index 0000000..b7e494c
Binary files /dev/null and b/deps/eglib/test/UTF-16BE.txt differ
diff --git a/deps/eglib/test/UTF-16LE.txt b/deps/eglib/test/UTF-16LE.txt
new file mode 100644
index 0000000..30fe7b0
Binary files /dev/null and b/deps/eglib/test/UTF-16LE.txt differ
diff --git a/deps/eglib/test/UTF-32BE.txt b/deps/eglib/test/UTF-32BE.txt
new file mode 100644
index 0000000..a1fd543
Binary files /dev/null and b/deps/eglib/test/UTF-32BE.txt differ
diff --git a/deps/eglib/test/UTF-32LE.txt b/deps/eglib/test/UTF-32LE.txt
new file mode 100644
index 0000000..043afc9
Binary files /dev/null and b/deps/eglib/test/UTF-32LE.txt differ
diff --git a/deps/eglib/test/UTF-8.txt b/deps/eglib/test/UTF-8.txt
new file mode 100644
index 0000000..4363f27
--- /dev/null
+++ b/deps/eglib/test/UTF-8.txt
@@ -0,0 +1,212 @@
+
+UTF-8 encoded sample plain-text file
+‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
+
+Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25
+
+
+The ASCII compatible UTF-8 encoding used in this plain-text file
+is defined in Unicode, ISO 10646-1, and RFC 2279.
+
+
+Using Unicode/UTF-8, you can write in emails and source code things such as
+
+Mathematics and sciences:
+
+ ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫
+ ⎪⎢⎜│a²+b³ ⎟⎥⎪
+ ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), ⎪⎢⎜│───── ⎟⎥⎪
+ ⎪⎢⎜⎷ c₈ ⎟⎥⎪
+ ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⎨⎢⎜ ⎟⎥⎬
+ ⎪⎢⎜ ∞ ⎟⎥⎪
+ ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (⟦A⟧ ⇔ ⟪B⟫), ⎪⎢⎜ ⎲ ⎟⎥⎪
+ ⎪⎢⎜ ⎳aⁱ-bⁱ⎟⎥⎪
+ 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm ⎩⎣⎝i=1 ⎠⎦⎭
+
+Linguistics and dictionaries:
+
+ ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn
+ Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ]
+
+APL:
+
+ ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈
+
+Nicer typography in plain text files:
+
+ ╔══════════════════════════════════════════╗
+ ║ ║
+ ║ • ‘single’ and “double” quotes ║
+ ║ ║
+ ║ • Curly apostrophes: “We’ve been here” ║
+ ║ ║
+ ║ • Latin-1 apostrophe and accents: '´` ║
+ ║ ║
+ ║ • ‚deutsche‘ „Anführungszeichen“ ║
+ ║ ║
+ ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║
+ ║ ║
+ ║ • ASCII safety test: 1lI|, 0OD, 8B ║
+ ║ ╭─────────╮ ║
+ ║ • the euro symbol: │ 14.95 € │ ║
+ ║ ╰─────────╯ ║
+ ╚══════════════════════════════════════════╝
+
+Combining characters:
+
+ STARGΛ̊TE SG-1, a = v̇ = r̈, a⃑ ⊥ b⃑
+
+Greek (in Polytonic):
+
+ The Greek anthem:
+
+ Σὲ γνωρίζω ἀπὸ τὴν κόψη
+ τοῦ σπαθιοῦ τὴν τρομερή,
+ σὲ γνωρίζω ἀπὸ τὴν ὄψη
+ ποὺ μὲ βία μετράει τὴ γῆ.
+
+ ᾿Απ᾿ τὰ κόκκαλα βγαλμένη
+ τῶν ῾Ελλήνων τὰ ἱερά
+ καὶ σὰν πρῶτα ἀνδρειωμένη
+ χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά!
+
+ From a speech of Demosthenes in the 4th century BC:
+
+ Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι,
+ ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς
+ λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ
+ τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿
+ εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ
+ πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν
+ οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι,
+ οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν
+ ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον
+ τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι
+ γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν
+ προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους
+ σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ
+ τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ
+ τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς
+ τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον.
+
+ Δημοσθένους, Γ´ ᾿Ολυνθιακὸς
+
+Georgian:
+
+ From a Unicode conference invitation:
+
+ გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო
+ კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს,
+ ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს
+ ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი,
+ ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება
+ ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში,
+ ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში.
+
+Russian:
+
+ From a Unicode conference invitation:
+
+ Зарегистрируйтесь сейчас на Десятую Международную Конференцию по
+ Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии.
+ Конференция соберет широкий круг экспертов по вопросам глобального
+ Интернета и Unicode, локализации и интернационализации, воплощению и
+ применению Unicode в различных операционных системах и программных
+ приложениях, шрифтах, верстке и многоязычных компьютерных системах.
+
+Thai (UCS Level 2):
+
+ Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese
+ classic 'San Gua'):
+
+ [----------------------------|------------------------]
+ ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่
+ สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา
+ ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา
+ โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ
+ เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ
+ ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ
+ พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้
+ ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ
+
+ (The above is a two-column text. If combining characters are handled
+ correctly, the lines of the second column should be aligned with the
+ | character above.)
+
+Ethiopian:
+
+ Proverbs in the Amharic language:
+
+ ሰማይ አይታረስ ንጉሥ አይከሰስ።
+ ብላ ካለኝ እንደአባቴ በቆመጠኝ።
+ ጌጥ ያለቤቱ ቁምጥና ነው።
+ ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው።
+ የአፍ ወለምታ በቅቤ አይታሽም።
+ አይጥ በበላ ዳዋ ተመታ።
+ ሲተረጉሙ ይደረግሙ።
+ ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል።
+ ድር ቢያብር አንበሳ ያስር።
+ ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም።
+ እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም።
+ የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ።
+ ሥራ ከመፍታት ልጄን ላፋታት።
+ ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል።
+ የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ።
+ ተንጋሎ ቢተፉ ተመልሶ ባፉ።
+ ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው።
+ እግርህን በፍራሽህ ልክ ዘርጋ።
+
+Runes:
+
+ ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ
+
+ (Old English, which transcribed into Latin reads 'He cwaeth that he
+ bude thaem lande northweardum with tha Westsae.' and means 'He said
+ that he lived in the northern land near the Western Sea.')
+
+Braille:
+
+ ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌
+
+ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞
+ ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎
+ ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂
+ ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙
+ ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑
+ ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲
+
+ ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
+
+ ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹
+ ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞
+ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕
+ ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹
+ ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎
+ ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎
+ ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳
+ ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞
+ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
+
+ (The first couple of paragraphs of "A Christmas Carol" by Dickens)
+
+Compact font selection example text:
+
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789
+ abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ
+ –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд
+ ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა
+
+Greetings in various languages:
+
+ Hello world, Καλημέρα κόσμε, コンニチハ
+
+Box drawing alignment tests: █
+ ▉
+ ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
+ ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
+ ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
+ ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
+ ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
+ ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
+ ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
+ ▝▀▘▙▄▟
diff --git a/deps/eglib/test/array.c b/deps/eglib/test/array.c
new file mode 100644
index 0000000..37d5486
--- /dev/null
+++ b/deps/eglib/test/array.c
@@ -0,0 +1,163 @@
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+/* example from glib documentation */
+RESULT
+test_array_big ()
+{
+ GArray *garray;
+ gint i;
+
+ /* We create a new array to store gint values.
+ We don't want it zero-terminated or cleared to 0's. */
+ garray = g_array_new (FALSE, FALSE, sizeof (gint));
+ for (i = 0; i < 10000; i++)
+ g_array_append_val (garray, i);
+
+ for (i = 0; i < 10000; i++)
+ if (g_array_index (garray, gint, i) != i)
+ return FAILED ("array value didn't match");
+
+ g_array_free (garray, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_array_index ()
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+ int v;
+
+ v = 27;
+ g_array_append_val (array, v);
+
+ if (27 != g_array_index (array, int, 0))
+ return FAILED ("");
+
+ g_array_free (array, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_array_append_zero_terminated ()
+{
+ GArray *array = g_array_new (TRUE, FALSE, sizeof (int));
+ int v;
+
+ v = 27;
+ g_array_append_val (array, v);
+
+ if (27 != g_array_index (array, int, 0))
+ return FAILED ("g_array_append_val failed");
+
+ if (0 != g_array_index (array, int, 1))
+ return FAILED ("zero_terminated didn't append a zero element");
+
+ g_array_free (array, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_array_append ()
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+ int v;
+
+ if (0 != array->len)
+ return FAILED ("initial array length not zero");
+
+ v = 27;
+
+ g_array_append_val (array, v);
+
+ if (1 != array->len)
+ return FAILED ("array append failed");
+
+ g_array_free (array, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_array_insert_val ()
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (gpointer));
+ gpointer ptr0, ptr1, ptr2, ptr3;
+
+ g_array_insert_val (array, 0, array);
+
+ if (array != g_array_index (array, gpointer, 0))
+ return FAILED ("1 The value in the array is incorrect");
+
+ g_array_insert_val (array, 1, array);
+ if (array != g_array_index (array, gpointer, 1))
+ return FAILED ("2 The value in the array is incorrect");
+
+ g_array_insert_val (array, 2, array);
+ if (array != g_array_index (array, gpointer, 2))
+ return FAILED ("3 The value in the array is incorrect");
+
+ g_array_free (array, TRUE);
+ array = g_array_new (FALSE, FALSE, sizeof (gpointer));
+ ptr0 = array;
+ ptr1 = array + 1;
+ ptr2 = array + 2;
+ ptr3 = array + 3;
+
+ g_array_insert_val (array, 0, ptr0);
+ g_array_insert_val (array, 1, ptr1);
+ g_array_insert_val (array, 2, ptr2);
+ g_array_insert_val (array, 1, ptr3);
+ if (ptr0 != g_array_index (array, gpointer, 0))
+ return FAILED ("4 The value in the array is incorrect");
+ if (ptr3 != g_array_index (array, gpointer, 1))
+ return FAILED ("5 The value in the array is incorrect");
+ if (ptr1 != g_array_index (array, gpointer, 2))
+ return FAILED ("6 The value in the array is incorrect");
+ if (ptr2 != g_array_index (array, gpointer, 3))
+ return FAILED ("7 The value in the array is incorrect");
+
+ g_array_free (array, TRUE);
+ return NULL;
+}
+
+RESULT
+test_array_remove ()
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+ int v[] = {30, 29, 28, 27, 26, 25};
+
+ g_array_append_vals (array, v, 6);
+
+ if (6 != array->len)
+ return FAILED ("append_vals fail");
+
+ g_array_remove_index (array, 3);
+
+ if (5 != array->len)
+ return FAILED ("remove_index failed to update length");
+
+ if (26 != g_array_index (array, int, 3))
+ return FAILED ("remove_index failed to update the array");
+
+ g_array_free (array, TRUE);
+
+ return NULL;
+}
+
+static Test array_tests [] = {
+ {"big", test_array_big},
+ {"append", test_array_append},
+ {"insert_val", test_array_insert_val},
+ {"index", test_array_index},
+ {"remove", test_array_remove},
+ {"append_zero_term", test_array_append_zero_terminated},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(array_tests_init, array_tests)
diff --git a/deps/eglib/test/dir.c b/deps/eglib/test/dir.c
new file mode 100644
index 0000000..f871121
--- /dev/null
+++ b/deps/eglib/test/dir.c
@@ -0,0 +1,66 @@
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef G_OS_UNIX
+#include <pthread.h>
+#endif
+#include "test.h"
+
+/* This test is just to be used with valgrind */
+RESULT
+test_dir ()
+{
+ GDir *dir;
+ GError *error;
+ const gchar *name;
+
+ /*
+ dir = g_dir_open (NULL, 0, NULL);
+ */
+ dir = g_dir_open ("", 0, NULL);
+ if (dir != NULL)
+ return FAILED ("1 Should be an error");
+
+ dir = g_dir_open ("", 9, NULL);
+ if (dir != NULL)
+ return FAILED ("2 Should be an error");
+
+ error = NULL;
+ dir = g_dir_open (".ljasdslakjd", 9, &error);
+ if (dir != NULL)
+ return FAILED ("3 opendir should fail");
+ if (error == NULL)
+ return FAILED ("4 got no error");
+ g_error_free (error);
+ error = NULL;
+ dir = g_dir_open (g_get_tmp_dir (), 9, &error);
+ if (dir == NULL)
+ return FAILED ("5 opendir should succeed");
+ if (error != NULL)
+ return FAILED ("6 got an error");
+ name = NULL;
+ name = g_dir_read_name (dir);
+ if (name == NULL)
+ return FAILED ("7 didn't read a file name");
+ while ((name = g_dir_read_name (dir)) != NULL) {
+ if (strcmp (name, ".") == 0)
+ return FAILED (". directory found");
+ if (strcmp (name, "..") == 0)
+ return FAILED (".. directory found");
+ }
+ g_dir_close (dir);
+ return OK;
+}
+
+static Test dir_tests [] = {
+ {"g_dir_*", test_dir},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(dir_tests_init, dir_tests)
+
+
diff --git a/deps/eglib/test/driver.c b/deps/eglib/test/driver.c
new file mode 100644
index 0000000..23e7638
--- /dev/null
+++ b/deps/eglib/test/driver.c
@@ -0,0 +1,248 @@
+/*
+ * EGLib Unit Test Driver
+ *
+ * Author:
+ * Aaron Bockover (abockover novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <config.h>
+#include "test.h"
+#include "tests.h"
+
+#include <stdio.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+
+#ifndef DRIVER_NAME
+#define DRIVER_NAME "EGlib"
+#endif
+
+typedef struct _StringArray {
+ gchar **strings;
+ gint length;
+} StringArray;
+
+static StringArray *
+string_array_append(StringArray *array, gchar *string)
+{
+ if(array == NULL) {
+ array = g_new0(StringArray, 1);
+ array->length = 1;
+ array->strings = g_malloc(sizeof(gchar *) * 2);
+ } else {
+ array->length++;
+ array->strings = g_realloc(array->strings, sizeof(gchar *)
+ * (array->length + 1));
+ }
+
+ array->strings[array->length - 1] = string;
+ array->strings[array->length] = NULL;
+
+ return array;
+}
+
+gint global_passed = 0, global_tests = 0;
+
+static void
+string_array_free(StringArray *array)
+{
+ g_free(array->strings);
+ g_free(array);
+}
+
+static void print_help(char *s)
+{
+ gint i;
+
+ printf("Usage: %s [OPTION]... [TESTGROUP]...\n\n", s);
+ printf("OPTIONS are:\n");
+ printf(" -h, --help show this help\n");
+ printf(" -t, --time time the tests\n");
+ printf(" -i, --iterations number of times to run tests\n");
+ printf(" -q, --quiet do not print test results; "
+ "final time always prints\n");
+ printf(" -n, --no-labels print final time without labels, "
+ "nice for scripts\n");
+ printf(" -d, --debug do not run tests, "
+ "debug the driver itself for valgrind\n\n");
+ printf("TESTGROUPS available:\n");
+
+ for(i = 0; test_groups[i].name != NULL; i++) {
+ if(test_groups[i].handler != fake_tests_init) {
+ printf(" %s\n", test_groups[i].name);
+ }
+ }
+
+ printf("\n");
+}
+
+gint main(gint argc, gchar **argv)
+{
+ gint i, j, c, iterations = 1;
+ StringArray *tests_to_run = NULL;
+ gdouble time_start;
+ gboolean report_time = FALSE;
+ gboolean quiet = FALSE;
+ gboolean global_failure = FALSE;
+ gboolean no_final_time_labels = FALSE;
+ gboolean debug = FALSE;
+
+#if HAVE_GETOPT_H
+ static struct option long_options [] = {
+ {"help", no_argument, 0, 'h'},
+ {"time", no_argument, 0, 't'},
+ {"quiet", no_argument, 0, 'q'},
+ {"iterations", required_argument, 0, 'i'},
+ {"debug", no_argument, 0, 'd'},
+ {"no-labels", no_argument, 0, 'n'},
+ {0, 0, 0, 0}
+ };
+
+ while((c = getopt_long(argc, argv, "dhtqni:", long_options, NULL)) != -1) {
switch(c) {
+ case 'h':
+ print_help(argv[0]);
+ return 1;
+ case 't':
+ report_time = TRUE;
+ break;
+ case 'i':
+ iterations = atoi(optarg);
+ break;
+ case 'q':
+ quiet = TRUE;
+ break;
+ case 'n':
+ no_final_time_labels = TRUE;
+ break;
+ case 'd':
+ debug = TRUE;
+ break;
+ }
+ }
+
+ for(i = optind; i < argc; i++) {
+ if(argv[i][0] == '-') {
+ continue;
+ }
+
+ tests_to_run = string_array_append(tests_to_run, argv[i]);
+ }
+#endif
+
+ time_start = get_timestamp();
+
+ for(j = 0; test_groups[j].name != NULL; j++) {
+ gboolean run = TRUE;
+ gchar *tests = NULL;
+ gchar *group = NULL;
+
+ if(tests_to_run != NULL) {
+ gint k;
+ run = FALSE;
+
+ for(k = 0; k < tests_to_run->length; k++) {
+ gchar *user = tests_to_run->strings[k];
+ const gchar *table = test_groups[j].name;
+ size_t user_len = strlen(user);
+ size_t table_len = strlen(table);
+
+ if(strncmp(user, table, table_len) == 0) {
+ if(user_len > table_len && user[table_len] != ':') {
+ break;
+ }
+
+ run = TRUE;
+ group = tests_to_run->strings[k];
+ break;
+ }
+ }
+ }
+
+ if(run) {
+ gboolean passed;
+ gchar **split = NULL;
+
+ if(debug && test_groups[j].handler != fake_tests_init) {
+ printf("Skipping %s, in driver debug mode\n",
+ test_groups[j].name);
+ continue;
+ } else if(!debug && test_groups[j].handler == fake_tests_init) {
+ continue;
+ }
+
+ if(group != NULL) {
+ split = eg_strsplit(group, ":", -1);
+ if(split != NULL) {
+ gint m;
+ for(m = 0; split[m] != NULL; m++) {
+ if(m == 1) {
+ tests = strdup(split[m]);
+ break;
+ }
+ }
+ eg_strfreev(split);
+ }
+ }
+
+ passed = run_group(&(test_groups[j]),
+ iterations, quiet, report_time, tests);
+
+ if(tests != NULL) {
+ g_free(tests);
+ }
+
+ if(!passed && !global_failure) {
+ global_failure = TRUE;
+ }
+ }
+ }
+
+ if(!quiet) {
+ gdouble pass_percentage = ((gdouble)global_passed / (gdouble)global_tests) * 100.0;
+ printf("=============================\n");
+ printf("Overall result: %s : %d / %d (%g%%)\n", global_failure ? "FAILED" : "OK",
global_passed, global_tests, pass_percentage);
+ }
+
+ if(report_time) {
+ gdouble duration = get_timestamp() - time_start;
+ if(no_final_time_labels) {
+ printf("%g\n", duration);
+ } else {
+ printf("%s Total Time: %g\n", DRIVER_NAME, duration);
+ }
+ }
+
+ if(tests_to_run != NULL) {
+ string_array_free(tests_to_run);
+ }
+
+ return global_tests - global_passed;
+}
+
+
diff --git a/deps/eglib/test/endian.c b/deps/eglib/test/endian.c
new file mode 100644
index 0000000..3347d76
--- /dev/null
+++ b/deps/eglib/test/endian.c
@@ -0,0 +1,38 @@
+#include "test.h"
+
+RESULT
+test_swap ()
+{
+ guint32 a = 0xabcdef01, res32;
+ guint64 b = (((guint64)a) << 32) | a, res64;
+ guint64 b_expect = (((guint64)0x1efcdab) << 32) | 0x01efcdab;
+ guint16 c = 0xabcd, res16;
+
+ res32 = GUINT32_SWAP_LE_BE (a);
+ if (res32 != 0x01efcdab)
+ return FAILED ("GUINT32_SWAP_LE_BE returned 0x%x", res32);
+ res32 = GUINT32_SWAP_LE_BE (1);
+ if (res32 != 0x1000000)
+ return FAILED ("GUINT32_SWAP_LE_BE returned 0x%x", res32);
+
+ res64 = GUINT64_SWAP_LE_BE(b);
+ if (res64 != b_expect)
+ return FAILED ("GUINT64_SWAP_LE_BE returned 0x%llx (had=0x%llx)", res64, b);
+ res16 = GUINT16_SWAP_LE_BE(c);
+ if (res16 != 0xcdab)
+ return FAILED ("GUINT16_SWAP_LE_BE returned 0x%x", (guint32) res16);
+
+ return OK;
+}
+
+/*
+ * test initialization
+ */
+
+static Test endian_tests [] = {
+ {"swap", test_swap},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(endian_tests_init, endian_tests)
+
diff --git a/deps/eglib/test/fake.c b/deps/eglib/test/fake.c
new file mode 100644
index 0000000..c8d9af6
--- /dev/null
+++ b/deps/eglib/test/fake.c
@@ -0,0 +1,19 @@
+/*
+ * Fake test allows debugging of the driver itself
+ */
+
+#include "test.h"
+
+RESULT
+test_fake()
+{
+ return OK;
+}
+
+static Test fake_tests [] = {
+ {"fake", test_fake},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(fake_tests_init, fake_tests)
+
diff --git a/deps/eglib/test/file.c b/deps/eglib/test/file.c
new file mode 100644
index 0000000..411c945
--- /dev/null
+++ b/deps/eglib/test/file.c
@@ -0,0 +1,228 @@
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include "test.h"
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#define close _close
+#endif
+
+RESULT
+test_file_get_contents ()
+{
+ GError *error;
+ gchar *content;
+ gboolean ret;
+ gsize length;
+#ifdef G_OS_WIN32
+ const gchar *filename = "c:\\Windows\\system.ini";
+#else
+ const gchar *filename = "/etc/hosts";
+#endif
+
+ /*
+ filename != NULL
+ ret = g_file_get_contents (NULL, NULL, NULL, NULL);
+ contents != NULL
+ ret = g_file_get_contents ("", NULL, NULL, NULL);
+ error no such file and fails for 'error' not being null too
+ ret = g_file_get_contents ("", &content, NULL, &error);
+ */
+
+ error = NULL;
+ ret = g_file_get_contents ("", &content, NULL, &error);
+ if (ret)
+ return FAILED ("HAH!");
+ if (error == NULL)
+ return FAILED ("Got nothing as error.");
+ if (content != NULL)
+ return FAILED ("Content is uninitialized");
+
+ g_error_free (error);
+ error = NULL;
+ ret = g_file_get_contents (filename, &content, &length, &error);
+ if (!ret)
+ return FAILED ("The error is %d %s\n", error->code, error->message);
+ if (error != NULL)
+ return FAILED ("Got an error returning TRUE");
+ if (content == NULL)
+ return FAILED ("Content is NULL");
+ if (strlen (content) != length)
+ return FAILED ("length is %d but the string is %d", length, strlen (content));
+ g_free (content);
+
+ return OK;
+}
+
+RESULT
+test_open_tmp ()
+{
+ GError *error;
+ gint fd;
+ gchar *name = GINT_TO_POINTER (-1);
+
+ /*
+ * Okay, this works, but creates a .xxx file in /tmp on every run. Disabled.
+ * fd = g_file_open_tmp (NULL, NULL, NULL);
+ * if (fd < 0)
+ * return FAILED ("Default failed.");
+ * close (fd);
+ */
+ error = NULL;
+ fd = g_file_open_tmp ("invalidtemplate", NULL, &error);
+ if (fd != -1)
+ return FAILED ("The template was invalid and accepted");
+ if (error == NULL)
+ return FAILED ("No error returned.");
+ g_error_free (error);
+
+ error = NULL;
+ fd = g_file_open_tmp ("i/nvalidtemplate", &name, &error);
+ if (fd != -1)
+ return FAILED ("The template was invalid and accepted");
+ if (error == NULL)
+ return FAILED ("No error returned.");
+ if (name == NULL)
+ return FAILED ("'name' is not reset");
+ g_error_free (error);
+
+ error = NULL;
+ fd = g_file_open_tmp ("valid-XXXXXX", &name, &error);
+ if (fd == -1)
+ return FAILED ("This should be valid");
+ if (error != NULL)
+ return FAILED ("No error returned.");
+ if (name == NULL)
+ return FAILED ("No name returned.");
+ close (fd);
+ unlink (name);
+ g_free (name);
+ return OK;
+}
+
+RESULT
+test_file ()
+{
+ gboolean res;
+ const gchar *tmp;
+ gchar *path;
+
+#ifndef G_OS_WIN32 /* FIXME */
+ gchar *sympath;
+ gint ignored;
+#endif
+
+ res = g_file_test (NULL, 0);
+ if (res)
+ return FAILED ("Should return FALSE HERE");
+
+ res = g_file_test ("file.c", 0);
+ if (res)
+ return FAILED ("Should return FALSE HERE");
+
+ tmp = g_get_tmp_dir ();
+ res = g_file_test (tmp, G_FILE_TEST_EXISTS);
+ if (!res)
+ return FAILED ("tmp does not exist.");
+ res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR);
+ if (res)
+ return FAILED ("tmp is regular");
+
+ res = g_file_test (tmp, G_FILE_TEST_IS_DIR);
+ if (!res)
+ return FAILED ("tmp is not a directory");
+ res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE);
+ if (!res)
+ return FAILED ("tmp is not a executable");
+
+ res = g_file_test (tmp, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("2 tmp does not exist.");
+ res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK);
+ if (res)
+ return FAILED ("2 tmp is regular");
+
+ res = g_file_test (tmp, G_FILE_TEST_IS_DIR | G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("2 tmp is not a directory");
+ res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("2 tmp is not a executable");
+
+ close (g_file_open_tmp (NULL, &path, NULL)); /* create an empty file */
+ res = g_file_test (path, G_FILE_TEST_EXISTS);
+ if (!res)
+ return FAILED ("3 %s should exist", path);
+ res = g_file_test (path, G_FILE_TEST_IS_REGULAR);
+ /* This is strange. Empty file is reported as not existing! */
+ if (!res)
+ return FAILED ("3 %s IS_REGULAR", path);
+ res = g_file_test (path, G_FILE_TEST_IS_DIR);
+ if (res)
+ return FAILED ("3 %s should not be a directory", path);
+ res = g_file_test (path, G_FILE_TEST_IS_EXECUTABLE);
+ if (res)
+ return FAILED ("3 %s should not be executable", path);
+ res = g_file_test (path, G_FILE_TEST_IS_SYMLINK);
+ if (res)
+ return FAILED ("3 %s should not be a symlink", path);
+
+#ifndef G_OS_WIN32 /* FIXME */
+ sympath = g_strconcat (path, "-link", NULL);
+ ignored = symlink (path, sympath);
+ res = g_file_test (sympath, G_FILE_TEST_EXISTS);
+ if (!res)
+ return FAILED ("4 %s should not exist", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
+ if (!res)
+ return FAILED ("4 %s should not be a regular file", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
+ if (res)
+ return FAILED ("4 %s should not be a directory", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
+ if (res)
+ return FAILED ("4 %s should not be executable", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("4 %s should be a symlink", sympath);
+
+ unlink (path);
+
+ res = g_file_test (sympath, G_FILE_TEST_EXISTS);
+ if (res)
+ return FAILED ("5 %s should exist", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
+ if (res)
+ return FAILED ("5 %s should be a regular file", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
+ if (res)
+ return FAILED ("5 %s should not be a directory", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
+ if (res)
+ return FAILED ("5 %s should not be executable", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("5 %s should be a symlink", sympath);
+ unlink (sympath);
+ g_free (sympath);
+#endif
+ g_free (path);
+ return OK;
+}
+
+static Test file_tests [] = {
+ {"g_file_get_contents", test_file_get_contents},
+ {"g_file_open_tmp", test_open_tmp},
+ {"g_file_test", test_file},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(file_tests_init, file_tests)
+
+
diff --git a/deps/eglib/test/hashtable.c b/deps/eglib/test/hashtable.c
new file mode 100644
index 0000000..8eb9885
--- /dev/null
+++ b/deps/eglib/test/hashtable.c
@@ -0,0 +1,177 @@
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+int foreach_count = 0;
+int foreach_fail = 0;
+
+void foreach (gpointer key, gpointer value, gpointer user_data)
+{
+ foreach_count++;
+ if (GPOINTER_TO_INT (user_data) != 'a')
+ foreach_fail = 1;
+}
+
+RESULT hash_t1 (void)
+{
+ GHashTable *t = g_hash_table_new (g_str_hash, g_str_equal);
+
+ foreach_count = 0;
+ foreach_fail = 0;
+ g_hash_table_insert (t, "hello", "world");
+ g_hash_table_insert (t, "my", "god");
+
+ g_hash_table_foreach (t, foreach, GINT_TO_POINTER('a'));
+ if (foreach_count != 2)
+ return FAILED ("did not find all keys, got %d expected 2", foreach_count);
+ if (foreach_fail)
+ return FAILED("failed to pass the user-data to foreach");
+
+ if (!g_hash_table_remove (t, "my"))
+ return FAILED ("did not find known key");
+ if (g_hash_table_size (t) != 1)
+ return FAILED ("unexpected size");
+ g_hash_table_insert(t, "hello", "moon");
+ if (strcmp (g_hash_table_lookup (t, "hello"), "moon") != 0)
+ return FAILED ("did not replace world with moon");
+
+ if (!g_hash_table_remove (t, "hello"))
+ return FAILED ("did not find known key");
+ if (g_hash_table_size (t) != 0)
+ return FAILED ("unexpected size");
+ g_hash_table_destroy (t);
+
+ return OK;
+}
+
+RESULT hash_t2 (void)
+{
+ return OK;
+}
+
+RESULT hash_default (void)
+{
+ GHashTable *hash = g_hash_table_new (NULL, NULL);
+
+ if (hash == NULL)
+ return FAILED ("g_hash_table_new should return a valid hash");
+
+ g_hash_table_destroy (hash);
+ return NULL;
+}
+
+RESULT
+hash_null_lookup (void)
+{
+ GHashTable *hash = g_hash_table_new (NULL, NULL);
+ gpointer ok, ov;
+
+ g_hash_table_insert (hash, NULL, GINT_TO_POINTER (1));
+ g_hash_table_insert (hash, GINT_TO_POINTER(1), GINT_TO_POINTER(2));
+
+ if (!g_hash_table_lookup_extended (hash, NULL, &ok, &ov))
+ return FAILED ("Did not find the NULL");
+ if (ok != NULL)
+ return FAILED ("Incorrect key found");
+ if (ov != GINT_TO_POINTER (1))
+ return FAILED ("Got wrong value %p\n", ov);
+
+ if (!g_hash_table_lookup_extended (hash, GINT_TO_POINTER(1), &ok, &ov))
+ return FAILED ("Did not find the 1");
+ if (ok != GINT_TO_POINTER(1))
+ return FAILED ("Incorrect key found");
+ if (ov != GINT_TO_POINTER (2))
+ return FAILED ("Got wrong value %p\n", ov);
+
+ g_hash_table_destroy (hash);
+
+ return NULL;
+}
+
+static void
+counter (gpointer key, gpointer value, gpointer user_data)
+{
+ int *counter = (int *) user_data;
+
+ (*counter)++;
+}
+
+RESULT hash_grow (void)
+{
+ GHashTable *hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ int i, count = 0;
+
+ for (i = 0; i < 1000; i++)
+ g_hash_table_insert (hash, g_strdup_printf ("%d", i), g_strdup_printf ("x-%d", i));
+
+ for (i = 0; i < 1000; i++){
+ char buffer [30];
+ gpointer value;
+
+ sprintf (buffer, "%d", i);
+
+ value = g_hash_table_lookup (hash, buffer);
+ sprintf (buffer, "x-%d", i);
+ if (strcmp (value, buffer) != 0){
+ return FAILED ("Failed to lookup the key %d, the value was %s\n", i, value);
+ }
+ }
+
+ if (g_hash_table_size (hash) != 1000)
+ return FAILED ("Did not find 1000 elements on the hash, found %d\n", g_hash_table_size
(hash));
+
+ /* Now do the manual count, lets not trust the internals */
+ g_hash_table_foreach (hash, counter, &count);
+ if (count != 1000){
+ return FAILED ("Foreach count is not 1000");
+ }
+
+ g_hash_table_destroy (hash);
+ return NULL;
+}
+
+RESULT hash_iter (void)
+{
+#if !defined(GLIB_MAJOR_VERSION) || GLIB_CHECK_VERSION(2, 16, 0)
+ GHashTable *hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
+ GHashTableIter iter;
+ int i, sum, keys_sum, values_sum;
+ gpointer key, value;
+
+ sum = 0;
+ for (i = 0; i < 1000; i++) {
+ sum += i;
+ g_hash_table_insert (hash, GUINT_TO_POINTER (i), GUINT_TO_POINTER (i));
+ }
+
+ keys_sum = values_sum = 0;
+ g_hash_table_iter_init (&iter, hash);
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ if (key != value)
+ return FAILED ("key != value");
+ keys_sum += GPOINTER_TO_UINT (key);
+ values_sum += GPOINTER_TO_UINT (value);
+ }
+ if (keys_sum != sum || values_sum != sum)
+ return FAILED ("Did not find all key-value pairs");
+ g_hash_table_destroy (hash);
+ return NULL;
+#else
+ /* GHashTableIter was added in glib 2.16 */
+ return NULL;
+#endif
+}
+
+static Test hashtable_tests [] = {
+ {"t1", hash_t1},
+ {"t2", hash_t2},
+ {"grow", hash_grow},
+ {"default", hash_default},
+ {"null_lookup", hash_null_lookup},
+ {"iter", hash_iter},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(hashtable_tests_init, hashtable_tests)
+
diff --git a/deps/eglib/test/list.c b/deps/eglib/test/list.c
new file mode 100644
index 0000000..68dadee
--- /dev/null
+++ b/deps/eglib/test/list.c
@@ -0,0 +1,438 @@
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+RESULT
+test_list_length ()
+{
+ GList *list = g_list_prepend (NULL, "foo");
+
+ if (g_list_length (list) != 1)
+ return FAILED ("length failed. #1");
+
+ list = g_list_prepend (list, "bar");
+ if (g_list_length (list) != 2)
+ return FAILED ("length failed. #2");
+
+ list = g_list_append (list, "bar");
+ if (g_list_length (list) != 3)
+ return FAILED ("length failed. #3");
+
+ g_list_free (list);
+ return NULL;
+}
+
+RESULT
+test_list_nth ()
+{
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+ GList *nth, *list;
+ list = g_list_prepend (NULL, baz);
+ list = g_list_prepend (list, bar);
+ list = g_list_prepend (list, foo);
+
+ nth = g_list_nth (list, 0);
+ if (nth->data != foo)
+ return FAILED ("nth failed. #0");
+
+ nth = g_list_nth (list, 1);
+ if (nth->data != bar)
+ return FAILED ("nth failed. #1");
+
+ nth = g_list_nth (list, 2);
+ if (nth->data != baz)
+ return FAILED ("nth failed. #2");
+
+ nth = g_list_nth (list, 3);
+ if (nth)
+ return FAILED ("nth failed. #3: %s", nth->data);
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_index ()
+{
+ int i;
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+ GList *list;
+ list = g_list_prepend (NULL, baz);
+ list = g_list_prepend (list, bar);
+ list = g_list_prepend (list, foo);
+
+ i = g_list_index (list, foo);
+ if (i != 0)
+ return FAILED ("index failed. #0: %d", i);
+
+ i = g_list_index (list, bar);
+ if (i != 1)
+ return FAILED ("index failed. #1: %d", i);
+
+ i = g_list_index (list, baz);
+ if (i != 2)
+ return FAILED ("index failed. #2: %d", i);
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_append ()
+{
+ GList *list = g_list_prepend (NULL, "first");
+ if (g_list_length (list) != 1)
+ return FAILED ("Prepend failed");
+
+ list = g_list_append (list, "second");
+
+ if (g_list_length (list) != 2)
+ return FAILED ("Append failed");
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_last ()
+{
+ GList *foo = g_list_prepend (NULL, "foo");
+ GList *bar = g_list_prepend (NULL, "bar");
+ GList *last;
+
+ foo = g_list_concat (foo, bar);
+ last = g_list_last (foo);
+
+ if (last != bar)
+ return FAILED ("last failed. #1");
+
+ foo = g_list_concat (foo, g_list_prepend (NULL, "baz"));
+ foo = g_list_concat (foo, g_list_prepend (NULL, "quux"));
+
+ last = g_list_last (foo);
+ if (strcmp ("quux", last->data))
+ return FAILED ("last failed. #2");
+
+ g_list_free (foo);
+
+ return OK;
+}
+
+RESULT
+test_list_concat ()
+{
+ GList *foo = g_list_prepend (NULL, "foo");
+ GList *bar = g_list_prepend (NULL, "bar");
+ GList *list = g_list_concat (foo, bar);
+
+ if (g_list_length (list) != 2)
+ return FAILED ("Concat failed. #1");
+
+ if (strcmp (list->data, "foo"))
+ return FAILED ("Concat failed. #2");
+
+ if (strcmp (list->next->data, "bar"))
+ return FAILED ("Concat failed. #3");
+
+ if (g_list_first (list) != foo)
+ return FAILED ("Concat failed. #4");
+
+ if (g_list_last (list) != bar)
+ return FAILED ("Concat failed. #5");
+
+ g_list_free (list);
+
+ return OK;
+}
+
+
+static gint
+compare (gconstpointer a, gconstpointer b)
+{
+ char *foo = (char *) a;
+ char *bar = (char *) b;
+
+ if (strlen (foo) < strlen (bar))
+ return -1;
+
+ return 1;
+}
+
+RESULT
+test_list_insert_sorted ()
+{
+ GList *list = g_list_prepend (NULL, "a");
+ list = g_list_append (list, "aaa");
+
+ /* insert at the middle */
+ list = g_list_insert_sorted (list, "aa", compare);
+ if (strcmp ("aa", list->next->data))
+ return FAILED ("insert_sorted failed. #1");
+
+ /* insert at the beginning */
+ list = g_list_insert_sorted (list, "", compare);
+ if (strcmp ("", list->data))
+ return FAILED ("insert_sorted failed. #2");
+
+ /* insert at the end */
+ list = g_list_insert_sorted (list, "aaaa", compare);
+ if (strcmp ("aaaa", g_list_last (list)->data))
+ return FAILED ("insert_sorted failed. #3");
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_copy ()
+{
+ int i, length;
+ GList *list, *copy;
+ list = g_list_prepend (NULL, "a");
+ list = g_list_append (list, "aa");
+ list = g_list_append (list, "aaa");
+ list = g_list_append (list, "aaaa");
+
+ length = g_list_length (list);
+ copy = g_list_copy (list);
+
+ for (i = 0; i < length; i++)
+ if (strcmp (g_list_nth (list, i)->data,
+ g_list_nth (copy, i)->data))
+ return FAILED ("copy failed.");
+
+ g_list_free (list);
+ g_list_free (copy);
+ return OK;
+}
+
+RESULT
+test_list_reverse ()
+{
+ guint i, length;
+ GList *list, *reverse;
+ list = g_list_prepend (NULL, "a");
+ list = g_list_append (list, "aa");
+ list = g_list_append (list, "aaa");
+ list = g_list_append (list, "aaaa");
+
+ length = g_list_length (list);
+ reverse = g_list_reverse (g_list_copy (list));
+
+ if (g_list_length (reverse) != length)
+ return FAILED ("reverse failed #1");
+
+ for (i = 0; i < length; i++){
+ guint j = length - i - 1;
+ if (strcmp (g_list_nth (list, i)->data,
+ g_list_nth (reverse, j)->data))
+ return FAILED ("reverse failed. #2");
+ }
+
+ g_list_free (list);
+ g_list_free (reverse);
+ return OK;
+}
+
+RESULT
+test_list_remove ()
+{
+ GList *list = g_list_prepend (NULL, "three");
+ char *one = "one";
+ list = g_list_prepend (list, "two");
+ list = g_list_prepend (list, one);
+
+ list = g_list_remove (list, one);
+
+ if (g_list_length (list) != 2)
+ return FAILED ("Remove failed");
+
+ if (strcmp ("two", list->data) != 0)
+ return FAILED ("Remove failed");
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_remove_link ()
+{
+ GList *foo = g_list_prepend (NULL, "a");
+ GList *bar = g_list_prepend (NULL, "b");
+ GList *baz = g_list_prepend (NULL, "c");
+ GList *list = foo;
+
+ foo = g_list_concat (foo, bar);
+ foo = g_list_concat (foo, baz);
+
+ list = g_list_remove_link (list, bar);
+
+ if (g_list_length (list) != 2)
+ return FAILED ("remove_link failed #1");
+
+ if (bar->next != NULL)
+ return FAILED ("remove_link failed #2");
+
+ g_list_free (list);
+ g_list_free (bar);
+ return OK;
+}
+
+RESULT
+test_list_insert_before ()
+{
+ GList *foo, *bar, *baz;
+
+ foo = g_list_prepend (NULL, "foo");
+ foo = g_list_insert_before (foo, NULL, "bar");
+ bar = g_list_last (foo);
+
+ if (strcmp (bar->data, "bar"))
+ return FAILED ("1");
+
+ baz = g_list_insert_before (foo, bar, "baz");
+ if (foo != baz)
+ return FAILED ("2");
+
+ if (strcmp (g_list_nth_data (foo, 1), "baz"))
+ return FAILED ("3: %s", g_list_nth_data (foo, 1));
+
+ g_list_free (foo);
+ return OK;
+}
+
+#define N_ELEMS 101
+
+static int intcompare (gconstpointer p1, gconstpointer p2)
+{
+ return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
+}
+
+static gboolean verify_sort (GList *list, int len)
+{
+ int prev;
+
+ if (list->prev)
+ return FALSE;
+
+ prev = GPOINTER_TO_INT (list->data);
+ len--;
+ for (list = list->next; list; list = list->next) {
+ int curr = GPOINTER_TO_INT (list->data);
+ if (prev > curr)
+ return FALSE;
+ prev = curr;
+
+ if (!list->prev || list->prev->next != list)
+ return FALSE;
+
+ if (len == 0)
+ return FALSE;
+ len--;
+ }
+ return len == 0;
+}
+
+RESULT
+test_list_sort ()
+{
+ int i, j, mul;
+ GList *list = NULL;
+
+ for (i = 0; i < N_ELEMS; ++i)
+ list = g_list_prepend (list, GINT_TO_POINTER (i));
+ list = g_list_sort (list, intcompare);
+ if (!verify_sort (list, N_ELEMS))
+ return FAILED ("decreasing list");
+
+ g_list_free (list);
+
+ list = NULL;
+ for (i = 0; i < N_ELEMS; ++i)
+ list = g_list_prepend (list, GINT_TO_POINTER (-i));
+ list = g_list_sort (list, intcompare);
+ if (!verify_sort (list, N_ELEMS))
+ return FAILED ("increasing list");
+
+ g_list_free (list);
+
+ list = g_list_prepend (NULL, GINT_TO_POINTER (0));
+ for (i = 1; i < N_ELEMS; ++i) {
+ list = g_list_prepend (list, GINT_TO_POINTER (i));
+ list = g_list_prepend (list, GINT_TO_POINTER (-i));
+ }
+ list = g_list_sort (list, intcompare);
+ if (!verify_sort (list, 2*N_ELEMS-1))
+ return FAILED ("alternating list");
+
+ g_list_free (list);
+
+ list = NULL;
+ mul = 1;
+ for (i = 1; i < N_ELEMS; ++i) {
+ mul = -mul;
+ for (j = 0; j < i; ++j)
+ list = g_list_prepend (list, GINT_TO_POINTER (mul * j));
+ }
+ list = g_list_sort (list, intcompare);
+ if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
+ return FAILED ("wavering list");
+
+ g_list_free (list);
+
+ return OK;
+}
+
+static gint
+find_custom (gconstpointer a, gconstpointer b)
+{
+ return(strcmp (a, b));
+}
+
+RESULT
+test_list_find_custom ()
+{
+ GList *list = NULL, *found;
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+
+ list = g_list_prepend (list, baz);
+ list = g_list_prepend (list, bar);
+ list = g_list_prepend (list, foo);
+
+ found = g_list_find_custom (list, baz, find_custom);
+
+ if (found == NULL)
+ return FAILED ("Find failed");
+
+ g_list_free (list);
+
+ return OK;
+}
+
+static Test list_tests [] = {
+ { "length", test_list_length},
+ { "nth", test_list_nth},
+ { "index", test_list_index},
+ { "last", test_list_last},
+ { "append", test_list_append},
+ { "concat", test_list_concat},
+ {"insert_sorted", test_list_insert_sorted},
+ {"insert_before", test_list_insert_before},
+ { "copy", test_list_copy},
+ { "reverse", test_list_reverse},
+ { "remove", test_list_remove},
+ { "remove_link", test_list_remove_link},
+ { "remove_link", test_list_remove_link},
+ { "sort", test_list_sort},
+ { "find_custom", test_list_find_custom},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(list_tests_init, list_tests)
diff --git a/deps/eglib/test/markup.c b/deps/eglib/test/markup.c
new file mode 100644
index 0000000..cf8d3f2
--- /dev/null
+++ b/deps/eglib/test/markup.c
@@ -0,0 +1,234 @@
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+#define do_bad_test(s) do { char *r = markup_test (s); if (r == NULL) return FAILED ("Failed on test " # s);
else g_free (r); } while (0)
+#define do_ok_test(s) do { char *r = markup_test (s); if (r != NULL) return FAILED ("Could not parse valid "
# s); } while (0)
+
+static char *
+markup_test (const char *s)
+{
+ GMarkupParser *parser = g_new0 (GMarkupParser, 1);
+ GMarkupParseContext *context;
+ GError *error = NULL;
+
+ context = g_markup_parse_context_new (parser, 0, 0, 0);
+
+ g_markup_parse_context_parse (context, s, strlen (s), &error);
+ g_markup_parse_context_free (context);
+
+ if (error != NULL){
+ char *msg = g_strdup (error->message);
+ g_error_free (error);
+
+ g_free (parser);
+ return msg;
+ }
+ g_free (parser);
+ return NULL;
+}
+
+RESULT
+invalid_documents (void)
+{
+ /* These should fail */
+ do_bad_test ("<1>");
+ do_bad_test ("<a<");
+ do_bad_test ("</a>");
+ do_bad_test ("<a b>");
+ do_bad_test ("<a b=>");
+ do_bad_test ("<a b=c>");
+
+ return OK;
+}
+
+RESULT
+valid_documents (void)
+{
+ /* These should fail */
+ do_ok_test ("<a>");
+ do_ok_test ("<a a=\"b\">");
+
+ return OK;
+}
+
+/*
+ * This is a test for the kind of files that the code in mono/domain.c
+ * parses; This code comes from Mono
+ */
+typedef struct {
+ GSList *supported_runtimes;
+ char *required_runtime;
+ int configuration_count;
+ int startup_count;
+} AppConfigInfo;
+
+static char *
+get_attribute_value (const gchar **attribute_names,
+ const gchar **attribute_values,
+ const char *att_name)
+{
+ int n;
+ for (n=0; attribute_names[n] != NULL; n++) {
+ if (strcmp (attribute_names[n], att_name) == 0)
+ return g_strdup (attribute_values[n]);
+ }
+ return NULL;
+}
+
+static void
+start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error)
+{
+ AppConfigInfo* app_config = (AppConfigInfo*) user_data;
+
+ if (strcmp (element_name, "configuration") == 0) {
+ app_config->configuration_count++;
+ return;
+ }
+ if (strcmp (element_name, "startup") == 0) {
+ app_config->startup_count++;
+ return;
+ }
+
+ if (app_config->configuration_count != 1 || app_config->startup_count != 1)
+ return;
+
+ if (strcmp (element_name, "requiredRuntime") == 0) {
+ app_config->required_runtime = get_attribute_value (attribute_names, attribute_values,
"version");
+ } else if (strcmp (element_name, "supportedRuntime") == 0) {
+ char *version = get_attribute_value (attribute_names, attribute_values, "version");
+ app_config->supported_runtimes = g_slist_append (app_config->supported_runtimes, version);
+ }
+}
+
+static void
+end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error)
+{
+ AppConfigInfo* app_config = (AppConfigInfo*) user_data;
+
+ if (strcmp (element_name, "configuration") == 0) {
+ app_config->configuration_count--;
+ } else if (strcmp (element_name, "startup") == 0) {
+ app_config->startup_count--;
+ }
+}
+
+static const GMarkupParser
+mono_parser = {
+ start_element,
+ end_element,
+ NULL,
+ NULL,
+ NULL
+};
+
+AppConfigInfo *
+domain_test (char *text)
+{
+ AppConfigInfo *app_config = g_new0 (AppConfigInfo, 1);
+ GMarkupParseContext *context;
+
+ context = g_markup_parse_context_new (&mono_parser, 0, app_config, NULL);
+ if (g_markup_parse_context_parse (context, text, strlen (text), NULL)) {
+ g_markup_parse_context_end_parse (context, NULL);
+ }
+ g_markup_parse_context_free (context);
+
+ return app_config;
+}
+
+void
+domain_free (AppConfigInfo *info)
+{
+ GSList *l;
+ if (info->required_runtime)
+ g_free (info->required_runtime);
+ for (l = info->supported_runtimes; l != NULL; l = l->next){
+ g_free (l->data);
+ }
+ g_slist_free (info->supported_runtimes);
+ g_free (info);
+}
+
+RESULT
+mono_domain (void)
+{
+ AppConfigInfo *info;
+
+ info = domain_test ("<configuration><!--hello--><startup><!--world--><requiredRuntime
version=\"v1\"><!--r--></requiredRuntime></startup></configuration>");
+ if (info->required_runtime == NULL)
+ return FAILED ("No required runtime section");
+ if (strcmp (info->required_runtime, "v1") != 0)
+ return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
+ domain_free (info);
+
+ info = domain_test ("<configuration><startup><requiredRuntime
version=\"v1\"/><!--comment--></configuration><!--end-->");
+ if (info->required_runtime == NULL)
+ return FAILED ("No required runtime section on auto-close section");
+ if (strcmp (info->required_runtime, "v1") != 0)
+ return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
+ domain_free (info);
+
+ info = domain_test ("<!--start--><configuration><startup><supportedRuntime
version=\"v1\"/><!--middle--><supportedRuntime version=\"v2\"/></startup></configuration>");
+ if ((strcmp ((char*)info->supported_runtimes->data, "v1") == 0)){
+ if (info->supported_runtimes->next == NULL)
+ return FAILED ("Expected 2 supported runtimes");
+
+ if ((strcmp ((char*)info->supported_runtimes->next->data, "v2") != 0))
+ return FAILED ("Expected v1, v2, got %s", info->supported_runtimes->next->data);
+ if (info->supported_runtimes->next->next != NULL)
+ return FAILED ("Expected v1, v2, got more");
+ } else
+ return FAILED ("Expected `v1', got %s", info->supported_runtimes->data);
+ domain_free (info);
+
+ return NULL;
+}
+
+RESULT
+mcs_config (void)
+{
+ return markup_test ("<configuration>\r\n <system.diagnostics>\r\n <trace autoflush=\"true\"
indentsize=\"4\">\r\n <listeners>\r\n <add name=\"compilerLogListener\"
type=\"System.Diagnostics.TextWriterTraceListener,System\"/> </listeners> </trace>
</system.diagnostics> </configuration>");
+
+}
+
+RESULT
+xml_parse (void)
+{
+ return markup_test ("<?xml version=\"1.0\" encoding=\"utf-8\"?><a></a>");
+}
+
+RESULT
+machine_config (void)
+{
+ char *data;
+ gsize size;
+
+ if (g_file_get_contents ("../../data/net_1_1/machine.config", &data, &size, NULL)){
+ return markup_test (data);
+ }
+ printf ("Ignoring this test\n");
+ return NULL;
+}
+
+static Test markup_tests [] = {
+ {"invalid_documents", invalid_documents},
+ {"good_documents", valid_documents},
+ {"mono_domain", mono_domain},
+ {"mcs_config", mcs_config},
+ {"xml_parse", xml_parse},
+ {"machine_config", machine_config},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(markup_tests_init, markup_tests)
+
diff --git a/deps/eglib/test/memory.c b/deps/eglib/test/memory.c
new file mode 100644
index 0000000..db7db08
--- /dev/null
+++ b/deps/eglib/test/memory.c
@@ -0,0 +1,40 @@
+
+#include <glib.h>
+#include "test.h"
+
+RESULT
+test_memory_zero_size_allocations ()
+{
+ gpointer p;
+
+ p = g_malloc (0);
+ if (p)
+ return FAILED ("Calling g_malloc with size zero should return NULL.");
+
+ p = g_malloc0 (0);
+ if (p)
+ return FAILED ("Calling g_malloc0 with size zero should return NULL.");
+
+ p = g_realloc (NULL, 0);
+ if (p)
+ return FAILED ("Calling g_realloc with size zero should return NULL.");
+
+ p = g_new (int, 0);
+ if (p)
+ return FAILED ("Calling g_new with size zero should return NULL.");
+
+ p = g_new0 (int, 0);
+ if (p)
+ return FAILED ("Calling g_new0 with size zero should return NULL.");
+
+ return OK;
+}
+
+
+static Test memory_tests [] = {
+ { "zero_size_allocations", test_memory_zero_size_allocations},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(memory_tests_init, memory_tests)
+
diff --git a/deps/eglib/test/module.c b/deps/eglib/test/module.c
new file mode 100644
index 0000000..a283637
--- /dev/null
+++ b/deps/eglib/test/module.c
@@ -0,0 +1,64 @@
+#include <config.h>
+#include <glib.h>
+#include <gmodule.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include "test.h"
+
+#if defined (G_OS_WIN32)
+#define EXTERNAL_SYMBOL "GetProcAddress"
+#else
+#define EXTERNAL_SYMBOL "system"
+#endif
+
+void G_MODULE_EXPORT
+dummy_test_export ()
+{
+}
+
+/* test for g_module_open (NULL, ...) */
+RESULT
+test_module_symbol_null ()
+{
+ gpointer proc = GINT_TO_POINTER (42);
+
+ GModule *m = g_module_open (NULL, G_MODULE_BIND_LAZY);
+
+ if (m == NULL)
+ return FAILED ("bind to main module failed. #0");
+
+ if (g_module_symbol (m, "__unlikely_\nexistent__", &proc))
+ return FAILED ("non-existent symbol lookup failed. #1");
+
+ if (proc)
+ return FAILED ("non-existent symbol lookup failed. #2");
+
+ if (!g_module_symbol (m, EXTERNAL_SYMBOL, &proc))
+ return FAILED ("external lookup failed. #3");
+
+ if (!proc)
+ return FAILED ("external lookup failed. #4");
+
+ if (!g_module_symbol (m, "dummy_test_export", &proc))
+ return FAILED ("in-proc lookup failed. #5");
+
+ if (!proc)
+ return FAILED ("in-proc lookup failed. #6");
+
+ if (!g_module_close (m))
+ return FAILED ("close failed. #7");
+
+ return OK;
+}
+
+static Test module_tests [] = {
+ {"g_module_symbol_null", test_module_symbol_null},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(module_tests_init, module_tests)
+
+
diff --git a/deps/eglib/test/path.c b/deps/eglib/test/path.c
new file mode 100644
index 0000000..e3832a0
--- /dev/null
+++ b/deps/eglib/test/path.c
@@ -0,0 +1,357 @@
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef G_OS_UNIX
+#include <pthread.h>
+#endif
+#include "test.h"
+
+#ifdef G_OS_WIN32
+#include <direct.h>
+#define chdir _chdir
+#endif
+
+/* This test is just to be used with valgrind */
+RESULT
+test_buildpath ()
+{
+ char *s;
+ char *buffer = "var/private";
+ char *dir = "/";
+
+ s = g_build_path ("/", "hola///", "//mundo", NULL);
+ if (strcmp (s, "hola/mundo") != 0)
+ return FAILED ("1 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "hola/", "/mundo", NULL);
+ if (strcmp (s, "hola/mundo") != 0)
+ return FAILED ("2 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "hola/", "mundo", NULL);
+ if (strcmp (s, "hola/mundo") != 0)
+ return FAILED ("3 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "hola", "/mundo", NULL);
+ if (strcmp (s, "hola/mundo") != 0)
+ return FAILED ("4 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "/hello", "world/", NULL);
+ if (strcmp (s, "/hello/world/") != 0)
+ return FAILED ("5 Got wrong result, got: %s", s);
+ g_free (s);
+
+ /* Now test multi-char-separators */
+ s = g_build_path ("**", "hello", "world", NULL);
+ if (strcmp (s, "hello**world") != 0)
+ return FAILED ("6 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("**", "hello**", "world", NULL);
+ if (strcmp (s, "hello**world") != 0)
+ return FAILED ("7 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("**", "hello**", "**world", NULL);
+ if (strcmp (s, "hello**world") != 0)
+ return FAILED ("8 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("**", "hello**", "**world", NULL);
+ if (strcmp (s, "hello**world") != 0)
+ return FAILED ("9 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("1234567890", "hello", "world", NULL);
+ if (strcmp (s, "hello1234567890world") != 0)
+ return FAILED ("10 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("1234567890", "hello1234567890", "1234567890world", NULL);
+ if (strcmp (s, "hello1234567890world") != 0)
+ return FAILED ("11 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("1234567890", "hello12345678901234567890", "1234567890world", NULL);
+ if (strcmp (s, "hello1234567890world") != 0)
+ return FAILED ("12 Got wrong result, got: %s", s);
+ g_free (s);
+
+ /* Multiple */
+ s = g_build_path ("/", "a", "b", "c", "d", NULL);
+ if (strcmp (s, "a/b/c/d") != 0)
+ return FAILED ("13 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "/a", "", "/c/", NULL);
+ if (strcmp (s, "/a/c/") != 0)
+ return FAILED ("14 Got wrong result, got: %s", s);
+ g_free (s);
+
+ /* Null */
+ s = g_build_path ("/", NULL, NULL);
+ if (s == NULL)
+ return FAILED ("must get a non-NULL return");
+ if (s [0] != 0)
+ return FAILED ("must get an empty string");
+
+ // This is to test the regression introduced by Levi for the Windows support
+ // that code errouneously read below the allowed area (in this case dir [-1]).
+ // and caused all kinds of random errors.
+ dir = "//";
+ dir++;
+ s = g_build_filename (dir, buffer, NULL);
+ if (s [0] != '/')
+ return FAILED ("Must have a '/' at the start");
+
+ g_free (s);
+ return OK;
+}
+
+RESULT
+test_buildfname ()
+{
+ char *s;
+
+ s = g_build_filename ("a", "b", "c", "d", NULL);
+#ifdef G_OS_WIN32
+ if (strcmp (s, "a\\b\\c\\d") != 0)
+#else
+ if (strcmp (s, "a/b/c/d") != 0)
+#endif
+ return FAILED ("1 Got wrong result, got: %s", s);
+ g_free (s);
+
+#ifdef G_OS_WIN32
+ s = g_build_filename ("C:\\", "a", NULL);
+ if (strcmp (s, "C:\\a") != 0)
+#else
+ s = g_build_filename ("/", "a", NULL);
+ if (strcmp (s, "/a") != 0)
+#endif
+ return FAILED ("1 Got wrong result, got: %s", s);
+
+#ifndef G_OS_WIN32
+ s = g_build_filename ("/", "foo", "/bar", "tolo/", "/meo/", NULL);
+ if (strcmp (s, "/foo/bar/tolo/meo/") != 0)
+ return FAILED ("1 Got wrong result, got: %s", s);
+#endif
+
+ return OK;
+}
+
+char *
+test_dirname ()
+{
+ char *s;
+
+#ifdef G_OS_WIN32
+ s = g_path_get_dirname ("c:\\home\\miguel");
+ if (strcmp (s, "c:\\home") != 0)
+ return FAILED ("Expected c:\\home, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("c:/home/miguel");
+ if (strcmp (s, "c:/home") != 0)
+ return FAILED ("Expected c:/home, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("c:\\home\\dingus\\");
+ if (strcmp (s, "c:\\home\\dingus") != 0)
+ return FAILED ("Expected c:\\home\\dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("dir.c");
+ if (strcmp (s, ".") != 0)
+ return FAILED ("Expected `.', got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("c:\\index.html");
+ if (strcmp (s, "c:") != 0)
+ return FAILED ("Expected [c:], got [%s]", s);
+#else
+ s = g_path_get_dirname ("/home/miguel");
+ if (strcmp (s, "/home") != 0)
+ return FAILED ("Expected /home, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("/home/dingus/");
+ if (strcmp (s, "/home/dingus") != 0)
+ return FAILED ("Expected /home/dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("dir.c");
+ if (strcmp (s, ".") != 0)
+ return FAILED ("Expected `.', got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("/index.html");
+ if (strcmp (s, "/") != 0)
+ return FAILED ("Expected [/], got [%s]", s);
+#endif
+ return OK;
+}
+
+char *
+test_basename ()
+{
+ char *s;
+
+#ifdef G_OS_WIN32
+ s = g_path_get_basename ("");
+ if (strcmp (s, ".") != 0)
+ return FAILED ("Expected `.', got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("c:\\home\\dingus\\");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("1 Expected dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("c:/home/dingus/");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("1 Expected dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("c:\\home\\dingus");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("2 Expected dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("c:/home/dingus");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("2 Expected dingus, got %s", s);
+ g_free (s);
+#else
+ s = g_path_get_basename ("");
+ if (strcmp (s, ".") != 0)
+ return FAILED ("Expected `.', got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("/home/dingus/");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("1 Expected dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("/home/dingus");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("2 Expected dingus, got %s", s);
+ g_free (s);
+#endif
+ return OK;
+}
+
+gchar *
+test_ppath ()
+{
+ char *s;
+#ifdef G_OS_WIN32
+ const gchar *searchfor = "explorer.exe";
+#else
+ const gchar *searchfor = "ls";
+#endif
+ s = g_find_program_in_path (searchfor);
+ if (s == NULL)
+ return FAILED ("No %s on this system?", searchfor);
+ g_free (s);
+ return OK;
+}
+
+gchar *
+test_ppath2 ()
+{
+ char *s;
+ const char *path = g_getenv ("PATH");
+#ifdef G_OS_WIN32
+ const gchar *searchfor = "test_eglib.exe";
+#else
+ const gchar *searchfor = "test-glib";
+#endif
+
+ g_setenv ("PATH", "", TRUE);
+ s = g_find_program_in_path ("ls");
+ if (s != NULL) {
+ g_setenv ("PATH", path, TRUE);
+ return FAILED ("Found something interesting here: %s", s);
+ }
+ g_free (s);
+ s = g_find_program_in_path (searchfor);
+ if (s == NULL) {
+ g_setenv ("PATH", path, TRUE);
+ return FAILED ("It should find '%s' in the current directory.", searchfor);
+ }
+ g_free (s);
+ g_setenv ("PATH", path, TRUE);
+ return OK;
+}
+
+#ifndef DISABLE_FILESYSTEM_TESTS
+gchar *
+test_cwd ()
+{
+ char *dir = g_get_current_dir ();
+#ifdef G_OS_WIN32
+ const gchar *newdir = "C:\\Windows";
+#else
+ const gchar *newdir = "/bin";
+#endif
+
+ if (dir == NULL)
+ return FAILED ("No current directory?");
+ g_free (dir);
+
+ if (chdir (newdir) == -1)
+ return FAILED ("No %s?", newdir);
+
+ dir = g_get_current_dir ();
+ if (strcmp (dir, newdir) != 0)
+ return FAILED("Did not go to %s?", newdir);
+ g_free (dir);
+
+ return OK;
+}
+#else
+gchar *
+test_cwd ()
+{
+ return OK;
+}
+#endif
+
+gchar *
+test_misc ()
+{
+ const char *home = g_get_home_dir ();
+ const char *tmp = g_get_tmp_dir ();
+
+ if (home == NULL)
+ return FAILED ("Where did my home go?");
+
+ if (tmp == NULL)
+ return FAILED ("Where did my /tmp go?");
+
+ return OK;
+}
+
+static Test path_tests [] = {
+ {"g_build_filename", test_buildfname},
+ {"g_buildpath", test_buildpath},
+ {"g_path_get_dirname", test_dirname},
+ {"g_path_get_basename", test_basename},
+ {"g_find_program_in_path", test_ppath},
+ {"g_find_program_in_path2", test_ppath2},
+ {"test_cwd", test_cwd },
+ {"test_misc", test_misc },
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(path_tests_init, path_tests)
+
+
diff --git a/deps/eglib/test/pattern.c b/deps/eglib/test/pattern.c
new file mode 100644
index 0000000..7db5a7b
--- /dev/null
+++ b/deps/eglib/test/pattern.c
@@ -0,0 +1,61 @@
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include "test.h"
+
+#define MATCH(pat,string,error_if,msg) \
+ spec = g_pattern_spec_new (pat); \
+ res = g_pattern_match_string (spec, string); \
+ if (res == error_if) \
+ return FAILED (msg " returned %s", res ? "TRUE" : "FALSE"); \
+ g_pattern_spec_free (spec);
+
+#define TEST_MATCH(pat,string,n) MATCH (pat, string, FALSE, "MATCH " #n)
+#define TEST_NO_MATCH(pat,string,n) MATCH (pat, string,TRUE, "NO_MATCH " #n)
+
+RESULT
+test_pattern_spec ()
+{
+ GPatternSpec *spec;
+ gboolean res;
+
+ /* spec = g_pattern_spec_new (NULL); */
+ TEST_MATCH ("*", "hola", 1);
+ TEST_MATCH ("hola", "hola", 2);
+ TEST_MATCH ("????", "hola", 3);
+ TEST_MATCH ("???a", "hola", 4);
+ TEST_MATCH ("h??a", "hola", 5);
+ TEST_MATCH ("h??*", "hola", 6);
+ TEST_MATCH ("h*", "hola", 7);
+ TEST_MATCH ("*hola", "hola", 8);
+ TEST_MATCH ("*l*", "hola", 9);
+ TEST_MATCH ("h*??", "hola", 10);
+ TEST_MATCH ("h*???", "hola", 11);
+ TEST_MATCH ("?o??", "hola", 12);
+ TEST_MATCH ("*h*o*l*a*", "hola", 13);
+ TEST_MATCH ("h*o*l*a", "hola", 14);
+ TEST_MATCH ("h?*?", "hola", 15);
+
+ TEST_NO_MATCH ("", "hola", 1);
+ TEST_NO_MATCH ("?????", "hola", 2);
+ TEST_NO_MATCH ("???", "hola", 3);
+ TEST_NO_MATCH ("*o", "hola", 4);
+ TEST_NO_MATCH ("h", "hola", 5);
+ TEST_NO_MATCH ("h*????", "hola", 6);
+
+ return OK;
+}
+
+static Test pattern_tests [] = {
+ {"g_pattern_spec*", test_pattern_spec},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(pattern_tests_init, pattern_tests)
+
+
diff --git a/deps/eglib/test/ptrarray.c b/deps/eglib/test/ptrarray.c
new file mode 100644
index 0000000..34d78b0
--- /dev/null
+++ b/deps/eglib/test/ptrarray.c
@@ -0,0 +1,349 @@
+#include <stdio.h>
+#include <glib.h>
+#include "test.h"
+
+/* Redefine the private structure only to verify proper allocations */
+typedef struct _GPtrArrayPriv {
+ gpointer *pdata;
+ guint len;
+ guint size;
+} GPtrArrayPriv;
+
+/* Don't add more than 32 items to this please */
+static const char *items [] = {
+ "Apples", "Oranges", "Plumbs", "Goats", "Snorps", "Grapes",
+ "Tickle", "Place", "Coffee", "Cookies", "Cake", "Cheese",
+ "Tseng", "Holiday", "Avenue", "Smashing", "Water", "Toilet",
+ NULL
+};
+
+static GPtrArray *ptrarray_alloc_and_fill(guint *item_count)
+{
+ GPtrArray *array = g_ptr_array_new();
+ gint i;
+
+ for(i = 0; items[i] != NULL; i++) {
+ g_ptr_array_add(array, (gpointer)items[i]);
+ }
+
+ if(item_count != NULL) {
+ *item_count = i;
+ }
+
+ return array;
+}
+
+static guint guess_size(guint length)
+{
+ guint size = 1;
+
+ while(size < length) {
+ size <<= 1;
+ }
+
+ return size;
+}
+
+RESULT ptrarray_alloc()
+{
+ GPtrArrayPriv *array;
+ guint i;
+
+ array = (GPtrArrayPriv *)ptrarray_alloc_and_fill(&i);
+
+ if(array->size != guess_size(array->len)) {
+ return FAILED("Size should be %d, but it is %d",
+ guess_size(array->len), array->size);
+ }
+
+ if(array->len != i) {
+ return FAILED("Expected %d node(s) in the array", i);
+ }
+
+ g_ptr_array_free((GPtrArray *)array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_for_iterate()
+{
+ GPtrArray *array = ptrarray_alloc_and_fill(NULL);
+ guint i;
+
+ for(i = 0; i < array->len; i++) {
+ char *item = (char *)g_ptr_array_index(array, i);
+ if(item != items[i]) {
+ return FAILED(
+ "Expected item at %d to be %s, but it was %s",
+ i, items[i], item);
+ }
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+static gint foreach_iterate_index = 0;
+static char *foreach_iterate_error = NULL;
+
+void foreach_callback(gpointer data, gpointer user_data)
+{
+ char *item = (char *)data;
+ const char *item_cmp = items[foreach_iterate_index++];
+
+ if(foreach_iterate_error != NULL) {
+ return;
+ }
+
+ if(item != item_cmp) {
+ foreach_iterate_error = FAILED(
+ "Expected item at %d to be %s, but it was %s",
+ foreach_iterate_index - 1, item_cmp, item);
+ }
+}
+
+RESULT ptrarray_foreach_iterate()
+{
+ GPtrArray *array = ptrarray_alloc_and_fill(NULL);
+
+ foreach_iterate_index = 0;
+ foreach_iterate_error = NULL;
+
+ g_ptr_array_foreach(array, foreach_callback, array);
+
+ g_ptr_array_free(array, TRUE);
+
+ return foreach_iterate_error;
+}
+
+RESULT ptrarray_set_size()
+{
+ GPtrArray *array = g_ptr_array_new();
+ guint i, grow_length = 50;
+
+ g_ptr_array_add(array, (gpointer)items[0]);
+ g_ptr_array_add(array, (gpointer)items[1]);
+ g_ptr_array_set_size(array, grow_length);
+
+ if(array->len != grow_length) {
+ return FAILED("Array length should be 50, it is %d", array->len);
+ } else if(array->pdata[0] != items[0]) {
+ return FAILED("Item 0 was overwritten, should be %s", items[0]);
+ } else if(array->pdata[1] != items[1]) {
+ return FAILED("Item 1 was overwritten, should be %s", items[1]);
+ }
+
+ for(i = 2; i < array->len; i++) {
+ if(array->pdata[i] != NULL) {
+ return FAILED("Item %d is not NULL, it is %p", i, array->pdata[i]);
+ }
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_remove_index()
+{
+ GPtrArray *array;
+ guint i;
+
+ array = ptrarray_alloc_and_fill(&i);
+
+ g_ptr_array_remove_index(array, 0);
+ if(array->pdata[0] != items[1]) {
+ return FAILED("First item is not %s, it is %s", items[1],
+ array->pdata[0]);
+ }
+
+ g_ptr_array_remove_index(array, array->len - 1);
+
+ if(array->pdata[array->len - 1] != items[array->len]) {
+ return FAILED("Last item is not %s, it is %s",
+ items[array->len - 2], array->pdata[array->len - 1]);
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_remove_index_fast()
+{
+ GPtrArray *array;
+ guint i;
+
+ array = ptrarray_alloc_and_fill(&i);
+
+ g_ptr_array_remove_index_fast(array, 0);
+ if(array->pdata[0] != items[array->len]) {
+ return FAILED("First item is not %s, it is %s", items[array->len],
+ array->pdata[0]);
+ }
+
+ g_ptr_array_remove_index_fast(array, array->len - 1);
+ if(array->pdata[array->len - 1] != items[array->len - 1]) {
+ return FAILED("Last item is not %s, it is %s",
+ items[array->len - 1], array->pdata[array->len - 1]);
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_remove()
+{
+ GPtrArray *array;
+ guint i;
+
+ array = ptrarray_alloc_and_fill(&i);
+
+ g_ptr_array_remove(array, (gpointer)items[7]);
+
+ if(!g_ptr_array_remove(array, (gpointer)items[4])) {
+ return FAILED("Item %s not removed", items[4]);
+ }
+
+ if(g_ptr_array_remove(array, (gpointer)items[4])) {
+ return FAILED("Item %s still in array after removal", items[4]);
+ }
+
+ if(array->pdata[array->len - 1] != items[array->len + 1]) {
+ return FAILED("Last item in GPtrArray not correct");
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+static gint ptrarray_sort_compare(gconstpointer a, gconstpointer b)
+{
+ gchar *stra = *(gchar **) a;
+ gchar *strb = *(gchar **) b;
+ return strcmp(stra, strb);
+}
+
+RESULT ptrarray_sort()
+{
+ GPtrArray *array = g_ptr_array_new();
+ guint i;
+ gchar *letters [] = { "A", "B", "C", "D", "E" };
+
+ g_ptr_array_add(array, letters[0]);
+ g_ptr_array_add(array, letters[1]);
+ g_ptr_array_add(array, letters[2]);
+ g_ptr_array_add(array, letters[3]);
+ g_ptr_array_add(array, letters[4]);
+
+ g_ptr_array_sort(array, ptrarray_sort_compare);
+
+ for(i = 0; i < array->len; i++) {
+ if(array->pdata[i] != letters[i]) {
+ return FAILED("Array out of order, expected %s got %s at position %d",
+ letters [i], (gchar *) array->pdata [i], i);
+ }
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+static gint ptrarray_sort_compare_with_data (gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ gchar *stra = *(gchar **) a;
+ gchar *strb = *(gchar **) b;
+
+ if (strcmp (user_data, "this is the data for qsort") != 0)
+ fprintf (stderr, "oops at compare with_data\n");
+
+ return strcmp(stra, strb);
+}
+
+RESULT ptrarray_sort_with_data ()
+{
+ GPtrArray *array = g_ptr_array_new();
+ guint i;
+ gchar *letters [] = { "A", "B", "C", "D", "E" };
+
+ g_ptr_array_add(array, letters[4]);
+ g_ptr_array_add(array, letters[1]);
+ g_ptr_array_add(array, letters[2]);
+ g_ptr_array_add(array, letters[0]);
+ g_ptr_array_add(array, letters[3]);
+
+ g_ptr_array_sort_with_data(array, ptrarray_sort_compare_with_data, "this is the data for qsort");
+
+ for(i = 0; i < array->len; i++) {
+ if(array->pdata[i] != letters[i]) {
+ return FAILED("Array out of order, expected %s got %s at position %d",
+ letters [i], (gchar *) array->pdata [i], i);
+ }
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_remove_fast()
+{
+ GPtrArray *array = g_ptr_array_new();
+ gchar *letters [] = { "A", "B", "C", "D", "E" };
+
+ if (g_ptr_array_remove_fast (array, NULL))
+ return FAILED ("Removing NULL succeeded");
+
+ g_ptr_array_add(array, letters[0]);
+ if (!g_ptr_array_remove_fast (array, letters[0]) || array->len != 0)
+ return FAILED ("Removing last element failed");
+
+ g_ptr_array_add(array, letters[0]);
+ g_ptr_array_add(array, letters[1]);
+ g_ptr_array_add(array, letters[2]);
+ g_ptr_array_add(array, letters[3]);
+ g_ptr_array_add(array, letters[4]);
+
+ if (!g_ptr_array_remove_fast (array, letters[0]) || array->len != 4)
+ return FAILED ("Removing first element failed");
+
+ if (array->pdata [0] != letters [4])
+ return FAILED ("First element wasn't replaced with last upon removal");
+
+ if (g_ptr_array_remove_fast (array, letters[0]))
+ return FAILED ("Succedeed removing a non-existing element");
+
+ if (!g_ptr_array_remove_fast (array, letters[3]) || array->len != 3)
+ return FAILED ("Failed removing \"D\"");
+
+ if (!g_ptr_array_remove_fast (array, letters[1]) || array->len != 2)
+ return FAILED ("Failed removing \"B\"");
+
+ if (array->pdata [0] != letters [4] || array->pdata [1] != letters [2])
+ return FAILED ("Last two elements are wrong");
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+static Test ptrarray_tests [] = {
+ {"alloc", ptrarray_alloc},
+ {"for_iterate", ptrarray_for_iterate},
+ {"foreach_iterate", ptrarray_foreach_iterate},
+ {"set_size", ptrarray_set_size},
+ {"remove_index", ptrarray_remove_index},
+ {"remove_index_fast", ptrarray_remove_index_fast},
+ {"remove", ptrarray_remove},
+ {"sort", ptrarray_sort},
+ {"remove_fast", ptrarray_remove_fast},
+ {"sort_with_data", ptrarray_sort_with_data},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(ptrarray_tests_init, ptrarray_tests)
+
+
diff --git a/deps/eglib/test/queue.c b/deps/eglib/test/queue.c
new file mode 100644
index 0000000..b12ddec
--- /dev/null
+++ b/deps/eglib/test/queue.c
@@ -0,0 +1,184 @@
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+RESULT
+test_queue_push ()
+{
+ GQueue *queue = g_queue_new ();
+
+ g_queue_push_head (queue, "foo");
+ g_queue_push_head (queue, "bar");
+ g_queue_push_head (queue, "baz");
+
+ if (queue->length != 3)
+ return FAILED ("push failed");
+
+ if (NULL != queue->head->prev)
+ return FAILED ("HEAD: prev is wrong");
+ if (strcmp ("baz", queue->head->data))
+ return FAILED ("HEAD: First element is wrong");
+ if (strcmp ("bar", queue->head->next->data))
+ return FAILED ("HEAD: Second element is wrong");
+ if (strcmp ("foo", queue->head->next->next->data))
+ return FAILED ("HEAD: Third element is wrong");
+ if (NULL != queue->head->next->next->next)
+ return FAILED ("HEAD: End is wrong");
+
+ if (NULL != queue->tail->next)
+ return FAILED ("TAIL: next is wrong");
+ if (strcmp ("foo", queue->tail->data))
+ return FAILED ("TAIL: Third element is wrong");
+ if (strcmp ("bar", queue->tail->prev->data))
+ return FAILED ("TAIL: Second element is wrong");
+ if (strcmp ("baz", queue->tail->prev->prev->data))
+ return FAILED ("TAIL: First element is wrong");
+ if (NULL != queue->tail->prev->prev->prev)
+ return FAILED ("TAIL: End is wrong");
+
+ g_queue_free (queue);
+ return OK;
+}
+
+RESULT
+test_queue_push_tail ()
+{
+ GQueue *queue = g_queue_new ();
+
+ g_queue_push_tail (queue, "baz");
+ g_queue_push_tail (queue, "bar");
+ g_queue_push_tail (queue, "foo");
+
+ if (queue->length != 3)
+ return FAILED ("push failed");
+
+ if (NULL != queue->head->prev)
+ return FAILED ("HEAD: prev is wrong");
+ if (strcmp ("baz", queue->head->data))
+ return FAILED ("HEAD: First element is wrong");
+ if (strcmp ("bar", queue->head->next->data))
+ return FAILED ("HEAD: Second element is wrong");
+ if (strcmp ("foo", queue->head->next->next->data))
+ return FAILED ("HEAD: Third element is wrong");
+ if (NULL != queue->head->next->next->next)
+ return FAILED ("HEAD: End is wrong");
+
+ if (NULL != queue->tail->next)
+ return FAILED ("TAIL: next is wrong");
+ if (strcmp ("foo", queue->tail->data))
+ return FAILED ("TAIL: Third element is wrong");
+ if (strcmp ("bar", queue->tail->prev->data))
+ return FAILED ("TAIL: Second element is wrong");
+ if (strcmp ("baz", queue->tail->prev->prev->data))
+ return FAILED ("TAIL: First element is wrong");
+ if (NULL != queue->tail->prev->prev->prev)
+ return FAILED ("TAIL: End is wrong");
+
+ g_queue_free (queue);
+ return OK;
+}
+
+RESULT
+test_queue_pop ()
+{
+ GQueue *queue = g_queue_new ();
+ gpointer data;
+
+ g_queue_push_head (queue, "foo");
+ g_queue_push_head (queue, "bar");
+ g_queue_push_head (queue, "baz");
+
+ data = g_queue_pop_head (queue);
+ if (strcmp ("baz", data))
+ return FAILED ("expect baz.");
+
+ data = g_queue_pop_head (queue);
+ if (strcmp ("bar", data))
+ return FAILED ("expect bar.");
+
+ data = g_queue_pop_head (queue);
+ if (strcmp ("foo", data))
+ return FAILED ("expect foo.");
+
+ if (g_queue_is_empty (queue) == FALSE)
+ return FAILED ("expect is_empty.");
+
+ if (queue->length != 0)
+ return FAILED ("expect 0 length .");
+
+ g_queue_push_head (queue, "foo");
+ g_queue_push_head (queue, "bar");
+ g_queue_push_head (queue, "baz");
+
+ g_queue_pop_head (queue);
+
+ if (NULL != queue->head->prev)
+ return FAILED ("HEAD: prev is wrong");
+ if (strcmp ("bar", queue->head->data))
+ return FAILED ("HEAD: Second element is wrong");
+ if (strcmp ("foo", queue->head->next->data))
+ return FAILED ("HEAD: Third element is wrong");
+ if (NULL != queue->head->next->next)
+ return FAILED ("HEAD: End is wrong");
+
+ if (NULL != queue->tail->next)
+ return FAILED ("TAIL: next is wrong");
+ if (strcmp ("foo", queue->tail->data))
+ return FAILED ("TAIL: Second element is wrong");
+ if (strcmp ("bar", queue->tail->prev->data))
+ return FAILED ("TAIL: First element is wrong");
+ if (NULL != queue->tail->prev->prev)
+ return FAILED ("TAIL: End is wrong");
+
+ g_queue_free (queue);
+ return OK;
+}
+
+RESULT
+test_queue_new ()
+{
+ GQueue *queue = g_queue_new ();
+
+ if (queue->length != 0)
+ return FAILED ("expect length == 0");
+
+ if (queue->head != NULL)
+ return FAILED ("expect head == NULL");
+
+ if (queue->tail != NULL)
+ return FAILED ("expect tail == NULL");
+
+ g_queue_free (queue);
+ return OK;
+}
+
+RESULT
+test_queue_is_empty ()
+{
+ GQueue *queue = g_queue_new ();
+
+ if (g_queue_is_empty (queue) == FALSE)
+ return FAILED ("new queue should be empty");
+
+ g_queue_push_head (queue, "foo");
+
+ if (g_queue_is_empty (queue) == TRUE)
+ return FAILED ("expected TRUE");
+
+ g_queue_free (queue);
+
+ return OK;
+}
+
+static Test queue_tests [] = {
+ { "push", test_queue_push},
+ {"push_tail", test_queue_push_tail},
+ { "pop", test_queue_pop},
+ { "new", test_queue_new},
+ {"is_empty", test_queue_is_empty},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(queue_tests_init, queue_tests)
+
diff --git a/deps/eglib/test/shell.c b/deps/eglib/test/shell.c
new file mode 100644
index 0000000..4715f1c
--- /dev/null
+++ b/deps/eglib/test/shell.c
@@ -0,0 +1,331 @@
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#include "test.h"
+
+RESULT
+test_shell_argv1 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+
+ /* The next line prints a critical error and returns FALSE
+ ret = g_shell_parse_argv (NULL, NULL, NULL, NULL);
+ */
+ ret = g_shell_parse_argv ("", NULL, NULL, NULL);
+ if (ret)
+ return FAILED ("1. It should return FALSE");
+
+ ret = g_shell_parse_argv ("hola", NULL, NULL, NULL);
+ if (!ret)
+ return FAILED ("2. It should return TRUE");
+
+ argc = 0;
+ ret = g_shell_parse_argv ("hola", &argc, NULL, NULL);
+ if (!ret)
+ return FAILED ("3. It should return TRUE");
+ if (argc != 1)
+ return FAILED ("4. argc was %d", argc);
+
+ argc = 0;
+ ret = g_shell_parse_argv ("hola bola", &argc, NULL, NULL);
+ if (!ret)
+ return FAILED ("5. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("6. argc was %d", argc);
+
+ argc = 0;
+ ret = g_shell_parse_argv ("hola bola", &argc, &argv, NULL);
+ if (!ret)
+ return FAILED ("7. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("8. argc was %d", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("9. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "bola"))
+ return FAILED ("10. argv[1] was %s", argv [1]);
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola 'bola'", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("11. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("12. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("13. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "bola"))
+ return FAILED ("14. argv[1] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("15. error is not null");
+
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola '' 'bola'", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("16. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("17. argc was %d expected 3", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("18. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], ""))
+ return FAILED ("19. argv[2] was %s", argv [1]);
+ if (strcmp (argv [2], "bola"))
+ return FAILED ("19. argv[2] was %s", argv [2]);
+ if (error != NULL)
+ return FAILED ("20. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola'' bola", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("21. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("22. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("23. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "bola"))
+ return FAILED ("24. argv[2] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("25. error is not null");
+
+ return OK;
+}
+
+RESULT
+test_shell_argv2 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola \"bola\"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("1. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("2. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("3. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "bola"))
+ return FAILED ("4. argv[1] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("5. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola \"\" \"bola \"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("6. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("7. argc was %d expected 3", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("8. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], ""))
+ return FAILED ("9. argv[2] was %s", argv [1]);
+ if (strcmp (argv [2], "bola "))
+ return FAILED ("10. argv[2] was %s", argv [2]);
+ if (error != NULL)
+ return FAILED ("11. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola\n\t \"\t\" \"bola \"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("10. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("11. argc was %d expected 3", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("12. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "\t"))
+ return FAILED ("13. argv[2] was %s", argv [1]);
+ if (strcmp (argv [2], "bola "))
+ return FAILED ("14. argv[2] was %s", argv [2]);
+ if (error != NULL)
+ return FAILED ("15. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola\n\t \\\n \"\t\" \"bola \"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("16. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("17. argc was %d expected 3", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("18. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "\t"))
+ return FAILED ("19. argv[2] was %s", argv [1]);
+ if (strcmp (argv [2], "bola "))
+ return FAILED ("20. argv[2] was %s", argv [2]);
+ if (error != NULL)
+ return FAILED ("21. error is not null");
+
+ g_strfreev (argv);
+ return OK;
+}
+
+RESULT
+test_shell_argv3 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola \"bola", &argc, &argv, &error);
+ if (ret)
+ return FAILED ("1. It should return FALSE");
+ if (argc != 0)
+ return FAILED ("2. argc was %d expected 0", argc);
+ if (argv != NULL)
+ return FAILED ("3. argv[0] was %s", argv [0]);
+ if (error == NULL)
+ return FAILED ("4. error is null");
+
+ /* Text ended before matching quote was found for ". (The text was 'hola "bola') */
+ g_error_free (error);
+ error = NULL;
+ ret = g_shell_parse_argv ("hola \\\"bola", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("5. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("6. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("18. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "\"bola"))
+ return FAILED ("18. argv[1] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("8. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ ret = g_shell_parse_argv ("hola \"\n\\'bola\"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("9. It should return TRUE. %s", error->message);
+ if (argc != 2)
+ return FAILED ("10. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("11. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "\n\\'bola"))
+ return FAILED ("12. argv[1] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("13. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ return OK;
+}
+
+// This was the 2.8 showstopper error
+RESULT
+test_shell_argv4 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+ char *str = "'/usr/bin/gnome-terminal' -e \"bash -c 'read -p \\\"Press any key to continue...\\\"
-n1;'\"";
+
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv (str, &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("1. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("2. argc was %d expected 3", argc);
+ if (argv == NULL)
+ return FAILED ("3. argv[0] was NULL");
+ if (error != NULL)
+ return FAILED ("4. error was set");
+
+ if (strcmp (argv [0], "/usr/bin/gnome-terminal"))
+ return FAILED ("5. Expected /usr/bin/gnome-terminal got %s", argv [0]);
+ if (strcmp (argv [1], "-e"))
+ return FAILED ("6. Expected -e, got: %s", argv [1]);
+ if (strcmp (argv [2], "bash -c 'read -p \"Press any key to continue...\" -n1;'"))
+ return FAILED ("7. Got unexpected result: %s\n", argv [2]);
+
+ return OK;
+}
+
+// This is https://bugzilla.novell.com/show_bug.cgi?id=655896
+RESULT
+test_shell_argv5 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+ char *str = "echo \"foo\",\"bar\"";
+
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv (str, &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("1. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("2. argc was %d expected 2", argc);
+ if (argv == NULL)
+ return FAILED ("3. argv[0] was NULL");
+ if (error != NULL)
+ return FAILED ("4. error was set");
+
+ if (strcmp (argv [0], "echo"))
+ return FAILED ("5. Expected echo got %s", argv [0]);
+ if (strcmp (argv [1], "foo,bar"))
+ return FAILED ("6. Expected foo,bar, got: %s", argv [1]);
+
+ return OK;
+}
+
+RESULT
+test_quote ()
+{
+ if (strcmp (g_shell_quote ("foo"), "'foo'"))
+ return FAILED ("Should return 'foo'");
+
+ if (strcmp (g_shell_quote ("foo'bar"), "'foo'\\''bar'"))
+ return FAILED ("Should return 'foo'\\''bar'");
+
+ if (strcmp (g_shell_quote ("foo bar"), "'foo bar'"))
+ return FAILED ("Should return 'foo bar'");
+ return OK;
+}
+
+static Test shell_tests [] = {
+ {"test_shell_argv1", test_shell_argv1},
+ {"test_shell_argv2", test_shell_argv2},
+ {"test_shell_argv3", test_shell_argv3},
+ {"test_shell_argv4", test_shell_argv4},
+ {"test_shell_argv5", test_shell_argv5},
+ {"g_shell_quote", test_quote},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(shell_tests_init, shell_tests)
+
diff --git a/deps/eglib/test/sizes.c b/deps/eglib/test/sizes.c
new file mode 100644
index 0000000..06ed8a5
--- /dev/null
+++ b/deps/eglib/test/sizes.c
@@ -0,0 +1,108 @@
+/*
+ * Tests to ensure that our type definitions are correct
+ *
+ * These depend on -Werror, -Wall being set to catch the build error.
+ */
+#include <stdio.h>
+#ifndef _MSC_VER
+#include <stdint.h>
+#endif
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+RESULT
+test_formats ()
+{
+ char buffer [1024];
+ gsize a = 1;
+
+ sprintf (buffer, "%" G_GSIZE_FORMAT, a);
+
+ return NULL;
+}
+
+RESULT
+test_ptrconv ()
+{
+ int iv, iv2;
+ unsigned int uv, uv2;
+ gpointer ptr;
+
+ iv = G_MAXINT32;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ iv = G_MININT32;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ iv = 1;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ iv = -1;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ iv = 0;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ uv = 0;
+ ptr = GUINT_TO_POINTER (uv);
+ uv2 = GPOINTER_TO_UINT (ptr);
+ if (uv != uv2)
+ return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
+
+ uv = 1;
+ ptr = GUINT_TO_POINTER (uv);
+ uv2 = GPOINTER_TO_UINT (ptr);
+ if (uv != uv2)
+ return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
+
+ uv = UINT32_MAX;
+ ptr = GUINT_TO_POINTER (uv);
+ uv2 = GPOINTER_TO_UINT (ptr);
+ if (uv != uv2)
+ return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
+
+ return NULL;
+
+}
+
+typedef struct {
+ int a;
+ int b;
+} my_struct;
+
+RESULT
+test_offset ()
+{
+ if (G_STRUCT_OFFSET (my_struct, a) != 0)
+ return FAILED ("offset of a is not zero");
+
+ if (G_STRUCT_OFFSET (my_struct, b) != 4 && G_STRUCT_OFFSET (my_struct, b) != 8)
+ return FAILED ("offset of b is 4 or 8, macro might be busted");
+
+ return OK;
+}
+
+static Test size_tests [] = {
+ {"formats", test_formats},
+ {"ptrconv", test_ptrconv},
+ {"g_struct_offset", test_offset},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(size_tests_init, size_tests)
diff --git a/deps/eglib/test/slist.c b/deps/eglib/test/slist.c
new file mode 100644
index 0000000..3f8360e
--- /dev/null
+++ b/deps/eglib/test/slist.c
@@ -0,0 +1,345 @@
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+
+RESULT
+test_slist_nth ()
+{
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+ GSList *nth, *list;
+ list = g_slist_prepend (NULL, baz);
+ list = g_slist_prepend (list, bar);
+ list = g_slist_prepend (list, foo);
+
+ nth = g_slist_nth (list, 0);
+ if (nth->data != foo)
+ return FAILED ("nth failed. #0");
+
+ nth = g_slist_nth (list, 1);
+ if (nth->data != bar)
+ return FAILED ("nth failed. #1");
+
+ nth = g_slist_nth (list, 2);
+ if (nth->data != baz)
+ return FAILED ("nth failed. #2");
+
+ nth = g_slist_nth (list, 3);
+ if (nth)
+ return FAILED ("nth failed. #3: %s", nth->data);
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_index ()
+{
+ int i;
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+ GSList *list;
+ list = g_slist_prepend (NULL, baz);
+ list = g_slist_prepend (list, bar);
+ list = g_slist_prepend (list, foo);
+
+ i = g_slist_index (list, foo);
+ if (i != 0)
+ return FAILED ("index failed. #0: %d", i);
+
+ i = g_slist_index (list, bar);
+ if (i != 1)
+ return FAILED ("index failed. #1: %d", i);
+
+ i = g_slist_index (list, baz);
+ if (i != 2)
+ return FAILED ("index failed. #2: %d", i);
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_append ()
+{
+ GSList *foo;
+ GSList *list = g_slist_append (NULL, "first");
+ if (g_slist_length (list) != 1)
+ return FAILED ("append(null,...) failed");
+
+ foo = g_slist_append (list, "second");
+ if (foo != list)
+ return FAILED ("changed list head on non-empty");
+
+ if (g_slist_length (list) != 2)
+ return FAILED ("Append failed");
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_concat ()
+{
+ GSList *foo = g_slist_prepend (NULL, "foo");
+ GSList *bar = g_slist_prepend (NULL, "bar");
+
+ GSList *list = g_slist_concat (foo, bar);
+
+ if (g_slist_length (list) != 2)
+ return FAILED ("Concat failed.");
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_find ()
+{
+ GSList *list = g_slist_prepend (NULL, "three");
+ GSList *found;
+ char *data;
+
+ list = g_slist_prepend (list, "two");
+ list = g_slist_prepend (list, "one");
+
+ data = "four";
+ list = g_slist_append (list, data);
+
+ found = g_slist_find (list, data);
+
+ if (found->data != data)
+ return FAILED ("Find failed");
+
+ g_slist_free (list);
+ return OK;
+}
+
+static gint
+find_custom (gconstpointer a, gconstpointer b)
+{
+ return(strcmp (a, b));
+}
+
+RESULT
+test_slist_find_custom ()
+{
+ GSList *list = NULL, *found;
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+
+ list = g_slist_prepend (list, baz);
+ list = g_slist_prepend (list, bar);
+ list = g_slist_prepend (list, foo);
+
+ found = g_slist_find_custom (list, baz, find_custom);
+
+ if (found == NULL)
+ return FAILED ("Find failed");
+
+ g_slist_free (list);
+
+ return OK;
+}
+
+RESULT
+test_slist_remove ()
+{
+ GSList *list = g_slist_prepend (NULL, "three");
+ char *one = "one";
+ list = g_slist_prepend (list, "two");
+ list = g_slist_prepend (list, one);
+
+ list = g_slist_remove (list, one);
+
+ if (g_slist_length (list) != 2)
+ return FAILED ("Remove failed");
+
+ if (strcmp ("two", list->data) != 0)
+ return FAILED ("Remove failed");
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_remove_link ()
+{
+ GSList *foo = g_slist_prepend (NULL, "a");
+ GSList *bar = g_slist_prepend (NULL, "b");
+ GSList *baz = g_slist_prepend (NULL, "c");
+ GSList *list = foo;
+
+ foo = g_slist_concat (foo, bar);
+ foo = g_slist_concat (foo, baz);
+
+ list = g_slist_remove_link (list, bar);
+
+ if (g_slist_length (list) != 2)
+ return FAILED ("remove_link failed #1");
+
+ if (bar->next != NULL)
+ return FAILED ("remove_link failed #2");
+
+ g_slist_free (list);
+ g_slist_free (bar);
+
+ return OK;
+}
+
+static gint
+compare (gconstpointer a, gconstpointer b)
+{
+ char *foo = (char *) a;
+ char *bar = (char *) b;
+
+ if (strlen (foo) < strlen (bar))
+ return -1;
+
+ return 1;
+}
+
+RESULT
+test_slist_insert_sorted ()
+{
+ GSList *list = g_slist_prepend (NULL, "a");
+ list = g_slist_append (list, "aaa");
+
+ /* insert at the middle */
+ list = g_slist_insert_sorted (list, "aa", compare);
+ if (strcmp ("aa", list->next->data))
+ return FAILED("insert_sorted failed #1");
+
+ /* insert at the beginning */
+ list = g_slist_insert_sorted (list, "", compare);
+ if (strcmp ("", list->data))
+ return FAILED ("insert_sorted failed #2");
+
+ /* insert at the end */
+ list = g_slist_insert_sorted (list, "aaaa", compare);
+ if (strcmp ("aaaa", g_slist_last (list)->data))
+ return FAILED ("insert_sorted failed #3");
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_insert_before ()
+{
+ GSList *foo, *bar, *baz;
+
+ foo = g_slist_prepend (NULL, "foo");
+ foo = g_slist_insert_before (foo, NULL, "bar");
+ bar = g_slist_last (foo);
+
+ if (strcmp (bar->data, "bar"))
+ return FAILED ("1");
+
+ baz = g_slist_insert_before (foo, bar, "baz");
+ if (foo != baz)
+ return FAILED ("2");
+
+ if (strcmp (foo->next->data, "baz"))
+ return FAILED ("3: %s", foo->next->data);
+
+ g_slist_free (foo);
+ return OK;
+}
+
+#define N_ELEMS 100
+
+static int intcompare (gconstpointer p1, gconstpointer p2)
+{
+ return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
+}
+
+static gboolean verify_sort (GSList *list, int len)
+{
+ int prev = GPOINTER_TO_INT (list->data);
+ len--;
+ for (list = list->next; list; list = list->next) {
+ int curr = GPOINTER_TO_INT (list->data);
+ if (prev > curr)
+ return FALSE;
+ prev = curr;
+
+ if (len == 0)
+ return FALSE;
+ len--;
+ }
+ return len == 0;
+}
+
+RESULT
+test_slist_sort ()
+{
+ int i, j, mul;
+ GSList *list = NULL;
+
+ for (i = 0; i < N_ELEMS; ++i)
+ list = g_slist_prepend (list, GINT_TO_POINTER (i));
+ list = g_slist_sort (list, intcompare);
+ if (!verify_sort (list, N_ELEMS))
+ return FAILED ("decreasing list");
+
+ g_slist_free (list);
+
+ list = NULL;
+ for (i = 0; i < N_ELEMS; ++i)
+ list = g_slist_prepend (list, GINT_TO_POINTER (-i));
+ list = g_slist_sort (list, intcompare);
+ if (!verify_sort (list, N_ELEMS))
+ return FAILED ("increasing list");
+
+ g_slist_free (list);
+
+ list = g_slist_prepend (NULL, GINT_TO_POINTER (0));
+ for (i = 1; i < N_ELEMS; ++i) {
+ list = g_slist_prepend (list, GINT_TO_POINTER (-i));
+ list = g_slist_prepend (list, GINT_TO_POINTER (i));
+ }
+ list = g_slist_sort (list, intcompare);
+ if (!verify_sort (list, 2*N_ELEMS-1))
+ return FAILED ("alternating list");
+
+ g_slist_free (list);
+
+ list = NULL;
+ mul = 1;
+ for (i = 1; i < N_ELEMS; ++i) {
+ mul = -mul;
+ for (j = 0; j < i; ++j)
+ list = g_slist_prepend (list, GINT_TO_POINTER (mul * j));
+ }
+ list = g_slist_sort (list, intcompare);
+ if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
+ return FAILED ("wavering list");
+
+ g_slist_free (list);
+
+ return OK;
+}
+
+static Test slist_tests [] = {
+ {"nth", test_slist_nth},
+ {"index", test_slist_index},
+ {"append", test_slist_append},
+ {"concat", test_slist_concat},
+ {"find", test_slist_find},
+ {"find_custom", test_slist_find_custom},
+ {"remove", test_slist_remove},
+ {"remove_link", test_slist_remove_link},
+ {"insert_sorted", test_slist_insert_sorted},
+ {"insert_before", test_slist_insert_before},
+ {"sort", test_slist_sort},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(slist_tests_init, slist_tests)
+
diff --git a/deps/eglib/test/spawn.c b/deps/eglib/test/spawn.c
new file mode 100644
index 0000000..ec30fc8
--- /dev/null
+++ b/deps/eglib/test/spawn.c
@@ -0,0 +1,82 @@
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include "test.h"
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#define read _read
+#define close _close
+#endif
+
+RESULT
+test_spawn_sync ()
+{
+ gchar *out;
+ gchar *err;
+ gint status = -1;
+ GError *error = NULL;
+
+ if (!g_spawn_command_line_sync ("ls", &out, &err, &status, &error))
+ return FAILED ("Error executing 'ls'");
+
+ if (status != 0)
+ return FAILED ("Status is %d", status);
+
+ if (out == NULL || strlen (out) == 0)
+ return FAILED ("Didn't get any output from ls!?");
+
+ g_free (out);
+ g_free (err);
+ return OK;
+}
+
+RESULT
+test_spawn_async ()
+{
+ /*
+gboolean
+g_spawn_async_with_pipes (const gchar *working_directory,
+ gchar **argv,
+ gchar **envp,
+ GSpawnFlags flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ GPid *child_pid,
+ gint *standard_input,
+ gint *standard_output,
+ gint *standard_error,
+ GError **error) */
+ char *argv [15];
+ int stdout_fd = -1;
+ char buffer [512];
+ pid_t child_pid = 0;
+
+ memset (argv, 0, 15 * sizeof (char *));
+ argv [0] = "ls";
+ if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, NULL,
&stdout_fd, NULL, NULL))
+ return FAILED ("1 Failed to run ls");
+ if (child_pid == 0)
+ return FAILED ("2 child pid not returned");
+ if (stdout_fd == -1)
+ return FAILED ("3 out fd is -1");
+
+ while (read (stdout_fd, buffer, 512) > 0);
+ close (stdout_fd);
+
+ return OK;
+}
+
+static Test spawn_tests [] = {
+ {"g_shell_spawn_sync", test_spawn_sync},
+ {"g_shell_spawn_async_with_pipes", test_spawn_async},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(spawn_tests_init, spawn_tests)
+
+
diff --git a/deps/eglib/test/string-util.c b/deps/eglib/test/string-util.c
new file mode 100644
index 0000000..73efd13
--- /dev/null
+++ b/deps/eglib/test/string-util.c
@@ -0,0 +1,698 @@
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#include "test.h"
+
+/* This test is just to be used with valgrind */
+RESULT
+test_strfreev ()
+{
+ gchar **array = g_new (gchar *, 4);
+ array [0] = g_strdup ("one");
+ array [1] = g_strdup ("two");
+ array [2] = g_strdup ("three");
+ array [3] = NULL;
+
+ g_strfreev (array);
+ g_strfreev (NULL);
+
+ return OK;
+}
+
+RESULT
+test_concat ()
+{
+ gchar *x = g_strconcat ("Hello", ", ", "world", NULL);
+ if (strcmp (x, "Hello, world") != 0)
+ return FAILED("concat failed, got: %s", x);
+ g_free (x);
+ return OK;
+}
+
+RESULT
+test_split ()
+{
+ const gchar *to_split = "Hello world, how are we doing today?";
+ gint i;
+ gchar **v;
+
+ v= g_strsplit(to_split, " ", 0);
+
+ if(v == NULL) {
+ return FAILED("split failed, got NULL vector (1)");
+ }
+
+ for(i = 0; v[i] != NULL; i++);
+ if(i != 7) {
+ return FAILED("split failed, expected 7 tokens, got %d", i);
+ }
+
+ g_strfreev(v);
+
+ v = g_strsplit(to_split, ":", -1);
+ if(v == NULL) {
+ return FAILED("split failed, got NULL vector (2)");
+ }
+
+ for(i = 0; v[i] != NULL; i++);
+ if(i != 1) {
+ return FAILED("split failed, expected 1 token, got %d", i);
+ }
+
+ if(strcmp(v[0], to_split) != 0) {
+ return FAILED("expected vector[0] to be '%s' but it was '%s'",
+ to_split, v[0]);
+ }
+ g_strfreev(v);
+
+ v = g_strsplit ("", ":", 0);
+ if (v == NULL)
+ return FAILED ("g_strsplit returned NULL");
+ g_strfreev (v);
+
+ v = g_strsplit ("/home/miguel/dingus", "/", 0);
+ if (v [0][0] != 0)
+ return FAILED ("Got a non-empty first element");
+ g_strfreev (v);
+
+ v = g_strsplit ("appdomain1, Version=0.0.0.0, Culture=neutral", ",", 4);
+ if (strcmp (v [0], "appdomain1") != 0)
+ return FAILED ("Invalid value");
+
+ if (strcmp (v [1], " Version=0.0.0.0") != 0)
+ return FAILED ("Invalid value");
+
+ if (strcmp (v [2], " Culture=neutral") != 0)
+ return FAILED ("Invalid value");
+
+ if (v [3] != NULL)
+ return FAILED ("Expected only 3 elements");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 4);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 0");
+
+ if (strcmp (v [1], "defXghi") != 0)
+ return FAILED ("Invalid value 1");
+
+ if (strcmp (v [2], "jklYmno") != 0)
+ return FAILED ("Invalid value 2");
+
+ if (v [3] != NULL)
+ return FAILED ("Expected only 3 elements (1)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 2);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 3");
+
+ if (strcmp (v [1], "defXghiXYjklYmno") != 0)
+ return FAILED ("Invalid value 4");
+
+ if (v [2] != NULL)
+ return FAILED ("Expected only 2 elements (2)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("abcXYdefXghiXYjklYmnoXY", "XY", 3);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 5");
+
+ if (strcmp (v [1], "defXghi") != 0)
+ return FAILED ("Invalid value 6");
+
+ if (strcmp (v [2], "jklYmnoXY") != 0)
+ return FAILED ("Invalid value 7");
+
+ if (v [3] != NULL)
+ return FAILED ("Expected only 3 elements (3)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("abcXYXYXYdefXY", "XY", -1);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 8");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 9");
+
+ if (strcmp (v [2], "") != 0)
+ return FAILED ("Invalid value 10");
+
+ if (strcmp (v [3], "def") != 0)
+ return FAILED ("Invalid value 11");
+
+ if (strcmp (v [4], "") != 0)
+ return FAILED ("Invalid value 12");
+
+ if (v [5] != NULL)
+ return FAILED ("Expected only 5 elements (4)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("XYXYXYabcXYdef", "XY", -1);
+ if (strcmp (v [0], "") != 0)
+ return FAILED ("Invalid value 13");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 14");
+
+ if (strcmp (v [2], "") != 0)
+ return FAILED ("Invalid value 15");
+
+ if (strcmp (v [3], "abc") != 0)
+ return FAILED ("Invalid value 16");
+
+ if (strcmp (v [4], "def") != 0)
+ return FAILED ("Invalid value 17");
+
+ if (v [5] != NULL)
+ return FAILED ("Expected only 5 elements (5)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("value=", "=", 2);
+ if (strcmp (v [0], "value") != 0)
+ return FAILED ("Invalid value 18; expected 'value', got '%s'", v [0]);
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 19; expected '', got '%s'", v [1]);
+ if (v [2] != NULL)
+ return FAILED ("Expected only 2 elements (6)");
+
+ g_strfreev (v);
+
+ return OK;
+}
+
+RESULT
+test_split_set ()
+{
+ gchar **v;
+
+ v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 6);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 0");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 1");
+
+ if (strcmp (v [2], "def") != 0)
+ return FAILED ("Invalid value 2");
+
+ if (strcmp (v [3], "ghi") != 0)
+ return FAILED ("Invalid value 3");
+
+ if (strcmp (v [4], "") != 0)
+ return FAILED ("Invalid value 4");
+
+ if (strcmp (v [5], "jklYmno") != 0)
+ return FAILED ("Invalid value 5");
+
+ if (v [6] != NULL)
+ return FAILED ("Expected only 6 elements (1)");
+
+ g_strfreev (v);
+
+ v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 3);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 6");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 7");
+
+ if (strcmp (v [2], "defXghiXYjklYmno") != 0)
+ return FAILED ("Invalid value 8");
+
+ if (v [3] != NULL)
+ return FAILED ("Expected only 3 elements (2)");
+
+ g_strfreev (v);
+
+ v = g_strsplit_set ("abcXdefYghiXjklYmnoX", "XY", 5);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 9");
+
+ if (strcmp (v [1], "def") != 0)
+ return FAILED ("Invalid value 10");
+
+ if (strcmp (v [2], "ghi") != 0)
+ return FAILED ("Invalid value 11");
+
+ if (strcmp (v [3], "jkl") != 0)
+ return FAILED ("Invalid value 12");
+
+ if (strcmp (v [4], "mnoX") != 0)
+ return FAILED ("Invalid value 13");
+
+ if (v [5] != NULL)
+ return FAILED ("Expected only 5 elements (5)");
+
+ g_strfreev (v);
+
+ v = g_strsplit_set ("abcXYXdefXY", "XY", -1);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 14");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 15");
+
+ if (strcmp (v [2], "") != 0)
+ return FAILED ("Invalid value 16");
+
+ if (strcmp (v [3], "def") != 0)
+ return FAILED ("Invalid value 17");
+
+ if (strcmp (v [4], "") != 0)
+ return FAILED ("Invalid value 18");
+
+ if (strcmp (v [5], "") != 0)
+ return FAILED ("Invalid value 19");
+
+ if (v [6] != NULL)
+ return FAILED ("Expected only 6 elements (4)");
+
+ g_strfreev (v);
+
+ v = g_strsplit_set ("XYXabcXYdef", "XY", -1);
+ if (strcmp (v [0], "") != 0)
+ return FAILED ("Invalid value 20");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 21");
+
+ if (strcmp (v [2], "") != 0)
+ return FAILED ("Invalid value 22");
+
+ if (strcmp (v [3], "abc") != 0)
+ return FAILED ("Invalid value 23");
+
+ if (strcmp (v [4], "") != 0)
+ return FAILED ("Invalid value 24");
+
+ if (strcmp (v [5], "def") != 0)
+ return FAILED ("Invalid value 25");
+
+ if (v [6] != NULL)
+ return FAILED ("Expected only 6 elements (5)");
+
+ g_strfreev (v);
+
+ return OK;
+}
+
+RESULT
+test_strreverse ()
+{
+ RESULT res = OK;
+ gchar *a = g_strdup ("onetwothree");
+ gchar *a_target = "eerhtowteno";
+ gchar *b = g_strdup ("onetwothre");
+ gchar *b_target = "erhtowteno";
+ gchar *c = g_strdup ("");
+ gchar *c_target = "";
+
+ g_strreverse (a);
+ if (strcmp (a, a_target)) {
+ res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", a, a_target);
+ goto cleanup;
+ }
+
+ g_strreverse (b);
+ if (strcmp (b, b_target)) {
+ res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
+ goto cleanup;
+ }
+
+ g_strreverse (c);
+ if (strcmp (c, c_target)) {
+ res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
+ goto cleanup;
+ }
+
+cleanup:
+ g_free (c);
+ g_free (b);
+ g_free (a);
+ return res;
+}
+
+RESULT
+test_strjoin ()
+{
+ char *s;
+
+ s = g_strjoin (NULL, "a", "b", NULL);
+ if (strcmp (s, "ab") != 0)
+ return FAILED ("Join of two strings with no separator fails");
+ g_free (s);
+
+ s = g_strjoin ("", "a", "b", NULL);
+ if (strcmp (s, "ab") != 0)
+ return FAILED ("Join of two strings with empty separator fails");
+ g_free (s);
+
+ s = g_strjoin ("-", "a", "b", NULL);
+ if (strcmp (s, "a-b") != 0)
+ return FAILED ("Join of two strings with separator fails");
+ g_free (s);
+
+ s = g_strjoin ("-", "aaaa", "bbbb", "cccc", "dddd", NULL);
+ if (strcmp (s, "aaaa-bbbb-cccc-dddd") != 0)
+ return FAILED ("Join of multiple strings fails");
+ g_free (s);
+
+ s = g_strjoin ("-", NULL);
+ if (s == NULL || (strcmp (s, "") != 0))
+ return FAILED ("Failed to join empty arguments");
+ g_free (s);
+
+ return OK;
+}
+
+RESULT
+test_strchug ()
+{
+ char *str = g_strdup (" \t\n hola");
+
+ g_strchug (str);
+ if (strcmp ("hola", str)) {
+ fprintf (stderr, "%s\n", str);
+ g_free (str);
+ return FAILED ("Failed.");
+ }
+ g_free (str);
+ return OK;
+}
+
+RESULT
+test_strchomp ()
+{
+ char *str = g_strdup ("hola \t");
+
+ g_strchomp (str);
+ if (strcmp ("hola", str)) {
+ fprintf (stderr, "%s\n", str);
+ g_free (str);
+ return FAILED ("Failed.");
+ }
+ g_free (str);
+ return OK;
+}
+
+RESULT
+test_strstrip ()
+{
+ char *str = g_strdup (" \t hola ");
+
+ g_strstrip (str);
+ if (strcmp ("hola", str)) {
+ fprintf (stderr, "%s\n", str);
+ g_free (str);
+ return FAILED ("Failed.");
+ }
+ g_free (str);
+ return OK;
+}
+
+#define urit(so,j) do { s = g_filename_to_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got
%s expected %s", s, j); g_free (s); } while (0);
+
+#define errit(so) do { s = g_filename_to_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s,
expected NULL", s); } while (0);
+
+RESULT
+test_filename_to_uri ()
+{
+#ifdef G_OS_WIN32
+#else
+ char *s;
+
+ urit ("/a", "file:///a");
+ urit ("/home/miguel", "file:///home/miguel");
+ urit ("/home/mig uel", "file:///home/mig%20uel");
+ urit ("/\303\241", "file:///%C3%A1");
+ urit ("/\303\241/octal", "file:///%C3%A1/octal");
+ urit ("/%", "file:///%25");
+ urit
("/\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040",
"file:///%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20");
+ urit ("/!$&'()*+,-./", "file:///!$&'()*+,-./");
+ urit ("/\042\043\045", "file:///%22%23%25");
+ urit ("/0123456789:=", "file:///0123456789:=");
+ urit ("/\073\074\076\077", "file:///%3B%3C%3E%3F");
+ urit ("/\133\134\135\136_\140\173\174\175", "file:///%5B%5C%5D%5E_%60%7B%7C%7D");
+ urit ("/\173\174\175\176\177\200", "file:///%7B%7C%7D~%7F%80");
+ urit ("/@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"file:///@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+ errit ("a");
+ errit ("./hola");
+#endif
+
+ return OK;
+}
+
+#define fileit(so,j) do { s = g_filename_from_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return
FAILED("Got %s expected %s", s, j); g_free (s); } while (0);
+
+#define ferrit(so) do { s = g_filename_from_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s,
expected NULL", s); } while (0);
+
+RESULT
+test_filename_from_uri ()
+{
+#ifdef G_OS_WIN32
+#else
+ char *s;
+
+ fileit ("file:///a", "/a");
+ fileit ("file:///%41", "/A");
+ fileit ("file:///home/miguel", "/home/miguel");
+ fileit ("file:///home/mig%20uel", "/home/mig uel");
+ ferrit ("/a");
+ ferrit ("a");
+ ferrit ("file://a");
+ ferrit ("file:a");
+ ferrit ("file:///%");
+ ferrit ("file:///%0");
+ ferrit ("file:///%jj");
+#endif
+
+ return OK;
+}
+
+RESULT
+test_ascii_xdigit_value ()
+{
+ int i;
+ gchar j;
+
+ i = g_ascii_xdigit_value ('9' + 1);
+ if (i != -1)
+ return FAILED ("'9' + 1");
+ i = g_ascii_xdigit_value ('0' - 1);
+ if (i != -1)
+ return FAILED ("'0' - 1");
+ i = g_ascii_xdigit_value ('a' - 1);
+ if (i != -1)
+ return FAILED ("'a' - 1");
+ i = g_ascii_xdigit_value ('f' + 1);
+ if (i != -1)
+ return FAILED ("'f' + 1");
+ i = g_ascii_xdigit_value ('A' - 1);
+ if (i != -1)
+ return FAILED ("'A' - 1");
+ i = g_ascii_xdigit_value ('F' + 1);
+ if (i != -1)
+ return FAILED ("'F' + 1");
+
+ for (j = '0'; j < '9'; j++) {
+ int c = g_ascii_xdigit_value (j);
+ if (c != (j - '0'))
+ return FAILED ("Digits %c -> %d", j, c);
+ }
+ for (j = 'a'; j < 'f'; j++) {
+ int c = g_ascii_xdigit_value (j);
+ if (c != (j - 'a' + 10))
+ return FAILED ("Lower %c -> %d", j, c);
+ }
+ for (j = 'A'; j < 'F'; j++) {
+ int c = g_ascii_xdigit_value (j);
+ if (c != (j - 'A' + 10))
+ return FAILED ("Upper %c -> %d", j, c);
+ }
+ return OK;
+}
+
+RESULT
+test_strdelimit ()
+{
+ gchar *str;
+
+ str = g_strdup (G_STR_DELIMITERS);
+ str = g_strdelimit (str, NULL, 'a');
+ if (0 != strcmp ("aaaaaaa", str))
+ return FAILED ("All delimiters: '%s'", str);
+ g_free (str);
+ str = g_strdup ("hola");
+ str = g_strdelimit (str, "ha", '+');
+ if (0 != strcmp ("+ol+", str))
+ return FAILED ("2 delimiters: '%s'", str);
+ g_free (str);
+ return OK;
+}
+
+#define NUMBERS "0123456789"
+
+RESULT
+test_strlcpy ()
+{
+ const gchar *src = "onetwothree";
+ gchar *dest;
+ gsize i;
+
+ dest = g_malloc (strlen (src) + 1);
+ memset (dest, 0, strlen (src) + 1);
+ i = g_strlcpy (dest, src, (gsize)-1);
+ if (i != strlen (src))
+ return FAILED ("Test1 got %d", i);
+
+ if (0 != strcmp (dest, src))
+ return FAILED ("Src and dest not equal");
+
+ i = g_strlcpy (dest, src, 3);
+ if (i != strlen (src))
+ return FAILED ("Test1 got %d", i);
+ if (0 != strcmp (dest, "on"))
+ return FAILED ("Test2");
+
+ i = g_strlcpy (dest, src, 1);
+ if (i != strlen (src))
+ return FAILED ("Test3 got %d", i);
+ if (*dest != '\0')
+ return FAILED ("Test4");
+
+ i = g_strlcpy (dest, src, 12345);
+ if (i != strlen (src))
+ return FAILED ("Test4 got %d", i);
+ if (0 != strcmp (dest, src))
+ return FAILED ("Src and dest not equal 2");
+ g_free (dest);
+
+ /* This is a test for g_filename_from_utf8, even if it does not look like it */
+ dest = g_filename_from_utf8 (NUMBERS, strlen (NUMBERS), NULL, NULL, NULL);
+ if (0 != strcmp (dest, NUMBERS))
+ return FAILED ("problem [%s] and [%s]", dest, NUMBERS);
+ g_free (dest);
+
+ return OK;
+}
+
+RESULT
+test_strescape ()
+{
+ gchar *str;
+
+ str = g_strescape ("abc", NULL);
+ if (strcmp ("abc", str))
+ return FAILED ("#1");
+ str = g_strescape ("\t\b\f\n\r\\\"abc", NULL);
+ if (strcmp ("\\t\\b\\f\\n\\r\\\\\\\"abc", str))
+ return FAILED ("#2 %s", str);
+ str = g_strescape ("\001abc", NULL);
+ if (strcmp ("\\001abc", str))
+ return FAILED ("#3 %s", str);
+ str = g_strescape ("\001abc", "\001");
+ if (strcmp ("\001abc", str))
+ return FAILED ("#3 %s", str);
+ return OK;
+}
+
+RESULT
+test_ascii_strncasecmp ()
+{
+ int n;
+
+ n = g_ascii_strncasecmp ("123", "123", 1);
+ if (n != 0)
+ return FAILED ("Should have been 0");
+
+ n = g_ascii_strncasecmp ("423", "123", 1);
+ if (n != 3)
+ return FAILED ("Should have been 3, got %d", n);
+
+ n = g_ascii_strncasecmp ("123", "423", 1);
+ if (n != -3)
+ return FAILED ("Should have been -3, got %d", n);
+
+ n = g_ascii_strncasecmp ("1", "1", 10);
+ if (n != 0)
+ return FAILED ("Should have been 0, got %d", n);
+ return OK;
+}
+
+RESULT
+test_ascii_strdown ()
+{
+ const gchar *a = "~09+AaBcDeFzZ$0909EmPAbCdEEEEEZZZZAAA";
+ const gchar *b = "~09+aabcdefzz$0909empabcdeeeeezzzzaaa";
+ gchar *c;
+ gint n, l;
+
+ l = (gint)strlen (b);
+ c = g_ascii_strdown (a, l);
+ n = g_ascii_strncasecmp (b, c, l);
+
+ if (n != 0) {
+ g_free (c);
+ return FAILED ("Should have been 0, got %d", n);
+ }
+
+ g_free (c);
+ return OK;
+}
+
+RESULT
+test_strdupv ()
+{
+ gchar **one;
+ gchar **two;
+ gint len;
+
+ one = g_strdupv (NULL);
+ if (one)
+ return FAILED ("Should have been NULL");
+
+ one = g_malloc (sizeof (gchar *));
+ *one = NULL;
+ two = g_strdupv (one);
+ if (!two)
+ FAILED ("Should have been not NULL");
+ len = g_strv_length (two);
+ if (len)
+ FAILED ("Should have been 0");
+ g_strfreev (two);
+ g_strfreev (one);
+ return NULL;
+}
+
+static Test strutil_tests [] = {
+ {"g_strfreev", test_strfreev},
+ {"g_strconcat", test_concat},
+ {"g_strsplit", test_split},
+ {"g_strsplit_set", test_split_set},
+ {"g_strreverse", test_strreverse},
+ {"g_strjoin", test_strjoin},
+ {"g_strchug", test_strchug},
+ {"g_strchomp", test_strchomp},
+ {"g_strstrip", test_strstrip},
+ {"g_filename_to_uri", test_filename_to_uri},
+ {"g_filename_from_uri", test_filename_from_uri},
+ {"g_ascii_xdigit_value", test_ascii_xdigit_value},
+ {"g_strdelimit", test_strdelimit},
+ {"g_strlcpy", test_strlcpy},
+ {"g_strescape", test_strescape},
+ {"g_ascii_strncasecmp", test_ascii_strncasecmp },
+ {"g_ascii_strdown", test_ascii_strdown },
+ {"g_strdupv", test_strdupv },
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(strutil_tests_init, strutil_tests)
+
+
diff --git a/deps/eglib/test/string.c b/deps/eglib/test/string.c
new file mode 100644
index 0000000..02ad0ad
--- /dev/null
+++ b/deps/eglib/test/string.c
@@ -0,0 +1,237 @@
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#include "test.h"
+
+#define sfail(k,p) if (s->str [p] != k) { g_string_free (s,TRUE); return FAILED("Got %s, Failed at %d,
expected '%c'", s->str, p, k);}
+
+RESULT
+test_append_speed()
+{
+ GString *s = g_string_new("");
+ gint i;
+
+ for(i = 0; i < 1024; i++) {
+ g_string_append(s, "x");
+ }
+
+ if(strlen (s->str) != 1024) {
+ return FAILED("Incorrect string size, got: %s %d",
+ s->str, strlen(s->str));
+ }
+
+ g_string_free (s, TRUE);
+
+ return OK;
+}
+
+RESULT
+test_append_c_speed()
+{
+ GString *s = g_string_new("");
+ gint i;
+
+ for(i = 0; i < 1024; i++) {
+ g_string_append_c(s, 'x');
+ }
+
+ if(strlen(s->str) != 1024) {
+ return FAILED("Incorrect string size, got: %s %d", s->str,
+ strlen(s->str));
+ }
+
+ g_string_free(s, TRUE);
+
+ return OK;
+}
+
+RESULT
+test_gstring ()
+{
+ GString *s = g_string_new_len ("My stuff", 2);
+ char *ret;
+ int i;
+
+ if (strcmp (s->str, "My") != 0)
+ return "Expected only 'My' on the string";
+ g_string_free (s, TRUE);
+
+ s = g_string_new_len ("My\0\0Rest", 6);
+ if (s->str [2] != 0)
+ return "Null was not copied";
+ if (strcmp (s->str+4, "Re") != 0){
+ return "Did not find the 'Re' part";
+ }
+
+ g_string_append (s, "lalalalalalalalalalalalalalalalalalalalalalal");
+ if (s->str [2] != 0)
+ return "Null as not copied";
+ if (strncmp (s->str+4, "Relala", 6) != 0){
+ return FAILED("Did not copy correctly, got: %s", s->str+4);
+ }
+
+ g_string_free (s, TRUE);
+
+ s = g_string_new ("");
+ for (i = 0; i < 1024; i++){
+ g_string_append_c (s, 'x');
+ }
+ if (strlen (s->str) != 1024){
+ return FAILED("Incorrect string size, got: %s %d\n", s->str, strlen (s->str));
+ }
+ g_string_free (s, TRUE);
+
+ s = g_string_new ("hola");
+ g_string_sprintfa (s, "%s%d", ", bola", 5);
+ if (strcmp (s->str, "hola, bola5") != 0){
+ return FAILED("Incorrect data, got: %s\n", s->str);
+ }
+ g_string_free (s, TRUE);
+
+ s = g_string_new ("Hola");
+ g_string_printf (s, "Dingus");
+
+ /* Test that it does not release it */
+ ret = g_string_free (s, FALSE);
+ g_free (ret);
+
+ s = g_string_new_len ("H" "\000" "H", 3);
+ g_string_append_len (s, "1" "\000" "2", 3);
+ sfail ('H', 0);
+ sfail ( 0, 1);
+ sfail ('H', 2);
+ sfail ('1', 3);
+ sfail ( 0, 4);
+ sfail ('2', 5);
+ g_string_free (s, TRUE);
+
+ return OK;
+}
+
+RESULT
+test_sized ()
+{
+ GString *s = g_string_sized_new (20);
+
+ if (s->str [0] != 0)
+ return FAILED ("Expected an empty string");
+ if (s->len != 0)
+ return FAILED ("Expected an empty len");
+
+ g_string_free (s, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_truncate ()
+{
+ GString *s = g_string_new ("0123456789");
+ g_string_truncate (s, 3);
+
+ if (strlen (s->str) != 3)
+ return FAILED ("size of string should have been 3, instead it is [%s]\n", s->str);
+ g_string_free (s, TRUE);
+
+ s = g_string_new ("a");
+ s = g_string_truncate (s, 10);
+ if (strlen (s->str) != 1)
+ return FAILED ("The size is not 1");
+ g_string_truncate (s, (gsize)-1);
+ if (strlen (s->str) != 1)
+ return FAILED ("The size is not 1");
+ g_string_truncate (s, 0);
+ if (strlen (s->str) != 0)
+ return FAILED ("The size is not 0");
+
+ g_string_free (s, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_prepend ()
+{
+ GString *s = g_string_new ("dingus");
+ g_string_prepend (s, "one");
+
+ if (strcmp (s->str, "onedingus") != 0)
+ return FAILED ("Failed, expected onedingus, got [%s]", s->str);
+
+ g_string_free (s, TRUE);
+
+ /* This is to force the code that where stuff does not fit in the allocated block */
+ s = g_string_sized_new (1);
+ g_string_prepend (s, "one");
+ if (strcmp (s->str, "one") != 0)
+ return FAILED ("Got erroneous result, expected [one] got [%s]", s->str);
+ g_string_free (s, TRUE);
+
+ /* This is to force the path where things fit */
+ s = g_string_new ("123123123123123123123123");
+ g_string_truncate (s, 1);
+ if (strcmp (s->str, "1") != 0)
+ return FAILED ("Expected [1] string, got [%s]", s->str);
+
+ g_string_prepend (s, "pre");
+ if (strcmp (s->str, "pre1") != 0)
+ return FAILED ("Expected [pre1], got [%s]", s->str);
+ g_string_free (s, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_appendlen ()
+{
+ GString *s = g_string_new ("");
+
+ g_string_append_len (s, "boo\000x", 0);
+ if (s->len != 0)
+ return FAILED ("The length is not zero %d", s->len);
+ g_string_append_len (s, "boo\000x", 5);
+ if (s->len != 5)
+ return FAILED ("The length is not five %d", s->len);
+ g_string_append_len (s, "ha", -1);
+ if (s->len != 7)
+ return FAILED ("The length is not seven %d", s->len);
+
+ g_string_free (s, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_macros ()
+{
+ char *s = g_strdup (G_STRLOC);
+ char *p = strchr (s + 2, ':');
+ int n;
+
+ if (p == NULL)
+ return FAILED ("Did not find a separator");
+ n = atoi (p+1);
+ if (n <= 0)
+ return FAILED ("did not find a valid line number");
+
+ *p = 0;
+ if (strcmp (s + strlen(s) - 8 , "string.c") != 0)
+ return FAILED ("This did not store the filename on G_STRLOC");
+
+ g_free (s);
+ return NULL;
+}
+
+static Test string_tests [] = {
+ {"append-speed", test_append_speed},
+ {"append_c-speed", test_append_c_speed},
+ {"ctor+append", test_gstring },
+ {"ctor+sized", test_sized },
+ {"truncate", test_truncate },
+ {"prepend", test_prepend },
+ {"append_len", test_appendlen },
+ {"macros", test_macros },
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(string_tests_init, string_tests)
diff --git a/deps/eglib/test/test-both b/deps/eglib/test/test-both
new file mode 100755
index 0000000..038c927
--- /dev/null
+++ b/deps/eglib/test/test-both
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+for arg in $@; do
+ if [ "x$arg" = "x--help" ]; then
+ echo "Usage: $0 [OPTION]... [ITERATIONS] [TESTGROUP]..."
+ echo ""
+ echo "Works the same as test-eglib or test-glib with the following"
+ echo "exception. Run test-eglib --help for details on normal testing"
+ echo ""
+ echo "If the first OPTION is --speed-compare, the following is"
+ echo "applicable to this program:"
+ echo ""
+ echo " --speed-compare run drivers in -qtni mode and report"
+ echo " speed comparison information"
+ echo ""
+ echo "After --speed-compare, the number of iterations "
+ echo "(optional, default is 100000) can be specified, followed "
+ echo "by specific tests to run (or none to run all)"
+ echo ""
+ echo "If --speed-compare is not the first argument, all arguments are"
+ echo "passed on directly to each driver"
+ echo ""
+ exit 1
+ fi
+done
+
+if [ ! -x "./test-glib" -o ! -x "./test-eglib" ]; then
+ make
+fi
+
+if [ "x$1" = "x--speed-compare" ]; then
+ ITERATIONS=100000
+ if [ ! -z "$2" ]; then
+ case $2 in
+ *[0-9]*) ITERATIONS=$2; break;
+ esac
+ fi
+
+ OPTIONS="-qnti $ITERATIONS"
+
+ for arg in $@; do
+ if [ "x$arg" = "x--speed-compare" ]; then
+ continue;
+ elif [ "$arg" = "$ITERATIONS" ]; then
+ continue;
+ fi
+
+ OPTIONS="$OPTIONS $arg"
+ done
+
+ echo "Running tests with $OPTIONS..."
+
+ GLIB=`./test-glib $OPTIONS`
+ EGLIB=`./test-eglib $OPTIONS`
+
+ # this blows
+ FASTER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 < $3) print $2; else print $4 }'`
+ FASTER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 < $2) print $1; else print $2 }'`
+ SLOWER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 > $3) print $2; else print $4 }'`
+ SLOWER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 > $2) print $1; else print $2 }'`
+
+ FASTER_PERCENTAGE=`echo "$SLOWER_SPEED $FASTER_SPEED" | awk '{ print ($1 / $2) * 100 }'`
+
+ echo "$FASTER_NAME $FASTER_SPEED"
+ echo "$SLOWER_NAME $SLOWER_SPEED"
+ echo "------------------------------------------------"
+ echo "$FASTER_NAME is $FASTER_PERCENTAGE% faster than $SLOWER_NAME"
+
+ exit 0;
+fi
+
+./test-eglib $@
+./test-glib $@
+
diff --git a/deps/eglib/test/test.c b/deps/eglib/test/test.c
new file mode 100644
index 0000000..6dd7bf4
--- /dev/null
+++ b/deps/eglib/test/test.c
@@ -0,0 +1,282 @@
+/*
+ * EGLib Unit Group/Test Runners
+ *
+ * Author:
+ * Aaron Bockover (abockover novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <glib.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#endif
+
+#include "test.h"
+
+extern gint global_passed, global_tests;
+
+#ifndef HAVE_VASPRINTF
+ /* systen does not provide a vasprintf function, use the one
+ provided within eglib itself */
+extern int vasprintf(char **ret, const char *format, va_list ap);
+#endif
+
+static gchar *last_result = NULL;
+
+gboolean
+run_test(Test *test, gchar **result_out)
+{
+ gchar *result;
+
+ if((result = test->handler()) == NULL) {
+ *result_out = NULL;
+ return TRUE;
+ } else {
+ *result_out = result;
+ return FALSE;
+ }
+}
+
+gboolean
+run_group(Group *group, gint iterations, gboolean quiet,
+ gboolean time, gchar *tests_to_run_s)
+{
+ Test *tests = group->handler();
+ gint i, j, passed = 0, total = 0;
+ gdouble start_time_group, start_time_test;
+ gchar **tests_to_run = NULL;
+
+ if(!quiet) {
+ if(iterations > 1) {
+ printf("[%s] (%dx)\n", group->name, iterations);
+ } else {
+ printf("[%s]\n", group->name);
+ }
+ }
+
+ if(tests_to_run_s != NULL) {
+ tests_to_run = eg_strsplit(tests_to_run_s, ",", -1);
+ }
+
+ start_time_group = get_timestamp();
+
+ for(i = 0; tests[i].name != NULL; i++) {
+ gchar *result = "";
+ gboolean iter_pass, run;
+
+ iter_pass = FALSE;
+ if(tests_to_run != NULL) {
+ gint j;
+ run = FALSE;
+ for(j = 0; tests_to_run[j] != NULL; j++) {
+ if(strcmp(tests_to_run[j], tests[i].name) == 0) {
+ run = TRUE;
+ break;
+ }
+ }
+ } else {
+ run = TRUE;
+ }
+
+ if(!run) {
+ continue;
+ }
+
+ total++;
+
+ if(!quiet) {
+ printf(" %s: ", tests[i].name);
+ }
+
+ start_time_test = get_timestamp();
+
+ for(j = 0; j < iterations; j++) {
+ iter_pass = run_test(&(tests[i]), &result);
+ if(!iter_pass) {
+ break;
+ }
+ }
+
+ if(iter_pass) {
+ passed++;
+ if(!quiet) {
+ if(time) {
+ printf("OK (%g)\n", get_timestamp() - start_time_test);
+ } else {
+ printf("OK\n");
+ }
+ }
+ } else {
+ if(!quiet) {
+ printf("FAILED (%s)\n", result);
+ }
+
+ if(last_result == result) {
+ last_result = NULL;
+ g_free(result);
+ }
+ }
+ }
+
+ global_passed += passed;
+ global_tests += total;
+
+ if(!quiet) {
+ gdouble pass_percentage = ((gdouble)passed / (gdouble)total) * 100.0;
+ if(time) {
+ printf(" %d / %d (%g%%, %g)\n", passed, total,
+ pass_percentage, get_timestamp() - start_time_group);
+ } else {
+ printf(" %d / %d (%g%%)\n", passed, total, pass_percentage);
+ }
+ }
+
+ if(tests_to_run != NULL) {
+ eg_strfreev(tests_to_run);
+ }
+
+ return passed == total;
+}
+
+RESULT
+FAILED(const gchar *format, ...)
+{
+ gchar *ret;
+ va_list args;
+ gint n;
+
+#if !defined(HAVE_VASPRINTF) && !defined(_EGLIB_MAJOR)
+ /* We are linked against the real glib, no vasprintf */
+ g_assert_not_reached ();
+ return NULL;
+#else
+ va_start(args, format);
+ n = vasprintf(&ret, format, args);
+ va_end(args);
+
+ if(n == -1) {
+ last_result = NULL;
+ return NULL;
+ }
+
+ last_result = ret;
+ return ret;
+#endif
+}
+
+gdouble
+get_timestamp()
+{
+ /* FIXME: We should use g_get_current_time here */
+ GTimeVal res;
+ g_get_current_time (&res);
+ return res.tv_sec + (1.e-6) * res.tv_usec;
+}
+
+/*
+ * Duplicating code here from EGlib to avoid g_strsplit skew between
+ * EGLib and GLib
+ */
+
+gchar **
+eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
+{
+ gchar *string_c;
+ gchar *strtok_save, **vector;
+ gchar *token, *token_c;
+ gint size = 1;
+ size_t token_length;
+
+ g_return_val_if_fail(string != NULL, NULL);
+ g_return_val_if_fail(delimiter != NULL, NULL);
+ g_return_val_if_fail(delimiter[0] != 0, NULL);
+
+ token_length = strlen(string);
+ string_c = (gchar *)g_malloc(token_length + 1);
+ memcpy(string_c, string, token_length);
+ string_c[token_length] = 0;
+
+ vector = NULL;
+ token = (gchar *)strtok_r(string_c, delimiter, &strtok_save);
+
+ while(token != NULL) {
+ token_length = strlen(token);
+ token_c = (gchar *)g_malloc(token_length + 1);
+ memcpy(token_c, token, token_length);
+ token_c[token_length] = 0;
+
+ vector = vector == NULL ?
+ (gchar **)g_malloc(2 * sizeof(vector)) :
+ (gchar **)g_realloc(vector, (size + 1) * sizeof(vector));
+
+ vector[size - 1] = token_c;
+ size++;
+
+ if(max_tokens > 0 && size >= max_tokens) {
+ if(size > max_tokens) {
+ break;
+ }
+
+ token = strtok_save;
+ } else {
+ token = (gchar *)strtok_r(NULL, delimiter, &strtok_save);
+ }
+ }
+
+ if(vector != NULL && size > 0) {
+ vector[size - 1] = NULL;
+ }
+
+ g_free(string_c);
+ string_c = NULL;
+
+ return vector;
+}
+
+void
+eg_strfreev (gchar **str_array)
+{
+ gchar **orig = str_array;
+ if (str_array == NULL)
+ return;
+ while (*str_array != NULL){
+ g_free (*str_array);
+ str_array++;
+ }
+ g_free (orig);
+}
+
+
+
diff --git a/deps/eglib/test/test.h b/deps/eglib/test/test.h
new file mode 100644
index 0000000..5c7275e
--- /dev/null
+++ b/deps/eglib/test/test.h
@@ -0,0 +1,82 @@
+/*
+ * EGLib Unit Group/Test Runners
+ *
+ * Author:
+ * Aaron Bockover (abockover novell com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _TEST_H
+#define _TEST_H
+
+#include <config.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+
+#ifdef _MSC_VER
+/* disable the following warnings
+ * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is
ignored.
+ * C4127: conditional expression is constant (test macros produce a lot of these)
+*/
+#pragma warning(disable:4100 4127)
+#endif
+
+typedef gchar * RESULT;
+
+typedef struct _Test Test;
+typedef struct _Group Group;
+
+typedef gchar * (* RunTestHandler)();
+typedef Test * (* LoadGroupHandler)();
+
+struct _Test {
+ const gchar *name;
+ RunTestHandler handler;
+};
+
+struct _Group {
+ const gchar *name;
+ LoadGroupHandler handler;
+};
+
+gboolean run_group(Group *group, gint iterations, gboolean quiet,
+ gboolean time, gchar *tests);
+#undef FAILED
+RESULT FAILED(const gchar *format, ...);
+gdouble get_timestamp();
+gchar ** eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
+void eg_strfreev (gchar **str_array);
+
+#define OK NULL
+
+#define DEFINE_TEST_GROUP_INIT(name, table) \
+ Test * (name)() { return table; }
+
+#define DEFINE_TEST_GROUP_INIT_H(name) \
+ Test * (name)();
+
+#endif /* _TEST_H */
+
+
diff --git a/deps/eglib/test/tests.h b/deps/eglib/test/tests.h
new file mode 100644
index 0000000..fdca395
--- /dev/null
+++ b/deps/eglib/test/tests.h
@@ -0,0 +1,57 @@
+#include "test.h"
+
+DEFINE_TEST_GROUP_INIT_H(string_tests_init);
+DEFINE_TEST_GROUP_INIT_H(strutil_tests_init);
+DEFINE_TEST_GROUP_INIT_H(slist_tests_init);
+DEFINE_TEST_GROUP_INIT_H(list_tests_init);
+DEFINE_TEST_GROUP_INIT_H(hashtable_tests_init);
+DEFINE_TEST_GROUP_INIT_H(ptrarray_tests_init);
+DEFINE_TEST_GROUP_INIT_H(size_tests_init);
+DEFINE_TEST_GROUP_INIT_H(fake_tests_init);
+DEFINE_TEST_GROUP_INIT_H(array_tests_init);
+DEFINE_TEST_GROUP_INIT_H(queue_tests_init);
+DEFINE_TEST_GROUP_INIT_H(path_tests_init);
+DEFINE_TEST_GROUP_INIT_H(shell_tests_init);
+DEFINE_TEST_GROUP_INIT_H(spawn_tests_init);
+DEFINE_TEST_GROUP_INIT_H(timer_tests_init);
+DEFINE_TEST_GROUP_INIT_H(file_tests_init);
+DEFINE_TEST_GROUP_INIT_H(pattern_tests_init);
+DEFINE_TEST_GROUP_INIT_H(dir_tests_init);
+DEFINE_TEST_GROUP_INIT_H(markup_tests_init);
+DEFINE_TEST_GROUP_INIT_H(unicode_tests_init);
+DEFINE_TEST_GROUP_INIT_H(utf8_tests_init);
+DEFINE_TEST_GROUP_INIT_H(endian_tests_init);
+DEFINE_TEST_GROUP_INIT_H(module_tests_init);
+DEFINE_TEST_GROUP_INIT_H(memory_tests_init);
+
+static Group test_groups [] = {
+ {"string", string_tests_init},
+ {"strutil", strutil_tests_init},
+ {"ptrarray", ptrarray_tests_init},
+ {"slist", slist_tests_init},
+ {"list", list_tests_init},
+ {"hashtable", hashtable_tests_init},
+ {"sizes", size_tests_init},
+ {"fake", fake_tests_init},
+ {"array", array_tests_init},
+ {"queue", queue_tests_init},
+ {"path", path_tests_init},
+ {"shell", shell_tests_init},
+ {"markup", markup_tests_init},
+#if !DISABLE_PROCESS_TESTS
+ {"spawn", spawn_tests_init},
+ {"module", module_tests_init},
+#endif
+#if !DISABLE_FILESYSTEM_TESTS
+ {"file", file_tests_init},
+#endif
+ {"timer", timer_tests_init},
+ {"pattern", pattern_tests_init},
+ {"dir", dir_tests_init},
+ {"unicode", unicode_tests_init},
+ {"utf8", utf8_tests_init},
+ {"endian", endian_tests_init},
+ {"memory", memory_tests_init},
+ {NULL, NULL}
+};
+
diff --git a/deps/eglib/test/timer.c b/deps/eglib/test/timer.c
new file mode 100644
index 0000000..7b41f80
--- /dev/null
+++ b/deps/eglib/test/timer.c
@@ -0,0 +1,55 @@
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <math.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef G_OS_WIN32
+#include <windows.h>
+#define sleep(t) Sleep((t) * 1000)
+#endif
+
+#include "test.h"
+
+RESULT
+test_timer ()
+{
+ GTimer *timer;
+ gdouble elapsed1, elapsed2;
+ gulong usec = 0;
+
+ timer = g_timer_new ();
+ sleep (1);
+ elapsed1 = g_timer_elapsed (timer, NULL);
+ if ((elapsed1 + 0.1) < 1.0)
+ return FAILED ("Elapsed time should be around 1s and was %f", elapsed1);
+
+ g_timer_stop (timer);
+ elapsed1 = g_timer_elapsed (timer, NULL);
+ elapsed2 = g_timer_elapsed (timer, &usec);
+ if (fabs (elapsed1 - elapsed2) > 0.000001)
+ return FAILED ("The elapsed times are not equal %f - %f.", elapsed1, elapsed2);
+
+ elapsed2 *= 1000000;
+ while (elapsed2 > 1000000)
+ elapsed2 -= 1000000;
+
+ if (fabs (usec - elapsed2) > 100.0)
+ return FAILED ("usecs are wrong.");
+
+ g_timer_destroy (timer);
+ return OK;
+}
+
+static Test timer_tests [] = {
+ {"g_timer", test_timer},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(timer_tests_init, timer_tests)
+
+
diff --git a/deps/eglib/test/unicode.c b/deps/eglib/test/unicode.c
new file mode 100644
index 0000000..c1c3402
--- /dev/null
+++ b/deps/eglib/test/unicode.c
@@ -0,0 +1,99 @@
+#include "test.h"
+
+/*
+ * g_unichar_type
+ */
+RESULT
+test_g_unichar_type ()
+{
+ if (g_unichar_type ('A') != G_UNICODE_UPPERCASE_LETTER)
+ return FAILED ("#1");
+ if (g_unichar_type ('a') != G_UNICODE_LOWERCASE_LETTER)
+ return FAILED ("#2");
+ if (g_unichar_type ('1') != G_UNICODE_DECIMAL_NUMBER)
+ return FAILED ("#3");
+ if (g_unichar_type (0xA3) != G_UNICODE_CURRENCY_SYMBOL)
+ return FAILED ("#4");
+ return NULL;
+}
+
+/*
+ * g_unichar_toupper
+ */
+RESULT
+test_g_unichar_toupper ()
+{
+ if (g_unichar_toupper (0) != 0)
+ return FAILED ("#0");
+ if (g_unichar_toupper ('a') != 'A')
+ return FAILED ("#1");
+ if (g_unichar_toupper ('1') != '1')
+ return FAILED ("#2");
+ if (g_unichar_toupper (0x1C4) != 0x1C4)
+ return FAILED ("#3");
+ if (g_unichar_toupper (0x1F2) != 0x1F1)
+ return FAILED ("#4");
+ if (g_unichar_toupper (0x1F3) != 0x1F1)
+ return FAILED ("#5");
+ if (g_unichar_toupper (0xFFFF) != 0xFFFF)
+ return FAILED ("#6");
+ if (g_unichar_toupper (0x10428) != 0x10400)
+ return FAILED ("#7");
+ return NULL;
+}
+
+/*
+ * g_unichar_tolower
+ */
+RESULT
+test_g_unichar_tolower ()
+{
+ if (g_unichar_tolower (0) != 0)
+ return FAILED ("#0");
+ if (g_unichar_tolower ('A') != 'a')
+ return FAILED ("#1");
+ if (g_unichar_tolower ('1') != '1')
+ return FAILED ("#2");
+ if (g_unichar_tolower (0x1C5) != 0x1C6)
+ return FAILED ("#3");
+ if (g_unichar_tolower (0x1F1) != 0x1F3)
+ return FAILED ("#4");
+ if (g_unichar_tolower (0x1F2) != 0x1F3)
+ return FAILED ("#5");
+ if (g_unichar_tolower (0xFFFF) != 0xFFFF)
+ return FAILED ("#6");
+ return NULL;
+}
+
+/*
+ * g_unichar_totitle
+ */
+RESULT
+test_g_unichar_totitle ()
+{
+ if (g_unichar_toupper (0) != 0)
+ return FAILED ("#0");
+ if (g_unichar_totitle ('a') != 'A')
+ return FAILED ("#1");
+ if (g_unichar_totitle ('1') != '1')
+ return FAILED ("#2");
+ if (g_unichar_totitle (0x1C4) != 0x1C5)
+ return FAILED ("#3");
+ if (g_unichar_totitle (0x1F2) != 0x1F2)
+ return FAILED ("#4");
+ if (g_unichar_totitle (0x1F3) != 0x1F2)
+ return FAILED ("#5");
+ if (g_unichar_toupper (0xFFFF) != 0xFFFF)
+ return FAILED ("#6");
+ return NULL;
+}
+
+static Test unicode_tests [] = {
+ {"g_unichar_type", test_g_unichar_type},
+ {"g_unichar_toupper", test_g_unichar_toupper},
+ {"g_unichar_tolower", test_g_unichar_tolower},
+ {"g_unichar_totitle", test_g_unichar_totitle},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(unicode_tests_init, unicode_tests)
diff --git a/deps/eglib/test/utf8.c b/deps/eglib/test/utf8.c
new file mode 100644
index 0000000..a924902
--- /dev/null
+++ b/deps/eglib/test/utf8.c
@@ -0,0 +1,935 @@
+#include <stdlib.h>
+
+#include "test.h"
+
+/*
+ * g_utf16_to_utf8
+ */
+
+glong
+compare_strings_utf8_pos (const gchar *expected, const gchar *actual, glong size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ if (expected [i] != actual [i])
+ return i;
+ return -1;
+}
+
+RESULT
+compare_strings_utf8_RESULT (const gchar *expected, const gchar *actual, glong size)
+{
+ glong ret;
+
+ ret = compare_strings_utf8_pos (expected, actual, size);
+ if (ret < 0)
+ return OK;
+ return FAILED ("Incorrect output: expected '%s' but was '%s', differ at %d\n", expected, actual, ret);
+}
+
+void
+gchar_to_gunichar2 (gunichar2 ret[], const gchar *src)
+{
+ int i;
+
+ for (i = 0; src [i]; i++)
+ ret [i] = src [i];
+ ret [i] = 0;
+}
+
+RESULT
+compare_utf16_to_utf8_explicit (const gchar *expected, const gunichar2 *utf16, glong len_in, glong len_out,
glong size_spec)
+{
+ GError *error;
+ gchar* ret;
+ RESULT result;
+ glong in_read, out_read;
+
+ result = NULL;
+
+ error = NULL;
+ ret = g_utf16_to_utf8 (utf16, size_spec, &in_read, &out_read, &error);
+ if (error) {
+ result = FAILED ("The error is %d %s\n", (error)->code, (error)->message);
+ g_error_free (error);
+ if (ret)
+ g_free (ret);
+ return result;
+ }
+ if (in_read != len_in)
+ result = FAILED ("Read size is incorrect: expected %d but was %d\n", len_in, in_read);
+ else if (out_read != len_out)
+ result = FAILED ("Converted size is incorrect: expected %d but was %d\n", len_out, out_read);
+ else
+ result = compare_strings_utf8_RESULT (expected, ret, len_out);
+
+ g_free (ret);
+ if (result)
+ return result;
+
+ return OK;
+}
+
+RESULT
+compare_utf16_to_utf8 (const gchar *expected, const gunichar2 *utf16, glong len_in, glong len_out)
+{
+ RESULT result;
+
+ result = compare_utf16_to_utf8_explicit (expected, utf16, len_in, len_out, -1);
+ if (result != OK)
+ return result;
+ return compare_utf16_to_utf8_explicit (expected, utf16, len_in, len_out, len_in);
+}
+
+RESULT
+test_utf16_to_utf8 ()
+{
+ const gchar *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 =
"\xEF\xBD\x81", *src5 = "\xF0\x90\x90\x80";
+ gunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] =
{0xFF41, 0}, str5 [] = {0xD801, 0xDC00, 0};
+ RESULT result;
+
+ gchar_to_gunichar2 (str1, src1);
+
+ /* empty string */
+ result = compare_utf16_to_utf8 (src0, str0, 0, 0);
+ if (result != OK)
+ return result;
+
+ result = compare_utf16_to_utf8 (src1, str1, 5, 5);
+ if (result != OK)
+ return result;
+ result = compare_utf16_to_utf8 (src2, str2, 2, 4);
+ if (result != OK)
+ return result;
+ result = compare_utf16_to_utf8 (src3, str3, 1, 3);
+ if (result != OK)
+ return result;
+ result = compare_utf16_to_utf8 (src4, str4, 1, 3);
+ if (result != OK)
+ return result;
+ result = compare_utf16_to_utf8 (src5, str5, 2, 4);
+ if (result != OK)
+ return result;
+
+ return OK;
+}
+
+/*
+ * g_utf8_to_utf16
+ */
+
+glong
+compare_strings_utf16_pos (const gunichar2 *expected, const gunichar2 *actual, glong size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ if (expected [i] != actual [i])
+ return i;
+ return -1;
+}
+
+RESULT
+compare_strings_utf16_RESULT (const gunichar2 *expected, const gunichar2 *actual, glong size)
+{
+ glong ret;
+
+ ret = compare_strings_utf16_pos (expected, actual, size);
+ if (ret < 0)
+ return OK;
+ return FAILED ("Incorrect output: expected '%s' but was '%s', differ at %d ('%c' x '%c')\n",
expected, actual, ret, expected [ret], actual [ret]);
+}
+
+#if !defined(EGLIB_TESTS)
+#define eg_utf8_to_utf16_with_nuls g_utf8_to_utf16
+#endif
+
+RESULT
+compare_utf8_to_utf16_explicit (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out,
glong size_spec, gboolean include_nuls)
+{
+ GError *error;
+ gunichar2* ret;
+ RESULT result;
+ glong in_read, out_read;
+
+ result = NULL;
+
+ error = NULL;
+ if (include_nuls)
+ ret = eg_utf8_to_utf16_with_nuls (utf8, size_spec, &in_read, &out_read, &error);
+ else
+ ret = g_utf8_to_utf16 (utf8, size_spec, &in_read, &out_read, &error);
+
+ if (error) {
+ result = FAILED ("The error is %d %s\n", (error)->code, (error)->message);
+ g_error_free (error);
+ if (ret)
+ g_free (ret);
+ return result;
+ }
+ if (in_read != len_in)
+ result = FAILED ("Read size is incorrect: expected %d but was %d\n", len_in, in_read);
+ else if (out_read != len_out)
+ result = FAILED ("Converted size is incorrect: expected %d but was %d\n", len_out, out_read);
+ else
+ result = compare_strings_utf16_RESULT (expected, ret, len_out);
+
+ g_free (ret);
+ if (result)
+ return result;
+
+ return OK;
+}
+
+RESULT
+compare_utf8_to_utf16_general (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out,
gboolean include_nuls)
+{
+ RESULT result;
+
+ result = compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, -1, include_nuls);
+ if (result != OK)
+ return result;
+ return compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, len_in, include_nuls);
+}
+
+RESULT
+compare_utf8_to_utf16 (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out)
+{
+ return compare_utf8_to_utf16_general (expected, utf8, len_in, len_out, FALSE);
+}
+
+RESULT
+compare_utf8_to_utf16_with_nuls (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out)
+{
+ return compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, len_in, TRUE);
+}
+
+
+RESULT
+test_utf8_seq ()
+{
+ const gchar *src = "\xE5\xB9\xB4\x27";
+ glong in_read, out_read;
+ //gunichar2 expected [6];
+ GError *error = NULL;
+ gunichar2 *dst;
+
+ //printf ("got: %s\n", src);
+ dst = g_utf8_to_utf16 (src, (glong)strlen (src), &in_read, &out_read, &error);
+ if (error != NULL){
+ return error->message;
+ }
+
+ if (in_read != 4) {
+ return FAILED ("in_read is expected to be 4 but was %d\n", in_read);
+ }
+ if (out_read != 2) {
+ return FAILED ("out_read is expected to be 2 but was %d\n", out_read);
+ }
+ g_free (dst);
+
+ return OK;
+}
+
+RESULT
+test_utf8_to_utf16 ()
+{
+ const gchar *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 =
"\xEF\xBD\x81";
+ gunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] =
{0xFF41, 0};
+ RESULT result;
+
+ gchar_to_gunichar2 (str1, src1);
+
+ /* empty string */
+ result = compare_utf8_to_utf16 (str0, src0, 0, 0);
+ if (result != OK)
+ return result;
+
+ result = compare_utf8_to_utf16 (str1, src1, 5, 5);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16 (str2, src2, 4, 2);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16 (str3, src3, 3, 1);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16 (str4, src4, 3, 1);
+ if (result != OK)
+ return result;
+
+ return OK;
+}
+
+RESULT
+test_utf8_to_utf16_with_nuls ()
+{
+ const gchar *src0 = "", *src1 = "AB\0DE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 =
"\xEF\xBD\x81";
+ gunichar2 str0 [] = {0}, str1 [] = {'A', 'B', 0, 'D', 'E', 0}, str2 [] = {0x5E74, 39, 0}, str3 [] =
{0xFF21, 0}, str4 [] = {0xFF41, 0};
+ RESULT result;
+
+#if !defined(EGLIB_TESTS)
+ return OK;
+#endif
+
+ /* implicit length is forbidden */
+ if (eg_utf8_to_utf16_with_nuls (src1, -1, NULL, NULL, NULL) != NULL)
+ return FAILED ("explicit nulls must fail with -1 length\n");
+
+ /* empty string */
+ result = compare_utf8_to_utf16_with_nuls (str0, src0, 0, 0);
+ if (result != OK)
+ return result;
+
+ result = compare_utf8_to_utf16_with_nuls (str1, src1, 5, 5);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16_with_nuls (str2, src2, 4, 2);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16_with_nuls (str3, src3, 3, 1);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16_with_nuls (str4, src4, 3, 1);
+ if (result != OK)
+ return result;
+
+ return OK;
+}
+
+typedef struct {
+ char *content;
+ size_t length;
+} convert_result_t;
+
+RESULT
+test_convert ()
+{
+ static const char *charsets[] = { "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE" };
+ gsize length, converted_length, n;
+ char *content, *converted, *path;
+ convert_result_t **expected;
+ GError *err = NULL;
+ const char *srcdir;
+ gboolean loaded;
+ guint i, j, k;
+ char c;
+
+ if (!(srcdir = getenv ("srcdir")) && !(srcdir = getenv ("PWD")))
+ return FAILED ("srcdir not defined!");
+
+ expected = g_malloc (sizeof (convert_result_t *) * G_N_ELEMENTS (charsets));
+
+ /* first load all our test samples... */
+ for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
+ path = g_strdup_printf ("%s%c%s.txt", srcdir, G_DIR_SEPARATOR, charsets[i]);
+ loaded = g_file_get_contents (path, &content, &length, &err);
+ g_free (path);
+
+ if (!loaded) {
+ for (j = 0; j < i; j++) {
+ g_free (expected[j]->content);
+ g_free (expected[j]);
+ }
+
+ g_free (expected);
+
+ return FAILED ("Failed to load content for %s: %s", charsets[i], err->message);
+ }
+
+ expected[i] = g_malloc (sizeof (convert_result_t));
+ expected[i]->content = content;
+ expected[i]->length = length;
+ }
+
+ /* test conversion from every charset to every other charset */
+ for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
+ for (j = 0; j < G_N_ELEMENTS (charsets); j++) {
+ converted = g_convert (expected[i]->content, expected[i]->length, charsets[j],
+ charsets[i], NULL, &converted_length, NULL);
+
+ if (converted == NULL) {
+ for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
+ g_free (expected[k]->content);
+ g_free (expected[k]);
+ }
+
+ g_free (expected);
+
+ return FAILED ("Failed to convert from %s to %s: NULL", charsets[i],
charsets[j]);
+ }
+
+ if (converted_length != expected[j]->length) {
+ length = expected[j]->length;
+
+ for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
+ g_free (expected[k]->content);
+ g_free (expected[k]);
+ }
+
+ g_free (converted);
+ g_free (expected);
+
+ return FAILED ("Failed to convert from %s to %s: expected %u bytes, got %u",
+ charsets[i], charsets[j], length, converted_length);
+ }
+
+ for (n = 0; n < converted_length; n++) {
+ if (converted[n] != expected[j]->content[n]) {
+ c = expected[j]->content[n];
+
+ for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
+ g_free (expected[k]->content);
+ g_free (expected[k]);
+ }
+
+ g_free (converted);
+ g_free (expected);
+
+ return FAILED ("Failed to convert from %s to %s: expected 0x%x at
offset %u, got 0x%x",
+ charsets[i], charsets[j], c, n, converted[n]);
+ }
+ }
+
+ g_free (converted);
+ }
+ }
+
+ for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
+ g_free (expected[k]->content);
+ g_free (expected[k]);
+ }
+
+ g_free (expected);
+
+ return OK;
+}
+
+
+RESULT
+test_xdigit ()
+{
+ static char test_chars[] = {
+ '0', '1', '2', '3', '4',
+ '5', '6', '7', '8', '9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G'};
+ static gint32 test_values[] = {
+ 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, -1,
+ 10, 11, 12, 13, 14, 15, -1};
+
+ int i =0;
+
+ for (i = 0; i < sizeof(test_chars); i++)
+ if (g_unichar_xdigit_value ((gunichar)test_chars[i]) != test_values[i])
+ return FAILED("Incorrect value %d at index %d", test_values[i], i);
+
+ return OK;
+}
+
+static RESULT
+ucs4_to_utf16_check_result (const gunichar2 *result_str, const gunichar2 *expected_str,
+ glong result_items_read, glong expected_items_read,
+ glong result_items_written, glong expected_items_written,
+ GError* result_error, gboolean expect_error)
+{
+ glong i;
+ if (result_items_read != expected_items_read)
+ return FAILED("Incorrect number of items read; expected %d, got %d", expected_items_read,
result_items_read);
+ if (result_items_written != expected_items_written)
+ return FAILED("Incorrect number of items written; expected %d, got %d",
expected_items_written, result_items_written);
+ if (result_error && !expect_error)
+ return FAILED("There should not be an error code.");
+ if (!result_error && expect_error)
+ return FAILED("Unexpected error object.");
+ if (expect_error && result_str)
+ return FAILED("NULL should be returned when an error occurs.");
+ if (!expect_error && !result_str)
+ return FAILED("When no error occurs NULL should not be returned.");
+ for (i=0; i<expected_items_written;i++) {
+ if (result_str [i] != expected_str [i])
+ return FAILED("Incorrect value %d at index %d", result_str [i], i);
+ }
+ if (result_str && result_str[expected_items_written] != '\0')
+ return FAILED("Null termination not found at the end of the string.");
+
+ return OK;
+}
+
+RESULT
+test_ucs4_to_utf16 ()
+{
+ static gunichar str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+ static gunichar2 exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+ static gunichar str2[3] = {'h',0x80000000,'\0'};
+ static gunichar2 exp2[2] = {'h','\0'};
+ static gunichar str3[3] = {'h',0xDA00,'\0'};
+ static gunichar str4[3] = {'h',0x10FFFF,'\0'};
+ static gunichar2 exp4[4] = {'h',0xdbff,0xdfff,'\0'};
+ static gunichar str5[7] = {0xD7FF,0xD800,0xDFFF,0xE000,0x110000,0x10FFFF,'\0'};
+ static gunichar2 exp5[5] = {0xD7FF,0xE000,0xdbff,0xdfff,'\0'};
+ static gunichar str6[2] = {0x10400, '\0'};
+ static gunichar2 exp6[3] = {0xD801, 0xDC00, '\0'};
+ static glong read_write[12] = {1,1,0,0,0,0,1,1,0,0,1,2};
+ gunichar2* res;
+ glong items_read, items_written, current_write_index;
+ GError* err=0;
+ RESULT check_result;
+ glong i;
+
+ res = g_ucs4_to_utf16 (str1, 12, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp1, items_read, 11, items_written, 11, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_ucs4_to_utf16 (str2, 0, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp2, items_read, 0, items_written, 0, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_ucs4_to_utf16 (str2, 1, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_ucs4_to_utf16 (str2, 2, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, 0, items_read, 1, items_written, 0, err, TRUE);
+ g_free (res);
+ if (check_result) return check_result;
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_ucs4_to_utf16 (str3, 2, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, 0, items_read, 1, items_written, 0, err, TRUE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_ucs4_to_utf16 (str4, 5, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp4, items_read, 2, items_written, 3, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ // This loop tests the bounds of the conversion algorithm
+ current_write_index = 0;
+ for (i=0;i<6;i++) {
+ items_read = items_written = 0;
+ err = 0;
+ res = g_ucs4_to_utf16 (&str5[i], 1, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, &exp5[current_write_index],
+ items_read, read_write[i*2], items_written, read_write[(i*2)+1], err,
!read_write[(i*2)+1]);
+ if (check_result) return check_result;
+ g_free (res);
+ current_write_index += items_written;
+ }
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_ucs4_to_utf16 (str6, 1, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp6, items_read, 1, items_written, 2, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ return OK;
+}
+
+static RESULT
+utf16_to_ucs4_check_result (const gunichar *result_str, const gunichar *expected_str,
+ glong result_items_read, glong expected_items_read,
+ glong result_items_written, glong expected_items_written,
+ GError* result_error, gboolean expect_error)
+{
+ glong i;
+ if (result_items_read != expected_items_read)
+ return FAILED("Incorrect number of items read; expected %d, got %d", expected_items_read,
result_items_read);
+ if (result_items_written != expected_items_written)
+ return FAILED("Incorrect number of items written; expected %d, got %d",
expected_items_written, result_items_written);
+ if (result_error && !expect_error)
+ return FAILED("There should not be an error code.");
+ if (!result_error && expect_error)
+ return FAILED("Unexpected error object.");
+ if (expect_error && result_str)
+ return FAILED("NULL should be returned when an error occurs.");
+ if (!expect_error && !result_str)
+ return FAILED("When no error occurs NULL should not be returned.");
+ for (i=0; i<expected_items_written;i++) {
+ if (result_str [i] != expected_str [i])
+ return FAILED("Incorrect value %d at index %d", result_str [i], i);
+ }
+ if (result_str && result_str[expected_items_written] != '\0')
+ return FAILED("Null termination not found at the end of the string.");
+
+ return OK;
+}
+
+RESULT
+test_utf16_to_ucs4 ()
+{
+ static gunichar2 str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+ static gunichar exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+ static gunichar2 str2[7] = {'H', 0xD800, 0xDC01,0xD800,0xDBFF,'l','\0'};
+ static gunichar exp2[3] = {'H',0x00010001,'\0'};
+ static gunichar2 str3[4] = {'H', 0xDC00 ,'l','\0'};
+ static gunichar exp3[2] = {'H','\0'};
+ static gunichar2 str4[20] = {0xDC00,0xDFFF,0xDFF,0xD800,0xDBFF,0xD800,0xDC00,0xD800,0xDFFF,
+
0xD800,0xE000,0xDBFF,0xDBFF,0xDBFF,0xDC00,0xDBFF,0xDFFF,0xDBFF,0xE000,'\0'};
+ static gunichar exp4[6] = {0xDFF,0x10000,0x103ff,0x10fc00,0x10FFFF,'\0'};
+ static gunichar2 str5[3] = {0xD801, 0xDC00, 0};
+ static gunichar exp5[2] = {0x10400, 0};
+ static glong read_write[33] = {1,0,0,1,0,0,1,1,1,2,1,0,2,2,1,2,2,1,2,1,0,2,1,0,2,2,1,2,2,1,2,1,0};
+ gunichar* res;
+ glong items_read, items_written, current_read_index,current_write_index;
+ GError* err=0;
+ RESULT check_result;
+ glong i;
+
+ res = g_utf16_to_ucs4 (str1, 12, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp1, items_read, 11, items_written, 11, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 0, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 0, items_written, 0, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 1, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 2, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 3, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 3, items_written, 2, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 4, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 3, items_written, 2, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 5, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 4, items_written, 0, err, TRUE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_utf16_to_ucs4 (str3, 5, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp3, items_read, 1, items_written, 0, err, TRUE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ // This loop tests the bounds of the conversion algorithm
+ current_read_index = current_write_index = 0;
+ for (i=0;i<11;i++) {
+ items_read = items_written = 0;
+ err = 0;
+ res = g_utf16_to_ucs4 (&str4[current_read_index], read_write[i*3], &items_read,
&items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, &exp4[current_write_index], items_read,
+ read_write[(i*3)+1], items_written, read_write[(i*3)+2], err,
+ !read_write[(i*3)+2]);
+ if (check_result) return check_result;
+ g_free (res);
+ current_read_index += read_write[i*3];
+ current_write_index += items_written;
+ }
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_utf16_to_ucs4 (str5, 2, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp5, items_read, 2, items_written, 1, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ return OK;
+}
+RESULT
+test_utf8_strlen ()
+{
+ gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'};//Valid, len = 5
+ gchar word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'};//Valid, len = 5
+ gchar word3 [] = {'h','e',0xC2, 0x82,0x45,'\0'};
//Valid, len = 4
+ gchar word4 [] = {0x62,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'};
//Valid, len = 5
+
+ glong len = 0;
+
+ //Test word1
+ len = g_utf8_strlen (word1,-1);
+ if (len != 5)
+ return FAILED ("Word1 expected length of 5, but was %i", len);
+ //Do tests with different values for max parameter.
+ len = g_utf8_strlen (word1,1);
+ if (len != 0)
+ return FAILED ("Word1, max = 1, expected length of 0, but was %i", len);
+ len = g_utf8_strlen (word1,2);
+ if (len != 1)
+ return FAILED ("Word1, max = 1, expected length of 1, but was %i", len);
+ len = g_utf8_strlen (word1,3);
+ if (len != 2)
+ return FAILED ("Word1, max = 2, expected length of 2, but was %i", len);
+
+ //Test word2
+ len = g_utf8_strlen (word2,-1);
+ if (len != 5)
+ return FAILED ("Word2 expected length of 5, but was %i", len);
+
+ //Test word3
+ len = g_utf8_strlen (word3,-1);
+ if (len != 4)
+ return FAILED ("Word3 expected length of 4, but was %i", len);
+
+ //Test word4
+ len = g_utf8_strlen (word4,-1);
+ if (len != 5)
+ return FAILED ("Word4 expected length of 5, but was %i", len);
+
+ //Test null case
+ len = g_utf8_strlen(NULL,0);
+ if (len != 0)
+ return FAILED ("Expected passing null to result in a length of 0");
+ return OK;
+}
+
+RESULT
+test_utf8_get_char()
+{
+ gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
+
+ gunichar value = g_utf8_get_char (&word1 [0]);
+ if (value != 0x82UL)
+ return FAILED ("Expected value of 0x82, but was %x", value);
+ value = g_utf8_get_char (&word1 [2]);
+ if (value != 0x45UL)
+ return FAILED ("Expected value of 0x45, but was %x", value);
+ value = g_utf8_get_char (&word1 [3]);
+ if (value != 0x1043UL)
+ return FAILED ("Expected value of 0x1043, but was %x", value);
+ value = g_utf8_get_char (&word1 [6]);
+ if (value != 0x58UL)
+ return FAILED ("Expected value of 0x58, but was %x", value);
+ value = g_utf8_get_char (&word1 [7]);
+ if (value != 0x42082UL)
+ return FAILED ("Expected value of 0x42082, but was %x", value);
+
+ return OK;
+}
+
+RESULT
+test_utf8_next_char()
+{
+ gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
+ gchar word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Valid, len = 5
+ gchar word1ExpectedValues [] = {0xC2, 0x45,0xE1, 0x58, 0xF1};
+ gchar word2ExpectedValues [] = {0xF1, 0xC2, 0x45, 0xE1, 0x58};
+
+ gchar* ptr = word1;
+ gint count = 0;
+ //Test word1
+ while (*ptr != 0) {
+ if (count > 4)
+ return FAILED ("Word1 has gone past its expected length");
+ if (*ptr != word1ExpectedValues[count])
+ return FAILED ("Word1 has an incorrect next_char at index %i", count);
+ ptr = g_utf8_next_char (ptr);
+ count++;
+ }
+
+ //Test word2
+ count = 0;
+ ptr = word2;
+ while (*ptr != 0) {
+ if (count > 4)
+ return FAILED ("Word2 has gone past its expected length");
+ if (*ptr != word2ExpectedValues[count])
+ return FAILED ("Word2 has an incorrect next_char at index %i", count);
+ ptr = g_utf8_next_char (ptr);
+ count++;
+ }
+
+ return OK;
+}
+
+RESULT
+test_utf8_validate()
+{
+ gchar invalidWord1 [] = {0xC3, 0x82, 0xC1,0x90,'\0'}; //Invalid, 1nd oct Can't be 0xC0 or 0xC1
+ gchar invalidWord2 [] = {0xC1, 0x89, 0x60, '\0'}; //Invalid, 1st oct can not be 0xC1
+ gchar invalidWord3 [] = {0xC2, 0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Invalid, oct after 0xC2 must be >
0x80
+
+ gchar validWord1 [] = {0xC2, 0x82, 0xC3,0xA0,'\0'}; //Valid
+ gchar validWord2 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid
+
+ const gchar* end;
+ gboolean retVal = g_utf8_validate (invalidWord1, -1, &end);
+ if (retVal != FALSE)
+ return FAILED ("Expected invalidWord1 to be invalid");
+ if (end != &invalidWord1 [2])
+ return FAILED ("Expected end parameter to be pointing to invalidWord1[2]");
+
+ end = NULL;
+ retVal = g_utf8_validate (invalidWord2, -1, &end);
+ if (retVal != FALSE)
+ return FAILED ("Expected invalidWord2 to be invalid");
+ if (end != &invalidWord2 [0])
+ return FAILED ("Expected end parameter to be pointing to invalidWord2[0]");
+
+ end = NULL;
+ retVal = g_utf8_validate (invalidWord3, -1, &end);
+ if (retVal != FALSE)
+ return FAILED ("Expected invalidWord3 to be invalid");
+ if (end != &invalidWord3 [0])
+ return FAILED ("Expected end parameter to be pointing to invalidWord3[1]");
+
+ end = NULL;
+ retVal = g_utf8_validate (validWord1, -1, &end);
+ if (retVal != TRUE)
+ return FAILED ("Expected validWord1 to be valid");
+ if (end != &validWord1 [4])
+ return FAILED ("Expected end parameter to be pointing to validWord1[4]");
+
+ end = NULL;
+ retVal = g_utf8_validate (validWord2, -1, &end);
+ if (retVal != TRUE)
+ return FAILED ("Expected validWord2 to be valid");
+ if (end != &validWord2 [11])
+ return FAILED ("Expected end parameter to be pointing to validWord2[11]");
+ return OK;
+}
+
+glong
+utf8_byteslen (const gchar *src)
+{
+ int i = 0;
+ do {
+ if (src [i] == '\0')
+ return i;
+ i++;
+ } while (TRUE);
+}
+
+RESULT
+test_utf8_strcase_each (const gchar *src, const gchar *expected, gboolean strup)
+{
+ gchar *tmp;
+ glong len, len2;
+ RESULT r;
+
+ len = utf8_byteslen (src);
+ tmp = strup ? g_utf8_strup (src, len) : g_utf8_strdown (src, len);
+ len2 = utf8_byteslen (tmp);
+ r = compare_strings_utf8_RESULT (expected, tmp, len < len2 ? len2 : len);
+ g_free (tmp);
+ return r;
+}
+
+RESULT
+test_utf8_strup_each (const gchar *src, const gchar *expected)
+{
+ return test_utf8_strcase_each (src, expected, TRUE);
+}
+
+RESULT
+test_utf8_strdown_each (const gchar *src, const gchar *expected)
+{
+ return test_utf8_strcase_each (src, expected, FALSE);
+}
+
+/*
+ * g_utf8_strup
+ */
+RESULT
+test_utf8_strup ()
+{
+ RESULT r;
+
+ if ((r = test_utf8_strup_each ("aBc", "ABC")) != OK)
+ return r;
+ if ((r = test_utf8_strup_each ("x86-64", "X86-64")) != OK)
+ return r;
+ // U+3B1 U+392 -> U+391 U+392
+ if ((r = test_utf8_strup_each ("\xCE\xB1\xCE\x92", "\xCE\x91\xCE\x92")) != OK)
+ return r;
+ // U+FF21 -> U+FF21
+ if ((r = test_utf8_strup_each ("\xEF\xBC\xA1", "\xEF\xBC\xA1")) != OK)
+ return r;
+ // U+FF41 -> U+FF21
+ if ((r = test_utf8_strup_each ("\xEF\xBD\x81", "\xEF\xBC\xA1")) != OK)
+ return r;
+ // U+10428 -> U+10400
+ if ((r = test_utf8_strup_each ("\xF0\x90\x90\xA8", "\xF0\x90\x90\x80")) != OK)
+ return r;
+
+ return OK;
+}
+
+/*
+ * g_utf8_strdown
+ */
+RESULT
+test_utf8_strdown ()
+{
+ RESULT r;
+
+ if ((r = test_utf8_strdown_each ("aBc", "abc")) != OK)
+ return r;
+ if ((r = test_utf8_strdown_each ("X86-64", "x86-64")) != OK)
+ return r;
+ // U+391 U+3B2 -> U+3B1 U+3B2
+ if ((r = test_utf8_strdown_each ("\xCE\x91\xCE\xB2", "\xCE\xB1\xCE\xB2")) != OK)
+ return r;
+/*
+ // U+FF41 -> U+FF41
+ if ((r = test_utf8_strdown_each ("\xEF\xBC\x81", "\xEF\xBC\x81")) != OK)
+ return r;
+ // U+FF21 -> U+FF41
+ if ((r = test_utf8_strdown_each ("\xEF\xBC\xA1", "\xEF\xBD\x81")) != OK)
+ return r;
+ // U+10400 -> U+10428
+ if ((r = test_utf8_strdown_each ("\xF0\x90\x90\x80", "\xF0\x90\x90\xA8")) != OK)
+ return r;
+*/
+ return OK;
+}
+
+/*
+ * test initialization
+ */
+
+static Test utf8_tests [] = {
+ {"g_utf16_to_utf8", test_utf16_to_utf8},
+ {"g_utf8_to_utf16", test_utf8_to_utf16},
+ {"g_utf8_to_utf16_with_nuls", test_utf8_to_utf16_with_nuls},
+ {"g_utf8_seq", test_utf8_seq},
+ {"g_convert", test_convert },
+ {"g_unichar_xdigit_value", test_xdigit },
+ {"g_ucs4_to_utf16", test_ucs4_to_utf16 },
+ {"g_utf16_to_ucs4", test_utf16_to_ucs4 },
+ {"g_utf8_strlen", test_utf8_strlen },
+ {"g_utf8_get_char", test_utf8_get_char },
+ {"g_utf8_next_char", test_utf8_next_char },
+ {"g_utf8_validate", test_utf8_validate },
+ {"g_utf8_strup", test_utf8_strup},
+ {"g_utf8_strdown", test_utf8_strdown},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(utf8_tests_init, utf8_tests)
+
+
diff --git a/deps/eglib/test/whats-implemented b/deps/eglib/test/whats-implemented
new file mode 100755
index 0000000..8a11357
--- /dev/null
+++ b/deps/eglib/test/whats-implemented
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+# Author: Aaron Bockover
+# Licensed under MIT/X11
+# (C) 2006 Novell
+
+if [ "x$1" = "x--help" ]; then
+ echo "Usage: $0 [--show-only-mono]"
+ echo ""
+ echo "This script prints a sorted list of GLib functions used in Mono"
+ echo "that have not yet been implemented in EGlib."
+ echo ""
+ echo "If --show-only-mono is passed, then the script will print all"
+ echo "GLib functions used in Mono, whether or not they have been"
+ echo "implemented in EGlib yet."
+ echo ""
+ echo "This script relies on the MONO_CHECKOUT environment variable."
+ echo "MONO_CHECKOUT should be set to the location of a mono checkout."
+ echo ""
+ exit 1
+fi
+
+IGNORE_FUNCTIONS="g_hash_table_lookup_node g_hash_table_foreach_remove_or_steal g_hash_table_resize"
+
+if [ -z $MONO_CHECKOUT ]; then
+ if [ -e ../../mono.pc.in ]; then
+ MONO_CHECKOUT=../..
+ else
+ MONO_CHECKOUT=~/cvs/mono/mono
+ fi
+fi
+
+if [ ! -d $MONO_CHECKOUT ]; then
+ echo "Cannot find mono checkout; set MONO_CHECKOUT"
+ exit 1
+fi
+
+MONO_CHECKOUT="$MONO_CHECKOUT/mono"
+RESULTS_FILE=.results
+
+(for i in `find $MONO_CHECKOUT -iregex \.*.c$`; do
+ grep -oP "[ \t\(\)]+g_[a-z_]+[ ]{0,1}\([A-Za-z_\&\*\,\(\) ]+\)" $i |
+ awk 'BEGIN { FS="(" } { print $1 }' |
+ sed -e 's/[^A-Za-z_]//g'
+ done
+) > $RESULTS_FILE
+
+if [ ! "x$1" = "x--show-only-mono" ]; then
+ IMPLEMENTED_FUNCTIONS=`grep -oP "g_[a-z_]+[ ]{0,1}" ../src/glib.h | awk 'BEGIN { FS="(" } { print $1
}'`
+
+ rm -f $RESULTS_FILE.tmp
+
+ for mono_function in `cat $RESULTS_FILE`; do
+ matched="no"
+ for implemented_function in $IMPLEMENTED_FUNCTIONS; do
+ if [ "x$mono_function" = "x$implemented_function" ]; then
+ matched="yes"
+ break
+ fi
+ done
+
+ for ignore_function in $IGNORE_FUNCTIONS; do
+ if [ "x$ignore_function" = "x$mono_function" ]; then
+ matched="yes"
+ break
+ fi
+ done
+
+ if [ "x$matched" = "xno" ]; then
+ echo $mono_function >> $RESULTS_FILE.tmp
+ fi
+ done
+
+ mv $RESULTS_FILE.tmp $RESULTS_FILE
+fi
+
+(for i in `cat $RESULTS_FILE | sort -u`; do
+ echo "`grep -c $i $RESULTS_FILE` $i";
+ done;
+) | sort -nr
+
+rm $RESULTS_FILE
+
diff --git a/deps/eglib/winconfig.h b/deps/eglib/winconfig.h
new file mode 100755
index 0000000..fdab3dd
--- /dev/null
+++ b/deps/eglib/winconfig.h
@@ -0,0 +1,76 @@
+/* config.h. Generated by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+/* #undef HAVE_PWD_H 1 */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+/* #undef HAVE_STRLCPY */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+/* #undef HAVE_SYS_TIME_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+/* #undef HAVE_SYS_WAIT_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Name of package */
+#define PACKAGE "eglib"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 4
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "0.1"
+
+#define HAVE_STRTOK_R 1
diff --git a/examples/Makefile.am b/examples/Makefile.am
index d9198a9..47a2157 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -3,10 +3,6 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
AM_CPPFLAGS = \
-I$(top_srcdir)
-if !USE_GLIB
-AM_CPPFLAGS += -I$(top_builddir)/deps/glib
-endif
-
AM_CFLAGS = \
$(COGL_DEP_CFLAGS) \
$(COGL_EXTRA_CFLAGS)
@@ -23,7 +19,7 @@ common_ldadd = \
$(LIBM)
if !USE_GLIB
-common_ldadd += $(top_builddir)/deps/glib/libglib.la
+common_ldadd += $(top_builddir)/deps/eglib/src/libeglib.la
endif
programs = cogl-info
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index ccbf5d8..083d734 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -145,8 +145,7 @@ if BUILD_COGL_PATH
test_conformance_LDADD += $(top_builddir)/cogl-path/libcogl-path.la
endif
if !USE_GLIB
-test_conformance_LDADD += $(top_builddir)/deps/glib/libglib.la
-test_conformance_LDADD += $(top_builddir)/deps/gmodule/libgmodule.la
+test_conformance_LDADD += $(top_builddir)/deps/eglib/src/libeglib.la
endif
test_conformance_LDFLAGS = -export-dynamic
diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am
index e9ca43e..4e0c1f5 100644
--- a/tests/unit/Makefile.am
+++ b/tests/unit/Makefile.am
@@ -71,8 +71,7 @@ test_unit_LDADD = \
$(top_builddir)/cogl/libcogl2.la \
$(LIBM)
if !USE_GLIB
-test_unit_LDADD += $(top_builddir)/deps/glib/libglib.la
-test_unit_LDADD += $(top_builddir)/deps/gmodule/libgmodule.la
+test_unit_LDADD += $(top_builddir)/deps/eglib/src/libeglib.la
endif
test_unit_LDFLAGS = -export-dynamic
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]