2006-08-23 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Wed, 23 Aug 2006 22:33:17 +0000 (22:33 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Wed, 23 Aug 2006 22:33:17 +0000 (22:33 -0000)
        * src/gerror.c: Implement.

        * src/glist.c (g_list_sort): Remove routine instead of hoping
        * that
        it wont crash when we run it.

I did a small implementation of GIO/GChannel/GSource just to find
that we are no longer using that code (daemon.c)

svn path=/trunk/mono/; revision=64284

eglib/ChangeLog
eglib/TODO
eglib/src/Makefile.am
eglib/src/gerror.c [new file with mode: 0644]
eglib/src/glib.h
eglib/src/glist.c

index 89076ad9ba6bcec2eb91ce090dd85c16b90345ab..d01ce93e84f9104c97a5e77653be64eee8e6adf3 100644 (file)
@@ -1,3 +1,10 @@
+2006-08-23  Miguel de Icaza  <miguel@novell.com>
+
+       * src/gerror.c: Implement. 
+
+       * src/glist.c (g_list_sort): Remove routine instead of hoping that
+       it wont crash when we run it.
+
 2006-08-23  Raja R Harinath  <rharinath@novell.com>
 
        * src/glist.c (g_list_insert_before): Avoid non-head declaration.
index 9eda41febc3f8eac07d3809f4e80ddc24b18c42c..a39c9f24f312d29ddcdb0139d7e4f659b358318e 100644 (file)
       These are currently only used for the GC-safe hash table, and 
       we will be replacing that with a copy of our own hashtable.
 
-Routines missing from eglib, by count number:
-
-     27 g_build_filename
-     24 g_utf16_to_utf8
-     21 g_snprintf
-     20 g_utf8_to_utf16
-     13 g_error_free
-     12 g_build_path
-     11 g_file_test
-     10 g_strlcpy
-     10 g_path_get_dirname
-     10 g_ascii_xdigit_value
-      9 g_path_get_basename
-      8 g_get_home_dir
-      6 g_io_channel_unix_get_fd
-      5 g_timer_elapsed
-      5 g_path_is_absolute
-      5 g_newa
-      5 g_get_current_dir
-      5 g_file_get_contents
-      4 g_strdown
-      4 g_get_tmp_dir
-      3 g_utf8_validate
-      3 g_thread_supported
-      3 g_thread_init
-      3 g_spaced_primes_closest
-      3 g_shell_quote
-      3 g_locale_to_utf8
-      3 g_list_insert_before
-      3 g_file_open_tmp
-      3 g_convert
-      2 g_timer_stop
-      2 g_timer_start
-      2 g_timer_new
-      2 g_strdelimit
-      2 g_shell_parse_argv
-      2 g_set_prgname
-      2 g_printerr
-      2 g_pattern_spec_new
-      2 g_pattern_spec_free
-      2 g_pattern_match_string
-      2 g_markup_parse_context_parse
-      2 g_markup_parse_context_new
-      2 g_markup_parse_context_free
-      2 g_markup_parse_context_end_parse
-      2 g_list_sort
-      2 g_get_current_time
-      2 g_find_program_in_path
-      2 g_filename_to_uri
-      2 g_filename_from_uri
-      2 g_concat_dir_and_file
-      1 g_win32_getlocale
-      1 g_timer_destroy
-      1 g_strescape
-      1 g_spawn_command_line_sync
-      1 g_spawn_async_with_pipes
-      1 g_source_unref
-      1 g_source_set_callback
-      1 g_source_remove
-      1 g_source_attach
-      1 g_shell_unquote
-      1 g_mem_set_vtable
-      1 g_main_loop_run
-      1 g_main_context_new
-      1 g_main_context_iteration
-      1 g_log_set_handler
-      1 g_locale_from_utf8
-      1 g_io_create_watch
-      1 g_io_channel_unref
-      1 g_io_channel_unix_new
-      1 g_io_channel_shutdown
-      1 g_io_channel_set_encoding
-      1 g_io_channel_set_buffered
-      1 g_io_channel_get_buffer_condition
-      1 g_io_add_watch
-      1 g_get_user_name
-      1 g_get_prgname
-      1 g_get_charset
-      1 g_filename_from_utf8
-      1 g_ascii_strdown
+Important Groups:
+
+       * Pattern Matching
+             2 g_pattern_spec_new
+             2 g_pattern_spec_free
+             2 g_pattern_match_string
+       
+       * Markup, used to load config files.
+             2 g_markup_parse_context_parse
+             2 g_markup_parse_context_new
+             2 g_markup_parse_context_free
+             2 g_markup_parse_context_end_parse
+
+       * Timers, used for the Mini built-in test suite
+             5 g_timer_elapsed
+             2 g_timer_stop
+             2 g_timer_start
+             2 g_timer_new
+             1 g_timer_destroy
+                    
+       * Process launching
+             1 g_spawn_command_line_sync
+             1 g_spawn_async_with_pipes
+             3 g_shell_quote
+             2 g_shell_parse_argv
+             1 g_shell_unquote
+
+        * Thread enabling, these might be just no-ops, check with Paolo/Zoltan
+             3 g_thread_supported
+             3 g_thread_init
+
+       * Path string manipulation and utilities.
+            27 g_build_filename
+            12 g_build_path
+            10 g_path_get_dirname
+             9 g_path_get_basename
+             2 g_find_program_in_path
+             2 g_filename_to_uri
+             2 g_filename_from_uri
+             2 g_concat_dir_and_file
+             5 g_path_is_absolute
+            10 g_ascii_xdigit_value
+       
+        * Information retrieval
+             8 g_get_home_dir
+             5 g_get_current_dir
+             4 g_get_tmp_dir
+             2 g_get_current_time
+             1 g_get_user_name
+             1 g_get_prgname
+             1 g_get_charset
+             1 g_win32_getlocale
+       
+       * String manipulation
+             1 g_filename_from_utf8
+             1 g_ascii_strdown
+             4 g_strdown
+            21 g_snprintf
+            10 g_strlcpy
+             2 g_strdelimit
+             1 g_strescape
+       
+       * Character encoding
+            24 g_utf16_to_utf8
+            20 g_utf8_to_utf16
+             3 g_utf8_validate
+             3 g_locale_to_utf8
+             3 g_convert
+             1 g_locale_from_utf8
+
+       * File 
+             5 g_file_get_contents
+            11 g_file_test
+             3 g_file_open_tmp
+       
+       * List
+             3 g_list_insert_before
+             2 g_list_sort
+       
+       * Miscelaneous
+             5 g_newa
+             3 g_spaced_primes_closest
+             2 g_set_prgname
+             2 g_printerr
+             1 g_mem_set_vtable
+             1 g_log_set_handler
 
 Macros:
       7 G_FILE_TEST_IS_DIR
@@ -107,9 +113,9 @@ Macros:
       4 G_FILE_TEST_IS_REGULAR
       2 G_USEC_PER_SEC
       2 G_STRLOC
-      2 G_IO_NVAL
       1 G_SPAWN_SEARCH_PATH
-      1 G_IO_PRI
       1 G_ALLOC_ONLY
 
-       
\ No newline at end of file
+* Dead Code
+
+       The GMainLoop code was no longer in use in Mono.
\ No newline at end of file
index 4f3752b74dd69cddca2905e14c35aecb22ac928e..e56bf947ebe06d26de6ebc0eca0ce43758a21203 100644 (file)
@@ -4,6 +4,7 @@ libeglib_la_SOURCES = \
        eglib-config.h  \
        glib.h          \
        garray.c        \
+       gerror.c        \
        ghashtable.c    \
        gmem.c          \
        gmodule.c       \
diff --git a/eglib/src/gerror.c b/eglib/src/gerror.c
new file mode 100644 (file)
index 0000000..8dd9b7a
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <glib.h>
+
+GError *
+g_error_new (gpointer 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;
+}
+
+void
+g_error_free (GError *error)
+{
+       g_return_if_fail (error != NULL);
+       
+       free (error->message);
+       g_free (error);
+}
+
+
+
index b466ebd007d931e259dd543953acf29d8bf54a66..88582fad899539675d67d302c89b29f674168e37 100644 (file)
@@ -150,7 +150,6 @@ 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
@@ -413,4 +412,19 @@ GUnicodeType   g_unichar_type    (gunichar c);
 /* FIXME: Implement these two for gcc */
 #define G_LIKELY(x) (x)
 #define G_UNLIKELY(x) (x)
+
+/*
+ * Errors
+ */
+typedef struct {
+       /* In the real glib, this is a GQuark, but we dont use/need that */
+       gpointer domain;
+       gint     code;
+       gchar   *message;
+} GError;
+
+void    g_error_free (GError *error);
+GError *g_error_new (gpointer domain, gint code, const char *format, ...);
+
+
 #endif
index fa486bb4b59245e74799c90af6942b5122016393..596305b3af23962e7fa2bf9687e0c5bca9bd73a2 100644 (file)
@@ -238,12 +238,6 @@ g_list_foreach (GList *list, GFunc func, gpointer user_data)
        }
 }
 
-GList*
-g_list_sort (GList *list, GCompareFunc func)
-{
-       return NULL;
-}
-
 gint
 g_list_index (GList *list, gconstpointer data)
 {