# New Ticket Created by Brent Dax # Please include the string: [perl #17646] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17646 >
This patch adds a very, very rudimentary form of C-level exception handling--bringing Parrot beyond the "homo erectus"[1] stage of exception handling into the stone age. :^) It adds a global function pointer, Parrot_exception_handler(), which is called by internal_exception() to handle exceptions. It is passed the error code (currently always 1) and the text of the message, and can do whatever it wants with that information--even ignore it, in which case internal_exception will return to the function that threw the exception. I don't expect this to be permanent--it's basically there because I'm working on a Parrot::Interp module (great book, Simon!) and want to translate the embedding and packfile systems' exceptions into Perl ones. As a bonus, this patch also fixes embed.c and packfile.c's bad habit of using fprintf() to report errors. Finally, it changes the error message format--the text handed to internal_exception() is surrounded by "Parrot VM: " on one side and ".\n" on the other (at least in the default exception handler). This means that I had to edit several tests and touch other files to reflect the new error message format. All tests pass, except for t/src, which has never passed on Windows. [1] Most of you probably know this already, but I've been bitten by misunderstood comments before, so I'm being careful. *Homo erectus* was an earlier stage of human evolution, not something a religious fundamentalist would claim to be an abomination. :^) --Brent Dax <[EMAIL PROTECTED]> @roles=map {"Parrot $_"} qw(embedding regexen Configure) Wire telegraph is a kind of a very, very long cat. You pull his tail in New York and his head is meowing in Los Angeles. And radio operates exactly the same way. The only difference is that there is no cat. --Albert Einstein (explaining radio) -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/38832/31536/410700/patch.txt
Index: embed.c =================================================================== RCS file: /cvs/public/parrot/embed.c,v retrieving revision 1.40 diff -u -r1.40 embed.c --- embed.c 26 Aug 2002 14:15:45 -0000 1.40 +++ embed.c 28 Sep 2002 10:50:56 -0000 @@ -97,13 +97,16 @@ /* if we have stat(), get the actual file size so we can read it * in one chunk. */ if (stat(filename, &file_stat)) { - fprintf(stderr, "Parrot VM: Can't stat %s, code %i.\n", filename, - errno); + internal_exception(STARTUP_ERROR, + "Can't stat %s (errno %i)", + filename, errno); return NULL; } if (!S_ISREG(file_stat.st_mode)) { - fprintf(stderr, "Parrot VM: %s is not a normal file.\n", filename); + internal_exception(STARTUP_ERROR, + "File %s is not normal", + filename); return NULL; } @@ -119,8 +122,9 @@ #ifndef HAS_HEADER_SYSMMAN io = PIO_open(interpreter, filename, "<"); if (!io) { - fprintf(stderr, "Parrot VM: Can't open %s, code %i.\n", filename, - errno); + internal_exception(STARTUP_ERROR, + "Can't open %s (errno %i)", + filename, errno); return NULL; } @@ -146,8 +150,8 @@ if (NULL == program_code) { /* Whoops, out of memory. */ - fprintf(stderr, - "Parrot VM: Could not allocate buffer to read packfile from PIO.\n"); + internal_exception(STARTUP_ERROR, + "Can't allocate buffer to read packfile from PIO"); return NULL; } @@ -162,8 +166,8 @@ realloc(program_code, program_size + chunk_size); if (NULL == program_code) { - fprintf(stderr, - "Parrot VM: Could not reallocate buffer while reading packfile from PIO.\n"); + internal_exception(STARTUP_ERROR, + "Can't reallocate buffer while reading packfile from PIO"); return NULL; } @@ -171,8 +175,8 @@ } if (read_result < 0) { - fprintf(stderr, - "Parrot VM: Problem reading packfile from PIO.\n"); + internal_exception(STARTUP_ERROR, + "Problem reading packfile from PIO"); return NULL; } } @@ -184,8 +188,8 @@ fd = open(filename, O_RDONLY | O_BINARY); if (!fd) { - fprintf(stderr, "Parrot VM: Can't open %s, code %i.\n", filename, - errno); + internal_exception(STARTUP_ERROR, "Can't open %s (errno %i)", + filename, errno); return NULL; } @@ -193,15 +197,15 @@ mmap(0, program_size, PROT_READ, MAP_SHARED, fd, (off_t)0); if (!program_code) { - fprintf(stderr, "Parrot VM: Can't read file %s, code %i.\n", - filename, errno); + internal_exception(STARTUP_ERROR, "Can't read file %s (errno %i)", + filename, errno); return NULL; } #else /* HAS_HEADER_SYSMMAN */ - fprintf(stderr, - "Parrot VM: uncaught error occurred reading file or mmap not available.\n"); + internal_exception(STARTUP_ERROR, + "Uncaught error occurred reading file or mmap not available"); return NULL; #endif /* HAS_HEADER_SYSMMAN */ @@ -214,7 +218,8 @@ if (!PackFile_unpack (interpreter, pf, (opcode_t *)program_code, program_size)) { - fprintf(stderr, "Parrot VM: Can't unpack packfile %s.\n", filename); + internal_exception(STARTUP_ERROR, + "Can't unpack packfile %s", filename); return NULL; } Index: exceptions.c =================================================================== RCS file: /cvs/public/parrot/exceptions.c,v retrieving revision 1.6 diff -u -r1.6 exceptions.c --- exceptions.c 12 Sep 2002 14:52:25 -0000 1.6 +++ exceptions.c 28 Sep 2002 10:50:56 -0000 @@ -15,17 +15,35 @@ #include <stdarg.h> -/* Exception Handler */ +/* Exception handler */ + +void standard_exception_handler(Parrot_Int exitcode, const char *text) { + fprintf(stderr, "Parrot VM: %s.\n", text); + exit(exitcode); +} + +void (*Parrot_exception_handler)(Parrot_Int exitcode, const char *text) = + &standard_exception_handler; + void internal_exception(int exitcode, const char *format, ...) { va_list arglist; + char *buffer; + INTVAL fmtlen=strlen(format); + va_start(arglist, format); - vfprintf(stderr, format, arglist); + + buffer=mem_sys_allocate(1024); + Parrot_vsnprintf(NULL, buffer, 1023, format, &arglist); + (*Parrot_exception_handler)(exitcode, buffer); + mem_sys_free(buffer); + va_end(arglist); - exit(exitcode); } + + /* Panic handler */ #define dumpcore() printf("Sorry, coredump is not yet implemented for this platform.\n\n"); exit(1); @@ -40,7 +58,7 @@ if (interpreter) printf("line %d\n", interpreter->current_line); else - printf("line ((not available)\n"); + printf("line (not available)\n"); printf("\n\ We highly suggest you notify the Parrot team if you have not been working on \n\ Parrot. Use bugs6.perl.org or send an e-mail to [EMAIL PROTECTED] \n\ Index: interpreter.c =================================================================== RCS file: /cvs/public/parrot/interpreter.c,v retrieving revision 1.99 diff -u -r1.99 interpreter.c --- interpreter.c 14 Sep 2002 16:10:13 -0000 1.99 +++ interpreter.c 28 Sep 2002 10:50:56 -0000 @@ -82,7 +82,7 @@ if (pc && (pc < code_start || pc >= code_end)) { internal_exception(INTERP_ERROR, - "Error: Control left bounds of byte-code block (now at location %d)!\n", + "Control left bounds of byte-code block (now at location +%d)", (int)(pc - code_start)); } } @@ -136,7 +136,7 @@ if (!prederef_oplib_handle) { internal_exception(PREDEREF_LOAD_ERROR, - "Unable to dynamically load oplib file '%s' for oplib '%s_prederef' version %s!\n", + "Unable to dynamically load oplib file '%s' for oplib +'%s_prederef' version %s", file_name, PARROT_CORE_OPLIB_NAME, PARROT_VERSION); } @@ -154,7 +154,7 @@ if (!prederef_oplib_init) { internal_exception(PREDEREF_LOAD_ERROR, - "No exported symbol for oplib init function '%s' from oplib file '%s' for oplib '%s_prederef' version %s!\n", + "No exported symbol for oplib init function '%s' from +oplib file '%s' for oplib '%s_prederef' version %s", func_name, file_name, PARROT_CORE_OPLIB_NAME, PARROT_VERSION); } @@ -167,7 +167,7 @@ if (!prederef_oplib) { internal_exception(PREDEREF_LOAD_ERROR, - "No oplib info returned by oplib init function '%s' from oplib file '%s' for oplib '%s_prederef' version %s!\n", + "No oplib info returned by oplib init function '%s' from +oplib file '%s' for oplib '%s_prederef' version %s", func_name, file_name, PARROT_CORE_OPLIB_NAME, PARROT_VERSION); } @@ -180,7 +180,7 @@ if (prederef_op_count <= 0) { internal_exception(PREDEREF_LOAD_ERROR, - "Illegal op count (%d) from oplib file '%s' for oplib '%s_prederef' version %s!\n", + "Illegal op count (%d) from oplib file '%s' for oplib +'%s_prederef' version %s", (int)prederef_op_count, file_name, PARROT_CORE_OPLIB_NAME, PARROT_VERSION); } @@ -205,7 +205,7 @@ if (!prederef_op_func) { internal_exception(PREDEREF_LOAD_ERROR, - "No op func table in oplib file '%s' for oplib '%s_prederef' version %s!\n", + "No op func table in oplib file '%s' for oplib +'%s_prederef' version %s", file_name, PARROT_CORE_OPLIB_NAME, PARROT_VERSION); } } @@ -294,7 +294,7 @@ /* pc_prederef[i] = (void *) &interpreter->code->const_table->constants[pc[i]]->pmc; */ internal_exception(ARG_OP_NOT_HANDLED, - "PMC constants not yet supported!\n"); + "PMC constants not yet supported"); break; case PARROT_ARG_SC: @@ -308,13 +308,13 @@ break; default: internal_exception(ARG_OP_NOT_HANDLED, - "Unhandled argtype %d\n",opinfo->types[i]); + "Unhandled argtype %d",opinfo->types[i]); break; } if (opinfo->types[i] != PARROT_ARG_IC && pc_prederef[i] == 0) { internal_exception(INTERP_ERROR, - "Prederef generated a NULL pointer for arg of type %d!\n", + "Prederef generated a NULL pointer for arg of type %d", opinfo->types[i]); } } @@ -400,7 +400,7 @@ if (pc && (pc < code_start || pc >= code_end)) { internal_exception(INTERP_ERROR, - "Error: Control left bounds of byte-code block (now at location %d)!\n", + "Error: Control left bounds of byte-code block (now at +location %d)", (int)(pc - code_start)); } } @@ -472,7 +472,7 @@ else if (Interp_flags_TEST(interpreter, PARROT_JIT_FLAG)) { #if !JIT_CAPABLE internal_exception(JIT_UNAVAILABLE, - "Error: PARROT_JIT_FLAG is set, but interpreter is not JIT_CAPABLE!\n"); + "PARROT_JIT_FLAG is set, but interpreter is not +JIT_CAPABLE"); #endif runops_jit(interpreter, pc); Index: packfile.c =================================================================== RCS file: /cvs/public/parrot/packfile.c,v retrieving revision 1.55 diff -u -r1.55 packfile.c --- packfile.c 19 Aug 2002 23:14:48 -0000 1.55 +++ packfile.c 28 Sep 2002 10:50:57 -0000 @@ -48,14 +48,14 @@ struct PackFile *pf = mem_sys_allocate(sizeof(struct PackFile)); if (!pf) { - fprintf(stderr, "PackFile_new: Unable to allocate!\n"); + internal_exception(PACKFILE_LOAD_ERROR, "Unable to allocate new packfile"); return NULL; } pf->header = mem_sys_allocate(sizeof(struct PackFile_Header)); if(!pf->header) { - fprintf(stderr, "PackFile_new: Unable to allocate header!\n"); + internal_exception(PACKFILE_LOAD_ERROR, "Unable to allocate new packfile +header"); PackFile_destroy(pf); return NULL; } @@ -65,7 +65,7 @@ mem_sys_allocate(sizeof(struct PackFile_FixupTable)); if (!pf->fixup_table) { - fprintf(stderr, "PackFile_new: Unable to allocate fixup table!\n"); + internal_exception(PACKFILE_LOAD_ERROR, "Unable to allocate new packfile +fixup table"); PackFile_destroy(pf); return NULL; } @@ -76,7 +76,7 @@ mem_sys_allocate(sizeof(struct PackFile_ConstTable)); if (!pf->const_table) { - fprintf(stderr, "PackFile_new: Unable to allocate constant table!\n"); + internal_exception(PACKFILE_LOAD_ERROR, "Unable to allocate new packfile +constant table"); PackFile_destroy(pf); return NULL; } @@ -205,7 +205,7 @@ PackFile_destroy(struct PackFile *pf) { if (!pf) { - fprintf(stderr, "PackFile_destroy: pf == NULL!\n"); + internal_exception(stderr, "PackFile_destroy: pf == NULL!\n"); return; } @@ -321,10 +321,11 @@ * FIXME */ if(self->need_wordsize) { - fprintf(stderr, - "PackFile_unpack: Unimplemented wordsize transform.\n"); - fprintf(stderr, "File has wordsize: %d (native is %d)\n", - header->wordsize, sizeof(opcode_t)); + internal_exception(PACKFILE_LOAD_ERROR, + "Unimplemented wordsize transform " + "(file wordsize %d, native wordsize %d)", + header->wordsize, sizeof(opcode_t) + ); return 0; } @@ -337,7 +338,7 @@ * The magic and opcodetype fields are in native byteorder. */ if (header->magic != PARROT_MAGIC) { - fprintf(stderr, "PackFile_unpack: Not a Parrot PackFile!\n"); + internal_exception(PACKFILE_LOAD_ERROR, "File is not a Parrot packfile"); #if TRACE_PACKFILE fprintf(stderr, "Magic number was [%x] not [%x]\n", header->magic, PARROT_MAGIC); @@ -363,8 +364,8 @@ if (!PackFile_FixupTable_unpack(self->fixup_table, cursor, header->fixup_ss)) { - fprintf(stderr, - "PackFile_unpack: Error reading fixup table segment!\n"); + internal_exception(PACKFILE_LOAD_ERROR, + "Error reading packfile fixup table segment"); return 0; } @@ -383,8 +384,8 @@ if (!PackFile_ConstTable_unpack(interpreter, self, self->const_table, cursor, header->const_ss)) { - fprintf(stderr, - "PackFile_unpack: Error reading constant table segment!\n"); + internal_exception(PACKFILE_LOAD_ERROR, + "Error reading constant table segment"); return 0; } @@ -407,8 +408,8 @@ self->byte_code = mem_sys_allocate(self->byte_code_size); if (!self->byte_code) { - fprintf(stderr, - "PackFile_unpack: Unable to allocate memory to copy byte code!\n"); + internal_exception(PACKFILE_LOAD_ERROR, + "Unable to allocate memory to copy byte code"); self->byte_code_size = 0; return 0; } @@ -551,7 +552,7 @@ opcode_t i; if (!self) { - fprintf(stderr, "PackFile_ConstTable_unpack: self == NULL!\n"); + PANIC("PackFile_ConstTable_unpack: self == NULL"); return 0; } @@ -575,8 +576,8 @@ sizeof(struct PackFile_Constant *)); if (!self->constants) { - fprintf(stderr, - "PackFile_ConstTable_unpack: Could not allocate memory for array!\n"); + internal_exception(PACKFILE_LOAD_ERROR, + "Could not allocate memory for packfile constant table array"); self->const_count = 0; return 0; } Index: register.c =================================================================== RCS file: /cvs/public/parrot/register.c,v retrieving revision 1.23 diff -u -r1.23 register.c --- register.c 4 Jul 2002 20:39:44 -0000 1.23 +++ register.c 28 Sep 2002 10:50:57 -0000 @@ -73,7 +73,7 @@ } /* Nope. So pitch a fit */ else { - internal_exception(NO_REG_FRAMES, "No more I register frames to pop!"); + internal_exception(NO_REG_FRAMES, "No more I register frames to pop"); } } @@ -151,7 +151,7 @@ } /* Nope. So pitch a fit */ else { - internal_exception(NO_REG_FRAMES, "No more S register frames to pop!"); + internal_exception(NO_REG_FRAMES, "No more S register frames to pop"); } } @@ -228,7 +228,7 @@ } /* Nope. So pitch a fit */ else { - internal_exception(NO_REG_FRAMES, "No more N register frames to pop!"); + internal_exception(NO_REG_FRAMES, "No more N register frames to pop"); } } @@ -305,7 +305,7 @@ } /* Nope. So pitch a fit */ else { - internal_exception(NO_REG_FRAMES, "No more P register frames to pop!"); + internal_exception(NO_REG_FRAMES, "No more P register frames to pop"); } } Index: stacks.c =================================================================== RCS file: /cvs/public/parrot/stacks.c,v retrieving revision 1.45 diff -u -r1.45 stacks.c --- stacks.c 17 Aug 2002 01:11:08 -0000 1.45 +++ stacks.c 28 Sep 2002 10:50:57 -0000 @@ -176,7 +176,7 @@ depth = num_entries - 1; if (stack_height(interpreter, stack) < (size_t)num_entries) { - internal_exception(ERROR_STACK_SHALLOW, "Stack too shallow!\n"); + internal_exception(ERROR_STACK_SHALLOW, "Stack too shallow"); } temp = *stack_entry(interpreter, stack, depth); @@ -190,7 +190,7 @@ else { if (stack_height(interpreter, stack) < (size_t)num_entries) { - internal_exception(ERROR_STACK_SHALLOW, "Stack too shallow!\n"); + internal_exception(ERROR_STACK_SHALLOW, "Stack too shallow"); } temp = *stack_entry(interpreter, stack, 0); @@ -284,7 +284,7 @@ break; default: internal_exception(ERROR_BAD_STACK_TYPE, - "Invalid Stack_Entry_type!\n"); + "Invalid Stack_Entry_type"); break; } @@ -329,7 +329,7 @@ /* Quick sanity check */ if (chunk->used == 0) { - internal_exception(ERROR_STACK_EMPTY, "No entries on stack!\n"); + internal_exception(ERROR_STACK_EMPTY, "No entries on stack"); } /* Now decrement the SP */ @@ -340,7 +340,7 @@ /* Types of 0 mean we don't care */ if (type && entry->entry_type != type) { internal_exception(ERROR_BAD_STACK_TYPE, - "Wrong type on top of stack!\n"); + "Wrong type on top of stack"); } /* Cleanup routine? */ @@ -375,7 +375,7 @@ break; default: internal_exception(ERROR_BAD_STACK_TYPE, - "Wrong type on top of stack!\n"); + "Wrong type on top of stack"); break; } Index: classes/array.pmc =================================================================== RCS file: /cvs/public/parrot/classes/array.pmc,v retrieving revision 1.35 diff -u -r1.35 array.pmc --- classes/array.pmc 18 Sep 2002 13:55:09 -0000 1.35 +++ classes/array.pmc 28 Sep 2002 10:50:57 -0000 @@ -17,7 +17,7 @@ #include "parrot/parrot.h" -#define THROW_UNSUPPORTED internal_exception(INVALID_OPERATION, "Operation not supported\n") +#define THROW_UNSUPPORTED internal_exception(INVALID_OPERATION, "Operation not +supported") static PMC* undef(struct Parrot_Interp* interpreter) { @@ -39,7 +39,7 @@ } else { internal_exception(OUT_OF_BOUNDS, - "Array resize out of bounds!\n"); + "Array resize out of bound"); } } else { @@ -118,7 +118,7 @@ if ((ix >= SELF->cache.int_val) || (ix < -SELF->cache.int_val)) { internal_exception(OUT_OF_BOUNDS, - "Array index out of bounds!\n"); + "Array index out of bounds"); } if (ix < 0) { @@ -163,7 +163,7 @@ if ((ix >= SELF->cache.int_val) || (ix < -SELF->cache.int_val)) { internal_exception(OUT_OF_BOUNDS, - "Array index out of bounds!\n"); + "Array index out of bounds"); } if (ix < 0) { @@ -208,7 +208,7 @@ if ((ix >= SELF->cache.int_val) || (ix < -SELF->cache.int_val)) { internal_exception(OUT_OF_BOUNDS, - "Array index out of bounds!\n"); + "Array index out of bounds"); } if (ix < 0) { @@ -249,7 +249,7 @@ if ((ix >= SELF->cache.int_val) || (ix < -SELF->cache.int_val)) { internal_exception(OUT_OF_BOUNDS, - "Array index out of bounds!\n"); + "Array index out of bounds"); } if (ix < 0) { @@ -321,7 +321,7 @@ if (ix >= SELF->cache.int_val || ix < -SELF->cache.int_val) { internal_exception(OUT_OF_BOUNDS, - "Array index out of bounds!\n"); + "Array index out of bounds"); } if (ix < 0) { @@ -375,7 +375,7 @@ if (ix >= SELF->cache.int_val || ix < -SELF->cache.int_val) { internal_exception(OUT_OF_BOUNDS, - "Array index out of bounds!\n"); + "Array index out of bounds"); } else if (ix < 0) { ix += SELF->cache.int_val; Index: include/parrot/exceptions.h =================================================================== RCS file: /cvs/public/parrot/include/parrot/exceptions.h,v retrieving revision 1.19 diff -u -r1.19 exceptions.h --- include/parrot/exceptions.h 8 Aug 2002 20:58:19 -0000 1.19 +++ include/parrot/exceptions.h 28 Sep 2002 10:51:44 -0000 @@ -14,6 +14,9 @@ #define PARROT_EXCEPTIONS_H_GUARD +extern void (*Parrot_exception_handler)(Parrot_Int exitcode, + const char *text); + /* Prototypes */ void internal_exception(int exitcode, const char *format, ...); void do_panic(struct Parrot_Interp *interpreter, const char *message, @@ -51,6 +54,8 @@ #define INTERNAL_PANIC 1 #define OUT_OF_BOUNDS 1 #define JIT_ERROR 1 +#define PACKFILE_LOAD_ERROR 1 +#define STARTUP_ERROR 1 #endif Index: t/op/stacks.t =================================================================== RCS file: /cvs/public/parrot/t/op/stacks.t,v retrieving revision 1.23 diff -u -r1.23 stacks.t --- t/op/stacks.t 4 Jul 2002 00:15:00 -0000 1.23 +++ t/op/stacks.t 28 Sep 2002 10:51:44 -0000 @@ -220,15 +220,15 @@ # Now, to make it do BAD THINGS! -output_is(<<"CODE",'No more I register frames to pop!','ENO I frames'); +output_is(<<"CODE", "Parrot VM: No more I register frames to pop.\n",'ENO I frames'); popi end CODE -output_is(<<"CODE",'No more N register frames to pop!','ENO N frames'); +output_is(<<"CODE", "Parrot VM: No more N register frames to pop.\n",'ENO N frames'); popn end CODE -output_is(<<"CODE",'No more S register frames to pop!','ENO S frames'); +output_is(<<"CODE", "Parrot VM: No more S register frames to pop.\n",'ENO S frames'); pops end CODE @@ -429,7 +429,7 @@ rotate_up 3 end CODE -Stack too shallow! +Parrot VM: Stack too shallow. OUTPUT output_is(<<"CODE", <<'OUTPUT', 'rotate down by more than stack size'); @@ -440,7 +440,7 @@ rotate_up -3 end CODE -Stack too shallow! +Parrot VM: Stack too shallow. OUTPUT output_is(<<'CODE', <<'OUTPUT', 'save/savec for strings'); @@ -585,7 +585,7 @@ end CODE ready -Stack Depth Wrong +Parrot VM: Stack Depth Wrong. OUTPUT } Index: t/op/string.t =================================================================== RCS file: /cvs/public/parrot/t/op/string.t,v retrieving revision 1.34 diff -u -r1.34 string.t --- t/op/string.t 15 Sep 2002 12:04:13 -0000 1.34 +++ t/op/string.t 28 Sep 2002 10:51:45 -0000 @@ -239,7 +239,7 @@ OUTPUT # This asks for substring it shouldn't be allowed... -output_is(<<'CODE', 'Cannot take substr outside string', "substr OOB"); +output_is(<<'CODE', "Parrot VM: Cannot take substr outside string.\n", "substr OOB"); set S0, "A string of length 21" set I0, -99 set I1, 6 @@ -248,7 +248,7 @@ CODE # This asks for substring it shouldn't be allowed... -output_is(<<'CODE', 'Cannot take substr outside string', "substr OOB"); +output_is(<<'CODE', "Parrot VM: Cannot take substr outside string.\n", "substr OOB"); set S0, "A string of length 21" set I0, 99 set I1, 6 @@ -356,7 +356,7 @@ OUTPUT -output_is( <<'CODE', 'Can only replace inside string or index after end of string', "5 arg substr, offset past end of string" ); +output_is( <<'CODE', "Parrot VM: Can only replace inside string or index after end of +string.\n", "5 arg substr, offset past end of string" ); set S0, "abcdefghijk" set S1, "xyz" substr S2, S0, 12, 3, S1 @@ -420,7 +420,7 @@ fghi OUTPUT -output_is( <<'CODE', 'Can only replace inside string or index after end of string', "5 arg substr, -ve offset out of string" ); +output_is( <<'CODE', "Parrot VM: Can only replace inside string or index after end of +string.\n", "5 arg substr, -ve offset out of string" ); set S0, "abcdefghijk" set S1, "xyz" substr S2, S0, -12, 4, S1 @@ -889,25 +889,25 @@ foo OUTPUT -output_is(<<'CODE','Cannot get character of empty string','2-param ord, empty string'); +output_is(<<'CODE', "Parrot VM: Cannot get character of empty string.\n",'2-param +ord, empty string'); ord I0,"" print I0 end CODE -output_is(<<'CODE','Cannot get character of empty string','2-param ord, empty string register'); +output_is(<<'CODE',"Parrot VM: Cannot get character of empty string.\n",'2-param ord, +empty string register'); ord I0,S0 print I0 end CODE -output_is(<<'CODE','Cannot get character of empty string','3-param ord, empty string'); +output_is(<<'CODE',"Parrot VM: Cannot get character of empty string.\n",'3-param ord, +empty string'); ord I0,"",0 print I0 end CODE -output_is(<<'CODE','Cannot get character of empty string','3-param ord, empty string register'); +output_is(<<'CODE',"Parrot VM: Cannot get character of empty string.\n",'3-param ord, +empty string register'); ord I0,S0,0 print I0 end @@ -958,13 +958,13 @@ end CODE -output_is(<<'CODE', 'Cannot get character past end of string','3-param ord, multi-character string'); +output_is(<<'CODE', "Parrot VM: Cannot get character past end of string.\n",'3-param +ord, multi-character string'); ord I0,"ab",2 print I0 end CODE -output_is(<<'CODE', 'Cannot get character past end of string','3-param ord, multi-character string'); +output_is(<<'CODE', "Parrot VM: Cannot get character past end of string.\n",'3-param +ord, multi-character string'); set S0,"ab" ord I0,S0,2 print I0 @@ -997,7 +997,7 @@ end CODE -output_is(<<'CODE','Cannot get character before beginning of string','3-param ord, multi-character string register, from end, OOB'); +output_is(<<'CODE',"Parrot VM: Cannot get character before beginning of +string.\n",'3-param ord, multi-character string register, from end, OOB'); set S0,"ab" ord I0,S0,-3 print I0 @@ -1125,7 +1125,7 @@ >< done OUTPUT -output_is(<<'CODE','Cannot repeat with negative arg','repeat OOB'); +output_is(<<'CODE',"Parrot VM: Cannot repeat with negative arg.\n",'repeat OOB'); repeat S0, "japh", -1 end CODE Index: t/op/time.t =================================================================== RCS file: /cvs/public/parrot/t/op/time.t,v retrieving revision 1.5 diff -u -r1.5 time.t --- t/op/time.t 1 Jun 2002 03:54:19 -0000 1.5 +++ t/op/time.t 28 Sep 2002 10:51:45 -0000 @@ -65,7 +65,7 @@ done OUTPUT -output_is(<<CODE, 'Cannot go back in time', "sleep"); +output_is(<<CODE, "Parrot VM: Cannot go back in time.\n", "sleep"); sleep -1 end CODE Index: t/pmc/array.t =================================================================== RCS file: /cvs/public/parrot/t/pmc/array.t,v retrieving revision 1.10 diff -u -r1.10 array.t --- t/pmc/array.t 8 Aug 2002 20:58:51 -0000 1.10 +++ t/pmc/array.t 28 Sep 2002 10:51:45 -0000 @@ -108,7 +108,7 @@ end CODE -Array index out of bounds! +Parrot VM: Array index out of bounds. OUTPUT output_is(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements"); @@ -118,7 +118,7 @@ set I0, P0[1] end CODE -Array index out of bounds! +Parrot VM: Array index out of bounds. OUTPUT 1;