Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit febf811

Browse files
committed
Added mac-only intrpeek routine that peeks for command-.
1 parent 7874d1f commit febf811

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

Parser/intrcheck.c

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2424

2525
/* Check for interrupts */
2626

27-
#ifdef THINK_C
28-
#include <MacHeaders>
29-
#define macintosh
30-
#endif
31-
3227
#ifdef HAVE_CONFIG_H
3328
#include "config.h"
3429
#endif
3530

3631
#include "myproto.h"
3732
#include "intrcheck.h"
3833

34+
#ifdef macintosh
35+
#ifdef THINK_C
36+
#include <OSEvents.h>
37+
#endif
38+
#include <Events.h>
39+
#endif
40+
41+
3942

4043
#ifdef QUICKWIN
4144

@@ -161,6 +164,28 @@ intrcheck()
161164
return 0;
162165
}
163166

167+
/* intrpeek() is like intrcheck(), but it doesn't flush the events. The
168+
** idea is that you call intrpeek() somewhere in a busy-wait loop, and return
169+
** None as soon as it returns 0. The mainloop will then pick up the cmd-. soon
170+
** thereafter.
171+
*/
172+
int
173+
intrpeek()
174+
{
175+
register EvQElPtr q;
176+
177+
q = (EvQElPtr) GetEvQHdr()->qHead;
178+
179+
for (; q; q = (EvQElPtr)q->qLink) {
180+
if (q->evtQWhat == keyDown &&
181+
(char)q->evtQMessage == '.' &&
182+
(q->evtQModifiers & cmdKey) != 0) {
183+
return 1;
184+
}
185+
}
186+
return 0;
187+
}
188+
164189
#define OK
165190

166191
#endif /* macintosh */

0 commit comments

Comments
 (0)