From c38f0cb736a37cf0f3aba7750ca8219b286278dc Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 14 Mar 1991 23:03:12 +0000 Subject: [PATCH] Change callers of `UX_select_input' to call it when the operating system makes it available. Previously they attempted to predict when it would be needed, which sometimes failed and is in general unmodular. --- v7/src/microcode/unxutl/ymkfile | 4 ++-- v7/src/microcode/uxio.c | 27 ++++++++++++++++----------- v7/src/microcode/version.h | 4 ++-- v7/src/microcode/x11base.c | 31 ++++++++++--------------------- v8/src/microcode/version.h | 4 ++-- 5 files changed, 32 insertions(+), 38 deletions(-) diff --git a/v7/src/microcode/unxutl/ymkfile b/v7/src/microcode/unxutl/ymkfile index 9b6937718..e9746b76e 100644 --- a/v7/src/microcode/unxutl/ymkfile +++ b/v7/src/microcode/unxutl/ymkfile @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/unxutl/Attic/ymkfile,v 1.42 1991/03/14 04:23:26 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/unxutl/Attic/ymkfile,v 1.43 1991/03/14 23:03:12 cph Exp $ Copyright (c) 1989-91 Massachusetts Institute of Technology @@ -626,7 +626,7 @@ dmpwrld.o : scheme.touch prims.h ux.h osfs.h \ unexec.c unexhp9k800.c getpagesize.h x11base.o x11graph.o x11term.o starbasex.o : scheme.touch prims.h x11.h -x11base.o : ux.h osio.h uxselect.h +x11base.o : ux.h uxselect.h starbase.o : scheme.touch prims.h Sgraph.o Sgraph_xt.o SgX.o : scheme.touch prims.h Sgraph.h diff --git a/v7/src/microcode/uxio.c b/v7/src/microcode/uxio.c index 4adf38fd9..b40a8eb78 100644 --- a/v7/src/microcode/uxio.c +++ b/v7/src/microcode/uxio.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxio.c,v 1.11 1991/03/14 04:22:59 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxio.c,v 1.12 1991/03/14 23:02:46 cph Exp $ Copyright (c) 1990-91 Massachusetts Institute of Technology @@ -359,6 +359,12 @@ DEFUN (OS_channel_unregister, (channel), Tchannel channel) } } +#ifdef HAVE_SELECT +CONST int UX_have_select_p = 1; +#else +CONST int UX_have_select_p = 0; +#endif + enum select_input DEFUN (UX_select_input, (fd, blockp), int fd AND int blockp) { @@ -405,16 +411,15 @@ DEFUN (OS_channel_select_then_read, (channel, buffer, nbytes), size_t nbytes) { #ifdef HAVE_SELECT - if (OS_channels_registered > ((CHANNEL_REGISTERED (channel)) ? 1 : 0)) - switch (UX_select_input ((CHANNEL_DESCRIPTOR (channel)), - (! (CHANNEL_NONBLOCKING (channel))))) - { - case select_input_none: - return (-1); - case select_input_other: - case select_input_process_status: - return (-2); - } + switch (UX_select_input ((CHANNEL_DESCRIPTOR (channel)), + (! (CHANNEL_NONBLOCKING (channel))))) + { + case select_input_none: + return (-1); + case select_input_other: + case select_input_process_status: + return (-2); + } #endif return (OS_channel_read (channel, buffer, nbytes)); } diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 7c556fa67..60051c560 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.68 1991/03/14 04:23:15 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.69 1991/03/14 23:02:55 cph Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -46,5 +46,5 @@ MIT in each case. */ #define VERSION 11 #endif #ifndef SUBVERSION -#define SUBVERSION 68 +#define SUBVERSION 69 #endif diff --git a/v7/src/microcode/x11base.c b/v7/src/microcode/x11base.c index 88bb21935..fd706b418 100644 --- a/v7/src/microcode/x11base.c +++ b/v7/src/microcode/x11base.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.17 1991/03/14 04:23:20 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.18 1991/03/14 23:03:03 cph Exp $ Copyright (c) 1989-91 Massachusetts Institute of Technology @@ -37,7 +37,6 @@ MIT in each case. */ #include "scheme.h" #include "prims.h" #include "ux.h" -#include "osio.h" #include "uxselect.h" #include "x11.h" @@ -701,17 +700,12 @@ DEFUN (x_event_to_object, (event), XEvent * event) entry that reads events -- or else that all other event readers cooperate with this strategy. */ -/* The time_limit argument is currently ignored, because Edwin doesn't - use it. */ - static SCHEME_OBJECT -DEFUN (xd_process_events, (xd, time_limit_p, time_limit), +DEFUN (xd_process_events, (xd, non_block_p), struct xdisplay * xd AND - int time_limit_p AND - unsigned long time_limit) + int non_block_p) { Display * display = (XD_DISPLAY (xd)); - int do_select = (OS_channels_registered > 0); unsigned int events_queued; if (XD_CACHED_EVENT_P (xd)) { @@ -719,17 +713,17 @@ DEFUN (xd_process_events, (xd, time_limit_p, time_limit), goto restart; } events_queued = - (do_select ? (XEventsQueued (display, QueuedAlready)) - : time_limit_p ? (XEventsQueued (display, QueuedAfterReading)) + (UX_have_select_p ? (XEventsQueued (display, QueuedAlready)) + : non_block_p ? (XEventsQueued (display, QueuedAfterReading)) : 0); while (1) { XEvent event; if (events_queued > 0) events_queued -= 1; - else if (do_select) + else if (UX_have_select_p) switch (UX_select_input ((ConnectionNumber (display)), - (!time_limit_p))) + (!non_block_p))) { case select_input_none: return (SHARP_F); @@ -740,7 +734,7 @@ DEFUN (xd_process_events, (xd, time_limit_p, time_limit), events_queued = (XEventsQueued (display, QueuedAfterReading)); continue; } - else if (time_limit_p) + else if (non_block_p) return (SHARP_F); XNextEvent (display, (&event)); if ((event . type) == KeymapNotify) @@ -831,13 +825,8 @@ DEFINE_PRIMITIVE ("X-CLOSE-WINDOW", Prim_x_close_window, 1, 1, 0) DEFINE_PRIMITIVE ("X-DISPLAY-PROCESS-EVENTS", Prim_x_display_process_events, 2, 2, 0) { PRIMITIVE_HEADER (2); - { - struct xdisplay * xd = (x_display_arg (1)); - PRIMITIVE_RETURN - (((ARG_REF (2)) == SHARP_F) - ? (xd_process_events (xd, 0, 0)) - : (xd_process_events (xd, 1, (arg_nonnegative_integer (2))))); - } + PRIMITIVE_RETURN + (xd_process_events ((x_display_arg (1)), (BOOLEAN_ARG (2)))); } static void diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index 5f8a8e134..cefc08edb 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.68 1991/03/14 04:23:15 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.69 1991/03/14 23:02:55 cph Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -46,5 +46,5 @@ MIT in each case. */ #define VERSION 11 #endif #ifndef SUBVERSION -#define SUBVERSION 68 +#define SUBVERSION 69 #endif -- 2.25.1