From: nobu.nokada@... Date: 2005-02-11T01:39:12+09:00 Subject: Re: mkmf and enum values Hi, At Thu, 10 Feb 2005 01:35:11 +0900, Daniel Berger wrote in [ruby-talk:130253]: > What's the best way to tell if an enum member contains a particular > value? Enum values are used as just integers, so it would be difficult to check if a symbol belongs to an enum. > My question in particular centers around the idtype_t enum, and I'm > writing some code that I want to make cross platform. On Solaris 9, > the enum contains values like P_ALL, P_CID, etc. I don't know that all > of these exist, or if they have slightly different names, on other > platforms. I think in older versions of Linux they were PS_, instead > of P_, for example. > > With a struct, for example, I know you can do something like this: > > have_struct_member("struct type","member","someheader.h") > > However, I didn't see anything like a "have_enum_value". def have_enum_value(enum, val, headers = nil) try_compile(cpp_include(headers)+"enum #{enum} conftest_val = #{val};") end -- Nobu Nakada