Assembly level enum management. More...
Classes | |
struct | enum_member_visitor_t |
Enum member visitor - see for_all_enum_members(). More... | |
Macros | |
#define | DEFMASK (bmask_t(-1)) |
default bitmask | |
#define | ENFL_REGEX 0x0001 |
apply regular expressions to beautify the name | |
Typedefs | |
typedef tid_t | enum_t |
Enums and bitfields. | |
typedef uval_t | bmask_t |
unsigned value that describes a bitmask a bit mask is 32/64 bits. More... | |
typedef uval_t | const_t |
members of enums | |
Functions | |
idaman size_t ida_export | get_enum_qty (void) |
Get number of declared enum_t types. | |
idaman enum_t ida_export | getn_enum (size_t idx) |
Get enum by its index in the list of enums (0..get_enum_qty()-1). | |
idaman uval_t ida_export | get_enum_idx (enum_t id) |
Get the index in the list of enums. | |
idaman enum_t ida_export | get_enum (const char *name) |
Get enum by name. | |
idaman bool ida_export | is_bf (enum_t id) |
Is enum a bitfield? (otherwise - plain enum, no bitmasks except for DEFMASK are allowed) | |
idaman bool ida_export | is_enum_hidden (enum_t id) |
Is enum collapsed? | |
idaman bool ida_export | set_enum_hidden (enum_t id, bool hidden) |
Collapse enum. | |
idaman bool ida_export | is_enum_fromtil (enum_t id) |
Does enum come from type library? | |
idaman bool ida_export | set_enum_fromtil (enum_t id, bool fromtil) |
Specify that enum comes from a type library. | |
idaman bool ida_export | is_ghost_enum (enum_t id) |
Is a ghost copy of a local type? | |
idaman bool ida_export | set_enum_ghost (enum_t id, bool ghost) |
Specify that enum is a ghost copy of a local type. | |
idaman ssize_t ida_export | get_enum_name (qstring *out, enum_t id) |
Get name of enum. | |
idaman ssize_t ida_export | get_enum_name2 (qstring *out, enum_t id, int flags=0) |
Get name of enum. More... | |
qstring | get_enum_name (tid_t id, int flags=0) |
idaman size_t ida_export | get_enum_width (enum_t id) |
Get the width of a enum element allowed values: 0 (unspecified),1,2,4,8,16,32,64. | |
idaman bool ida_export | set_enum_width (enum_t id, int width) |
See comment for get_enum_width() | |
idaman ssize_t ida_export | get_enum_cmt (qstring *buf, enum_t id, bool repeatable) |
Get enum comment. | |
idaman size_t ida_export | get_enum_size (enum_t id) |
Get the number of the members of the enum. | |
idaman flags64_t ida_export | get_enum_flag (enum_t id) |
Get flags determining the representation of the enum. More... | |
idaman const_t ida_export | get_enum_member_by_name (const char *name) |
Get a reference to an enum member by its name. | |
idaman uval_t ida_export | get_enum_member_value (const_t id) |
Get value of an enum member. | |
idaman enum_t ida_export | get_enum_member_enum (const_t id) |
Get the parent enum of an enum member. | |
idaman bmask_t ida_export | get_enum_member_bmask (const_t id) |
Get bitmask of an enum member. | |
idaman const_t ida_export | get_enum_member (enum_t id, uval_t value, int serial, bmask_t mask) |
Find an enum member by enum, value and bitmask. More... | |
Access to all used bitmasks in an enum | |
idaman bmask_t ida_export | get_first_bmask (enum_t enum_id) |
Get first bitmask in the enum (bitfield) More... | |
idaman bmask_t ida_export | get_last_bmask (enum_t enum_id) |
Get last bitmask in the enum (bitfield) More... | |
idaman bmask_t ida_export | get_next_bmask (enum_t enum_id, bmask_t bmask) |
Get next bitmask in the enum (bitfield) More... | |
idaman bmask_t ida_export | get_prev_bmask (enum_t enum_id, bmask_t bmask) |
Get prev bitmask in the enum (bitfield) More... | |
Access to all enum members with specified bitmask | |
| |
idaman uval_t ida_export | get_first_enum_member (enum_t id, bmask_t bmask=DEFMASK) |
idaman uval_t ida_export | get_last_enum_member (enum_t id, bmask_t bmask=DEFMASK) |
idaman uval_t ida_export | get_next_enum_member (enum_t id, uval_t value, bmask_t bmask=DEFMASK) |
idaman uval_t ida_export | get_prev_enum_member (enum_t id, uval_t value, bmask_t bmask=DEFMASK) |
idaman ssize_t ida_export | get_enum_member_name (qstring *out, const_t id) |
Get name of an enum member by const_t. | |
idaman ssize_t ida_export | get_enum_member_cmt (qstring *buf, const_t id, bool repeatable) |
Get enum member's comment. | |
Work with the bitmask name & comment | |
idaman bool ida_export | set_bmask_name (enum_t id, bmask_t bmask, const char *name) |
idaman ssize_t ida_export | get_bmask_name (qstring *out, enum_t id, bmask_t bmask) |
idaman bool ida_export | set_bmask_cmt (enum_t id, bmask_t bmask, const char *cmt, bool repeatable) |
idaman ssize_t ida_export | get_bmask_cmt (qstring *buf, enum_t id, bmask_t bmask, bool repeatable) |
Variables | |
const uchar | MAX_ENUM_SERIAL = 255 |
Max number of identical constants allowed for one enum type. | |
Access to all enum members with specified value and mask | |
A sample loop looks like this: const_t main_cid;
uchar serial;
cid != BADNODE;
cid = get_next_serial_enum_member(&serial, main_cid) )
{
...
}
The 'out_serial' argument of get_first_serial_enum_member/get_last_serial_enum_member can be nullptr. The 'in_out_serial' is required for the other functions. | |
#define | ENUM_MEMBER_ERROR_NAME 1 |
already have member with this name (bad name) | |
#define | ENUM_MEMBER_ERROR_VALUE 2 |
already have 256 members with this value | |
#define | ENUM_MEMBER_ERROR_ENUM 3 |
bad enum id | |
#define | ENUM_MEMBER_ERROR_MASK 4 |
bad bmask | |
#define | ENUM_MEMBER_ERROR_ILLV 5 |
bad bmask and value combination (~bmask & value != 0) | |
idaman const_t ida_export | get_first_serial_enum_member (uchar *out_serial, enum_t id, uval_t value, bmask_t bmask) |
idaman const_t ida_export | get_last_serial_enum_member (uchar *out_serial, enum_t id, uval_t value, bmask_t bmask) |
idaman const_t ida_export | get_next_serial_enum_member (uchar *in_out_serial, const_t first_cid) |
idaman const_t ida_export | get_prev_serial_enum_member (uchar *in_out_serial, const_t first_cid) |
idaman int ida_export | for_all_enum_members (enum_t id, enum_member_visitor_t &cv) |
Visit all members of a given enum. | |
idaman uchar ida_export | get_enum_member_serial (const_t cid) |
Get serial number of an enum member. | |
idaman int32 ida_export | get_enum_type_ordinal (enum_t id) |
Get corresponding type ordinal number. | |
idaman void ida_export | set_enum_type_ordinal (enum_t id, int32 ord) |
Set corresponding type ordinal number. | |
idaman enum_t ida_export | add_enum (size_t idx, const char *name, flags64_t flag) |
Add new enum type. More... | |
idaman void ida_export | del_enum (enum_t id) |
Delete an enum type. | |
idaman bool ida_export | set_enum_idx (enum_t id, size_t idx) |
Set serial number of enum. More... | |
idaman bool ida_export | set_enum_bf (enum_t id, bool bf) |
Set 'bitfield' bit of enum (i.e. convert it to a bitfield) | |
idaman bool ida_export | set_enum_name (enum_t id, const char *name) |
Set name of enum type. | |
idaman bool ida_export | set_enum_cmt (enum_t id, const char *cmt, bool repeatable) |
Set comment for enum type. | |
idaman bool ida_export | set_enum_flag (enum_t id, flags64_t flag) |
Set data representation flags. | |
idaman int ida_export | add_enum_member (enum_t id, const char *name, uval_t value, bmask_t bmask=DEFMASK) |
Add member to enum type. More... | |
idaman bool ida_export | del_enum_member (enum_t id, uval_t value, uchar serial, bmask_t bmask) |
Delete member of enum type. | |
idaman bool ida_export | set_enum_member_name (const_t id, const char *name) |
Set name of enum member. | |
bool | set_enum_member_cmt (const_t id, const char *cmt, bool repeatable) |
Set comment for enum member. | |
THREAD_SAFE bool | is_one_bit_mask (bmask_t mask) |
Is bitmask one bit? | |
Detailed Description
Assembly level enum management.
Enums and bitfields are represented as enum_t.
Typedef Documentation
◆ bmask_t
Function Documentation
◆ get_enum_name2()
Get name of enum.
- Parameters
-
[out] out buffer to hold the name id enum id flags Enum name flags
◆ get_enum_flag()
Get flags determining the representation of the enum.
(currently they define the numeric base: octal, decimal, hex, bin) and signness.
◆ get_enum_member()
Find an enum member by enum, value and bitmask.
- Note
- if serial -1, return a member with any serial
◆ get_first_bmask()
Get first bitmask in the enum (bitfield)
- Parameters
-
enum_id id of enum (bitfield)
- Returns
- the smallest bitmask for enum, or DEFMASK
◆ get_last_bmask()
Get last bitmask in the enum (bitfield)
- Parameters
-
enum_id id of enum
- Returns
- the biggest bitmask for enum, or DEFMASK
◆ get_next_bmask()
Get next bitmask in the enum (bitfield)
- Parameters
-
enum_id id of enum bmask the current bitmask
- Returns
- value of a bitmask with value higher than the specified value, or DEFMASK
◆ get_prev_bmask()
Get prev bitmask in the enum (bitfield)
- Parameters
-
enum_id id of enum bmask the current bitmask
- Returns
- value of a bitmask with value lower than the specified value, or DEFMASK
◆ add_enum()
Add new enum type.
- if idx==BADADDR then add as the last idx
- if name==nullptr then generate a unique name "enum_%d"
◆ set_enum_idx()
idaman bool ida_export set_enum_idx | ( | enum_t | id, |
size_t | idx | ||
) |
Set serial number of enum.
Also see get_enum_idx().
◆ add_enum_member()
idaman int ida_export add_enum_member | ( | enum_t | id, |
const char * | name, | ||
uval_t | value, | ||
bmask_t | bmask = DEFMASK |
||
) |
Add member to enum type.
- Returns
- 0 if ok, otherwise one of Add enum member result codes
Generated by