parameters to match the *At() functions.
svn path=/trunk/yasm/; revision=299
return NULL;
if (bc->type != BC_INSN)
- InternalError(__LINE__, __FILE__,
- _("Trying to get EA of non-instruction"));
+ InternalError(_("Trying to get EA of non-instruction"));
return bc->data.insn.ea;
}
bc->data.jmprel.opersize = opersize;
break;
default:
- InternalError(__LINE__, __FILE__,
- _("OperSize override applied to non-instruction"));
+ InternalError(_("OperSize override applied to non-instruction"));
return;
}
}
bc->data.jmprel.addrsize = addrsize;
break;
default:
- InternalError(__LINE__, __FILE__,
- _("AddrSize override applied to non-instruction"));
+ InternalError(_("AddrSize override applied to non-instruction"));
return;
}
}
lockrep_pre = &bc->data.jmprel.lockrep_pre;
break;
default:
- InternalError(__LINE__, __FILE__,
- _("LockRep prefix applied to non-instruction"));
+ InternalError(_("LockRep prefix applied to non-instruction"));
return;
}
return;
if (bc->type != BC_INSN)
- InternalError(__LINE__, __FILE__,
- _("Attempted to set shift flag on non-instruction"));
+ InternalError(_("Attempted to set shift flag on non-instruction"));
bc->data.insn.shift_op = 1;
}
switch (bc->type) {
case BC_EMPTY:
/* FIXME: delete it (probably in bytecodes_ level, not here */
- InternalError(__LINE__, __FILE__,
- _("got empty bytecode in parser_finalize"));
+ InternalError(_("got empty bytecode in parser_finalize"));
break;
case BC_INSN:
bytecode_parser_finalize_insn(bc);
/* Report an internal error. Essentially a fatal error with trace info.
* Exit immediately because it's essentially an assert() trap. */
void
-InternalError(unsigned int line, const char *file, const char *message)
+InternalError_(const char *file, unsigned int line, const char *message)
{
fprintf(stderr, _("INTERNAL ERROR at %s, line %d: %s\n"), file, line,
message);
void ParserError(const char *);
-void InternalError(unsigned int line, const char *file, const char *message);
+void InternalError_(const char *file, unsigned int line, const char *message);
+#define InternalError(msg) InternalError_(__FILE__, __LINE__, msg)
void Fatal(fatal_num);
void Error(const char *, ...);
xfree(left);
ptr->numterms++;
} else {
- InternalError(__LINE__, __FILE__,
- _("Right side of expression must exist"));
+ InternalError(_("Right side of expression must exist"));
}
if (right) {
/* The reg expn *must* be EXPR_ADD at this point. Sanity check. */
if (e->terms[havereg_expr].type != EXPR_EXPR ||
e->terms[havereg_expr].data.expn->op != EXPR_ADD)
- InternalError(__LINE__, __FILE__,
- _("Register expression not ADD or EXPN"));
+ InternalError(_("Register expression not ADD or EXPN"));
/* Iterate over each term in reg expn */
for (i=0; i<e->terms[havereg_expr].data.expn->numterms; i++) {
* Sanity check for EXPR_INT.
*/
if (e->terms[i].data.expn->terms[0].type != EXPR_REG)
- InternalError(__LINE__, __FILE__,
- _("Register not found in reg expn"));
+ InternalError(_("Register not found in reg expn"));
if (e->terms[i].data.expn->terms[1].type != EXPR_INT)
- InternalError(__LINE__, __FILE__,
- _("Non-integer value in reg expn"));
+ InternalError(_("Non-integer value in reg expn"));
reg = get_reg(&e->terms[i].data.expn->terms[0], data);
if (!reg)
return 0;
/* underflow and overflow both set!? */
if (underflow && overflow)
- InternalError(__LINE__, __FILE__, _("Both underflow and overflow set"));
+ InternalError(_("Both underflow and overflow set"));
/* check for underflow or overflow and set up appropriate output */
if (underflow) {
/* get little-endian bytes */
buf = BitVector_Block_Read(output, &len);
if (len < byte_size)
- InternalError(__LINE__, __FILE__,
- _("Byte length of BitVector does not match bit length"));
+ InternalError(_("Byte length of BitVector does not match bit length"));
/* copy to output */
memcpy(ptr, buf, byte_size*sizeof(unsigned char));
case 10:
return floatnum_get_common(flt, ptr, 10, 64, 0, 15);
default:
- InternalError(__LINE__, __FILE__,
- _("Invalid float conversion size"));
+ InternalError(_("Invalid float conversion size"));
return 1; /* never reached, but silence GCC warning */
}
}
}
if (!operand && op != EXPR_NEG && op != EXPR_NOT && op != EXPR_LNOT)
- InternalError(__LINE__, __FILE__, _("Operation needs an operand"));
+ InternalError(_("Operation needs an operand"));
/* A operation does a bitvector computation if result is allocated. */
switch (op) {
case INTNUM_BV:
return BitVector_Chunk_Read(intn->val.bv, 32, 0);
default:
- InternalError(__LINE__, __FILE__, _("unknown intnum type"));
+ InternalError(_("unknown intnum type"));
return 0;
}
}
} else
return BitVector_Chunk_Read(intn->val.bv, 32, 0);
default:
- InternalError(__LINE__, __FILE__, _("unknown intnum type"));
+ InternalError(_("unknown intnum type"));
return 0;
}
}
case INTNUM_BV:
buf = BitVector_Block_Read(intn->val.bv, &len);
if (len < size)
- InternalError(__LINE__, __FILE__,
- _("Invalid size specified (too large)"));
+ InternalError(_("Invalid size specified (too large)"));
memcpy(ptr, buf, size);
xfree(buf);
break;
xfree(void *p)
{
if (!p)
- InternalError(__LINE__, __FILE__, _("Tried to free NULL pointer"));
+ InternalError(_("Tried to free NULL pointer"));
free(p);
}
xfree(left);
ptr->numterms++;
} else {
- InternalError(__LINE__, __FILE__,
- _("Right side of expression must exist"));
+ InternalError(_("Right side of expression must exist"));
}
if (right) {
/* The reg expn *must* be EXPR_ADD at this point. Sanity check. */
if (e->terms[havereg_expr].type != EXPR_EXPR ||
e->terms[havereg_expr].data.expn->op != EXPR_ADD)
- InternalError(__LINE__, __FILE__,
- _("Register expression not ADD or EXPN"));
+ InternalError(_("Register expression not ADD or EXPN"));
/* Iterate over each term in reg expn */
for (i=0; i<e->terms[havereg_expr].data.expn->numterms; i++) {
* Sanity check for EXPR_INT.
*/
if (e->terms[i].data.expn->terms[0].type != EXPR_REG)
- InternalError(__LINE__, __FILE__,
- _("Register not found in reg expn"));
+ InternalError(_("Register not found in reg expn"));
if (e->terms[i].data.expn->terms[1].type != EXPR_INT)
- InternalError(__LINE__, __FILE__,
- _("Non-integer value in reg expn"));
+ InternalError(_("Non-integer value in reg expn"));
reg = get_reg(&e->terms[i].data.expn->terms[0], data);
if (!reg)
return 0;
xfree(left);
ptr->numterms++;
} else {
- InternalError(__LINE__, __FILE__,
- _("Right side of expression must exist"));
+ InternalError(_("Right side of expression must exist"));
}
if (right) {
/* The reg expn *must* be EXPR_ADD at this point. Sanity check. */
if (e->terms[havereg_expr].type != EXPR_EXPR ||
e->terms[havereg_expr].data.expn->op != EXPR_ADD)
- InternalError(__LINE__, __FILE__,
- _("Register expression not ADD or EXPN"));
+ InternalError(_("Register expression not ADD or EXPN"));
/* Iterate over each term in reg expn */
for (i=0; i<e->terms[havereg_expr].data.expn->numterms; i++) {
* Sanity check for EXPR_INT.
*/
if (e->terms[i].data.expn->terms[0].type != EXPR_REG)
- InternalError(__LINE__, __FILE__,
- _("Register not found in reg expn"));
+ InternalError(_("Register not found in reg expn"));
if (e->terms[i].data.expn->terms[1].type != EXPR_INT)
- InternalError(__LINE__, __FILE__,
- _("Non-integer value in reg expn"));
+ InternalError(_("Non-integer value in reg expn"));
reg = get_reg(&e->terms[i].data.expn->terms[0], data);
if (!reg)
return 0;
xfree(left);
ptr->numterms++;
} else {
- InternalError(__LINE__, __FILE__,
- _("Right side of expression must exist"));
+ InternalError(_("Right side of expression must exist"));
}
if (right) {
/* The reg expn *must* be EXPR_ADD at this point. Sanity check. */
if (e->terms[havereg_expr].type != EXPR_EXPR ||
e->terms[havereg_expr].data.expn->op != EXPR_ADD)
- InternalError(__LINE__, __FILE__,
- _("Register expression not ADD or EXPN"));
+ InternalError(_("Register expression not ADD or EXPN"));
/* Iterate over each term in reg expn */
for (i=0; i<e->terms[havereg_expr].data.expn->numterms; i++) {
* Sanity check for EXPR_INT.
*/
if (e->terms[i].data.expn->terms[0].type != EXPR_REG)
- InternalError(__LINE__, __FILE__,
- _("Register not found in reg expn"));
+ InternalError(_("Register not found in reg expn"));
if (e->terms[i].data.expn->terms[1].type != EXPR_INT)
- InternalError(__LINE__, __FILE__,
- _("Non-integer value in reg expn"));
+ InternalError(_("Non-integer value in reg expn"));
reg = get_reg(&e->terms[i].data.expn->terms[0], data);
if (!reg)
return 0;
xfree(left);
ptr->numterms++;
} else {
- InternalError(__LINE__, __FILE__,
- _("Right side of expression must exist"));
+ InternalError(_("Right side of expression must exist"));
}
if (right) {
/* The reg expn *must* be EXPR_ADD at this point. Sanity check. */
if (e->terms[havereg_expr].type != EXPR_EXPR ||
e->terms[havereg_expr].data.expn->op != EXPR_ADD)
- InternalError(__LINE__, __FILE__,
- _("Register expression not ADD or EXPN"));
+ InternalError(_("Register expression not ADD or EXPN"));
/* Iterate over each term in reg expn */
for (i=0; i<e->terms[havereg_expr].data.expn->numterms; i++) {
* Sanity check for EXPR_INT.
*/
if (e->terms[i].data.expn->terms[0].type != EXPR_REG)
- InternalError(__LINE__, __FILE__,
- _("Register not found in reg expn"));
+ InternalError(_("Register not found in reg expn"));
if (e->terms[i].data.expn->terms[1].type != EXPR_INT)
- InternalError(__LINE__, __FILE__,
- _("Non-integer value in reg expn"));
+ InternalError(_("Non-integer value in reg expn"));
reg = get_reg(&e->terms[i].data.expn->terms[0], data);
if (!reg)
return 0;
return NULL;
if (bc->type != BC_INSN)
- InternalError(__LINE__, __FILE__,
- _("Trying to get EA of non-instruction"));
+ InternalError(_("Trying to get EA of non-instruction"));
return bc->data.insn.ea;
}
bc->data.jmprel.opersize = opersize;
break;
default:
- InternalError(__LINE__, __FILE__,
- _("OperSize override applied to non-instruction"));
+ InternalError(_("OperSize override applied to non-instruction"));
return;
}
}
bc->data.jmprel.addrsize = addrsize;
break;
default:
- InternalError(__LINE__, __FILE__,
- _("AddrSize override applied to non-instruction"));
+ InternalError(_("AddrSize override applied to non-instruction"));
return;
}
}
lockrep_pre = &bc->data.jmprel.lockrep_pre;
break;
default:
- InternalError(__LINE__, __FILE__,
- _("LockRep prefix applied to non-instruction"));
+ InternalError(_("LockRep prefix applied to non-instruction"));
return;
}
return;
if (bc->type != BC_INSN)
- InternalError(__LINE__, __FILE__,
- _("Attempted to set shift flag on non-instruction"));
+ InternalError(_("Attempted to set shift flag on non-instruction"));
bc->data.insn.shift_op = 1;
}
switch (bc->type) {
case BC_EMPTY:
/* FIXME: delete it (probably in bytecodes_ level, not here */
- InternalError(__LINE__, __FILE__,
- _("got empty bytecode in parser_finalize"));
+ InternalError(_("got empty bytecode in parser_finalize"));
break;
case BC_INSN:
bytecode_parser_finalize_insn(bc);
/* Report an internal error. Essentially a fatal error with trace info.
* Exit immediately because it's essentially an assert() trap. */
void
-InternalError(unsigned int line, const char *file, const char *message)
+InternalError_(const char *file, unsigned int line, const char *message)
{
fprintf(stderr, _("INTERNAL ERROR at %s, line %d: %s\n"), file, line,
message);
void ParserError(const char *);
-void InternalError(unsigned int line, const char *file, const char *message);
+void InternalError_(const char *file, unsigned int line, const char *message);
+#define InternalError(msg) InternalError_(__FILE__, __LINE__, msg)
void Fatal(fatal_num);
void Error(const char *, ...);
xfree(left);
ptr->numterms++;
} else {
- InternalError(__LINE__, __FILE__,
- _("Right side of expression must exist"));
+ InternalError(_("Right side of expression must exist"));
}
if (right) {
/* The reg expn *must* be EXPR_ADD at this point. Sanity check. */
if (e->terms[havereg_expr].type != EXPR_EXPR ||
e->terms[havereg_expr].data.expn->op != EXPR_ADD)
- InternalError(__LINE__, __FILE__,
- _("Register expression not ADD or EXPN"));
+ InternalError(_("Register expression not ADD or EXPN"));
/* Iterate over each term in reg expn */
for (i=0; i<e->terms[havereg_expr].data.expn->numterms; i++) {
* Sanity check for EXPR_INT.
*/
if (e->terms[i].data.expn->terms[0].type != EXPR_REG)
- InternalError(__LINE__, __FILE__,
- _("Register not found in reg expn"));
+ InternalError(_("Register not found in reg expn"));
if (e->terms[i].data.expn->terms[1].type != EXPR_INT)
- InternalError(__LINE__, __FILE__,
- _("Non-integer value in reg expn"));
+ InternalError(_("Non-integer value in reg expn"));
reg = get_reg(&e->terms[i].data.expn->terms[0], data);
if (!reg)
return 0;
/* underflow and overflow both set!? */
if (underflow && overflow)
- InternalError(__LINE__, __FILE__, _("Both underflow and overflow set"));
+ InternalError(_("Both underflow and overflow set"));
/* check for underflow or overflow and set up appropriate output */
if (underflow) {
/* get little-endian bytes */
buf = BitVector_Block_Read(output, &len);
if (len < byte_size)
- InternalError(__LINE__, __FILE__,
- _("Byte length of BitVector does not match bit length"));
+ InternalError(_("Byte length of BitVector does not match bit length"));
/* copy to output */
memcpy(ptr, buf, byte_size*sizeof(unsigned char));
case 10:
return floatnum_get_common(flt, ptr, 10, 64, 0, 15);
default:
- InternalError(__LINE__, __FILE__,
- _("Invalid float conversion size"));
+ InternalError(_("Invalid float conversion size"));
return 1; /* never reached, but silence GCC warning */
}
}
}
if (!operand && op != EXPR_NEG && op != EXPR_NOT && op != EXPR_LNOT)
- InternalError(__LINE__, __FILE__, _("Operation needs an operand"));
+ InternalError(_("Operation needs an operand"));
/* A operation does a bitvector computation if result is allocated. */
switch (op) {
case INTNUM_BV:
return BitVector_Chunk_Read(intn->val.bv, 32, 0);
default:
- InternalError(__LINE__, __FILE__, _("unknown intnum type"));
+ InternalError(_("unknown intnum type"));
return 0;
}
}
} else
return BitVector_Chunk_Read(intn->val.bv, 32, 0);
default:
- InternalError(__LINE__, __FILE__, _("unknown intnum type"));
+ InternalError(_("unknown intnum type"));
return 0;
}
}
case INTNUM_BV:
buf = BitVector_Block_Read(intn->val.bv, &len);
if (len < size)
- InternalError(__LINE__, __FILE__,
- _("Invalid size specified (too large)"));
+ InternalError(_("Invalid size specified (too large)"));
memcpy(ptr, buf, size);
xfree(buf);
break;
xfree(void *p)
{
if (!p)
- InternalError(__LINE__, __FILE__, _("Tried to free NULL pointer"));
+ InternalError(_("Tried to free NULL pointer"));
free(p);
}