mirror of https://github.com/python/cpython.git
Mac interrupt code moved to macglue.c
This commit is contained in:
parent
7e4b2def34
commit
9fc3989c66
|
@ -116,82 +116,7 @@ intrcheck()
|
|||
|
||||
#ifdef macintosh
|
||||
|
||||
#ifdef applec /* MPW */
|
||||
#include <OSEvents.h>
|
||||
#include <SysEqu.h>
|
||||
#endif /* applec */
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
static int interrupted;
|
||||
|
||||
static RETSIGTYPE intcatcher PROTO((int));
|
||||
static RETSIGTYPE
|
||||
intcatcher(sig)
|
||||
int sig;
|
||||
{
|
||||
interrupted = 1;
|
||||
signal(SIGINT, intcatcher);
|
||||
}
|
||||
|
||||
void
|
||||
initintr()
|
||||
{
|
||||
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
|
||||
signal(SIGINT, intcatcher);
|
||||
}
|
||||
|
||||
#ifdef THINK_C
|
||||
/* MPW and MW runtime catch cmd-. and raise SIGINT, THINK does not, it seems */
|
||||
static void
|
||||
scan_event_queue(flush)
|
||||
int flush;
|
||||
{
|
||||
register EvQElPtr q;
|
||||
|
||||
q = (EvQElPtr) GetEvQHdr()->qHead;
|
||||
|
||||
for (; q; q = (EvQElPtr)q->qLink) {
|
||||
if (q->evtQWhat == keyDown &&
|
||||
(char)q->evtQMessage == '.' &&
|
||||
(q->evtQModifiers & cmdKey) != 0) {
|
||||
if ( flush )
|
||||
FlushEvents(keyDownMask, 0);
|
||||
interrupted = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
intrcheck()
|
||||
{
|
||||
#ifdef THINK_C
|
||||
scan_event_queue(1);
|
||||
#endif
|
||||
PyMac_Yield();
|
||||
if (interrupted) {
|
||||
interrupted = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* intrpeek() is like intrcheck(), but it doesn't flush the events. The
|
||||
** idea is that you call intrpeek() somewhere in a busy-wait loop, and return
|
||||
** None as soon as it returns 1. The mainloop will then pick up the cmd-. soon
|
||||
** thereafter.
|
||||
*/
|
||||
int
|
||||
intrpeek()
|
||||
{
|
||||
#ifdef THINK_C
|
||||
scan_event_queue(0);
|
||||
#endif
|
||||
return interrupted;
|
||||
}
|
||||
|
||||
/* The Mac interrupt code has moved to macglue.c */
|
||||
#define OK
|
||||
|
||||
#endif /* macintosh */
|
||||
|
|
Loading…
Reference in New Issue