summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2014-02-09 15:06:14 +0000
committerRobert Bragg <robert@linux.intel.com>2014-03-05 19:28:04 +0000
commitf6d5fd5a45ec989acdce58ae737840cbee96a8d8 (patch)
tree6dddd355b52ceb7a24485b133d9d18549c0bc8c3
parent151e10aac871769e96d5402685e66f72ef2c7edd (diff)
downloadcogl-f6d5fd5a45ec989acdce58ae737840cbee96a8d8.tar.gz
eglib: remove unused gpattern and gmarkup apis
This simply removes a couple of eglib apis that aren't needed by Cogl and the corresponding tests.
-rw-r--r--deps/eglib/src/Makefile.am2
-rw-r--r--deps/eglib/src/gmarkup.c487
-rw-r--r--deps/eglib/src/gpattern.c216
-rw-r--r--deps/eglib/test/Makefile.am2
-rw-r--r--deps/eglib/test/markup.c234
-rw-r--r--deps/eglib/test/pattern.c61
-rw-r--r--deps/eglib/test/tests.h10
7 files changed, 3 insertions, 1009 deletions
diff --git a/deps/eglib/src/Makefile.am b/deps/eglib/src/Makefile.am
index 2efca84d..a5f6744a 100644
--- a/deps/eglib/src/Makefile.am
+++ b/deps/eglib/src/Makefile.am
@@ -49,8 +49,6 @@ libeglib_la_SOURCES = \
gspawn.c \
gfile.c \
gfile-posix.c \
- gpattern.c \
- gmarkup.c \
gutf8.c \
gunicode.c \
unicode-data.h \
diff --git a/deps/eglib/src/gmarkup.c b/deps/eglib/src/gmarkup.c
deleted file mode 100644
index 7a1c0964..00000000
--- a/deps/eglib/src/gmarkup.c
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * 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/gpattern.c b/deps/eglib/src/gpattern.c
deleted file mode 100644
index aef45ded..00000000
--- a/deps/eglib/src/gpattern.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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/test/Makefile.am b/deps/eglib/test/Makefile.am
index 14aa233e..024af900 100644
--- a/deps/eglib/test/Makefile.am
+++ b/deps/eglib/test/Makefile.am
@@ -20,9 +20,7 @@ SOURCES = \
spawn.c \
timer.c \
file.c \
- pattern.c \
dir.c \
- markup.c \
unicode.c \
utf8.c \
endian.c \
diff --git a/deps/eglib/test/markup.c b/deps/eglib/test/markup.c
deleted file mode 100644
index cf8d3f2d..00000000
--- a/deps/eglib/test/markup.c
+++ /dev/null
@@ -1,234 +0,0 @@
-#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/pattern.c b/deps/eglib/test/pattern.c
deleted file mode 100644
index 7db5a7be..00000000
--- a/deps/eglib/test/pattern.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#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/tests.h b/deps/eglib/test/tests.h
index fdca3957..6f00d8c3 100644
--- a/deps/eglib/test/tests.h
+++ b/deps/eglib/test/tests.h
@@ -15,17 +15,15 @@ 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},
+static Group test_groups [] = {
+ {"string", string_tests_init},
{"strutil", strutil_tests_init},
{"ptrarray", ptrarray_tests_init},
{"slist", slist_tests_init},
@@ -37,8 +35,7 @@ static Group test_groups [] = {
{"queue", queue_tests_init},
{"path", path_tests_init},
{"shell", shell_tests_init},
- {"markup", markup_tests_init},
-#if !DISABLE_PROCESS_TESTS
+#if !DISABLE_PROCESS_TESTS
{"spawn", spawn_tests_init},
{"module", module_tests_init},
#endif
@@ -46,7 +43,6 @@ static Group test_groups [] = {
{"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},