<[EMAIL PROTECTED]> writes:
>I have a header file with an enum,
>
>typedef enum { one two } OneTwo;
>
>..in the xs I used 
>
>#define one 0
>#define two 1
>
>char *

char * ??? 

>one()
>
>    CODE:
>#ifdef one
>    RETVAL = one;
>#else
>    croak("Your vendor has not defined the macro one");
>#endif
>
>    OUTPUT:
>    RETVAL
>
>...etc
>
>
>Is there a better way to handle enums?

I tend to treat them as constant subs something like:

/* Make function-like things for XS to "call"
#define ENUM_one() one 
#define ENUM_two() two

MODULE ....  PREFIX ENUM_ 
PROTOTYPES : ENABLE

IV 
ENUM_one()

IV 
ENUM_two()

Here ENUM_ 

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/

  • Enums shildreth
    • Nick Ing-Simmons

Reply via email to