Author: tewk
Date: Tue Dec 30 12:50:55 2008
New Revision: 34668

Modified:
   trunk/src/pmc/fixedstringarray.pmc
   trunk/src/pmc/string.pmc

Log:
[core] added get_repr to FixedStringArray and added get_repr to String

Modified: trunk/src/pmc/fixedstringarray.pmc
==============================================================================
--- trunk/src/pmc/fixedstringarray.pmc  (original)
+++ trunk/src/pmc/fixedstringarray.pmc  Tue Dec 30 12:50:55 2008
@@ -475,6 +475,37 @@
 
 /*
 
+=item C<STRING *get_repr()>
+
+Returns the Parrot string representation C<key>.
+
+=cut
+
+*/
+
+    VTABLE STRING *get_repr() {
+        STRING *res    = CONST_STRING(INTERP, "[ ");
+        const INTVAL n = SELF.get_integer();
+        INTVAL  j;
+
+        for (j = 0; j < n; ++j) {
+            PMC * const val = SELF.get_pmc_keyed_int(j);
+            res = string_append(INTERP, res, CONST_STRING(INTERP, "\""));
+            res = string_append(INTERP, res, VTABLE_get_repr(INTERP, val));
+            res = string_append(INTERP, res, CONST_STRING(INTERP, "\""));
+
+            if (j < n - 1)
+                res = string_append(INTERP, res, CONST_STRING(INTERP, ", "));
+        }
+
+        res = string_append(INTERP, res, CONST_STRING(INTERP, " ]"));
+        return res;
+    }
+
+
+
+/*
+
 =back
 
 =head2 Freeze/thaw Interface

Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc    (original)
+++ trunk/src/pmc/string.pmc    Tue Dec 30 12:50:55 2008
@@ -977,7 +977,7 @@
     }
 
     VTABLE STRING* get_repr() {
-        return key_set_to_string(INTERP, SELF);
+        return VTABLE_get_string(INTERP, SELF);
     }
 
 /*

Reply via email to