summaryrefslogtreecommitdiff
path: root/nasm.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-12 20:27:41 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-12 20:27:41 -0700
commit16b0a33ceae7b57cf4ebc9ab62cd4e1dc00dbf8c (patch)
tree8402b87bfea53a1b9c57069653c3b8f42e0f8b6e /nasm.h
parent7978feebd2fb0be9f4a37980090dfebeeb29a36d (diff)
downloadnasm-16b0a33ceae7b57cf4ebc9ab62cd4e1dc00dbf8c.tar.gz
nasm-16b0a33ceae7b57cf4ebc9ab62cd4e1dc00dbf8c.tar.bz2
nasm-16b0a33ceae7b57cf4ebc9ab62cd4e1dc00dbf8c.zip
Use enumerations where practical to ease debugging
We have a lot of enumerations; by declaring fields as such, we make it easier when debugging, since the debugger can display the enumerations in cleartext. However, make sure exceptional values (like -1) are included in the enumeration, since the compiler otherwise may not include it in the valid range of the enumeration.
Diffstat (limited to 'nasm.h')
-rw-r--r--nasm.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/nasm.h b/nasm.h
index 2efc3eb..ff1e80e 100644
--- a/nasm.h
+++ b/nasm.h
@@ -19,6 +19,8 @@
#include "config.h"
#endif
+#include "insnsi.h" /* For enum opcode */
+
#ifndef NULL
#define NULL 0
#endif
@@ -522,10 +524,11 @@ enum {
/* Register names automatically generated from regs.dat */
#include "regs.h"
-enum { /* condition code names */
+enum ccode { /* condition code names */
C_A, C_AE, C_B, C_BE, C_C, C_E, C_G, C_GE, C_L, C_LE, C_NA, C_NAE,
C_NB, C_NBE, C_NC, C_NE, C_NG, C_NGE, C_NL, C_NLE, C_NO, C_NP,
- C_NS, C_NZ, C_O, C_P, C_PE, C_PO, C_S, C_Z
+ C_NS, C_NZ, C_O, C_P, C_PE, C_PO, C_S, C_Z,
+ C_none = -1
};
/*
@@ -603,8 +606,8 @@ typedef struct { /* an instruction itself */
char *label; /* the label defined, or NULL */
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 */
+ enum opcode opcode; /* the opcode - not just the string */
+ enum ccode condition; /* the condition code, if Jcc/SETcc */
int operands; /* how many operands? 0-3
* (more if db et al) */
operand oprs[3]; /* the operands, defined as above */