From b74e7d2f4780c159f7583bd4eecd07ee222d1d9c Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 14 Dec 2000 21:02:20 +0000 Subject: [PATCH] Warn if no callback. Call callback correctly. (g_io_win32_create_watch): 2000-12-14 Tor Lillqvist * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call callback correctly. (g_io_win32_create_watch): Fix typo. (g_io_win32_fd_create_watch): Ditto. (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix fd lookalike provided by the C library), call g_io_channel_win32_new_fd(). If it is a socket (from WinSock), call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and fds don't overlap. TODO: Implement also datagram sockets. (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). * gcompletion.h: Include only on Unix. Is this inclusion really needed here? OTOH, do include , for size_t. * gmessages.c: (Win32) Don't define a function called "write" that might clash with the prototype from , use a #define. * glib.def: Update. * gmain.c (g_source_add_poll): Don't return a value from void function. (g_main_context_get_poll_func): Compile also for non-Win32, as presumably was intended. The result var is a GPollFunc, not a GPollFunc*. Return the result! gobject: 2000-12-14 Tor Lillqvist * makefile.mingw.in: Update, include parts from Makefile.am to build gmarshal.[ch]. Some day, we won't need these separate makefiles for Win32 compilation. I hope. * makefile.msc.in: Update. No use trying to build gmarshal.[ch] here, it would require Unixish tools. MSVC users building from CVS sources are out of luck. * gobject.def: Update. --- ChangeLog | 28 +++++++++++++++++++++++++ ChangeLog.pre-2-0 | 28 +++++++++++++++++++++++++ ChangeLog.pre-2-10 | 28 +++++++++++++++++++++++++ ChangeLog.pre-2-12 | 28 +++++++++++++++++++++++++ ChangeLog.pre-2-2 | 28 +++++++++++++++++++++++++ ChangeLog.pre-2-4 | 28 +++++++++++++++++++++++++ ChangeLog.pre-2-6 | 28 +++++++++++++++++++++++++ ChangeLog.pre-2-8 | 28 +++++++++++++++++++++++++ gcompletion.h | 3 +++ giowin32.c | 31 +++++++++++++++++++++------- glib.def | 52 +++++++++++++++++++++++++++++++++++------------ glib/gcompletion.h | 3 +++ glib/giowin32.c | 31 +++++++++++++++++++++------- glib/glib.def | 52 +++++++++++++++++++++++++++++++++++------------ glib/gmain.c | 12 +++++------ glib/gmessages.c | 9 +++++--- gmain.c | 12 +++++------ gmessages.c | 9 +++++--- gobject/ChangeLog | 12 +++++++++++ gobject/gobject.def | 10 ++------- gobject/makefile.mingw.in | 36 ++++++++++++++++++++++++++++++-- gobject/makefile.msc.in | 3 ++- 22 files changed, 428 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe5f01f..bd587a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2000-12-14 Tor Lillqvist + + * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call + callback correctly. + (g_io_win32_create_watch): Fix typo. + (g_io_win32_fd_create_watch): Ditto. + (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix + fd lookalike provided by the C library), call + g_io_channel_win32_new_fd(). If it is a socket (from WinSock), + call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and + fds don't overlap. TODO: Implement also datagram sockets. + (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). + + * gcompletion.h: Include only on Unix. Is this + inclusion really needed here? OTOH, do include , for + size_t. + + * gmessages.c: (Win32) Don't define a function called "write" that + might clash with the prototype from , use a #define. + + * glib.def: Update. + + * gmain.c (g_source_add_poll): Don't return a value from void + function. + (g_main_context_get_poll_func): Compile also for non-Win32, as + presumably was intended. The result var is a GPollFunc, not a + GPollFunc*. Return the result! + 2000-12-13 Havoc Pennington * gconvert.c (open_converter): make static diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index fe5f01f..bd587a5 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,31 @@ +2000-12-14 Tor Lillqvist + + * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call + callback correctly. + (g_io_win32_create_watch): Fix typo. + (g_io_win32_fd_create_watch): Ditto. + (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix + fd lookalike provided by the C library), call + g_io_channel_win32_new_fd(). If it is a socket (from WinSock), + call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and + fds don't overlap. TODO: Implement also datagram sockets. + (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). + + * gcompletion.h: Include only on Unix. Is this + inclusion really needed here? OTOH, do include , for + size_t. + + * gmessages.c: (Win32) Don't define a function called "write" that + might clash with the prototype from , use a #define. + + * glib.def: Update. + + * gmain.c (g_source_add_poll): Don't return a value from void + function. + (g_main_context_get_poll_func): Compile also for non-Win32, as + presumably was intended. The result var is a GPollFunc, not a + GPollFunc*. Return the result! + 2000-12-13 Havoc Pennington * gconvert.c (open_converter): make static diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index fe5f01f..bd587a5 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,31 @@ +2000-12-14 Tor Lillqvist + + * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call + callback correctly. + (g_io_win32_create_watch): Fix typo. + (g_io_win32_fd_create_watch): Ditto. + (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix + fd lookalike provided by the C library), call + g_io_channel_win32_new_fd(). If it is a socket (from WinSock), + call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and + fds don't overlap. TODO: Implement also datagram sockets. + (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). + + * gcompletion.h: Include only on Unix. Is this + inclusion really needed here? OTOH, do include , for + size_t. + + * gmessages.c: (Win32) Don't define a function called "write" that + might clash with the prototype from , use a #define. + + * glib.def: Update. + + * gmain.c (g_source_add_poll): Don't return a value from void + function. + (g_main_context_get_poll_func): Compile also for non-Win32, as + presumably was intended. The result var is a GPollFunc, not a + GPollFunc*. Return the result! + 2000-12-13 Havoc Pennington * gconvert.c (open_converter): make static diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index fe5f01f..bd587a5 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,31 @@ +2000-12-14 Tor Lillqvist + + * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call + callback correctly. + (g_io_win32_create_watch): Fix typo. + (g_io_win32_fd_create_watch): Ditto. + (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix + fd lookalike provided by the C library), call + g_io_channel_win32_new_fd(). If it is a socket (from WinSock), + call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and + fds don't overlap. TODO: Implement also datagram sockets. + (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). + + * gcompletion.h: Include only on Unix. Is this + inclusion really needed here? OTOH, do include , for + size_t. + + * gmessages.c: (Win32) Don't define a function called "write" that + might clash with the prototype from , use a #define. + + * glib.def: Update. + + * gmain.c (g_source_add_poll): Don't return a value from void + function. + (g_main_context_get_poll_func): Compile also for non-Win32, as + presumably was intended. The result var is a GPollFunc, not a + GPollFunc*. Return the result! + 2000-12-13 Havoc Pennington * gconvert.c (open_converter): make static diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index fe5f01f..bd587a5 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,31 @@ +2000-12-14 Tor Lillqvist + + * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call + callback correctly. + (g_io_win32_create_watch): Fix typo. + (g_io_win32_fd_create_watch): Ditto. + (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix + fd lookalike provided by the C library), call + g_io_channel_win32_new_fd(). If it is a socket (from WinSock), + call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and + fds don't overlap. TODO: Implement also datagram sockets. + (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). + + * gcompletion.h: Include only on Unix. Is this + inclusion really needed here? OTOH, do include , for + size_t. + + * gmessages.c: (Win32) Don't define a function called "write" that + might clash with the prototype from , use a #define. + + * glib.def: Update. + + * gmain.c (g_source_add_poll): Don't return a value from void + function. + (g_main_context_get_poll_func): Compile also for non-Win32, as + presumably was intended. The result var is a GPollFunc, not a + GPollFunc*. Return the result! + 2000-12-13 Havoc Pennington * gconvert.c (open_converter): make static diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index fe5f01f..bd587a5 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,31 @@ +2000-12-14 Tor Lillqvist + + * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call + callback correctly. + (g_io_win32_create_watch): Fix typo. + (g_io_win32_fd_create_watch): Ditto. + (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix + fd lookalike provided by the C library), call + g_io_channel_win32_new_fd(). If it is a socket (from WinSock), + call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and + fds don't overlap. TODO: Implement also datagram sockets. + (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). + + * gcompletion.h: Include only on Unix. Is this + inclusion really needed here? OTOH, do include , for + size_t. + + * gmessages.c: (Win32) Don't define a function called "write" that + might clash with the prototype from , use a #define. + + * glib.def: Update. + + * gmain.c (g_source_add_poll): Don't return a value from void + function. + (g_main_context_get_poll_func): Compile also for non-Win32, as + presumably was intended. The result var is a GPollFunc, not a + GPollFunc*. Return the result! + 2000-12-13 Havoc Pennington * gconvert.c (open_converter): make static diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index fe5f01f..bd587a5 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,31 @@ +2000-12-14 Tor Lillqvist + + * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call + callback correctly. + (g_io_win32_create_watch): Fix typo. + (g_io_win32_fd_create_watch): Ditto. + (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix + fd lookalike provided by the C library), call + g_io_channel_win32_new_fd(). If it is a socket (from WinSock), + call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and + fds don't overlap. TODO: Implement also datagram sockets. + (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). + + * gcompletion.h: Include only on Unix. Is this + inclusion really needed here? OTOH, do include , for + size_t. + + * gmessages.c: (Win32) Don't define a function called "write" that + might clash with the prototype from , use a #define. + + * glib.def: Update. + + * gmain.c (g_source_add_poll): Don't return a value from void + function. + (g_main_context_get_poll_func): Compile also for non-Win32, as + presumably was intended. The result var is a GPollFunc, not a + GPollFunc*. Return the result! + 2000-12-13 Havoc Pennington * gconvert.c (open_converter): make static diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index fe5f01f..bd587a5 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,31 @@ +2000-12-14 Tor Lillqvist + + * giowin32.c (g_io_win32_dispatch): Warn if no callback. Call + callback correctly. + (g_io_win32_create_watch): Fix typo. + (g_io_win32_fd_create_watch): Ditto. + (g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix + fd lookalike provided by the C library), call + g_io_channel_win32_new_fd(). If it is a socket (from WinSock), + call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and + fds don't overlap. TODO: Implement also datagram sockets. + (g_io_channel_win32_poll): Call g_main_context_get_poll_func(). + + * gcompletion.h: Include only on Unix. Is this + inclusion really needed here? OTOH, do include , for + size_t. + + * gmessages.c: (Win32) Don't define a function called "write" that + might clash with the prototype from , use a #define. + + * glib.def: Update. + + * gmain.c (g_source_add_poll): Don't return a value from void + function. + (g_main_context_get_poll_func): Compile also for non-Win32, as + presumably was intended. The result var is a GPollFunc, not a + GPollFunc*. Return the result! + 2000-12-13 Havoc Pennington * gconvert.c (open_converter): make static diff --git a/gcompletion.h b/gcompletion.h index 83b243b..d5fca3f 100644 --- a/gcompletion.h +++ b/gcompletion.h @@ -28,7 +28,10 @@ #define __G_COMPLETION_H__ #include +#include /* For size_t */ +#ifdef G_OS_UNIX #include +#endif G_BEGIN_DECLS diff --git a/giowin32.c b/giowin32.c index f4e74cc..beee622 100644 --- a/giowin32.c +++ b/giowin32.c @@ -354,11 +354,19 @@ g_io_win32_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { + GIOFunc func = (GIOFunc)callback; GIOWin32Watch *watch = (GIOWin32Watch *)source; - return (*callback) (watch->channel, - watch->pollfd.revents & watch->condition, - user_data); + if (!func) + { + g_warning ("GIOWin32Watch dispatched without callback\n" + "You must call g_source_connect()."); + return FALSE; + } + + return (*func) (watch->channel, + watch->pollfd.revents & watch->condition, + user_data); } static void @@ -379,7 +387,7 @@ static GSourceFuncs win32_watch_funcs = { static GSource * g_io_win32_create_watch (GIOChannel *channel, GIOCondition condition, - int (*reader) (int, guchar *, int))) + int (*reader) (int, guchar *, int)) { GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel; GIOWin32Watch *watch; @@ -741,7 +749,7 @@ static GSource * g_io_win32_sock_create_watch (GIOChannel *channel, GIOCondition condition) { - return g_io_win32_add_watch (channel, condition, sock_reader); + return g_io_win32_create_watch (channel, condition, sock_reader); } static GIOFuncs win32_channel_msg_funcs = { @@ -837,7 +845,16 @@ g_io_channel_win32_new_stream_socket (int socket) GIOChannel * g_io_channel_unix_new (gint fd) { - return g_io_channel_win32_new_fd (fd); + struct stat st; + + if (fstat (fd, &st) == 0) + return g_io_channel_win32_new_fd (fd); + + if (getsockopt (fd, SOL_SOCKET, SO_TYPE, NULL, NULL) != SO_ERROR) + return g_io_channel_win32_new_stream_socket(fd); + + g_warning ("%d isn't a file descriptor or a socket", fd); + return NULL; } gint @@ -864,7 +881,7 @@ g_io_channel_win32_poll (GPollFD *fds, g_return_val_if_fail (n_fds >= 0, 0); - result = (*g_main_win32_get_poll_func ()) (fds, n_fds, timeout); + result = (*g_main_context_get_poll_func (NULL)) (fds, n_fds, timeout); return result; } diff --git a/glib.def b/glib.def index f6a2ae0..ac55829 100644 --- a/glib.def +++ b/glib.def @@ -157,6 +157,7 @@ EXPORTS g_idle_add g_idle_add_full g_idle_remove_by_data + g_idle_source_new g_int_equal g_int_hash g_io_add_watch @@ -215,17 +216,26 @@ EXPORTS g_log_set_fatal_mask g_log_set_handler g_logv - g_main_add_poll - g_main_destroy - g_main_is_running - g_main_iteration - g_main_new - g_main_pending - g_main_quit - g_main_remove_poll - g_main_run - g_main_set_poll_func - g_main_win32_get_poll_func + g_main_context_add_poll + g_main_context_check + g_main_context_default + g_main_context_dispatch + g_main_context_find_source_by_funcs_user_data + g_main_context_find_source_by_id + g_main_context_find_source_by_user_data + g_main_context_get + g_main_context_get_poll_func + g_main_context_iteration + g_main_context_pending + g_main_context_prepare + g_main_context_query + g_main_context_remove_poll + g_main_context_set_poll_func + g_main_loop_destroy + g_main_loop_is_running + g_main_loop_new + g_main_loop_quit + g_main_loop_run g_malloc g_malloc0 g_markup_error_quark @@ -397,10 +407,24 @@ EXPORTS g_slist_sort g_slist_sort_with_data g_snprintf - g_source_add + g_source_add_poll + g_source_attach + g_source_destroy + g_source_get_can_recurse + g_source_get_context + g_source_get_current_time + g_source_get_id + g_source_get_priority + g_source_new + g_source_ref g_source_remove - g_source_remove_by_source_data + g_source_remove_by_funcs_user_data g_source_remove_by_user_data + g_source_set_callback + g_source_set_callback_indirect + g_source_set_can_recurse + g_source_set_priority + g_source_unref g_spaced_primes_closest g_spawn_async g_spawn_async_with_pipes @@ -432,6 +456,7 @@ EXPORTS g_strdelimit g_strdown g_strdup + g_strdupv g_strdup_printf g_strdup_vprintf g_strerror @@ -486,6 +511,7 @@ EXPORTS g_threads_got_initialized g_timeout_add g_timeout_add_full + g_timeout_source_new g_timer_destroy g_timer_elapsed g_timer_new diff --git a/glib/gcompletion.h b/glib/gcompletion.h index 83b243b..d5fca3f 100644 --- a/glib/gcompletion.h +++ b/glib/gcompletion.h @@ -28,7 +28,10 @@ #define __G_COMPLETION_H__ #include +#include /* For size_t */ +#ifdef G_OS_UNIX #include +#endif G_BEGIN_DECLS diff --git a/glib/giowin32.c b/glib/giowin32.c index f4e74cc..beee622 100644 --- a/glib/giowin32.c +++ b/glib/giowin32.c @@ -354,11 +354,19 @@ g_io_win32_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { + GIOFunc func = (GIOFunc)callback; GIOWin32Watch *watch = (GIOWin32Watch *)source; - return (*callback) (watch->channel, - watch->pollfd.revents & watch->condition, - user_data); + if (!func) + { + g_warning ("GIOWin32Watch dispatched without callback\n" + "You must call g_source_connect()."); + return FALSE; + } + + return (*func) (watch->channel, + watch->pollfd.revents & watch->condition, + user_data); } static void @@ -379,7 +387,7 @@ static GSourceFuncs win32_watch_funcs = { static GSource * g_io_win32_create_watch (GIOChannel *channel, GIOCondition condition, - int (*reader) (int, guchar *, int))) + int (*reader) (int, guchar *, int)) { GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel; GIOWin32Watch *watch; @@ -741,7 +749,7 @@ static GSource * g_io_win32_sock_create_watch (GIOChannel *channel, GIOCondition condition) { - return g_io_win32_add_watch (channel, condition, sock_reader); + return g_io_win32_create_watch (channel, condition, sock_reader); } static GIOFuncs win32_channel_msg_funcs = { @@ -837,7 +845,16 @@ g_io_channel_win32_new_stream_socket (int socket) GIOChannel * g_io_channel_unix_new (gint fd) { - return g_io_channel_win32_new_fd (fd); + struct stat st; + + if (fstat (fd, &st) == 0) + return g_io_channel_win32_new_fd (fd); + + if (getsockopt (fd, SOL_SOCKET, SO_TYPE, NULL, NULL) != SO_ERROR) + return g_io_channel_win32_new_stream_socket(fd); + + g_warning ("%d isn't a file descriptor or a socket", fd); + return NULL; } gint @@ -864,7 +881,7 @@ g_io_channel_win32_poll (GPollFD *fds, g_return_val_if_fail (n_fds >= 0, 0); - result = (*g_main_win32_get_poll_func ()) (fds, n_fds, timeout); + result = (*g_main_context_get_poll_func (NULL)) (fds, n_fds, timeout); return result; } diff --git a/glib/glib.def b/glib/glib.def index f6a2ae0..ac55829 100644 --- a/glib/glib.def +++ b/glib/glib.def @@ -157,6 +157,7 @@ EXPORTS g_idle_add g_idle_add_full g_idle_remove_by_data + g_idle_source_new g_int_equal g_int_hash g_io_add_watch @@ -215,17 +216,26 @@ EXPORTS g_log_set_fatal_mask g_log_set_handler g_logv - g_main_add_poll - g_main_destroy - g_main_is_running - g_main_iteration - g_main_new - g_main_pending - g_main_quit - g_main_remove_poll - g_main_run - g_main_set_poll_func - g_main_win32_get_poll_func + g_main_context_add_poll + g_main_context_check + g_main_context_default + g_main_context_dispatch + g_main_context_find_source_by_funcs_user_data + g_main_context_find_source_by_id + g_main_context_find_source_by_user_data + g_main_context_get + g_main_context_get_poll_func + g_main_context_iteration + g_main_context_pending + g_main_context_prepare + g_main_context_query + g_main_context_remove_poll + g_main_context_set_poll_func + g_main_loop_destroy + g_main_loop_is_running + g_main_loop_new + g_main_loop_quit + g_main_loop_run g_malloc g_malloc0 g_markup_error_quark @@ -397,10 +407,24 @@ EXPORTS g_slist_sort g_slist_sort_with_data g_snprintf - g_source_add + g_source_add_poll + g_source_attach + g_source_destroy + g_source_get_can_recurse + g_source_get_context + g_source_get_current_time + g_source_get_id + g_source_get_priority + g_source_new + g_source_ref g_source_remove - g_source_remove_by_source_data + g_source_remove_by_funcs_user_data g_source_remove_by_user_data + g_source_set_callback + g_source_set_callback_indirect + g_source_set_can_recurse + g_source_set_priority + g_source_unref g_spaced_primes_closest g_spawn_async g_spawn_async_with_pipes @@ -432,6 +456,7 @@ EXPORTS g_strdelimit g_strdown g_strdup + g_strdupv g_strdup_printf g_strdup_vprintf g_strerror @@ -486,6 +511,7 @@ EXPORTS g_threads_got_initialized g_timeout_add g_timeout_add_full + g_timeout_source_new g_timer_destroy g_timer_elapsed g_timer_new diff --git a/glib/gmain.c b/glib/gmain.c index 9c60b87..5f2e2a7 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -904,7 +904,7 @@ g_source_add_poll (GSource *source, g_return_if_fail (source != NULL); g_return_if_fail (fd != NULL); - g_return_val_if_fail (!SOURCE_DESTROYED (source), 0); + g_return_if_fail (!SOURCE_DESTROYED (source)); context = source->context; @@ -2440,8 +2440,6 @@ g_main_context_set_poll_func (GMainContext *context, UNLOCK_CONTEXT (context); } -#ifdef G_OS_WIN32 - /** * g_main_context_get_poll_func: * @context: a #GMainContext @@ -2453,7 +2451,7 @@ g_main_context_set_poll_func (GMainContext *context, GPollFunc g_main_context_get_poll_func (GMainContext *context) { - GPollFunc *result; + GPollFunc result; if (!context) context = g_main_context_default (); @@ -2461,9 +2459,9 @@ g_main_context_get_poll_func (GMainContext *context) LOCK_CONTEXT (context); result = context->poll_func; UNLOCK_CONTEXT (context); -} -#endif + return result; +} /* HOLDS: context's lock */ /* Wake the main loop up from a poll() */ @@ -2477,7 +2475,7 @@ g_main_context_wakeup (GMainContext *context) #ifndef G_OS_WIN32 write (context->wake_up_pipe[1], "A", 1); #else - ReleaseSemaphore (context->context->wake_up_semaphore, 1, NULL); + ReleaseSemaphore (context->wake_up_semaphore, 1, NULL); #endif } #endif diff --git a/glib/gmessages.c b/glib/gmessages.c index 1685f86..3116c2f 100644 --- a/glib/gmessages.c +++ b/glib/gmessages.c @@ -98,15 +98,18 @@ static gboolean alloc_console_called = FALSE; /* Just use stdio. If we're out of memory, we're hosed anyway. */ #undef write static inline int -write (FILE *fd, - const char *buf, - int len) +dowrite (FILE *fd, + const void *buf, + unsigned int len) { fwrite (buf, len, 1, fd); fflush (fd); return len; } + +#define write(fd, buf, len) dowrite(fd, buf, len) + static void ensure_stdout_valid (void) { diff --git a/gmain.c b/gmain.c index 9c60b87..5f2e2a7 100644 --- a/gmain.c +++ b/gmain.c @@ -904,7 +904,7 @@ g_source_add_poll (GSource *source, g_return_if_fail (source != NULL); g_return_if_fail (fd != NULL); - g_return_val_if_fail (!SOURCE_DESTROYED (source), 0); + g_return_if_fail (!SOURCE_DESTROYED (source)); context = source->context; @@ -2440,8 +2440,6 @@ g_main_context_set_poll_func (GMainContext *context, UNLOCK_CONTEXT (context); } -#ifdef G_OS_WIN32 - /** * g_main_context_get_poll_func: * @context: a #GMainContext @@ -2453,7 +2451,7 @@ g_main_context_set_poll_func (GMainContext *context, GPollFunc g_main_context_get_poll_func (GMainContext *context) { - GPollFunc *result; + GPollFunc result; if (!context) context = g_main_context_default (); @@ -2461,9 +2459,9 @@ g_main_context_get_poll_func (GMainContext *context) LOCK_CONTEXT (context); result = context->poll_func; UNLOCK_CONTEXT (context); -} -#endif + return result; +} /* HOLDS: context's lock */ /* Wake the main loop up from a poll() */ @@ -2477,7 +2475,7 @@ g_main_context_wakeup (GMainContext *context) #ifndef G_OS_WIN32 write (context->wake_up_pipe[1], "A", 1); #else - ReleaseSemaphore (context->context->wake_up_semaphore, 1, NULL); + ReleaseSemaphore (context->wake_up_semaphore, 1, NULL); #endif } #endif diff --git a/gmessages.c b/gmessages.c index 1685f86..3116c2f 100644 --- a/gmessages.c +++ b/gmessages.c @@ -98,15 +98,18 @@ static gboolean alloc_console_called = FALSE; /* Just use stdio. If we're out of memory, we're hosed anyway. */ #undef write static inline int -write (FILE *fd, - const char *buf, - int len) +dowrite (FILE *fd, + const void *buf, + unsigned int len) { fwrite (buf, len, 1, fd); fflush (fd); return len; } + +#define write(fd, buf, len) dowrite(fd, buf, len) + static void ensure_stdout_valid (void) { diff --git a/gobject/ChangeLog b/gobject/ChangeLog index 6d5e5e4..2475a75 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,15 @@ +2000-12-14 Tor Lillqvist + + * makefile.mingw.in: Update, include parts from Makefile.am to + build gmarshal.[ch]. Some day, we won't need these separate + makefiles for Win32 compilation. I hope. + + * makefile.msc.in: Update. No use trying to build gmarshal.[ch] + here, it would require Unixish tools. MSVC users building from CVS + sources are out of luck. + + * gobject.def: Update. + Wed Dec 13 09:31:26 2000 Tim Janik * gparamspecs.[hc]: add G_TYPE_PARAM_BOXED implementation. diff --git a/gobject/gobject.def b/gobject/gobject.def index 1e6fe32..996d388 100644 --- a/gobject/gobject.def +++ b/gobject/gobject.def @@ -31,21 +31,16 @@ EXPORTS g_flags_get_value_by_name g_flags_get_value_by_nick g_flags_register_static - g_object_class_find_param_spec - g_object_class_install_param g_object_get g_object_get_data - g_object_get_param g_object_get_qdata g_object_get_valist g_object_new g_object_new_valist - g_object_queue_param_changed g_object_ref g_object_set g_object_set_data g_object_set_data_full - g_object_set_param g_object_set_qdata g_object_set_qdata_full g_object_set_valist @@ -78,6 +73,7 @@ EXPORTS g_param_value_validate g_param_values_cmp g_signal_connect_closure_by_id + g_signal_connect_object g_signal_emitv g_signal_handler_block g_signal_handler_disconnect @@ -89,10 +85,10 @@ EXPORTS g_signal_handlers_unblock_matched g_signal_lookup g_signal_name + g_signal_new g_signal_newv g_signal_query g_signal_stop_emission - g_signal_type_closure_new g_type_add_interface_dynamic g_type_add_interface_static g_type_check_class_cast @@ -104,7 +100,6 @@ EXPORTS g_type_class_peek_parent g_type_class_ref g_type_class_unref - g_type_conforms_to g_type_create_instance g_type_free_instance g_type_from_name @@ -113,7 +108,6 @@ EXPORTS g_type_get_plugin g_type_get_qdata g_type_init - g_type_instance_conforms_to g_type_interface_peek g_type_interfaces g_type_is_a diff --git a/gobject/makefile.mingw.in b/gobject/makefile.mingw.in index 5608e14..5bdb682 100644 --- a/gobject/makefile.mingw.in +++ b/gobject/makefile.mingw.in @@ -18,6 +18,8 @@ GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@ INCLUDES = -I .. -I . DEFINES = -DHAVE_CONFIG_H -DGOBJECT_COMPILATION -DG_LOG_DOMAIN=g_log_domain_gruntime +srcdir=. + BUILD_DLL = ../build-dll all : \ @@ -26,7 +28,8 @@ all : \ makefile.mingw: makefile.mingw.in sed -e 's,@GLIB[_]MAJOR_VERSION@,@GLIB_MAJOR_VERSION@,' \ - -e 's,@GLIB[_]MINOR_VERSION@,@GLIB_MINOR_VERSION@,' <$< >$@ + -e 's,@GLIB[_]MINOR_VERSION@,@GLIB_MINOR_VERSION@,' \ + -e 's,@RE[B]UILD@,,' <$< >$@ gobject_OBJECTS = \ gboxed.o \ @@ -47,4 +50,33 @@ gobject-$(GLIB_VER).dll : $(gobject_OBJECTS) gobject.def $(BUILD_DLL) gobject $(GLIB_VER) gobject.def $(gobject_OBJECTS) -L .. -lglib-$(GLIB_VER) glib-genmarshal.exe : glib-genmarshal.c - $(CC) -o $@ $(CFLAGS) -UGOBJECT_COMPILATION -DG_LOG_DOMAIN=\"glib-genmarshal\" $< -L .. -lglib-$(GLIB_VER) -L . -lgobject-$(GLIB_VER) + $(CC) -o $@ $(CFLAGS) -UGOBJECT_COMPILATION $< -L .. -lglib-$(GLIB_VER) -L . -lgobject-$(GLIB_VER) + +# Copied from Makefile.am: +# initial creation of the real stamp-* files +gmarshal.h: # never add deps here + test -f "$(srcdir)/$@" || touch $(srcdir)/$@ +# normal autogeneration rules +# all autogenerated files need to be generated in the srcdir, +# so old versions get remade and are not confused with newer +# versions in the build dir. thus a development setup requires +# srcdir to be writable, passing --disable-rebuilds to +# ../configure will supress all autogeneration rules. +$(srcdir)/stamp-gmarshal.h: @REBUILD@ gmarshal.list gmarshal.h glib-genmarshal.exe + echo "#ifndef __G_MARSHAL_H__" > xgen-gmh \ + && echo "#define __G_MARSHAL_H__" >> xgen-gmh \ + && ./glib-genmarshal --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --header >> xgen-gmh \ + && echo "#endif /* __G_MARSHAL_H__ */" >> xgen-gmh \ + && (cmp -s xgen-gmh $(srcdir)/gmarshal.h || cp xgen-gmh $(srcdir)/gmarshal.h) \ + && rm -f xgen-gmh xgen-gmh~ \ + && echo timestamp > $@ +$(srcdir)/gmarshal.c: @REBUILD@ $(srcdir)/stamp-gmarshal.h + ./glib-genmarshal --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --body >> xgen-gmc \ + && cp xgen-gmc $(srcdir)/gmarshal.c \ + && rm -f xgen-gmc xgen-gmc~ +$(srcdir)/gmarshal.strings: @REBUILD@ $(srcdir)/gmarshal.list + grep '^[A-Z]' $(srcdir)/gmarshal.list \ + | sed -e 's/^/"g_cclosure_marshal_/' -e 's/:/__/' -e 's/,/_/g' -e 's/$$/",/' > xgen-gms \ + && cp xgen-gms $(srcdir)/gmarshal.strings \ + && rm -f xgen-gms xgen-gms~ +glib-genmarshal.o: gmarshal.strings diff --git a/gobject/makefile.msc.in b/gobject/makefile.msc.in index b804ace..4730aa6 100644 --- a/gobject/makefile.msc.in +++ b/gobject/makefile.msc.in @@ -24,6 +24,7 @@ gobject_OBJECTS = \ gbsearcharray.obj \ gclosure.obj \ genums.obj \ + gmarshal.obj \ gobject.obj \ gparam.obj \ gparamspecs.obj \ @@ -42,4 +43,4 @@ gobject-$(GLIB_VER).dll : $(gobject_OBJECTS) gobject.def $(CC) $(CFLAGS) -LD -Fegobject-$(GLIB_VER).dll $(gobject_OBJECTS) ..\glib-$(GLIB_VER).lib $(LDFLAGS) /def:gobject.def glib-genmarshal.exe : glib-genmarshal.c - $(CC) -Fe$@ $(CFLAGS) -UGOBJECT_COMPILATION -DG_LOG_DOMAIN=\"glib-genmarshal\" glib-genmarshal.c ..\glib-$(GLIB_VER).lib gobject-$(GLIB_VER).lib + $(CC) -Fe$@ $(CFLAGS) -UGOBJECT_COMPILATION glib-genmarshal.c ..\glib-$(GLIB_VER).lib gobject-$(GLIB_VER).lib -- 2.7.4