Author: joncham
Date: 2007-04-24 14:21:18 -0400 (Tue, 24 Apr 2007)
New Revision: 76209

Modified:
   trunk/mono/eglib/ChangeLog
   trunk/mono/eglib/src/gdate.c
   trunk/mono/eglib/src/gdir.c
   trunk/mono/eglib/src/gfile.c
   trunk/mono/eglib/src/glib.h
   trunk/mono/eglib/src/glist.c
   trunk/mono/eglib/src/gmarkup.c
   trunk/mono/eglib/src/gmodule.c
   trunk/mono/eglib/src/gpath.c
   trunk/mono/eglib/src/gpattern.c
   trunk/mono/eglib/src/gshell.c
   trunk/mono/eglib/src/gspawn.c
   trunk/mono/eglib/src/gstr.c
   trunk/mono/eglib/src/gtimer.c
   trunk/mono/eglib/src/gunicode.c
Log:
2007-04-24  Jonathan Chambers <[EMAIL PROTECTED]>

        Patch from Michael Jerris <[EMAIL PROTECTED]>
        * src/gspawn.c: Start msvc build.
        * src/gpath.c: Start msvc build.
        * src/gmarkup.c: Start msvc build.
        * src/gshell.c: Start msvc build.
        * src/gstr.c: Start msvc build.
        * src/glist.c: Start msvc build.
        * src/glib.h: Start msvc build.
        * src/gdate.c: Start msvc build.
        * src/gpattern.c: Start msvc build.
        * src/gdir.c: Start msvc build.
        * src/gfile.c: Start msvc build.
        * src/gtimer.c: Start msvc build.
        * src/gmodule.c: Start msvc build.
        * src/gunicode.c: Start msvc build.



Modified: trunk/mono/eglib/ChangeLog
===================================================================
--- trunk/mono/eglib/ChangeLog  2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/ChangeLog  2007-04-24 18:21:18 UTC (rev 76209)
@@ -1,3 +1,22 @@
+2007-04-24  Jonathan Chambers <[EMAIL PROTECTED]>
+       
+       Patch from Michael Jerris <[EMAIL PROTECTED]>
+       * src/gspawn.c: Start msvc build.
+       * src/gpath.c: Start msvc build.
+       * src/gmarkup.c: Start msvc build.
+       * src/gshell.c: Start msvc build.
+       * src/gstr.c: Start msvc build.
+       * src/glist.c: Start msvc build.
+       * src/glib.h: Start msvc build.
+       * src/gdate.c: Start msvc build.
+       * src/gpattern.c: Start msvc build.
+       * src/gdir.c: Start msvc build.
+       * src/gfile.c: Start msvc build.
+       * src/gtimer.c: Start msvc build.
+       * src/gmodule.c: Start msvc build.
+       * src/gunicode.c: Start msvc build.
+
+
 2007-01-27  Robert Jordan  <[EMAIL PROTECTED]>
 
        * test/Makefile.am: Add linker option to be able to

Modified: trunk/mono/eglib/src/gdate.c
===================================================================
--- trunk/mono/eglib/src/gdate.c        2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gdate.c        2007-04-24 18:21:18 UTC (rev 76209)
@@ -27,7 +27,12 @@
  */
 #include <stdio.h>
 #include <glib.h>
+
+#ifdef _MSC_VER
+#include <winsock2.h>
+#else
 #include <sys/time.h>
+#endif
 
 void
 g_get_current_time (GTimeVal *result)

Modified: trunk/mono/eglib/src/gdir.c
===================================================================
--- trunk/mono/eglib/src/gdir.c 2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gdir.c 2007-04-24 18:21:18 UTC (rev 76209)
@@ -28,14 +28,18 @@
 #include <glib.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef _MSC_VER
+#include <unistd.h>
 #include <dirent.h>
+#endif
 
 struct _GDir {
 #ifdef G_OS_WIN32
+       /* FIXME */
+       int dir;
 #else
        DIR *dir;
 #endif

Modified: trunk/mono/eglib/src/gfile.c
===================================================================
--- trunk/mono/eglib/src/gfile.c        2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gfile.c        2007-04-24 18:21:18 UTC (rev 76209)
@@ -28,11 +28,16 @@
 #include <glib.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#ifdef _MSC_VER
+#include <io.h>
+#define open _open
+#else
+#include <unistd.h>
+#endif
 
 GFileError
 g_file_error_from_errno (gint err_no)

Modified: trunk/mono/eglib/src/glib.h
===================================================================
--- trunk/mono/eglib/src/glib.h 2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/glib.h 2007-04-24 18:21:18 UTC (rev 76209)
@@ -5,10 +5,12 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <stdint.h>
 #include <stddef.h>
 #include <ctype.h>
+#ifndef _MSC_VER
+#include <stdint.h>
 #include <eglib-config.h>
+#endif
 
 #ifndef offsetof
 #   define offsetof(s_name,n_name) (size_t)(char *)&(((s_name*)0)->m_name)
@@ -30,6 +32,64 @@
 typedef char           gchar;
 typedef unsigned char  guchar;
 
+#ifdef _MSC_VER
+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 unsigned __int16       gunichar2;
+/*
+ * 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_BREAKPOINT()           @BREAKPOINT@
+#define [EMAIL PROTECTED]@
+#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@
+*/
+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 INT32_MAX 2147483647
+#define INT32_MIN (~ INT32_MAX)
+#define INT64_MAX 9223372036854775807i64
+#define INT64_MIN (~INT64_MAX)
+
+#define STDOUT_FILENO stdout
+#define STDERR_FILENO stderr
+
+/* FIXME: what should this be ?*/
+#define X_OK 1
+#define WNOHANG 1
+#define F_SETFD 1
+#define FD_CLOEXEC 1
+
+#undef inline
+#define inline __inline
+
+#define G_OS_WIN32 1
+
+#else
 /* Types defined in terms of the stdint.h */
 typedef int8_t         gint8;
 typedef uint8_t        guint8;
@@ -42,6 +102,7 @@
 typedef float          gfloat;
 typedef double         gdouble;
 typedef uint16_t       gunichar2;
+#endif
 /*
  * Macros
  */
@@ -439,14 +500,14 @@
 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, ...);
 
-#define g_error(format...)    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format)
-#define g_critical(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, 
format)
-#define g_warning(format...)  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format)
-#define g_message(format...)  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format)
-#define g_debug(format...)    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+#define g_error(format, ...)    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, 
format, __VA_ARGS__)
+#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__)
 
 #define g_log_set_handler(a,b,c,d)
-#define g_printerr(format...) fprintf (stderr, format)
+#define g_printerr(format, ...) fprintf (stderr, format, __VA_ARGS__)
 /*
  * Conversions
  */
@@ -502,7 +563,7 @@
  * 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)
+#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);

Modified: trunk/mono/eglib/src/glist.c
===================================================================
--- trunk/mono/eglib/src/glist.c        2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/glist.c        2007-04-24 18:21:18 UTC (rev 76209)
@@ -205,7 +205,8 @@
 {
        GList *prev = NULL;
        GList *current;
-       
+       GList *node;
+
        if (!func)
                return list;
 
@@ -216,7 +217,7 @@
                prev = current;
        }
 
-       GList *node = new_node (prev, data, current);
+       node = new_node (prev, data, current);
        return list == current ? node : list;
 }
 

Modified: trunk/mono/eglib/src/gmarkup.c
===================================================================
--- trunk/mono/eglib/src/gmarkup.c      2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gmarkup.c      2007-04-24 18:21:18 UTC (rev 76209)
@@ -42,7 +42,7 @@
 #include <stdio.h>
 #include <glib.h>
 
-#define set_error(msg...) do { if (error != NULL) *error = g_error_new 
(GINT_TO_POINTER (1), 1, msg); } while (0);
+#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new 
(GINT_TO_POINTER (1), 1, msg, __VA_ARGS__); } while (0);
 
 typedef enum {
        START,
@@ -114,7 +114,7 @@
        int l;
        
        if (*p != '"'){
-               set_error ("Expected the attribute value to start with a 
quote");
+               set_error ("%s", "Expected the attribute value to start with a 
quote");
                return end;
        }
        start = ++p;
@@ -258,7 +258,7 @@
                                        context->state = START_ELEMENT;
                                continue;
                        }
-                       set_error ("Expected < to start the document");
+                       set_error ("%s", "Expected < to start the document");
                        goto fail;
 
                case SKIP_XML_DECLARATION:
@@ -271,7 +271,7 @@
                        for (; p < end && isspace (*p); p++)
                                ;
                        if (p == end){
-                               set_error ("Unfinished element");
+                               set_error ("%s", "Unfinished element");
                                goto fail;
                        }
 
@@ -282,14 +282,14 @@
                        }
                        
                        if (!(isascii (*p) && isalpha (*p))){
-                               set_error ("Expected an element name");
+                               set_error ("%s", "Expected an element name");
                                goto fail;
                        }
                        
                        for (++p; p < end && (isalnum (*p) || (*p == '.')); p++)
                                ;
                        if (p == end){
-                               set_error ("Expected an element");
+                               set_error ("%s", "Expected an element");
                                goto fail;
                        }
                        element_end = p;
@@ -297,7 +297,7 @@
                        for (; p < end && isspace (*p); p++)
                                ;
                        if (p == end){
-                               set_error ("Unfinished element");
+                               set_error ("%s", "Unfinished element");
                                goto fail;
                        }
                        p = parse_attributes (p, end, &names, &values, error, 
&full_stop, context->state);
@@ -308,7 +308,7 @@
                                }
                                /* Only set the error if parse_attributes did 
not */
                                if (error != NULL && *error == NULL)
-                                       set_error ("Unfinished sequence");
+                                       set_error ("%s", "Unfinished sequence");
                                goto fail;
                        }
                        l = element_end - element_start;
@@ -396,7 +396,7 @@
                        char *text;
 
                        if (context->level == NULL){
-                               set_error ("Too many closing tags, not enough 
open tags");
+                               set_error ("%s", "Too many closing tags, not 
enough open tags");
                                goto fail;
                        }
                        

Modified: trunk/mono/eglib/src/gmodule.c
===================================================================
--- trunk/mono/eglib/src/gmodule.c      2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gmodule.c      2007-04-24 18:21:18 UTC (rev 76209)
@@ -239,28 +239,28 @@
 GModule *
 g_module_open (const gchar *file, GModuleFlags flags)
 {
-       g_error ("g_module_open not implemented on this platform");
+       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 ("g_module_open not implemented on this platform");
+       g_error ("%s", "g_module_open not implemented on this platform");
        return FALSE;
 }
 
 const gchar *
 g_module_error (void)
 {
-       g_error ("g_module_open not implemented on this platform");
+       g_error ("%s", "g_module_open not implemented on this platform");
        return NULL;
 }
 
 gboolean
 g_module_close (GModule *module)
 {
-       g_error ("g_module_open not implemented on this platform");
+       g_error ("%s", "g_module_open not implemented on this platform");
        return FALSE;
 }
 #endif

Modified: trunk/mono/eglib/src/gpath.c
===================================================================
--- trunk/mono/eglib/src/gpath.c        2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gpath.c        2007-04-24 18:21:18 UTC (rev 76209)
@@ -27,11 +27,14 @@
  */
 #include <stdio.h>
 #include <glib.h>
-#include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
+
+#ifndef _MSC_VER
+#include <pthread.h>
+#include <unistd.h>
 #include <pwd.h>
-#include <pthread.h>
+#endif
 
 gchar *
 g_build_path (const gchar *separator, const gchar *first_element, ...)
@@ -235,20 +238,28 @@
 const gchar *
 g_get_home_dir (void)
 {
-       g_error ("g_get_home_dir not implemented on this platform");
+       g_error ("%s", "g_get_home_dir not implemented on this platform");
        return NULL;
 }
 
 #endif
 
 static char *tmp_dir;
+#ifdef _MSC_VER
+/* FIXME */
+#else
 static pthread_mutex_t tmp_lock = PTHREAD_MUTEX_INITIALIZER;
+#endif
 
 const gchar *
 g_get_tmp_dir (void)
 {
        if (tmp_dir == NULL){
+#ifdef _MSC_VER
+/* FIXME */
+#else
                pthread_mutex_lock (&tmp_lock);
+#endif
                if (tmp_dir == NULL){
                        tmp_dir = getenv ("TMPDIR");
                        if (tmp_dir == NULL){
@@ -260,7 +271,11 @@
                                }
                        }
                }
+#ifdef _MSC_VER
+/* FIXME */
+#else
                pthread_mutex_unlock (&tmp_lock);
+#endif
        }
        return tmp_dir;
 }

Modified: trunk/mono/eglib/src/gpattern.c
===================================================================
--- trunk/mono/eglib/src/gpattern.c     2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gpattern.c     2007-04-24 18:21:18 UTC (rev 76209)
@@ -28,8 +28,10 @@
 #include <glib.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
+#ifndef _MSC_VER
 #include <unistd.h>
-#include <errno.h>
+#endif
 
 typedef enum {
        MATCH_LITERAL,

Modified: trunk/mono/eglib/src/gshell.c
===================================================================
--- trunk/mono/eglib/src/gshell.c       2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gshell.c       2007-04-24 18:21:18 UTC (rev 76209)
@@ -136,7 +136,7 @@
 gchar *
 g_shell_quote (const gchar *unquoted_string)
 {
-       //g_error ("Not implemented");
+       //g_error ("%s", "Not implemented");
        return g_strdup (unquoted_string);
 //     return NULL;
 }
@@ -144,7 +144,7 @@
 gchar *
 g_shell_unquote (const gchar *quoted_string, GError **error)
 {
-//     g_error ("Not implemented");
+//     g_error ("%s", "Not implemented");
        return g_strdup (quoted_string);
 //     return NULL;
 }

Modified: trunk/mono/eglib/src/gspawn.c
===================================================================
--- trunk/mono/eglib/src/gspawn.c       2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gspawn.c       2007-04-24 18:21:18 UTC (rev 76209)
@@ -28,17 +28,20 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#ifdef _MSC_VER
+#include <winsock2.h>
+#else
 #include <unistd.h>
-#include <unistd.h>
-#include <fcntl.h>
 #include <sys/time.h>
 #include <sys/wait.h>
-#include <sys/types.h>
+#endif
 #include <glib.h>
 
-#define set_error(msg...) do { if (error != NULL) *error = g_error_new 
(G_LOG_DOMAIN, 1, msg); } while (0)
-#define set_error_cond(cond,msg...) do { if ((cond) && error != NULL) *error = 
g_error_new (G_LOG_DOMAIN, 1, msg); } while (0)
-#define set_error_status(status,msg...) do { if (error != NULL) *error = 
g_error_new (G_LOG_DOMAIN, status, msg); } while (0)
+#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new 
(G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
+#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error 
= g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
+#define set_error_status(status,msg, ...) do { if (error != NULL) *error = 
g_error_new (G_LOG_DOMAIN, 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)
 
@@ -48,7 +51,7 @@
        int res;
 
        NO_INTR (res, read (fd, buffer, count));
-       set_error_cond (res == -1, "Error reading from pipe.");
+       set_error_cond (res == -1, "%s", "Error reading from pipe.");
        return res;
 }
 
@@ -134,7 +137,7 @@
 create_pipe (int *fds, GError **error)
 {
        if (pipe (fds) == -1) {
-               set_error ("Error creating pipe.");
+               set_error ("%s", "Error creating pipe.");
                return FALSE;
        }
        return TRUE;
@@ -277,7 +280,7 @@
                CLOSE_PIPE (out_pipe);
                CLOSE_PIPE (err_pipe);
                CLOSE_PIPE (in_pipe);
-               set_error ("Error in fork ()");
+               set_error ("%s", "Error in fork ()");
                return FALSE;
        }
 

Modified: trunk/mono/eglib/src/gstr.c
===================================================================
--- trunk/mono/eglib/src/gstr.c 2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gstr.c 2007-04-24 18:21:18 UTC (rev 76209)
@@ -132,10 +132,10 @@
 gchar *
 g_strconcat (const gchar *first, ...)
 {
-       g_return_val_if_fail (first != NULL, NULL);
        va_list args;
        int total = 0;
        char *s, *ret;
+       g_return_val_if_fail (first != NULL, NULL);
 
        total += strlen (first);
        va_start (args, first);
@@ -426,7 +426,7 @@
        g_return_val_if_fail (filename != NULL, NULL);
 
        if (hostname != NULL)
-               g_warning ("eglib: g_filename_to_uri: hostname not handled");
+               g_warning ("%s", "eglib: g_filename_to_uri: hostname not 
handled");
 
        if (*filename != '/'){
                if (error != NULL)
@@ -479,7 +479,7 @@
        g_return_val_if_fail (uri != NULL, NULL);
 
        if (hostname != NULL)
-               g_warning ("eglib: g_filename_from_uri: hostname not handled");
+               g_warning ("%s", "eglib: g_filename_from_uri: hostname not 
handled");
 
        if (strncmp (uri, "file:///", 8) != 0){
                if (error != NULL)

Modified: trunk/mono/eglib/src/gtimer.c
===================================================================
--- trunk/mono/eglib/src/gtimer.c       2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gtimer.c       2007-04-24 18:21:18 UTC (rev 76209)
@@ -26,7 +26,11 @@
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #include <glib.h>
+#ifdef _MSC_VER
+#include <winsock2.h>
+#else
 #include <sys/time.h>
+#endif
 
 struct _GTimer {
        struct timeval start;

Modified: trunk/mono/eglib/src/gunicode.c
===================================================================
--- trunk/mono/eglib/src/gunicode.c     2007-04-24 18:21:17 UTC (rev 76208)
+++ trunk/mono/eglib/src/gunicode.c     2007-04-24 18:21:18 UTC (rev 76209)
@@ -35,9 +35,15 @@
  */
 #include <stdio.h>
 #include <glib.h>
+#include <errno.h>
+#ifdef _MSC_VER
+/* FIXME */
+#define CODESET 1
+typedef int iconv_t;
+#else
 #include <langinfo.h>
 #include <iconv.h>
-#include <errno.h>
+#endif
 
 static char *my_charset;
 static gboolean is_utf8;
@@ -45,14 +51,14 @@
 GUnicodeType 
 g_unichar_type (gunichar c)
 {
-       g_error ("g_unichar_type is not implemented");
+       g_error ("%s", "g_unichar_type is not implemented");
        return 0;
 }
 
 gunichar
 g_unichar_tolower (gunichar c)
 {
-       g_error ("g_unichar_type is not implemented");
+       g_error ("%s", "g_unichar_type is not implemented");
        return 0;
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to