cvsuser 03/01/10 20:24:32
Modified: . exceptions.c interpreter.c misc.c spf_vtable.c
Log:
Reformulation of Andy D's patch in ticket #17091: break up giant printf
into smaller pieces. Also contains a few additional bugfixes.
Revision Changes Path
1.10 +30 -33 parrot/exceptions.c
Index: exceptions.c
===================================================================
RCS file: /cvs/public/parrot/exceptions.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- exceptions.c 8 Nov 2002 05:18:39 -0000 1.9
+++ exceptions.c 11 Jan 2003 04:24:32 -0000 1.10
@@ -1,7 +1,7 @@
/* exceptions.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: exceptions.c,v 1.9 2002/11/08 05:18:39 josh Exp $
+ * $Id: exceptions.c,v 1.10 2003/01/11 04:24:32 sfink Exp $
* Overview:
* define the internal interpreter exceptions
* Data Structure and Algorithms:
@@ -43,37 +43,34 @@
else
strcpy(flag_buffer, "(null interpreter)");
- PIO_printf(interpreter, "\
-Parrot VM: PANIC: %s!\n\
-C file %s, line %d\n\
-Parrot file %s, line %d\n\
-\n\
+ PIO_printf(interpreter, "Parrot VM: PANIC: %s!\n",
+ message ? message : "(no message available)");
+
+ PIO_printf(interpreter, "C file %s, line %d\n",
+ file ? file : "(not available)", line);
+
+ if (interpreter) {
+ PIO_printf(interpreter, "Parrot file %Ss, line %d\n",
+ interpreter->current_file, interpreter->current_line);
+ } else {
+ PIO_printf(interpreter, "Parrot file (not available), ");
+ PIO_printf(interpreter, "line (not available)\n");
+ }
+
+ PIO_printf(interpreter, "\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\
Include the entire text of this error message and the text of the script that \n\
generated the error. If you've made any modifications to Parrot, please \n\
-describe them as well.\n\
-\n\
-Version : %s\n\
-Configured : %s\n\
-Architecture: %s\n\
-JIT Capable : %s\n\
-Interp Flags: %s\n\
-Exceptions : %s\n\
-\n\
-Dumping Core...\n",
- message ? message : "(not available)",
- line,
- file ? file : "(not available)",
- interpreter ? string_to_cstring(interpreter, interpreter->current_file) :
"(not available)",
- interpreter ? (int)interpreter->current_line : 0,
- PARROT_VERSION,
- PARROT_CONFIG_DATE,
- PARROT_ARCHNAME,
- JIT_CAPABLE ? "Yes" : "No",
- flag_buffer,
- "(missing from core)"
- );
+describe them as well.\n\n");
+
+ PIO_printf(interpreter, "Version : %s\n", PARROT_VERSION);
+ PIO_printf(interpreter, "Configured : %s\n", PARROT_CONFIG_DATE);
+ PIO_printf(interpreter, "Architecture: %s\n", PARROT_ARCHNAME);
+ PIO_printf(interpreter, "JIT Capable : %s\n", JIT_CAPABLE ? "Yes" : "No");
+ PIO_printf(interpreter, "Interp Flags: %s\n", flag_buffer);
+ PIO_printf(interpreter, "Exceptions : %s\n", "(missing from core)");
+ PIO_printf(interpreter, "\nDumping Core...\n");
dumpcore();
}
1.127 +5 -4 parrot/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/interpreter.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -w -r1.126 -r1.127
--- interpreter.c 10 Jan 2003 09:37:29 -0000 1.126
+++ interpreter.c 11 Jan 2003 04:24:32 -0000 1.127
@@ -1,7 +1,7 @@
/* interpreter.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: interpreter.c,v 1.126 2003/01/10 09:37:29 leo Exp $
+ * $Id: interpreter.c,v 1.127 2003/01/11 04:24:32 sfink Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -407,6 +407,10 @@
/* Get an empty interpreter from system memory */
interpreter = mem_sys_allocate_zeroed(sizeof(struct Parrot_Interp));
+ /* PANIC will fail until this is done */
+ SET_NULL(interpreter->piodata);
+ PIO_init(interpreter);
+
interpreter->DOD_block_level = 1;
interpreter->GC_block_level = 1;
@@ -502,9 +506,6 @@
string_make(interpreter, "(unknown file)", 14, NULL, 0, NULL);
interpreter->current_package =
string_make(interpreter, "(unknown package)", 18, NULL, 0, NULL);;
-
- SET_NULL(interpreter->piodata);
- PIO_init(interpreter);
SET_NULL_P(interpreter->code, struct PackFile *);
SET_NULL_P(interpreter->profile, ProfData *);
1.32 +3 -3 parrot/misc.c
Index: misc.c
===================================================================
RCS file: /cvs/public/parrot/misc.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -w -r1.31 -r1.32
--- misc.c 13 Dec 2002 15:11:27 -0000 1.31
+++ misc.c 11 Jan 2003 04:24:32 -0000 1.32
@@ -1,7 +1,7 @@
/* misc.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: misc.c,v 1.31 2002/12/13 15:11:27 educated_foo Exp $
+ * $Id: misc.c,v 1.32 2003/01/11 04:24:32 sfink Exp $
* Overview:
* Miscellaneous functions, mainly the Parrot_sprintf family
* Data Structure and Algorithms:
@@ -57,8 +57,8 @@
STRING *ret = Parrot_vsprintf_c(interpreter, pat, args);
string_transcode(interpreter, ret, NULL, NULL, &ret);
- memcpy(targ, ret->strstart, ret->bufused);
- targ[ret->bufused + 1] = '\0';
+ memcpy(targ, ret->strstart, ret->strlen);
+ targ[ret->strlen] = '\0';
}
void
1.9 +2 -2 parrot/spf_vtable.c
Index: spf_vtable.c
===================================================================
RCS file: /cvs/public/parrot/spf_vtable.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -r1.8 -r1.9
--- spf_vtable.c 18 Nov 2002 10:12:18 -0000 1.8
+++ spf_vtable.c 11 Jan 2003 04:24:32 -0000 1.9
@@ -1,7 +1,7 @@
/* spf_vtable.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: spf_vtable.c,v 1.8 2002/11/18 10:12:18 leo Exp $
+ * $Id: spf_vtable.c,v 1.9 2003/01/11 04:24:32 sfink Exp $
* Overview:
* Implements the two families of functions Parrot_sprintf
* may use to retrieve arguments.
@@ -173,7 +173,7 @@
case SIZE_PSTR:
{
STRING *s = (STRING *)va_arg(*arg, STRING *);
- return string_copy(interpreter, s);
+ return s ? string_copy(interpreter, s) : cstr2pstr("(null)");
}