Author: coke
Date: Mon Jul 28 20:35:50 2008
New Revision: 29835
Modified:
trunk/languages/tcl/src/pmc/tcllist.pmc
trunk/languages/tcl/src/pmc/tclstring.pmc
Log:
[tcl] make 'get_list' METHOD more universal on the Tcl PMCs.
Modified: trunk/languages/tcl/src/pmc/tcllist.pmc
==============================================================================
--- trunk/languages/tcl/src/pmc/tcllist.pmc (original)
+++ trunk/languages/tcl/src/pmc/tcllist.pmc Mon Jul 28 20:35:50 2008
@@ -243,6 +243,19 @@
}
}
+/*
+
+=item METHOD get_list
+
+Return a list version of ourself
+
+=cut
+
+*/
+
+ METHOD get_list() {
+ RETURN(PMC *SELF);
+ }
}
/*
Modified: trunk/languages/tcl/src/pmc/tclstring.pmc
==============================================================================
--- trunk/languages/tcl/src/pmc/tclstring.pmc (original)
+++ trunk/languages/tcl/src/pmc/tclstring.pmc Mon Jul 28 20:35:50 2008
@@ -16,7 +16,7 @@
maps String
{
- METHOD get_list(STRING* str) {
+ METHOD get_list(STRING* str :optional) {
PMC* retval = pmc_new(INTERP, pmc_type(INTERP,
string_from_literal(INTERP, "TclList")));
INTVAL pos = -1; /* we increment before we use it */
INTVAL len; /* length of the string */
@@ -28,7 +28,7 @@
INTVAL depth; /* keep track of nested {} pairs */
if (! str)
- RETURN(PMC *SELF);
+ str = SELF.get_string();
/*
* RT#48166 This prevents a segfault; retval gets claimed before it