Author: infinoid
Date: Sat May  3 21:27:11 2008
New Revision: 27315

Modified:
   branches/pdd13pbc/include/parrot/exceptions.h
   branches/pdd13pbc/src/pmc/packfile.pmc

Log:
[PDD13] Make improvements suggested by chromatic++.


Modified: branches/pdd13pbc/include/parrot/exceptions.h
==============================================================================
--- branches/pdd13pbc/include/parrot/exceptions.h       (original)
+++ branches/pdd13pbc/include/parrot/exceptions.h       Sat May  3 21:27:11 2008
@@ -62,7 +62,6 @@
         E_ReferenceError,
         E_SystemError,
         E_MemoryError,
-        E_MalformedPackFileError,
         E_LAST_PYTHON_E = E_MemoryError,
 
         BAD_BUFFER_SIZE,
@@ -116,7 +115,8 @@
         INTERNAL_NOT_IMPLEMENTED,
         ERR_OVERFLOW,
         LOSSY_CONVERSION,
-        ROLE_COMPOSITION_METH_CONFLICT
+        ROLE_COMPOSITION_METH_CONFLICT,
+        EXCEPTION_MALFORMED_PACKFILE
 } exception_type_enum;
 
 /* &end_gen */

Modified: branches/pdd13pbc/src/pmc/packfile.pmc
==============================================================================
--- branches/pdd13pbc/src/pmc/packfile.pmc      (original)
+++ branches/pdd13pbc/src/pmc/packfile.pmc      Sat May  3 21:27:11 2008
@@ -33,7 +33,7 @@
 
 */
     VTABLE void init() {
-        PMC_struct_val(SELF) = PackFile_new(interp, 0);
+        PMC_data(SELF) = PackFile_new(interp, 0);
     }
 
 
@@ -48,7 +48,7 @@
 */
 
     VTABLE void destroy() {
-        PackFile_destroy(interp, (PackFile*)PMC_struct_val(SELF));
+        PackFile_destroy(interp, PMC_data_typed(SELF, PackFile *));
     }
 
 /*
@@ -75,11 +75,11 @@
 Implementation note: taken from the bottom end of Parrot_readbc().
 */
     VTABLE void set_string_native(STRING *str) {
-        PackFile *pf = (PackFile*)PMC_struct_val(SELF);
+        PackFile *pf = PMC_data_typed(SELF, PackFile *);
         const opcode_t *ptr = (const opcode_t*)Parrot_string_cstring(interp, 
str);
         int length = string_length(interp, str);
         if (!PackFile_unpack(interp, pf, ptr, length))
-            real_exception(interp, NULL, E_MalformedPackFileError, "Can't 
unpack packfile.");
+            real_exception(interp, NULL, EXCEPTION_MALFORMED_PACKFILE, "Can't 
unpack packfile.");
 
         /* Set :main routine */
         do_sub_pragmas(interp, pf->cur_cs, PBC_PBC, NULL);
@@ -120,7 +120,7 @@
 
 */
     VTABLE INTVAL get_integer_keyed_str(STRING *key) {
-        PackFile *pf = (PackFile*)PMC_struct_val(SELF);
+        PackFile *pf = PMC_data_typed(SELF, PackFile *);
         if (!string_compare(interp, key, CONST_STRING(interp, "wordsize")))
             return pf->header->wordsize;
         if (!string_compare(interp, key, CONST_STRING(interp, "byteorder")))
@@ -163,7 +163,7 @@
 
 */
     VTABLE STRING *get_string_keyed_str(STRING *key) {
-        PackFile *pf = (PackFile*)PMC_struct_val(SELF);
+        PackFile *pf = PMC_data_typed(SELF, PackFile *);
         if (!string_compare(interp, key, CONST_STRING(interp, "uuid")))
             return string_from_cstring(interp, (char*)pf->header->uuid_data, 
pf->header->uuid_size);
 

Reply via email to