Author: leo
Date: Wed Apr 20 23:11:39 2005
New Revision: 7899

Modified:
   trunk/classes/float.pmc
   trunk/classes/hash.pmc
   trunk/classes/string.pmc
   trunk/dynclasses/tclarray.pmc
   trunk/dynclasses/tclobject.pmc
   trunk/vtable.tbl
Log:
[perl #35053] [PATCH] classes/float.pmc: void function can't return a value

In classes/float.pmc, the MMD_DEFAULT branch of i_subtract tries to
return a value, even though the function is defined as 'void'.

Courtesy of Andy Dougherty <[EMAIL PROTECTED]>

---

* better morph for Tcl objects
* fix Tcl hash creation sequence
* align string methods in vtable.tbl
* fix a few hash pod entries
*


Modified: trunk/classes/float.pmc
==============================================================================
--- trunk/classes/float.pmc     (original)
+++ trunk/classes/float.pmc     Wed Apr 20 23:11:39 2005
@@ -247,7 +247,7 @@
             Parrot_scalar_i_subtract_Complex(interpreter, SELF, value);
         }
 MMD_DEFAULT: {
-            return SUPER(value);  /* XXX inheritance problem */
+            SUPER(value);  /* XXX inheritance problem */
         }
     }
 

Modified: trunk/classes/hash.pmc
==============================================================================
--- trunk/classes/hash.pmc      (original)
+++ trunk/classes/hash.pmc      Wed Apr 20 23:11:39 2005
@@ -141,8 +141,7 @@
 
 =item C<void class_init()>
 
-Class initialization. Allocates the memory for the hash.
-Sets up some global variables.
+Class initialization. Creates a buffer-like memory pool for the hash.
 
 =cut
 
@@ -156,8 +155,7 @@
 
 =item C<void init()>
 
-Initializes the instance. Creates a global C<Undef> if it doesn't
-already exist.
+Initializes the instance.
 
 =cut
 

Modified: trunk/classes/string.pmc
==============================================================================
--- trunk/classes/string.pmc    (original)
+++ trunk/classes/string.pmc    Wed Apr 20 23:11:39 2005
@@ -571,7 +571,7 @@
 
 /*
 
-=item C<void substr(INTVAL offset, INTVAL length)>
+=item C<STRING* substr(INTVAL offset, INTVAL length)>
 
 Extracts the substring starting at C<offset>, with size
 C<length>, and returns it.

Modified: trunk/dynclasses/tclarray.pmc
==============================================================================
--- trunk/dynclasses/tclarray.pmc       (original)
+++ trunk/dynclasses/tclarray.pmc       Wed Apr 20 23:11:39 2005
@@ -89,8 +89,9 @@
 */
 
     void init () {
+        PMC_struct_val(SELF) = NULL;
         PObj_custom_mark_SET(SELF);
-        new_hash(INTERP, (Hash**)&PMC_struct_val(SELF));
+        new_pmc_hash(INTERP, SELF);
     }
 
 /*

Modified: trunk/dynclasses/tclobject.pmc
==============================================================================
--- trunk/dynclasses/tclobject.pmc      (original)
+++ trunk/dynclasses/tclobject.pmc      Wed Apr 20 23:11:39 2005
@@ -37,23 +37,18 @@
     void morph (INTVAL type) {
         if (SELF->vtable->base_type == type)
             return;
-        if (SELF->vtable->base_type == TclString_type) {
-            PObj_custom_mark_CLEAR(SELF);
-            SELF->vtable = Parrot_base_vtables[type];
-            return;
-        }
-        if (type == TclString_type) {
-            /*
-             * if we morph to a string, first clear str_val
-             * so that after changing the vtable a parallel
-             * reader doesn't get a garbage pointer
-             */
-            PMC_str_val(SELF) = NULL;
-            PObj_custom_mark_SET(SELF);
-            SELF->vtable = Parrot_base_vtables[type];
-            return;
-        }
-        SELF->vtable = Parrot_base_vtables[type];
+       switch (type) {
+           case enum_class_String:
+               type = TclString_type;
+               break;
+           case enum_class_Integer:
+               type = TclInt_type;
+               break;
+           case enum_class_Float:
+               type = TclFloat_type;
+               break;
+       }
+       pmc_reuse(INTERP, SELF, type, 0);
     }
 
     void set_pmc (PMC* value) {

Modified: trunk/vtable.tbl
==============================================================================
--- trunk/vtable.tbl    (original)
+++ trunk/vtable.tbl    Wed Apr 20 23:11:39 2005
@@ -237,10 +237,6 @@
 void bitwise_shr(PMC* value, PMC* dest)        MMD_BSR
 void bitwise_shr_int(INTVAL value, PMC* dest)  MMD_BSR_INT
 
-[STRING]
-void concatenate(PMC* value, PMC* dest)        MMD_CONCAT
-void concatenate_str(STRING* value, PMC* dest) MMD_CONCAT_STR
-
 [CMP]
 INTVAL is_equal(PMC* value)                  MMD_EQ
 INTVAL is_equal_num(PMC* value)              MMD_NUMEQ
@@ -260,9 +256,16 @@
 
 void logical_not(PMC* dest)
 
+[STRING]
+void concatenate(PMC* value, PMC* dest)        MMD_CONCAT
+void concatenate_str(STRING* value, PMC* dest) MMD_CONCAT_STR
+
 void repeat(PMC* value, PMC* dest)           MMD_REPEAT
 void repeat_int(INTVAL value, PMC* dest)     MMD_REPEAT_INT
 
+void substr(INTVAL offset, INTVAL length, PMC* dest)
+STRING* substr_str(INTVAL offset, INTVAL length)
+
 [EXISTS]
 INTVAL exists_keyed(PMC* key)
 INTVAL exists_keyed_int(INTVAL key)
@@ -285,11 +288,6 @@
 PMC* nextkey_keyed_str(STRING* key, INTVAL what)
 PMC* get_iter()
 
-[STRING]
-void substr(INTVAL offset, INTVAL length, PMC* dest)
-STRING* substr_str(INTVAL offset, INTVAL length)
-
-[MAIN]
 void* invoke(void* next)
 
 INTVAL can(STRING* method)

Reply via email to