Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GetKeys() and KeyMap?



hi,



In an e-mail that had a date of 7/27/04 4:03:14 PM, email@hidden wrote:

>> How in do you get the (128) elements of a KeyMap and read true/false
>> separately???
>
>The 128 elements are all bits.
Oh, I was thinking Boolean.



>> (1) struct KeyMap { UInt32[4] };
>
>Where are you seeing this? The typedef I see from documentation is:
>
>struct KeyMap
>{
> char map[16];
>};
>
>> (2) typedef long KeyMap[16];
>
>Where have you seen (2)? That container contains 512 bits. Now if
>'long' is replaced by char, then you'd have 128 bits.
The first one was a mistake.
The second one was also a mistake, it should look like this:
typedef long KeyMap[4]

>Big Endian is how PowerPC (and 680x0) stores data in memory.

Really I didn't need to know what that was, but thanks anyway.
(Knowledge IS power)

>> My compiler gives me an error when I try this:
>> /*KeyMap*/ keys = /*UInt8*/ trykeys; /*UInt8 trykeys[128]*/

>I don't understand what you were trying here.
keys = trykeys; // trykeys was declared as: UInt8
(and I was just showing some of the ways I tryed to compile my code)

>The following code works for me (Xcode 1.2):

>void foo (void)
>{
> KeyMap aKeyMap;
>
> GetKeys (aKeyMap);
>}
Me too.
My problem isn't compiling, it's testing if a character.
But as you said it's bits not Boolean.


>> Note: I am extremely bad when it comes to working with bytes
>>(and other values)
>> BinarySpike
>
>Then why do you call yourself BinarySpike? :)

Because email@hidden is already taken :)
(But I'm not saying BinarySpike isn't a good name)


>> #include <Carbon.h>
>> Boolean Done;
>> KeyMap keys;
>> UInt8 trykeys[128];
> ^^^^^^^^^^^^^^^^^^^
>You don't need this tryKeys. This has a size of 1024 bits.
>Just use your 'keys' declaration above.

Like I said, I was thinking Boolean terms.


Bit Shifting should do the trick right?


BinarySpike ;)
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.