diff -x CVS -ru3 -N /home/src/gnomecvs/glib/ChangeLog ./ChangeLog
--- /home/src/gnomecvs/glib/ChangeLog   Thu Oct  8 10:54:11 1998
+++ ./ChangeLog Tue Oct 20 22:51:30 1998
@@ -1,3 +1,101 @@
+1998-10-20: Tor Lillqvist <[email protected]>
+
+       * README.win32 glib.def gmodule.def
+       * glibconfig.h.win32 gmodule/gmoduleconf.h.win32:
+       New files for the Windows port. The .def files list exported
+       symbols for the Microsoft linker and compatibles.
+
+       * configure.in:
+       Added checks for some platform-dependent headers: pwd.h sys/param.h
+       sys/select.h sys/time.h sys/times.h unistd.h, and the function lstat.
+
+       * gerror.c:
+       Conditionalized inclusion of system-dependent headers. Changes
+       for Windows: no gdb to do a stack trace. Just call abort().
+
+       * glib.h:
+       Changes for Windows:
+
+       Added macros G_DIR_SEPARATOR, G_DIR_SEPARATOR_S for
+       platform-dependent file name syntax elements. Added macros
+       G_SEARCHPATH_SEPARATOR, G_SEARCHPATH_SEPARATOR_S for
+       platform-dependent search path syntax conventions.
+
+       Added pragmas for Microsoft C to make it more pedantic.
+
+       Marked GLib's global variables for export from DLL.
+
+       Added the function g_strescape that escapes backslashes.
+
+       Added functions g_path_is_absolute and g_path_skip_root to
+       handle platform-dependent file name syntax.
+
+       Added the function g_getenv that expands environment variables
+       that contain references to other environment variables, as is
+       typical on Windows NT.
+
+       Added the GIOChannel structure which is used to encapsulate the
+       IPC mechanism used by the GIMP's plug-ins, and possibly other
+       things later. On Unix a GIOChannel encapsulates just a file
+       descriptor. On Windows it contains a file handle from _pipe() and a
+       few other things related to the implementation of gdk_input_add
+       and GIMP plug-in communication. Subject to change.
+
+       Removed duplicate declarations of the version variables.
+
+       For the Microsoft compiler, declare own implementation of
+       ftruncate and the <dirent.h> functions.
+
+       * gmem.c:
+       Define a symbolic name  for the profiling table size.
+
+       * gmessages.c:
+       Conditionalized inclusion of unistd.h. On Windows, output using
+       stdio to stdout.
+
+       * gmodule/gmodule-win32.c:
+       New file.
+
+       * gmodule/gmodule.c gmodule/gmodule.h:
+       Added the funcion g_module_build_path that builds the path to
+       a module file, decorating the name according to the system's
+       conventions.  Added the Windows implementation.
+
+       * gmodule/libgplugin_a.c gmodule/libgplugin_b.c:
+       Added LibMain for LCC-Win32.
+
+       * gmodule/testgmodule.c:
+       Handle Windows dll names.
+
+       * gscanner.c:
+       Conditionalized inclusion of unistd.h. Added changes for
+       Microsoft C. Added CR to the skipped character set. Added small
+       workaround for MSC compiler bug in g_scanner_cur_value.
+
+       * gstrfuncs.c:
+       Added the function g_strescape, which escapes the backslash
+       character. Needed especially when printing Windows filenames.
+
+       * gtimer.c:
+       Conditionalized inclusion of unistd.h and sys/time.h. Added
+       implementations for Windows.
+
+       * gutils.c:
+       Conditionalized inclusion of platform-dependent headers. Use
+       the platform-independent file name syntax macros.
+       Conditionalize code on platform-dependent features. Added the
+       functions g_path_is_absolute g_path_skip_root and g_getenv.
+       Added the GIOChannel-related functions. Added
+       compiler-dependent Unix compatibility functions for Windows.
+
+       * makefile.lcc makefile.msc:
+       New files. Compiler-specific makefiles for LCC-Win32 and
+       Microsoft C. Only Microsoft C is actually supported currently.
+
+       * testglib.c:
+       Added pathname check cases for Windows. Added workaround for
+       bug in the Microsoft runtime library. Improved some tests a bit.
+
Thu Oct  8 06:47:27 1998  Tim Janik  <[email protected]>

       * glib.h:
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/README.win32 ./README.win32
--- /home/src/gnomecvs/glib/README.win32        Thu Jan  1 02:00:00 1970
+++ ./README.win32      Tue Oct 20 21:36:24 1998
@@ -0,0 +1,7 @@
+For more information about the Windows port, see
+http://www.iki.fi/tml/gimp/win32/ .
+
+As for now, only Microsoft C is really supported. Before compiling,
+check the BIN definition in makefile.msc. Compile with `nmake -f
+makefile.msc`. Install with `nmake -f makefile.msc install`. Gnu-Win32
+with egcs and maybe LCC-Win32 support will be added later.
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/acconfig.h ./acconfig.h
--- /home/src/gnomecvs/glib/acconfig.h  Wed Sep  9 10:55:54 1998
+++ ./acconfig.h        Tue Oct 20 21:07:38 1998
@@ -43,9 +43,14 @@
#undef HAVE_FLOAT_H
#undef HAVE_LIMITS_H
#undef HAVE_LONG_DOUBLE
+#undef HAVE_PWD_H
+#undef HAVE_SYS_PARAM_H
#undef HAVE_SYS_SELECT_H
+#undef HAVE_SYS_TIME_H
+#undef HAVE_SYS_TIMES_H
#undef HAVE_STRERROR
#undef HAVE_STRSIGNAL
+#undef HAVE_UNISTD_H
#undef HAVE_VSNPRINTF
#undef HAVE_VALUES_H
#undef HAVE_VPRINTF
@@ -73,6 +78,9 @@
#undef GLIB_MICRO_VERSION
#undef GLIB_INTERFACE_AGE
#undef GLIB_BINARY_AGE
+
+#undef WIN32
+#undef NATIVE_WIN32

/* #undef PACKAGE */
/* #undef VERSION */
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/configure.in ./configure.in
--- /home/src/gnomecvs/glib/configure.in        Sun Oct 18 09:13:49 1998
+++ ./configure.in      Wed Oct 21 00:24:23 1998
@@ -217,10 +217,16 @@
dnl header file checks
AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H))
AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H))
+AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
+AC_CHECK_HEADERS(sys/param.h, AC_DEFINE(HAVE_SYS_PARAM_H))
+AC_CHECK_HEADERS(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H))
+AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
+AC_CHECK_HEADERS(sys/times.h, AC_DEFINE(HAVE_SYS_TIMES_H))
+AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))

-# Check for strerror, strsignal, memmove, vsnprintf, and strcasecmp functions
-AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf strcasecmp)
+# Check for some functions
+AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp)

# Check for sys_errlist
AC_MSG_CHECKING(for sys_errlist)
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gerror.c ./gerror.c
--- /home/src/gnomecvs/glib/gerror.c    Wed Sep  9 10:55:55 1998
+++ ./gerror.c  Mon Oct 12 20:27:06 1998
@@ -20,13 +20,19 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include "glib.h"
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
+#endif
#include <sys/types.h>

#include <time.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#include "glib.h"
+#endif

#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
@@ -36,6 +42,9 @@
#include <string.h> /* for bzero on BSD systems */
#endif

+#ifdef _MSC_VER
+#include <process.h>           /* For _getpid() */
+#endif

#ifndef NO_FD_SET
#  define SELECT_MASK fd_set
@@ -115,6 +124,7 @@
void
g_on_error_stack_trace (const gchar *prg_name)
{
+#ifndef NATIVE_WIN32
  pid_t pid;
  gchar buf[16];
  gchar *args[4] = { "gdb", NULL, NULL, NULL };
@@ -142,6 +152,9 @@
  while (glib_on_error_halt)
    ;
  glib_on_error_halt = TRUE;
+#else
+  abort ();
+#endif
}

static gboolean stack_trace_done = FALSE;
@@ -155,6 +168,7 @@
static void
stack_trace (char **args)
{
+#ifndef NATIVE_WIN32
  pid_t pid;
  int in_fd[2];
  int out_fd[2];
@@ -249,4 +263,7 @@
  close (out_fd[0]);
  close (out_fd[1]);
  _exit (0);
+#else
+  abort ();
+#endif
}
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/glib.def ./glib.def
--- /home/src/gnomecvs/glib/glib.def    Thu Jan  1 02:00:00 1970
+++ ./glib.def  Wed Oct 21 00:47:18 1998
@@ -0,0 +1,302 @@
+EXPORTS
+       g_array_append_vals
+       g_array_free
+       g_array_new
+       g_array_prepend_vals
+       g_array_set_size
+       g_atexit
+       g_basename
+       g_bit_nth_lsf
+       g_bit_nth_msf
+       g_bit_storage
+       g_blow_chunks
+       g_byte_array_append
+       g_byte_array_free
+       g_byte_array_new
+       g_byte_array_prepend
+       g_byte_array_set_size
+       g_cache_destroy
+       g_cache_insert
+       g_cache_key_foreach
+       g_cache_new
+       g_cache_remove
+       g_cache_value_foreach
+       g_closedir
+       g_completion_add_items
+       g_completion_clear_items
+       g_completion_complete
+       g_completion_free
+       g_completion_new
+       g_completion_remove_items
+       g_datalist_clear
+       g_datalist_foreach
+       g_datalist_id_get_data
+       g_datalist_id_remove_no_notify
+       g_datalist_id_set_data_full
+       g_datalist_init
+       g_dataset_destroy
+       g_dataset_foreach
+       g_dataset_id_get_data
+       g_dataset_id_remove_no_notify
+       g_dataset_id_set_data_full
+       g_direct_equal
+       g_direct_hash
+       g_dirname
+       g_free
+       g_ftruncate
+       g_get_current_dir
+       g_get_home_dir
+       g_get_prgname
+       g_get_real_name
+       g_get_tmp_dir
+       g_get_user_name
+       g_getenv
+       g_hash_table_destroy
+       g_hash_table_foreach
+       g_hash_table_foreach_remove
+       g_hash_table_freeze
+       g_hash_table_insert
+       g_hash_table_lookup
+       g_hash_table_lookup_extended
+       g_hash_table_new
+       g_hash_table_remove
+       g_hash_table_size
+       g_hash_table_thaw
+       g_hook_alloc
+       g_hook_compare_ids
+       g_hook_destroy
+       g_hook_destroy_link
+       g_hook_find
+       g_hook_find_data
+       g_hook_find_func
+       g_hook_find_func_data
+       g_hook_first_valid
+       g_hook_free
+       g_hook_get
+       g_hook_insert_before
+       g_hook_insert_sorted
+       g_hook_list_init
+       g_hook_list_invoke
+       g_hook_list_invoke_check
+       g_hook_list_marshal
+       g_hook_list_clear
+       g_hook_next_valid
+       g_hook_prepend
+       g_hook_ref
+       g_hook_unref
+       g_int_equal
+       g_int_hash
+       g_iochannel_new
+       g_iochannel_free
+       g_iochannel_close_and_free
+       g_iochannel_wakeup_peer
+       g_list_alloc
+       g_list_allocator_free
+       g_list_allocator_new
+       g_list_append
+       g_list_concat
+       g_list_find
+       g_list_find_custom
+       g_list_first
+       g_list_foreach
+       g_list_free
+       g_list_free_1
+       g_list_index
+       g_list_insert
+       g_list_insert_sorted
+       g_list_last
+       g_list_length
+       g_list_nth
+       g_list_nth_data
+       g_list_position
+       g_list_prepend
+       g_list_remove
+       g_list_remove_link
+       g_list_reverse
+       g_list_set_allocator
+       g_log
+       g_log_default_handler
+       g_log_remove_handler
+       g_log_set_always_fatal
+       g_log_set_fatal_mask
+       g_log_set_handler
+       g_logv
+       g_malloc
+       g_malloc0
+       g_mem_check
+       g_mem_chunk_alloc
+       g_mem_chunk_alloc0
+       g_mem_chunk_clean
+       g_mem_chunk_destroy
+       g_mem_chunk_free
+       g_mem_chunk_info
+       g_mem_chunk_new
+       g_mem_chunk_print
+       g_mem_chunk_reset
+       g_mem_profile
+       g_memdup
+       g_node_child_index
+       g_node_child_position
+       g_node_children_foreach
+       g_node_depth
+       g_node_destroy
+       g_node_find
+       g_node_find_child
+       g_node_first_sibling
+       g_node_get_root
+       g_node_insert
+       g_node_insert_before
+       g_node_is_ancestor
+       g_node_last_child
+       g_node_last_sibling
+       g_node_max_height
+       g_node_n_children
+       g_node_n_nodes
+       g_node_new
+       g_node_nth_child
+       g_node_prepend
+       g_node_reverse_children
+       g_node_traverse
+       g_node_unlink
+       g_on_error_query
+       g_on_error_stack_trace
+       g_opendir
+       g_parse_debug_string
+       g_path_is_absolute
+       g_path_skip_root
+       g_print
+       g_printerr
+       g_printf_string_upper_bound
+       g_ptr_array_add
+       g_ptr_array_free
+       g_ptr_array_new
+       g_ptr_array_remove
+       g_ptr_array_remove_index
+       g_ptr_array_set_size
+       g_quark_from_static_string
+       g_quark_from_string
+       g_quark_to_string
+       g_quark_try_string
+       g_readdir
+       g_realloc
+       g_relation_count
+       g_relation_delete
+       g_relation_destroy
+       g_relation_exists
+       g_relation_index
+       g_relation_insert
+       g_relation_new
+       g_relation_print
+       g_relation_select
+       g_rewinddir
+       g_scanner_cur_line
+       g_scanner_cur_position
+       g_scanner_cur_token
+       g_scanner_cur_value
+       g_scanner_destroy
+       g_scanner_eof
+       g_scanner_error
+       g_scanner_freeze_symbol_table
+       g_scanner_get_next_token
+       g_scanner_input_file
+       g_scanner_input_text
+       g_scanner_lookup_symbol
+       g_scanner_new
+       g_scanner_peek_next_token
+       g_scanner_scope_add_symbol
+       g_scanner_scope_foreach_symbol
+       g_scanner_scope_lookup_symbol
+       g_scanner_scope_remove_symbol
+       g_scanner_set_scope
+       g_scanner_stat_mode
+       g_scanner_thaw_symbol_table
+       g_scanner_unexp_token
+       g_scanner_warn
+       g_set_error_handler
+       g_set_message_handler
+       g_set_prgname
+       g_set_print_handler
+       g_set_printerr_handler
+       g_set_warning_handler
+       g_slist_alloc
+       g_slist_append
+       g_slist_concat
+       g_slist_find
+       g_slist_find_custom
+       g_slist_foreach
+       g_slist_free
+       g_slist_free_1
+       g_slist_index
+       g_slist_insert
+       g_slist_insert_sorted
+       g_slist_last
+       g_slist_length
+       g_slist_nth
+       g_slist_nth_data
+       g_slist_position
+       g_slist_prepend
+       g_slist_remove
+       g_slist_remove_link
+       g_slist_reverse
+       g_slist_set_allocator
+       g_snprintf
+       g_str_equal
+       g_str_hash
+       g_strcasecmp
+       g_strconcat
+       g_strdelimit
+       g_strdown
+       g_strdup
+       g_strdup_printf
+       g_strdup_vprintf
+       g_strerror
+       g_string_append
+       g_string_append_c
+       g_string_assign
+       g_string_chunk_free
+       g_string_chunk_insert
+       g_string_chunk_insert_const
+       g_string_chunk_new
+       g_string_down
+       g_string_erase
+       g_string_free
+       g_string_insert
+       g_string_insert_c
+       g_string_new
+       g_string_prepend
+       g_string_prepend_c
+       g_string_sized_new
+       g_string_sprintf
+       g_string_sprintfa
+       g_string_truncate
+       g_string_up
+       g_strescape
+       g_strndup
+       g_strnfill
+       g_strreverse
+       g_strsignal
+       g_strtod
+       g_strup
+       g_timer_destroy
+       g_timer_elapsed
+       g_timer_new
+       g_timer_reset
+       g_timer_start
+       g_timer_stop
+       g_tree_destroy
+       g_tree_height
+       g_tree_insert
+       g_tree_lookup
+       g_tree_new
+       g_tree_nnodes
+       g_tree_remove
+       g_tree_search
+       g_tree_traverse
+       g_tuples_destroy
+       g_tuples_index
+       g_vsnprintf
+       glib_binary_age
+       glib_interface_age
+       glib_major_version
+       glib_micro_version
+       glib_minor_version
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/glib.h ./glib.h
--- /home/src/gnomecvs/glib/glib.h      Thu Oct  8 10:54:11 1998
+++ ./glib.h    Tue Oct 20 23:01:10 1998
@@ -34,6 +34,52 @@
#endif


+#ifdef NATIVE_WIN32
+
+/* On native Win32, directory separator is the backslash, and search path
+ * separator is the semicolon.
+ */
+#define G_DIR_SEPARATOR '\\'
+#define G_DIR_SEPARATOR_S "\\"
+#define G_SEARCHPATH_SEPARATOR ';'
+#define G_SEARCHPATH_SEPARATOR_S ";"
+
+#else  /* !NATIVE_WIN32 */
+
+/* Unix */
+
+#define G_DIR_SEPARATOR '/'
+#define G_DIR_SEPARATOR_S "/"
+#define G_SEARCHPATH_SEPARATOR ':'
+#define G_SEARCHPATH_SEPARATOR_S ":"
+
+#endif /* !NATIVE_WIN32 */
+
+#ifdef _MSC_VER
+/* Make MSVC more pedantic, this is a recommended pragma list
+   from _Win32_Programming_ by Rector and Newcomer.  */
+#pragma warning(error:4002)
+#pragma warning(error:4003)
+#pragma warning(1:4010)
+#pragma warning(error:4013)
+#pragma warning(1:4016)
+#pragma warning(error:4020)
+#pragma warning(error:4021)
+#pragma warning(error:4027)
+#pragma warning(error:4029)
+#pragma warning(error:4033)
+#pragma warning(error:4035)
+#pragma warning(error:4045)
+#pragma warning(error:4047)
+#pragma warning(error:4049)
+#pragma warning(error:4053)
+#pragma warning(error:4071)
+#pragma warning(disable:4101)
+#pragma warning(error:4150)
+
+#pragma warning(disable:4244)  /* No possible loss of data warnings, please */
+#endif /* _MSC_VER */
+
/* glib provides definitions for the extrema of many
 *  of the standard types. These are:
 * G_MINFLOAT
@@ -552,12 +598,21 @@

/* Glib version.
 */
-extern const guint glib_major_version;
-extern const guint glib_minor_version;
-extern const guint glib_micro_version;
-extern const guint glib_interface_age;
-extern const guint glib_binary_age;
+#ifdef NATIVE_WIN32
+#ifdef COMPILING_GLIB
+#define GUTILS_C_VAR __declspec(dllexport)
+#else
+#define GUTILS_C_VAR __declspec(dllimport)
+#endif
+#else
+#define GUTILS_C_VAR extern
+#endif

+GUTILS_C_VAR const guint glib_major_version;
+GUTILS_C_VAR const guint glib_minor_version;
+GUTILS_C_VAR const guint glib_micro_version;
+GUTILS_C_VAR const guint glib_interface_age;
+GUTILS_C_VAR const guint glib_binary_age;

/* Forward declarations of glib types.
 */
@@ -586,7 +641,7 @@
typedef struct _GTree          GTree;
typedef struct _GTuples                GTuples;
typedef union  _GTokenValue    GTokenValue;
-
+typedef struct _GIOChannel     GIOChannel;

typedef enum
{
@@ -1124,7 +1179,7 @@

/* Logging mechanism
 */
-extern const gchar                     *g_log_domain_glib;
+extern         const gchar             *g_log_domain_glib;
guint          g_log_set_handler       (const gchar    *log_domain,
                                        GLogLevelFlags  log_levels,
                                        GLogFunc        log_func,
@@ -1314,6 +1369,7 @@
void    g_strreverse           (gchar       *string);
gpointer g_memdup              (gconstpointer mem,
                                guint         byte_size);
+gchar *  g_strescape           (gchar       *string);

/* calculate a string size, guarranteed to fit format + args.
 */
@@ -1345,10 +1401,15 @@
                                gchar const *format,
                                va_list      args);
gchar* g_basename              (const gchar *file_name);
+/* Check if a file name is an absolute path */
+gboolean g_path_is_absolute    (const gchar *file_name);
+/* In case of absolute paths, skip the root part */
+gchar*  g_path_skip_root       (gchar       *file_name);

/* strings are newly allocated with g_malloc() */
gchar* g_dirname               (const gchar *file_name);
gchar* g_get_current_dir       (void);
+gchar*  g_getenv               (const gchar *variable);

/* We make the assumption that if memmove isn't available, then
 * bcopy will do the job. This isn't safe everywhere. (bcopy can't
@@ -1430,7 +1491,6 @@
}
#endif /* G_CAN_INLINE */

-
/* String Chunks
 */
GStringChunk* g_string_chunk_new          (gint size);
@@ -1922,11 +1982,115 @@

guint     g_spaced_primes_closest (guint num);

-/* Glib version.
+
+/* IO Channels.
+ * These are used for plug-in communication in the GIMP, for instance.
+ * On Unix, it's simply an encapsulated file descriptor (a pipe).
+ * On Windows, it's a handle to an anonymouos pipe, *and* (in the case
+ * of the writable end) a thread id to post a message to when you have written
+ * stuff.
+ */
+struct _GIOChannel
+{
+  int fd;                      /* file handle (pseudo such in Win32) */
+#ifdef NATIVE_WIN32
+  guint peer;                  /* thread to post message to */
+  guint peer_fd;               /* read handle (in the other process) */
+  guint offset;                        /* counter of accumulated bytes, to
+                                * be included in the message posted
+                                * so we keep in sync.
+                                */
+  guint peer_offset;           /* in input channels where the writer's
+                                * offset is, so we don't try to read too much
+                                */
+#endif
+};
+
+GIOChannel *g_iochannel_new     (gint fd);
+void g_iochannel_free           (GIOChannel *channel);
+void g_iochannel_close_and_free (GIOChannel *channel);
+void g_iochannel_wakeup_peer    (GIOChannel *channel);
+
+#ifndef NATIVE_WIN32
+#define g_iochannel_wakeup_peer(channel) G_STMT_START { } G_STMT_END
+#endif
+
+#ifdef NATIVE_WIN32
+
+#define MAXPATHLEN 1024
+
+#if defined (_MSC_VER)
+
+typedef int pid_t;
+
+/* These POSIXish functions are available in the Microsoft C library
+ * prefixed with underscore (which of course technically speaking is
+ * the Right Thing, as they are non-ANSI. Not that being non-ANSI
+ * prevents Microsoft from practically requiring you to include
+ * <windows.h> every now and then...).
+ *
+ * You still need to include the appropriate headers to get the
+ * prototypes, <io.h> or <direct.h>.
 */
-extern const guint glib_major_version;
-extern const guint glib_minor_version;
-extern const guint glib_micro_version;
+#define getcwd _getcwd
+#define getpid _getpid
+#define access _access
+#define open _open
+#define read _read
+#define write _write
+#define lseek _lseek
+#define close _close
+#define pipe(phandles) _pipe(phandles,4096,_O_BINARY)
+#define popen _popen
+#define pclose _pclose
+#define fdopen _fdopen
+
+/* MSC doesn't have ftrunctate, we emulate it */
+#define ftruncate(fd, size) g_ftruncate (fd, size)
+extern int g_ftruncate (int f, unsigned int size);
+
+/* MSC needs our own opendir/readdir/closedir emulation routines */
+
+#define NAME_MAX 255
+
+typedef struct {
+  char *dir_name;
+  void *lpFindFileData;
+  guint hFindFile;
+  gboolean just_opened;
+} DIR;
+
+struct dirent {
+  char d_name[NAME_MAX+1];
+};
+
+#define opendir g_opendir
+#define readdir g_readdir
+#define rewinddir g_rewinddir
+#define closedir g_closedir
+
+DIR           *opendir   (const char *dirname);
+struct  dirent *readdir          (DIR *dir);
+void           rewinddir (DIR *dir);
+int            closedir  (DIR *dir);
+
+#endif /* _MSC_VER */
+
+#define g_ntohl(x) \
+  ((guint32)((((guint32)(x) & 0x000000ffU) << 24) | \
+            (((guint32)(x) & 0x0000ff00U) <<  8) | \
+            (((guint32)(x) & 0x00ff0000U) >>  8) | \
+            (((guint32)(x) & 0xff000000U) >> 24)))
+
+#define g_htonl(x) g_ntohl(x)
+
+#define g_ntohs(x) \
+  ((guint16)((((guint16)(x) & 0x00ff) << 8) | \
+            (((guint16)(x) & 0xff00) >> 8)))
+
+#define g_htons(x) g_ntohs(x)
+
+#endif /* NATIVE_WIN32 */

#ifdef __cplusplus
}
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/glibconfig.h.in ./glibconfig.h.in
--- /home/src/gnomecvs/glib/glibconfig.h.in     Wed Sep  9 10:55:56 1998
+++ ./glibconfig.h.in   Wed Oct 21 00:30:59 1998
@@ -21,9 +21,14 @@
#undef HAVE_FLOAT_H
#undef HAVE_LIMITS_H
#undef HAVE_LONG_DOUBLE
+#undef HAVE_PWD_H
+#undef HAVE_SYS_PARAM_H
#undef HAVE_SYS_SELECT_H
+#undef HAVE_SYS_TIME_H
+#undef HAVE_SYS_TIMES_H
#undef HAVE_STRERROR
#undef HAVE_STRSIGNAL
+#undef HAVE_UNISTD_H
#undef HAVE_VSNPRINTF
#undef HAVE_VALUES_H
#undef HAVE_VPRINTF
@@ -67,6 +72,9 @@
/* Define if you have the atexit function.  */
#undef HAVE_ATEXIT

+/* Define if you have the lstat function.  */
+#undef HAVE_LSTAT
+
/* Define if you have the memmove function.  */
#undef HAVE_MEMMOVE

@@ -93,3 +101,9 @@

/* Define if you have the <values.h> header file.  */
#undef HAVE_VALUES_H
+
+/* Define if this is Win32, possibly using the GNU-Win32 emulation layer. */
+#undef WIN32
+
+/* Define if this is Win32 without GNU-Win32.  */
+#undef NATIVE_WIN32 1
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/glibconfig.h.win32 ./glibconfig.h.win32
--- /home/src/gnomecvs/glib/glibconfig.h.win32  Thu Jan  1 02:00:00 1970
+++ ./glibconfig.h.win32        Tue Oct 20 22:42:38 1998
@@ -0,0 +1,119 @@
+/* glibconfig.h.win32. Handcrafted for Microsoft C  */
+
+#if !(defined(_MSC_VER) || defined(__LCC__))
+#error Unrecognized Win32 compiler, edit glibconfig.h by hand
+#endif
+
+/* Define to empty if the keyword does not work.  */
+/* #undef const */
+
+/* Define if you don't have vprintf but do have _doprnt.  */
+/* #undef HAVE_DOPRNT */
+
+/* Define if you have the vprintf function.  */
+#define HAVE_VPRINTF 1
+
+/* Define as __inline if that's what the C compiler calls it.  */
+#if defined (_MSC_VER)
+#define G_HAVE___INLINE
+#endif
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* #undef ENABLE_MEM_CHECK */
+/* #undef ENABLE_MEM_PROFILE */
+
+/* #undef G_COMPILED_WITH_DEBUGGING */
+/* #undef HAVE_BROKEN_WCTYPE */
+/* #undef HAVE_DOPRNT */
+/* #undef HAVE_LONG_DOUBLE */
+/* #undef HAVE_PWD_H */
+/* #undef HAVE_SYS_PARAM_H */
+/* #undef HAVE_SYS_SELECT_H */
+/* #undef HAVE_SYS_TIME_H */
+/* #undef HAVE_SYS_TIMES_H */
+/* #undef HAVE_UNISTD_H */
+/* #undef HAVE_VSNPRINTF */
+#define HAVE_VPRINTF 1
+#ifdef _MSC_VER
+#define HAVE_WCHAR_H 1
+#define HAVE_WCTYPE_H 1
+#else
+#undef HAVE_WCHAR_H
+#undef HAVE_WCTYPE_H
+#endif
+
+/* #undef NO_FD_SET */
+/* #undef NO_SYS_ERRLIST */
+#define NO_SYS_SIGLIST 1
+
+#define GLIB_MAJOR_VERSION 1
+#define GLIB_MINOR_VERSION 1
+#define GLIB_MICRO_VERSION 4
+#define GLIB_INTERFACE_AGE 0
+#define GLIB_BINARY_AGE 0
+
+/* The number of bytes in a char.  */
+#define SIZEOF_CHAR 1
+
+/* The number of bytes in a int.  */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long.  */
+#define SIZEOF_LONG 4
+
+/* The number of bytes in a long long.  */
+/* #undef SIZEOF_LONG_LONG */
+
+/* The number of bytes in a short.  */
+#define SIZEOF_SHORT 2
+
+/* The number of bytes in a void *.  */
+#define SIZEOF_VOID_P 4
+
+/* Define if you have the atexit function.  */
+#define HAVE_ATEXIT 1
+
+/* Define if you have the lstat function.  */
+/* #undef HAVE_LSTAT */
+
+/* Define if you have the memmove function.  */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the on_exit function.  */
+/* #undef HAVE_ON_EXIT */
+
+/* Define if you have the strcasecmp function.  */
+/* #undef HAVE_STRCASECMP */
+
+/* Define if you have the strerror function.  */
+#define HAVE_STRERROR 1
+
+/* Define if you have the strsignal function.  */
+/* #undef HAVE_STRSIGNAL */
+
+/* Define if you have the vsnprintf function.  */
+/* #undef HAVE_VSNPRINTF */
+
+/* Define if you have the getpid function.  */
+/* #undef HAVE_GETPID */
+
+/* Define if you have the <float.h> header file.  */
+#ifdef _MSC_VER
+#define HAVE_FLOAT_H 1
+#else
+/* #undef HAVE_FLOAT_H */
+#endif
+
+/* Define if you have the <limits.h> header file.  */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <values.h> header file.  */
+/* #undef HAVE_VALUES_H */
+
+/* Define if this is Win32, possibly using the GNU-Win32 emulation layer. */
+#define WIN32 1
+
+/* Define if this is Win32 without GNU-Win32.  */
+#define NATIVE_WIN32 1
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmem.c ./gmem.c
--- /home/src/gnomecvs/glib/gmem.c      Tue Oct  6 21:31:24 1998
+++ ./gmem.c    Tue Oct 20 22:46:14 1998
@@ -23,6 +23,7 @@
/* #define ENABLE_MEM_PROFILE */
/* #define ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS */
/* #define ENABLE_MEM_CHECK */
+#define MEM_PROFILE_TABLE_SIZE 8192

/*
 * This library can check for some attempts to do illegal things to
@@ -114,7 +115,7 @@
static GRealMemChunk *mem_chunks = NULL;

#ifdef ENABLE_MEM_PROFILE
-static gulong allocations[4096] = { 0 };
+static gulong allocations[MEM_PROFILE_TABLE_SIZE] = { 0 };
static gulong allocated_mem = 0;
static gulong freed_mem = 0;
static gint allocating_for_mem_chunk = 0;
@@ -171,10 +172,10 @@
#  ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
  if(!allocating_for_mem_chunk) {
#  endif
-    if (size <= 4095)
+    if (size <= MEM_PROFILE_TABLE_SIZE - 1)
      allocations[size-1] += 1;
    else
-      allocations[4095] += 1;
+      allocations[MEM_PROFILE_TABLE_SIZE-1] += 1;
    allocated_mem += size;
#  ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
  }
@@ -201,7 +202,7 @@
    return NULL;


-#if defined (ENABLE_MEM_PROFILE) || defined (ENABLE_MEM_CHECK)
+#if defined(ENABLE_MEM_PROFILE) || defined (ENABLE_MEM_CHECK)
  size += SIZEOF_LONG;
#endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */

@@ -234,10 +235,10 @@
#    ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
  if(!allocating_for_mem_chunk) {
#    endif
-    if (size <= 4095)
+    if (size <= (MEM_PROFILE_TABLE_SIZE-1))
      allocations[size-1] += 1;
    else
-      allocations[4095] += 1;
+      allocations[MEM_PROFILE_TABLE_SIZE-1] += 1;
    allocated_mem += size;
#    ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
  }
@@ -318,10 +319,10 @@
#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
  if(!allocating_for_mem_chunk) {
#endif
-    if (size <= 4095)
+    if (size <= (MEM_PROFILE_TABLE_SIZE-1))
      allocations[size-1] += 1;
    else
-      allocations[4095] += 1;
+      allocations[MEM_PROFILE_TABLE_SIZE-1] += 1;
    allocated_mem += size;
#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
  }
@@ -375,14 +376,15 @@
#ifdef ENABLE_MEM_PROFILE
  gint i;

-  for (i = 0; i < 4095; i++)
+  for (i = 0; i < (MEM_PROFILE_TABLE_SIZE-1); i++)
    if (allocations[i] > 0)
      g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
            "%lu allocations of %d bytes\n", allocations[i], i + 1);

-  if (allocations[4095] > 0)
+  if (allocations[MEM_PROFILE_TABLE_SIZE-1] > 0)
    g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
-          "%lu allocations of greater than 4095 bytes\n", allocations[4095]);
+          "%lu allocations of greater than %d bytes\n",
+          allocations[MEM_PROFILE_TABLE_SIZE-1], MEM_PROFILE_TABLE_SIZE-1);
  g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes allocated\n", allocated_mem);
  g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes freed\n", freed_mem);
  g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes in use\n", allocated_mem - freed_mem);
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmessages.c ./gmessages.c
--- /home/src/gnomecvs/glib/gmessages.c Wed Sep  9 10:55:56 1998
+++ ./gmessages.c       Tue Oct 20 22:47:00 1998
@@ -20,8 +20,24 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#include "glib.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef NATIVE_WIN32
+
+/* Just use stdio. If we're out of memroy, we're hosed anyway. */
+#undef write
+
+static int
+write (FILE *fd, const char *buf, int len)
+{
+  fwrite (buf, len, 1, fd);
+  return len;
+}
+
+#endif


/* --- structures --- */
@@ -334,7 +350,11 @@
                      const gchar    *message,
                      gpointer        unused_data)
{
+#ifdef NATIVE_WIN32
+  FILE *fd;
+#else
  gint fd;
+#endif
  gboolean in_recursion;
  gboolean is_fatal;

@@ -345,7 +365,13 @@
  if (!message)
    message = "g_log_default_handler(): (NULL) message";

+#ifdef NATIVE_WIN32
+  /* Use just stdout as stderr is hard to get redirected from the
+     DOS prompt. */
+  fd = stdout;
+#else
  fd = (log_level >= G_LOG_LEVEL_MESSAGE) ? 1 : 2;
+#endif

  switch (log_level)
    {
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/gmodule-dl.c ./gmodule/gmodule-dl.c
--- /home/src/gnomecvs/glib/gmodule/gmodule-dl.c        Wed Sep  9 10:55:58 1998
+++ ./gmodule/gmodule-dl.c      Tue Oct 20 22:48:30 1998
@@ -115,3 +115,13 @@

  return p;
}
+
+static gchar *
+_g_module_build_path (const gchar *directory,
+                     const gchar *module_name)
+{
+  if (directory != NULL && directory[0] != '\0')
+    return g_strdup_printf ("%s/%s.so", directory, module_name);
+  else
+    return g_strdup_printf ("%s.so", module_name);
+}
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/gmodule-dld.c ./gmodule/gmodule-dld.c
--- /home/src/gnomecvs/glib/gmodule/gmodule-dld.c       Wed Sep  9 10:55:58 1998
+++ ./gmodule/gmodule-dld.c     Tue Oct 20 22:48:36 1998
@@ -112,3 +112,13 @@

  return p;
}
+
+static gchar *
+_g_module_build_path (const gchar *directory,
+                     const gchar *module_name)
+{
+  if (directory != NULL && directory[0] != '\0')
+    return g_strdup_printf ("%s/%s.sl", directory, module_name);
+  else
+    return g_strdup_printf ("%s.sl", module_name);
+}
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/gmodule-win32.c ./gmodule/gmodule-win32.c
--- /home/src/gnomecvs/glib/gmodule/gmodule-win32.c     Thu Jan  1 02:00:00 1970
+++ ./gmodule/gmodule-win32.c   Tue Oct 20 22:48:40 1998
@@ -0,0 +1,93 @@
+/* GMODULE - GLIB wrapper code for dynamic module loading
+ * Copyright (C) 1998 Tim Janik
+ * Copyright (C) 1998 Tor Lillqvist
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include <stdio.h>
+#include <windows.h>
+
+/* --- functions --- */
+static gpointer
+_g_module_open (const gchar    *file_name,
+               gboolean        bind_lazy)
+{
+  HINSTANCE handle;
+
+  handle = LoadLibrary (file_name);
+  if (!handle)
+    {
+      char error[100];
+      sprintf (error, "Error code %d", GetLastError ());
+      g_module_set_error (error);
+    }
+
+  return handle;
+}
+
+static gpointer
+_g_module_self (void)
+{
+  HMODULE handle;
+
+  handle = GetModuleHandle (NULL);
+  if (!handle)
+    {
+      char error[100];
+      sprintf (error, "Error code %d", GetLastError ());
+      g_module_set_error (error);
+    }
+
+  return handle;
+}
+
+static void
+_g_module_close (gpointer        handle,
+                gboolean         is_unref)
+{
+  if (!FreeLibrary (handle))
+    {
+      char error[100];
+      sprintf (error, "Error code %d", GetLastError ());
+      g_module_set_error (error);
+    }
+}
+
+static gpointer
+_g_module_symbol (gpointer       handle,
+                 const gchar    *symbol_name)
+{
+  gpointer p;
+
+  p = GetProcAddress (handle, symbol_name);
+  if (!p)
+    {
+      char error[100];
+      sprintf (error, "Error code %d", GetLastError ());
+      g_module_set_error (error);
+    }
+  return p;
+}
+
+static gchar *
+_g_module_build_path (const gchar *directory,
+                     const gchar *module_name)
+{
+  if (directory != NULL && directory[0] != '\0')
+    return g_strdup_printf ("%s\\%s.dll", directory, module_name);
+  else
+    return g_strdup_printf ("%s.dll", module_name);
+}
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/gmodule.c ./gmodule/gmodule.c
--- /home/src/gnomecvs/glib/gmodule/gmodule.c   Mon Sep 21 10:25:39 1998
+++ ./gmodule/gmodule.c Tue Oct 20 21:24:54 1998
@@ -51,6 +51,8 @@
static gpointer                _g_module_self          (void);
static gpointer                _g_module_symbol        (gpointer        handle,
                                                const gchar    *symbol_name);
+static gchar*          _g_module_build_path    (const gchar    *directory,
+                                                const gchar    *module_name);
static inline void     g_module_set_error      (const gchar    *error);
static inline GModule* g_module_find_by_handle (gpointer        handle);
static inline GModule* g_module_find_by_name   (const gchar    *name);
@@ -108,6 +110,8 @@
#include "gmodule-dl.c"
#elif  (G_MODULE_IMPL == G_MODULE_IMPL_DLD)
#include "gmodule-dld.c"
+#elif  (G_MODULE_IMPL == G_MODULE_IMPL_WIN32)
+#include "gmodule-win32.c"
#else
#undef CHECK_ERROR
#define        CHECK_ERROR(rv) { g_module_set_error ("unsupported"); return rv; }
@@ -135,6 +139,18 @@
}
#endif /* no implementation */

+#ifdef __LCC__
+
+int __stdcall
+LibMain(void *hinstDll,
+       unsigned long dwReason,
+       void *reserved)
+{
+  return(1);
+}
+
+#endif
+

/* --- functions --- */
gboolean
@@ -350,3 +366,13 @@

  return module->file_name;
}
+
+gchar *
+g_module_build_path (const gchar *directory,
+                    const gchar *module_name)
+{
+  g_return_val_if_fail (module_name != NULL, NULL);
+
+  return _g_module_build_path (directory, module_name);
+}
+
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/gmodule.h ./gmodule/gmodule.h
--- /home/src/gnomecvs/glib/gmodule/gmodule.h   Mon Sep 21 10:25:39 1998
+++ ./gmodule/gmodule.h Tue Oct 20 21:25:40 1998
@@ -33,8 +33,11 @@
 * we need autoconf support here to feature Windows dll stubs.
 */
#define        G_MODULE_IMPORT         extern
+#ifdef NATIVE_WIN32
+#define        G_MODULE_EXPORT         __declspec(dllexport)
+#else
#define        G_MODULE_EXPORT
-
+#endif

typedef enum
{
@@ -70,6 +73,20 @@
/* retrive the file name from an existing module */
gchar*         g_module_name              (GModule             *module);

+
+/* Build the actual file name containing a module. `directory' is the
+ * directory where the module file is supposed to be, or NULL or empty
+ * in which case it should either be in the current directory or, on
+ * some operating systems, in some standard place, for instance on the
+ * PATH. Hence, to be absoultely sure to get the correct module,
+ * always pass in a directory. The file name consists of the directory,
+ * if supplied, and `module_name' suitably decorated accoring to
+ * the operating system's conventions (for instance lib*.so or *.dll).
+ *
+ * No checks are made that the file exists, or is of correct type.
+ */
+gchar *                g_module_build_path       (const gchar          *directory,
+                                          const gchar          *module_name);

#ifdef __cplusplus
}
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/gmoduleconf.h.in ./gmodule/gmoduleconf.h.in
--- /home/src/gnomecvs/glib/gmodule/gmoduleconf.h.in    Wed Sep  9 10:55:58 1998
+++ ./gmodule/gmoduleconf.h.in  Wed Oct 21 00:30:14 1998
@@ -29,6 +29,7 @@
#define        G_MODULE_IMPL_NONE      0
#define        G_MODULE_IMPL_DL        1
#define        G_MODULE_IMPL_DLD       2
+#define        G_MODULE_IMPL_WIN32     3

#define        G_MODULE_IMPL           @G_MODULE_IMPL@
#undef G_MODULE_HAVE_DLERROR
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/gmoduleconf.h.win32 ./gmodule/gmoduleconf.h.win32
--- /home/src/gnomecvs/glib/gmodule/gmoduleconf.h.win32 Thu Jan  1 02:00:00 1970
+++ ./gmodule/gmoduleconf.h.win32       Fri Aug 21 23:27:36 1998
@@ -0,0 +1,46 @@
+/* GMODULE - GLIB wrapper code for dynamic module loading
+ * Copyright (C) 1998 Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __G_MODULE_CONF_H__
+#define __G_MODULE_CONF_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+
+#define        G_MODULE_IMPL_NONE      0
+#define        G_MODULE_IMPL_DL        1
+#define        G_MODULE_IMPL_DLD       2
+#define        G_MODULE_IMPL_WIN32     3
+
+#define        G_MODULE_IMPL           G_MODULE_IMPL_WIN32
+#undef G_MODULE_HAVE_DLERROR
+
+#ifdef __LCC__
+#define G_MODULE_NEED_USCORE
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __G_MODULE_CONF_H__ */
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/libgplugin_a.c ./gmodule/libgplugin_a.c
--- /home/src/gnomecvs/glib/gmodule/libgplugin_a.c      Wed Sep  9 10:55:58 1998
+++ ./gmodule/libgplugin_a.c    Sun Oct  4 00:24:46 1998
@@ -17,6 +17,18 @@
 * Boston, MA 02111-1307, USA.
 */
#include       <gmodule.h>
+#include       <stdlib.h>
+
+#ifdef __LCC__
+
+int __stdcall
+LibMain(void *hinstDll,
+       unsigned long dwReason,
+       void *reserved)
+{
+  return(1);
+}
+#endif

G_MODULE_EXPORT void
gplugin_a_func (void)
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/libgplugin_b.c ./gmodule/libgplugin_b.c
--- /home/src/gnomecvs/glib/gmodule/libgplugin_b.c      Mon Sep 21 10:25:39 1998
+++ ./gmodule/libgplugin_b.c    Thu Oct 15 13:29:20 1998
@@ -18,6 +18,18 @@
 */
#include        <gmodule.h>

+#ifdef __LCC__
+
+int __stdcall
+LibMain(void *hinstDll,
+       unsigned long dwReason,
+       void *reserved)
+{
+  return(1);
+}
+
+#endif
+
G_MODULE_EXPORT const gchar*
g_module_check_init (GModule *module)
{
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule/testgmodule.c ./gmodule/testgmodule.c
--- /home/src/gnomecvs/glib/gmodule/testgmodule.c       Wed Sep  9 10:55:58 1998
+++ ./gmodule/testgmodule.c     Fri Aug 28 09:15:08 1998
@@ -20,7 +20,7 @@
#include       <gmodule.h>


-void
+G_MODULE_EXPORT void
g_clash_func (void)
{
  g_print ("GModule: Hello global clash\n");
@@ -44,8 +44,13 @@
  string = g_get_current_dir ();
  g_print ("testgmodule (%s):\n", string);

+#ifdef WIN32
+  plugin_a = g_strconcat (string, "\\libgplugin_a.dll", NULL);
+  plugin_b = g_strconcat (string, "\\libgplugin_b.dll", NULL);
+#else
  plugin_a = g_strconcat (string, "/.libs/", "libgplugin_a.so", NULL);
  plugin_b = g_strconcat (string, "/.libs/", "libgplugin_b.so", NULL);
+#endif
  g_free (string);

  /* module handles
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gmodule.def ./gmodule.def
--- /home/src/gnomecvs/glib/gmodule.def Thu Jan  1 02:00:00 1970
+++ ./gmodule.def       Wed Oct 21 00:47:36 1998
@@ -0,0 +1,9 @@
+EXPORTS
+       g_log_domain_gmodule
+       g_module_close
+       g_module_error
+       g_module_make_resident
+       g_module_name
+       g_module_open
+       g_module_supported
+       g_module_symbol
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gscanner.c ./gscanner.c
--- /home/src/gnomecvs/glib/gscanner.c  Fri Sep 25 12:46:44 1998
+++ ./gscanner.c        Tue Oct 20 22:52:16 1998
@@ -25,13 +25,16 @@
#include       <stdarg.h>
#include       <string.h>
#include       <stdio.h>
+#include       "glib.h"
+#ifdef HAVE_UNISTD_H
#include       <unistd.h>
+#endif
#include       <errno.h>
#include       <sys/types.h>   /* needed for sys/stat.h */
#include       <sys/stat.h>
-#include       "glib.h"
-
-
+#ifdef _MSC_VER
+#include       <io.h>          /* For _read() */
+#endif

/* --- defines --- */
#define        to_lower(c)                             ( \
@@ -61,7 +64,7 @@
static GScannerConfig g_scanner_config_template =
{
  (
-   " \t\n"
+   " \t\r\n"
   )                   /* cset_skip_characters */,
  (
   G_CSET_a_2_z
@@ -616,7 +619,8 @@
  v.v_int = 0;
  g_return_val_if_fail (scanner != NULL, v);

-  return scanner->value;
+  v = scanner->value;
+  return v;
}

guint
@@ -1064,9 +1068,11 @@
  gint         st_mode;

  stat_buf = g_new0 (struct stat, 1);
-
+#ifdef HAVE_LSTAT
  lstat (filename, stat_buf);
-
+#else
+  stat (filename, stat_buf);
+#endif
  st_mode = stat_buf->st_mode;

  g_free (stat_buf);
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gstrfuncs.c ./gstrfuncs.c
--- /home/src/gnomecvs/glib/gstrfuncs.c Mon Sep 21 10:25:39 1998
+++ ./gstrfuncs.c       Tue Oct 20 21:13:34 1998
@@ -985,3 +985,32 @@
       *c = new_delim;
    }
}
+
+gchar *
+g_strescape (gchar *string)
+{
+  gint backslashes = 0;
+  gchar *p = string;
+  gchar *q;
+  gchar *escaped;
+
+  while (*p != '\000')
+    backslashes += (*p++ == '\\');
+
+  if (backslashes == 0)
+    return g_strdup (string);
+
+  escaped = g_malloc (strlen (string) + backslashes + 1);
+
+  p = string;
+  q = escaped;
+
+  while (*p != '\000')
+    {
+      if (*p == '\\')
+       *q++ = '\\';
+      *q++ = *p++;
+    }
+  *q = '\000';
+  return escaped;
+}
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gtimer.c ./gtimer.c
--- /home/src/gnomecvs/glib/gtimer.c    Wed Sep  9 10:55:57 1998
+++ ./gtimer.c  Thu Oct 15 13:52:24 1998
@@ -16,21 +16,32 @@
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
-#include <sys/time.h>
-#include <unistd.h>
#include "glib.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifndef NATIVE_WIN32
+#include <sys/time.h>
+#endif

+#ifdef NATIVE_WIN32
+#include <windows.h>
+#endif

typedef struct _GRealTimer GRealTimer;

struct _GRealTimer
{
+#ifdef NATIVE_WIN32
+  DWORD start;
+  DWORD end;
+#else
  struct timeval start;
  struct timeval end;
+#endif
  gint active;
};

-
GTimer*
g_timer_new (void)
{
@@ -39,8 +50,11 @@
  timer = g_new (GRealTimer, 1);
  timer->active = TRUE;

+#ifdef NATIVE_WIN32
+  timer->start = GetTickCount ();
+#else
  gettimeofday (&timer->start, NULL);
-
+#endif
  return ((GTimer*) timer);
}

@@ -60,7 +74,11 @@
  g_assert (timer != NULL);

  rtimer = (GRealTimer*) timer;
+#ifdef NATIVE_WIN32
+  rtimer->start = GetTickCount ();
+#else
  gettimeofday (&rtimer->start, NULL);
+#endif
  rtimer->active = 1;
}

@@ -72,7 +90,11 @@
  g_assert (timer != NULL);

  rtimer = (GRealTimer*) timer;
+#ifdef NATIVE_WIN32
+  rtimer->end = GetTickCount ();
+#else
  gettimeofday (&rtimer->end, NULL);
+#endif
  rtimer->active = 0;
}

@@ -84,7 +106,11 @@
  g_assert (timer != NULL);

  rtimer = (GRealTimer*) timer;
+#ifdef NATIVE_WIN32
+   rtimer->start = GetTickCount ();
+#else
  gettimeofday (&rtimer->start, NULL);
+#endif
}

gdouble
@@ -92,13 +118,36 @@
                gulong *microseconds)
{
  GRealTimer *rtimer;
+#ifndef NATIVE_WIN32
  struct timeval elapsed;
+#endif
  gdouble total;

  g_assert (timer != NULL);

  rtimer = (GRealTimer*) timer;

+#ifdef NATIVE_WIN32
+  if (rtimer->active)
+    rtimer->end = GetTickCount ();
+  /* Check for wraparound, which happens every 49.7 days.
+   * No, Win95 machines probably are never running for that long,
+   * but NT machines are.
+   */
+  if (rtimer->end < rtimer->start)
+    total = (UINT_MAX - (rtimer->start - rtimer->end)) / 1000.0;
+  else
+    total = (rtimer->end - rtimer->start) / 1000.0;
+  if (microseconds)
+    {
+      if (rtimer->end < rtimer->start)
+       *microseconds =
+         ((UINT_MAX - (rtimer->start - rtimer->end)) % 1000) * 1000;
+      else
+       *microseconds =
+         ((rtimer->end - rtimer->start) % 1000) * 1000;
+    }
+#else
  if (rtimer->active)
    gettimeofday (&rtimer->end, NULL);

@@ -115,6 +164,6 @@

  if (microseconds)
    *microseconds = elapsed.tv_usec;
-
+#endif
  return total;
}
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/gutils.c ./gutils.c
--- /home/src/gnomecvs/glib/gutils.c    Wed Sep  9 10:55:57 1998
+++ ./gutils.c  Tue Oct 20 23:22:58 1998
@@ -16,15 +16,23 @@
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
+#include "glibconfig.h"
+
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#ifdef HAVE_PWD_H
#include <pwd.h>
+#endif
#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
+#endif

/* implement Glib's inline functions
 */
@@ -32,12 +40,43 @@
#define        G_CAN_INLINE 1
#include "glib.h"

+#ifdef NATIVE_WIN32
+#define STRICT                 /* Strict typing, please */
+#include <windows.h>
+#include <direct.h>
+#include <errno.h>
+#include <ctype.h>
+
+#ifdef _MSC_VER
+#include <io.h>
+#endif
+#endif
+
+#ifndef MAXPATHLEN
+#ifdef PATH_MAX
+#define MAXPATHLEN PATH_MAX
+#else
+#define MAXPATHLEN 1024
+#endif
+#endif
+
const guint glib_major_version = GLIB_MAJOR_VERSION;
const guint glib_minor_version = GLIB_MINOR_VERSION;
const guint glib_micro_version = GLIB_MICRO_VERSION;
const guint glib_interface_age = GLIB_INTERFACE_AGE;
const guint glib_binary_age = GLIB_BINARY_AGE;

+#ifdef __LCC__
+
+int __stdcall
+LibMain(void *hinstDll,
+       unsigned long dwReason,
+       void *reserved)
+{
+  return(1);
+}
+
+#endif

void
g_atexit (GVoidFunc func)
@@ -184,13 +223,41 @@

  g_return_val_if_fail (file_name != NULL, NULL);

-  base = strrchr (file_name, '/');
+  base = strrchr (file_name, G_DIR_SEPARATOR);
  if (base)
    return base + 1;
+#ifdef NATIVE_WIN32
+  if (isalpha(file_name[0]) && file_name[1] == ':')
+    return (gchar *) file_name + 2;
+#endif

  return (gchar*) file_name;
}

+gboolean
+g_path_is_absolute (const gchar *file_name)
+{
+  if (file_name[0] == G_DIR_SEPARATOR)
+    return TRUE;
+#ifdef NATIVE_WIN32
+  if (isalpha(file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
+    return TRUE;
+#endif
+  return FALSE;
+}
+
+gchar *
+g_path_skip_root (gchar *file_name)
+{
+  if (file_name[0] == G_DIR_SEPARATOR)
+    return file_name + 1;
+#ifdef NATIVE_WIN32
+  if (isalpha(file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
+    return file_name + 3;
+#endif
+  return NULL;
+}
+
gchar*
g_dirname (const gchar    *file_name)
{
@@ -199,10 +266,10 @@

  g_return_val_if_fail (file_name != NULL, NULL);

-  base = strrchr (file_name, '/');
+  base = strrchr (file_name, G_DIR_SEPARATOR);
  if (!base)
    return g_strdup (".");
-  while (base > file_name && *base == '/')
+  while (base > file_name && *base == G_DIR_SEPARATOR)
    base--;
  len = (guint) 1 + base - file_name;

@@ -244,7 +311,7 @@
      /* hm, should we g_error() out here?
       * this can happen if e.g. "./" has mode \0000
       */
-      buffer[0] = '/';
+      buffer[0] = G_DIR_SEPARATOR;
      buffer[1] = 0;
    }

@@ -254,6 +321,42 @@
  return dir;
}

+gchar *
+g_getenv (const gchar *variable)
+{
+#ifndef NATIVE_WIN32
+  return getenv (variable);
+#else
+  char *v;
+  int l = 100, k;
+  char *p;
+
+  if ((v = getenv (variable)) == NULL)
+    return NULL;
+
+  /* On Windows NT, it is relatively typical that environment variables
+   * contain references to other environment variables. Handle that by
+   * calling ExpandEnvironmentStrings.
+   */
+
+  v = g_strdup (v);
+  l = 16;
+  do {
+    p = g_malloc (l);
+
+    if ((k = ExpandEnvironmentStrings (v, p, l)) > l)
+      {
+       g_free (p);
+       l *= 2;
+      }
+  } while (k > l);
+
+  g_free (v);
+
+  return p;
+#endif
+}
+
static gchar   *g_tmp_dir = NULL;
static gchar   *g_user_name = NULL;
static gchar   *g_real_name = NULL;
@@ -264,22 +367,29 @@
{
  if (!g_tmp_dir)
    {
+#ifdef HAVE_PWD_H
      struct passwd *pw;
-
-      g_tmp_dir = g_strdup (getenv ("TMPDIR"));
+#endif
+      g_tmp_dir = g_strdup (g_getenv ("TMPDIR"));
      if (!g_tmp_dir)
-       g_tmp_dir = g_strdup (getenv ("TMP"));
+       g_tmp_dir = g_strdup (g_getenv ("TMP"));
      if (!g_tmp_dir)
-       g_tmp_dir = g_strdup (getenv ("TEMP"));
+       g_tmp_dir = g_strdup (g_getenv ("TEMP"));
+
      if (!g_tmp_dir)
-       g_tmp_dir = g_strdup ("/tmp");
+#ifndef NATIVE_WIN32
+       g_tmp_dir = g_strdup (G_DIR_SEPARATOR_S "tmp");
+#else
+        g_tmp_dir = g_strdup (".");
+#endif

-      g_home_dir = g_strdup (getenv ("HOME"));
+      g_home_dir = g_strdup (g_getenv ("HOME"));

+#ifdef HAVE_PWD_H
      setpwent ();
      pw = getpwuid (getuid ());
      endpwent ();
-
+
      if (pw)
       {
         g_user_name = g_strdup (pw->pw_name);
@@ -287,6 +397,25 @@
         if (!g_home_dir)
           g_home_dir = g_strdup (pw->pw_dir);
       }
+#else
+#ifdef NATIVE_WIN32
+      {
+       DWORD nSize = 17;
+       g_user_name = g_malloc (nSize);
+
+       if (!GetUserName (g_user_name, &nSize))
+         {
+           g_free (g_user_name);
+           g_user_name = g_strdup ("somebody");
+         }
+       g_real_name = g_strdup ("Unknown");
+      }
+#else
+      g_user_name = g_strdup ("somebody");
+      g_real_name = g_strdup ("Unknown");
+      g_home_dir = NULL;
+#endif
+#endif
    }
}

@@ -366,3 +495,203 @@
{
  return *(const gint*) v;
}
+
+GIOChannel *
+g_iochannel_new (gint fd)
+{
+  GIOChannel *channel = g_new (GIOChannel, 1);
+
+  channel->fd = fd;
+
+#ifdef NATIVE_WIN32
+  channel->peer = 0;
+  channel->peer_fd = 0;
+  channel->offset = 0;
+  channel->peer_offset = 0;
+#endif
+
+  return channel;
+}
+
+void
+g_iochannel_free (GIOChannel *channel)
+{
+  g_free (channel);
+}
+
+void
+g_iochannel_close_and_free (GIOChannel *channel)
+{
+  close (channel->fd);
+
+  g_iochannel_free (channel);
+}
+
+#undef g_iochannel_wakeup_peer
+
+void
+g_iochannel_wakeup_peer (GIOChannel *channel)
+{
+#ifdef NATIVE_WIN32
+  static guint message = 0;
+
+  if (message == 0)
+    message = RegisterWindowMessage ("gdk-pipe-readable");
+
+#if 0
+  g_print ("g_iochannel_wakeup_peer: calling PostThreadMessage (%#x, %d, %d, %d)\n",
+          channel->peer, message, channel->peer_fd, channel->offset);
+#endif
+  PostThreadMessage (channel->peer, message,
+                    channel->peer_fd, channel->offset);
+#endif
+}
+
+#ifdef NATIVE_WIN32
+
+#ifdef _MSC_VER
+
+int
+g_ftruncate (int          fd,
+            unsigned int size)
+{
+  HANDLE hfile;
+  DWORD curpos;
+
+  hfile = (HANDLE)_get_osfhandle (fd);
+  if ((curpos = SetFilePointer (hfile, 0, NULL, FILE_CURRENT)) == 0xFFFFFFFF
+      || SetFilePointer (hfile, size, NULL, FILE_BEGIN) == 0xFFFFFFFF
+      || !SetEndOfFile (hfile))
+    {
+      int error = GetLastError ();
+      switch (error)
+       {
+       case ERROR_INVALID_HANDLE:
+         errno = EBADF; break;
+       default:
+         errno = EIO; break;
+       }
+      return -1;
+    }
+
+  return 0;
+}
+
+DIR *
+g_opendir (const char *dirname)
+{
+  DIR *result;
+  char *mask;
+  int k;
+
+  result = g_new (DIR, 1);
+  result->lpFindFileData = g_new (WIN32_FIND_DATA, 1);
+  result->dir_name = g_strdup (dirname);
+
+  k = strlen (result->dir_name);
+  if (result->dir_name[k-1] == '\\')
+    {
+      result->dir_name[k-1] = '\0';
+      k--;
+    }
+  mask = g_strdup_printf ("%s\\*", result->dir_name);
+
+  result->hFindFile =
+    (guint) FindFirstFile (mask,
+                          (LPWIN32_FIND_DATA) result->lpFindFileData);
+  g_free (mask);
+  if (result->hFindFile == (guint) INVALID_HANDLE_VALUE)
+    {
+      int error = GetLastError ();
+
+      g_free (result->dir_name);
+      g_free (result->lpFindFileData);
+      g_free (result);
+      switch (error)
+       {
+       default: errno = EIO; return NULL;
+       }
+    }
+  result->just_opened = TRUE;
+
+  return result;
+}
+
+struct dirent *
+g_readdir (DIR *dir)
+{
+  static struct dirent result;
+
+  if (dir->just_opened)
+    {
+      dir->just_opened = FALSE;
+    }
+  else
+    {
+      if (!FindNextFile ((HANDLE) dir->hFindFile,
+                        (LPWIN32_FIND_DATA) dir->lpFindFileData))
+       {
+         int error = GetLastError ();
+         switch (error)
+           {
+           case ERROR_NO_MORE_FILES:
+             return NULL;
+           default:
+             errno = EIO; return NULL;
+           }
+       }
+    }
+  strcpy (result.d_name,
+         g_basename (((LPWIN32_FIND_DATA) dir->lpFindFileData)->cFileName));
+
+  return &result;
+}
+
+void
+g_rewinddir (DIR *dir)
+{
+  char *mask;
+
+  if (!FindClose ((HANDLE) dir->hFindFile))
+    g_warning ("FindClose failed\n");
+  mask = g_strdup_printf ("%s\\*", dir->dir_name);
+  dir->hFindFile =
+    (guint) FindFirstFile (mask,
+                          (LPWIN32_FIND_DATA) dir->lpFindFileData);
+  g_free (mask);
+
+  if (dir->hFindFile == (guint) INVALID_HANDLE_VALUE)
+    {
+      int error = GetLastError ();
+      switch (error)
+       {
+       default: errno = EIO; return;
+       }
+    }
+  dir->just_opened = TRUE;
+}
+
+int
+g_closedir (DIR *dir)
+{
+  if (!FindClose ((HANDLE) dir->hFindFile))
+    {
+      int error = GetLastError ();
+
+      switch (error)
+       {
+       default:
+         errno = EIO; return -1;
+       }
+    }
+
+  g_free (dir->dir_name);
+  g_free (dir->lpFindFileData);
+  g_free (dir);
+
+  return 0;
+}
+
+#endif /* _MSC_VER */
+
+#endif /* NATIVE_WIN32 */
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/makefile.lcc ./makefile.lcc
--- /home/src/gnomecvs/glib/makefile.lcc        Thu Jan  1 02:00:00 1970
+++ ./makefile.lcc      Sun Aug 30 11:54:46 1998
@@ -0,0 +1,99 @@
+## Makefile for building glib.dll and gmodule.dll with lcc
+## Use: make -f makefile.lcc
+## Note that testglib crashes when compiled with lcc...
+
+INSTALL = copy/y
+TOUCH = copy/y makefile.lcc
+
+CFLAGS = -I. -O
+CC = lcc
+LD = lcclnk
+
+BIN = C:\bin
+
+all : \
+       glibconfig.h    \
+       glib.dll        \
+       gmodule\gmoduleconf.h \
+       gmodule.dll     \
+       testglib.exe    \
+       testgmodule.exe
+
+install : all
+       $(INSTALL) glib.dll $(BIN)
+       $(INSTALL) gmodule.dll $(BIN)
+       $(TOUCH) install
+
+glib_OBJECTS = \
+       garray.obj      \
+       gcache.obj      \
+       gcompletion.obj \
+       gdataset.obj    \
+       gerror.obj      \
+       ghash.obj       \
+       glist.obj       \
+       gmem.obj        \
+       gmessages.obj   \
+       gnode.obj       \
+       gprimes.obj     \
+       gslist.obj      \
+       gtimer.obj      \
+       gtree.obj       \
+       grel.obj        \
+       gstring.obj     \
+       gstrfuncs.obj   \
+       gscanner.obj    \
+       gutils.obj
+
+glib.dll : $(glib_OBJECTS)
+       $(LD) -dll -o glib.dll $(glib_OBJECTS)
+       implib glib.dll
+
+glibconfig.h: glibconfig.h.win32
+       copy glibconfig.h.win32 glibconfig.h
+
+.c.obj :
+       $(CC) $(CFLAGS) -DCOMPILING_GLIB -DG_LOG_DOMAIN=g_log_domain_glib $<
+
+gmodule_OBJECTS = \
+       gmodule.obj
+
+gmodule.dll : $(gmodule_OBJECTS)
+       $(LD) -dll -o gmodule.dll $(gmodule_OBJECTS) glib.lib
+       implib gmodule.dll
+
+gmodule.obj : gmodule\gmodule.c gmodule\gmodule-win32.c
+       $(CC) $(CFLAGS) -Igmodule -DCOMPILING_GMODULE -DG_LIB_DOMAIN=g_log_domain_gmodule gmodule\gmodule.c
+
+gmodule\gmoduleconf.h: gmodule\gmoduleconf.h.win32
+       copy gmodule\gmoduleconf.h.win32 gmodule\gmoduleconf.h
+
+testglib.exe : glib.dll testglib.obj
+       $(LD) -o testglib.exe testglib.obj glib.lib
+
+testglib.obj : testglib.c
+       $(CC) $(CFLAGS) testglib.c
+
+testgmodule.exe : glib.dll gmodule.dll testgmodule.obj libgplugin_a.dll libgplugin_b.dll
+       $(LD) -o testgmodule.exe testgmodule.obj testgmodule.def glib.lib gmodule.lib
+
+testgmodule.obj : gmodule\testgmodule.c
+       $(CC) $(CFLAGS) -Igmodule gmodule\testgmodule.c
+
+libgplugin_a.dll : libgplugin_a.obj
+       $(LD) -dll -o libgplugin_a.dll libgplugin_a.obj glib.lib gmodule.lib
+
+libgplugin_a.obj : gmodule\libgplugin_a.c
+       $(CC) $(CFLAGS) -Igmodule gmodule\libgplugin_a.c
+
+libgplugin_b.dll : libgplugin_b.obj
+       $(LD) -dll -o libgplugin_b.dll libgplugin_b.obj /link glib.lib gmodule.lib
+
+libgplugin_b.obj : gmodule\libgplugin_b.c
+       $(CC) $(CFLAGS) -Igmodule gmodule\libgplugin_b.c
+
+clean:
+       del *.exe
+       del *.obj
+       del *.dll
+       del *.lib
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/makefile.msc ./makefile.msc
--- /home/src/gnomecvs/glib/makefile.msc        Thu Jan  1 02:00:00 1970
+++ ./makefile.msc      Tue Oct 20 21:18:30 1998
@@ -0,0 +1,110 @@
+## Makefile for building the GLib and gmodule dll with Microsoft C
+## Use: nmake -f makefile.msc install
+
+# Change this to wherever you want to install the dlls
+BIN = C:\bin
+
+# cl -? described the options
+CC = cl -G5 -GF -Ox -W3 -D_DLL -nologo
+
+LDFLAGS = /link /nodefaultlib:libc msvcrt.lib # /debug:full /debugtype:cv
+INSTALL = copy
+TOUCH = copy makefile.msc
+
+GLIB_VER = 1.1
+
+CFLAGS = -I.
+
+all : \
+       glibconfig.h    \
+       glib-$(GLIB_VER).dll    \
+       gmodule\gmoduleconf.h \
+       gmodule-$(GLIB_VER).dll \
+       testglib.exe    \
+       testgmodule.exe
+
+install : all
+       $(INSTALL) glib-$(GLIB_VER).dll $(BIN)
+       $(INSTALL) gmodule-$(GLIB_VER).dll $(BIN)
+       $(TOUCH) install
+
+glib_OBJECTS = \
+       garray.obj      \
+       gcache.obj      \
+       gcompletion.obj \
+       gdataset.obj    \
+       gerror.obj      \
+       ghook.obj       \
+       ghash.obj       \
+       glist.obj       \
+       gmem.obj        \
+       gmessages.obj   \
+       gnode.obj       \
+       gprimes.obj     \
+       gslist.obj      \
+       gtimer.obj      \
+       gtree.obj       \
+       grel.obj        \
+       gstring.obj     \
+       gstrfuncs.obj   \
+       gscanner.obj    \
+       gutils.obj
+
+glib-$(GLIB_VER).dll : $(glib_OBJECTS)
+       $(CC) $(CFLAGS) -MD -LD -Feglib-$(GLIB_VER).dll $(glib_OBJECTS) user32.lib advapi32.lib $(LDFLAGS) /def:glib.def
+
+glibconfig.h: glibconfig.h.win32
+       copy glibconfig.h.win32 glibconfig.h
+
+.c.obj :
+       $(CC) $(CFLAGS) -GD -c -DCOMPILING_GLIB -DG_LOG_DOMAIN=g_log_domain_glib $<
+
+gmodule_OBJECTS = \
+       gmodule.obj
+
+gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS)
+       $(CC) $(CFLAGS) -MD -LD -Fegmodule-$(GLIB_VER).dll $(gmodule_OBJECTS) glib-$(GLIB_VER).lib $(LDFLAGS) /def:gmodule.def
+
+gmodule.obj : gmodule\gmodule.c gmodule\gmodule-win32.c
+       $(CC) $(CFLAGS) -Igmodule -c -DG_LIB_DOMAIN=g_log_domain_gmodule gmodule\gmodule.c
+
+gmodule\gmoduleconf.h: gmodule\gmoduleconf.h.win32
+       copy gmodule\gmoduleconf.h.win32 gmodule\gmoduleconf.h
+
+testglib.exe : glib-$(GLIB_VER).dll testglib.obj
+       $(CC) $(CFLAGS) -MD -Fetestglib.exe testglib.obj glib-$(GLIB_VER).lib $(LDFLAGS) /map
+
+testglib.obj : testglib.c
+       $(CC) -c $(CFLAGS) testglib.c
+
+testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.obj libgplugin_a.dll libgplugin_b.dll
+       $(CC) $(CFLAGS) -MD testgmodule.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS)
+
+testgmodule.obj : gmodule\testgmodule.c
+       $(CC) $(CFLAGS) -Igmodule -c gmodule\testgmodule.c
+
+libgplugin_a.dll : libgplugin_a.obj
+       $(CC) $(CFLAGS) -MD -LD libgplugin_a.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS)
+
+libgplugin_a.obj : gmodule\libgplugin_a.c
+       $(CC) $(CFLAGS) -Igmodule -c gmodule\libgplugin_a.c
+
+libgplugin_b.dll : libgplugin_b.obj
+       $(CC) $(CFLAGS) -MD -LD libgplugin_b.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib  $(LDFLAGS)
+
+libgplugin_b.obj : gmodule\libgplugin_b.c
+       $(CC) $(CFLAGS) -Igmodule -c gmodule\libgplugin_b.c
+
+clean:
+       del *.exe
+       del *.obj
+       del *.dll
+       del *.lib
+       del *.err
+       del *.map
+       del *.sym
+       del *.exp
+       del *.lk1
+       del *.mk1
+       del *.pdb
+       del *.ilk
diff -x CVS -ru3 -N /home/src/gnomecvs/glib/testglib.c ./testglib.c
--- /home/src/gnomecvs/glib/testglib.c  Mon Sep 21 10:25:39 1998
+++ ./testglib.c        Thu Oct 15 13:27:38 1998
@@ -295,6 +295,7 @@
    gchar *filename;
    gchar *dirname;
  } dirname_checks[] = {
+#ifndef NATIVE_WIN32
    { "/", "/" },
    { "////", "/" },
    { ".////", "." },
@@ -306,6 +307,18 @@
    { "a/b", "a" },
    { "a/b/", "a/b" },
    { "c///", "c" },
+#else
+    { "\\", "\\" },
+    { ".\\\\\\\\", "." },
+    { ".", "." },
+    { "..", "." },
+    { "..\\", ".." },
+    { "..\\\\\\\\", ".." },
+    { "", "." },
+    { "a\\b", "a" },
+    { "a\\b\\", "a\\b" },
+    { "c\\\\\\", "c" },
+#endif
  };
  guint n_dirname_checks = sizeof (dirname_checks) / sizeof (dirname_checks[0]);

@@ -625,12 +638,32 @@
  for (i = 0; i < 10000; i++)
    g_string_append_c (string1, 'a'+(i%26));

+#if !(defined (_MSC_VER) || defined (__LCC__))
+  /* MSVC and LCC use the same run-time C library, which doesn't like
+     the %10000.10000f format... */
  g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f",
                   "this pete guy sure is a wuss, like he's the number ",
                   1,
                   " wuss.  everyone agrees.\n",
                   string1->str,
                   10, 666, 15, 15, 666.666666666, 666.666666666);
+#else
+  g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%100.100f",
+                   "this pete guy sure is a wuss, like he's the number ",
+                   1,
+                   " wuss.  everyone agrees.\n",
+                   string1->str,
+                   10, 666, 15, 15, 666.666666666, 666.666666666);
+#endif
+
+  g_print ("string2 length = %d...\n", string2->len);
+  string2->str[70] = '\0';
+  g_print ("first 70 chars:\n%s\n", string2->str);
+  string2->str[141] = '\0';
+  g_print ("next 70 chars:\n%s\n", string2->str+71);
+  string2->str[212] = '\0';
+  g_print ("and next 70:\n%s\n", string2->str+142);
+  g_print ("last 70 chars:\n%s\n", string2->str+string2->len - 70);

  g_print ("ok\n");

@@ -648,7 +681,23 @@

  g_print ("ok\n");

-  g_print ("checking g_strcasecmp...\n");
+  g_print ("checking g_strcasecmp...");
+  g_assert (g_strcasecmp ("FroboZZ", "frobozz") == 0);
+  g_assert (g_strcasecmp ("frobozz", "frobozz") == 0);
+  g_assert (g_strcasecmp ("frobozz", "FROBOZZ") == 0);
+  g_assert (g_strcasecmp ("FROBOZZ", "froboz") != 0);
+  g_assert (g_strcasecmp ("", "") == 0);
+  g_assert (g_strcasecmp ("!#%&/()", "!#%&/()") == 0);
+  g_assert (g_strcasecmp ("a", "b") < 0);
+  g_assert (g_strcasecmp ("a", "B") < 0);
+  g_assert (g_strcasecmp ("A", "b") < 0);
+  g_assert (g_strcasecmp ("A", "B") < 0);
+  g_assert (g_strcasecmp ("b", "a") > 0);
+  g_assert (g_strcasecmp ("b", "A") > 0);
+  g_assert (g_strcasecmp ("B", "a") > 0);
+  g_assert (g_strcasecmp ("B", "A") > 0);
+
+  g_print ("ok\n");

  /* g_debug (argv[0]); */

@@ -757,7 +806,7 @@
  g_print ("ok\n");

  g_printerr ("g_log tests:");
-  g_warning ("harmless warning");
+  g_warning ("harmless warning with parameters: %d %s %#x", 42, "Boo", 12345);
  g_message ("the next warning is a test:");
  string = NULL;
  g_print (string);