summaryrefslogtreecommitdiffstats
path: root/Parser/intrcheck.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-01-16 14:04:51 (GMT)
committerGuido van Rossum <guido@python.org>1991-01-16 14:04:51 (GMT)
commit875eb7d9c2a06118b211b69fee30b5b14fbab9f8 (patch)
treeac6a34bb81bb6f192d8af94f5764a1ac001aee77 /Parser/intrcheck.c
parentd9bf55d0d05fdadc96382c4e3c9c55630a2ef435 (diff)
downloadcpython-875eb7d9c2a06118b211b69fee30b5b14fbab9f8.zip
cpython-875eb7d9c2a06118b211b69fee30b5b14fbab9f8.tar.gz
cpython-875eb7d9c2a06118b211b69fee30b5b14fbab9f8.tar.bz2
Mac version now looks ahead in event queue instead of eating events.
Much better!
Diffstat (limited to 'Parser/intrcheck.c')
-rw-r--r--Parser/intrcheck.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/Parser/intrcheck.c b/Parser/intrcheck.c
index 8c35114..2679318 100644
--- a/Parser/intrcheck.c
+++ b/Parser/intrcheck.c
@@ -27,26 +27,52 @@ intrcheck()
#ifdef THINK_C
+/* This is for THINK C 4.0.
+ For 3.0, you may have to remove the signal stuff. */
+
#include <MacHeaders>
+#include <signal.h>
+#include "sigtype.h"
+
+static int interrupted;
+
+static SIGTYPE
+intcatcher(sig)
+ int sig;
+{
+ interrupted = 1;
+ signal(SIGINT, intcatcher);
+}
void
initintr()
{
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ signal(SIGINT, intcatcher);
}
int
intrcheck()
{
- /* Static to make it faster only */
- static EventRecord e;
+ register EvQElPtr q;
- /* XXX This fails if the user first types ahead and then
- decides to interrupt -- repeating Command-. until the
- event queue overflows may work though. */
- if (EventAvail(keyDownMask|autoKeyMask, &e) &&
- (e.modifiers & cmdKey) &&
- (e.message & charCodeMask) == '.') {
- (void) GetNextEvent(keyDownMask|autoKeyMask, &e);
+ /* This is like THINK C 4.0's <console.h>.
+ I'm not sure why FlushEvents must be called from asm{}. */
+ for (q = (EvQElPtr)EventQueue.qHead; q; q = (EvQElPtr)q->qLink) {
+ if (q->evtQWhat == keyDown &&
+ (char)q->evtQMessage == '.' &&
+ (q->evtQModifiers & cmdKey) != 0) {
+
+ asm {
+ moveq #keyDownMask,d0
+ _FlushEvents
+ }
+ interrupted = 1;
+ break;
+ }
+ }
+ if (interrupted) {
+ interrupted = 0;
return 1;
}
return 0;
@@ -63,7 +89,6 @@ intrcheck()
#include <stdio.h>
#include <signal.h>
-
#include "sigtype.h"
static int interrupted;