summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-10-26 19:06:38 +0000
committerRichard M. Stallman <rms@gnu.org>1995-10-26 19:06:38 +0000
commit3635be47bdc67ae98851c030656339b31d7ba660 (patch)
tree2bfd529fe7793a88381e34840af2cb102a938f45 /src
parent85aa52faa34b3b7783b1c5d8801e6c9465450fbc (diff)
downloademacs-3635be47bdc67ae98851c030656339b31d7ba660.tar.gz
(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.
Diffstat (limited to 'src')
-rw-r--r--src/msdos.c58
1 files changed, 54 insertions, 4 deletions
diff --git a/src/msdos.c b/src/msdos.c
index 16632b6b0ca..3557dee874a 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -358,7 +358,12 @@ IT_ring_bell ()
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 @@ dos_get_modifiers (keymask)
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 @@ dos_rawgetc ()
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 @@ dos_keyread ()
else
return dos_rawgetc ();
}
-
-
-
+
#ifndef HAVE_X_WINDOWS
/* See xterm.c for more info. */
void
@@ -2477,4 +2519,12 @@ dos_abort (file, line)
}
#endif
+syms_of_msdos ()
+{
+ recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil);
+ staticpro (&recent_doskeys);
+
+ defsubr (&Srecent_doskeys);
+}
+
#endif /* MSDOS */