mywiki:linux:enum_string
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mywiki:linux:enum_string [2015/06/26 15:47] – super | mywiki:linux:enum_string [2019/09/15 18:55] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| Map Enum to string array or its value array | Map Enum to string array or its value array | ||
| - | | + | < |
| + | #define DP_F_FLAG_LIST | ||
| DP_F_ENUM_OR_STRING(DP_F_DEREGISTER, | DP_F_ENUM_OR_STRING(DP_F_DEREGISTER, | ||
| DP_F_ENUM_OR_STRING(DP_F_FAST_ETH_LAN, | DP_F_ENUM_OR_STRING(DP_F_FAST_ETH_LAN, | ||
| DP_F_ENUM_OR_STRING(DP_F_FAST_ETH_WAN, | DP_F_ENUM_OR_STRING(DP_F_FAST_ETH_WAN, | ||
| DP_F_ENUM_OR_STRING(DP_F_FAST_WLAN, | DP_F_ENUM_OR_STRING(DP_F_FAST_WLAN, | ||
| + | </ | ||
| + | ====== define an enum ====== | ||
| - | #define a enum | + | < |
| #define DP_F_ENUM_OR_STRING(name, | #define DP_F_ENUM_OR_STRING(name, | ||
| enum DP_F_FLAG { | enum DP_F_FLAG { | ||
| DP_F_FLAG_LIST | DP_F_FLAG_LIST | ||
| }; | }; | ||
| + | </ | ||
| - | #map enum to string | + | |
| + | ====== | ||
| + | < | ||
| #undef DP_F_ENUM_OR_STRING | #undef DP_F_ENUM_OR_STRING | ||
| #define DP_F_ENUM_OR_STRING(name, | #define DP_F_ENUM_OR_STRING(name, | ||
| Line 22: | Line 28: | ||
| }; | }; | ||
| #undef DP_F_ENUM_OR_STRING | #undef DP_F_ENUM_OR_STRING | ||
| + | </ | ||
| - | + | ====== | |
| - | #map enum to an value array | + | < |
| #undef DP_F_ENUM_OR_STRING | #undef DP_F_ENUM_OR_STRING | ||
| - | #define DP_F_ENUM_OR_STRING(name, | + | #define DP_F_ENUM_OR_STRING(name, |
| uint32_t dp_port_flag[] = { | uint32_t dp_port_flag[] = { | ||
| DP_F_FLAG_LIST | DP_F_FLAG_LIST | ||
| }; | }; | ||
| #undef DP_F_ENUM_OR_STRING | #undef DP_F_ENUM_OR_STRING | ||
| + | </ | ||
| + | |||
mywiki/linux/enum_string.1435304867.txt.gz · Last modified: (external edit)
