Re: does gmm-proc have a way of dealing with preprocessor #defines?



Hi,
Thanks Kjell.  You were right.

Ian.

On 27/08/13 20:54, Kjell Ahlstedt wrote:
2013-08-23 00:22, Ian Martin skrev:
Hi,
I'm messing around with cluttermm, which hasn't seen a lot of attention for some time.  I think the last time the .hg files were updated was just before the 1.0 release in 2009, and the last git commit was about a year ago.

I've managed to build it with jhbuild, but there's been a lot of work done in cluttermm since 2009, and there's some wrapping required to get it up to speed.  I'm working my way through that, but have run into the following problem:  when running enum.pl to generate the enums, ClutterPathNodeType is causing grief.  Here's the C declaration in clutter-enums.h (emphasis mine):

#define CLUTTER_PATH_RELATIVE           (32)

/**
 * ClutterPathNodeType:
 * @CLUTTER_PATH_MOVE_TO: jump to the given position
 * @CLUTTER_PATH_LINE_TO: create a line from the last node to the
 *   given position
 * @CLUTTER_PATH_CURVE_TO: bezier curve using the last position and
 *   three control points.
 * @CLUTTER_PATH_CLOSE: create a line from the last node to the last
 *   %CLUTTER_PATH_MOVE_TO node.
 * @CLUTTER_PATH_REL_MOVE_TO: same as %CLUTTER_PATH_MOVE_TO but with
 *   coordinates relative to the last node.
 * @CLUTTER_PATH_REL_LINE_TO: same as %CLUTTER_PATH_LINE_TO but with
 *   coordinates relative to the last node.
 * @CLUTTER_PATH_REL_CURVE_TO: same as %CLUTTER_PATH_CURVE_TO but with
 *   coordinates relative to the last node.
 *
 * Types of nodes in a #ClutterPath.
 *
 * Since: 1.0
 */
typedef enum {
  CLUTTER_PATH_MOVE_TO      = 0,
  CLUTTER_PATH_LINE_TO      = 1,
  CLUTTER_PATH_CURVE_TO     = 2,
  CLUTTER_PATH_CLOSE        = 3,

  CLUTTER_PATH_REL_MOVE_TO  = CLUTTER_PATH_MOVE_TO | CLUTTER_PATH_RELATIVE,
  CLUTTER_PATH_REL_LINE_TO  = CLUTTER_PATH_LINE_TO | CLUTTER_PATH_RELATIVE,
  CLUTTER_PATH_REL_CURVE_TO = CLUTTER_PATH_CURVE_TO | CLUTTER_PATH_RELATIVE
} ClutterPathNodeType;
and so running enum.pl on it results in
WARNING: CLUTTER_PATH_RELATIVE value of CLUTTER_PATH_REL_LINE_TO element in 'ClutterPathNodeType' enum is an unknown token.
It probably is ...
I'm guessing it's the preprocessor define that's causing the problem.  Is there a simple way to get gmmproc to read this appropriately, or should I just redefine the whole enum in one of the .hg files?

Ian.


Are the warnings fatal, or does enum.pl generate a useful file?

When generating gio_enums.defs in glibmm/gio/src, enum.pl prints some such warnings because of

typedef enum {
  G_SOCKET_FAMILY_INVALID,
  G_SOCKET_FAMILY_UNIX = GLIB_SYSDEF_AF_UNIX,
  G_SOCKET_FAMILY_IPV4 = GLIB_SYSDEF_AF_INET,
  G_SOCKET_FAMILY_IPV6 = GLIB_SYSDEF_AF_INET6
} GSocketFamily;

and

typedef enum /*< flags >*/
{
  G_SOCKET_MSG_NONE,
  G_SOCKET_MSG_OOB = GLIB_SYSDEF_MSG_OOB,
  G_SOCKET_MSG_PEEK = GLIB_SYSDEF_MSG_PEEK,
  G_SOCKET_MSG_DONTROUTE = GLIB_SYSDEF_MSG_DONTROUTE
} GSocketMsgFlags;

The generated file is still correct, and gmmproc can use it for generating .h files out out .hg files.
These enums are simpler than your enum, because they don't contain "|". I don't know it that matters.

Kjell




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