I would like to translate some c headers files but I am unsure of how to approach the members variables defined with the size of a certain number of bits. For example
struct _GtkWindow
{
GtkBin bin;
gchar *title;
gchar *wmclass_name;
gchar *wmclass_class;
gchar *wm_role;
GtkWidget *focus_widget;
GtkWidget *default_widget;
GtkWindow *transient_parent;
GtkWindowGeometryInfo *geometry_info;
GdkWindow *frame;
GtkWindowGroup *group;
guint16 configure_request_count;
guint allow_shrink : 1;
guint allow_grow : 1;
guint configure_notify_received : 1;
/* The following flags are initially TRUE (before a window is mapped).
* They cause us to compute a configure request that involves
* default-only parameters. Once mapped, we set them to FALSE.
* Then we set them to TRUE again on unmap (for position)
* and on unrealize (for size).
*/
guint need_default_position : 1;
guint need_default_size : 1;
guint position : 3;
guint type : 4; /* GtkWindowType */
guint has_user_ref_count : 1;
guint has_focus : 1;
guint modal : 1;
guint destroy_with_parent : 1;
guint has_frame : 1;
/* gtk_window_iconify() called before realization */
guint iconify_initially : 1;
guint stick_initially : 1;
guint maximize_initially : 1;
guint decorated : 1;
guint type_hint : 3; /* GdkWindowTypeHint */
guint gravity : 5; /* GdkGravity */
guint is_active : 1;
guint has_toplevel_focus : 1;
guint frame_left;
guint frame_top;
guint frame_right;
guint frame_bottom;
guint keys_changed_handler;
GdkModifierType mnemonic_modifier;
GdkScreen *screen;
};
What I would like is a way to declare the fields so that they can be accessed transparently as would be possible in C. At the moment they way I intend to solve the problem is just count the total number of bits for each member and declare a generic variable big enough for the fields. This way the if I follow the gtk reference and use a structure member that is a bit field, fasm will alert me of the error and I could verify whats going on according to how the structure was translated. This is what I have come up with so far. Is it an ok solution or can it be done better?