Author: paultcochrane
Date: Sat Jul  7 09:36:54 2007
New Revision: 19674

Modified:
   trunk/include/parrot/exec.h
   trunk/include/parrot/string_funcs.h
   trunk/include/parrot/string_primitives.h
   trunk/src/dynext.c
   trunk/src/encodings/utf8.c
   trunk/src/exec.c
   trunk/src/exec_save.c
   trunk/src/exec_save.h
   trunk/src/gc/dod.c
   trunk/src/interpreter.c
   trunk/src/main.c
   trunk/src/pmc/sarray.pmc
   trunk/src/pmc/unmanagedstruct.pmc
   trunk/src/stm/backend.c
   trunk/src/string_primitives.c
   trunk/src/tsq.c

Log:
Converted more internal_exception()s to real_exception()s.  This time
by changing the api of some of the functions so that the interpreter is
passed in as the first argument.


Modified: trunk/include/parrot/exec.h
==============================================================================
--- trunk/include/parrot/exec.h (original)
+++ trunk/include/parrot/exec.h Sat Jul  7 09:36:54 2007
@@ -106,7 +106,7 @@
     __attribute__nonnull__(1)
     __attribute__nonnull__(2);
 
-void Parrot_exec_save(Parrot_exec_objfile_t *obj, const char *file);
+void Parrot_exec_save(Interp *interp, Parrot_exec_objfile_t *obj, const char 
*file);
 
 void Parrot_exec_emit_mov_mr(Interp *interp, char *mem, int reg);
 void Parrot_exec_emit_mov_mr_n(Interp *interp, char *mem, int reg);

Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h (original)
+++ trunk/include/parrot/string_funcs.h Sat Jul  7 09:36:54 2007
@@ -434,7 +434,7 @@
     STRING *s /*NULLOK*/ )
         __attribute__nonnull__(2);
 
-PARROT_API void string_set_data_directory( const char *dir );
+PARROT_API void string_set_data_directory( Interp *interp, const char *dir );
 PARROT_API Parrot_UInt4 string_unescape_one( Interp *interp,
     UINTVAL *offset /*NN*/,
     STRING *string )

Modified: trunk/include/parrot/string_primitives.h
==============================================================================
--- trunk/include/parrot/string_primitives.h    (original)
+++ trunk/include/parrot/string_primitives.h    Sat Jul  7 09:36:54 2007
@@ -17,7 +17,7 @@
 
 /* Set the directory where ICU finds its data files (encodings,
    locales, etc.) */
-PARROT_API void string_set_data_directory(const char *dir);
+PARROT_API void string_set_data_directory(Interp *interp, const char *dir);
 
 /* Convert from any supported encoding, into our internal format */
 PARROT_API void string_fill_from_buffer(Interp *interp,

Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c  (original)
+++ trunk/src/dynext.c  Sat Jul  7 09:36:54 2007
@@ -441,7 +441,7 @@
     path = get_path(interp, lib, &handle, wo_ext, ext);
     if (!path || !handle) {
         /*
-         * XXX internal_exception? return PMCNULL?
+         * XXX real_exception? return PMCNULL?
          * PMC Undef seems convenient, because it can be queried with 
get_bool()
          */
         return pmc_new(interp, enum_class_Undef);

Modified: trunk/src/encodings/utf8.c
==============================================================================
--- trunk/src/encodings/utf8.c  (original)
+++ trunk/src/encodings/utf8.c  Sat Jul  7 09:36:54 2007
@@ -99,16 +99,16 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static UINTVAL utf8_characters( const utf8_t *ptr /*NN*/, UINTVAL byte_len )
+static UINTVAL utf8_characters( Interp *interp, const utf8_t *ptr /*NN*/, 
UINTVAL byte_len )
         __attribute__nonnull__(1);
 
-static UINTVAL utf8_decode( const utf8_t *ptr );
+static UINTVAL utf8_decode( Interp *interp, const utf8_t *ptr );
 static UINTVAL utf8_decode_and_advance( Interp *interp /*NN*/,
     String_iter *i /*NN*/ )
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static void * utf8_encode( void *ptr /*NN*/, UINTVAL c )
+static void * utf8_encode( Interp *interp, void *ptr /*NN*/, UINTVAL c )
         __attribute__nonnull__(1);
 
 static void utf8_encode_and_advance( Interp *interp /*NN*/,
@@ -164,7 +164,7 @@
 */
 
 static UINTVAL
-utf8_characters(const utf8_t *ptr /*NN*/, UINTVAL byte_len)
+utf8_characters(Interp *interp, const utf8_t *ptr /*NN*/, UINTVAL byte_len)
 {
     const utf8_t *u8ptr = ptr;
     const utf8_t *u8end = u8ptr + byte_len;
@@ -176,7 +176,7 @@
     }
 
     if (u8ptr > u8end) {
-        internal_exception(MALFORMED_UTF8, "Unaligned end in UTF-8 string\n");
+        real_exception(interp, NULL, MALFORMED_UTF8, "Unaligned end in UTF-8 
string\n");
     }
 
     return characters;
@@ -191,7 +191,7 @@
 */
 
 static UINTVAL
-utf8_decode(const utf8_t *ptr)
+utf8_decode(Interp *interp, const utf8_t *ptr)
 {
     const utf8_t *u8ptr = ptr;
     UINTVAL c = *u8ptr;
@@ -204,17 +204,17 @@
         for (count = 1; count < len; count++) {
             u8ptr++;
             if (!UTF8_IS_CONTINUATION(*u8ptr)) {
-                internal_exception(MALFORMED_UTF8, "Malformed UTF-8 string\n");
+                real_exception(interp, NULL, MALFORMED_UTF8, "Malformed UTF-8 
string\n");
             }
             c = UTF8_ACCUMULATE(c, *u8ptr);
         }
 
         if (UNICODE_IS_SURROGATE(c)) {
-            internal_exception(MALFORMED_UTF8, "Surrogate in UTF-8 string\n");
+            real_exception(interp, NULL, MALFORMED_UTF8, "Surrogate in UTF-8 
string\n");
         }
     }
     else if (!UNICODE_IS_INVARIANT(c)) {
-        internal_exception(MALFORMED_UTF8, "Malformed UTF-8 string\n");
+        real_exception(interp, NULL, MALFORMED_UTF8, "Malformed UTF-8 
string\n");
     }
 
     return c;
@@ -229,14 +229,14 @@
 */
 
 static void *
-utf8_encode(void *ptr /*NN*/, UINTVAL c)
+utf8_encode(Interp *interp, void *ptr /*NN*/, UINTVAL c)
 {
     utf8_t *u8ptr = (utf8_t *)ptr;
     UINTVAL len = UNISKIP(c);
     utf8_t *u8end = u8ptr + len - 1;
 
     if (c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) {
-        internal_exception(INVALID_CHARACTER,
+        real_exception(interp, NULL, INVALID_CHARACTER,
                            "Invalid character for UTF-8 encoding\n");
     }
 
@@ -347,7 +347,7 @@
 {
     const STRING * const s = i->str;
     unsigned char * const pos = (unsigned char *)s->strstart + i->bytepos;
-    unsigned char * const new_pos = (unsigned char *)utf8_encode(pos, c);
+    unsigned char * const new_pos = (unsigned char *)utf8_encode(interp, pos, 
c);
 
     i->bytepos += (new_pos - pos);
     /* XXX possible buffer overrun exception? */
@@ -440,7 +440,7 @@
             }
 
             pos = p + dest_pos;
-            new_pos = (unsigned char *)utf8_encode(pos, c);
+            new_pos = (unsigned char *)utf8_encode(interp, pos, c);
             dest_pos += (new_pos - pos);
         }
         result->bufused = dest_pos;
@@ -454,14 +454,14 @@
 }
 
 static UINTVAL
-get_codepoint(SHIM_INTERP, const STRING *src /*NN*/, UINTVAL offset)
+get_codepoint(Interp *interp, const STRING *src /*NN*/, UINTVAL offset)
 {
     const utf8_t * const start = (const utf8_t 
*)utf8_skip_forward(src->strstart, offset);
-    return utf8_decode(start);
+    return utf8_decode(interp, start);
 }
 
 static void
-set_codepoint(SHIM_INTERP, STRING *src /*NN*/,
+set_codepoint(Interp *interp, STRING *src /*NN*/,
         UINTVAL offset, UINTVAL codepoint)
 {
     const void *start;
@@ -470,7 +470,7 @@
 
     start = utf8_skip_forward(src->strstart, offset);
     p = const_cast(start);
-    utf8_encode(p, codepoint);
+    utf8_encode(interp, p, codepoint);
 }
 
 static UINTVAL

Modified: trunk/src/exec.c
==============================================================================
--- trunk/src/exec.c    (original)
+++ trunk/src/exec.c    Sat Jul  7 09:36:54 2007
@@ -113,7 +113,7 @@
     offset_fixup(obj);
     output = interp->output_file ?
         interp->output_file : "exec_output.o";
-    Parrot_exec_save(obj, output);
+    Parrot_exec_save(interp, obj, output);
 }
 
 /*

Modified: trunk/src/exec_save.c
==============================================================================
--- trunk/src/exec_save.c       (original)
+++ trunk/src/exec_save.c       Sat Jul  7 09:36:54 2007
@@ -35,7 +35,7 @@
 /*
 
 =item C<void
-Parrot_exec_save(Parrot_exec_objfile_t *obj, const char *file)>
+Parrot_exec_save(Interp *interp, Parrot_exec_objfile_t *obj, const char *file)>
 
 Save the C<Parrot_exec_objfile_t> to C<file>.
 
@@ -44,7 +44,7 @@
 */
 
 void
-Parrot_exec_save(Parrot_exec_objfile_t *obj, const char *file)
+Parrot_exec_save(Interp *interp, Parrot_exec_objfile_t *obj, const char *file)
 {
     FILE *fp;
     int i;
@@ -88,7 +88,7 @@
                 rellocation.r_extern = 1;
                 break;
             default:
-                internal_exception(EXEC_ERROR,
+                real_exception(interp, NULL, EXEC_ERROR,
                     "Unknown text rellocation type: %d\n",
                         obj->text_rellocation_table[i].type);
                 break;
@@ -117,7 +117,7 @@
                 symlst.n_type = N_EXT;
                 break;
             default:
-                internal_exception(EXEC_ERROR, "Unknown symbol type: %d\n",
+                real_exception(interp, NULL, EXEC_ERROR, "Unknown symbol type: 
%d\n",
                     obj->symbol_table[i].type);
                 break;
         }
@@ -187,7 +187,7 @@
 #  define NSECTIONS     8
 
 void
-Parrot_exec_save(Parrot_exec_objfile_t *obj, const char *file)
+Parrot_exec_save(Interp *interp, Parrot_exec_objfile_t *obj, const char *file)
 {
     Elf32_Ehdr header;
     Elf32_Shdr sechdr;
@@ -319,7 +319,7 @@
                             R_386_32);
                 break;
             default:
-                internal_exception(EXEC_ERROR,
+                real_exception(interp, NULL, EXEC_ERROR,
                     "Unknown text rellocation type: %d\n",
                         obj->text_rellocation_table[i].type);
                 break;
@@ -361,7 +361,7 @@
                         obj->text_rellocation_table[i].offset - 4])) << 16;
                 break;
             default:
-                internal_exception(EXEC_ERROR,
+                real_exception(interp, NULL, EXEC_ERROR,
                     "Unknown text rellocation type: %d\n",
                         obj->text_rellocation_table[i].type);
                 break;
@@ -385,7 +385,7 @@
                             R_ARM_ABS32);
                 break;
             default:
-                internal_exception(EXEC_ERROR,
+                real_exception(interp, NULL, EXEC_ERROR,
                     "Unknown text rellocation type: %d\n",
                         obj->text_rellocation_table[i].type);
                 break;
@@ -438,7 +438,7 @@
                 symlst.st_info = ELF32_ST_INFO(STB_GLOBAL, STT_NOTYPE);
                 break;
             default:
-                internal_exception(EXEC_ERROR, "Unknown symbol type: %d\n",
+                real_exception(interp, NULL, EXEC_ERROR, "Unknown symbol type: 
%d\n",
                     obj->symbol_table[i].type);
                 break;
         }
@@ -582,7 +582,7 @@
 #  define SYMTAB     DATA_RELOC + (obj->data_rellocation_count * 0xA)
 
 void
-Parrot_exec_save(Parrot_exec_objfile_t *obj, const char *file)
+Parrot_exec_save(Interp *interp, Parrot_exec_objfile_t *obj, const char *file)
 {
     FILE *fp;
     int i;
@@ -649,7 +649,7 @@
                 save_short(fp, 0x06);
                 break;
             default:
-                internal_exception(EXEC_ERROR,
+                real_exception(interp, NULL, EXEC_ERROR,
                     "Unknown text rellocation type: %d\n",
                         obj->text_rellocation_table[i].type);
                 break;
@@ -678,7 +678,7 @@
                 save_short(fp, 0x20);
                 break;
             default:
-                internal_exception(EXEC_ERROR, "Unknown symbol type: %d\n",
+                real_exception(interp, NULL, EXEC_ERROR, "Unknown symbol type: 
%d\n",
                     obj->symbol_table[i].type);
                 break;
         }

Modified: trunk/src/exec_save.h
==============================================================================
--- trunk/src/exec_save.h       (original)
+++ trunk/src/exec_save.h       Sat Jul  7 09:36:54 2007
@@ -14,7 +14,7 @@
 #ifndef PARROT_EXEC_SAVE_H_GUARD
 #define PARROT_EXEC_SAVE_H_GUARD
 
-void Parrot_exec_save(Parrot_exec_objfile_t *obj, const char *file);
+void Parrot_exec_save(Interp *interp, Parrot_exec_objfile_t *obj, const char 
*file);
 
 #endif /* PARROT_EXEC_SAVE_H_GUARD */
 

Modified: trunk/src/gc/dod.c
==============================================================================
--- trunk/src/gc/dod.c  (original)
+++ trunk/src/gc/dod.c  Sat Jul  7 09:36:54 2007
@@ -32,7 +32,7 @@
 static void clear_live_bits( Small_Object_Pool *pool /*NN*/ )
         __attribute__nonnull__(1);
 
-static size_t find_common_mask( size_t val1, size_t val2 );
+static size_t find_common_mask( Interp *interp, size_t val1, size_t val2 );
 static void mark_special( Interp *interp /*NN*/, PMC *obj /*NN*/ )
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
@@ -60,7 +60,7 @@
 int CONSERVATIVE_POINTER_CHASING = 0;
 #endif
 
-static size_t find_common_mask(size_t val1, size_t val2)
+static size_t find_common_mask(Interp *interp, size_t val1, size_t val2)
     __attribute__const__
     __attribute__warn_unused_result__;
 
@@ -724,7 +724,7 @@
 */
 
 static size_t
-find_common_mask(size_t val1, size_t val2)
+find_common_mask(Interp *interp, size_t val1, size_t val2)
 {
     int       i;
     const int bound = sizeof (size_t) * 8;
@@ -745,7 +745,7 @@
         return 0;
     }
 
-    internal_exception(INTERP_ERROR,
+    real_exception(interp, NULL, INTERP_ERROR,
             "Unexpected condition in find_common_mask()!\n");
 
     return 0;
@@ -771,7 +771,8 @@
     const size_t pmc_max    = get_max_pmc_address(interp);
 
     const size_t mask       =
-        find_common_mask(buffer_min < pmc_min ? buffer_min : pmc_min,
+        find_common_mask(interp,
+                         buffer_min < pmc_min ? buffer_min : pmc_min,
                          buffer_max > pmc_max ? buffer_max : pmc_max);
 
     if (!lo_var_ptr || !hi_var_ptr)

Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c     (original)
+++ trunk/src/interpreter.c     Sat Jul  7 09:36:54 2007
@@ -57,7 +57,7 @@
     oplib_init_f init_func )
         __attribute__nonnull__(1);
 
-static oplib_init_f get_op_lib_init( int core_op, int which, PMC *lib );
+static oplib_init_f get_op_lib_init( Interp *interp, int core_op, int which, 
PMC *lib );
 static void init_prederef( Interp *interp /*NN*/, int which )
         __attribute__nonnull__(1);
 
@@ -308,7 +308,7 @@
 */
 
 static oplib_init_f
-get_op_lib_init(int core_op, int which, PMC *lib)
+get_op_lib_init(Interp *interp, int core_op, int which, PMC *lib)
 {
     if (core_op) {
         oplib_init_f init_func;
@@ -334,7 +334,7 @@
                 break;
             default:
                 init_func = NULL;
-                internal_exception(1, "Couldn't find init_func for core %d", 
which);
+                real_exception(interp, NULL, 1, "Couldn't find init_func for 
core %d", which);
                 break;
         }
         return init_func;
@@ -353,7 +353,7 @@
 static void
 load_prederef(Interp *interp /*NN*/, int which)
 {
-    const oplib_init_f init_func = get_op_lib_init(1, which, NULL);
+    const oplib_init_f init_func = get_op_lib_init(interp, 1, which, NULL);
     int (*get_op)(const char * name, int full);
 
     get_op = interp->op_lib->op_code;
@@ -808,7 +808,7 @@
 Parrot_setup_event_func_ptrs(Parrot_Interp interp)
 {
     const size_t n = interp->op_count;
-    const oplib_init_f init_func = get_op_lib_init(1, interp->run_core, NULL);
+    const oplib_init_f init_func = get_op_lib_init(interp, 1, 
interp->run_core, NULL);
     op_lib_t * const lib = init_func(1);
     /*
      * remember op_func_table
@@ -869,7 +869,7 @@
         interp->all_op_libs = (op_lib_t **)mem_sys_realloc(interp->all_op_libs,
                 sizeof (op_lib_t *) * (interp->n_libs + 1));
 
-    init_func = get_op_lib_init(0, 0, lib_pmc);
+    init_func = get_op_lib_init(interp, 0, 0, lib_pmc);
     lib = init_func(1);
 
     interp->all_op_libs[interp->n_libs++] = lib;
@@ -1017,7 +1017,7 @@
     if (0 /*lib_variant */) {
         size_t i;
 
-        new_init_func = get_op_lib_init(0, 0, lib_variant);
+        new_init_func = get_op_lib_init(interp, 0, 0, lib_variant);
         new_lib = new_init_func(1);
         for (i = n_old; i < n_tot; ++i)
             ops_addr[i] = (new_lib->op_func_table)[i - n_old];
@@ -1069,7 +1069,7 @@
 static void
 notify_func_table(Interp *interp /*NN*/, op_func_t* table /*NN*/, int on)
 {
-    const oplib_init_f init_func = get_op_lib_init(1, interp->run_core, NULL);
+    const oplib_init_f init_func = get_op_lib_init(interp, 1, 
interp->run_core, NULL);
 
     init_func((long) table);
     switch (interp->run_core) {

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c    (original)
+++ trunk/src/main.c    Sat Jul  7 09:36:54 2007
@@ -45,8 +45,9 @@
     Parrot_set_config_hash();
 
     interp     = Parrot_new(NULL);
-    if (!imcc_initialize(interp))
-        internal_exception(1, "Could not initialize IMCC\n");
+    if (!imcc_initialize(interp)) {
+        real_exception(interp, NULL, 1, "Could not initialize IMCC\n");
+    }
 
     /* We parse the arguments, but first store away the name of the Parrot
        executable, since parsing destroys that and we want to make it

Modified: trunk/src/pmc/sarray.pmc
==============================================================================
--- trunk/src/pmc/sarray.pmc    (original)
+++ trunk/src/pmc/sarray.pmc    Sat Jul  7 09:36:54 2007
@@ -178,7 +178,7 @@
 /*
 
 =item C<static PARROT_INLINE HashEntry *
-shift_entry(PMC *self)>
+shift_entry(Interp *interp, PMC *self)>
 
 Removes and returns the first element from the array.
 
@@ -187,15 +187,16 @@
 */
 
 static PARROT_INLINE HashEntry *
-shift_entry(PMC *self)
+shift_entry(Interp *interp, PMC *self)
 {
     HashEntry * const e = (HashEntry *) PMC_data(self);
     HashEntry *ret;
     INTVAL start_index = UVal_int(e[0].val);
     const INTVAL end_index   = UVal_int(e[1].val);
 
-    if (start_index >= end_index)
-        internal_exception(OUT_OF_BOUNDS, "SArray index out of bounds!");
+    if (start_index >= end_index) {
+        real_exception(interp, NULL, OUT_OF_BOUNDS, "SArray index out of 
bounds!");
+    }
 
     ret = (HashEntry *) PMC_data(self) + (2 + start_index++);
 
@@ -207,7 +208,7 @@
 /*
 
 =item C<static PARROT_INLINE HashEntry *
-get_entry(PMC *self, INTVAL key)>
+get_entry(Interp *interp, PMC *self, INTVAL key)>
 
 Returns the element for index C<key>.
 
@@ -216,7 +217,7 @@
 */
 
 static PARROT_INLINE HashEntry*
-get_entry(PMC *self, INTVAL key)
+get_entry(Interp *interp, PMC *self, INTVAL key)
 {
     HashEntry *e = (HashEntry *) PMC_data(self);
     const INTVAL start_index = UVal_int(e[0].val);
@@ -226,8 +227,9 @@
         key += end_index;
     }
     key += start_index;   /* lower bound if already shifted */
-    if (key < start_index || key >= end_index)
-        internal_exception(OUT_OF_BOUNDS, "SArray index out of bounds!");
+    if (key < start_index || key >= end_index) {
+        real_exception(interp, NULL, OUT_OF_BOUNDS, "SArray index out of 
bounds!");
+    }
     e = (HashEntry *) PMC_data(self) + (2 + key);
     return e;
 }
@@ -429,7 +431,7 @@
 */
 
     INTVAL type_keyed_int(INTVAL key) {
-        HashEntry *e = get_entry(SELF, key);
+        HashEntry *e = get_entry(INTERP, SELF, key);
         return e->type;
     }
 
@@ -444,7 +446,7 @@
 */
 
     INTVAL get_integer_keyed_int(INTVAL key) {
-        HashEntry *e = get_entry(SELF, key);
+        HashEntry *e = get_entry(INTERP, SELF, key);
         return ret_int(INTERP, e);
     }
 
@@ -475,7 +477,7 @@
 */
 
     INTVAL shift_integer() {
-        HashEntry *ret = shift_entry(SELF);
+        HashEntry *ret = shift_entry(INTERP, SELF);
         return ret_int(INTERP, ret);
     }
 
@@ -490,7 +492,7 @@
 */
 
     FLOATVAL get_number_keyed_int(INTVAL key) {
-        HashEntry *e = get_entry(SELF, key);
+        HashEntry *e = get_entry(INTERP, SELF, key);
         return ret_num(INTERP, e);
     }
 
@@ -521,7 +523,7 @@
 */
 
     FLOATVAL shift_float() {
-        HashEntry *ret = shift_entry(SELF);
+        HashEntry *ret = shift_entry(INTERP, SELF);
         return ret_num(INTERP, ret);
     }
 
@@ -536,7 +538,7 @@
 */
 
     STRING* get_string_keyed_int(INTVAL key) {
-        HashEntry *e = get_entry(SELF, key);
+        HashEntry *e = get_entry(INTERP, SELF, key);
         return ret_string(INTERP, e);
     }
 
@@ -567,7 +569,7 @@
 */
 
     STRING* shift_string() {
-        HashEntry *ret = shift_entry(SELF);
+        HashEntry *ret = shift_entry(INTERP, SELF);
         return ret_string(INTERP, ret);
     }
 
@@ -582,7 +584,7 @@
 */
 
     PMC* get_pmc_keyed_int(INTVAL key) {
-        HashEntry *e = get_entry(SELF, key);
+        HashEntry *e = get_entry(INTERP, SELF, key);
         return ret_pmc(INTERP, e);
     }
 
@@ -612,7 +614,7 @@
 */
 
     PMC* shift_pmc() {
-        HashEntry *ret = shift_entry(SELF);
+        HashEntry *ret = shift_entry(INTERP, SELF);
         return ret_pmc(INTERP, ret);
     }
 

Modified: trunk/src/pmc/unmanagedstruct.pmc
==============================================================================
--- trunk/src/pmc/unmanagedstruct.pmc   (original)
+++ trunk/src/pmc/unmanagedstruct.pmc   Sat Jul  7 09:36:54 2007
@@ -204,7 +204,7 @@
 /*
 
 =item C<static INTVAL
-ret_int(const char *p, int type)>
+ret_int(Interp *interp, const char *p, int type)>
 
 Returns the element of type C<type> starting at C<*p> as an C<INTVAL>.
 
@@ -216,11 +216,11 @@
 */
 
 static INTVAL
-ret_int(const char *p, int type)
+ret_int(Interp *interp, const char *p, int type)
     __attribute__nonnull__(1);
 
 static INTVAL
-ret_int(const char *p, int type)
+ret_int(Interp *interp, const char *p, int type)
 {
     switch (type) {
         case enum_type_INTVAL:
@@ -259,7 +259,7 @@
         case enum_type_uchar:
             return *p;
         default:
-            internal_exception(1, "returning unhandled int type in struct");
+            real_exception(interp, NULL, 1, "returning unhandled int type in 
struct");
     }
     return -1;
 }
@@ -267,7 +267,7 @@
 /*
 
 =item C<static FLOATVAL
-ret_float(const char *p, int type)>
+ret_float(Interp *interp, const char *p, int type)>
 
 Returns the element of type C<type> starting at C<*p> as a C<FLOATVAL>.
 
@@ -276,11 +276,11 @@
 */
 
 static FLOATVAL
-ret_float(const char *p, int type)
+ret_float(Interp *interp, const char *p, int type)
     __attribute__nonnull__(1);
 
 static FLOATVAL
-ret_float(const char *p, int type)
+ret_float(Interp *interp, const char *p, int type)
 {
     switch (type) {
         case enum_type_FLOATVAL:
@@ -290,7 +290,7 @@
         case enum_type_double:
             return (FLOATVAL) *(const double*) p;
         default:
-            internal_exception(1, "returning unhandled float type in struct");
+            real_exception(interp, NULL, 1, "returning unhandled float type in 
struct");
     }
     return -1.0;
 }
@@ -392,14 +392,14 @@
 /*
 
 =item C<static void
-set_int(char *p, int type, INTVAL value)>
+set_int(Interp *interp, char *p, int type, INTVAL value)>
 
 =cut
 
 */
 
 static void
-set_int(char *p, int type, INTVAL value)
+set_int(Interp *interp, char *p, int type, INTVAL value)
 {
     switch (type) {
         case enum_type_uint8:
@@ -420,7 +420,7 @@
             *(short*)p = (short)value;
             break;
         default:
-            internal_exception(1, "setting unhandled int type in struct");
+            real_exception(interp, NULL, 1, "setting unhandled int type in 
struct");
             break;
     }
 }
@@ -428,7 +428,7 @@
 /*
 
 =item C<static void
-set_float(char *p, int type, FLOATVAL value)>
+set_float(Interp *interp, char *p, int type, FLOATVAL value)>
 
 Sets the value of the element of type C<type> starting at C<*p> to
 C<value>.
@@ -438,7 +438,7 @@
 */
 
 static void
-set_float(char *p, int type, FLOATVAL value)
+set_float(Interp *interp, char *p, int type, FLOATVAL value)
 {
     switch (type) {
         case enum_type_FLOATVAL:
@@ -451,7 +451,7 @@
             *(double*) p = (double) value;
             break;
         default:
-            internal_exception(1, "setting unhandled float type in struct");
+            real_exception(interp, NULL, 1, "setting unhandled float type in 
struct");
             break;
     }
 }
@@ -459,7 +459,7 @@
 /*
 
 =item C<static void
-set_string(char *p, int type, STRING *value)>
+set_string(Interp *interp, char *p, int type, STRING *value)>
 
 Sets the value of the element of type C<type> starting at C<*p> to
 C<*value>.
@@ -469,7 +469,7 @@
 */
 
 static void
-set_string(char *p, int type, STRING* value)
+set_string(Interp *interp, char *p, int type, STRING* value)
 {
     char *cstr;
     switch (type) {
@@ -481,7 +481,7 @@
             *(char **) p = cstr;
             break;
         default:
-            internal_exception(1, "setting unhandled string type in struct 
(%d)", type);
+            real_exception(interp, NULL, 1, "setting unhandled string type in 
struct (%d)", type);
             break;
     }
 }
@@ -767,7 +767,7 @@
     INTVAL get_integer_keyed_int(INTVAL ix) {
         int type;
         char *p = char_offset_int(INTERP, pmc, ix, &type);
-        return ret_int(p, type);
+        return ret_int(INTERP, p, type);
     }
 
 /*
@@ -783,7 +783,7 @@
     INTVAL get_integer_keyed(PMC* key) {
         int type;
         char *p = char_offset_key(INTERP, pmc, key, &type);
-        return ret_int(p, type);
+        return ret_int(INTERP, p, type);
     }
 
 /*
@@ -799,7 +799,7 @@
     FLOATVAL get_number_keyed_int(INTVAL key) {
         int type;
         char *p = char_offset_int(INTERP, pmc, key, &type);
-        return ret_float(p, type);
+        return ret_float(INTERP, p, type);
     }
 
 /*
@@ -815,7 +815,7 @@
     FLOATVAL get_number_keyed(PMC* key) {
         int type;
         char *p = char_offset_key(INTERP, pmc, key, &type);
-        return ret_float(p, type);
+        return ret_float(INTERP, p, type);
     }
 
 /*
@@ -924,7 +924,7 @@
     void set_integer_keyed_int(INTVAL ix, INTVAL value) {
         int type;
         char *p = char_offset_int(INTERP, pmc, ix, &type);
-        set_int(p, type, value);
+        set_int(INTERP, p, type, value);
     }
 
 /*
@@ -942,7 +942,7 @@
     void set_integer_keyed(PMC* key, INTVAL value) {
         int type;
         char *p = char_offset_key(INTERP, pmc, key, &type);
-        set_int(p, type, value);
+        set_int(INTERP, p, type, value);
     }
 
 /*
@@ -958,7 +958,7 @@
     void set_number_keyed_int(INTVAL key, FLOATVAL value) {
         int type;
         char *p = char_offset_int(INTERP, pmc, key, &type);
-        set_float(p, type, value);
+        set_float(INTERP, p, type, value);
     }
 
 /*
@@ -974,7 +974,7 @@
     void set_number_keyed(PMC *key, FLOATVAL value) {
         int type;
         char *p = char_offset_key(INTERP, pmc, key, &type);
-        set_float(p, type, value);
+        set_float(INTERP, p, type, value);
     }
 
 /*
@@ -990,7 +990,7 @@
     void set_string_keyed_int(INTVAL key, STRING* value) {
         int type;
         char *p = char_offset_int(INTERP, pmc, key, &type);
-        set_string(p, type, value);
+        set_string(INTERP, p, type, value);
     }
 
 /*
@@ -1006,7 +1006,7 @@
     void set_string_keyed(PMC *key, STRING* value) {
         int type;
         char *p = char_offset_key(INTERP, pmc, key, &type);
-        set_string(p, type, value);
+        set_string(INTERP, p, type, value);
     }
 
 }

Modified: trunk/src/stm/backend.c
==============================================================================
--- trunk/src/stm/backend.c     (original)
+++ trunk/src/stm/backend.c     Sat Jul  7 09:36:54 2007
@@ -690,7 +690,7 @@
     STM_TRACE("commit");
 
     if (log->depth == 0) {
-        internal_exception(1, "stm_commit without transaction\n");
+        real_exception(interp, NULL, 1, "stm_commit without transaction\n");
         return 0;
     }
 
@@ -738,7 +738,7 @@
     STM_TRACE_SAFE("abort");
 
     if (log->depth == 0) {
-        internal_exception(1, "stm_abort without transaction\n");
+        real_exception(interp, NULL, 1, "stm_abort without transaction\n");
         return;
     }
 
@@ -1362,7 +1362,7 @@
     STM_tx_log * const  log = Parrot_STM_tx_log_get(interp);
 
     if (log->depth == 0) {
-        internal_exception(1, "STM_begin_update outside transaction");
+        real_exception(interp, NULL, 1, "STM_begin_update outside 
transaction");
         return PMCNULL;
     }
 
@@ -1388,7 +1388,7 @@
 
     if (log->depth == 0) {
         /* error for now */
-        internal_exception(1, "STM_write outside transaction");
+        real_exception(interp, NULL, 1, "STM_write outside transaction");
         return;
     }
 
@@ -1459,7 +1459,7 @@
     log   = Parrot_STM_tx_log_get(interp);
 
     if (log->depth == 0)
-        internal_exception(1, "replay_extracted outside of transaction");
+        real_exception(interp, NULL, 1, "replay_extracted outside of 
transaction");
 
     sublog = get_sublog(log, log->depth);
     start  = log->last_read;

Modified: trunk/src/string_primitives.c
==============================================================================
--- trunk/src/string_primitives.c       (original)
+++ trunk/src/string_primitives.c       Sat Jul  7 09:36:54 2007
@@ -39,7 +39,7 @@
 
 PARROT_API
 void
-string_set_data_directory(const char *dir)
+string_set_data_directory(Interp *interp, const char *dir)
 {
 #if PARROT_HAS_ICU
     u_setDataDirectory(dir);
@@ -51,14 +51,14 @@
        EBCDIC.) */
 
     if (!u_isdigit(57) || (u_charDigitValue(57) != 9)) {
-            internal_exception(ICU_ERROR,
+            real_exception(interp, NULL, ICU_ERROR,
                 "string_set_data_directory: ICU data files not found"
                 "(apparently) for directory [%s]", dir);
     }
 #else
     UNUSED(dir);
 
-    internal_exception(ICU_ERROR,
+    real_exception(interp, NULL, ICU_ERROR,
         "string_set_data_directory: parrot compiled without ICU support");
 #endif
 }

Modified: trunk/src/tsq.c
==============================================================================
--- trunk/src/tsq.c     (original)
+++ trunk/src/tsq.c     Sat Jul  7 09:36:54 2007
@@ -339,8 +339,9 @@
 void
 queue_destroy(QUEUE *queue /*NN*/)
 {
-    if (peek_entry(queue))
+    if (peek_entry(queue)) {
         internal_exception(1, "Queue not empty on destroy");
+    }
     COND_DESTROY(queue->queue_condition);
     MUTEX_DESTROY(queue->queue_mutex);
     mem_sys_free(queue);

Reply via email to