Permalink
Browse files

Standardize internal exception calls (James deBoer, james at huronbox…

… dot com).

See #32769.


git-svn-id: https://svn.parrot.org/parrot/trunk@7282 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 05ac062 commit d1854520e83526cefe263ddded1ae9fb7ad85e6f @chromatic chromatic committed Dec 12, 2004
View
@@ -50,7 +50,7 @@ static PMC* retval(Interp *interp, void *ret)
{
PMC *value;
if (ret == 0)
- internal_exception(OUT_OF_BOUNDS, "Array index out of bounds!\n");
+ internal_exception(OUT_OF_BOUNDS, "Array index out of bounds!");
/* XXX getting non existent value, exception or undef?
* current is for perlarray */
if (ret == (void*) -1)
@@ -135,7 +135,7 @@ Parrot_Array_set_pmc_ptr(Interp *interp, List *list, INTVAL key)
PMC *value;
if (ret == 0)
- internal_exception(OUT_OF_BOUNDS, "Array index out of bounds!\n");
+ internal_exception(OUT_OF_BOUNDS, "Array index out of bounds!");
/* assign into a sparse or not yet set value */
if (ret == (void*) -1 || *(PMC**)ret == 0) {
value = undef(interp);
@@ -675,7 +675,7 @@ Sets the PMC at element C<idx> to C<*src>.
INTVAL length;
length = ((List *) PMC_data(SELF))->length;
if (idx >= length || -idx > length) {
- internal_exception(OUT_OF_BOUNDS, "Array index out of bounds!\n");
+ internal_exception(OUT_OF_BOUNDS, "Array index out of bounds!");
}
list_assign(INTERP, (List *) PMC_data(SELF), idx,
@@ -974,7 +974,7 @@ C<offset>.
void splice(PMC* value, INTVAL offset, INTVAL count) {
if (SELF->vtable->base_type != value->vtable->base_type)
- internal_exception(1, "Type mismatch in splice\n");
+ internal_exception(1, "Type mismatch in splice");
list_splice(INTERP, (List*) PMC_data(SELF), value, offset, count);
}
View
@@ -114,7 +114,7 @@ complex_parse_string (Parrot_Interp interp,
if( (*t != 'i' && *t != 'j') || (*(t+1) != 0) ) {
/* imaginary part does not end in 'i' or 'j' */
internal_exception(INVALID_STRING_REPRESENTATION,
- "Complex: malformed string\n");
+ "Complex: malformed string");
first_num_length = second_num_length = 0;
}
/* this is useful if there is no number for the
@@ -126,7 +126,7 @@ complex_parse_string (Parrot_Interp interp,
else {
/* "+" or "-" not found: error */
internal_exception(INVALID_STRING_REPRESENTATION,
- "Complex: malformed string\n");
+ "Complex: malformed string");
first_num_length = second_num_length = 0;
}
}
@@ -188,7 +188,7 @@ complex_locate_keyed_num(Parrot_Interp interp, PMC* self, STRING *key) {
if(0 == string_equal(interp, key, real))
return &RE(self);
internal_exception(KEY_NOT_FOUND,
- "Complex: key is neither 'real' or 'imag'\n");
+ "Complex: key is neither 'real' or 'imag'");
return NULL;
}
View
@@ -55,7 +55,7 @@ static void
cant_do_method(Parrot_Interp interpreter, PMC * pmc, const char *methname)
{
internal_exception(ILL_INHERIT,
- "%s() not implemented in class '%s'\n", methname,
+ "%s() not implemented in class '%s'", methname,
caller(interpreter, pmc));
}
View
@@ -87,15 +87,15 @@ find_or_die(Parrot_Interp interpreter, PMC *pmc, STRING *meth) {
if (PObj_is_object_TEST(pmc)) {
class = GET_CLASS((Buffer *)PMC_data(pmc), pmc);
internal_exception(METH_NOT_FOUND,
- "Can't find method '%s' for object '%s'\n",
+ "Can't find method '%s' for object '%s'",
string_to_cstring(interpreter, meth),
string_to_cstring(interpreter, PMC_str_val(
get_attrib_num((SLOTTYPE *)PMC_data(class),
PCD_CLASS_NAME)))
);
} else {
internal_exception(METH_NOT_FOUND,
- "Can't find method '%s' - erroneous PMC\n",
+ "Can't find method '%s' - erroneous PMC",
string_to_cstring(interpreter, meth)
);
}
@@ -157,7 +157,7 @@ Returns the integer value of the element at index C<key>.
INTVAL *data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedBooleanArray: index out of bounds!\n");
+ "FixedBooleanArray: index out of bounds!");
data = (INTVAL *)PMC_data(SELF);
return data[key];
@@ -288,7 +288,7 @@ Resizes the array to C<size> elements.
void set_integer_native (INTVAL size) {
if (PMC_int_val(SELF) || size < 1)
- internal_exception(OUT_OF_BOUNDS, "FixedBooleanArray: Can't resize!\n");
+ internal_exception(OUT_OF_BOUNDS, "FixedBooleanArray: Can't resize!");
PMC_int_val(SELF) = size;
PMC_data(SELF) = mem_sys_allocate(size * sizeof(INTVAL));
PObj_active_destroy_SET(SELF);
@@ -308,7 +308,7 @@ Sets the integer value of the element at index C<key> to C<value>.
INTVAL *data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedBooleanArray: index out of bounds!\n");
+ "FixedBooleanArray: index out of bounds!");
data = (INTVAL*)PMC_data(SELF);
data[key] = (value != 0);
@@ -188,7 +188,7 @@ Returns the floating-point value of the element at index C<key>.
FLOATVAL *data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedFloatArray: index out of bounds!\n");
+ "FixedFloatArray: index out of bounds!");
data = (FLOATVAL *)PMC_data(SELF);
return data[key];
@@ -288,7 +288,7 @@ Resizes the array to C<size> elements.
void set_integer_native (INTVAL size) {
if (PMC_int_val(SELF) || size < 1)
- internal_exception(OUT_OF_BOUNDS, "FixedFloatArray: Can't resize!\n");
+ internal_exception(OUT_OF_BOUNDS, "FixedFloatArray: Can't resize!");
PMC_int_val(SELF) = size;
PMC_data(SELF) = mem_sys_allocate(size * sizeof(FLOATVAL));
PObj_active_destroy_SET(SELF);
@@ -339,7 +339,7 @@ C<value>.
FLOATVAL *data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedFloatArray: index out of bounds!\n");
+ "FixedFloatArray: index out of bounds!");
data = (FLOATVAL*)PMC_data(SELF);
data[key] = value;
@@ -157,7 +157,7 @@ Returns the integer value of the element at index C<key>.
INTVAL *data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedIntegerArray: index out of bounds!\n");
+ "FixedIntegerArray: index out of bounds!");
data = (INTVAL *)PMC_data(SELF);
return data[key];
@@ -288,7 +288,7 @@ Resizes the array to C<size> elements.
void set_integer_native (INTVAL size) {
if (PMC_int_val(SELF) || size < 1)
- internal_exception(OUT_OF_BOUNDS, "FixedIntegerArray: Can't resize!\n");
+ internal_exception(OUT_OF_BOUNDS, "FixedIntegerArray: Can't resize!");
PMC_int_val(SELF) = size;
PMC_data(SELF) = mem_sys_allocate(size * sizeof(INTVAL));
PObj_active_destroy_SET(SELF);
@@ -308,7 +308,7 @@ Sets the integer value of the element at index C<key> to C<value>.
INTVAL *data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedIntegerArray: index out of bounds!\n");
+ "FixedIntegerArray: index out of bounds!");
data = (INTVAL*)PMC_data(SELF);
data[key] = value;
@@ -422,7 +422,7 @@ Returns the PMC value of the element at index C<key>.
PMC **data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedPMCArray: index out of bounds!\n");
+ "FixedPMCArray: index out of bounds!");
data = (PMC **)PMC_data(SELF);
return data[key];
@@ -458,7 +458,7 @@ Resizes the array to C<size> elements.
PMC **data;
if (PMC_int_val(SELF) && size)
- internal_exception(OUT_OF_BOUNDS, "FixedPMCArray: Can't resize!\n");
+ internal_exception(OUT_OF_BOUNDS, "FixedPMCArray: Can't resize!");
if (!size)
return;
PMC_int_val(SELF) = size;
@@ -604,7 +604,7 @@ Sets the PMC value of the element at index C<key> to C<*src>.
PMC **data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedPMCArray: index out of bounds!\n");
+ "FixedPMCArray: index out of bounds!");
data = (PMC**)PMC_data(SELF);
DOD_WRITE_BARRIER(INTERP, SELF, data[key], src);
@@ -243,7 +243,7 @@ Returns the Parrot string value of the element at index C<key>.
STRING **data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedStringArray: index out of bounds!\n");
+ "FixedStringArray: index out of bounds!");
data = (STRING **)PMC_data(SELF);
return data[key];
@@ -312,7 +312,7 @@ Resizes the array to C<size> elements.
void set_integer_native (INTVAL size) {
if (PMC_int_val(SELF) || size < 1)
- internal_exception(OUT_OF_BOUNDS, "FixedStringArray: Can't resize!\n");
+ internal_exception(OUT_OF_BOUNDS, "FixedStringArray: Can't resize!");
PMC_int_val(SELF) = size;
PMC_data(SELF) = mem_sys_allocate_zeroed(size * sizeof(STRING*));
PObj_custom_mark_destroy_SETALL(SELF);
@@ -406,7 +406,7 @@ Sets the Parrot string value of the element at index C<key> to C<value>.
STRING **data;
if (key < 0 || key >= PMC_int_val(SELF))
internal_exception(OUT_OF_BOUNDS,
- "FixedStringArray: index out of bounds!\n");
+ "FixedStringArray: index out of bounds!");
data = (STRING**)PMC_data(SELF);
data[key] = value;
View
@@ -598,7 +598,7 @@ Divides the integer by C<*value> and returns the result in C<*dest>.
*/
void divide (PMC* value, PMC* dest) {
MMD_PerlUndef: {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
MMD_BigInt: {
overflow_p(INTERP, SELF, value, dest, MMD_DIVIDE);
@@ -609,7 +609,7 @@ MMD_DEFAULT: {
FLOATVAL d;
INTVAL i;
if (valf == 0.0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
return;
}
d = PMC_int_val(SELF)/valf;
@@ -623,7 +623,7 @@ MMD_DEFAULT: {
void floor_divide (PMC* value, PMC* dest) {
MMD_PerlUndef: {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
MMD_BigInt: {
overflow_p(INTERP, SELF, value, dest, MMD_DIVIDE);
View
@@ -20,7 +20,7 @@ C<IntList> provides an integer-only array.
#include "parrot/parrot.h"
-#define THROW_UNSUPPORTED internal_exception(INTERP_ERROR, "Operation not supported\n")
+#define THROW_UNSUPPORTED internal_exception(INTERP_ERROR, "Operation not supported")
pmclass IntList does array {
@@ -212,7 +212,7 @@ Removes and returns the first element in the list.
void splice(PMC* value, INTVAL offset, INTVAL count) {
if (SELF->vtable->base_type != value->vtable->base_type)
- internal_exception(1, "Type mismatch in splice\n");
+ internal_exception(1, "Type mismatch in splice");
list_splice(INTERP, (List*) PMC_struct_val(SELF), value,
offset, count);
}
View
@@ -40,7 +40,7 @@ Raises an exception. Use C<init_pmc()>.
*/
void init () {
- internal_exception(1, "Iterator init without aggregate\n");
+ internal_exception(1, "Iterator init without aggregate");
}
/*
@@ -283,7 +283,7 @@ Reset the Iterator. C<value> must be one of
void set_integer_native (INTVAL value) {
PMC *key, *agg;
if (value < ITERATE_FROM_START || value > ITERATE_FROM_END)
- internal_exception(1, "Illegal set_integer on iterator\n");
+ internal_exception(1, "Illegal set_integer on iterator");
/* reset iterator on aggregate */
agg = (PMC*) PMC_pmc_val(SELF);
if (agg->vtable->base_type == enum_class_Slice) {
View
@@ -49,7 +49,7 @@
}
print " $retval $methname ($args) {\n";
- print " internal_exception(NULL_REG_ACCESS, \"Fatal exception: Null PMC access (PMC::$methname)!\\n\");\n";
+ print " internal_exception(NULL_REG_ACCESS, \"Fatal exception: Null PMC access (PMC::$methname)!\");\n";
if($retval ne 'void') {
print " return ($retval)0;\n";
}
View
@@ -62,7 +62,7 @@ C<Parrot_instantiate_object()>.
*/
void init() {
- internal_exception(1, "Can't create new ParrotObjects\n",
+ internal_exception(1, "Can't create new ParrotObjects",
"use the registered class instead");
}
View
@@ -142,7 +142,7 @@ static STRING* make_hash_key(Interp* interpreter, PMC * key)
{
if (key == NULL) {
internal_exception(OUT_OF_BOUNDS,
- "Cannot use NULL key for PerlHash!\n");
+ "Cannot use NULL key for PerlHash!");
return NULL;
}
return key_string(interpreter, key);
View
@@ -268,7 +268,7 @@ When Python mode is enabled does sprintf :(
}
else {
internal_exception(INVALID_OPERATION,
- "modulus() not implemented for PerlString\n");
+ "modulus() not implemented for PerlString");
}
}
View
@@ -306,15 +306,15 @@ Morphs to a C<PerlString> with the value of C<*value>.
Parrot_warn(INTERP, PARROT_WARNINGS_UNDEF_FLAG,
"Use of uninitialized value in division");
if(value->vtable == Parrot_base_vtables[enum_class_PerlUndef]) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
else if(value->vtable == Parrot_base_vtables[enum_class_PerlInt]) {
if(VTABLE_get_integer(INTERP, value) == 0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
}
else if(VTABLE_get_number(INTERP, value) == 0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
VTABLE_set_integer_native(INTERP, dest, 0);
@@ -332,7 +332,7 @@ Morphs to a C<PerlString> with the value of C<*value>.
Parrot_warn(INTERP, PARROT_WARNINGS_UNDEF_FLAG,
"Use of uninitialized value in integer division");
if(value == 0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
VTABLE_set_integer_native(INTERP, dest, 0);
}
@@ -350,7 +350,7 @@ Morphs to a C<PerlString> with the value of C<*value>.
Parrot_warn(INTERP, PARROT_WARNINGS_UNDEF_FLAG,
"Use of uninitialized value in numeric division");
if(value == 0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
VTABLE_set_integer_native(INTERP, dest, 0);
}
@@ -367,15 +367,15 @@ Morphs to a C<PerlString> with the value of C<*value>.
Parrot_warn(INTERP, PARROT_WARNINGS_UNDEF_FLAG,
"Use of uninitialized value in modulus");
if(value->vtable == Parrot_base_vtables[enum_class_PerlUndef]) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
else if(value->vtable == Parrot_base_vtables[enum_class_PerlInt]) {
if(VTABLE_get_integer(INTERP, value) == 0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
}
else if(VTABLE_get_number(INTERP, value) == 0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
VTABLE_set_integer_native(INTERP, dest, 0);
@@ -393,7 +393,7 @@ Morphs to a C<PerlString> with the value of C<*value>.
Parrot_warn(INTERP, PARROT_WARNINGS_UNDEF_FLAG,
"Use of uninitialized value in integer modulus");
if(value == 0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
VTABLE_set_integer_native(INTERP, dest, 0);
}
@@ -411,7 +411,7 @@ Morphs to a C<PerlString> with the value of C<*value>.
Parrot_warn(INTERP, PARROT_WARNINGS_UNDEF_FLAG,
"Use of uninitialized value in numeric modulus");
if(value == 0) {
- internal_exception(DIV_BY_ZERO, "division by zero!\n");
+ internal_exception(DIV_BY_ZERO, "division by zero!");
}
VTABLE_set_integer_native(INTERP, dest, 0);
}
Oops, something went wrong.

0 comments on commit d185452

Please sign in to comment.