diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-11 22:14:18 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-11 22:14:18 +0000 |
commit | b79f0d0cc336662d16a22e07ad429e8deb71c956 (patch) | |
tree | c3bd6f6f1808ca5d62a0554ac6f62c1acd405ca3 /nasm.h | |
parent | 2ba7ed7122eea2e594f2f67ea9427b7e702692cc (diff) | |
download | nasm-b79f0d0cc336662d16a22e07ad429e8deb71c956.tar.gz |
Use enums to make debugging easier
When we're dealing with a field which is guaranteed to have an enum type,
then declare it as such so it shows up in debuggers.
Diffstat (limited to 'nasm.h')
-rw-r--r-- | nasm.h | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -543,7 +543,7 @@ enum { /* condition code names */ * prefixes, we must ensure the enumerations for prefixes and * register names do not overlap. */ -enum { /* instruction prefixes */ +enum prefixes { /* instruction prefixes */ PREFIX_ENUM_START = REG_ENUM_LIMIT, P_A16 = PREFIX_ENUM_START, P_A32, P_LOCK, P_O16, P_O32, P_REP, P_REPE, P_REPNE, P_REPNZ, P_REPZ, P_TIMES @@ -562,7 +562,7 @@ enum { /* special EA flags */ EAF_FSGS = 32 /* fs/gs segment override present */ }; -enum { /* values for `hinttype' */ +enum eval_hint { /* values for `hinttype' */ EAH_NOHINT = 0, /* no hint at all - our discretion */ EAH_MAKEBASE = 1, /* try to make given reg the base */ EAH_NOTBASE = 2 /* try _not_ to make reg the base */ @@ -571,8 +571,10 @@ enum { /* values for `hinttype' */ typedef struct { /* operand to an instruction */ int32_t type; /* type of operand */ int addr_size; /* 0 means default; 16; 32; 64 */ - int basereg, indexreg, scale; /* registers and scale involved */ - int hintbase, hinttype; /* hint as to real base register */ + enum reg_enum basereg, indexreg; /* address registers */ + int scale; /* index scale */ + int hintbase; + enum eval_hint hinttype; /* hint as to real base register */ int32_t segment; /* immediate segment, if needed */ int64_t offset; /* any immediate number */ int32_t wrt; /* segment base it's relative to */ @@ -597,7 +599,7 @@ typedef struct extop { /* extended operand */ typedef struct { /* an instruction itself */ char *label; /* the label defined, or NULL */ - int prefixes[MAXPREFIX]; /* instruction prefixes, if any */ + enum prefixes prefixes[MAXPREFIX]; /* instruction prefixes, if any */ int nprefix; /* number of entries in above */ int opcode; /* the opcode - not just the string */ int condition; /* the condition code, if Jcc/SETcc */ @@ -931,7 +933,7 @@ struct dfmt { * ----- */ -enum { +enum special_tokens { S_ABS, S_BYTE, S_DWORD, S_FAR, S_LONG, S_NEAR, S_NOSPLIT, S_QWORD, S_REL, S_SHORT, S_STRICT, S_TO, S_TWORD, S_WORD }; |