changeset 13305:63a43c4b29b2

(IT_ring_bell): Use intdos, not write. (recent_doskeys_index, total_doskeys, recent_doskeys): New variables. (Frecent_doskeys): New function. (syms_of_msdos): New function.
author Richard M. Stallman <rms@gnu.org>
date Thu, 26 Oct 1995 19:06:38 +0000
parents 3ac6db7496fd
children 77d8e407592e
files src/msdos.c
diffstat 1 files changed, 54 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/msdos.c	Thu Oct 26 13:53:18 1995 +0000
+++ b/src/msdos.c	Thu Oct 26 19:06:38 1995 +0000
@@ -358,7 +358,12 @@
       ScreenVisualBell ();
     }
   else
-    write (1, "\007", 1);
+    {
+      union REGS inregs, outregs;
+      inregs.h.ah = 2;
+      inregs.h.dl = 7;
+      intdos (&inregs, &outregs);
+    }
 }
 
 static void
@@ -1132,6 +1137,35 @@
   return modifiers;
 }
 
+#define NUM_RECENT_DOSKEYS (100)
+int recent_doskeys_index;	/* Index for storing next element into recent_doskeys */
+int total_doskeys;		/* Total number of elements stored into recent_doskeys */
+Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */
+
+DEFUN ("recent-doskeys", Frecent_doskeys, Srecent_doskeys, 0, 0, 0,
+  "Return vector of last 100 keyboard input values seen in dos_rawgetc.\n\
+Each input key receives two values in this vector: first the ASCII code,\n\
+and then the scan code.")
+     ()
+{
+  Lisp_Object *keys = XVECTOR (recent_doskeys)->contents;
+  Lisp_Object val;
+
+  if (total_doskeys < NUM_RECENT_DOSKEYS)
+    return Fvector (total_doskeys, keys);
+  else
+    {
+      val = Fvector (NUM_RECENT_DOSKEYS, keys);
+      bcopy (keys + recent_doskeys_index,
+	     XVECTOR (val)->contents,
+	     (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
+      bcopy (keys,
+	     XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
+	     recent_doskeys_index * sizeof (Lisp_Object));
+      return val;
+    }
+}
+
 /* Get a char from keyboard.  Function keys are put into the event queue.  */
 static int
 dos_rawgetc ()
@@ -1160,6 +1194,16 @@
       c = regs.h.al;
       sc = regs.h.ah;
 
+      total_doskeys += 2;
+      XVECTOR (recent_doskeys)->contents[recent_doskeys_index++]
+	= make_number (c);
+      if (recent_doskeys_index == NUM_RECENT_DOSKEYS)
+	recent_doskeys_index = 0;
+      XVECTOR (recent_doskeys)->contents[recent_doskeys_index++]
+	= make_number (sc);
+      if (recent_doskeys_index == NUM_RECENT_DOSKEYS)
+	recent_doskeys_index = 0;
+
       modifiers = dos_get_modifiers (&mask);
       
 #ifndef HAVE_X_WINDOWS
@@ -1372,9 +1416,7 @@
   else
     return dos_rawgetc ();
 }
-
-
-
+
 #ifndef HAVE_X_WINDOWS
 /* See xterm.c for more info.  */
 void
@@ -2477,4 +2519,12 @@
 }
 #endif
 
+syms_of_msdos ()
+{
+  recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil);
+  staticpro (&recent_doskeys);
+
+  defsubr (&Srecent_doskeys);
+}
+
 #endif /* MSDOS */