This microcode cannot be used with Edwin versions prior to 3.65.
authorChris Hanson <org/chris-hanson/cph>
Tue, 4 Feb 1992 04:37:26 +0000 (04:37 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 4 Feb 1992 04:37:26 +0000 (04:37 +0000)
The implementation of UX_select has been changed to return to the
caller when a Scheme interrupt needs servicing, rather than just
servicing the interrupt and going back into the select.  This gives
Scheme code a chance to run and do something useful.

In addition, the primitives CHANNEL-SELECT-THEN-READ and
X-DISPLAY-PROCESS-EVENTS have been changed to return different event
codes for the "other output" and "process status change" events.  This
allows the event-handling code to go directly to the handler, rather
than trying to figure out which one occurred.

v7/src/microcode/prosio.c
v7/src/microcode/uxio.c
v7/src/microcode/uxselect.h
v7/src/microcode/version.h
v7/src/microcode/x11base.c
v8/src/microcode/version.h

index c5e4b55d870df33916a3d95afea4c659ca4d2274..5547a905af245e1c0ebc7854e227dd2493587ad5 100644 (file)
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosio.c,v 1.6 1991/03/14 04:22:45 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosio.c,v 1.7 1992/02/04 04:36:56 cph Exp $
 
-Copyright (c) 1987-91 Massachusetts Institute of Technology
+Copyright (c) 1987-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -233,8 +233,10 @@ DEFINE_PRIMITIVE ("CHANNEL-UNREGISTER", Prim_channel_unregister, 1, 1,
 
 DEFINE_PRIMITIVE ("CHANNEL-SELECT-THEN-READ", Prim_channel_select_then_read, 4, 4,
   "Like CHANNEL-READ, but also watches registered input channels.\n\
-If there is no input on CHANNEL, but there is input on some other registered\n\
-channel or some subprocess status changes, this procedure returns #T.")
+If there is no input on CHANNEL, returns #F.\n\
+If there is input on some other registered channel, returns -2.\n\
+If the status of some subprocess changes, returns -3.\n\
+If an interrupt occurs during the read, returns -4.")
 {
   PRIMITIVE_HEADER (4);
   CHECK_ARG (2, STRING_P);
@@ -247,11 +249,6 @@ channel or some subprocess status changes, this procedure returns #T.")
       (OS_channel_select_then_read ((arg_channel (1)),
                                    (STRING_LOC (buffer, start)),
                                    (end - start)));
-    PRIMITIVE_RETURN
-      ((nread == -2)
-       ? SHARP_T
-       : (nread < 0)
-       ? SHARP_F
-       : (long_to_integer (nread)));
+    PRIMITIVE_RETURN ((nread == (-1)) ? SHARP_F : (long_to_integer (nread)));
   }
 }
index 011b38e591863717985eb575271ddceea500e82f..51fcd75fc7959e52639c6fbdbec89821aec239cc 100644 (file)
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxio.c,v 1.17 1992/01/20 18:52:26 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxio.c,v 1.18 1992/02/04 04:37:03 cph Exp $
 
-Copyright (c) 1990-1992 Massachusetts Institute of Technology
+Copyright (c) 1990-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -406,9 +406,11 @@ DEFUN (UX_select_input, (fd, blockp), int fd AND int blockp)
        error_system_call (errno, syscall_select);
       else if (status_change_p)
        return (select_input_process_status);
-      deliver_pending_interrupts ();
+      if (pending_interrupts_p ())
+       return (select_input_interrupt);
     }
 #else
+  error_system_call (ENOSYS, syscall_select);
   return (select_input_argument);
 #endif
 }
@@ -419,16 +421,17 @@ DEFUN (OS_channel_select_then_read, (channel, buffer, nbytes),
        PTR buffer AND
        size_t nbytes)
 {
-#ifdef HAVE_SELECT
   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);
+    case select_input_process_status:
+      return (-3);
+    case select_input_interrupt:
+      return (-4);
     }
-#endif
   return (OS_channel_read (channel, buffer, nbytes));
 }
index 5c6f5a235b6fdeb2fc64ef0189d9b2f51ef53e32..121a8cbfb53a72e703eb9fadb806c73873b38e9b 100644 (file)
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxselect.h,v 1.1 1991/06/22 19:09:15 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxselect.h,v 1.2 1992/02/04 04:37:11 cph Exp $
 
-Copyright (c) 1991 Massachusetts Institute of Technology
+Copyright (c) 1991-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -40,7 +40,8 @@ enum select_input
   select_input_argument,
   select_input_other,
   select_input_none,
-  select_input_process_status
+  select_input_process_status,
+  select_input_interrupt
 };
 
 extern CONST int UX_have_select_p;
index f8964900085aadcd6d16cd25bd331c5c4eacbc9d..7fe476a2ea8934975392c2e585dd595cf963fef7 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.106 1992/02/04 00:43:55 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.107 1992/02/04 04:37:16 cph Exp $
 
 Copyright (c) 1988-92 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     106
+#define SUBVERSION     107
 #endif
index 00f191afe2165071772c1d3a916465ed74f4be71..1e04268382a7d887d577af135ddbf5a09a1c6e0c 100644 (file)
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.30 1992/01/22 23:13:31 arthur Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.31 1992/02/04 04:37:26 cph Exp $
 
-Copyright (c) 1989-91 Massachusetts Institute of Technology
+Copyright (c) 1989-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -779,8 +779,11 @@ DEFUN (xd_process_events, (xd, non_block_p),
          case select_input_none:
            return (SHARP_F);
          case select_input_other:
+           return (LONG_TO_FIXNUM (-2));
          case select_input_process_status:
-           return (SHARP_T);
+           return (LONG_TO_FIXNUM (-3));
+         case select_input_interrupt:
+           return (LONG_TO_FIXNUM (-4));
          case select_input_argument:
            events_queued = (XEventsQueued (display, QueuedAfterReading));
            continue;
index ec4d44ee71011fca86468c3fd2fb38d9d77c6575..4b65a0af57c1eb2190c7b6f9a34560dbd5a9747d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.106 1992/02/04 00:43:55 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.107 1992/02/04 04:37:16 cph Exp $
 
 Copyright (c) 1988-92 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     106
+#define SUBVERSION     107
 #endif