Remove unused DOS code.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Wed, 7 Oct 1992 06:23:36 +0000 (06:23 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Wed, 7 Oct 1992 06:23:36 +0000 (06:23 +0000)
Clean up some interrupt code.

12 files changed:
v7/src/microcode/dosconio.c
v7/src/microcode/dosexcp.c
v7/src/microcode/dosinsn.h
v7/src/microcode/dosint10.c
v7/src/microcode/dosio.c
v7/src/microcode/doskbd.c
v7/src/microcode/dossig.c
v7/src/microcode/dossys.c
v7/src/microcode/dossys.h
v7/src/microcode/dostty.c
v7/src/microcode/dosx32.c
v7/src/microcode/msdos.h

index f0d2102f62ccb3432275bb83f0314395e002947a..08e12028325a77746cdc611196fc6766e30c9a88 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: dosconio.c,v 1.7 1992/09/24 01:34:59 cph Exp $
+$Id: dosconio.c,v 1.8 1992/10/07 06:23:25 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -326,7 +326,7 @@ long
 DEFUN (console_read, (buffer, nbytes, buffered_p, blocking_p),
        char * buffer AND unsigned nbytes AND int buffered_p AND int blocking_p)
 { 
-  System_Error_Reset();
+  System_Error_Reset ();
   do
   { /* Get all pending characters into the buffer */
     while (typeahead_available_p ())
@@ -350,15 +350,6 @@ DEFUN (console_read, (buffer, nbytes, buffered_p, blocking_p),
   } while (blocking_p);        /* Keep reading for blocking channel. */
   /* This means there is nothing available, don't block */
   System_Error_Return (ERRNO_NONBLOCK);
-}
-
-extern int EXFUN
- (text_write, (int fd AND CONST unsigned char * buffer AND size_t nbytes));
-
-void
-DEFUN (console_write_string, (string), void * string)
-{
-  text_write ((fileno(stdout)), string, strlen((char *) string));
   return;
 }
 \f
index 5cd65bcf06fffbe54a43ce89236baf09d1658c82..2dee0327051d28c36c63a2bf17ea3dda8c52a5d7 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: dosexcp.c,v 1.4 1992/09/19 19:05:17 jinx Exp $
+$Id: dosexcp.c,v 1.5 1992/10/07 06:23:27 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -37,6 +37,7 @@ MIT in each case. */
 #include <stdlib.h>
 #include <string.h>
 #include <dos.h>
+#include "msdos.h"
 #include "dossys.h"
 #include "dosinsn.h"
 #include "dosexcp.h"
@@ -46,23 +47,23 @@ DPMI_get_exception_vector (unsigned exception,
                           unsigned short * cs_selector,
                           unsigned * code_offset)
 {
-  union REGS regs1, regs2;
+  union REGS regs;
 
   if (exception > 0x1f)
   {
     errno = EINVAL;
     return (DOS_FAILURE);
   }
-  regs1.e.eax = 0x202;
-  regs1.e.ebx = exception;
-  int86 (0x31, &regs1, &regs2);
-  if ((regs2.e.flags & 1) != 0)
+  regs.e.eax = 0x202;
+  regs.e.ebx = exception;
+  intDPMI (&regs, &regs);
+  if ((regs.e.flags & 1) != 0)
   {
     errno = EINVAL;
     return (DOS_FAILURE);
   }
-  * cs_selector = regs2.x.cx;
-  * code_offset = regs2.e.edx;
+  * cs_selector = regs.x.cx;
+  * code_offset = regs.e.edx;
   return (DOS_SUCCESS);
 }
 
@@ -82,7 +83,7 @@ DPMI_set_exception_vector (unsigned exception,
   regs.e.ebx = exception;
   regs.e.ecx = cs_selector;
   regs.e.edx = code_offset;
-  int86 (0x31, &regs, &regs);
+  intDPMI (&regs, &regs);
   if ((regs.e.flags & 1) != 0)
   {
     errno = EINVAL;
@@ -208,7 +209,7 @@ DPMI_free_scheme_stack (unsigned short ss)
 
   regs.x.ax = 0x1;
   regs.x.bx = ss;
-  int86 (0x31, &regs, &regs);
+  intDPMI (&regs, &regs);
   return ((regs.e.cflag != 0) ? DOS_FAILURE : DOS_SUCCESS);
 }
 
@@ -232,7 +233,7 @@ DPMI_alloc_scheme_stack (unsigned short * ds,
 
   regs.x.ax = 0x0;             /* Allocate LDT Descriptor */
   regs.x.cx = 1;
-  int86 (0x31, &regs, &regs);
+  intDPMI (&regs, &regs);
   if (regs.e.cflag != 0)
     return (DOS_FAILURE);
   ss_sel = regs.x.ax;
@@ -241,7 +242,7 @@ DPMI_alloc_scheme_stack (unsigned short * ds,
   regs.x.ax = 0xb;             /* Get Descriptor */
   regs.x.bx = css_sel;
   regs.e.edi = ((unsigned long) &descriptor[0]);
-  int86x (0x31, &regs, &regs, &sregs);
+  intDPMIx (&regs, &regs, &sregs);
   if (regs.e.cflag != 0)
   {
 fail:
@@ -261,7 +262,7 @@ fail:
   regs.x.ax = 0xc;             /* Set Descriptor */
   regs.x.bx = ss_sel;
   regs.e.edi = ((unsigned long) &descriptor[0]);
-  int86x (0x31, &regs, &regs, &sregs);
+  intDPMIx (&regs, &regs, &sregs);
   if (regs.e.cflag != 0)
     goto fail;
 
@@ -286,7 +287,7 @@ X32_get_exception_vector (unsigned exception,
   segread (&sregs);
   regs.e.eax = 0x2532;
   regs.h.cl = exception;
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   if ((regs.e.flags & 1) != 0)
   {
     errno = EINVAL;
@@ -316,7 +317,7 @@ X32_set_exception_vector (unsigned exception,
   sregs.ds = cs_selector;
   regs.e.edx = code_offset;
 
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   if ((regs.e.flags & 1) != 0)
   {
     errno = EINVAL;
index 286e0ee13724e208c0d26053623bd35d6595a19a..3969c6d690d28712c6970c1a240c8b34f5139c02 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/dosinsn.h,v 1.1 1992/05/05 06:55:13 jinx Exp $
+$Id: dosinsn.h,v 1.2 1992/10/07 06:23:28 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -35,6 +35,18 @@ MIT in each case. */
 #ifndef _DOSINSN_H_
 #  define _DOSINSN_H_
 \f
+#ifdef getDS
+#undef getDS
+#endif
+
+#ifdef getCS
+#undef getCS
+#endif
+
+#ifdef getSS
+#undef getSS
+#endif
+
 extern unsigned short getCS (void);
 extern unsigned short getDS (void);
 extern unsigned short getSS (void);
index feb7dbac7b2a7e6b28dad0f89235863495cd2161..a6105d04ff0f07b22d718c24a68ffa759e21aee4 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: dosint10.c,v 1.2 1992/09/15 20:35:42 jinx Exp $
+$Id: dosint10.c,v 1.3 1992/10/07 06:23:28 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -43,23 +43,17 @@ MIT in each case. */
   The coordinates (0x00,0x00) is the upper-left corner.
 */
 
-#include "dosint10.h"
 #include "scheme.h"
 #include "prims.h"
+#include "msdos.h"
+#include "dosint10.h"
 \f
-#define DEBUG_WRITE(message) \
-  {\
-    FILE *debug_file = fopen("\\tmp\\debug.fil","ab");\
-    fputs(message,debug_file);\
-    fputs("\n",debug_file);\
-    fclose(debug_file);\
-  }
-
 /**********************************************************************/
 
 #define MAP map_ansi_sys_color_to_bios_attribute
 
-int map_ansi_sys_color_to_bios_attribute(int iANSIcode)
+static int 
+map_ansi_sys_color_to_bios_attribute (int iANSIcode)
 {
   /*
     ANSI.SYS color mappings (ISO 6429 standard) to video memory attributes:
@@ -114,7 +108,7 @@ int REVERSE_VIDEO = UNINITIALIZED;
 extern unsigned long RealModeBufferParagraph;
 extern char *pRealModeBuffer;
 
-void 
+static void 
 bios_initialize_variables (void)
 /*
   If valid environment variables exist, use values. Otherwise
@@ -130,43 +124,40 @@ bios_initialize_variables (void)
     DISPLAY_ROWS = tty_y_size-1;
 
   if (FOREGROUND_ATTRIBUTE == UNINITIALIZED)
+  {
+    psTemp = (getenv ("EDWIN_FOREGROUND"));
+    if (NULL == psTemp)
+      FOREGROUND_ATTRIBUTE = _0B(0,0,0,0,0,1,1,1); /* White */
+    else
     {
-      psTemp = getenv("EDWIN_FOREGROUND");
-      if (NULL == psTemp)
-        {
-          FOREGROUND_ATTRIBUTE = _0B(0,0,0,0,0,1,1,1); /* White */
-        }
+      if (atoi(psTemp) == 0)
+       FOREGROUND_ATTRIBUTE = _0B(0,0,0,0,0,1,1,1); /* White */
       else
-        {
-          if (atoi(psTemp) == 0)
-            FOREGROUND_ATTRIBUTE = _0B(0,0,0,0,0,1,1,1); /* White */
-          else
-            FOREGROUND_ATTRIBUTE = MAP(atoi(psTemp));
-        }
+       FOREGROUND_ATTRIBUTE = MAP(atoi(psTemp));
     }
+  }
 
   if (BACKGROUND_ATTRIBUTE == UNINITIALIZED)
+  {
+    psTemp = (getenv ("EDWIN_BACKGROUND"));
+    if (NULL == psTemp)
+      BACKGROUND_ATTRIBUTE = _0B(0,0,0,0,0,0,0,0) << 4; /* Black */
+    else
     {
-      psTemp = getenv("EDWIN_BACKGROUND");
-      if (NULL == psTemp)
-        {
-          BACKGROUND_ATTRIBUTE = _0B(0,0,0,0,0,0,0,0) << 4; /* Black */
-        }
+      if (atoi(psTemp) == 0)
+       BACKGROUND_ATTRIBUTE = _0B(0,0,0,0,0,0,0,0) << 4; /* Black */
       else
-        {
-          if (atoi(psTemp) == 0)
-            BACKGROUND_ATTRIBUTE = _0B(0,0,0,0,0,0,0,0) << 4; /* Black */
-          else
-            BACKGROUND_ATTRIBUTE = MAP(atoi(psTemp)) << 4;
-        }
+       BACKGROUND_ATTRIBUTE = MAP(atoi(psTemp)) << 4;
     }
+  }
 
   NORMAL_VIDEO = (FOREGROUND_ATTRIBUTE | BACKGROUND_ATTRIBUTE);
   REVERSE_VIDEO = ((FOREGROUND_ATTRIBUTE << 4) | (BACKGROUND_ATTRIBUTE >> 4));
   return;
 }
-
-void bios_uninitialize_variables(void)
+\f
+static void 
+bios_uninitialize_variables (void)
 {
   DISPLAY_COLUMNS = UNINITIALIZED;
   DISPLAY_ROWS = UNINITIALIZED;
@@ -174,370 +165,309 @@ void bios_uninitialize_variables(void)
   BACKGROUND_ATTRIBUTE = UNINITIALIZED;
   NORMAL_VIDEO = UNINITIALIZED;
   REVERSE_VIDEO = UNINITIALIZED;
-}
-\f
-void bios__scroll_up_rectangle(int iBlankAttribute, int iLines,
-  int iUpperLeftX, int iUpperLeftY,
-  int iBottomRightX, int iBottomRightY)
-{
-  union REGS rIn;
-  union REGS rOut;
-
-  rIn.h.ah = 0x06;
-  rIn.h.al = iLines;
-  rIn.h.bh = iBlankAttribute;
-  rIn.h.ch = iUpperLeftY;
-  rIn.h.cl = iUpperLeftX;
-  rIn.h.dh = iBottomRightY;
-  rIn.h.dl = iBottomRightX;
-  int86(0x10,&rIn,&rOut);
+  return;
 }
 
-void bios__scroll_down_rectangle(int iBlankAttribute, int iLines,
-  int iUpperLeftX, int iUpperLeftY,
-  int iBottomRightX, int iBottomRightY)
+static void 
+bios__scroll_up_rectangle (int iBlankAttribute, int iLines,
+                          int iUpperLeftX, int iUpperLeftY,
+                          int iBottomRightX, int iBottomRightY)
 {
-  union REGS rIn;
-  union REGS rOut;
-
-  rIn.h.ah = 0x07;
-  rIn.h.al = iLines;
-  rIn.h.bh = iBlankAttribute;
-  rIn.h.ch = iUpperLeftY;
-  rIn.h.cl = iUpperLeftX;
-  rIn.h.dh = iBottomRightY;
-  rIn.h.dl = iBottomRightX;
-  int86(0x10,&rIn,&rOut);
+  union REGS regs;
+
+  regs.h.ah = 0x06;
+  regs.h.al = iLines;
+  regs.h.bh = iBlankAttribute;
+  regs.h.ch = iUpperLeftY;
+  regs.h.cl = iUpperLeftX;
+  regs.h.dh = iBottomRightY;
+  regs.h.dl = iBottomRightX;
+  int10h (&regs, &regs);
+  return;
 }
 
-void bios__set_cursor_position(int iPageNumber, int iColumn, int iRow)
+static void 
+bios__scroll_down_rectangle (int iBlankAttribute, int iLines,
+                            int iUpperLeftX, int iUpperLeftY,
+                            int iBottomRightX, int iBottomRightY)
 {
-  union REGS rIn;
-  union REGS rOut;
-
-  rIn.h.ah = 0x02;
-  rIn.h.bh = iPageNumber;
-  rIn.h.dh = iRow;
-  rIn.h.dl = iColumn;
-  int86(0x10,&rIn,&rOut);
+  union REGS regs;
+
+  regs.h.ah = 0x07;
+  regs.h.al = iLines;
+  regs.h.bh = iBlankAttribute;
+  regs.h.ch = iUpperLeftY;
+  regs.h.cl = iUpperLeftX;
+  regs.h.dh = iBottomRightY;
+  regs.h.dl = iBottomRightX;
+  int10h (&regs, &regs);
+  return;
 }
 
-void bios__write_char_with_attribute(char cChar, int iPageNumber,
-  int iAttribute, int iRepeatCount)
-  /* Note: no special characters are recognized */
+static void 
+bios__set_cursor_position (int iPageNumber, int iColumn, int iRow)
 {
-  union REGS rIn;
-  union REGS rOut;
-
-  rIn.h.ah = 0x09;
-  rIn.h.al = cChar;
-  rIn.h.bh = iPageNumber;
-  rIn.h.bl = iAttribute;
-  rIn.x.cx = iRepeatCount;
+  union REGS regs;
 
-  int86(0x10,&rIn,&rOut);
+  regs.h.ah = 0x02;
+  regs.h.bh = iPageNumber;
+  regs.h.dh = iRow;
+  regs.h.dl = iColumn;
+  int10h (&regs, &regs);
+  return;
+}
+\f
+static void 
+bios__write_char_with_attribute (char cChar, int iPageNumber,
+                                int iAttribute, int iRepeatCount)
+     /* Note: no special characters are recognized */
+{
+  union REGS regs;
+
+  regs.h.ah = 0x09;
+  regs.h.al = cChar;
+  regs.h.bh = iPageNumber;
+  regs.h.bl = iAttribute;
+  regs.x.cx = iRepeatCount;
+  int10h (&regs, &regs);
+  return;
 }
 
-void bios__teletype_output_char(char cChar, int iPageNumber,
-  int iGraphicsModeForegroundColor)
+static void 
+bios__teletype_output_char (char cChar, int iPageNumber,
+                           int iGraphicsModeForegroundColor)
   /* Note: CR/LF/BS/BEL recognized */
 {
-  union REGS rIn;
-  union REGS rOut;
+  union REGS regs;
 
-  rIn.h.ah = 0x0E;
-  rIn.h.al = cChar;
-  rIn.h.bh = iPageNumber;
-  rIn.h.bl = iGraphicsModeForegroundColor;
-
-  int86(0x10,&rIn,&rOut);
+  regs.h.ah = 0x0E;
+  regs.h.al = cChar;
+  regs.h.bh = iPageNumber;
+  regs.h.bl = iGraphicsModeForegroundColor;
+  int10h (&regs, &regs);
+  return;
 }
 
-void bios__set_video_mode(int iModeNumber)
+static void 
+bios__set_video_mode (int iModeNumber)
 {
-  union REGS rIn;
-  union REGS rOut;
+  union REGS regs;
 
-  rIn.h.ah = 0x00;
-  rIn.h.al = iModeNumber;
-  int86(0x10,&rIn,&rOut);
+  regs.h.ah = 0x00;
+  regs.h.al = iModeNumber;
+  int10h (&regs, &regs);
+  return;
 }
 
-void bios__set_cursor_size(int iBlinkMode, int iTopScan, int iBottomScan)
+static void
+bios__set_cursor_size (int iBlinkMode, int iTopScan, int iBottomScan)
 {
-  union REGS rIn;
-  union REGS rOut;
-
-  rIn.h.ah = 0x01;
-  rIn.h.ch = (((iBlinkMode & _0B(0,0,0,0,0,0,1,1)) << 5)
-             | (iTopScan & _0B(0,0,0,1,1,1,1,1)));
-  rIn.h.cl = (iBottomScan & _0B(0,0,0,1,1,1,1,1));
-  int86(0x10,&rIn,&rOut);
+  union REGS regs;
+
+  regs.h.ah = 0x01;
+  regs.h.ch = (((iBlinkMode & _0B(0,0,0,0,0,0,1,1)) << 5)
+              | (iTopScan & _0B(0,0,0,1,1,1,1,1)));
+  regs.h.cl = (iBottomScan & _0B(0,0,0,1,1,1,1,1));
+  int10h (&regs, &regs);
+  return;
 }
 \f
-void bios_clear_line(int iCol, int iRow, int iFirstUnusedX)
+static void 
+bios_clear_line (int iCol, int iRow, int iFirstUnusedX)
 {
-  bios__scroll_up_rectangle(NORMAL_VIDEO, 0, iCol, iRow, iFirstUnusedX, iRow);
+  bios__scroll_up_rectangle (NORMAL_VIDEO, 0, iCol, iRow, iFirstUnusedX, iRow);
+  return;
 }
 
-void bios_clear_region(int iUpperLeftX, int iUpperLeftY,
-  int iBottomRightX, int iBottomRightY)
+static void
+bios_clear_region (int iUpperLeftX, int iUpperLeftY,
+                  int iBottomRightX, int iBottomRightY)
 {
-  bios__scroll_up_rectangle(NORMAL_VIDEO, 0,
-    iUpperLeftX, iUpperLeftY, iBottomRightX, iBottomRightY);
+  bios__scroll_up_rectangle (NORMAL_VIDEO, 0,
+                            iUpperLeftX, iUpperLeftY,
+                            iBottomRightX, iBottomRightY);
+  return;
 }
 
-void bios_clear_screen(void)
+static void
+bios_clear_screen (void)
 {
-  bios__scroll_up_rectangle(NORMAL_VIDEO, 0x00,
-    0, 0, DISPLAY_COLUMNS, DISPLAY_ROWS);
+  bios__scroll_up_rectangle (NORMAL_VIDEO, 0x00,
+                            0, 0, DISPLAY_COLUMNS, DISPLAY_ROWS);
+  return;
 }
 
-void bios_get_cursor_position(int *x, int *y)
+static void
+bios_get_cursor_position (int * x, int * y)
 {
-  union REGS rIn;
-  union REGS rOut;
-
-  rIn.h.ah = 0x03;
-  rIn.h.bh = 0x00; /* page number */
-  int86(0x10,&rIn,&rOut);
-  *y = rOut.h.dh;
-  *x = rOut.h.dl;
-}
+  union REGS regs;
 
-void bios_write_string_attributed(char *pString, long lLength, int iColumn,
-  int iRow, int iSingleAttribute)
-{
-  strncpy(pRealModeBuffer,pString,lLength);
-  asm_bios__write_string_attr(1,0,iSingleAttribute,lLength,
-    iColumn,iRow,((RealModeBufferParagraph << 16) + 0));
+  regs.h.ah = 0x03;
+  regs.h.bh = 0x00; /* page number */
+  int10h (&regs, &regs);
+  *y = regs.h.dh;
+  *x = regs.h.dl;
+  return;
 }
-\f
-#ifdef USE_MAIN
 
-int main()
+static void
+bios_write_string_attributed (char * pString, long lLength, int iColumn,
+                             int iRow, int iSingleAttribute)
 {
- char BIGSTR[] = \
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ2þþþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ4þþþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ6þþþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ8þþþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ10þþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ12þþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ14þþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ16þþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ18þþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ20þþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ22þþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "12345678911234567892123456789312345678941234567895123456789612345678971234567898"
-    "þþ24þþþþþ1þþþþþþþþþ2þþþþþþþþþ3þþþþþþþþþ4þþþþþþþþþ5þþþþþþþþþ6þþþþþþþþþ7þþþþþþþþþ8"
-    "1234567891123456789212345678931234567894123456789512345678961234567897123456789";
-
-  int i,j,k;
-
-  printf(BIGSTR);
-  bios_initialize();
-
-  for (j=0; j<=24; j++)
-    {
-      for (i=0; i<=79; i++)
-        {
-          bios__set_cursor_position(0x00,i,j);
-          bios__write_char_with_attribute(i+j,0x00,_0B(0,0,0,1,1,1,0,0),0x01);
-        }
-    }
-
-  for (i=0; i<=24; i++)
-  {
-    bios__scroll_down_rectangle(i*4, 1, 0, 0, 39, 24);
-    bios__scroll_up_rectangle(i*4, 1, 40, 0, 79, 24);
-  }
-
-  for (i=0; i<=24; i=i+2)
-  {
-    bios_clear_line(i);
-  }
-
-  for (i=0; i<=255; i++)
-  {
-    bios__teletype_output_char(i,0x00,0x00);
-  }
-
-  {
-    char *pcTemp;
-    pcTemp = BIGSTR;
-    while (0x00 != *pcTemp)
-      {
-        bios__teletype_output_char(*pcTemp,0x00,0x00);
-        pcTemp++;
-      }
-  }
-
-  printf("\n%s",BIGSTR);
-  for (i=5; i<75; i=i+4)
-  {
-    bios_clear_region(i,5,i+2,20);
-  }
-
+  strncpy (pRealModeBuffer, pString, lLength);
+  asm_bios__write_string_attr (1, 0, iSingleAttribute, lLength,
+                              iColumn, iRow,
+                              ((RealModeBufferParagraph << 16) + 0));
+  return;
 }
-
-#endif /* USE_MAIN */
 \f
-DEFINE_PRIMITIVE("BIOS:BEEP", Prim_bios_beep, 0, 0, 0)
+DEFINE_PRIMITIVE ("BIOS:BEEP", Prim_bios_beep, 0, 0, 0)
 {
-  PRIMITIVE_HEADER(0);
-  bios__teletype_output_char('\007',0,0x00);
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (0);
+  bios__teletype_output_char ('\007', 0, 0x00);
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:CLEAR-LINE!", Prim_bios_clear_line, 3, 3, 0)
+DEFINE_PRIMITIVE ("BIOS:CLEAR-LINE!", Prim_bios_clear_line, 3, 3, 0)
 {
-  PRIMITIVE_HEADER(3);
-  bios_clear_line(arg_integer(1),arg_integer(2),arg_integer(3));
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (3);
+  bios_clear_line ((arg_integer (1)), (arg_integer (2)), (arg_integer (3)));
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:CLEAR-RECTANGLE!", Prim_bios_clear_rectangle, 5, 5, 0)
+DEFINE_PRIMITIVE ("BIOS:CLEAR-RECTANGLE!", Prim_bios_clear_rectangle, 5, 5, 0)
   /* xl xu yl yu highlight */
 {
-  PRIMITIVE_HEADER(5);
-  bios_clear_region(arg_integer(1),arg_integer(3),arg_integer(2),arg_integer(4));
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (5);
+  bios_clear_region ((arg_integer (1)), (arg_integer (3)),
+                    (arg_integer (2)), (arg_integer (4)));
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:CLEAR-SCREEN!", Prim_bios_clear_screen, 0, 0, 0)
+DEFINE_PRIMITIVE ("BIOS:CLEAR-SCREEN!", Prim_bios_clear_screen, 0, 0, 0)
 {
-  PRIMITIVE_HEADER(0);
-  bios_clear_screen();
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (0);
+  bios_clear_screen ();
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:DISCARD!", Prim_bios_discard, 0, 0, 0)
+DEFINE_PRIMITIVE ("BIOS:DISCARD!", Prim_bios_discard, 0, 0, 0)
 {
-  PRIMITIVE_HEADER(0);
-  bios_uninitialize_variables();
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (0);
+  bios_uninitialize_variables ();
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:ENTER!", Prim_bios_enter, 0, 0, 0)
+DEFINE_PRIMITIVE ("BIOS:ENTER!", Prim_bios_enter, 0, 0, 0)
 {
-  PRIMITIVE_HEADER(0);
-  bios_initialize_variables ();
-  bios_clear_screen();
-  bios__set_cursor_position(0,0,DISPLAY_ROWS);
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (0);
+  bios_initialize_variables  ();
+  bios_clear_screen ();
+  bios__set_cursor_position (0, 0, DISPLAY_ROWS);
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:EXIT!", Prim_bios_exit, 0, 0, 0)
+DEFINE_PRIMITIVE ("BIOS:EXIT!", Prim_bios_exit, 0, 0, 0)
 {
-  PRIMITIVE_HEADER(0);
-  bios__set_cursor_position(0,0,DISPLAY_ROWS);
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (0);
+  bios__set_cursor_position (0, 0, DISPLAY_ROWS);
+  PRIMITIVE_RETURN (SHARP_T);
 }
-
+\f
 /*
   flush!, modeline-event!, and discretionary-flush have no meaning
   for BIOS output, no corresponding primitives have been defined.
 */
 
-DEFINE_PRIMITIVE("BIOS:SCROLL-LINES-DOWN!", Prim_bios_scroll_lines_down, 5, 5, 0)
+DEFINE_PRIMITIVE ("BIOS:SCROLL-LINES-DOWN!", Prim_bios_scroll_lines_down,
+                 5, 5, 0)
   /* xl xu yl yu amount */
 {
-  PRIMITIVE_HEADER(5);
-  bios__scroll_down_rectangle(NORMAL_VIDEO,arg_integer(5),
-    arg_integer(1),arg_integer(3),arg_integer(2),arg_integer(4));
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (5);
+  bios__scroll_down_rectangle (NORMAL_VIDEO, (arg_integer (5)),
+                              (arg_integer (1)), (arg_integer (3)),
+                              (arg_integer (2)), (arg_integer (4)));
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:SCROLL-LINES-UP!", Prim_bios_scroll_lines_up, 5, 5, 0)
+DEFINE_PRIMITIVE ("BIOS:SCROLL-LINES-UP!", Prim_bios_scroll_lines_up, 5, 5, 0)
 {
-  PRIMITIVE_HEADER(5);
-  bios__scroll_up_rectangle(NORMAL_VIDEO,arg_integer(5),
-    arg_integer(1),arg_integer(3),arg_integer(2),arg_integer(4));
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (5);
+  bios__scroll_up_rectangle (NORMAL_VIDEO, (arg_integer (5)),
+                            (arg_integer (1)), (arg_integer (3)),
+                            (arg_integer (2)), (arg_integer (4)));
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
 /*
   console-wrap-update! has no meaning for BIOS output, no primitive defined.
 */
 
-DEFINE_PRIMITIVE("BIOS:WRITE-CHAR!", Prim_bios_write_char, 2, 2, 0)
+DEFINE_PRIMITIVE ("BIOS:WRITE-CHAR!", Prim_bios_write_char, 2, 2, 0)
   /* char highlight */
 {
-  PRIMITIVE_HEADER(2);
-  if (BOOLEAN_ARG(2))
-    {
-      int x,y;
-      bios_get_cursor_position(&x,&y);
-      bios__scroll_up_rectangle(REVERSE_VIDEO,1,x,y,x,y);
-      bios__teletype_output_char(arg_ascii_char(1),0,0);
-    }
+  PRIMITIVE_HEADER (2);
+  if (BOOLEAN_ARG (2))
+  {
+    int x, y;
+
+    bios_get_cursor_position (&x, &y);
+    bios__scroll_up_rectangle (REVERSE_VIDEO, 1, x, y, x, y);
+    bios__teletype_output_char ((arg_ascii_char (1)), 0, 0);
+  }
   else
-    bios__teletype_output_char(arg_ascii_char(1),0,0);
-  PRIMITIVE_RETURN(SHARP_T);
+    bios__teletype_output_char ((arg_ascii_char (1)), 0, 0);
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:WRITE-CURSOR!", Prim_bios_write_cursor, 2, 2, 0)
+DEFINE_PRIMITIVE ("BIOS:WRITE-CURSOR!", Prim_bios_write_cursor, 2, 2, 0)
 {
-  PRIMITIVE_HEADER(2);
-  bios__set_cursor_position(0,arg_integer(1),arg_integer(2));
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (2);
+  bios__set_cursor_position (0, (arg_integer (1)), (arg_integer (2)));
+  PRIMITIVE_RETURN (SHARP_T);
 }
-
-DEFINE_PRIMITIVE("BIOS:WRITE-SUBSTRING!", Prim_bios_write_substring, 4, 4, 0)
+\f
+DEFINE_PRIMITIVE ("BIOS:WRITE-SUBSTRING!", Prim_bios_write_substring, 4, 4, 0)
   /* string start end highlight */
 {
+  int x, y;
   long start, end;
-  PRIMITIVE_HEADER(4);
+  PRIMITIVE_HEADER (4);
 
-  start = arg_integer (2);
-  end = arg_integer (3);
+  start = (arg_integer (2));
+  end = (arg_integer (3));
   if (start > end)
-    PRIMITIVE_RETURN(SHARP_F);
+    PRIMITIVE_RETURN (SHARP_F);
 
-  {
-    int x, y;
+  bios_get_cursor_position (&x, &y);
+  bios_write_string_attributed (((STRING_ARG(1)) + start), (end - start),
+                               x, y,
+                               ((BOOLEAN_ARG (4))
+                                ? REVERSE_VIDEO
+                                : NORMAL_VIDEO));
 
-    bios_get_cursor_position (&x, &y);
-    bios_write_string_attributed (((STRING_ARG(1)) + start), (end - start),
-                                  x, y,
-                                  ((BOOLEAN_ARG(4))
-                                   ? REVERSE_VIDEO
-                                   : NORMAL_VIDEO));
-  }
-
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:SET-VIDEO-MODE!", Prim_bios_set_video_mode, 1, 1, 0)
+DEFINE_PRIMITIVE ("BIOS:SET-VIDEO-MODE!", Prim_bios_set_video_mode, 1, 1, 0)
 {
-  PRIMITIVE_HEADER(1);
-  bios__set_video_mode(arg_integer(1));
-  pc_gestalt_screen_x_size();
-  pc_gestalt_screen_y_size();
-  bios_initialize_variables();
-  bios_clear_screen();
-  bios__set_cursor_position(0,0,DISPLAY_ROWS);
-  PRIMITIVE_RETURN(SHARP_T);
+  extern void pc_gestalt_screen_x_size (void);
+  extern void pc_gestalt_screen_y_size (void);
+  PRIMITIVE_HEADER (1);
+
+  bios__set_video_mode (arg_integer(1));
+  pc_gestalt_screen_x_size ();
+  pc_gestalt_screen_y_size ();
+  bios_initialize_variables ();
+  bios_clear_screen ();
+  bios__set_cursor_position (0, 0, DISPLAY_ROWS);
+  PRIMITIVE_RETURN (SHARP_T);
 }
 
-DEFINE_PRIMITIVE("BIOS:SET-CURSOR-SIZE!",Prim_bios_set_cursor_size, 3, 3, 0)
+DEFINE_PRIMITIVE ("BIOS:SET-CURSOR-SIZE!", Prim_bios_set_cursor_size, 3, 3, 0)
 {
-  extern void pc_gestalt_x_size(void);
-  extern void pc_gestalt_y_size(void);
-
-  PRIMITIVE_HEADER(3);
-  bios__set_cursor_size(arg_integer(1),arg_integer(2),arg_integer(3));
-  PRIMITIVE_RETURN(SHARP_T);
+  PRIMITIVE_HEADER (3);
+  bios__set_cursor_size ((arg_integer (1)), (arg_integer (2)),
+                        (arg_integer (3)));
+  PRIMITIVE_RETURN (SHARP_T);
 }
index 7429946724b3095a3411b929f9815291ca75be58..02cbf94dddf71fa2e1696d76b43467988fea6257 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/dosio.c,v 1.1 1992/05/05 06:55:13 jinx Exp $
+$Id: dosio.c,v 1.2 1992/10/07 06:23:29 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -36,7 +36,7 @@ MIT in each case. */
 #include "dosio.h"
 #include "osterm.h"
 
-#ifdef __STDC__
+#ifndef fileno
 #define fileno(fp)     ((fp)->_file)
 #endif
 \f
@@ -52,6 +52,7 @@ DEFUN_VOID (DOS_channel_close_all)
   for (channel = 0; (channel < OS_channel_table_size); channel += 1)
     if (CHANNEL_OPEN_P (channel))
       OS_channel_close_noerror (channel);
+  return;
 }
 
 void
@@ -73,6 +74,7 @@ DEFUN_VOID (DOS_initialize_channels)
   }
   add_reload_cleanup (DOS_channel_close_all);
   OS_channels_registered = 0;
+  return;
 }
 
 void
@@ -81,6 +83,7 @@ DEFUN_VOID (DOS_reset_channels)
   DOS_free (channel_table);
   channel_table = 0;
   OS_channel_table_size = 0;
+  return;
 }
 
 Tchannel
@@ -88,13 +91,13 @@ DEFUN_VOID (channel_allocate)
 {
   Tchannel channel = 0;
   while (1)
-    {
-      if (channel == OS_channel_table_size)
-       error_out_of_channels ();
-      if (CHANNEL_CLOSED_P (channel))
-       return (channel);
-      channel += 1;
-    }
+  {
+    if (channel == OS_channel_table_size)
+      error_out_of_channels ();
+    if (CHANNEL_CLOSED_P (channel))
+      return (channel);
+    channel += 1;
+  }
 }
 \f
 int
@@ -107,31 +110,34 @@ void
 DEFUN (OS_channel_close, (channel), Tchannel channel)
 {
   if (! (CHANNEL_INTERNAL (channel)))
-    {
-      if (CHANNEL_REGISTERED (channel))
-       OS_channel_unregister (channel);
-      STD_VOID_SYSTEM_CALL
-       (syscall_close, (DOS_close (CHANNEL_DESCRIPTOR (channel))));
-      MARK_CHANNEL_CLOSED (channel);
-    }
+  {
+    if (CHANNEL_REGISTERED (channel))
+      OS_channel_unregister (channel);
+    STD_VOID_SYSTEM_CALL
+      (syscall_close, (DOS_close (CHANNEL_DESCRIPTOR (channel))));
+    MARK_CHANNEL_CLOSED (channel);
+  }
+  return;
 }
 
 void
 DEFUN (OS_channel_close_noerror, (channel), Tchannel channel)
 {
   if (! (CHANNEL_INTERNAL (channel)))
-    {
-      if (CHANNEL_REGISTERED (channel))
-       OS_channel_unregister (channel);
-      DOS_close (CHANNEL_DESCRIPTOR (channel));
-      MARK_CHANNEL_CLOSED (channel);
-    }
+  {
+    if (CHANNEL_REGISTERED (channel))
+      OS_channel_unregister (channel);
+    DOS_close (CHANNEL_DESCRIPTOR (channel));
+    MARK_CHANNEL_CLOSED (channel);
+  }
+  return;
 }
 
 static void
 DEFUN (channel_close_on_abort_1, (cp), PTR cp)
 {
   OS_channel_close (* ((Tchannel *) cp));
+  return;
 }
 
 void
@@ -140,6 +146,7 @@ DEFUN (OS_channel_close_on_abort, (channel), Tchannel channel)
   Tchannel * cp = (dstack_alloc (sizeof (Tchannel)));
   (*cp) = (channel);
   transaction_record_action (tat_abort, channel_close_on_abort_1, cp);
+  return;
 }
 
 enum channel_type
@@ -169,16 +176,32 @@ DEFUN (OS_terminal_drain_output, (channel), Tchannel channel)
   return;
 }
 
+extern int EXFUN (dos_read, (int, PTR, size_t, int, int));
+
+int
+DEFUN (dos_read, (fd, buffer, nbytes, buffered_p, blocking_p),
+       int fd AND PTR buffer AND size_t nbytes AND int buffered_p AND int blocking_p)
+{
+  if (nbytes == 0)
+    return (0);
+  else if (fd == (fileno (stdin)))
+    return (console_read (buffer, nbytes, buffered_p, blocking_p));
+  else
+    return (DOS_read (fd, buffer, nbytes));
+}
+
+int
 DEFUN (dos_channel_read, (channel, buffer, nbytes),
        Tchannel channel AND PTR buffer AND size_t nbytes)
 {
   if (nbytes == 0)
     return 0;
-  else if (CHANNEL_DESCRIPTOR (channel) == fileno(stdin))
-    return console_read(buffer, nbytes, 
-                       CHANNEL_BUFFERED(channel), CHANNEL_BLOCKING_P(channel));
+  else if ((CHANNEL_DESCRIPTOR (channel)) == (fileno (stdin)))
+    return (console_read (buffer, nbytes, 
+                         (CHANNEL_BUFFERED (channel)),
+                         (CHANNEL_BLOCKING_P (channel))));
   else
-    return DOS_read ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes);
+    return (DOS_read ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes));
 }
 
 long
@@ -187,7 +210,7 @@ DEFUN (OS_channel_read, (channel, buffer, nbytes),
 {
   while (1)
   {
-    long scr = dos_channel_read(channel, buffer, nbytes);    
+    long scr = (dos_channel_read (channel, buffer, nbytes));
     if (scr < 0)
     {
       if (errno == ERRNO_NONBLOCK)
@@ -206,16 +229,16 @@ static int
 DEFUN (dos_write, (fd, buffer, nbytes),
        int fd AND CONST unsigned char * buffer AND size_t nbytes)
 {
-  return ( (fd == fileno(stdout))
-          ? dos_console_write(buffer, nbytes)
-          : write(fd, buffer, nbytes) );
+  return ((fd == (fileno (stdout)))
+         ? (dos_console_write (buffer, nbytes))
+         : (DOS_write (fd, buffer, nbytes)));
 }
 
 #define Syscall_Write(fd, buffer, size, so_far)                \
 do                                                     \
 { size_t _size = (size);                               \
   int _written;                                                \
-  _written = dos_write((fd), (buffer), (_size));       \
+  _written = dos_write ((fd), (buffer), (_size));      \
   if (_size != _written)                               \
     return ((_written < 0) ? -1 : (so_far) + _written); \
 } while (0)
@@ -228,22 +251,21 @@ DEFUN (text_write, (fd, buffer, nbytes),
   CONST unsigned char *start;
   size_t i;
 
-  for (i=0, start=buffer; i < nbytes; start = &buffer[i])
+  for (i = 0, start = buffer; i < nbytes; start = &buffer[i])
   { size_t len;
 
-    while ((i < nbytes)&&(buffer[i] != LINEFEED)) i++;
+    while ((i < nbytes) && (buffer[i] != LINEFEED)) i++;
     len = (&buffer[i] - start);
 
-    Syscall_Write(fd, start, len, (i - len));
+    Syscall_Write (fd, start, len, (i - len));
 
-    if ((i < nbytes)&&(buffer[i] == LINEFEED))
+    if ((i < nbytes) && (buffer[i] == LINEFEED))
     { /* We are sitting on a linefeed. Write out CRLF */
       /* This backs out incorrectly if only CR is written out */
-      Syscall_Write(fd, crlf, sizeof(crlf), i);
+      Syscall_Write (fd, crlf, (sizeof (crlf)), i);
       i = i + 1; /* Skip over special character */
     }
   }
-
   return nbytes;
 }
 
@@ -253,15 +275,17 @@ long
 DEFUN (OS_channel_write, (channel, buffer, nbytes),
        Tchannel channel AND CONST PTR buffer AND size_t nbytes)
 {
-  if (nbytes == 0) return (0);
+  if (nbytes == 0)
+    return (0);
 
   while (1)
-  { int fd, scr;
+  {
+    int fd, scr;
 
     fd = CHANNEL_DESCRIPTOR(channel);
-    scr = ((CHANNEL_COOKED(channel))
-          ? text_write(fd, buffer, nbytes)
-          : dos_write(fd, buffer, nbytes));
+    scr = ((CHANNEL_COOKED (channel))
+          ? (text_write (fd, buffer, nbytes))
+          : (dos_write (fd, buffer, nbytes)));
              
     if (scr < 0)
     {
@@ -274,7 +298,6 @@ DEFUN (OS_channel_write, (channel, buffer, nbytes),
     return scr;
   }
 }
-
 \f
 size_t
 DEFUN (OS_channel_read_load_file, (channel, buffer, nbytes),
@@ -466,18 +489,19 @@ DEFUN (OS_channel_unregister, (channel), Tchannel channel)
     }
 }
 
-\f
+
 /* No SELECT in DOS */
 long
 DEFUN (OS_channel_select_then_read, (channel, buffer, nbytes),
        Tchannel channel AND
        PTR buffer AND
        size_t nbytes)
-{ /* We can't really select amonst channels in DOS, but still need
-     to keep track of whether the read was interrupted. */
+{ /* We can't really select amongst channels in DOS, but still need
+     to keep track of whether the read was interrupted.
+   */
   while (1)
   {
-    long scr = dos_channel_read(channel, buffer, nbytes);
+    long scr = (dos_channel_read (channel, buffer, nbytes));
 
     if (scr < 0)
     {
@@ -486,7 +510,8 @@ DEFUN (OS_channel_select_then_read, (channel, buffer, nbytes),
       else if (errno == EINTR)
        return -4;
       else
-      { DOS_prim_check_errno (syscall_read);
+      {
+       DOS_prim_check_errno (syscall_read);
        continue;
       }
     }
index 3e3eb56ee1d100822703a1afecf213747f0482e0..fb9d598aecf87d13437cb8dc4b4d04c3353e5f27 100644 (file)
@@ -1,5 +1,6 @@
 /* -*-C-*-
-$Id: doskbd.c,v 1.9 1992/09/06 16:24:03 jinx Exp $
+
+$Id: doskbd.c,v 1.10 1992/10/07 06:23:30 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -289,18 +290,18 @@ dos_boolean
 under_QEMM_386_p (void)
 {
   unsigned int i;
-  union REGS iregs, oregs;
+  union REGS regs;
 
-  iregs.h.al = 0x01;
-  iregs.x.bx = 0x5145;
-  iregs.x.cx = 0x4d4d;
-  iregs.x.dx = 0x3432;
+  regs.h.al = 0x01;
+  regs.x.bx = 0x5145;
+  regs.x.cx = 0x4d4d;
+  regs.x.dx = 0x3432;
 
   for (i = 0xc0; i <= 0xff; i++)
   {
-    iregs.h.ah = i;
-    int86 (0x2f, &iregs, &oregs);
-    if (oregs.x.bx == 0x4f4b)
+    regs.h.ah = i;
+    int86 (0x2f, &regs, &regs);
+    if (regs.x.bx == 0x4f4b)
       return (dos_true);
   }
   return (dos_false);
@@ -420,7 +421,7 @@ DPMI_PM_getvector (unsigned vecnum, unsigned * eip, unsigned * cs)
   
   regs.x.ax = 0x204;
   regs.h.bl = (vecnum & 0xff);
-  int86 (0x31, &regs, &regs);
+  intDPMI (&regs, &regs);
   * eip = regs.e.edx;
   * cs = ((unsigned) regs.x.cx);
   return;
@@ -435,7 +436,7 @@ DPMI_PM_setvector (unsigned vecnum, unsigned eip, unsigned cs)
   regs.h.bl = (vecnum & 0xff);
   regs.e.edx = eip;
   regs.x.cx = ((unsigned short) cs);
-  int86 (0x31, &regs, &regs);
+  intDPMI (&regs, &regs);
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
 }
 
@@ -446,7 +447,7 @@ DPMI_RM_getvector (unsigned vecnum, unsigned short * ip, unsigned short * cs)
   
   regs.x.ax = 0x200;
   regs.h.bl = (vecnum & 0xff);
-  int86 (0x31, &regs, &regs);
+  intDPMI (&regs, &regs);
   * ip = regs.x.dx;
   * cs = regs.x.cx;
   return;
@@ -461,7 +462,7 @@ DPMI_RM_setvector (unsigned vecnum, unsigned short ip, unsigned short cs)
   regs.h.bl = (vecnum & 0xff);
   regs.x.cx = cs;
   regs.x.dx = ip;
-  int86 (0x31, &regs, &regs);
+  intDPMI (&regs, &regs);
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
 }
 \f
@@ -507,7 +508,7 @@ DPMI_allocate_RM_call_back (unsigned short * cb_ip,
   regs.e.edi = RM_regs;
   sregs.es = ds;
 
-  int86x (0x31, &regs, &regs, &sregs);
+  intDPMIx (&regs, &regs, &sregs);
   * cb_ip = regs.x.dx;
   * cb_cs = regs.x.cx;
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
@@ -521,7 +522,7 @@ DPMI_free_RM_call_back (unsigned short cb_ip, unsigned short cb_cs)
   regs.x.ax = 0x304;
   regs.x.cx = cb_cs;
   regs.x.dx = cb_ip;
-  int86 (0x31, &regs, &regs);
+  intDPMI (&regs, &regs);
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
 }
 
@@ -538,7 +539,7 @@ DPMI_allocate_DOS_block (unsigned short size,
   
   regs.x.ax = 0x100;
   regs.x.bx = ((((unsigned) size) + 15) >> 4); /* paragraphs */
-  int86 (0x31, & regs, & regs);
+  intDPMI (&regs, &regs);
   * rm_seg = regs.x.ax;
   * pm_sel = regs.x.dx;
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
@@ -551,7 +552,7 @@ DPMI_free_DOS_block (unsigned short selector)
   
   regs.x.ax = 0x101;
   regs.x.dx = selector;
-  int86 (0x31, & regs, & regs);
+  intDPMI (&regs, &regs);
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
 }
 
@@ -568,7 +569,7 @@ DOSX_allocate_DOS_block (unsigned short size,
   
   regs.x.ax = 0x25c0;
   regs.x.bx = ((((unsigned) size) + 15) >> 4); /* paragraphs */
-  int86 (0x21, & regs, & regs);
+  intdos (&regs, &regs);
   if ((regs.e.flags & 1) == 0)
   {
     * rm_seg = regs.x.ax;
@@ -584,7 +585,7 @@ DOSX_allocate_DOS_block (unsigned short size,
 
   regs.h.ah = 0x48;
   regs.x.bx = ((((unsigned) size) + 15) >> 4); /* paragraphs */
-  int86 (0x21, & regs, & regs);
+  intdos (&regs, &regs);
   * rm_seg = regs.x.ax;
   if ((regs.e.flags & 1) != 0)
   {
@@ -604,7 +605,7 @@ DOSX_free_DOS_block (unsigned short seg)
   
   regs.x.ax = 0x25c1;
   regs.x.cx = seg;
-  int86 (0x21, & regs, & regs);
+  intdos (&regs, &regs);
 
 #else /* not 0 */
 
@@ -613,7 +614,7 @@ DOSX_free_DOS_block (unsigned short seg)
   regs.h.ah = 0x49;
   segread (&sregs);
   sregs.es = seg;
-  int86x (0x21, & regs, & regs, & sregs);
+  intdosx (&regs, &regs, &sregs);
 
 #endif /* 0 */
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
@@ -632,7 +633,7 @@ DOSX_PM_getvector (unsigned vecnum, unsigned * eip, unsigned * cs)
   regs.x.ax = 0x2502;
   regs.h.cl = (vecnum & 0xff);
   segread (&sregs);
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   * eip = regs.e.ebx;
   * cs = ((unsigned) sregs.es);
   return;
@@ -649,7 +650,7 @@ DOSX_installvector (unsigned vecnum, unsigned eip, unsigned cs)
   regs.e.edx = eip;
   segread (&sregs);
   sregs.ds = cs;
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   return;
 }
 
@@ -666,7 +667,7 @@ DOSX_restore_vector (unsigned vecnum, unsigned eip,
   regs.e.ebx = rmode;
   regs.x.ax = 0x2507;
   regs.h.cl = (vecnum & 0xff);
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   return;
 }
 
@@ -681,7 +682,7 @@ DOSX_RM_getvector (unsigned vecnum, unsigned * vector)
 
   regs.x.ax = 0x2503;
   regs.h.cl = (vecnum & 0xff);
-  int86 (0x21, &regs, &regs);
+  intdos (&regs, &regs);
   * vector = regs.e.ebx;
   return;
 }
@@ -698,7 +699,7 @@ DOSX_RM_setvector (unsigned vecnum, unsigned rm_address)
   regs.x.ax = 0x2505;
   regs.h.cl = (vecnum & 0xff);
   regs.e.ebx = rm_address;
-  int86 (0x31, &regs, &regs);
+  intdos (&regs, &regs);
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
 }
 
@@ -714,8 +715,8 @@ DOSX_convert_PM_to_RM_address (unsigned short sel, unsigned offset,
   sregs.es = sel;
   regs.e.ebx = offset;
   regs.e.ecx = length;
-  regs.e.eax = 0x250F;
-  int86x (0x21, &regs, &regs, &sregs);
+  regs.e.eax = 0x250f;
+  intdosx (&regs, &regs, &sregs);
   * rm_address = regs.e.ecx;
   return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
 }
@@ -882,7 +883,7 @@ make_RM_handler (unsigned * size, unsigned * offset, unsigned * delta)
   union REGS regs;
 
   regs.x.ax = 0x2509;
-  int86 (0x21, &regs, &regs);
+  intdos (&regs, &regs);
   start_offset = ((unsigned long) RM_keyboard_pattern_start);
   pattern_start = ((((unsigned long) regs.x.bx) << 4) + start_offset);
 
index e904519c5f14d11ce0aed3f7470cb5d5bf4a9ba0..b33434b05132ef89a06532d91b3007174c580a91 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: dossig.c,v 1.11 1992/09/30 14:31:42 jinx Exp $
+$Id: dossig.c,v 1.12 1992/10/07 06:23:32 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -32,8 +32,8 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-#include "msdos.h"
 #include "scheme.h"
+#include "msdos.h"
 #include <signal.h>
 #include <int.h>
 #include "ossig.h"
@@ -48,10 +48,16 @@ MIT in each case. */
 #include <cerror.h>
 #endif
 
+#ifndef fileno
+#define fileno(fp)     ((fp)->_file)
+#endif
+
 cc_t EXFUN (DOS_interactive_interrupt_handler, (void));
 \f
 /* Signal Manipulation */
 
+#ifdef UNUSED
+
 static Tsignal_handler
 DEFUN (current_handler, (signo), int signo)
 {
@@ -68,6 +74,8 @@ DEFUN (current_handler, (signo), int signo)
 #define ABORT_HANDLER DOS_signal
 #define EXIT_HANDLER DOS_signal
 
+#endif /* UNUSED */
+
 /* These could be implemented, at least under DPMI by examining
    and setting the virtual interrupt state.
  */
@@ -75,18 +83,22 @@ DEFUN (current_handler, (signo), int signo)
 void
 DEFUN_VOID (preserve_signal_mask)
 {
+  return;
 }
 
 void
 DEFUN_VOID (block_signals)
 {
+  return;
 }
 
 void
 DEFUN_VOID (unblock_signals)
 {
+  return;
 }
 \f
+#ifdef UNUSED
 /* Signal Descriptors */
 
 enum dfl_action { dfl_terminate, dfl_ignore, dfl_stop };
@@ -236,6 +248,7 @@ DEFUN (ta_abort_handler, (ap), PTR ap)
   ABORT_HANDLER ((((struct handler_record *) ap) -> signo),
                 (((struct handler_record *) ap) -> handler));
 }
+#endif /* UNUSED */
 \f
 #define CONTROL_B_INTERRUPT_CHAR       'B'
 #define CONTROL_G_INTERRUPT_CHAR       'G'
@@ -245,6 +258,7 @@ DEFUN (ta_abort_handler, (ap), PTR ap)
 #define TERMINATE_INTERRUPT_CHAR       '@'
 #define NO_INTERRUPT_CHAR              '0'
 
+#ifdef UNUSED
 static void
 DEFUN (echo_keyboard_interrupt, (c, dc), cc_t c AND cc_t dc)
 {
@@ -277,7 +291,10 @@ DEFUN_STD_HANDLER (sighnd_control_c,
       tty_set_next_interrupt_char (int_char);
   })
 
+#endif /* UNUSED */
+
 /* Keyboard interrupt */
+
 #define KB_INT_TABLE_SIZE              ((256) + 1)
 
 #define CONTROL_BREAK                  '\0'            /* A lie. */
@@ -366,7 +383,7 @@ DEFUN_VOID (update_interrupt_characters)
   }
   return;
 }
-
+\f
 unsigned int
 DEFUN_VOID (OS_ctty_num_int_chars)
 {
@@ -407,6 +424,33 @@ DEFUN (OS_ctty_set_int_char_handlers, (new_int_handlers),
   update_interrupt_characters ();
   return;
 }
+
+extern long EXFUN (text_write, (int, CONST unsigned char *, size_t));
+
+static void
+DEFUN (console_write_string, (string), unsigned char * string)
+{
+  (void) text_write ((fileno (stdout)), string, (strlen (string)));
+  return;
+}
+
+static void
+DEFUN (console_write_character, (c), unsigned char c)
+{
+  (void) text_write ((fileno (stdout)), &c, 1);
+  return;
+}
+
+static unsigned char
+DEFUN_VOID (console_read_character)
+{
+  unsigned char c;
+  extern int EXFUN (dos_read, (int, PTR, size_t, int, int));
+
+  /* non-buffered, non-blocking read. */
+  (void) dos_read ((fileno (stdin)), &c, 1, 0, 0);
+  return (c);
+}
 \f
 void
 DEFUN_VOID (initialize_keyboard_interrupt_table)
@@ -558,8 +602,8 @@ DEFUN_VOID (DOS_interactive_interrupt_handler)
     console_write_string
       ("\nKeyboard interrupt, type character (? for help): ");
     
-    response = (dos_get_keyboard_character ());
-    dos_console_write_character (response);
+    response = (console_read_character ());
+    console_write_character (response);
     
     switch (response)
     {
@@ -589,8 +633,8 @@ DEFUN_VOID (DOS_interactive_interrupt_handler)
       case 'Q':
       {
        console_write_string ("\nTerminate scheme (y or n)? ");
-       response = (dos_get_keyboard_character ());
-       dos_console_write_character (response);
+       response = (console_read_character ());
+       console_write_character (response);
        if ((response == 'y') || (response == 'Y'))
        {
          console_write_string ("\n");
@@ -616,9 +660,9 @@ DEFUN_VOID (DOS_interactive_interrupt_handler)
 
       default:
       {
-       char temp[128];
+       unsigned char temp[128];
 
-       sprintf(temp, "\nIllegal interrupt character: [%c]", response);
+       sprintf (temp, "\nIllegal interrupt character: [%c]", response);
        console_write_string (temp);
        print_interrupt_help ();
        break;
@@ -628,23 +672,17 @@ DEFUN_VOID (DOS_interactive_interrupt_handler)
 }
 \f  
 void
-DEFUN (stop_signal_default, (signo), int signo)
+DEFUN_VOID (OS_restartable_exit)
 {
   return;
 }
 
-void EXFUN ((*stop_signal_hook), (int signo));
+#ifdef UNUSED
 
 #define IF_POSIX_SIGNALS(code) do {} while (0)
 
 DEFUN_STD_HANDLER (sighnd_stop, {})
 
-void
-DEFUN_VOID (OS_restartable_exit)
-{
-  stop_signal_default (SIGTSTP);
-}
-
 #ifdef HAVE_ITIMER
 
 DEFUN_STD_HANDLER (sighnd_timer,
@@ -710,14 +748,10 @@ DEFUN_STD_HANDLER (sighnd_software_trap,
    case we just hope that child terminations don't happen too close to
    one another to cause problems. */
 
-void EXFUN ((*subprocess_death_hook), (pid_t pid, wait_status_t * status));
-
-#define WAITPID(status) (DOS_wait (status))
-#define BREAK break
-
 DEFUN_STD_HANDLER (sighnd_dead_subprocess,
   {
   })
+#endif /* UNUSED */
 \f
 /* PC specific low-level interrupt hooks. */
 /* Control-Break Interrupt. */
@@ -1218,6 +1252,8 @@ DEFUN_VOID (DOS_restore_interrupts)
 \f
 /* Signal Bindings */
 
+#ifdef UNUSED
+
 static void
 DEFUN (bind_handler, (signo, handler),
        int signo AND
@@ -1227,13 +1263,15 @@ DEFUN (bind_handler, (signo, handler),
       && ((handler != ((Tsignal_handler) sighnd_stop)))
       && ((current_handler (signo)) == SIG_DFL))
     INSTALL_HANDLER (signo, handler);
+  return;
 }
 
+#endif /* UNUSED */
+
 void
 DEFUN_VOID (DOS_initialize_signals)
 {
-  stop_signal_hook = 0;
-  subprocess_death_hook = 0;
+#ifdef UNUSED
   initialize_signal_descriptors ();
   bind_handler (SIGINT,                sighnd_control_c);
   bind_handler (SIGTERM,       sighnd_control_g);
@@ -1262,6 +1300,9 @@ DEFUN_VOID (DOS_initialize_signals)
        scan += 1;
       }
   }
-  DOS_initialize_interrupts();
-  DOS_install_interrupts();
+#else /* UNUSED */
+  DOS_initialize_interrupts ();
+  DOS_install_interrupts ();
+#endif /* UNUSED */
+  return;
 }
index e3c6e61528ced8d8b377bb66cb213360115b9959..7f43fa7315f79cffe66b662d455a362bc69cbaa0 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: dossys.c,v 1.3 1992/09/17 13:31:53 jinx Exp $
+$Id: dossys.c,v 1.4 1992/10/07 06:23:33 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -34,59 +34,63 @@ MIT in each case. */
 
 #include <dos.h>
 #include <stdio.h>
+#include "msdos.h"
 #include "dossys.h"
 \f
+#ifdef UNUSED
 int 
 dos_keyboard_input_available_p (void)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   
-  inregs.h.ah = 0x0B;
-  intdos (&inregs, &outregs);
-  return (outregs.h.al != 0);
+  regs.h.ah = 0x0B;
+  intdos (&regs, &regs);
+  return (regs.h.al != 0);
 }
 
 unsigned char 
 dos_get_keyboard_character (void)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   
-  inregs.h.ah = 0x07;
-  intdos (&inregs, &outregs);
-  return ((unsigned char) (outregs.h.al));
+  regs.h.ah = 0x07;
+  intdos (&regs, &regs);
+  return ((unsigned char) (regs.h.al));
 }
+#endif /* UNUSED */
 
 int 
 dos_poll_keyboard_character (unsigned char * result)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   
-  inregs.h.ah = 0x06;
-  inregs.h.dl = 0xFF;
-  intdos (&inregs, &outregs);
-  *result = ((unsigned char) (outregs.h.al));
-  return ((outregs.x.flags & 0x40) == 0);
+  regs.h.ah = 0x06;
+  regs.h.dl = 0xFF;
+  intdos (&regs, &regs);
+  *result = ((unsigned char) (regs.h.al));
+  return ((regs.x.flags & 0x40) == 0);
 }
 
-void 
+void
 dos_console_write_character (unsigned char character)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   
-  inregs.h.ah = 0x06;
-  inregs.h.dl = character;
-  intdos (&inregs, &outregs);
+  regs.h.ah = 0x06;
+  regs.h.dl = character;
+  intdos (&regs, &regs);
   return;
 }
 
 int 
 dos_console_write (void * vbuffer, size_t nsize)
 {
-  union REGS inregs, outregs;
   unsigned char * buffer = vbuffer;
+  union REGS inregs, outregs;
   int i;  
   
-  for (inregs.h.ah = 0x06, i=0; i < nsize; i++)
+  inregs.h.ah = 0x06;
+  for (i = 0; i < nsize; i++)
   {
     inregs.h.dl = buffer[i];
     intdos (&inregs, &outregs);
@@ -96,233 +100,243 @@ dos_console_write (void * vbuffer, size_t nsize)
 \f
 /* DOS I/O functions using handles */
 
+#ifdef UNUSED
 handle_t 
 dos_open_file_with_handle (unsigned char * name, int mode)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   struct SREGS segregs;
   
-  inregs.e.edx = ((unsigned long) name);
+  regs.e.edx = ((unsigned long) name);
   segread (&segregs);
-  inregs.h.ah = 0x3D;
-  inregs.h.al = mode;
-  intdosx (&inregs, &outregs, &segregs);
-  return ((outregs.x.cflag) ? DOS_FAILURE : ((unsigned int) outregs.x.ax));
+  regs.h.ah = 0x3D;
+  regs.h.al = mode;
+  intdosx (&regs, &regs, &segregs);
+  return ((regs.x.cflag) ? DOS_FAILURE : ((unsigned int) regs.x.ax));
 }
 
 int 
 dos_close_file_with_handle (handle_t handle)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   
-  inregs.x.bx = handle;
-  inregs.h.al = 0x3E;
-  intdos (&inregs, &outregs);
-  return ((outregs.x.cflag) ? DOS_FAILURE : DOS_SUCCESS);
+  regs.x.bx = handle;
+  regs.h.al = 0x3E;
+  intdos (&regs, &regs);
+  return ((regs.x.cflag) ? DOS_FAILURE : DOS_SUCCESS);
 }
 
 int 
 dos_read_file_with_handle (handle_t handle, void * buffer, size_t nbytes)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   struct SREGS segregs;
   
-  inregs.x.bx = handle;  
-  inregs.e.edx = ((unsigned long) buffer);
-  inregs.e.ecx = nbytes;
+  regs.x.bx = handle;  
+  regs.e.edx = ((unsigned long) buffer);
+  regs.e.ecx = nbytes;
   segread (&segregs);
-  inregs.h.ah = 0x3F;
-  intdosx (&inregs, &outregs, &segregs);
-  return ((outregs.x.cflag) ? DOS_FAILURE : outregs.e.eax);
+  regs.h.ah = 0x3F;
+  intdosx (&regs, &regs, &segregs);
+  return ((regs.x.cflag) ? DOS_FAILURE : regs.e.eax);
 }
 
 int 
 dos_write_file_with_handle (handle_t handle, void * buffer, size_t nbytes)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   struct SREGS segregs;
   
-  inregs.x.bx = handle;
-  inregs.e.edx = (unsigned long) buffer;
-  inregs.e.ecx = nbytes;
+  regs.x.bx = handle;
+  regs.e.edx = (unsigned long) buffer;
+  regs.e.ecx = nbytes;
   segread (&segregs);
-  inregs.h.ah = 0x40;
-  intdosx (&inregs, &outregs, &segregs);
-  return ((outregs.x.cflag) ? DOS_FAILURE : outregs.e.eax);
+  regs.h.ah = 0x40;
+  intdosx (&regs, &regs, &segregs);
+  return ((regs.x.cflag) ? DOS_FAILURE : regs.e.eax);
 }
   
 int 
 dos_get_device_status_with_handle (handle_t handle)
 { 
-  union REGS inregs, outregs;
+  union REGS regs;
   
-  inregs.x.bx = handle;
-  inregs.x.ax = 0x4400;
-  intdos (&inregs, &outregs);
-  return ((outregs.x.cflag) ? DOS_FAILURE : ((unsigned int) outregs.x.dx));
+  regs.x.bx = handle;
+  regs.x.ax = 0x4400;
+  intdos (&regs, &regs);
+  return ((regs.x.cflag) ? DOS_FAILURE : ((unsigned int) regs.x.dx));
 }
   
 int 
 dos_set_device_status_with_handle (handle_t handle, int mode)
 { 
   int original_mode;
-  union REGS inregs, outregs;
+  union REGS regs;
   
   original_mode = dos_get_device_status_with_handle(handle);
   if (original_mode == DOS_FAILURE)
     return (DOS_FAILURE);
-  inregs.x.dx = mode;
-  inregs.x.bx = handle;
-  inregs.x.ax = 0x4401;
-  intdos (&inregs, &outregs);
-  return ((outregs.x.cflag) ? DOS_FAILURE : original_mode);
+  regs.x.dx = mode;
+  regs.x.bx = handle;
+  regs.x.ax = 0x4401;
+  intdos (&regs, &regs);
+  return ((regs.x.cflag) ? DOS_FAILURE : original_mode);
 }  
+#endif /* UNUSED */
 \f
 void 
 dos_get_version (version_t *version_number)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
 
   /* Use old style version number because we may be running below DOS 5.0 */
-  inregs.h.al = 0x01;
-  inregs.h.ah = 0x30;
-  intdos (&inregs, &outregs);
-  version_number -> major = outregs.h.al;
-  version_number -> minor = outregs.h.ah;
+  regs.h.al = 0x01;
+  regs.h.ah = 0x30;
+  intdos (&regs, &regs);
+  version_number -> major = regs.h.al;
+  version_number -> minor = regs.h.ah;
   if ((version_number -> major) >= 5)
   { /* Get the real version. */
-    inregs.x.ax = 0x3306;
-    intdos (&inregs, &outregs);
-    version_number -> major = outregs.h.bl;
-    version_number -> minor = outregs.h.bh;
+    regs.x.ax = 0x3306;
+    intdos (&regs, &regs);
+    version_number -> major = regs.h.bl;
+    version_number -> minor = regs.h.bh;
   }
   return;
 }
 
+#ifdef UNUSED
 void 
 dos_reset_drive (void)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   
-  inregs.h.al = 0x0d;
-  intdos (&inregs, &outregs);
+  regs.h.al = 0x0d;
+  intdos (&regs, &regs);
   return;
 }
 
 int 
 dos_set_verify_flag (int verify_p)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   int old_flag;
   
-  inregs.h.ah = 0x54;
-  intdos(&inregs, &outregs);
-  old_flag = outregs.h.al;
-  inregs.h.al = (verify_p) ? 1 : 0;
-  inregs.h.ah = 0x2E;
-  intdos(&inregs, &outregs);
+  regs.h.ah = 0x54;
+  intdos (&regs, &regs);
+  old_flag = regs.h.al;
+  regs.h.al = ((verify_p) ? 1 : 0);
+  regs.h.ah = 0x2E;
+  intdos (&regs, &regs);
   return (old_flag);
 }
+#endif /* UNUSED */
 
 int 
 dos_set_ctrl_c_check_flag (int check_p)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   int old_flag;
   
-  inregs.x.ax = 0x3300;
-  intdos(&inregs, &outregs);
-  old_flag = outregs.h.dl;
-  inregs.h.dl = (check_p) ? 1 : 0;
-  inregs.x.ax = 0x3301;
-  intdos(&inregs, &outregs);
+  regs.x.ax = 0x3300;
+  intdos (&regs, &regs);
+  old_flag = regs.h.dl;
+  regs.h.dl = ((check_p) ? 1 : 0);
+  regs.x.ax = 0x3301;
+  intdos (&regs, &regs);
   return (old_flag);
 }
 
 int 
 dos_rename_file (const char * old, const char * new)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   struct SREGS segregs;
   
-  inregs.e.edx = (unsigned long) old;
-  inregs.e.edi = (unsigned long) new;
-  segread(&segregs);
+  regs.e.edx = ((unsigned long) old);
+  regs.e.edi = ((unsigned long) new);
+  segread (&segregs);
   segregs.es = segregs.ds;
-  inregs.h.ah = 0x56;
-  intdosx(&inregs, &outregs, &segregs);
-  if (outregs.x.cflag)
+  regs.h.ah = 0x56;
+  intdosx (&regs, &regs, &segregs);
+  if (regs.x.cflag)
     return (DOS_FAILURE);
   else
     return (DOS_SUCCESS);
 }
 
+#ifdef UNUSED
 int 
 dos_get_machine_name (char * name)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   struct SREGS segregs;
   
-  inregs.e.edx = ((unsigned long) name);
-  segregs.ds = getDS();
-  inregs.x.ax = 0x5E00;
-  intdosx(&inregs, &outregs, &segregs);
-  if ((outregs.x.cflag) || (outregs.h.ch == 0))
+  regs.e.edx = ((unsigned long) name);
+  segread (&segregs);
+  regs.x.ax = 0x5E00;
+  intdosx (&regs, &regs, &segregs);
+  if ((regs.x.cflag) || (regs.h.ch == 0))
     return (DOS_FAILURE);
   else
-    return (outregs.h.cl);
+    return (regs.h.cl);
 }
+#endif /* UNUSED */
 
 int 
 dos_drive_letter_to_number (char letter)
 {
   if (letter == '\0')
     return 0;
-  else if ((letter >= 'a')&&(letter <= 'z'))
+  else if ((letter >= 'a') && (letter <= 'z'))
     return ((letter - 'a') + 1);
-  else if ((letter >= 'A')&&(letter <= 'Z'))
+  else if ((letter >= 'A') && (letter <= 'Z'))
     return ((letter - 'A') + 1);
   else
     return (-1);
 }
 
+#ifdef UNUSED
 char 
 dos_drive_number_to_letter (int number)
 {
-  if ((number >= 1)&&(number <= 26))
+  if ((number >= 1) && (number <= 26))
     return ('A' + (number - 1));
   else
     return ('\0');
 }
+#endif /* UNUSED */
 
 int 
 dos_set_default_drive (int drive_number)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   
   if (drive_number > 0)
   {    
-    inregs.h.dl = drive_number - 1;
-    inregs.h.ah = 0x0E;
-    intdos(&inregs, &outregs);
+    regs.h.dl = (drive_number - 1);
+    regs.h.ah = 0x0E;
+    intdos (&regs, &regs);
   }
   return (DOS_SUCCESS);
 }
     
+#ifdef UNUSED
 int
 dos_get_default_drive (int drive_number)
 {
-  union REGS inregs, outregs;
+  union REGS regs;
   
-  inregs.h.ah = 0x19;
-  intdos (&inregs, &outregs);
-  return (outregs.h.al + 1);
+  regs.h.ah = 0x19;
+  intdos (&regs, &regs);
+  return ((regs.h.al) + 1);
 }
+#endif /* UNUSED */
 \f
 dos_boolean 
 dos_pathname_as_filename (char * name, char * buffer)
 { /* Returns whether directory encountered is top level */
-  unsigned int end_index = strlen(name) - 1;
+  unsigned int end_index = ((strlen (name)) - 1);
 
   /* The runtime system comes down with a name that has a back slash
      at the end.  This will choke DOS.
@@ -415,7 +429,7 @@ DOS_canonicalize_filename (char * aliased, char * direct)
   regs.e.edx = ((unsigned) &intrpt);
   /* Int 21h, ax = 2511h: Issue real mode interrupt. */
   regs.x.ax = 0x2511;
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   if (regs.e.cflag != 0)
     return (-1);
   strncpy (direct, pRealModeBuffer, RETURN_BUFFER_SIZE);
@@ -429,16 +443,15 @@ char *pRealModeBuffer = NULL;
 void
 DOS_initialize_real_mode (void)
 {
-  union REGS rIn;
-  union REGS rOut;
+  union REGS regs;
 
-  rIn.h.ah = 0x48;
-  rIn.x.bx = 256;
-  int86 (0x21, &rIn, &rOut);
-  if (rOut.e.cflag == 0)
+  regs.h.ah = 0x48;
+  regs.x.bx = 256;
+  intdos (&regs, &regs);
+  if (regs.e.cflag == 0)
   {
-    pRealModeBuffer = ((char *) rOut.e.ebx);
-    RealModeBufferParagraph = rOut.x.ax;
+    pRealModeBuffer = ((char *) regs.e.ebx);
+    RealModeBufferParagraph = regs.x.ax;
   }
   return;
 }
index 8a29beae6e7309b3c3dd2fc99c34cf49e6aab468..426abf5ed9ff8c5302d02d26ed80b32f5086857f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/dossys.h,v 1.1 1992/05/05 06:55:13 jinx Exp $
+$Id: dossys.h,v 1.2 1992/10/07 06:23:34 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -50,35 +50,45 @@ typedef struct version_struct
 typedef int handle_t;
 
 /* Console Character I/O */
-extern int dos_keyboard_input_available_p(void);
-extern unsigned char dos_get_keyboard_character(void);
-extern int dos_poll_keyboard_character(unsigned char *result);
-extern void dos_console_write_character(unsigned char character);
-extern int dos_console_write(void * vbuffer, size_t nsize);
+#ifdef UNUSED
+extern int dos_keyboard_input_available_p (void);
+extern unsigned char dos_get_keyboard_character (void);
+#endif /* UNUSED */
+extern int dos_poll_keyboard_character (unsigned char *result);
+extern void dos_console_write_character (unsigned char character);
+extern int dos_console_write (void * vbuffer, size_t nsize);
 
 /* Handle I/O */
-extern handle_t dos_open_file_with_handle(unsigned char * name, int mode);
-extern int dos_close_file_with_handle(handle_t handle);
+#ifdef UNUSED
+extern handle_t dos_open_file_with_handle (unsigned char * name, int mode);
+extern int dos_close_file_with_handle (handle_t handle);
 extern int dos_read_file_with_handle
            (handle_t handle, void * buffer, size_t nbytes);
 extern int dos_write_file_with_handle
            (handle_t handle, void * buffer, size_t nbytes);
-extern int dos_get_device_status_with_handle(handle_t handle);
-extern int dos_set_device_status_with_handle(handle_t handle, int mode);
+extern int dos_get_device_status_with_handle (handle_t handle);
+extern int dos_set_device_status_with_handle (handle_t handle, int mode);
+#endif /* UNUSED */
 
 /* Misc */
-extern void dos_get_version(version_t * version_number);
-extern void dos_reset_drive(void);
-extern int dos_set_verify_flag(int verify_p);
-extern int dos_set_ctrl_c_check_flag(int check_p);
-extern int dos_rename_file(const char *old, const char *new);
-extern int dos_get_machine_name(char *name);
-extern int dos_drive_letter_to_number(char letter);
-extern char dos_drive_number_to_letter(int number);
-extern int dos_get_default_drive(int drive_number);
-extern int dos_set_default_drive(int drive_number);
-extern int dos_pathname_as_filename(char * name, char * buffer);
-extern int dos_split_filename(char * name, char * device, char * filename);
+extern void dos_get_version (version_t * version_number);
+#ifdef UNUSED
+extern void dos_reset_drive (void);
+extern int dos_set_verify_flag (int verify_p);
+#endif /* UNUSED */
+extern int dos_set_ctrl_c_check_flag (int check_p);
+extern int dos_rename_file (const char *old, const char *new);
+#ifdef UNUSED
+extern int dos_get_machine_name (char *name);
+#endif /* UNUSED */
+extern int dos_drive_letter_to_number (char letter);
+#ifdef UNUSED
+extern char dos_drive_number_to_letter (int number);
+extern int dos_get_default_drive (int drive_number);
+#endif /* UNUSED */
+extern int dos_set_default_drive (int drive_number);
+extern int dos_pathname_as_filename (char * name, char * buffer);
+extern int dos_split_filename (char * name, char * device, char * filename);
 
 /* Keyboard control */
 
@@ -86,7 +96,7 @@ extern dos_boolean DOS_keyboard_intercepted_p;
 extern int dos_restore_kbd_hook (void);
 extern int dos_install_kbd_hook (void);
 extern unsigned char dos_set_kbd_modifier_mask (unsigned char);
-
+\f
 /* DOS Interrupt Vectors */
 #define DOS_INTVECT_DIVIDE_BY_0                (0x00)
 #define DOS_INTVECT_SINGLE_STEP                (0x01)
index a7b75344b7b0adb19e5a8779bde42cc09693b1ac..6146686f4077defa6587f619543f4d00af43fe43 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/dostty.c,v 1.2 1992/07/28 18:19:19 jinx Exp $
+$Id: dostty.c,v 1.3 1992/10/07 06:23:35 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -96,51 +96,53 @@ DEFUN_VOID (OS_tty_command_clear)
 #define DEFAULT_TTY_Y_SIZE 25
 #endif
 
-int 
+void
 pc_gestalt_screen_x_size (void)
 {
-  charpsTemp;
-
-  psTemp = getenv("MITSCHEME_COLUMNS");
-  if (NULL == psTemp)
-    {
-      union REGS rIn;
-      union REGS rOut;
-      rIn.h.ah = 0x0F;
-      rIn.h.al = 0x00;
-      int86(0x10,&rIn,&rOut);
-      tty_x_size = rOut.h.ah;
-    }
+  char *psTemp;
+
+  psTemp = (getenv ("MITSCHEME_COLUMNS"));
+  if (psTemp == NULL)
+  {
+    union REGS regs;
+
+    regs.h.ah = 0x0F;
+    regs.h.al = 0x00;
+    int10h (&regs, &regs);
+    tty_x_size = regs.h.ah;
+  }
   else
-    {
-      tty_x_size = atoi(psTemp);
-      if (0 == tty_x_size)
-        tty_x_size = DEFAULT_TTY_X_SIZE; /* atoi failed, use default */
-    }
+  {
+    tty_x_size = (atoi (psTemp));
+    if (tty_x_size == 0)
+      tty_x_size = DEFAULT_TTY_X_SIZE; /* atoi failed, use default */
+  }
+  return;
 }
 
-int 
+void
 pc_gestalt_screen_y_size (void)
 {
-  charpsTemp;
-
-  psTemp = getenv("MITSCHEME_LINES");
-  if (NULL == psTemp)
-    {
-      union REGS rIn;
-      union REGS rOut;
-      rIn.x.ax = 0x1130;
-      rIn.h.bh = 0x00;
-      rIn.h.dl = DEFAULT_TTY_Y_SIZE-1;
-      int86(0x10,&rIn,&rOut);
-      tty_y_size = rOut.h.dl + 1;
-    }
+  char *psTemp;
+
+  psTemp = (getenv ("MITSCHEME_LINES"));
+  if (psTemp == NULL)
+  {
+    union REGS regs;
+
+    regs.x.ax = 0x1130;
+    regs.h.bh = 0x00;
+    regs.h.dl = DEFAULT_TTY_Y_SIZE-1;
+    int10h (&regs, &regs);
+    tty_y_size = regs.h.dl + 1;
+  }
   else
-    {
-      tty_y_size = atoi(psTemp);
-      if (0 == tty_y_size)
-        tty_y_size = DEFAULT_TTY_Y_SIZE; /* atoi failed, use default */
-    }
+  {
+    tty_y_size = (atoi (psTemp));
+    if (tty_y_size == 0)
+      tty_y_size = DEFAULT_TTY_Y_SIZE; /* atoi failed, use default */
+  }
+  return;
 }
 
 void
@@ -154,25 +156,23 @@ DEFUN_VOID (DOS_initialize_tty)
   tty_x_size = (-1);
   tty_y_size = (-1);
   tty_command_beep = ALERT_STRING;
-  tty_command_clear = 0;
-
+  tty_command_clear = "\033[2J";
 
   /* Figure out the size of the terminal. Tries environment variables.
      If that fails, use default values. */
 
-  tty_x_size = pc_gestalt_screen_x_size();
-  tty_y_size = pc_gestalt_screen_y_size();
-
-  if (tty_command_clear == 0)
-    tty_command_clear = "\033[2J";
+  pc_gestalt_screen_x_size ();
+  pc_gestalt_screen_y_size ();
+  return;
 }
 \f
 /* Fake TERMCAP capability */
 short ospeed;
 char PC;
 
-int tputs (string, nlines, outfun)
-     register char *string;
+int 
+tputs (string, nlines, outfun)
+     register char * string;
      int nlines;
      register int (*outfun) ();
 {
@@ -181,22 +181,22 @@ int tputs (string, nlines, outfun)
   if (string == (char *) 0)
     return;
   while (*string >= '0' && *string <= '9')
-    {
-      padcount += *string++ - '0';
-      padcount *= 10;
-    }
+  {
+    padcount += *string++ - '0';
+    padcount *= 10;
+  }
   if (*string == '.')
-    {
-      string++;
-      padcount += *string++ - '0';
-    }
+  {
+    string++;
+    padcount += *string++ - '0';
+  }
   if (*string == '*')
-    {
-      string++;
-      padcount *= nlines;
-    }
+  {
+    string++;
+    padcount *= nlines;
+  }
   while (*string)
     (*outfun) (*string++);
 
-  return 0;
+  return (0);
 }
index 8acb30cb8d7f67f7e75db21fd2dbea04c3c01e8b..ba65668f1e377ac446500b1ba4807ff263bf607f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: dosx32.c,v 1.3 1992/10/01 18:20:41 jinx Exp $
+$Id: dosx32.c,v 1.4 1992/10/07 06:23:35 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -35,23 +35,28 @@ MIT in each case. */
 #include <int.h>
 #include <stdio.h>
 #include "ansidecl.h"
+#include "msdos.h"
 #include "dosio.h"
 #include "dossys.h"
+
+#ifdef getDS
+#undef getDS
+#endif
+
+#ifdef getCS
+#undef getCS
+#endif
+
+extern unsigned short EXFUN (getCS, (void));
+extern unsigned short EXFUN (getDS, (void));
 \f
 /* Exports */
 
-extern int EXFUN (X32_lock_scheme_microcode, (void));
-
 extern int EXFUN (under_X32_p, (void));
-
+extern int EXFUN (X32_lock_scheme_microcode, (void));
 extern int EXFUN (X32_interrupt_restore, (unsigned));
-
 extern int EXFUN (X32_int_intercept, (unsigned, void (*) (void), PTR));
 
-extern unsigned short EXFUN (getCS, (void));
-
-extern unsigned short EXFUN (getDS, (void));
-
 int
 DEFUN_VOID (under_X32_p)
 {
@@ -59,7 +64,7 @@ DEFUN_VOID (under_X32_p)
   
   regs.x.bx = (getDS ());
   regs.x.ax = 0x3504;
-  int86 (0x21, &regs, &regs);
+  intdos (&regs, &regs);
   return ((regs.e.flags & 1) == 0);
 }
 
@@ -97,7 +102,7 @@ DEFUN (lock_unlock, (operation, segment, offset, size),
   regs.e.ecx = base;
   segread (&sregs);
   sregs.es = segment;
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   return (((regs.e.flags & 1) != 0) ? -1 : 0);
 }
 \f
@@ -223,7 +228,7 @@ DEFUN (X32_do_restore, (iv, area),
   regs.e.edx = area->protected_offset;
   regs.e.ebx = area->real_handler;
   sregs.ds = area->protected_segment;
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   return (((regs.e.flags & 0x1) == 0) ? 0 : -1);
 }
 
@@ -242,7 +247,7 @@ DEFUN (X32_do_install, (iv, handler),
   regs.h.cl = iv;
   regs.e.edx = ((unsigned) handler);
   sregs.ds = (getCS ());
-  int86x (0x21, &regs, &regs, &sregs);
+  intdosx (&regs, &regs, &sregs);
   if ((regs.e.flags & 1) != 0)
     return (-1);
   return (0);
@@ -315,7 +320,7 @@ DEFUN (X32_int_intercept, (iv, handler, ptr),
   {
     regs.x.ax = 0x2503;
     regs.h.cl = iv;
-    int86 (0x21, &regs, &regs);
+    intdos (&regs, &regs);
     if ((regs.e.flags & 1) != 0)
       return (-1);
     area->real_handler = regs.e.ebx;
@@ -327,7 +332,7 @@ DEFUN (X32_int_intercept, (iv, handler, ptr),
     regs.x.ax = 0x2502;
     regs.h.cl = iv;
     segread (&sregs);
-    int86x (0x21, &regs, &regs, &sregs);
+    intdosx (&regs, &regs, &sregs);
     if ((regs.e.flags & 1) != 0)
       return (-1);
 
@@ -346,18 +351,18 @@ DEFUN (X32_int_intercept, (iv, handler, ptr),
   return (0);
 }
 \f
-extern int EXFUN (X32_subprocess, (char *, int, int, int));
-extern int EXFUN (X32_system, (char *));
-extern int EXFUN (system, (char *));
+extern int EXFUN (X32_subprocess, (const char *, int, int, int));
+extern int EXFUN (X32_system, (const char *));
+extern int EXFUN (system, (const char *));
 
 static int
-DEFUN (dummy_system, (command), char * command)
+DEFUN (dummy_system, (command), const char * command)
 {
   return (-1);
 }
 
 static int
-DEFUN (X32_DPMI_system, (command), char * command)
+DEFUN (X32_DPMI_system, (command), const char * command)
 {
   /* Plain system does not work in X32 under DPMI
      in the presence of our timer interrupt handler.
@@ -391,12 +396,12 @@ DEFUN (X32_DPMI_system, (command), char * command)
   return (result);
 }
 
-int EXFUN (which_system, (char *));
+int EXFUN (which_system, (const char *));
 
-static int EXFUN ((* fsystem), (char *)) = which_system;
+static int EXFUN ((* fsystem), (const char *)) = which_system;
 
 static int
-DEFUN (which_system, (command), char * command)
+DEFUN (which_system, (command), const char * command)
 {
   if (! (under_X32_p ()))
     fsystem = dummy_system;
@@ -408,7 +413,7 @@ DEFUN (which_system, (command), char * command)
 }
 
 int
-DEFUN (X32_system, (command), char * command)
+DEFUN (X32_system, (command), const char * command)
 {
   return (((* fsystem) (command)));
 }
@@ -464,7 +469,7 @@ DEFUN (restore_io_handle, (handle, saved_handle),
 
 int
 DEFUN (X32_subprocess, (command, in_spec, out_spec, err_spec),
-       char * command
+       const char * command
        AND int in_spec
        AND int out_spec
        AND int err_spec)
index 47803faf94c0679b4e364d8ef98d7fc4f8d77d23..74be61bf78c74fa57950518a094953ca899ff647 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/msdos.h,v 1.2 1992/07/06 23:42:02 jinx Exp $
+$Id: msdos.h,v 1.3 1992/10/07 06:23:36 jinx Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -32,11 +32,11 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* Unix system include file */
-
-#ifndef SCM_DOS_H
-#define SCM_DOS_H
+/* DOS system include file */
 
+#ifndef SCM_MSDOS_H
+#define SCM_MSDOS_H
+\f
 #define SYSTEM_NAME "dos"
 #define SYSTEM_VARIANT "MS-DOS"
 
@@ -524,8 +524,14 @@ extern int EXFUN
 #define DOS_SC_OPEN_MAX() 16
 #endif
 
+/* Interrupts */
+
+#define int10h(in,out)         int86 (0x10, in, out)
+#define intDPMI(in,out)                int86 (0x31, in, out)
+#define intDPMIx(in,out,seg)   int86x (0x31, in, out, seg)
+
 /* Doesn't really go anywhere */
 #define INTERRUPT_CHAIN_NEXT   0
 #define INTERRUPT_RETURN       1
 
-extern void EXFUN (console_write_string, (void * string));
+#endif /* SCM_MSDOS_H */