Re: Official .defs files



> > Ie.
> >   (value (name *) (c-name *) (c-value *))
> > 
> 
> Can't you simply get the number from the order they come in the
> define-enum? Can we assume that tab-forward will be 0 and so on?

No.  many of the enums do not take the default values.

Ie.
(bit fields)
typedef enum
{
  GTK_EXPAND = 1 << 0,
  GTK_SHRINK = 1 << 1,
  GTK_FILL   = 1 << 2
} GtkAttachOptions;

(masking)
typedef enum
{
  GTK_PATH_PRIO_LOWEST      = 0,
  GTK_PATH_PRIO_GTK         = 4,
  GTK_PATH_PRIO_APPLICATION = 8,
  GTK_PATH_PRIO_RC          = 12,
  GTK_PATH_PRIO_HIGHEST     = 15,
  GTK_PATH_PRIO_MASK        = 0x0f
} GtkPathPriorityType;


Not to mention things which are derived values....

typedef enum                    /*< flags >*/
{
  GTK_RUN_FIRST      = 1 << 0,
  GTK_RUN_LAST       = 1 << 1,
  GTK_RUN_BOTH       = (GTK_RUN_FIRST | GTK_RUN_LAST),
  GTK_RUN_NO_RECURSE = 1 << 2,
  GTK_RUN_ACTION     = 1 << 3,
  GTK_RUN_NO_HOOKS   = 1 << 4
} GtkSignalRunType;

These are the ones I most have to redefine in C++ because 
enums require casts in C++ where they are used in this fashion.


Thus there is a compelling need for the c-values to be in the 
file.  Further, getting the value from the order implies they
won't get sorted or otherwise mangled anywhere in the process.
Be safe and place it in the spec.  Worst case, most of the 
bindings just skip over that field.

The program I sent already handles most cases including derived 
ones.  

--Karl







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]