Commit 3635be47 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(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.
parent 85aa52fa
......@@ -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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment