[svn:parrot] r46385 - branches/codestring/src/pmc

coke at svn.parrot.org coke at svn.parrot.org
Fri May 7 14:39:42 UTC 2010


Author: coke
Date: Fri May  7 14:39:42 2010
New Revision: 46385
URL: https://trac.parrot.org/parrot/changeset/46385

Log:
Add a few string-ish VTABLE entries to StringBuilder.

Modified:
   branches/codestring/src/pmc/stringbuilder.pmc

Modified: branches/codestring/src/pmc/stringbuilder.pmc
==============================================================================
--- branches/codestring/src/pmc/stringbuilder.pmc	Fri May  7 08:02:45 2010	(r46384)
+++ branches/codestring/src/pmc/stringbuilder.pmc	Fri May  7 14:39:42 2010	(r46385)
@@ -190,9 +190,11 @@
 
 /*
 
-=item C<VTABLE set_string_native()>
+=item C<VTABLE set_string_native(STRING)>
 
-Set content of buffer to passed string
+=item C<VTABLE set_pmc(PMC)>
+
+Set content of buffer to passed string or PMC
 
 =cut
 
@@ -200,6 +202,9 @@
     VTABLE void set_string_native(STRING *s) {
         SET_ATTR_buffer(INTERP, SELF, Parrot_str_clone(INTERP, s));
     }
+    VTABLE void set_pmc(PMC *s) {
+        SET_ATTR_buffer(INTERP, SELF, VTABLE_get_string(INTERP, s));
+    }
 
 
 /*
@@ -213,6 +218,7 @@
 =cut
 
 */
+
     INTVAL get_integer() {
         STRING *buffer;
         GET_ATTR_buffer(INTERP, SELF, buffer);
@@ -221,6 +227,21 @@
 
 /*
 
+=item C<VTABLE substr_str()>
+
+=cut
+
+*/
+
+    VTABLE STRING *substr_str(INTVAL offset, INTVAL length) {
+        STRING *buffer;
+        GET_ATTR_buffer(INTERP, SELF, buffer);
+        return Parrot_str_substr(INTERP, buffer, offset, length);
+    }
+
+
+/*
+
 =back
 
 =cut


More information about the parrot-commits mailing list