Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!apple!xanadu!bob From: bob@xanadu.com (Bob Schumaker -- "Software-in-a-bucket") Newsgroups: comp.sys.mac.programmer Subject: Re: Two (2) weenie C questions... Summary: Check for keys in both MPW and THINK C Keywords: Keymaps Message-ID: <1990Aug30.235321.13449@xanadu.com> Date: 30 Aug 90 23:53:21 GMT References: <1990Aug29.202759.293@midway.uchicago.edu> Sender: sun!markets!bob Organization: The AMIX Corporation, Palo Alto, CA Lines: 33 > 1) How does one determine if a key is down using KeyMap? It's simple in > Pascal: an array of booleans, but in the C interfaces it's declared as Boolean CheckKey (map, key) KeyMap *map; int key; { long i = (1 << (31 - (key % 32))); #ifdef applec /* or AppleC in MPW 3.2 :-( don't ask me why! */ return (*map[key/32] & i); #else return (map->Key[key / 32] & i); #endif } ------------------------------------------------------------------------ This life is a test. It is only a test. Had this been a real life, you would have been told where to go and what to do. ------------------------------------------------------------------------ Bob Schumaker The AMIX Corporation 2345 Yale, Palo Alto, CA 94306 Addresses: bob@amix.com uunet!markets!amix!bob amix.com!bob@uunet.uu.net sun!xanadu!amix!bob Any opinions expressed herein probably *are* the opinions of my employer. ------------------------------------------------------------------------ -- ------------------------------------------------------------------------ This life is a test. It is only a test. Had this been a real life, you would have been told where to go and what to do. ------------------------------------------------------------------------