summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-01-19 12:12:36 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-01-19 12:12:36 (GMT)
commitfebf811a2dc03e52b1b91205a8342e42b93ff482 (patch)
tree98f8a3c883929b3b36b85df4a6a960fbbf21f79e
parent7874d1fe7e3baa4bde3fbdfea937186061e62516 (diff)
downloadcpython-febf811a2dc03e52b1b91205a8342e42b93ff482.zip
cpython-febf811a2dc03e52b1b91205a8342e42b93ff482.tar.gz
cpython-febf811a2dc03e52b1b91205a8342e42b93ff482.tar.bz2
Added mac-only intrpeek routine that peeks for command-.
-rw-r--r--Parser/intrcheck.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/Parser/intrcheck.c b/Parser/intrcheck.c
index 518cc59..827fcdd 100644
--- a/Parser/intrcheck.c
+++ b/Parser/intrcheck.c
@@ -24,11 +24,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Check for interrupts */
-#ifdef THINK_C
-#include <MacHeaders>
-#define macintosh
-#endif
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -36,6 +31,14 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "myproto.h"
#include "intrcheck.h"
+#ifdef macintosh
+#ifdef THINK_C
+#include <OSEvents.h>
+#endif
+#include <Events.h>
+#endif
+
+
#ifdef QUICKWIN
@@ -161,6 +164,28 @@ intrcheck()
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 0. The mainloop will then pick up the cmd-. soon
+** thereafter.
+*/
+int
+intrpeek()
+{
+ register EvQElPtr q;
+
+ q = (EvQElPtr) GetEvQHdr()->qHead;
+
+ for (; q; q = (EvQElPtr)q->qLink) {
+ if (q->evtQWhat == keyDown &&
+ (char)q->evtQMessage == '.' &&
+ (q->evtQModifiers & cmdKey) != 0) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
#define OK
#endif /* macintosh */