ffi/ffi-swig-generator — pull request #17 by phemmer (2013-10-18 03:13:19+00:00)
Title: Enum constants

*This pull request also includes the commit in the pull request for [named enums](https://github.com/ffi/ffi-swig-generator/pull/16). This is to avoid merge conflicts since both modify the same areas of code.*

This adds constants for all enums. It is common practice to use enums for defining sequential constants within C code. This adds each value of the enum as a constant.

For example

%module Test
typedef enum {
FOO,
BAR,
POP,
TART,
} baz;

Without this change:

baz = enum :foo,
:bar,
:pop,
:tart

With this change:

baz = enum :baz, [
:foo,
:bar,
:pop,
:tart,
]
FOO = 0
BAR = FOO + 1
POP = BAR + 1
TART = POP + 1