[lazarus] bit fields

Sergio Kessler sak at perio.unlp.edu.ar
Tue May 18 13:32:54 EDT 1999



Hi all, I have been talking with the gtk developers to modify some
things in the next release, so it easy for bindings makers to do
the wrapers.
They are agreeing in some things (fields accesors for reading properties,
at least implemented by macros), but when I mention that they should 
try to avoid to do guint bitfield : 1
they say me that this should be mapped to a boolean pascal,
I don't think this is possible, it is ?

I get lost with this:

       Pascal                                      C

  entry_change_id : guint;    > 32 bits <     guint entry_change_id;
  list_change_id : guint;     > 32 bits <     guint list_change_id
  flag0 : word;                          /    guint value_in_list : 1;
                     \                 /      guint ok_if_empty : 1;
                       > 32b vs. 5b ?<        guint case_sensitive : 1;
                                       \      guint use_arrows : 1;
                                         \    guint use_arrows_always : 1;
  current_button : guint16;   > 16 bits <     guint16 current_button;
  activate_id : guint;        > 32 bits <     guint activate_id;

When I pass an object to gtk, I pass a binary structure, how the 
remaining 27 bits of flag0 aren't overwrited with the next field
(current_button) ??
The C compiler pack all this bits in a word, not byte, not anything else ?

It should help if they use something like:

typedef enum { 0, 1} gbit;        ??
or
typedef enum { FALSE, TRUE} gbit;     ??

Sergio
-- 
  |    Sergio A. Kessler  http://perio.unlp.edu.ar/~sergio
-O_O-  Keep working at it... you will either succeed, or become an expert.






More information about the Lazarus mailing list