mywiki:linux:enum_string
This is an old revision of the document!
Map Enum to string array or its value array
#define DP_F_FLAG_LIST \
DP_F_ENUM_OR_STRING(DP_F_DEREGISTER, 0x00000001, "De-Register"), \ DP_F_ENUM_OR_STRING(DP_F_FAST_ETH_LAN, 0x00000002, "ETH_LAN"), \ DP_F_ENUM_OR_STRING(DP_F_FAST_ETH_WAN, 0x00000004, "ETH_WAN"),\ DP_F_ENUM_OR_STRING(DP_F_FAST_WLAN, 0x00000008, "FAST_WLAN"),\
#define a enum #define DP_F_ENUM_OR_STRING(name,value, short_name) name = value enum DP_F_FLAG {
DP_F_FLAG_LIST
};
#map enum to string #undef DP_F_ENUM_OR_STRING #define DP_F_ENUM_OR_STRING(name,value, short_name) short_name char *dp_port_type_str[] = {
DP_F_FLAG_LIST
}; #undef DP_F_ENUM_OR_STRING
#map enum to an value array #undef DP_F_ENUM_OR_STRING #define DP_F_ENUM_OR_STRING(name,value, short_name) name uint32_t dp_port_flag[] = {
DP_F_FLAG_LIST
}; #undef DP_F_ENUM_OR_STRING
mywiki/linux/enum_string.1435304848.txt.gz · Last modified: (external edit)
