summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-10 14:58:45 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-10 14:58:45 -0700
commit6867acc18ee541e361a5fa1e5a1bac3a478a3856 (patch)
treeb13b49a2e8227469c3eb7cb983e4b2bb27868466
parentbe1b83d24aee03d29913957fdba40cf7a268e660 (diff)
downloadnasm-6867acc18ee541e361a5fa1e5a1bac3a478a3856.tar.gz
Use the compiler-provided booleans if available, otherwise emulate
Both C and C++ have "bool", "true" and "false" in lower case; C requires <stdbool.h> for this, in C++ it is an inherent type built into the compiler. Use those instead of the old macros; emulate with a simple typedef enum if unavailable.
-rw-r--r--assemble.c18
-rw-r--r--compiler.h8
-rw-r--r--configure.in3
-rw-r--r--disasm.c96
-rw-r--r--eval.c18
-rw-r--r--exprlib.c22
-rw-r--r--float.c15
-rw-r--r--labels.c8
-rw-r--r--listing.c12
-rw-r--r--nasm.c70
-rw-r--r--nasm.h15
-rw-r--r--nasmlib.c16
-rw-r--r--nasmlib.h4
-rw-r--r--ndisasm.c8
-rw-r--r--output/outaout.c24
-rw-r--r--output/outas86.c12
-rw-r--r--output/outcoff.c34
-rw-r--r--output/outelf32.c50
-rw-r--r--output/outelf64.c52
-rw-r--r--output/outieee.c39
-rw-r--r--output/outobj.c52
-rw-r--r--parser.c18
-rw-r--r--preproc.c140
-rw-r--r--rdoff/rdlar.c75
-rw-r--r--stdscan.c4
25 files changed, 403 insertions, 410 deletions
diff --git a/assemble.c b/assemble.c
index 448a5d37..5d9d1d00 100644
--- a/assemble.c
+++ b/assemble.c
@@ -416,7 +416,7 @@ int32_t assemble(int32_t segment, int32_t offset, int bits, uint32_t cp,
/* Check to see if we need an address-size prefix */
add_asp(instruction, bits);
- size_prob = FALSE;
+ size_prob = false;
for (temp = nasm_instructions[instruction->opcode]; temp->opcode != -1; temp++){
int m = matches(temp, instruction, bits);
@@ -1827,7 +1827,7 @@ static int matches(const struct itemplate *itemp, insn * instruction, int bits)
static ea *process_ea(operand * input, ea * output, int addrbits,
int rfield, int32_t rflags, int forw_ref)
{
- output->rip = FALSE;
+ output->rip = false;
/* REX flags for the rfield operand */
output->rex |= rexflags(rfield, rflags, REX_R|REX_P|REX_W|REX_H);
@@ -1847,7 +1847,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits,
output->rex |= op_rexflags(input, REX_B|REX_P|REX_W|REX_H);
- output->sib_present = FALSE; /* no SIB necessary */
+ output->sib_present = false; /* no SIB necessary */
output->bytes = 0; /* no offset necessary either */
output->modrm = 0xC0 | ((rfield & 7) << 3) | (i & 7);
} else { /* it's a memory reference */
@@ -1859,16 +1859,16 @@ static ea *process_ea(operand * input, ea * output, int addrbits,
if (globalbits == 64 && (~input->type & IP_REL)) {
int scale, index, base;
- output->sib_present = TRUE;
+ output->sib_present = true;
scale = 0;
index = 4;
base = 5;
output->sib = (scale << 6) | (index << 3) | base;
output->bytes = 4;
output->modrm = 4 | ((rfield & 7) << 3);
- output->rip = FALSE;
+ output->rip = false;
} else {
- output->sib_present = FALSE;
+ output->sib_present = false;
output->bytes = (addrbits != 16 ? 4 : 2);
output->modrm = (addrbits != 16 ? 5 : 6) | ((rfield & 7) << 3);
output->rip = globalbits == 64;
@@ -1984,7 +1984,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits,
mod = 2;
}
- output->sib_present = FALSE;
+ output->sib_present = false;
output->bytes = (bt == -1 || mod == 2 ? 4 : mod);
output->modrm = (mod << 6) | ((rfield & 7) << 3) | rm;
} else {
@@ -2032,7 +2032,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits,
mod = 2;
}
- output->sib_present = TRUE;
+ output->sib_present = true;
output->bytes = (bt == -1 || mod == 2 ? 4 : mod);
output->modrm = (mod << 6) | ((rfield & 7) << 3) | 4;
output->sib = (scale << 6) | (index << 3) | base;
@@ -2119,7 +2119,7 @@ static ea *process_ea(operand * input, ea * output, int addrbits,
else
mod = 2;
- output->sib_present = FALSE; /* no SIB - it's 16-bit */
+ output->sib_present = false; /* no SIB - it's 16-bit */
output->bytes = mod; /* bytes of offset needed */
output->modrm = (mod << 6) | ((rfield & 7) << 3) | rm;
}
diff --git a/compiler.h b/compiler.h
index 5f35490e..3b36e97a 100644
--- a/compiler.h
+++ b/compiler.h
@@ -60,4 +60,12 @@ int vsnprintf(char *, size_t, const char *, va_list);
# endif
#endif
+#ifndef __cplusplus /* C++ has false, true, bool as keywords */
+# ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+# else
+typedef enum { false, true } bool;
+# endif
+#endif
+
#endif /* NASM_COMPILER_H */
diff --git a/configure.in b/configure.in
index c9969764..30877073 100644
--- a/configure.in
+++ b/configure.in
@@ -87,6 +87,9 @@ AC_CHECK_HEADERS(inttypes.h, , CFLAGS="$CFLAGS -I\$(top_srcdir)/inttypes")
dnl The standard header for str*casecmp is <strings.h>
AC_CHECK_HEADERS(strings.h)
+dnl Look for <stdbool.h>
+AC_CHECK_HEADERS(stdbool.h)
+
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
diff --git a/disasm.c b/disasm.c
index dc754707..570f562e 100644
--- a/disasm.c
+++ b/disasm.c
@@ -367,7 +367,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
{
uint8_t *r = (uint8_t *)(t->code);
uint8_t *origdata = data;
- int a_used = FALSE, o_used = FALSE;
+ bool a_used = false, o_used = false;
enum prefixes drep = 0;
uint8_t lock = prefix->lock;
int osize = prefix->osize;
@@ -382,7 +382,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
ins->rex = prefix->rex;
if (t->flags & (segsize == 64 ? IF_NOLONG : IF_LONG))
- return FALSE;
+ return false;
if (prefix->rep == 0xF2)
drep = P_REPNE;
@@ -396,7 +396,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
if (c >= 01 && c <= 03) {
while (c--)
if (*r++ != *data++)
- return FALSE;
+ return false;
} else if (c == 04) {
switch (*data++) {
case 0x07:
@@ -409,7 +409,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
ins->oprs[0].basereg = 3;
break;
default:
- return FALSE;
+ return false;
}
} else if (c == 05) {
switch (*data++) {
@@ -420,7 +420,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
ins->oprs[0].basereg = 5;
break;
default:
- return FALSE;
+ return false;
}
} else if (c == 06) {
switch (*data++) {
@@ -437,7 +437,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
ins->oprs[0].basereg = 3;
break;
default:
- return FALSE;
+ return false;
}
} else if (c == 07) {
switch (*data++) {
@@ -448,12 +448,12 @@ static int matches(const struct itemplate *t, uint8_t *data,
ins->oprs[0].basereg = 5;
break;
default:
- return FALSE;
+ return false;
}
} else if (c >= 010 && c <= 013) {
int t = *r++, d = *data++;
if (d < t || d > t + 7)
- return FALSE;
+ return false;
else {
ins->oprs[c - 010].basereg = (d-t)+
(ins->rex & REX_B ? 8 : 0);
@@ -536,7 +536,7 @@ static int matches(const struct itemplate *t, uint8_t *data,
data = do_ea(data, modrm, asize, segsize,
&ins->oprs[(c >> 3) & 07], ins);
if (!data)
- return FALSE;
+ return false;
ins->oprs[c & 07].basereg = ((modrm >> 3)&7)+
(ins->rex & REX_R ? 8 : 0);
} else if (c >= 0140 && c <= 0143) {
@@ -550,75 +550,75 @@ static int matches(const struct itemplate *t, uint8_t *data,
ins->drexdst = c & 3;
} else if (c == 0170) {
if (*data++)
- return FALSE;
+ return false;
} else if (c == 0171) {
data = do_drex(data, ins);
if (!data)
- return FALSE;
+ return false;
} else if (c >= 0200 && c <= 0277) {
int modrm = *data++;
if (((modrm >> 3) & 07) != (c & 07))
- return FALSE; /* spare field doesn't match up */
+ return false; /* spare field doesn't match up */
data = do_ea(data, modrm, asize, segsize,
&ins->oprs[(c >> 3) & 07], ins);
if (!data)
- return FALSE;
+ return false;
} else if (c == 0310) {
if (asize != 16)
- return FALSE;
+ return false;
else
- a_used = TRUE;
+ a_used = true;
} else if (c == 0311) {
if (asize == 16)
- return FALSE;
+ return false;
else
- a_used = TRUE;
+ a_used = true;
} else if (c == 0312) {
if (asize != segsize)
- return FALSE;
+ return false;
else
- a_used = TRUE;
+ a_used = true;
} else if (c == 0313) {
if (asize != 64)
- return FALSE;
+ return false;
else
- a_used = TRUE;
+ a_used = true;
} else if (c == 0320) {
if (osize != 16)
- return FALSE;
+ return false;
else
- o_used = TRUE;
+ o_used = true;
} else if (c == 0321) {
if (osize != 32)
- return FALSE;
+ return false;
else
- o_used = TRUE;
+ o_used = true;
} else if (c == 0322) {
if (osize != (segsize == 16) ? 16 : 32)
- return FALSE;
+ return false;
else
- o_used = TRUE;
+ o_used = true;
} else if (c == 0323) {
ins->rex |= REX_W; /* 64-bit only instruction */
osize = 64;
} else if (c == 0324) {
if (!(ins->rex & (REX_P|REX_W)) || osize != 64)
- return FALSE;
+ return false;
} else if (c == 0330) {
int t = *r++, d = *data++;
if (d < t || d > t + 15)
- return FALSE;
+ return false;
else
ins->condition = d - t;
} else if (c == 0331) {
if (prefix->rep)
- return FALSE;
+ return false;
} else if (c == 0332) {
if (prefix->rep != 0xF2)
- return FALSE;
+ return false;
} else if (c == 0333) {
if (prefix->rep != 0xF3)
- return FALSE;
+ return false;
drep = 0;
} else if (c == 0334) {
if (lock) {
@@ -630,31 +630,31 @@ static int matches(const struct itemplate *t, uint8_t *data,
drep = P_REPE;
} else if (c == 0364) {
if (prefix->osp)
- return FALSE;
+ return false;
} else if (c == 0365) {
if (prefix->asp)
- return FALSE;
+ return false;
} else if (c == 0366) {
if (!prefix->osp)
- return FALSE;
- o_used = TRUE;
+ return false;
+ o_used = true;
} else if (c == 0367) {
if (!prefix->asp)
- return FALSE;
- o_used = TRUE;
+ return false;
+ o_used = true;
}
}
/* REX cannot be combined with DREX */
if ((ins->rex & REX_D) && (prefix->rex))
- return FALSE;
+ return false;
/*
* Check for unused rep or a/o prefixes.
*/
for (i = 0; i < t->operands; i++) {
if (ins->oprs[i].segment != SEG_RMREG)
- a_used = TRUE;
+ a_used = true;
}
ins->nprefix = 0;
@@ -744,7 +744,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
p = (const struct itemplate * const *)ix->p;
for (n = ix->n; n; n--, p++) {
if ((length = matches(*p, data, &prefix, segsize, &tmp_ins))) {
- works = TRUE;
+ works = true;
/*
* Final check to make sure the types of r/m match up.
* XXX: Need to make sure this is actually correct.
@@ -765,7 +765,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
!whichreg((*p)->opd[i],
tmp_ins.oprs[i].basereg, tmp_ins.rex))
)) {
- works = FALSE;
+ works = false;
break;
}
}
@@ -850,7 +850,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
slen +=
snprintf(output + slen, outbufsize - slen, "%s",
insn_names[(*p)->opcode]);
- colon = FALSE;
+ colon = false;
length += data - origdata; /* fix up for prefixes */
for (i = 0; i < (*p)->operands; i++) {
opflags_t t = (*p)->opd[i];
@@ -880,9 +880,9 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
}
if (t & COLON)
- colon = TRUE;
+ colon = true;
else
- colon = FALSE;
+ colon = false;
if ((t & (REGISTER | FPUREG)) ||
(o->segment & SEG_RMREG)) {
@@ -934,7 +934,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
16 ? "word " : ""), offs);
segover = NULL;
} else if (!(REGMEM & ~t)) {
- int started = FALSE;
+ int started = false;
if (t & BITS8)
slen +=
snprintf(output + slen, outbufsize - slen, "byte ");
@@ -974,7 +974,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
slen += snprintf(output + slen, outbufsize - slen, "%s",
reg_names[(o->basereg -
EXPR_REG_START)]);
- started = TRUE;
+ started = true;
}
if (o->indexreg != -1) {
if (started)
@@ -986,7 +986,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
slen +=
snprintf(output + slen, outbufsize - slen, "*%d",
o->scale);
- started = TRUE;
+ started = true;
}
if (o->segment & SEG_DISP8) {
int minus = 0;
diff --git a/eval.c b/eval.c
index 3679f2d4..65290f26 100644
--- a/eval.c
+++ b/eval.c
@@ -223,7 +223,7 @@ static expr *segment_part(expr * e)
/*
* Recursive-descent parser. Called with a single boolean operand,
- * which is TRUE if the evaluation is critical (i.e. unresolved
+ * which is true if the evaluation is critical (i.e. unresolved
* symbols are an error condition). Must update the global `i' to
* reflect the token after the parsed string. May return NULL.
*
@@ -357,7 +357,7 @@ static expr *rexp3(int critical)
if (!f)
return NULL;
- e = add_vectors(e, scalar_mult(f, -1L, FALSE));
+ e = add_vectors(e, scalar_mult(f, -1L, false));
switch (j) {
case TOKEN_EQ:
@@ -365,9 +365,9 @@ static expr *rexp3(int critical)
if (is_unknown(e))
v = -1; /* means unknown */
else if (!is_really_simple(e) || reloc_value(e) != 0)
- v = (j == TOKEN_NE); /* unequal, so return TRUE if NE */
+ v = (j == TOKEN_NE); /* unequal, so return true if NE */
else
- v = (j == TOKEN_EQ); /* equal, so return TRUE if EQ */
+ v = (j == TOKEN_EQ); /* equal, so return true if EQ */
break;
default:
if (is_unknown(e))
@@ -528,7 +528,7 @@ static expr *expr4(int critical)
e = add_vectors(e, f);
break;
case '-':
- e = add_vectors(e, scalar_mult(f, -1L, FALSE));
+ e = add_vectors(e, scalar_mult(f, -1L, false));
break;
}
}
@@ -562,9 +562,9 @@ static expr *expr5(int critical)
switch (j) {
case '*':
if (is_simple(e))
- e = scalar_mult(f, reloc_value(e), TRUE);
+ e = scalar_mult(f, reloc_value(e), true);
else if (is_simple(f))
- e = scalar_mult(e, reloc_value(f), TRUE);
+ e = scalar_mult(e, reloc_value(f), true);
else if (is_just_unknown(e) && is_just_unknown(f))
e = unknown_expr();
else {
@@ -673,7 +673,7 @@ static expr *expr6(int critical)
e = expr6(critical);
if (!e)
return NULL;
- return scalar_mult(e, -1L, FALSE);
+ return scalar_mult(e, -1L, false);
case '+':
@@ -861,7 +861,7 @@ expr *evaluate(scanner sc, void *scprivate, struct tokenval *tv,
if (!f)
return NULL;
}
- e = scalar_mult(e, 1L, FALSE); /* strip far-absolute segment part */
+ e = scalar_mult(e, 1L, false); /* strip far-absolute segment part */
if (f) {
expr *g;
if (is_just_unknown(f))
diff --git a/exprlib.c b/exprlib.c
index 2f03ff0a..d116ee57 100644
--- a/exprlib.c
+++ b/exprlib.c
@@ -7,7 +7,7 @@
#include "nasm.h"
/*
- * Return TRUE if the argument is a simple scalar. (Or a far-
+ * Return true if the argument is a simple scalar. (Or a far-
* absolute, which counts.)
*/
int is_simple(expr * vect)
@@ -27,7 +27,7 @@ int is_simple(expr * vect)
}
/*
- * Return TRUE if the argument is a simple scalar, _NOT_ a far-
+ * Return true if the argument is a simple scalar, _NOT_ a far-
* absolute.
*/
int is_really_simple(expr * vect)
@@ -47,29 +47,29 @@ int is_really_simple(expr * vect)
}
/*
- * Return TRUE if the argument is relocatable (i.e. a simple
+ * Return true if the argument is relocatable (i.e. a simple
* scalar, plus at most one segment-base, plus possibly a WRT).
*/
int is_reloc(expr * vect)
{
while (vect->type && !vect->value) /* skip initial value-0 terms */
vect++;
- if (!vect->type) /* trivially return TRUE if nothing */
+ if (!vect->type) /* trivially return true if nothing */
return 1; /* is present apart from value-0s */
- if (vect->type < EXPR_SIMPLE) /* FALSE if a register is present */
+ if (vect->type < EXPR_SIMPLE) /* false if a register is present */
return 0;
if (vect->type == EXPR_SIMPLE) { /* skip over a pure number term... */
do {
vect++;
} while (vect->type && !vect->value);
- if (!vect->type) /* ...returning TRUE if that's all */
+ if (!vect->type) /* ...returning true if that's all */
return 1;
}
if (vect->type == EXPR_WRT) { /* skip over a WRT term... */
do {
vect++;
} while (vect->type && !vect->value);
- if (!vect->type) /* ...returning TRUE if that's all */
+ if (!vect->type) /* ...returning true if that's all */
return 1;
}
if (vect->value != 0 && vect->value != 1)
@@ -77,13 +77,13 @@ int is_reloc(expr * vect)
do { /* skip over _one_ seg-base term... */
vect++;
} while (vect->type && !vect->value);
- if (!vect->type) /* ...returning TRUE if that's all */
+ if (!vect->type) /* ...returning true if that's all */
return 1;
- return 0; /* And return FALSE if there's more */
+ return 0; /* And return false if there's more */
}
/*
- * Return TRUE if the argument contains an `unknown' part.
+ * Return true if the argument contains an `unknown' part.
*/
int is_unknown(expr * vect)
{
@@ -93,7 +93,7 @@ int is_unknown(expr * vect)
}
/*
- * Return TRUE if the argument contains nothing but an `unknown'
+ * Return true if the argument contains nothing but an `unknown'
* part.
*/
int is_just_unknown(expr * vect)
diff --git a/float.c b/float.c
index c6126890..7d7b7813 100644
--- a/float.c
+++ b/float.c
@@ -18,9 +18,6 @@
#include "nasm.h"
-#define TRUE 1
-#define FALSE 0
-
#define MANT_WORDS 10 /* 112 bits + 48 for accuracy == 160 */
#define MANT_DIGITS 49 /* 50 digits don't fit in 160 bits */
@@ -90,7 +87,7 @@ static void ieee_flconvert_hex(char *string, uint16_t *mant,
while ((c = *string++) != '\0') {
if (c == '.') {
if (!seendot)
- seendot = TRUE;
+ seendot = true;
else {
error(ERR_NONFATAL,
"too many periods in floating-point constant");
@@ -163,11 +160,11 @@ static void ieee_flconvert(char *string, uint16_t *mant,
p = digits;
tenpwr = 0;
- started = seendot = FALSE;
+ started = seendot = false;
while (*string && *string != 'E' && *string != 'e') {
if (*string == '.') {
if (!seendot)
- seendot = TRUE;
+ seendot = true;
else {
error(ERR_NONFATAL,
"too many periods in floating-point constant");
@@ -178,7 +175,7 @@ static void ieee_flconvert(char *string, uint16_t *mant,
if (seendot)
tenpwr--;
} else {
- started = TRUE;
+ started = true;
if (p < digits + sizeof(digits))
*p++ = *string - '0';
if (!seendot)
@@ -210,7 +207,7 @@ static void ieee_flconvert(char *string, uint16_t *mant,
*m = 0;
m = mant;
q = digits;
- started = FALSE;
+ started = false;
twopwr = 0;
while (m < mant + MANT_WORDS) {
uint16_t carry = 0;
@@ -229,7 +226,7 @@ static void ieee_flconvert(char *string, uint16_t *mant,
*r = i;
}
if (carry)
- *m |= bit, started = TRUE;
+ *m |= bit, started = true;
if (started) {
if (bit == 1)
bit = 0x8000, m++;
diff --git a/labels.c b/labels.c
index 2d2630d9..365330a3 100644
--- a/labels.c
+++ b/labels.c
@@ -88,7 +88,7 @@ static char *perm_copy(const char *string);
static char *prevlabel;
-static int initialized = FALSE;
+static int initialized = false;
char lprefix[PREFIX_MAX] = { 0 };
char lpostfix[PREFIX_MAX] = { 0 };
@@ -96,7 +96,7 @@ char lpostfix[PREFIX_MAX] = { 0 };
/*
* Internal routine: finds the `union label' corresponding to the
* given label name. Creates a new one, if it isn't found, and if
- * `create' is TRUE.
+ * `create' is true.
*/
static union label *find_label(char *label, int create)
{
@@ -386,7 +386,7 @@ int init_labels(void)
prevlabel = "";
- initialized = TRUE;
+ initialized = true;
return 0;
}
@@ -395,7 +395,7 @@ void cleanup_labels(void)
{
union label *lptr, *lhold;
- initialized = FALSE;
+ initialized = false;
hash_free(ltab);
diff --git a/listing.c b/listing.c
index 226a026e..c0d43c75 100644
--- a/listing.c
+++ b/listing.c
@@ -76,7 +76,7 @@ static void list_emit(void)
fprintf(listfp, " %s", listline);
fputc('\n', listfp);
- listlinep = FALSE;
+ listlinep = false;
listdata[0] = '\0';
}
@@ -90,13 +90,13 @@ static void list_init(char *fname, efunc error)
*listline = '\0';
listlineno = 0;
- listp = TRUE;
+ listp = true;
listlevel = 0;
suppress = 0;
mistack = nasm_malloc(sizeof(MacroInhibit));
mistack->next = NULL;
mistack->level = 0;
- mistack->inhibiting = TRUE;
+ mistack->inhibiting = true;
}
static void list_cleanup(void)
@@ -232,7 +232,7 @@ static void list_line(int type, char *line)
}
}
list_emit();
- listlinep = TRUE;
+ listlinep = true;
strncpy(listline, line, LIST_MAX_LEN - 1);
listline[LIST_MAX_LEN - 1] = '\0';
listlevel_e = listlevel;
@@ -254,13 +254,13 @@ static void list_uplevel(int type)
MacroInhibit *temp = nasm_malloc(sizeof(MacroInhibit));
temp->next = mistack;
temp->level = listlevel;
- temp->inhibiting = FALSE;
+ temp->inhibiting = false;
mistack = temp;
} else if (type == LIST_MACRO_NOLIST) {
MacroInhibit *temp = nasm_malloc(sizeof(MacroInhibit));
temp->next = mistack;
temp->level = listlevel;
- temp->inhibiting = TRUE;
+ temp->inhibiting = true;
mistack = temp;
}
}
diff --git a/nasm.c b/nasm.c
index 86ac2d1d..3b7dfd17 100644
--- a/nasm.c
+++ b/nasm.c
@@ -48,7 +48,7 @@ static void usage(void);
static efunc report_error;
static int using_debug_info, opt_verbose_info;
-int tasm_compatible_mode = FALSE;
+bool tasm_compatible_mode = false;
int pass0;
int maxbits = 0;
int globalrel = 0;
@@ -94,7 +94,7 @@ static enum op_type operating_mode;
* doesn't do anything. Initial defaults are given here.
*/
static char suppressed[1 + ERR_WARN_MAX] = {
- 0, TRUE, TRUE, TRUE, FALSE, TRUE
+ 0, true, true, true, false, true
};
/*
@@ -159,7 +159,7 @@ static void nasm_fputs(const char *line, FILE * outfile)
int main(int argc, char **argv)
{
pass0 = 1;
- want_usage = terminate_after_phase = FALSE;
+ want_usage = terminate_after_phase = false;
report_error = report_error_gnu;
error_file = stderr;
@@ -235,7 +235,7 @@ int main(int argc, char **argv)
} else
ofile = NULL;
- location.known = FALSE;
+ location.known = false;
/* pass = 1; */
preproc->reset(inname, 2, report_error, evaluate, &nasmlist);
@@ -432,7 +432,7 @@ static int process_arg(char *p, char *q)
case 'v':
case '+':
param++;
- opt_verbose_info = TRUE;
+ opt_verbose_info = true;
break;
case 'x':
@@ -480,7 +480,7 @@ static int process_arg(char *p, char *q)
}
break;
case 'g':
- using_debug_info = TRUE;
+ using_debug_info = true;
break;
case 'h':
printf
@@ -531,7 +531,7 @@ static int process_arg(char *p, char *q)
exit(0);
break;
case 't':
- tasm_compatible_mode = TRUE;
+ tasm_compatible_mode = true;
break;
case 'v':
{
@@ -859,8 +859,8 @@ static void assemble_file(char *fname)
if (*listname)
nasmlist.init(listname, report_error);
}
- in_abs_seg = FALSE;
- global_offset_changed = FALSE; /* set by redefine_label */
+ in_abs_seg = false;
+ global_offset_changed = false; /* set by redefine_label */
location.segment = ofmt->section(NULL, pass2, &sb);
globalbits = sb;
if (pass > 1) {
@@ -872,7 +872,7 @@ static void assemble_file(char *fname)
preproc->reset(fname, pass1, report_error, evaluate, &nasmlist);
globallineno = 0;
if (pass == 1)
- location.known = TRUE;
+ location.known = true;
location.offset = offs = GET_CURR_OFFS;
while ((line = preproc->getline())) {
@@ -894,7 +894,7 @@ static void assemble_file(char *fname)
"segment name `%s' not recognized",
value);
} else {
- in_abs_seg = FALSE;
+ in_abs_seg = false;
location.segment = seg;
}
break;
@@ -911,12 +911,12 @@ static void assemble_file(char *fname)
}
} else if (pass == 1) { /* pass == 1 */
q = value;
- validid = TRUE;
+ validid = true;
if (!isidstart(*q))
- validid = FALSE;
+ validid = false;
while (*q && *q != ':') {
if (!isidchar(*q))
- validid = FALSE;
+ validid = false;
q++;
}
if (!validid) {
@@ -935,7 +935,7 @@ static void assemble_file(char *fname)
declare_as_global(value, special,
report_error);
define_label(value, seg_alloc(), 0L, NULL,
- FALSE, TRUE, ofmt, report_error);
+ false, true, ofmt, report_error);
pass0 = temp;
}
} /* else pass0 == 1 */
@@ -956,12 +956,12 @@ static void assemble_file(char *fname)
}
} else if (pass2 == 1) { /* pass == 1 */
q = value;
- validid = TRUE;
+ validid = true;
if (!isidstart(*q))
- validid = FALSE;
+ validid = false;
while (*q && *q != ':') {
if (!isidchar(*q))
- validid = FALSE;
+ validid = false;
q++;
}
if (!validid) {
@@ -982,12 +982,12 @@ static void assemble_file(char *fname)
value++; /* skip initial $ if present */
if (pass0 == 1) {
p = value;
- validid = TRUE;
+ validid = true;
if (!isidstart(*p))
- validid = FALSE;
+ validid = false;
while (*p && !isspace(*p)) {
if (!isidchar(*p))
- validid = FALSE;
+ validid = false;
p++;
}
if (!validid) {
@@ -1054,18 +1054,18 @@ static void assemble_file(char *fname)
else
report_error(ERR_PANIC, "invalid ABSOLUTE address "
"in pass two");
- in_abs_seg = TRUE;
+ in_abs_seg = true;
location.segment = NO_SEG;
break;
case D_DEBUG: /* [DEBUG] */
p = value;
q = debugid;
- validid = TRUE;
+ validid = true;
if (!isidstart(*p))
- validid = FALSE;
+ validid = false;
while (*p && !isspace(*p)) {
if (!isidchar(*p))
- validid = FALSE;
+ validid = false;
*q++ = *p++;
}
*q++ = 0;
@@ -1085,10 +1085,10 @@ static void assemble_file(char *fname)
value++;
if (*value == '+' || *value == '-') {
- validid = (*value == '-') ? TRUE : FALSE;
+ validid = (*value == '-') ? true : false;
value++;
} else
- validid = FALSE;
+ validid = false;
for (i = 1; i <= ERR_WARN_MAX; i++)
if (!nasm_stricmp(value, suppressed_names[i]))
@@ -1155,7 +1155,7 @@ static void assemble_file(char *fname)
if (!(optimizing > 0) && pass == 2) {
if (forwref != NULL && globallineno == forwref->lineno) {
- output_ins.forw_ref = TRUE;
+ output_ins.forw_ref = true;
do {
output_ins.oprs[forwref->operand].opflags |=
OPFLAG_FORWARD;
@@ -1163,7 +1163,7 @@ static void assemble_file(char *fname)
} while (forwref != NULL
&& forwref->lineno == globallineno);
} else
- output_ins.forw_ref = FALSE;
+ output_ins.forw_ref = false;
}
if (!(optimizing > 0) && output_ins.forw_ref) {
@@ -1234,7 +1234,7 @@ static void assemble_file(char *fname)
def_label(output_ins.label,
output_ins.oprs[0].segment,
output_ins.oprs[0].offset, NULL,
- FALSE, isext, ofmt,
+ false, isext, ofmt,
report_error);
} else if (output_ins.operands == 2
&& (output_ins.oprs[0].
@@ -1253,7 +1253,7 @@ static void assemble_file(char *fname)
output_ins.oprs[0].
offset | SEG_ABS,
output_ins.oprs[1].offset, NULL,
- FALSE, FALSE, ofmt,
+ false, false, ofmt,
report_error);
} else
report_error(ERR_NONFATAL,
@@ -1272,7 +1272,7 @@ static void assemble_file(char *fname)
define_label(output_ins.label,
output_ins.oprs[0].segment,
output_ins.oprs[0].offset,
- NULL, FALSE, FALSE, ofmt,
+ NULL, false, false, ofmt,
report_error);
} else if (output_ins.operands == 2
&& (output_ins.oprs[0].
@@ -1288,7 +1288,7 @@ static void assemble_file(char *fname)
output_ins.oprs[0].
offset | SEG_ABS,
output_ins.oprs[1].offset,
- NULL, FALSE, FALSE, ofmt,
+ NULL, false, false, ofmt,
report_error);
} else
report_error(ERR_NONFATAL,
@@ -1596,7 +1596,7 @@ static void report_error_common(int severity, const char *fmt,
fputc('\n', error_file);
if (severity & ERR_USAGE)
- want_usage = TRUE;
+ want_usage = true;
switch (severity & ERR_MASK) {
case ERR_WARNING:
@@ -1605,7 +1605,7 @@ static void report_error_common(int severity, const char *fmt,
break;
case ERR_NONFATAL:
/* hack enables listing(!) on errors */
- terminate_after_phase = TRUE;
+ terminate_after_phase = true;
break;
case ERR_FATAL:
if (ofile) {
diff --git a/nasm.h b/nasm.h
index 068049b4..c9ec461a 100644
--- a/nasm.h
+++ b/nasm.h
@@ -19,17 +19,6 @@
#include "nasmlib.h"
#include "insnsi.h" /* For enum opcode */
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef FALSE
-#define FALSE 0 /* comes in handy */
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
#define NO_SEG -1L /* null segment value */
#define SEG_ABS 0x40000000L /* mask for far-absolute segments */
@@ -242,7 +231,7 @@ struct eval_hints {
* it will start by calling the scanner.
*
* If a forward reference happens during evaluation, the evaluator
- * must set `*fwref' to TRUE if `fwref' is non-NULL.
+ * must set `*fwref' to true if `fwref' is non-NULL.
*
* `critical' is non-zero if the expression may not contain forward
* references. The evaluator will report its own error if this
@@ -978,7 +967,7 @@ enum special_tokens {
extern int pass0;
-extern int tasm_compatible_mode;
+extern bool tasm_compatible_mode;
extern int optimizing;
extern int globalbits; /* 16, 32 or 64-bit mode */
extern int globalrel; /* default to relative addressing? */
diff --git a/nasmlib.c b/nasmlib.c
index 0a0bb950..aca2af42 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -202,10 +202,10 @@ int64_t readnum(char *str, int *error)
int32_t radix;
uint64_t result, checklimit;
int digit, last;
- int warn = FALSE;
+ int warn = false;
int sign = 1;
- *error = FALSE;
+ *error = false;
while (isspace(*r))
r++; /* find start of number */
@@ -249,7 +249,7 @@ int64_t readnum(char *str, int *error)
* now.
*/
if (r >= q) {
- *error = TRUE;
+ *error = true;
return 0;
}
@@ -274,11 +274,11 @@ int64_t readnum(char *str, int *error)
while (*r && r < q) {
if (*r < '0' || (*r > '9' && *r < 'A')
|| (digit = numvalue(*r)) >= radix) {
- *error = TRUE;
+ *error = true;
return 0;
}
if (result > checklimit || (result == checklimit && digit >= last)) {
- warn = TRUE;
+ warn = true;
}
result = radix * result + digit;
@@ -298,19 +298,19 @@ int64_t readstrnum(char *str, int length, int *warn)
int64_t charconst = 0;
int i;
- *warn = FALSE;
+ *warn = false;
str += length;
if (globalbits == 64) {
for (i = 0; i < length; i++) {
if (charconst & 0xFF00000000000000ULL)
- *warn = TRUE;
+ *warn = true;
charconst = (charconst << 8) + (uint8_t)*--str;
}
} else {
for (i = 0; i < length; i++) {
if (charconst & 0xFF000000UL)
- *warn = TRUE;
+ *warn = true;
charconst = (charconst << 8) + (uint8_t)*--str;
}
}
diff --git a/nasmlib.h b/nasmlib.h
index 857fa0b7..3f839cf2 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -128,13 +128,13 @@ char *nasm_strsep(char **stringp, const char *delim);
/*
* Convert a string into a number, using NASM number rules. Sets
- * `*error' to TRUE if an error occurs, and FALSE otherwise.
+ * `*error' to true if an error occurs, and false otherwise.
*/
int64_t readnum(char *str, int *error);
/*
* Convert a character constant into a number. Sets
- * `*warn' to TRUE if an overflow occurs, and FALSE otherwise.
+ * `*warn' to true if an overflow occurs, and false otherwise.
* str points to and length covers the middle of the string,
* without the quotes.
*/
diff --git a/ndisasm.c b/ndisasm.c
index a6664315..db9bf5a9 100644
--- a/ndisasm.c
+++ b/ndisasm.c
@@ -59,9 +59,9 @@ int main(int argc, char **argv)
uint32_t nextsync, synclen, initskip = 0L;
int lenread;
int32_t lendis;
- int autosync = FALSE;
+ bool autosync = false;
int bits = 16, b;
- int eof = FALSE;
+ bool eof = false;
uint32_t prefer = 0;
int rn_error;
int32_t offset;
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
switch (tolower(*p)) {
case 'a': /* auto or intelligent sync */
case 'i':
- autosync = TRUE;
+ autosync = true;
p++;
break;
case 'h':
@@ -264,7 +264,7 @@ int main(int argc, char **argv)
if (to_read) {
lenread = fread(p, 1, to_read, fp);
if (lenread == 0)
- eof = TRUE; /* help along systems with bad feof */
+ eof = true; /* help along systems with bad feof */
} else
lenread = 0;
p += lenread;
diff --git a/output/outaout.c b/output/outaout.c
index 6c9bf242..2c7f7d69 100644
--- a/output/outaout.c
+++ b/output/outaout.c
@@ -153,7 +153,7 @@ static void aoutg_init(FILE * fp, efunc errfunc, ldfunc ldef,
static void aout_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
{
- bsd = FALSE;
+ bsd = false;
aoutg_init(fp, errfunc, ldef, eval);
aout_gotpc_sect = aout_gotoff_sect = aout_got_sect =
@@ -169,25 +169,25 @@ extern struct ofmt of_aoutb;
static void aoutb_init(FILE * fp, efunc errfunc, ldfunc ldef,
evalfunc eval)
{
- bsd = TRUE;
+ bsd = true;
aoutg_init(fp, errfunc, ldef, eval);
is_pic = 0x00; /* may become 0x40 */
aout_gotpc_sect = seg_alloc();
- ldef("..gotpc", aout_gotpc_sect + 1, 0L, NULL, FALSE, FALSE, &of_aoutb,
+ ldef("..gotpc", aout_gotpc_sect + 1, 0L, NULL, false, false, &of_aoutb,
error);
aout_gotoff_sect = seg_alloc();
- ldef("..gotoff", aout_gotoff_sect + 1, 0L, NULL, FALSE, FALSE,
+ ldef("..gotoff", aout_gotoff_sect + 1, 0L, NULL, false, false,
&of_aoutb, error);
aout_got_sect = seg_alloc();
- ldef("..got", aout_got_sect + 1, 0L, NULL, FALSE, FALSE, &of_aoutb,
+ ldef("..got", aout_got_sect + 1, 0L, NULL, false, false, &of_aoutb,
error);
aout_plt_sect = seg_alloc();
- ldef("..plt", aout_plt_sect + 1, 0L, NULL, FALSE, FALSE, &of_aoutb,
+ ldef("..plt", aout_plt_sect + 1, 0L, NULL, false, false, &of_aoutb,
error);
aout_sym_sect = seg_alloc();
- ldef("..sym", aout_sym_sect + 1, 0L, NULL, FALSE, FALSE, &of_aoutb,
+ ldef("..sym", aout_sym_sect + 1, 0L, NULL, false, false, &of_aoutb,
error);
}
@@ -250,7 +250,7 @@ static void aout_deflabel(char *name, int32_t segment, int32_t offset,
{
int pos = strslen + 4;
struct Symbol *sym;
- int special_used = FALSE;
+ int special_used = false;
if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
/*
@@ -361,7 +361,7 @@ static void aout_deflabel(char *name, int32_t segment, int32_t offset,
if (special[n]) {
struct tokenval tokval;
expr *e;
- int fwd = FALSE;
+ int fwd = false;
char *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */
if (!bsd) {
@@ -394,7 +394,7 @@ static void aout_deflabel(char *name, int32_t segment, int32_t offset,
}
stdscan_bufptr = saveme; /* bugfix? fbk 8/10/00 */
}
- special_used = TRUE;
+ special_used = true;
}
}
@@ -649,11 +649,11 @@ static void aout_out(int32_t segto, const void *data, uint32_t type,
is_pic = 0x40;
addr =
aout_add_gsym_reloc(s, segment, addr, RELTYPE_GOT,
- realbytes, TRUE);
+ realbytes, true);
} else if (wrt == aout_sym_sect + 1) {
addr = aout_add_gsym_reloc(s, segment, addr,
RELTYPE_ABSOLUTE, realbytes,
- FALSE);
+ false);
} else if (wrt == aout_plt_sect + 1) {
is_pic = 0x40;
error(ERR_NONFATAL,
diff --git a/output/outas86.c b/output/outas86.c
index 4bfbb04b..351aa047 100644
--- a/output/outas86.c
+++ b/output/outas86.c
@@ -24,17 +24,17 @@
struct Piece {
struct Piece *next;
int type; /* 0 = absolute, 1 = seg, 2 = sym */
- int32_t offset; /* relative offset */
- int number; /* symbol/segment number (4=bss) */
- int32_t bytes; /* size of reloc or of absolute data */
- int relative; /* TRUE or FALSE */
+ int32_t offset; /* relative offset */
+ int number; /* symbol/segment number (4=bss) */
+ int32_t bytes; /* size of reloc or of absolute data */
+ bool relative; /* relative address? */
};
struct Symbol {
- int32_t strpos; /* string table position of name */
+ int32_t strpos; /* string table position of name */
int flags; /* symbol flags */
int segment; /* 4=bss at this point */
- int32_t value; /* address, or COMMON variable size */
+ int32_t value; /* address, or COMMON variable size */
};
/*
diff --git a/output/outcoff.c b/output/outcoff.c
index 44a41e5a..c9e780cd 100644
--- a/output/outcoff.c
+++ b/output/outcoff.c
@@ -66,28 +66,28 @@
*/
/* Flag which version of COFF we are currently outputting. */
-static int win32, win64;
+static bool win32, win64;
struct Reloc {
struct Reloc *next;
- int32_t address; /* relative to _start_ of section */
- int32_t symbol; /* symbol number */
+ int32_t address; /* relative to _start_ of section */
+ int32_t symbol; /* symbol number */
enum {
SECT_SYMBOLS,
ABS_SYMBOL,
REAL_SYMBOLS
} symbase; /* relocation for symbol number :) */
- int relative; /* TRUE or FALSE */
- int size64; /* TRUE or FALSE */
+ bool relative;
+ bool size64;
};
struct Symbol {
char name[9];
- int32_t strpos; /* string table position of name */
+ int32_t strpos; /* string table position of name */
+ int32_t value; /* address, or COMMON variable size */
int section; /* section number where it's defined
* - in COFF codes, not NASM codes */
- int is_global; /* is it a global symbol or not? */
- int32_t value; /* address, or COMMON variable size */
+ bool is_global; /* is it a global symbol or not? */
};
static FILE *coffp;
@@ -138,7 +138,7 @@ static void coff_write_symbols(void);
static void coff_win32_init(FILE * fp, efunc errfunc,
ldfunc ldef, evalfunc eval)
{
- win32 = TRUE; win64 = FALSE;
+ win32 = true; win64 = false;
(void)ldef; /* placate optimizers */
(void)eval;
coff_gen_init(fp, errfunc);
@@ -148,7 +148,7 @@ static void coff_win64_init(FILE * fp, efunc errfunc,
ldfunc ldef, evalfunc eval)
{
maxbits = 64;
- win32 = FALSE; win64 = TRUE;
+ win32 = false; win64 = true;
(void)ldef; /* placate optimizers */
(void)eval;
coff_gen_init(fp, errfunc);
@@ -157,7 +157,7 @@ static void coff_win64_init(FILE * fp, efunc errfunc,
static void coff_std_init(FILE * fp, efunc errfunc, ldfunc ldef,
evalfunc eval)
{
- win32 = win64 = FALSE;
+ win32 = win64 = false;
(void)ldef; /* placate optimizers */
(void)eval;
coff_gen_init(fp, errfunc);
@@ -396,7 +396,7 @@ static void coff_deflabel(char *name, int32_t segment, int32_t offset,
break;
}
if (!sym->section)
- sym->is_global = TRUE;
+ sym->is_global = true;
}
if (is_global == 2)
sym->value = offset;
@@ -532,7 +532,7 @@ static void coff_out(int32_t segto, const void *data, uint32_t type,
error(ERR_NONFATAL, "COFF format does not support"
" segment base references");
} else
- fix = coff_add_reloc(s, segment, FALSE, FALSE);
+ fix = coff_add_reloc(s, segment, false, false);
}
p = mydata;
WRITELONG(p, *(int32_t *)data + fix);
@@ -550,13 +550,13 @@ static void coff_out(int32_t segto, const void *data, uint32_t type,
error(ERR_NONFATAL, "COFF format does not support"
" segment base references");
} else
- fix = coff_add_reloc(s, segment, FALSE);
+ fix = coff_add_reloc(s, segment, false);
} */
- fix = coff_add_reloc(s, segment, FALSE, TRUE);
+ fix = coff_add_reloc(s, segment, false, true);
WRITEDLONG(p, *(int64_t *)data + fix);
coff_sect_write(s, mydata, realbytes);
} else {
- fix = coff_add_reloc(s, segment, FALSE, FALSE);
+ fix = coff_add_reloc(s, segment, false, false);
WRITELONG(p, *(int32_t *)data + fix);
coff_sect_write(s, mydata, realbytes);
}
@@ -576,7 +576,7 @@ static void coff_out(int32_t segto, const void *data, uint32_t type,
error(ERR_NONFATAL, "COFF format does not support"
" segment base references");
} else
- fix = coff_add_reloc(s, segment, TRUE, FALSE);
+ fix = coff_add_reloc(s, segment, true, false);
p = mydata;
if (win32 | win64) {
WRITELONG(p, *(int32_t *)data + 4 - realbytes + fix);
diff --git a/output/outelf32.c b/output/outelf32.c
index ca918487..344546a6 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -147,7 +147,7 @@ static int32_t elf_foffs;
static void elf_write(void);
static void elf_sect_write(struct Section *, const uint8_t *,
uint32_t);
-static void elf_section_header(int, int, int, void *, int, int32_t, int, int,
+static void elf_section_header(int, int, int, void *, bool, int32_t, int, int,
int, int);
static void elf_write_sections(void);
static struct SAA *elf_build_symtab(int32_t *, int32_t *);
@@ -241,19 +241,19 @@ static void elf_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
fwds = NULL;
elf_gotpc_sect = seg_alloc();
- ldef("..gotpc", elf_gotpc_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf32,
+ ldef("..gotpc", elf_gotpc_sect + 1, 0L, NULL, false, false, &of_elf32,
error);
elf_gotoff_sect = seg_alloc();
- ldef("..gotoff", elf_gotoff_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf32,
+ ldef("..gotoff", elf_gotoff_sect + 1, 0L, NULL, false, false, &of_elf32,
error);
elf_got_sect = seg_alloc();
- ldef("..got", elf_got_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf32,
+ ldef("..got", elf_got_sect + 1, 0L, NULL, false, false, &of_elf32,
error);
elf_plt_sect = seg_alloc();
- ldef("..plt", elf_plt_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf32,
+ ldef("..plt", elf_plt_sect + 1, 0L, NULL, false, false, &of_elf32,
error);
elf_sym_sect = seg_alloc();
- ldef("..sym", elf_sym_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf32,
+ ldef("..sym", elf_sym_sect + 1, 0L, NULL, false, false, &of_elf32,
error);
def_seg = seg_alloc();
@@ -440,7 +440,7 @@ static void elf_deflabel(char *name, int32_t segment, int32_t offset,
{
int pos = strslen;
struct Symbol *sym;
- int special_used = FALSE;
+ bool special_used = false;
#if defined(DEBUG) && DEBUG>2
fprintf(stderr,
@@ -546,7 +546,7 @@ static void elf_deflabel(char *name, int32_t segment, int32_t offset,
error(ERR_NONFATAL, "alignment constraint `%s' is not a"
" power of two", special);
}
- special_used = TRUE;
+ special_used = true;
} else
sym->value = (sym->section == SHN_UNDEF ? 0 : offset);
@@ -611,7 +611,7 @@ static void elf_deflabel(char *name, int32_t segment, int32_t offset,
if (*special) {
struct tokenval tokval;
expr *e;
- int fwd = FALSE;
+ int fwd = 0;
char *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */
while (special[n] && isspace(special[n]))
@@ -638,7 +638,7 @@ static void elf_deflabel(char *name, int32_t segment, int32_t offset,
}
stdscan_bufptr = saveme; /* bugfix? fbk 8/10/00 */
}
- special_used = TRUE;
+ special_used = true;
}
}
sym->globnum = nglobs;
@@ -699,7 +699,7 @@ static void elf_add_reloc(struct Section *sect, int32_t segment, int type)
*/
static int32_t elf_add_gsym_reloc(struct Section *sect,
int32_t segment, int32_t offset,
- int type, int exact)
+ int type, bool exact)
{
struct Reloc *r;
struct Section *s;
@@ -859,15 +859,15 @@ static void elf_out(int32_t segto, const void *data, uint32_t type,
elf_add_reloc(s, segment, R_386_GOTOFF);
} else if (wrt == elf_got_sect + 1) {
addr = elf_add_gsym_reloc(s, segment, addr,
- R_386_GOT32, TRUE);
+ R_386_GOT32, true);
} else if (wrt == elf_sym_sect + 1) {
if (realbytes == 2) {
gnu16 = 1;
addr = elf_add_gsym_reloc(s, segment, addr,
- R_386_16, FALSE);
+ R_386_16, false);
} else {
addr = elf_add_gsym_reloc(s, segment, addr,
- R_386_32, FALSE);
+ R_386_32, false);
}
} else if (wrt == elf_plt_sect + 1) {
error(ERR_NONFATAL, "ELF format cannot produce non-PC-"
@@ -1030,31 +1030,31 @@ static void elf_write(void)
elf_nsect = 0;
elf_sects = nasm_malloc(sizeof(*elf_sects) * (2 * nsects + 10));
- elf_section_header(0, 0, 0, NULL, FALSE, 0L, 0, 0, 0, 0); /* SHN_UNDEF */
+ elf_section_header(0, 0, 0, NULL, false, 0L, 0, 0, 0, 0); /* SHN_UNDEF */
scount = 1; /* needed for the stabs debugging to track the symtable section */
p = shstrtab + 1;
for (i = 0; i < nsects; i++) {
elf_section_header(p - shstrtab, sects[i]->type, sects[i]->flags,
(sects[i]->type == SHT_PROGBITS ?
- sects[i]->data : NULL), TRUE,
+ sects[i]->data : NULL), true,
sects[i]->len, 0, 0, sects[i]->align, 0);
p += strlen(p) + 1;
scount++; /* dito */
}
- elf_section_header(p - shstrtab, 1, 0, comment, FALSE, (int32_t)commlen, 0, 0, 1, 0); /* .comment */
+ elf_section_header(p - shstrtab, 1, 0, comment, false, (int32_t)commlen, 0, 0, 1, 0); /* .comment */
scount++; /* dito */
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 3, 0, shstrtab, FALSE, (int32_t)shstrtablen, 0, 0, 1, 0); /* .shstrtab */
+ elf_section_header(p - shstrtab, 3, 0, shstrtab, false, (int32_t)shstrtablen, 0, 0, 1, 0); /* .shstrtab */
scount++; /* dito */
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 2, 0, symtab, TRUE, symtablen, nsects + 4, symtablocal, 4, 16); /* .symtab */
+ elf_section_header(p - shstrtab, 2, 0, symtab, true, symtablen, nsects + 4, symtablocal, 4, 16); /* .symtab */
symtabsection = scount; /* now we got the symtab section index in the ELF file */
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 3, 0, strs, TRUE, strslen, 0, 0, 1, 0); /* .strtab */
+ elf_section_header(p - shstrtab, 3, 0, strs, true, strslen, 0, 0, 1, 0); /* .strtab */
for (i = 0; i < nsects; i++)
if (sects[i]->head) {
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 9, 0, sects[i]->rel, TRUE,
+ elf_section_header(p - shstrtab, 9, 0, sects[i]->rel, true,
sects[i]->rellen, nsects + 3, i + 1, 4, 8);
}
if (of_elf32.current_dfmt == &df_stabs) {
@@ -1066,16 +1066,16 @@ static void elf_write(void)
if ((stabbuf) && (stabstrbuf) && (stabrelbuf)) {
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 1, 0, stabbuf, 0, stablen,
+ elf_section_header(p - shstrtab, 1, 0, stabbuf, false, stablen,
nsections - 2, 0, 4, 12);
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 3, 0, stabstrbuf, 0,
+ elf_section_header(p - shstrtab, 3, 0, stabstrbuf, false,
stabstrlen, 0, 0, 4, 0);
p += strlen(p) + 1;
/* link -> symtable info -> section to refer to */
- elf_section_header(p - shstrtab, 9, 0, stabrelbuf, 0,
+ elf_section_header(p - shstrtab, 9, 0, stabrelbuf, false,
stabrellen, symtabsection, nsections - 3, 4,
8);
}
@@ -1206,7 +1206,7 @@ static struct SAA *elf_build_reltab(int32_t *len, struct Reloc *r)
}
static void elf_section_header(int name, int type, int flags,
- void *data, int is_saa, int32_t datalen,
+ void *data, bool is_saa, int32_t datalen,
int link, int info, int align, int eltsize)
{
elf_sects[elf_nsect].data = data;
diff --git a/output/outelf64.c b/output/outelf64.c
index 5f77bb12..392a7d47 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -159,7 +159,7 @@ static int32_t elf_foffs;
static void elf_write(void);
static void elf_sect_write(struct Section *, const uint8_t *,
uint32_t);
-static void elf_section_header(int, int, int, void *, int, int32_t, int, int,
+static void elf_section_header(int, int, int, void *, bool, int32_t, int, int,
int, int);
static void elf_write_sections(void);
static struct SAA *elf_build_symtab(int32_t *, int32_t *);
@@ -254,19 +254,19 @@ static void elf_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
fwds = NULL;
elf_gotpc_sect = seg_alloc();
- ldef("..gotpc", elf_gotpc_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf64,
+ ldef("..gotpc", elf_gotpc_sect + 1, 0L, NULL, false, false, &of_elf64,
error);
elf_gotoff_sect = seg_alloc();
- ldef("..gotoff", elf_gotoff_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf64,
+ ldef("..gotoff", elf_gotoff_sect + 1, 0L, NULL, false, false, &of_elf64,
error);
elf_got_sect = seg_alloc();
- ldef("..got", elf_got_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf64,
+ ldef("..got", elf_got_sect + 1, 0L, NULL, false, false, &of_elf64,
error);
elf_plt_sect = seg_alloc();
- ldef("..plt", elf_plt_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf64,
+ ldef("..plt", elf_plt_sect + 1, 0L, NULL, false, false, &of_elf64,
error);
elf_sym_sect = seg_alloc();
- ldef("..sym", elf_sym_sect + 1, 0L, NULL, FALSE, FALSE, &of_elf64,
+ ldef("..sym", elf_sym_sect + 1, 0L, NULL, false, false, &of_elf64,
error);
def_seg = seg_alloc();
@@ -453,7 +453,7 @@ static void elf_deflabel(char *name, int32_t segment, int32_t offset,
{
int pos = strslen;
struct Symbol *sym;
- int special_used = FALSE;
+ bool special_used = false;
#if defined(DEBUG) && DEBUG>2
fprintf(stderr,
@@ -559,7 +559,7 @@ static void elf_deflabel(char *name, int32_t segment, int32_t offset,
error(ERR_NONFATAL, "alignment constraint `%s' is not a"
" power of two", special);
}
- special_used = TRUE;
+ special_used = true;
} else
sym->value = (sym->section == SHN_UNDEF ? 0 : offset);
@@ -624,7 +624,7 @@ static void elf_deflabel(char *name, int32_t segment, int32_t offset,
if (*special) {
struct tokenval tokval;
expr *e;
- int fwd = FALSE;
+ int fwd = 0;
char *saveme = stdscan_bufptr; /* bugfix? fbk 8/10/00 */
while (special[n] && isspace(special[n]))
@@ -651,7 +651,7 @@ static void elf_deflabel(char *name, int32_t segment, int32_t offset,
}
stdscan_bufptr = saveme; /* bugfix? fbk 8/10/00 */
}
- special_used = TRUE;
+ special_used = true;
}
}
sym->globnum = nglobs;
@@ -712,7 +712,7 @@ static void elf_add_reloc(struct Section *sect, int32_t segment, int type)
*/
static int32_t elf_add_gsym_reloc(struct Section *sect,
int32_t segment, int64_t offset,
- int type, int exact)
+ int type, bool exact)
{
struct Reloc *r;
struct Section *s;
@@ -886,21 +886,21 @@ static void elf_out(int32_t segto, const void *data, uint32_t type,
elf_add_reloc(s, segment, R_X86_64_GOTTPOFF);
} else if (wrt == elf_got_sect + 1) {
addr = elf_add_gsym_reloc(s, segment, addr,
- R_X86_64_GOT32, TRUE);
+ R_X86_64_GOT32, true);
} else if (wrt == elf_sym_sect + 1) {
switch (realbytes) {
case 2:
gnu16 = 1;
addr = elf_add_gsym_reloc(s, segment, addr,
- R_X86_64_16, FALSE);
+ R_X86_64_16, false);
break;
case 4:
addr = elf_add_gsym_reloc(s, segment, addr,
- R_X86_64_32, FALSE);
+ R_X86_64_32, false);
break;
case 8:
addr = elf_add_gsym_reloc(s, segment, addr,
- R_X86_64_64, FALSE);
+ R_X86_64_64, false);
break;
default:
error(ERR_PANIC, "internal error elf64-hpa-903");
@@ -1061,31 +1061,31 @@ static void elf_write(void)
elf_nsect = 0;
elf_sects = nasm_malloc(sizeof(*elf_sects) * (2 * nsects + 10));
- elf_section_header(0, 0, 0, NULL, FALSE, 0L, 0, 0, 0, 0); /* SHN_UNDEF */
+ elf_section_header(0, 0, 0, NULL, false, 0L, 0, 0, 0, 0); /* SHN_UNDEF */
scount = 1; /* needed for the stabs debugging to track the symtable section */
p = shstrtab + 1;
for (i = 0; i < nsects; i++) {
elf_section_header(p - shstrtab, sects[i]->type, sects[i]->flags,
(sects[i]->type == SHT_PROGBITS ?
- sects[i]->data : NULL), TRUE,
+ sects[i]->data : NULL), true,
sects[i]->len, 0, 0, sects[i]->align, 0);
p += strlen(p) + 1;
scount++; /* dito */
}
- elf_section_header(p - shstrtab, 1, 0, comment, FALSE, (int32_t)commlen, 0, 0, 1, 0); /* .comment */
+ elf_section_header(p - shstrtab, 1, 0, comment, false, (int32_t)commlen, 0, 0, 1, 0); /* .comment */
scount++; /* dito */
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 3, 0, shstrtab, FALSE, (int32_t)shstrtablen, 0, 0, 1, 0); /* .shstrtab */
+ elf_section_header(p - shstrtab, 3, 0, shstrtab, false, (int32_t)shstrtablen, 0, 0, 1, 0); /* .shstrtab */
scount++; /* dito */
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 2, 0, symtab, TRUE, symtablen, nsects + 4, symtablocal, 4, 24); /* .symtab */
+ elf_section_header(p - shstrtab, 2, 0, symtab, true, symtablen, nsects + 4, symtablocal, 4, 24); /* .symtab */
symtabsection = scount; /* now we got the symtab section index in the ELF file */
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 3, 0, strs, TRUE, strslen, 0, 0, 1, 0); /* .strtab */
+ elf_section_header(p - shstrtab, 3, 0, strs, true, strslen, 0, 0, 1, 0); /* .strtab */
for (i = 0; i < nsects; i++)
if (sects[i]->head) {
p += strlen(p) + 1;
- elf_section_header(p - shstrtab,SHT_RELA, 0, sects[i]->rel, TRUE,
+ elf_section_header(p - shstrtab,SHT_RELA, 0, sects[i]->rel, true,
sects[i]->rellen, nsects + 3, i + 1, 4, 24);
}
if (of_elf64.current_dfmt == &df_stabs) {
@@ -1097,16 +1097,16 @@ static void elf_write(void)
if ((stabbuf) && (stabstrbuf) && (stabrelbuf)) {
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 1, 0, stabbuf, 0, stablen,
+ elf_section_header(p - shstrtab, 1, 0, stabbuf, false, stablen,
nsections - 2, 0, 4, 12);
p += strlen(p) + 1;
- elf_section_header(p - shstrtab, 3, 0, stabstrbuf, 0,
+ elf_section_header(p - shstrtab, 3, 0, stabstrbuf, false,
stabstrlen, 0, 0, 4, 0);
p += strlen(p) + 1;
/* link -> symtable info -> section to refer to */
- elf_section_header(p - shstrtab, 9, 0, stabrelbuf, 0,
+ elf_section_header(p - shstrtab, 9, 0, stabrelbuf, false,
stabrellen, symtabsection, nsections - 3, 4,
16);
}
@@ -1238,7 +1238,7 @@ static struct SAA *elf_build_reltab(int32_t *len, struct Reloc *r)
}
static void elf_section_header(int name, int type, int flags,
- void *data, int is_saa, int32_t datalen,
+ void *data, bool is_saa, int32_t datalen,
int link, int info, int align, int eltsize)
{
elf_sects[elf_nsect].data = data;
diff --git a/output/outieee.c b/output/outieee.c
index 145fcafe..e5077263 100644
--- a/output/outieee.c
+++ b/output/outieee.c
@@ -60,7 +60,7 @@ static int ieee_uppercase;
static efunc error;
static ldfunc deflabel;
static FILE *ofp;
-static int any_segs;
+static bool any_segs;
static int arrindex;
#define HUNKSIZE 1024 /* Size of the data hunk */
@@ -183,7 +183,7 @@ static void ieee_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
ofp = fp;
error = errfunc;
deflabel = ldef;
- any_segs = FALSE;
+ any_segs = false;
fpubhead = NULL;
fpubtail = &fpubhead;
exthead = NULL;
@@ -194,7 +194,7 @@ static void ieee_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
seghead = ieee_seg_needs_update = NULL;
segtail = &seghead;
ieee_entry_seg = NO_SEG;
- ieee_uppercase = FALSE;
+ ieee_uppercase = false;
checksum = 0;
of_ieee.current_dfmt->init(&of_ieee, NULL, fp, errfunc);
}
@@ -391,7 +391,7 @@ static void ieee_out(int32_t segto, const void *data, uint32_t type,
}
/*
- * If `any_segs' is still FALSE, we must define a default
+ * If `any_segs' is still false, we must define a default
* segment.
*/
if (!any_segs) {
@@ -718,7 +718,7 @@ static int32_t ieee_segment(char *name, int pass, int *bits)
segtail = &seg->next;
seg->index = seg_alloc();
seg->ieee_index = ieee_idx;
- any_segs = TRUE;
+ any_segs = true;
seg->name = NULL;
seg->currentpos = 0;
seg->align = 1; /* default */
@@ -750,9 +750,9 @@ static int32_t ieee_segment(char *name, int pass, int *bits)
else if (!nasm_stricmp(p, "common"))
seg->combine = CMB_COMMON;
else if (!nasm_stricmp(p, "use16"))
- seg->use32 = FALSE;
+ seg->use32 = false;
else if (!nasm_stricmp(p, "use32"))
- seg->use32 = TRUE;
+ seg->use32 = true;
else if (!nasm_strnicmp(p, "align=", 6)) {
seg->align = readnum(p + 6, &rn_error);
if (seg->align == 0)
@@ -790,10 +790,10 @@ static int32_t ieee_segment(char *name, int pass, int *bits)
ieee_seg_needs_update = seg;
if (seg->align >= SEG_ABS)
deflabel(name, NO_SEG, seg->align - SEG_ABS,
- NULL, FALSE, FALSE, &of_ieee, error);
+ NULL, false, false, &of_ieee, error);
else
deflabel(name, seg->index + 1, 0L,
- NULL, FALSE, FALSE, &of_ieee, error);
+ NULL, false, false, &of_ieee, error);
ieee_seg_needs_update = NULL;
if (seg->use32)
@@ -813,7 +813,7 @@ static int ieee_directive(char *directive, char *value, int pass)
(void)value;
(void)pass;
if (!strcmp(directive, "uppercase")) {
- ieee_uppercase = TRUE;
+ ieee_uppercase = true;
return 1;
}
return 0;
@@ -901,7 +901,7 @@ static void ieee_write_file(int debuginfo)
* the standard doesn't specify when to put checksums,
* we'll just do it periodically.
*/
- ieee_putcs(FALSE);
+ ieee_putcs(false);
/*
* Write the section headers
@@ -953,7 +953,7 @@ static void ieee_write_file(int debuginfo)
ieee_entry_ofs);
}
- ieee_putcs(FALSE);
+ ieee_putcs(false);
/*
* Write the publics
*/
@@ -1010,7 +1010,7 @@ static void ieee_write_file(int debuginfo)
ieee_putascii("NX%X,%02X%s.\r\n", i++, strlen(buf), buf);
ext = ext->next;
}
- ieee_putcs(FALSE);
+ ieee_putcs(false);
/*
* IEEE doesn't have a standard pass break record
@@ -1084,7 +1084,7 @@ static void ieee_write_file(int debuginfo)
org = ieee_putld(org, org + size, data->data);
data = data->next;
}
- ieee_putcs(FALSE);
+ ieee_putcs(false);
}
seg = seg->next;
@@ -1266,7 +1266,7 @@ void dbgls_init(struct ofmt *of, void *id, FILE * fp, efunc error)
arrhead = NULL;
arrtail = &arrhead;
ieee_segment("??LINE", 2, &tempint);
- any_segs = FALSE;
+ any_segs = false;
}
static void dbgls_cleanup(void)
{
@@ -1308,7 +1308,7 @@ static void dbgls_linnum(const char *lnfname, int32_t lineno, int32_t segto)
return;
/*
- * If `any_segs' is still FALSE, we must define a default
+ * If `any_segs' is still false, we must define a default
* segment.
*/
if (!any_segs) {
@@ -1350,10 +1350,9 @@ static void dbgls_deflabel(char *name, int32_t segment,
int32_t offset, int is_global, char *special)
{
struct ieeeSection *seg;
- int used_special; /* have we used the special text? */
- /* Keep compiler from warning about special and used_special */
- used_special = special ? FALSE : FALSE;
+ /* Keep compiler from warning about special */
+ (void)special;
/*
* If it's a special-retry from pass two, discard it.
@@ -1382,7 +1381,7 @@ static void dbgls_deflabel(char *name, int32_t segment,
}
/*
- * If `any_segs' is still FALSE, we might need to define a
+ * If `any_segs' is still false, we might need to define a
* default segment, if they're trying to declare a label in
* `first_seg'. But the label should exist due to a prior
* call to ieee_deflabel so we can skip that.
diff --git a/output/outobj.c b/output/outobj.c
index 2f7079ef..04e4bbac 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -145,8 +145,8 @@ static void ori_pubdef(ObjRecord * orp);
static void ori_null(ObjRecord * orp);
static ObjRecord *obj_commit(ObjRecord * orp);
-static int obj_uppercase; /* Flag: all names in uppercase */
-static int obj_use32; /* Flag: at least one segment is 32-bit */
+static bool obj_uppercase; /* Flag: all names in uppercase */
+static bool obj_use32; /* Flag: at least one segment is 32-bit */
/*
* Clear an ObjRecord structure. (Never reallocates).
@@ -469,7 +469,7 @@ static evalfunc evaluate;
static ldfunc deflabel;
static FILE *ofp;
static int32_t first_seg;
-static int any_segs;
+static bool any_segs;
static int passtwo;
static int arrindex;
@@ -550,7 +550,7 @@ static struct Segment {
CMB_STACK = 5,
CMB_COMMON = 6
} combine;
- int32_t use32; /* is this segment 32-bit? */
+ bool use32; /* is this segment 32-bit? */
struct Public *pubhead, **pubtail, *lochead, **loctail;
char *name;
char *segclass, *overlay; /* `class' is a C++ keyword :-) */
@@ -609,7 +609,7 @@ static void obj_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
evaluate = eval;
deflabel = ldef;
first_seg = seg_alloc();
- any_segs = FALSE;
+ any_segs = false;
fpubhead = NULL;
fpubtail = &fpubhead;
exthead = NULL;
@@ -627,8 +627,8 @@ static void obj_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
grphead = obj_grp_needs_update = NULL;
grptail = &grphead;
obj_entry_seg = NO_SEG;
- obj_uppercase = FALSE;
- obj_use32 = FALSE;
+ obj_uppercase = false;
+ obj_use32 = false;
passtwo = 0;
current_seg = NULL;
@@ -748,7 +748,7 @@ static void obj_deflabel(char *name, int32_t segment,
struct ExtBack *eb;
struct Segment *seg;
int i;
- int used_special = FALSE; /* have we used the special text? */
+ bool used_special = false; /* have we used the special text? */
#if defined(DEBUG) && DEBUG>2
fprintf(stderr,
@@ -809,7 +809,7 @@ static void obj_deflabel(char *name, int32_t segment,
}
/*
- * If `any_segs' is still FALSE, we might need to define a
+ * If `any_segs' is still false, we might need to define a
* default segment, if they're trying to declare a label in
* `first_seg'.
*/
@@ -885,7 +885,7 @@ static void obj_deflabel(char *name, int32_t segment,
* specifications.
*/
while (special && *special) {
- used_special = TRUE;
+ used_special = true;
/*
* We might have a default-WRT specification.
@@ -1016,7 +1016,7 @@ static void obj_out(int32_t segto, const void *data, uint32_t type,
}
/*
- * If `any_segs' is still FALSE, we must define a default
+ * If `any_segs' is still false, we must define a default
* segment.
*/
if (!any_segs) {
@@ -1136,14 +1136,14 @@ static void obj_write_fixup(ObjRecord * orp, int bytes,
}
if (seg % 2) {
- base = TRUE;
+ base = true;
locat = FIX_16_SELECTOR;
seg--;
if (bytes != 2)
error(ERR_PANIC, "OBJ: 4-byte segment base fixup got"
" through sanity check");
} else {
- base = FALSE;
+ base = false;
locat = (bytes == 2) ? FIX_16_OFFSET : FIX_32_OFFSET;
if (!segrel)
/*
@@ -1330,11 +1330,11 @@ static int32_t obj_segment(char *name, int pass, int *bits)
seg->index = (any_segs ? seg_alloc() : first_seg);
seg->obj_index = obj_idx;
seg->grp = NULL;
- any_segs = TRUE;
+ any_segs = true;
seg->name = NULL;
seg->currentpos = 0;
seg->align = 1; /* default */
- seg->use32 = FALSE; /* default */
+ seg->use32 = false; /* default */
seg->combine = CMB_PUBLIC; /* default */
seg->segclass = seg->overlay = NULL;
seg->pubhead = NULL;
@@ -1368,9 +1368,9 @@ static int32_t obj_segment(char *name, int pass, int *bits)
else if (!nasm_stricmp(p, "stack"))
seg->combine = CMB_STACK;
else if (!nasm_stricmp(p, "use16"))
- seg->use32 = FALSE;
+ seg->use32 = false;
else if (!nasm_stricmp(p, "use32"))
- seg->use32 = TRUE;
+ seg->use32 = true;
else if (!nasm_stricmp(p, "flat")) {
/*
* This segment is an OS/2 FLAT segment. That means
@@ -1457,10 +1457,10 @@ static int32_t obj_segment(char *name, int pass, int *bits)
obj_seg_needs_update = seg;
if (seg->align >= SEG_ABS)
deflabel(name, NO_SEG, seg->align - SEG_ABS,
- NULL, FALSE, FALSE, &of_obj, error);
+ NULL, false, false, &of_obj, error);
else
deflabel(name, seg->index + 1, 0L,
- NULL, FALSE, FALSE, &of_obj, error);
+ NULL, false, false, &of_obj, error);
obj_seg_needs_update = NULL;
/*
@@ -1561,7 +1561,7 @@ static int obj_directive(char *directive, char *value, int pass)
obj_grp_needs_update = grp;
deflabel(v, grp->index + 1, 0L,
- NULL, FALSE, FALSE, &of_obj, error);
+ NULL, false, false, &of_obj, error);
obj_grp_needs_update = NULL;
while (*q) {
@@ -1622,7 +1622,7 @@ static int obj_directive(char *directive, char *value, int pass)
return 1;
}
if (!strcmp(directive, "uppercase")) {
- obj_uppercase = TRUE;
+ obj_uppercase = true;
return 1;
}
if (!strcmp(directive, "import")) {
@@ -1655,7 +1655,7 @@ static int obj_directive(char *directive, char *value, int pass)
" and library name");
else {
struct ImpDef *imp;
- int err = FALSE;
+ int err = false;
imp = *imptail = nasm_malloc(sizeof(struct ImpDef));
imptail = &imp->next;
@@ -1719,7 +1719,7 @@ static int obj_directive(char *directive, char *value, int pass)
else if (!nasm_stricmp(v, "nodata"))
flags |= EXPDEF_FLAG_NODATA;
else if (!nasm_strnicmp(v, "parm=", 5)) {
- int err = FALSE;
+ int err = false;
flags |= EXPDEF_MASK_PARMCNT & readnum(v + 5, &err);
if (err) {
error(ERR_NONFATAL,
@@ -1727,7 +1727,7 @@ static int obj_directive(char *directive, char *value, int pass)
return 1;
}
} else {
- int err = FALSE;
+ int err = false;
ordinal = readnum(v, &err);
if (err) {
error(ERR_NONFATAL,
@@ -2364,7 +2364,7 @@ static void dbgbi_linnum(const char *lnfname, int32_t lineno, int32_t segto)
return;
/*
- * If `any_segs' is still FALSE, we must define a default
+ * If `any_segs' is still false, we must define a default
* segment.
*/
if (!any_segs) {
@@ -2442,7 +2442,7 @@ static void dbgbi_deflabel(char *name, int32_t segment,
}
/*
- * If `any_segs' is still FALSE, we might need to define a
+ * If `any_segs' is still false, we might need to define a
* default segment, if they're trying to declare a label in
* `first_seg'. But the label should exist due to a prior
* call to obj_deflabel so we can skip that.
diff --git a/parser.c b/parser.c
index 5fe79f87..f2b7cfe3 100644
--- a/parser.c
+++ b/parser.c
@@ -51,7 +51,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
int critical;
struct eval_hints hints;
- result->forw_ref = FALSE;
+ result->forw_ref = false;
error = errfunc;
stdscan_reset();
@@ -92,7 +92,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
* am still not certain.
*/
ldef(result->label, in_abs_seg ? abs_seg : location->segment,
- location->offset, NULL, TRUE, FALSE, outfmt, errfunc);
+ location->offset, NULL, true, false, outfmt, errfunc);
}
}
@@ -192,7 +192,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
extop *eop, **tail = &result->eops, **fixptr;
int oper_num = 0;
- result->eops_float = FALSE;
+ result->eops_float = false;
/*
* Begin to read the DB/DW/DD/DQ/DT/DO/INCBIN operands.
@@ -233,7 +233,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
if (i == TOKEN_FLOAT) {
eop->type = EOT_DB_STRING;
- result->eops_float = TRUE;
+ result->eops_float = true;
switch (result->opcode) {
case I_DW:
eop->stringlen = 2;
@@ -426,7 +426,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
}
if (i == '[' || i == '&') { /* memory reference */
- mref = TRUE;
+ mref = true;
bracket = (i == '[');
while ((i = stdscan(NULL, &tokval)) == TOKEN_SPECIAL) {
/* check for address directives */
@@ -502,8 +502,8 @@ insn *parse_line(int pass, char *buffer, insn * result,
}
}
} else { /* immediate operand, or register */
- mref = FALSE;
- bracket = FALSE; /* placate optimisers */
+ mref = false;
+ bracket = false; /* placate optimisers */
}
if ((result->oprs[operand].type & FAR) && !mref &&
@@ -516,7 +516,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
critical, error, &hints);
i = tokval.t_type;
if (result->oprs[operand].opflags & OPFLAG_FORWARD) {
- result->forw_ref = TRUE;
+ result->forw_ref = true;
}
if (!value) { /* error in evaluator */
result->opcode = -1; /* unrecoverable parse error: */
@@ -562,7 +562,7 @@ insn *parse_line(int pass, char *buffer, insn * result,
critical, error, &hints);
i = tokval.t_type;
if (result->oprs[operand].opflags & OPFLAG_FORWARD) {
- result->forw_ref = TRUE;
+ result->forw_ref = true;
}
/* and get the offset */
if (!value) { /* but, error in evaluator */
diff --git a/preproc.c b/preproc.c
index d99b31f5..003038b3 100644
--- a/preproc.c
+++ b/preproc.c
@@ -101,11 +101,11 @@ struct SMacro {
struct MMacro {
MMacro *next;
char *name;
- int casesense;
int nparam_min, nparam_max;
- int plus; /* is the last parameter greedy? */
- int nolist; /* is this macro listing-inhibited? */
- int in_progress;
+ bool casesense;
+ bool plus; /* is the last parameter greedy? */
+ bool nolist; /* is this macro listing-inhibited? */
+ bool in_progress;
Token *dlist; /* All defaults as one list */
Token **defaults; /* Parameter default pointers */
int ndefs; /* number of default parameters */
@@ -366,7 +366,7 @@ static const char **stdmacpos;
* any.
*/
static const char **extrastdmac = NULL;
-int any_extrastdmac;
+bool any_extrastdmac;
/*
* Tokens are allocated in blocks to improve speed
@@ -386,7 +386,7 @@ static Blocks blocks = { NULL, NULL };
static Token *expand_mmac_params(Token * tline);
static Token *expand_smacro(Token * tline);
static Token *expand_id(Token * tline);
-static Context *get_ctx(char *name, int all_contexts);
+static Context *get_ctx(char *name, bool all_contexts);
static void make_tok_num(Token * tok, int32_t val);
static void error(int severity, const char *fmt, ...);
static void *new_Block(size_t size);
@@ -605,7 +605,7 @@ static char *read_line(void)
char *ret = nasm_strdup(*stdmacpos++);
if (!*stdmacpos && any_extrastdmac) {
stdmacpos = extrastdmac;
- any_extrastdmac = FALSE;
+ any_extrastdmac = false;
return ret;
}
/*
@@ -628,7 +628,7 @@ static char *read_line(void)
l = nasm_malloc(sizeof(Line));
l->next = istk->expansion;
l->first = head;
- l->finishes = FALSE;
+ l->finishes = false;
istk->expansion = l;
}
}
@@ -948,7 +948,7 @@ static char *detoken(Token * tlist, int expand_locals)
if (expand_locals &&
t->type == TOK_PREPROC_ID && t->text &&
t->text[0] == '%' && t->text[1] == '$') {
- Context *ctx = get_ctx(t->text, FALSE);
+ Context *ctx = get_ctx(t->text, false);
if (ctx) {
char buffer[40];
char *p, *q = t->text + 2;
@@ -1101,12 +1101,12 @@ static int mstrcmp(char *p, char *q, int casesense)
* NULL, having _already_ reported an error condition, if the
* context stack isn't deep enough for the supplied number of $
* signs.
- * If all_contexts == TRUE, contexts that enclose current are
+ * If all_contexts == true, contexts that enclose current are
* also scanned for such smacro, until it is found; if not -
* only the context that directly results from the number of $'s
* in variable's name.
*/
-static Context *get_ctx(char *name, int all_contexts)
+static Context *get_ctx(char *name, bool all_contexts)
{
Context *ctx;
SMacro *m;
@@ -1236,8 +1236,8 @@ hash_findix(struct hash_table *hash, const char *str)
/*
* Determine if we should warn on defining a single-line macro of
* name `name', with `nparam' parameters. If nparam is 0 or -1, will
- * return TRUE if _any_ single-line macro of that name is defined.
- * Otherwise, will return TRUE if a single-line macro with either
+ * return true if _any_ single-line macro of that name is defined.
+ * Otherwise, will return true if a single-line macro with either
* `nparam' or no parameters is defined.
*
* If a macro with precisely the right number of parameters is
@@ -1264,9 +1264,9 @@ smacro_defined(Context * ctx, char *name, int nparam, SMacro ** defn,
m = ctx->localmac;
} else if (name[0] == '%' && name[1] == '$') {
if (cstk)
- ctx = get_ctx(name, FALSE);
+ ctx = get_ctx(name, false);
if (!ctx)
- return FALSE; /* got to return _something_ */
+ return false; /* got to return _something_ */
m = ctx->localmac;
} else {
m = (SMacro *) hash_findix(smacros, name);
@@ -1281,12 +1281,12 @@ smacro_defined(Context * ctx, char *name, int nparam, SMacro ** defn,
else
*defn = NULL;
}
- return TRUE;
+ return true;
}
m = m->next;
}
- return FALSE;
+ return false;
}
/*
@@ -1307,9 +1307,9 @@ static void count_mmac_params(Token * t, int *nparam, Token *** params)
*params = nasm_realloc(*params, sizeof(**params) * paramsize);
}
skip_white_(t);
- brace = FALSE;
+ brace = false;
if (tok_is_(t, "{"))
- brace = TRUE;
+ brace = true;
(*params)[(*nparam)++] = t;
while (tok_isnt_(t, brace ? "}" : ","))
t = t->next;
@@ -1353,7 +1353,7 @@ static int if_condition(Token * tline, enum preproc_token ct)
switch (i) {
case PPC_IFCTX:
- j = FALSE; /* have we matched yet? */
+ j = false; /* have we matched yet? */
while (cstk && tline) {
skip_white_(tline);
if (!tline || tline->type != TOK_ID) {
@@ -1363,13 +1363,13 @@ static int if_condition(Token * tline, enum preproc_token ct)
return -1;
}
if (!nasm_stricmp(tline->text, cstk->name))
- j = TRUE;
+ j = true;
tline = tline->next;
}
break;
case PPC_IFDEF:
- j = FALSE; /* have we matched yet? */
+ j = false; /* have we matched yet? */
while (tline) {
skip_white_(tline);
if (!tline || (tline->type != TOK_ID &&
@@ -1380,7 +1380,7 @@ static int if_condition(Token * tline, enum preproc_token ct)
goto fail;
}
if (smacro_defined(NULL, tline->text, 0, NULL, 1))
- j = TRUE;
+ j = true;
tline = tline->next;
}
break;
@@ -1398,7 +1398,7 @@ static int if_condition(Token * tline, enum preproc_token ct)
goto fail;
}
tt = tt->next;
- j = TRUE; /* assume equality unless proved not */
+ j = true; /* assume equality unless proved not */
while ((t->type != TOK_OTHER || strcmp(t->text, ",")) && tt) {
if (tt->type == TOK_OTHER && !strcmp(tt->text, ",")) {
error(ERR_NONFATAL, "`%s': more than one comma on line",
@@ -1414,7 +1414,7 @@ static int if_condition(Token * tline, enum preproc_token ct)
continue;
}
if (tt->type != t->type) {
- j = FALSE; /* found mismatching tokens */
+ j = false; /* found mismatching tokens */
break;
}
/* Unify surrounding quotes for strings */
@@ -1423,7 +1423,7 @@ static int if_condition(Token * tline, enum preproc_token ct)
tt->text[strlen(tt->text) - 1] = t->text[0];
}
if (mstrcmp(tt->text, t->text, i == PPC_IFIDN) != 0) {
- j = FALSE; /* found mismatching tokens */
+ j = false; /* found mismatching tokens */
break;
}
@@ -1431,12 +1431,12 @@ static int if_condition(Token * tline, enum preproc_token ct)
tt = tt->next;
}
if ((t->type != TOK_OTHER || strcmp(t->text, ",")) || tt)
- j = FALSE; /* trailing gunk on one end or other */
+ j = false; /* trailing gunk on one end or other */
break;
case PPC_IFMACRO:
{
- int found = 0;
+ bool found = false;
MMacro searching, *mmac;
tline = tline->next;
@@ -1449,9 +1449,9 @@ static int if_condition(Token * tline, enum preproc_token ct)
}
searching.name = nasm_strdup(tline->text);
searching.casesense = (i == PP_MACRO);
- searching.plus = FALSE;
- searching.nolist = FALSE;
- searching.in_progress = FALSE;
+ searching.plus = false;
+ searching.nolist = false;
+ searching.in_progress = false;
searching.rep_nest = NULL;
searching.nparam_min = 0;
searching.nparam_max = INT_MAX;
@@ -1491,7 +1491,7 @@ static int if_condition(Token * tline, enum preproc_token ct)
}
if (tline && tok_is_(tline->next, "+")) {
tline = tline->next;
- searching.plus = TRUE;
+ searching.plus = true;
}
mmac = (MMacro *) hash_findix(mmacros, searching.name);
while (mmac) {
@@ -1500,7 +1500,7 @@ static int if_condition(Token * tline, enum preproc_token ct)
|| searching.plus)
&& (searching.nparam_min <= mmac->nparam_max
|| mmac->plus)) {
- found = TRUE;
+ found = true;
break;
}
mmac = mmac->next;
@@ -1525,7 +1525,7 @@ static int if_condition(Token * tline, enum preproc_token ct)
t = tline;
while (tok_type_(t, TOK_WHITESPACE))
t = t->next;
- j = FALSE; /* placate optimiser */
+ j = false; /* placate optimiser */
if (t)
j = t->type == needtype;
break;
@@ -1573,7 +1573,7 @@ void expand_macros_in_string(char **p)
{
Token *line = tokenize(*p);
line = expand_smacro(line);
- *p = detoken(line, FALSE);
+ *p = detoken(line, false);
}
/**
@@ -1960,7 +1960,7 @@ static int do_directive(Token * tline)
error(ERR_NONFATAL, "%s", p);
nasm_free(p);
} else {
- p = detoken(tline, FALSE);
+ p = detoken(tline, false);
error(ERR_WARNING, "%s", p);
nasm_free(p);
}
@@ -2047,9 +2047,9 @@ static int do_directive(Token * tline)
defining = nasm_malloc(sizeof(MMacro));
defining->name = nasm_strdup(tline->text);
defining->casesense = (i == PP_MACRO);
- defining->plus = FALSE;
- defining->nolist = FALSE;
- defining->in_progress = FALSE;
+ defining->plus = false;
+ defining->nolist = false;
+ defining->in_progress = false;
defining->rep_nest = NULL;
tline = expand_smacro(tline->next);
skip_white_(tline);
@@ -2086,12 +2086,12 @@ static int do_directive(Token * tline)
}
if (tline && tok_is_(tline->next, "+")) {
tline = tline->next;
- defining->plus = TRUE;
+ defining->plus = true;
}
if (tline && tok_type_(tline->next, TOK_ID) &&
!nasm_stricmp(tline->next->text, ".nolist")) {
tline = tline->next;
- defining->nolist = TRUE;
+ defining->nolist = true;
}
mmac = (MMacro *) hash_findix(mmacros, defining->name);
while (mmac) {
@@ -2181,14 +2181,14 @@ static int do_directive(Token * tline)
return DIRECTIVE_FOUND;
case PP_REP:
- nolist = FALSE;
+ nolist = false;
do {
tline = tline->next;
} while (tok_type_(tline, TOK_WHITESPACE));
if (tok_type_(tline, TOK_ID) &&
nasm_stricmp(tline->text, ".nolist") == 0) {
- nolist = TRUE;
+ nolist = true;
do {
tline = tline->next;
} while (tok_type_(tline, TOK_WHITESPACE));
@@ -2222,7 +2222,7 @@ static int do_directive(Token * tline)
defining = nasm_malloc(sizeof(MMacro));
defining->name = NULL; /* flags this macro as a %rep block */
defining->casesense = 0;
- defining->plus = FALSE;
+ defining->plus = false;
defining->nolist = nolist;
defining->in_progress = i;
defining->nparam_min = defining->nparam_max = 0;
@@ -2299,7 +2299,7 @@ static int do_directive(Token * tline)
return DIRECTIVE_FOUND;
}
- ctx = get_ctx(tline->text, FALSE);
+ ctx = get_ctx(tline->text, false);
mname = tline->text;
last = tline;
@@ -2404,7 +2404,7 @@ static int do_directive(Token * tline)
smac->casesense = ((i == PP_DEFINE) || (i == PP_XDEFINE));
smac->nparam = nparam;
smac->expansion = macro_start;
- smac->in_progress = FALSE;
+ smac->in_progress = false;
free_tlist(origline);
return DIRECTIVE_FOUND;
@@ -2425,7 +2425,7 @@ static int do_directive(Token * tline)
}
/* Find the context that symbol belongs to */
- ctx = get_ctx(tline->text, FALSE);
+ ctx = get_ctx(tline->text, false);
if (!ctx)
smhead = (SMacro **) hash_findi(smacros, tline->text, NULL);
else
@@ -2468,7 +2468,7 @@ static int do_directive(Token * tline)
free_tlist(origline);
return DIRECTIVE_FOUND;
}
- ctx = get_ctx(tline->text, FALSE);
+ ctx = get_ctx(tline->text, false);
mname = tline->text;
last = tline;
@@ -2525,7 +2525,7 @@ static int do_directive(Token * tline)
smac->casesense = (i == PP_STRLEN);
smac->nparam = 0;
smac->expansion = macro_start;
- smac->in_progress = FALSE;
+ smac->in_progress = false;
free_tlist(tline);
free_tlist(origline);
return DIRECTIVE_FOUND;
@@ -2542,7 +2542,7 @@ static int do_directive(Token * tline)
free_tlist(origline);
return DIRECTIVE_FOUND;
}
- ctx = get_ctx(tline->text, FALSE);
+ ctx = get_ctx(tline->text, false);
mname = tline->text;
last = tline;
@@ -2624,7 +2624,7 @@ static int do_directive(Token * tline)
smac->casesense = (i == PP_SUBSTR);
smac->nparam = 0;
smac->expansion = macro_start;
- smac->in_progress = FALSE;
+ smac->in_progress = false;
free_tlist(tline);
free_tlist(origline);
return DIRECTIVE_FOUND;
@@ -2643,7 +2643,7 @@ static int do_directive(Token * tline)
free_tlist(origline);
return DIRECTIVE_FOUND;
}
- ctx = get_ctx(tline->text, FALSE);
+ ctx = get_ctx(tline->text, false);
mname = tline->text;
last = tline;
@@ -2711,7 +2711,7 @@ static int do_directive(Token * tline)
smac->casesense = (i == PP_ASSIGN);
smac->nparam = 0;
smac->expansion = macro_start;
- smac->in_progress = FALSE;
+ smac->in_progress = false;
free_tlist(origline);
return DIRECTIVE_FOUND;
@@ -2743,7 +2743,7 @@ static int do_directive(Token * tline)
src_set_linnum(k);
istk->lineinc = m;
if (tline) {
- nasm_free(src_set_fname(detoken(tline, FALSE)));
+ nasm_free(src_set_fname(detoken(tline, false)));
}
free_tlist(origline);
return DIRECTIVE_FOUND;
@@ -3003,7 +3003,7 @@ static Token *expand_smacro(Token * tline)
if ((mname = tline->text)) {
/* if this token is a local macro, look in local context */
if (tline->type == TOK_ID || tline->type == TOK_PREPROC_ID)
- ctx = get_ctx(mname, TRUE);
+ ctx = get_ctx(mname, true);
else
ctx = NULL;
if (!ctx) {
@@ -3065,7 +3065,7 @@ static Token *expand_smacro(Token * tline)
do {
t = tline->next;
while (tok_type_(t, TOK_SMAC_END)) {
- t->mac->in_progress = FALSE;
+ t->mac->in_progress = false;
t->text = NULL;
t = tline->next = delete_Token(t);
}
@@ -3088,14 +3088,14 @@ static Token *expand_smacro(Token * tline)
params[0] = tline->next;
paramsize = nasm_malloc(sparam * sizeof(int));
paramsize[0] = 0;
- while (TRUE) { /* parameter loop */
+ while (true) { /* parameter loop */
/*
* For some unusual expansions
* which concatenates function call
*/
t = tline->next;
while (tok_type_(t, TOK_SMAC_END)) {
- t->mac->in_progress = FALSE;
+ t->mac->in_progress = false;
t->text = NULL;
t = tline->next = delete_Token(t);
}
@@ -3200,7 +3200,7 @@ static Token *expand_smacro(Token * tline)
}
tt = new_Token(tline, TOK_SMAC_END, NULL, 0);
tt->mac = m;
- m->in_progress = TRUE;
+ m->in_progress = true;
tline = tt;
for (t = m->expansion; t; t = t->next) {
if (t->type >= TOK_SMAC_PARAM) {
@@ -3237,7 +3237,7 @@ static Token *expand_smacro(Token * tline)
}
if (tline->type == TOK_SMAC_END) {
- tline->mac->in_progress = FALSE;
+ tline->mac->in_progress = false;
tline = delete_Token(tline);
} else {
t = *tail = tline;
@@ -3525,13 +3525,13 @@ static int expand_mmacro(Token * tline)
paramlen = nparam ? nasm_malloc(nparam * sizeof(*paramlen)) : NULL;
for (i = 0; params[i]; i++) {
- int brace = FALSE;
+ int brace = false;
int comma = (!m->plus || i < nparam - 1);
t = params[i];
skip_white_(t);
if (tok_is_(t, "{"))
- t = t->next, brace = TRUE, comma = FALSE;
+ t = t->next, brace = true, comma = false;
params[i] = t;
paramlen[i] = 0;
while (t) {
@@ -3566,7 +3566,7 @@ static int expand_mmacro(Token * tline)
ll->first = NULL;
istk->expansion = ll;
- m->in_progress = TRUE;
+ m->in_progress = true;
m->params = params;
m->iline = tline;
m->nparam = nparam;
@@ -3771,7 +3771,7 @@ static char *pp_getline(void)
nasm_free(m->params);
free_tlist(m->iline);
nasm_free(m->paramlen);
- l->finishes->in_progress = FALSE;
+ l->finishes->in_progress = false;
} else
free_mmacro(m);
}
@@ -3790,7 +3790,7 @@ static char *pp_getline(void)
tline = l->first;
istk->expansion = l->next;
nasm_free(l);
- p = detoken(tline, FALSE);
+ p = detoken(tline, false);
list->line(LIST_MACRO, p);
nasm_free(p);
break;
@@ -3851,7 +3851,7 @@ static char *pp_getline(void)
Line *l = nasm_malloc(sizeof(Line));
l->next = defining->expansion;
l->first = tline;
- l->finishes = FALSE;
+ l->finishes = false;
defining->expansion = l;
continue;
} else if (istk->conds && !emitting(istk->conds->state)) {
@@ -3880,7 +3880,7 @@ static char *pp_getline(void)
/*
* De-tokenize the line again, and emit it.
*/
- line = detoken(tline, TRUE);
+ line = detoken(tline, true);
free_tlist(tline);
break;
} else {
@@ -3996,7 +3996,7 @@ void pp_pre_include(char *fname)
l = nasm_malloc(sizeof(Line));
l->next = predef;
l->first = inc;
- l->finishes = FALSE;
+ l->finishes = false;
predef = l;
}
@@ -4018,7 +4018,7 @@ void pp_pre_define(char *definition)
l = nasm_malloc(sizeof(Line));
l->next = predef;
l->first = def;
- l->finishes = FALSE;
+ l->finishes = false;
predef = l;
}
@@ -4034,7 +4034,7 @@ void pp_pre_undefine(char *definition)
l = nasm_malloc(sizeof(Line));
l->next = predef;
l->first = def;
- l->finishes = FALSE;
+ l->finishes = false;
predef = l;
}
diff --git a/rdoff/rdlar.c b/rdoff/rdlar.c
index 1d4cd431..4728b57b 100644
--- a/rdoff/rdlar.c
+++ b/rdoff/rdlar.c
@@ -19,9 +19,6 @@
#define PROGRAM_VERSION "0.1"
-/** Types **/
-typedef enum { FALSE, TRUE } bool;
-
/** Constants **/
const char commands[] = "adnrtx";
const char modifiers[] = "cflouvV";
@@ -125,7 +122,7 @@ void put_header(struct rdlm_hdr *hdr, FILE * libfp, char *modname)
return;
if (fwrite(hdr, 1, sizeof(*hdr), libfp) != sizeof(*hdr) ||
(modname && (fwrite(modname, 1, n, libfp) != n)))
- error_exit(3, TRUE, "could not write header");
+ error_exit(3, true, "could not write header");
}
/*
@@ -138,11 +135,11 @@ char copybytes(FILE * fp, FILE * fp2, int n)
for (i = 0; i < n; i++) {
t = fgetc(fp);
if (t == EOF)
- error_exit(1, FALSE, "premature end of file in '%s'",
+ error_exit(1, false, "premature end of file in '%s'",
_argv[2]);
if (fp2)
if (fputc(t, fp2) == EOF)
- error_exit(1, FALSE, "write error");
+ error_exit(1, false, "write error");
}
return (char)t;
}
@@ -160,11 +157,11 @@ int32_t copyint32_t(FILE * fp, FILE * fp2)
for (i = 0; i < 4; i++) {
t = fgetc(fp);
if (t == EOF)
- error_exit(1, FALSE, "premature end of file in '%s'",
+ error_exit(1, false, "premature end of file in '%s'",
_argv[2]);
if (fp2)
if (fputc(t, fp2) == EOF)
- error_exit(1, FALSE, "write error");
+ error_exit(1, false, "write error");
*p++ = t;
}
int32_ttolocal(&l);
@@ -189,13 +186,13 @@ int create_library(char *libname)
libfp = fopen(libname, "wb");
if (!libfp)
- error_exit(1, TRUE, "could not open '%s'\n", libname);
+ error_exit(1, true, "could not open '%s'\n", libname);
/* Write library header */
put_header(&hdr, libfp, NULL);
fclose(libfp);
- return TRUE;
+ return true;
}
/*
@@ -213,7 +210,7 @@ int add_module(FILE * libfp, const char *fname, char *modname)
/* Initialize some fields in the module header */
if (stat(fname, &finfo) < 0)
- error_exit(1, TRUE, "could not stat '%s'", fname);
+ error_exit(1, true, "could not stat '%s'", fname);
hdr.date = finfo.st_mtime;
hdr.owner = finfo.st_uid;
hdr.group = finfo.st_gid;
@@ -221,7 +218,7 @@ int add_module(FILE * libfp, const char *fname, char *modname)
modfp = fopen(fname, "rb");
if (!modfp)
- error_exit(1, TRUE, "could not open '%s'", fname);
+ error_exit(1, true, "could not open '%s'", fname);
/* Write module header */
put_header(&hdr, libfp, modname);
@@ -232,11 +229,11 @@ int add_module(FILE * libfp, const char *fname, char *modname)
if (i == EOF)
break;
if (fputc(i, libfp) == EOF)
- error_exit(1, FALSE, "write error");
+ error_exit(1, false, "write error");
}
fclose(modfp);
- return TRUE;
+ return true;
}
/*
@@ -263,19 +260,19 @@ int main(int argc, char **argv)
for (i = 1; i < strlen(argv[1]); i++) {
switch (c = argv[1][i]) {
case 'c':
- options.createok = TRUE;
+ options.createok = true;
break;
case 'f':
- options.usefname = TRUE;
+ options.usefname = true;
break;
case 'l':
- options.align = TRUE;
+ options.align = true;
break;
case 'o':
- options.odate = TRUE;
+ options.odate = true;
break;
case 'u':
- options.fresh = TRUE;
+ options.fresh = true;
break;
case 'v':
options.verbose++;
@@ -285,13 +282,13 @@ int main(int argc, char **argv)
exit(0);
default:
if (strchr(commands, c) == NULL)
- error_exit(2, FALSE, "invalid command or modifier '%c'",
+ error_exit(2, false, "invalid command or modifier '%c'",
c);
}
}
if (argc < 3)
- error_exit(2, FALSE, "missing library name");
+ error_exit(2, false, "missing library name");
/* Process the command */
if (argv[1][0] == '-')
@@ -299,7 +296,7 @@ int main(int argc, char **argv)
switch (c = argv[1][0]) {
case 'a': /* add a module */
if (argc < 4 || (!options.usefname && argc != 5))
- error_exit(2, FALSE, "invalid number of arguments");
+ error_exit(2, false, "invalid number of arguments");
/* Check if a library already exists. If not - create it */
if (access(argv[2], F_OK) < 0) {
@@ -310,7 +307,7 @@ int main(int argc, char **argv)
libfp = fopen(argv[2], "ab");
if (!libfp)
- error_exit(1, TRUE, "could not open '%s'", argv[2]);
+ error_exit(1, true, "could not open '%s'", argv[2]);
if (!options.usefname)
add_module(libfp, argv[4], argv[3]);
@@ -329,17 +326,17 @@ int main(int argc, char **argv)
if (!options.usefname)
argc--;
if (argc < 4)
- error_exit(2, FALSE, "required parameter missing");
+ error_exit(2, false, "required parameter missing");
p = options.usefname ? argv[3] : argv[4];
case 't': /* list library contents */
libfp = fopen(argv[2], "rb");
if (!libfp)
- error_exit(1, TRUE, "could not open '%s'\n", argv[2]);
+ error_exit(1, true, "could not open '%s'\n", argv[2]);
/* Read library header */
if (fread(&hdr, 1, sizeof(hdr), libfp) != sizeof(hdr) ||
hdr.magic != RDLAMAG)
- error_exit(1, FALSE, "invalid library format");
+ error_exit(1, false, "invalid library format");
/* Walk through the library looking for requested module */
while (!feof(libfp)) {
@@ -348,11 +345,11 @@ int main(int argc, char **argv)
if (feof(libfp))
break;
if (i != sizeof(hdr) || hdr.magic != RDLMMAG)
- error_exit(1, FALSE, "invalid module header");
+ error_exit(1, false, "invalid module header");
/* Read module name */
i = hdr.hdrsize - sizeof(hdr);
if (i > sizeof(buf) || fread(buf, 1, i, libfp) != i)
- error_exit(1, FALSE, "invalid module name");
+ error_exit(1, false, "invalid module name");
if (c == 'x') {
/* Check against desired name */
if (!strcmp(buf, argv[3])) {
@@ -362,7 +359,7 @@ int main(int argc, char **argv)
p);
modfp = fopen(p, "wb");
if (!modfp)
- error_exit(1, TRUE, "could not open '%s'", p);
+ error_exit(1, true, "could not open '%s'", p);
}
} else {
printf("%-40s ", buf);
@@ -381,26 +378,26 @@ int main(int argc, char **argv)
if (modfp)
fclose(modfp);
else if (c == 'x')
- error_exit(1, FALSE, "module '%s' not found in '%s'",
+ error_exit(1, false, "module '%s' not found in '%s'",
argv[3], argv[2]);
break;
case 'r': /* replace module(s) */
argc--;
if (stat(argv[4], &finfo) < 0)
- error_exit(1, TRUE, "could not stat '%s'", argv[4]);
+ error_exit(1, true, "could not stat '%s'", argv[4]);
case 'd': /* delete module(s) */
if (argc < 4)
- error_exit(2, FALSE, "required parameter missing");
+ error_exit(2, false, "required parameter missing");
libfp = fopen(argv[2], "rb");
if (!libfp)
- error_exit(1, TRUE, "could not open '%s'", argv[2]);
+ error_exit(1, true, "could not open '%s'", argv[2]);
/* Copy the library into a temporary file */
tmpfp = tmpfile();
if (!tmpfp)
- error_exit(1, TRUE, "could not open temporary file");
+ error_exit(1, true, "could not open temporary file");
stat(argv[2], &finfo);
copybytes(libfp, tmpfp, finfo.st_size);
@@ -410,7 +407,7 @@ int main(int argc, char **argv)
/* Read library header and write it to a new file */
if (fread(&hdr, 1, sizeof(hdr), tmpfp) != sizeof(hdr) ||
hdr.magic != RDLAMAG)
- error_exit(1, FALSE, "invalid library format");
+ error_exit(1, false, "invalid library format");
put_header(&hdr, libfp, NULL);
/* Walk through the library looking for requested module */
@@ -418,11 +415,11 @@ int main(int argc, char **argv)
/* Read module header */
if (fread(&hdr, 1, sizeof(hdr), tmpfp) != sizeof(hdr) ||
hdr.magic != RDLMMAG)
- error_exit(1, FALSE, "invalid module header");
+ error_exit(1, false, "invalid module header");
/* Read module name */
i = hdr.hdrsize - sizeof(hdr);
if (i > sizeof(buf) || fread(buf, 1, i, tmpfp) != i)
- error_exit(1, FALSE, "invalid module name");
+ error_exit(1, false, "invalid module name");
/* Check against desired name */
if (!strcmp(buf, argv[3]) &&
(c == 'd' || !options.odate
@@ -449,7 +446,7 @@ int main(int argc, char **argv)
break;
if (fputc(i, libfp) == EOF)
- error_exit(1, FALSE, "write error");
+ error_exit(1, false, "write error");
}
fclose(libfp);
@@ -457,7 +454,7 @@ int main(int argc, char **argv)
break;
default:
- error_exit(2, FALSE, "invalid command '%c'\n", c);
+ error_exit(2, false, "invalid command '%c'\n", c);
}
return 0;
diff --git a/stdscan.c b/stdscan.c
index 934fdf54..7305b313 100644
--- a/stdscan.c
+++ b/stdscan.c
@@ -76,10 +76,10 @@ int stdscan(void *private_data, struct tokenval *tv)
if (isidstart(*stdscan_bufptr) ||
(*stdscan_bufptr == '$' && isidstart(stdscan_bufptr[1]))) {
/* now we've got an identifier */
- int is_sym = FALSE;
+ bool is_sym = false;
if (*stdscan_bufptr == '$') {
- is_sym = TRUE;
+ is_sym = true;
stdscan_bufptr++;
}