[futurebasic] C conversion and masking.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2001 : Group Archive : Group : All Groups

From: David Cottrell <David.Cottrell@...>
Date: Sat, 23 Jun 2001 15:56:52 +1000
I've been revisiting the code I wrote to access the info from a Wacom 
Intuos Graphics tablet and I've hit a conversion problem. I'm not sure 
the conversion is correct, and MORE IMPORTANTLY, I'm not sure how to 
access some flag bits.

The C definition reads:

char flags; /* proximity, update flag, and # buttons.

My translation is

DIM flags AS char /* proximity, update flag, and # buttons */

This seems OK. But...

The bit I don't follow is:

#define PROXIMITY 0x80 /*is the transducer within proximity*/
#define TRACKING 0x40 /* is the driver tracking the mouse cursor; 
0=YES */

These are bit masks I think, but what about the update flag? That's the 
one I want. I also don't understand how to use this information. That 
is, how do I find out if the update flag is set?

eg.

LONG IF updateFlag
   'do important stuff
XELSE
  'twiddle thumbs
END IF

It's kind of embarision but I just realised I really dont understand 
this bit setting/reading stuff.

All enlightenment appreciated.

David


Macintosh users might only make up 5% of all computer users, but they 
are the top 5%. - Douglas Adams