+Tue Oct 27 03:00:50 1998 Tim Janik <timj@gtk.org>
+
+ * glib.h: removed dummy structure definitions for struct _GCache,
+ _GTree, _GTimer, _GMemChunk, _GListAllocator and _GStringChunk.
+
+ * gutils.c: implement glib's inline functions _after_ all include
+ statements have been processed.
+ removed Tor's MAXPATHLEN check since there already was one supplied
+ further down in this file.
+ (LibMain): special cased the #ifdef __LCC__ case for NATIVE_WIN32,
+ since lcc maybe used on other platforms as well. why in hell is this
+ stuff required?
+ (g_get_any_init): for windows, if the user name is supplied, use it as
+ realname also.
+ in general, if there is no homedir specified, use the tmpdir that
+ we already figured.
+
+ * gtimer.c (g_timer_elapsed): changed a g_assert() statement to
+ g_return_if_fail().
+
+ * applied glib-tml-981020-0.patch for WIN32 portability, added some
+ comments and g_return_if_fail() statements, minor indentation fixes.
+ ChangeLog entry from Tor Lillqvist is appended.
+
+ * glib.h (struct dirent): use lower case structure members.
+
+ * glib.h:
+ * makefile.lcc:
+ * makefile.msc:
+ s/COMPILING_GLIB/GLIB_COMPILATION/
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
+ * 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.
+
Sun Oct 25 01:24:01 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.4
+Tue Oct 27 03:00:50 1998 Tim Janik <timj@gtk.org>
+
+ * glib.h: removed dummy structure definitions for struct _GCache,
+ _GTree, _GTimer, _GMemChunk, _GListAllocator and _GStringChunk.
+
+ * gutils.c: implement glib's inline functions _after_ all include
+ statements have been processed.
+ removed Tor's MAXPATHLEN check since there already was one supplied
+ further down in this file.
+ (LibMain): special cased the #ifdef __LCC__ case for NATIVE_WIN32,
+ since lcc maybe used on other platforms as well. why in hell is this
+ stuff required?
+ (g_get_any_init): for windows, if the user name is supplied, use it as
+ realname also.
+ in general, if there is no homedir specified, use the tmpdir that
+ we already figured.
+
+ * gtimer.c (g_timer_elapsed): changed a g_assert() statement to
+ g_return_if_fail().
+
+ * applied glib-tml-981020-0.patch for WIN32 portability, added some
+ comments and g_return_if_fail() statements, minor indentation fixes.
+ ChangeLog entry from Tor Lillqvist is appended.
+
+ * glib.h (struct dirent): use lower case structure members.
+
+ * glib.h:
+ * makefile.lcc:
+ * makefile.msc:
+ s/COMPILING_GLIB/GLIB_COMPILATION/
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
+ * 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.
+
Sun Oct 25 01:24:01 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.4
+Tue Oct 27 03:00:50 1998 Tim Janik <timj@gtk.org>
+
+ * glib.h: removed dummy structure definitions for struct _GCache,
+ _GTree, _GTimer, _GMemChunk, _GListAllocator and _GStringChunk.
+
+ * gutils.c: implement glib's inline functions _after_ all include
+ statements have been processed.
+ removed Tor's MAXPATHLEN check since there already was one supplied
+ further down in this file.
+ (LibMain): special cased the #ifdef __LCC__ case for NATIVE_WIN32,
+ since lcc maybe used on other platforms as well. why in hell is this
+ stuff required?
+ (g_get_any_init): for windows, if the user name is supplied, use it as
+ realname also.
+ in general, if there is no homedir specified, use the tmpdir that
+ we already figured.
+
+ * gtimer.c (g_timer_elapsed): changed a g_assert() statement to
+ g_return_if_fail().
+
+ * applied glib-tml-981020-0.patch for WIN32 portability, added some
+ comments and g_return_if_fail() statements, minor indentation fixes.
+ ChangeLog entry from Tor Lillqvist is appended.
+
+ * glib.h (struct dirent): use lower case structure members.
+
+ * glib.h:
+ * makefile.lcc:
+ * makefile.msc:
+ s/COMPILING_GLIB/GLIB_COMPILATION/
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
+ * 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.
+
Sun Oct 25 01:24:01 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.4
+Tue Oct 27 03:00:50 1998 Tim Janik <timj@gtk.org>
+
+ * glib.h: removed dummy structure definitions for struct _GCache,
+ _GTree, _GTimer, _GMemChunk, _GListAllocator and _GStringChunk.
+
+ * gutils.c: implement glib's inline functions _after_ all include
+ statements have been processed.
+ removed Tor's MAXPATHLEN check since there already was one supplied
+ further down in this file.
+ (LibMain): special cased the #ifdef __LCC__ case for NATIVE_WIN32,
+ since lcc maybe used on other platforms as well. why in hell is this
+ stuff required?
+ (g_get_any_init): for windows, if the user name is supplied, use it as
+ realname also.
+ in general, if there is no homedir specified, use the tmpdir that
+ we already figured.
+
+ * gtimer.c (g_timer_elapsed): changed a g_assert() statement to
+ g_return_if_fail().
+
+ * applied glib-tml-981020-0.patch for WIN32 portability, added some
+ comments and g_return_if_fail() statements, minor indentation fixes.
+ ChangeLog entry from Tor Lillqvist is appended.
+
+ * glib.h (struct dirent): use lower case structure members.
+
+ * glib.h:
+ * makefile.lcc:
+ * makefile.msc:
+ s/COMPILING_GLIB/GLIB_COMPILATION/
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
+ * 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.
+
Sun Oct 25 01:24:01 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.4
+Tue Oct 27 03:00:50 1998 Tim Janik <timj@gtk.org>
+
+ * glib.h: removed dummy structure definitions for struct _GCache,
+ _GTree, _GTimer, _GMemChunk, _GListAllocator and _GStringChunk.
+
+ * gutils.c: implement glib's inline functions _after_ all include
+ statements have been processed.
+ removed Tor's MAXPATHLEN check since there already was one supplied
+ further down in this file.
+ (LibMain): special cased the #ifdef __LCC__ case for NATIVE_WIN32,
+ since lcc maybe used on other platforms as well. why in hell is this
+ stuff required?
+ (g_get_any_init): for windows, if the user name is supplied, use it as
+ realname also.
+ in general, if there is no homedir specified, use the tmpdir that
+ we already figured.
+
+ * gtimer.c (g_timer_elapsed): changed a g_assert() statement to
+ g_return_if_fail().
+
+ * applied glib-tml-981020-0.patch for WIN32 portability, added some
+ comments and g_return_if_fail() statements, minor indentation fixes.
+ ChangeLog entry from Tor Lillqvist is appended.
+
+ * glib.h (struct dirent): use lower case structure members.
+
+ * glib.h:
+ * makefile.lcc:
+ * makefile.msc:
+ s/COMPILING_GLIB/GLIB_COMPILATION/
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
+ * 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.
+
Sun Oct 25 01:24:01 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.4
+Tue Oct 27 03:00:50 1998 Tim Janik <timj@gtk.org>
+
+ * glib.h: removed dummy structure definitions for struct _GCache,
+ _GTree, _GTimer, _GMemChunk, _GListAllocator and _GStringChunk.
+
+ * gutils.c: implement glib's inline functions _after_ all include
+ statements have been processed.
+ removed Tor's MAXPATHLEN check since there already was one supplied
+ further down in this file.
+ (LibMain): special cased the #ifdef __LCC__ case for NATIVE_WIN32,
+ since lcc maybe used on other platforms as well. why in hell is this
+ stuff required?
+ (g_get_any_init): for windows, if the user name is supplied, use it as
+ realname also.
+ in general, if there is no homedir specified, use the tmpdir that
+ we already figured.
+
+ * gtimer.c (g_timer_elapsed): changed a g_assert() statement to
+ g_return_if_fail().
+
+ * applied glib-tml-981020-0.patch for WIN32 portability, added some
+ comments and g_return_if_fail() statements, minor indentation fixes.
+ ChangeLog entry from Tor Lillqvist is appended.
+
+ * glib.h (struct dirent): use lower case structure members.
+
+ * glib.h:
+ * makefile.lcc:
+ * makefile.msc:
+ s/COMPILING_GLIB/GLIB_COMPILATION/
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
+ * 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.
+
Sun Oct 25 01:24:01 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.4
+Tue Oct 27 03:00:50 1998 Tim Janik <timj@gtk.org>
+
+ * glib.h: removed dummy structure definitions for struct _GCache,
+ _GTree, _GTimer, _GMemChunk, _GListAllocator and _GStringChunk.
+
+ * gutils.c: implement glib's inline functions _after_ all include
+ statements have been processed.
+ removed Tor's MAXPATHLEN check since there already was one supplied
+ further down in this file.
+ (LibMain): special cased the #ifdef __LCC__ case for NATIVE_WIN32,
+ since lcc maybe used on other platforms as well. why in hell is this
+ stuff required?
+ (g_get_any_init): for windows, if the user name is supplied, use it as
+ realname also.
+ in general, if there is no homedir specified, use the tmpdir that
+ we already figured.
+
+ * gtimer.c (g_timer_elapsed): changed a g_assert() statement to
+ g_return_if_fail().
+
+ * applied glib-tml-981020-0.patch for WIN32 portability, added some
+ comments and g_return_if_fail() statements, minor indentation fixes.
+ ChangeLog entry from Tor Lillqvist is appended.
+
+ * glib.h (struct dirent): use lower case structure members.
+
+ * glib.h:
+ * makefile.lcc:
+ * makefile.msc:
+ s/COMPILING_GLIB/GLIB_COMPILATION/
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
+ * 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.
+
Sun Oct 25 01:24:01 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.4
+Tue Oct 27 03:00:50 1998 Tim Janik <timj@gtk.org>
+
+ * glib.h: removed dummy structure definitions for struct _GCache,
+ _GTree, _GTimer, _GMemChunk, _GListAllocator and _GStringChunk.
+
+ * gutils.c: implement glib's inline functions _after_ all include
+ statements have been processed.
+ removed Tor's MAXPATHLEN check since there already was one supplied
+ further down in this file.
+ (LibMain): special cased the #ifdef __LCC__ case for NATIVE_WIN32,
+ since lcc maybe used on other platforms as well. why in hell is this
+ stuff required?
+ (g_get_any_init): for windows, if the user name is supplied, use it as
+ realname also.
+ in general, if there is no homedir specified, use the tmpdir that
+ we already figured.
+
+ * gtimer.c (g_timer_elapsed): changed a g_assert() statement to
+ g_return_if_fail().
+
+ * applied glib-tml-981020-0.patch for WIN32 portability, added some
+ comments and g_return_if_fail() statements, minor indentation fixes.
+ ChangeLog entry from Tor Lillqvist is appended.
+
+ * glib.h (struct dirent): use lower case structure members.
+
+ * glib.h:
+ * makefile.lcc:
+ * makefile.msc:
+ s/COMPILING_GLIB/GLIB_COMPILATION/
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
+ * 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.
+
Sun Oct 25 01:24:01 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.4
DEFS += -DG_LOG_DOMAIN=g_log_domain_glib
-EXTRA_DIST = \
- glib.m4 \
- glib.spec \
- sanity_check
+EXTRA_DIST = \
+ glib.m4 \
+ glib.spec \
+ sanity_check \
+ README.win32 \
+ glib.def \
+ makefile.lcc \
+ makefile.msc \
+ glibconfig.h.win32
+
# build . first, then SUBDIRS
all-recursive-am: all-am
--- /dev/null
+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.
--- /dev/null
+\f
+/usr/src/glib/TAGS,include
+\f
+/usr/src/glib/gmodule/TAGS,include
+\f
+/usr/src/gtk+/gtk/TAGS,include
+\f
+/usr/src/gtk+/gdk/TAGS,include
+\f
+/usr/src/gle/TAGS,include
+\f
+/usr/src/devel-utils/TAGS,include
#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
#undef GLIB_INTERFACE_AGE
#undef GLIB_BINARY_AGE
+#undef WIN32
+#undef NATIVE_WIN32
+
/* #undef PACKAGE */
/* #undef VERSION */
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)
#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>
#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
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 };
while (glib_on_error_halt)
;
glib_on_error_halt = TRUE;
+#else
+ abort ();
+#endif
}
static gboolean stack_trace_done = FALSE;
static void
stack_trace (char **args)
{
+#ifndef NATIVE_WIN32
pid_t pid;
int in_fd[2];
int out_fd[2];
close (out_fd[0]);
close (out_fd[1]);
_exit (0);
+#else
+ abort ();
+#endif
}
#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>
#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
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 };
while (glib_on_error_halt)
;
glib_on_error_halt = TRUE;
+#else
+ abort ();
+#endif
}
static gboolean stack_trace_done = FALSE;
static void
stack_trace (char **args)
{
+#ifndef NATIVE_WIN32
pid_t pid;
int in_fd[2];
int out_fd[2];
close (out_fd[0]);
close (out_fd[1]);
_exit (0);
+#else
+ abort ();
+#endif
}
--- /dev/null
+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_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_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_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_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_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
+ gwin_ftruncate
+ gwin_opendir
+ gwin_readdir
+ gwin_rewinddir
+ gwin_closedir
#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
/* 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;
-
+ * we prefix variable declarations so they can
+ * properly get exported in windows dlls.
+ */
+#ifdef NATIVE_WIN32
+# ifdef GLIB_COMPILATION
+# define GUTILS_C_VAR __declspec(dllexport)
+# else /* !GLIB_COMPILATION */
+# define GUTILS_C_VAR __declspec(dllimport)
+# endif /* !GLIB_COMPILATION */
+#else /* !NATIVE_WIN32 */
+# define GUTILS_C_VAR extern
+#endif /* !NATIVE_WIN32 */
+
+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.
*/
typedef struct _GTree GTree;
typedef struct _GTuples GTuples;
typedef union _GTokenValue GTokenValue;
+typedef struct _GIOChannel GIOChannel;
typedef enum
guint value;
};
-struct _GCache { gint dummy; };
-struct _GTree { gint dummy; };
-struct _GTimer { gint dummy; };
-struct _GMemChunk { gint dummy; };
-struct _GListAllocator { gint dummy; };
-struct _GStringChunk { gint dummy; };
-
/* Doubly linked lists
*/
/* 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,
void g_strdown (gchar *string);
void g_strup (gchar *string);
void g_strreverse (gchar *string);
-gpointer g_memdup (gconstpointer mem,
- guint byte_size);
/* removes leading spaces */
gchar* g_strchug (gchar *string);
/* removes trailing spaces */
...); /* NULL terminated */
gchar* g_strjoin (const gchar *separator,
...); /* NULL terminated */
+gchar* g_strescape (gchar *string);
+gpointer g_memdup (gconstpointer mem,
+ guint byte_size);
/* NULL terminated string arrays.
* g_strsplit() splits up string into max_tokens tokens at delim and
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
}
#endif /* G_CAN_INLINE */
-
/* String Chunks
*/
GStringChunk* g_string_chunk_new (gint size);
* next largest prime, or the highest it knows about which is about
* MAXINT/4.
*/
-
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
+{
+ gint 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
+
+
+/* Windows emulation stubs for common unix functions
*/
-extern const guint glib_major_version;
-extern const guint glib_minor_version;
-extern const guint glib_micro_version;
+#ifdef NATIVE_WIN32
+
+#define MAXPATHLEN 1024
+
+#ifdef _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>.
+ *
+ * For some functions, we provide emulators in glib, which are prefixed
+ * with gwin_.
+ */
+#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
+#define ftruncate(fd, size) gwin_ftruncate (fd, size)
+#define opendir gwin_opendir
+#define readdir gwin_readdir
+#define rewinddir gwin_rewinddir
+#define closedir gwin_closedir
+
+#define NAME_MAX 255
+
+struct DIR
+{
+ gchar *dir_name;
+
+ gboolean just_opened;
+ guint find_file_handle;
+ gpointer find_file_data;
+};
+typedef struct DIR DIR;
+struct dirent
+{
+ gchar d_name[NAME_MAX + 1];
+};
+
+/* emulation functions */
+extern int gwin_ftruncate (gint f,
+ guint size);
+DIR* gwin_opendir (const gchar *dirname);
+struct dirent* gwin_readdir (DIR *dir);
+void gwin_rewinddir (DIR *dir);
+gint gwin_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
}
DEFS += -DG_LOG_DOMAIN=g_log_domain_glib
-EXTRA_DIST = \
- glib.m4 \
- glib.spec \
- sanity_check
+EXTRA_DIST = \
+ glib.m4 \
+ glib.spec \
+ sanity_check \
+ README.win32 \
+ glib.def \
+ makefile.lcc \
+ makefile.msc \
+ glibconfig.h.win32
+
# build . first, then SUBDIRS
all-recursive-am: all-am
#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>
#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
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 };
while (glib_on_error_halt)
;
glib_on_error_halt = TRUE;
+#else
+ abort ();
+#endif
}
static gboolean stack_trace_done = FALSE;
static void
stack_trace (char **args)
{
+#ifndef NATIVE_WIN32
pid_t pid;
int in_fd[2];
int out_fd[2];
close (out_fd[0]);
close (out_fd[1]);
_exit (0);
+#else
+ abort ();
+#endif
}
#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>
#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
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 };
while (glib_on_error_halt)
;
glib_on_error_halt = TRUE;
+#else
+ abort ();
+#endif
}
static gboolean stack_trace_done = FALSE;
static void
stack_trace (char **args)
{
+#ifndef NATIVE_WIN32
pid_t pid;
int in_fd[2];
int out_fd[2];
close (out_fd[0]);
close (out_fd[1]);
_exit (0);
+#else
+ abort ();
+#endif
}
--- /dev/null
+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_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_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_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_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_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
+ gwin_ftruncate
+ gwin_opendir
+ gwin_readdir
+ gwin_rewinddir
+ gwin_closedir
#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
/* 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;
-
+ * we prefix variable declarations so they can
+ * properly get exported in windows dlls.
+ */
+#ifdef NATIVE_WIN32
+# ifdef GLIB_COMPILATION
+# define GUTILS_C_VAR __declspec(dllexport)
+# else /* !GLIB_COMPILATION */
+# define GUTILS_C_VAR __declspec(dllimport)
+# endif /* !GLIB_COMPILATION */
+#else /* !NATIVE_WIN32 */
+# define GUTILS_C_VAR extern
+#endif /* !NATIVE_WIN32 */
+
+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.
*/
typedef struct _GTree GTree;
typedef struct _GTuples GTuples;
typedef union _GTokenValue GTokenValue;
+typedef struct _GIOChannel GIOChannel;
typedef enum
guint value;
};
-struct _GCache { gint dummy; };
-struct _GTree { gint dummy; };
-struct _GTimer { gint dummy; };
-struct _GMemChunk { gint dummy; };
-struct _GListAllocator { gint dummy; };
-struct _GStringChunk { gint dummy; };
-
/* Doubly linked lists
*/
/* 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,
void g_strdown (gchar *string);
void g_strup (gchar *string);
void g_strreverse (gchar *string);
-gpointer g_memdup (gconstpointer mem,
- guint byte_size);
/* removes leading spaces */
gchar* g_strchug (gchar *string);
/* removes trailing spaces */
...); /* NULL terminated */
gchar* g_strjoin (const gchar *separator,
...); /* NULL terminated */
+gchar* g_strescape (gchar *string);
+gpointer g_memdup (gconstpointer mem,
+ guint byte_size);
/* NULL terminated string arrays.
* g_strsplit() splits up string into max_tokens tokens at delim and
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
}
#endif /* G_CAN_INLINE */
-
/* String Chunks
*/
GStringChunk* g_string_chunk_new (gint size);
* next largest prime, or the highest it knows about which is about
* MAXINT/4.
*/
-
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
+{
+ gint 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
+
+
+/* Windows emulation stubs for common unix functions
*/
-extern const guint glib_major_version;
-extern const guint glib_minor_version;
-extern const guint glib_micro_version;
+#ifdef NATIVE_WIN32
+
+#define MAXPATHLEN 1024
+
+#ifdef _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>.
+ *
+ * For some functions, we provide emulators in glib, which are prefixed
+ * with gwin_.
+ */
+#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
+#define ftruncate(fd, size) gwin_ftruncate (fd, size)
+#define opendir gwin_opendir
+#define readdir gwin_readdir
+#define rewinddir gwin_rewinddir
+#define closedir gwin_closedir
+
+#define NAME_MAX 255
+
+struct DIR
+{
+ gchar *dir_name;
+
+ gboolean just_opened;
+ guint find_file_handle;
+ gpointer find_file_data;
+};
+typedef struct DIR DIR;
+struct dirent
+{
+ gchar d_name[NAME_MAX + 1];
+};
+
+/* emulation functions */
+extern int gwin_ftruncate (gint f,
+ guint size);
+DIR* gwin_opendir (const gchar *dirname);
+struct dirent* gwin_readdir (DIR *dir);
+void gwin_rewinddir (DIR *dir);
+gint gwin_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
}
/* #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
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;
# 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
}
# 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
}
#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
}
#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);
#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 inline int
+write (FILE *fd,
+ const char *buf,
+ int len)
+{
+ fwrite (buf, len, 1, fd);
+
+ return len;
+}
+#endif /* NATIVE_WIN32 */
/* --- structures --- */
const gchar *message,
gpointer unused_data)
{
+#ifdef NATIVE_WIN32
+ FILE *fd;
+#else
gint fd;
+#endif
gboolean in_recursion;
gboolean is_fatal;
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)
{
#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) ( \
static GScannerConfig g_scanner_config_template =
{
(
- " \t\n"
+ " \t\r\n"
) /* cset_skip_characters */,
(
G_CSET_a_2_z
{
GTokenValue v;
- v.v_int = 0;
g_return_val_if_fail (scanner != NULL, v);
+
+ /* MSC isn't capable of handling return scanner->value; ? */
+
+ v.v_int = 0;
- return scanner->value;
+ v = scanner->value;
+
+ return v;
}
guint
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);
#else
gint c1, c2;
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
while (*s1 && *s2)
{
/* According to A. Cox, some platforms have islower's that
return string;
}
+gchar*
+g_strescape (gchar *string)
+{
+ gchar *q;
+ gchar *escaped;
+ guint backslashes = 0;
+ gchar *p = string;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ while (*p != '\000')
+ backslashes += (*p++ == '\\');
+
+ if (!backslashes)
+ return g_strdup (string);
+
+ escaped = g_new (gchar, strlen (string) + backslashes + 1);
+
+ p = string;
+ q = escaped;
+
+ while (*p != '\000')
+ {
+ if (*p == '\\')
+ *q++ = '\\';
+ *q++ = *p++;
+ }
+ *q = '\000';
+
+ return escaped;
+}
+
/* blame Elliot for these next five routines */
gchar*
g_strchug (gchar *string)
* 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 /* HAVE_UNISTD_H */
+#ifndef NATIVE_WIN32
+#include <sys/time.h>
+#endif /* NATIVE_WIN32 */
+#ifdef NATIVE_WIN32
+#include <windows.h>
+#endif /* NATIVE_WIN32 */
typedef struct _GRealTimer GRealTimer;
struct _GRealTimer
{
+#ifdef NATIVE_WIN32
+ DWORD start;
+ DWORD end;
+#else /* !NATIVE_WIN32 */
struct timeval start;
struct timeval end;
- gint active;
-};
+#endif /* !NATIVE_WIN32 */
+ guint active : 1;
+};
GTimer*
g_timer_new (void)
timer = g_new (GRealTimer, 1);
timer->active = TRUE;
+#ifdef NATIVE_WIN32
+ timer->start = GetTickCount ();
+#else /* !NATIVE_WIN32 */
gettimeofday (&timer->start, NULL);
+#endif /* !NATIVE_WIN32 */
return ((GTimer*) timer);
}
g_assert (timer != NULL);
rtimer = (GRealTimer*) timer;
+ rtimer->active = TRUE;
+
+#ifdef NATIVE_WIN32
+ rtimer->start = GetTickCount ();
+#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->start, NULL);
- rtimer->active = 1;
+#endif /* !NATIVE_WIN32 */
}
void
g_assert (timer != NULL);
rtimer = (GRealTimer*) timer;
+ rtimer->active = FALSE;
+
+#ifdef NATIVE_WIN32
+ rtimer->end = GetTickCount ();
+#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->end, NULL);
- rtimer->active = 0;
+#endif /* !NATIVE_WIN32 */
}
void
g_assert (timer != NULL);
rtimer = (GRealTimer*) timer;
+
+#ifdef NATIVE_WIN32
+ rtimer->start = GetTickCount ();
+#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->start, NULL);
+#endif /* !NATIVE_WIN32 */
}
gdouble
gulong *microseconds)
{
GRealTimer *rtimer;
- struct timeval elapsed;
gdouble total;
+#ifndef NATIVE_WIN32
+ struct timeval elapsed;
+#endif /* NATIVE_WIN32 */
- g_assert (timer != NULL);
+ g_return_val_if_fail (timer != NULL, 0);
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 /* !NATIVE_WIN32 */
if (rtimer->active)
gettimeofday (&rtimer->end, NULL);
if (microseconds)
*microseconds = elapsed.tv_usec;
+#endif /* !NATIVE_WIN32 */
return total;
}
* 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
+
+#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 /* _MSC_VER */
+#endif /* NATIVE_WIN32 */
/* implement Glib's inline functions
*/
#define G_CAN_INLINE 1
#include "glib.h"
+#ifdef MAXPATHLEN
+#define G_PATH_LENGTH (MAXPATHLEN + 1)
+#elif defined (PATH_MAX)
+#define G_PATH_LENGTH (PATH_MAX + 1)
+#else /* !MAXPATHLEN */
+#define G_PATH_LENGTH (2048 + 1)
+#endif /* !MAXPATHLEN && !PATH_MAX */
+
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;
+#if defined (NATIVE_WIN32) && defined (__LCC__)
+int __stdcall
+LibMain (void *hinstDll,
+ unsigned long dwReason,
+ void *reserved)
+{
+ return 1;
+}
+#endif /* NATIVE_WIN32 && __LCC__ */
void
g_atexit (GVoidFunc func)
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 /* NATIVE_WIN32 */
return (gchar*) file_name;
}
+gboolean
+g_path_is_absolute (const gchar *file_name)
+{
+ g_return_val_if_fail (file_name != NULL, FALSE);
+
+ 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)
+{
+ g_return_val_if_fail (file_name != NULL, NULL);
+
+ 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)
{
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;
return base;
}
-#ifdef MAXPATHLEN
-#define G_PATH_LENGTH (MAXPATHLEN + 1)
-#elif defined (PATH_MAX)
-#define G_PATH_LENGTH (PATH_MAX + 1)
-#else /* !MAXPATHLEN */
-#define G_PATH_LENGTH (2048 + 1)
-#endif /* !MAXPATHLEN && !PATH_MAX */
-
gchar*
g_get_current_dir (void)
{
/* 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;
}
return dir;
}
+gchar*
+g_getenv (const gchar *variable)
+{
+ g_return_val_if_fail (variable != NULL, NULL);
+
+#ifndef NATIVE_WIN32
+ return getenv (variable);
+#else
+ gchar *v;
+ guint l, k;
+ gchar *p;
+
+ v = getenv (variable);
+ if (!v)
+ 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_new (gchar, l);
+
+ k = ExpandEnvironmentStrings (v, p, l);
+ if (k > 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;
{
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 /* !NATIVE_WIN32 */
+ g_tmp_dir = g_strdup (".");
+#endif /* !NATIVE_WIN32 */
+ }
- 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 (!g_home_dir)
g_home_dir = g_strdup (pw->pw_dir);
}
+#else /* !HAVE_PWD_H */
+# ifdef NATIVE_WIN32
+ {
+ guint len = 17;
+
+ g_user_name = g_new (gchar, len);
+
+ if (!GetUserName (g_user_name, &len))
+ {
+ g_free (g_user_name);
+ g_user_name = g_strdup ("somebody");
+ g_real_name = g_strdup ("Unknown");
+ }
+ else
+ g_real_name = g_strdup (g_user_name);
+ g_home_dir = NULL;
+ }
+# else /* !NATIVE_WIN32 */
+ g_user_name = g_strdup ("somebody");
+ g_real_name = g_strdup ("Unknown");
+ g_home_dir = NULL;
+# endif /* !NATIVE_WIN32 */
+#endif /* !HAVE_PWD_H */
}
+
+ if (!g_home_dir)
+ g_home_dir = g_strdup (g_tmp_dir);
}
gchar*
}
guint
-g_direct_hash(gconstpointer v)
+g_direct_hash (gconstpointer v)
{
return GPOINTER_TO_UINT (v);
}
gint
-g_direct_equal(gconstpointer v, gconstpointer v2)
+g_direct_equal (gconstpointer v1,
+ gconstpointer v2)
{
- return GPOINTER_TO_UINT (v) == GPOINTER_TO_UINT (v2);
+ return GPOINTER_TO_UINT (v1) == GPOINTER_TO_UINT (v2);
}
gint
-g_int_equal (gconstpointer v, gconstpointer v2)
+g_int_equal (gconstpointer v1,
+ gconstpointer v2)
{
- return *((const gint*) v) == *((const gint*) v2);
+ return *((const gint*) v1) == *((const gint*) v2);
}
guint
{
return *(const gint*) v;
}
+
+GIOChannel*
+g_iochannel_new (gint fd)
+{
+ GIOChannel *channel = g_new0 (GIOChannel, 1);
+
+ channel->fd = fd;
+
+#ifdef NATIVE_WIN32
+ channel->peer = 0;
+ channel->peer_fd = 0;
+ channel->offset = 0;
+ channel->peer_offset = 0;
+#endif /* NATIVE_WIN32 */
+
+ return channel;
+}
+
+void
+g_iochannel_free (GIOChannel *channel)
+{
+ g_return_if_fail (channel != NULL);
+
+ g_free (channel);
+}
+
+void
+g_iochannel_close_and_free (GIOChannel *channel)
+{
+ g_return_if_fail (channel != NULL);
+
+ close (channel->fd);
+
+ g_iochannel_free (channel);
+}
+
+#undef g_iochannel_wakeup_peer
+
+void
+g_iochannel_wakeup_peer (GIOChannel *channel)
+{
+ static guint message = 0;
+
+ g_return_if_fail (channel != NULL);
+
+#ifdef NATIVE_WIN32
+ 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 /* NATIVE_WIN32 */
+}
+
+
+#ifdef NATIVE_WIN32
+#ifdef _MSC_VER
+
+int
+gwin_ftruncate (gint fd,
+ guint size)
+{
+ HANDLE hfile;
+ guint curpos;
+
+ g_return_val_if_fail (fd >= 0, -1);
+
+ hfile = (HANDLE) _get_osfhandle (fd);
+ curpos = SetFilePointer (hfile, 0, NULL, FILE_CURRENT);
+ if (curpos == 0xFFFFFFFF
+ || SetFilePointer (hfile, size, NULL, FILE_BEGIN) == 0xFFFFFFFF
+ || !SetEndOfFile (hfile))
+ {
+ gint error = GetLastError ();
+
+ switch (error)
+ {
+ case ERROR_INVALID_HANDLE:
+ errno = EBADF;
+ break;
+ default:
+ errno = EIO;
+ break;
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+DIR*
+gwin_opendir (const char *dirname)
+{
+ DIR *result;
+ gchar *mask;
+ guint k;
+
+ g_return_val_if_fail (dirname != NULL, NULL);
+
+ result = g_new0 (DIR, 1);
+ result->find_file_data = g_new0 (WIN32_FIND_DATA, 1);
+ result->dir_name = g_strdup (dirname);
+
+ k = strlen (result->dir_name);
+ if (k && result->dir_name[k - 1] == '\\')
+ {
+ result->dir_name[k - 1] = '\0';
+ k--;
+ }
+ mask = g_strdup_printf ("%s\\*", result->dir_name);
+
+ result->find_file_handle = (guint) FindFirstFile (mask,
+ (LPWIN32_FIND_DATA) result->find_file_data);
+ g_free (mask);
+
+ if (result->find_file_handle == (guint) INVALID_HANDLE_VALUE)
+ {
+ int error = GetLastError ();
+
+ g_free (result->dir_name);
+ g_free (result->find_file_data);
+ g_free (result);
+ switch (error)
+ {
+ default:
+ errno = EIO;
+ return NULL;
+ }
+ }
+ result->just_opened = TRUE;
+
+ return result;
+}
+
+struct dirent*
+gwin_readdir (DIR *dir)
+{
+ static struct dirent result;
+
+ g_return_val_if_fail (dir != NULL, NULL);
+
+ if (dir->just_opened)
+ dir->just_opened = FALSE;
+ else
+ {
+ if (!FindNextFile ((HANDLE) dir->find_file_handle,
+ (LPWIN32_FIND_DATA) dir->find_file_data))
+ {
+ 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->find_file_data)->cFileName));
+
+ return &result;
+}
+
+void
+gwin_rewinddir (DIR *dir)
+{
+ gchar *mask;
+
+ g_return_if_fail (dir != NULL);
+
+ if (!FindClose ((HANDLE) dir->find_file_handle))
+ g_warning ("gwin_rewinddir(): FindClose() failed\n");
+
+ mask = g_strdup_printf ("%s\\*", dir->dir_name);
+ dir->find_file_handle = (guint) FindFirstFile (mask,
+ (LPWIN32_FIND_DATA) dir->find_file_data);
+ g_free (mask);
+
+ if (dir->find_file_handle == (guint) INVALID_HANDLE_VALUE)
+ {
+ int error = GetLastError ();
+
+ switch (error)
+ {
+ default:
+ errno = EIO;
+ return;
+ }
+ }
+ dir->just_opened = TRUE;
+}
+
+gint
+gwin_closedir (DIR *dir)
+{
+ g_return_val_if_fail (dir != NULL, -1);
+
+ if (!FindClose ((HANDLE) dir->find_file_handle))
+ {
+ int error = GetLastError ();
+
+ switch (error)
+ {
+ default:
+ errno = EIO; return -1;
+ }
+ }
+
+ g_free (dir->dir_name);
+ g_free (dir->find_file_data);
+ g_free (dir);
+
+ return 0;
+}
+
+#endif /* _MSC_VER */
+
+#endif /* NATIVE_WIN32 */
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
+/* Define if you have <unistd.h>. */
+#undef HAVE_UNISTD_H
+
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
#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
/* 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
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
+/* Define if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
+/* Define if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <sys/times.h> header file. */
+#undef HAVE_SYS_TIMES_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
/* Define if you have the <values.h> header file. */
#undef HAVE_VALUES_H
--- /dev/null
+/* 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
/* #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
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;
# 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
}
# 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
}
#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
}
#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);
#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 inline int
+write (FILE *fd,
+ const char *buf,
+ int len)
+{
+ fwrite (buf, len, 1, fd);
+
+ return len;
+}
+#endif /* NATIVE_WIN32 */
/* --- structures --- */
const gchar *message,
gpointer unused_data)
{
+#ifdef NATIVE_WIN32
+ FILE *fd;
+#else
gint fd;
+#endif
gboolean in_recursion;
gboolean is_fatal;
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)
{
+Tue Oct 27 04:00:11 1998 Tim Janik <timj@gtk.org>
+
+ * testgmodule.c (main): changed the #ifdef WIN32 test to NATIVE_WIN32,
+ this needs to be more constistent throughout the code, do we go for
+ NATIVE_WIN32 or WIN32?
+
+ * gmodule.c (LibMain): special cased the #ifdef __LCC__ case for
+ NATIVE_WIN32, since lcc maybe used on other platforms as well.
+ * libgplugin_a.c (LibMain):
+ * libgplugin_b.c (LibMain):
+ likewise. not sure i like this special requirement for lcc in here.
+
+ * gmodule-dl.c (_g_module_build_path):
+ feature empty "" directories and prepend the module name with "lib".
+
+ * gmodule-dld.c (_g_module_build_path):
+ * gmodule-win32.c (_g_module_build_path):
+ feature empty "" directories.
+
+ * we need some more magic in the _g_module_build_path variants
+ so we don't append/prepend lib and .so, .sl or .dll for those names
+ that already contain it.
+
+ * applied patch from Tor Lillqvist for g_module_build_path() and
+ windows support.
+
+1998-10-20: Tor Lillqvist <tml@iki.fi>
+
+ * 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.
+
1998-10-25 Raja R Harinath <harinath@cs.umn.edu>
* gmodule.h: Remove `#pragma }'.
EXTRA_DIST = \
gmoduleconf.h.in \
+ gmodule.def \
gmodule-dl.c \
- gmodule-dld.c
+ gmodule-dld.c \
+ gmodule-win32.c \
+ gmoduleconf.h.win32
BUILT_SOURCES = gmoduleconf.h
gmoduleconf.h: gmoduleconf.h.in
return p;
}
+
+static gchar*
+_g_module_build_path (const gchar *directory,
+ const gchar *module_name)
+{
+ if (directory)
+ return g_strconcat (directory, "/lib", module_name, ".so", NULL);
+ else
+ return g_strconcat ("lib", module_name, ".so", NULL);
+}
return p;
}
+
+static gchar*
+_g_module_build_path (const gchar *directory,
+ const gchar *module_name)
+{
+ if (directory)
+ return g_strconcat (directory, "/", module_name, ".sl", NULL);
+ else
+ return g_strconcat (module_name, ".sl", NULL);
+}
--- /dev/null
+/* 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)
+ return g_strconcat (directory, "\\", module_name, ".dll", NULL);
+ else
+ return g_strconcat (module_name, ".dll", NULL);
+}
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);
#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; }
}
#endif /* no implementation */
+#if defined (NATIVE_WIN32) && defined (__LCC__)
+int __stdcall
+LibMain (void *hinstDll,
+ unsigned long dwReason,
+ void *reserved)
+{
+ return 1;
+}
+#endif /* NATIVE_WIN32 && __LCC__ */
+
/* --- functions --- */
gboolean
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);
+}
--- /dev/null
+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
#include <glib.h>
-/* exporting and importing functions,
- * we need autoconf support here to feature Windows dll stubs.
+/* exporting and importing functions, this is special cased
+ * to feature Windows dll stubs.
*/
#define G_MODULE_IMPORT extern
-#define G_MODULE_EXPORT
-
+#ifdef NATIVE_WIN32
+# define G_MODULE_EXPORT __declspec(dllexport)
+#else /* !NATIVE_WIN32 */
+# define G_MODULE_EXPORT
+#endif /* !NATIVE_WIN32 */
typedef enum
{
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
}
#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@
#undef G_MODULE_HAVE_DLERROR
* Boston, MA 02111-1307, USA.
*/
#include <gmodule.h>
+#include <stdlib.h>
+
+#if defined (NATIVE_WIN32) && defined (__LCC__)
+int __stdcall
+LibMain(void *hinstDll,
+ unsigned long dwReason,
+ void *reserved)
+{
+ return 1;
+}
+#endif /* NATIVE_WIN32 && __LCC__ */
G_MODULE_EXPORT void
gplugin_a_func (void)
*/
#include <gmodule.h>
+#if defined (NATIVE_WIN32) && defined (__LCC__)
+int __stdcall
+LibMain(void *hinstDll,
+ unsigned long dwReason,
+ void *reserved)
+{
+ return 1;
+}
+#endif /* NATIVE_WIN32 && __LCC__ */
+
G_MODULE_EXPORT const gchar*
g_module_check_init (GModule *module)
{
#include <gmodule.h>
-void
+G_MODULE_EXPORT void
g_clash_func (void)
{
g_print ("GModule: Hello global clash\n");
string = g_get_current_dir ();
g_print ("testgmodule (%s):\n", string);
+#ifdef NATIVE_WIN32
+ plugin_a = g_strconcat (string, "\\libgplugin_a.dll", NULL);
+ plugin_b = g_strconcat (string, "\\libgplugin_b.dll", NULL);
+#else /* !NATIVE_WIN32 */
plugin_a = g_strconcat (string, "/.libs/", "libgplugin_a.so", NULL);
plugin_b = g_strconcat (string, "/.libs/", "libgplugin_b.so", NULL);
+#endif /* NATIVE_WIN32 */
g_free (string);
/* module handles
#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) ( \
static GScannerConfig g_scanner_config_template =
{
(
- " \t\n"
+ " \t\r\n"
) /* cset_skip_characters */,
(
G_CSET_a_2_z
{
GTokenValue v;
- v.v_int = 0;
g_return_val_if_fail (scanner != NULL, v);
+
+ /* MSC isn't capable of handling return scanner->value; ? */
+
+ v.v_int = 0;
- return scanner->value;
+ v = scanner->value;
+
+ return v;
}
guint
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);
#else
gint c1, c2;
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
while (*s1 && *s2)
{
/* According to A. Cox, some platforms have islower's that
return string;
}
+gchar*
+g_strescape (gchar *string)
+{
+ gchar *q;
+ gchar *escaped;
+ guint backslashes = 0;
+ gchar *p = string;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ while (*p != '\000')
+ backslashes += (*p++ == '\\');
+
+ if (!backslashes)
+ return g_strdup (string);
+
+ escaped = g_new (gchar, strlen (string) + backslashes + 1);
+
+ p = string;
+ q = escaped;
+
+ while (*p != '\000')
+ {
+ if (*p == '\\')
+ *q++ = '\\';
+ *q++ = *p++;
+ }
+ *q = '\000';
+
+ return escaped;
+}
+
/* blame Elliot for these next five routines */
gchar*
g_strchug (gchar *string)
* 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 /* HAVE_UNISTD_H */
+#ifndef NATIVE_WIN32
+#include <sys/time.h>
+#endif /* NATIVE_WIN32 */
+#ifdef NATIVE_WIN32
+#include <windows.h>
+#endif /* NATIVE_WIN32 */
typedef struct _GRealTimer GRealTimer;
struct _GRealTimer
{
+#ifdef NATIVE_WIN32
+ DWORD start;
+ DWORD end;
+#else /* !NATIVE_WIN32 */
struct timeval start;
struct timeval end;
- gint active;
-};
+#endif /* !NATIVE_WIN32 */
+ guint active : 1;
+};
GTimer*
g_timer_new (void)
timer = g_new (GRealTimer, 1);
timer->active = TRUE;
+#ifdef NATIVE_WIN32
+ timer->start = GetTickCount ();
+#else /* !NATIVE_WIN32 */
gettimeofday (&timer->start, NULL);
+#endif /* !NATIVE_WIN32 */
return ((GTimer*) timer);
}
g_assert (timer != NULL);
rtimer = (GRealTimer*) timer;
+ rtimer->active = TRUE;
+
+#ifdef NATIVE_WIN32
+ rtimer->start = GetTickCount ();
+#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->start, NULL);
- rtimer->active = 1;
+#endif /* !NATIVE_WIN32 */
}
void
g_assert (timer != NULL);
rtimer = (GRealTimer*) timer;
+ rtimer->active = FALSE;
+
+#ifdef NATIVE_WIN32
+ rtimer->end = GetTickCount ();
+#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->end, NULL);
- rtimer->active = 0;
+#endif /* !NATIVE_WIN32 */
}
void
g_assert (timer != NULL);
rtimer = (GRealTimer*) timer;
+
+#ifdef NATIVE_WIN32
+ rtimer->start = GetTickCount ();
+#else /* !NATIVE_WIN32 */
gettimeofday (&rtimer->start, NULL);
+#endif /* !NATIVE_WIN32 */
}
gdouble
gulong *microseconds)
{
GRealTimer *rtimer;
- struct timeval elapsed;
gdouble total;
+#ifndef NATIVE_WIN32
+ struct timeval elapsed;
+#endif /* NATIVE_WIN32 */
- g_assert (timer != NULL);
+ g_return_val_if_fail (timer != NULL, 0);
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 /* !NATIVE_WIN32 */
if (rtimer->active)
gettimeofday (&rtimer->end, NULL);
if (microseconds)
*microseconds = elapsed.tv_usec;
+#endif /* !NATIVE_WIN32 */
return total;
}
* 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
+
+#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 /* _MSC_VER */
+#endif /* NATIVE_WIN32 */
/* implement Glib's inline functions
*/
#define G_CAN_INLINE 1
#include "glib.h"
+#ifdef MAXPATHLEN
+#define G_PATH_LENGTH (MAXPATHLEN + 1)
+#elif defined (PATH_MAX)
+#define G_PATH_LENGTH (PATH_MAX + 1)
+#else /* !MAXPATHLEN */
+#define G_PATH_LENGTH (2048 + 1)
+#endif /* !MAXPATHLEN && !PATH_MAX */
+
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;
+#if defined (NATIVE_WIN32) && defined (__LCC__)
+int __stdcall
+LibMain (void *hinstDll,
+ unsigned long dwReason,
+ void *reserved)
+{
+ return 1;
+}
+#endif /* NATIVE_WIN32 && __LCC__ */
void
g_atexit (GVoidFunc func)
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 /* NATIVE_WIN32 */
return (gchar*) file_name;
}
+gboolean
+g_path_is_absolute (const gchar *file_name)
+{
+ g_return_val_if_fail (file_name != NULL, FALSE);
+
+ 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)
+{
+ g_return_val_if_fail (file_name != NULL, NULL);
+
+ 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)
{
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;
return base;
}
-#ifdef MAXPATHLEN
-#define G_PATH_LENGTH (MAXPATHLEN + 1)
-#elif defined (PATH_MAX)
-#define G_PATH_LENGTH (PATH_MAX + 1)
-#else /* !MAXPATHLEN */
-#define G_PATH_LENGTH (2048 + 1)
-#endif /* !MAXPATHLEN && !PATH_MAX */
-
gchar*
g_get_current_dir (void)
{
/* 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;
}
return dir;
}
+gchar*
+g_getenv (const gchar *variable)
+{
+ g_return_val_if_fail (variable != NULL, NULL);
+
+#ifndef NATIVE_WIN32
+ return getenv (variable);
+#else
+ gchar *v;
+ guint l, k;
+ gchar *p;
+
+ v = getenv (variable);
+ if (!v)
+ 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_new (gchar, l);
+
+ k = ExpandEnvironmentStrings (v, p, l);
+ if (k > 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;
{
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 /* !NATIVE_WIN32 */
+ g_tmp_dir = g_strdup (".");
+#endif /* !NATIVE_WIN32 */
+ }
- 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 (!g_home_dir)
g_home_dir = g_strdup (pw->pw_dir);
}
+#else /* !HAVE_PWD_H */
+# ifdef NATIVE_WIN32
+ {
+ guint len = 17;
+
+ g_user_name = g_new (gchar, len);
+
+ if (!GetUserName (g_user_name, &len))
+ {
+ g_free (g_user_name);
+ g_user_name = g_strdup ("somebody");
+ g_real_name = g_strdup ("Unknown");
+ }
+ else
+ g_real_name = g_strdup (g_user_name);
+ g_home_dir = NULL;
+ }
+# else /* !NATIVE_WIN32 */
+ g_user_name = g_strdup ("somebody");
+ g_real_name = g_strdup ("Unknown");
+ g_home_dir = NULL;
+# endif /* !NATIVE_WIN32 */
+#endif /* !HAVE_PWD_H */
}
+
+ if (!g_home_dir)
+ g_home_dir = g_strdup (g_tmp_dir);
}
gchar*
}
guint
-g_direct_hash(gconstpointer v)
+g_direct_hash (gconstpointer v)
{
return GPOINTER_TO_UINT (v);
}
gint
-g_direct_equal(gconstpointer v, gconstpointer v2)
+g_direct_equal (gconstpointer v1,
+ gconstpointer v2)
{
- return GPOINTER_TO_UINT (v) == GPOINTER_TO_UINT (v2);
+ return GPOINTER_TO_UINT (v1) == GPOINTER_TO_UINT (v2);
}
gint
-g_int_equal (gconstpointer v, gconstpointer v2)
+g_int_equal (gconstpointer v1,
+ gconstpointer v2)
{
- return *((const gint*) v) == *((const gint*) v2);
+ return *((const gint*) v1) == *((const gint*) v2);
}
guint
{
return *(const gint*) v;
}
+
+GIOChannel*
+g_iochannel_new (gint fd)
+{
+ GIOChannel *channel = g_new0 (GIOChannel, 1);
+
+ channel->fd = fd;
+
+#ifdef NATIVE_WIN32
+ channel->peer = 0;
+ channel->peer_fd = 0;
+ channel->offset = 0;
+ channel->peer_offset = 0;
+#endif /* NATIVE_WIN32 */
+
+ return channel;
+}
+
+void
+g_iochannel_free (GIOChannel *channel)
+{
+ g_return_if_fail (channel != NULL);
+
+ g_free (channel);
+}
+
+void
+g_iochannel_close_and_free (GIOChannel *channel)
+{
+ g_return_if_fail (channel != NULL);
+
+ close (channel->fd);
+
+ g_iochannel_free (channel);
+}
+
+#undef g_iochannel_wakeup_peer
+
+void
+g_iochannel_wakeup_peer (GIOChannel *channel)
+{
+ static guint message = 0;
+
+ g_return_if_fail (channel != NULL);
+
+#ifdef NATIVE_WIN32
+ 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 /* NATIVE_WIN32 */
+}
+
+
+#ifdef NATIVE_WIN32
+#ifdef _MSC_VER
+
+int
+gwin_ftruncate (gint fd,
+ guint size)
+{
+ HANDLE hfile;
+ guint curpos;
+
+ g_return_val_if_fail (fd >= 0, -1);
+
+ hfile = (HANDLE) _get_osfhandle (fd);
+ curpos = SetFilePointer (hfile, 0, NULL, FILE_CURRENT);
+ if (curpos == 0xFFFFFFFF
+ || SetFilePointer (hfile, size, NULL, FILE_BEGIN) == 0xFFFFFFFF
+ || !SetEndOfFile (hfile))
+ {
+ gint error = GetLastError ();
+
+ switch (error)
+ {
+ case ERROR_INVALID_HANDLE:
+ errno = EBADF;
+ break;
+ default:
+ errno = EIO;
+ break;
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+DIR*
+gwin_opendir (const char *dirname)
+{
+ DIR *result;
+ gchar *mask;
+ guint k;
+
+ g_return_val_if_fail (dirname != NULL, NULL);
+
+ result = g_new0 (DIR, 1);
+ result->find_file_data = g_new0 (WIN32_FIND_DATA, 1);
+ result->dir_name = g_strdup (dirname);
+
+ k = strlen (result->dir_name);
+ if (k && result->dir_name[k - 1] == '\\')
+ {
+ result->dir_name[k - 1] = '\0';
+ k--;
+ }
+ mask = g_strdup_printf ("%s\\*", result->dir_name);
+
+ result->find_file_handle = (guint) FindFirstFile (mask,
+ (LPWIN32_FIND_DATA) result->find_file_data);
+ g_free (mask);
+
+ if (result->find_file_handle == (guint) INVALID_HANDLE_VALUE)
+ {
+ int error = GetLastError ();
+
+ g_free (result->dir_name);
+ g_free (result->find_file_data);
+ g_free (result);
+ switch (error)
+ {
+ default:
+ errno = EIO;
+ return NULL;
+ }
+ }
+ result->just_opened = TRUE;
+
+ return result;
+}
+
+struct dirent*
+gwin_readdir (DIR *dir)
+{
+ static struct dirent result;
+
+ g_return_val_if_fail (dir != NULL, NULL);
+
+ if (dir->just_opened)
+ dir->just_opened = FALSE;
+ else
+ {
+ if (!FindNextFile ((HANDLE) dir->find_file_handle,
+ (LPWIN32_FIND_DATA) dir->find_file_data))
+ {
+ 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->find_file_data)->cFileName));
+
+ return &result;
+}
+
+void
+gwin_rewinddir (DIR *dir)
+{
+ gchar *mask;
+
+ g_return_if_fail (dir != NULL);
+
+ if (!FindClose ((HANDLE) dir->find_file_handle))
+ g_warning ("gwin_rewinddir(): FindClose() failed\n");
+
+ mask = g_strdup_printf ("%s\\*", dir->dir_name);
+ dir->find_file_handle = (guint) FindFirstFile (mask,
+ (LPWIN32_FIND_DATA) dir->find_file_data);
+ g_free (mask);
+
+ if (dir->find_file_handle == (guint) INVALID_HANDLE_VALUE)
+ {
+ int error = GetLastError ();
+
+ switch (error)
+ {
+ default:
+ errno = EIO;
+ return;
+ }
+ }
+ dir->just_opened = TRUE;
+}
+
+gint
+gwin_closedir (DIR *dir)
+{
+ g_return_val_if_fail (dir != NULL, -1);
+
+ if (!FindClose ((HANDLE) dir->find_file_handle))
+ {
+ int error = GetLastError ();
+
+ switch (error)
+ {
+ default:
+ errno = EIO; return -1;
+ }
+ }
+
+ g_free (dir->dir_name);
+ g_free (dir->find_file_data);
+ g_free (dir);
+
+ return 0;
+}
+
+#endif /* _MSC_VER */
+
+#endif /* NATIVE_WIN32 */
--- /dev/null
+## 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) -DGLIB_COMPILATION -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
--- /dev/null
+## 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 -DGLIB_COMPILATION -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
gchar *filename;
gchar *dirname;
} dirname_checks[] = {
+#ifndef NATIVE_WIN32
{ "/", "/" },
{ "////", "/" },
{ ".////", "." },
{ "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]);
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");
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]); */
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);
gchar *filename;
gchar *dirname;
} dirname_checks[] = {
+#ifndef NATIVE_WIN32
{ "/", "/" },
{ "////", "/" },
{ ".////", "." },
{ "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]);
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");
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]); */
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);