Author: coke
Date: Wed Jul 23 20:14:13 2008
New Revision: 29718
Removed:
trunk/languages/tcl/runtime/list_to_string.pir
Modified:
trunk/MANIFEST
trunk/languages/tcl/config/makefiles/root.in
trunk/languages/tcl/runtime/tcllib.pir
trunk/languages/tcl/src/pmc/tcldict.pmc
Log:
[tcl] reclaim 47 spec tests in dict.test;
- the recently reactivated TclDict vtable get_string had a segfault.
- avoid it entirely by translating the PIR sub it invoked into C
- delete the now-unused PIR sub
- Fix the algorithm to use the right container PMC type.
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST (original)
+++ trunk/MANIFEST Wed Jul 23 20:14:13 2008
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Jul 22 18:07:34 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu Jul 24 03:13:28 2008 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -2546,7 +2546,6 @@
languages/tcl/runtime/builtin/variable.pir [tcl]
languages/tcl/runtime/builtin/vwait.pir [tcl]
languages/tcl/runtime/conversions.pir [tcl]
-languages/tcl/runtime/list_to_string.pir [tcl]
languages/tcl/runtime/options.pir [tcl]
languages/tcl/runtime/string_to_list.pir [tcl]
languages/tcl/runtime/tcllib.pir [tcl]
Modified: trunk/languages/tcl/config/makefiles/root.in
==============================================================================
--- trunk/languages/tcl/config/makefiles/root.in (original)
+++ trunk/languages/tcl/config/makefiles/root.in Wed Jul 23 20:14:13 2008
@@ -66,7 +66,6 @@
$(C_BUILTIN)/list.pir \
$(C_BUILTIN)/return.pir \
runtime/conversions.pir \
-runtime/list_to_string.pir \
runtime/string_to_list.pir \
runtime/variables.pir \
runtime/options.pir \
Modified: trunk/languages/tcl/runtime/tcllib.pir
==============================================================================
--- trunk/languages/tcl/runtime/tcllib.pir (original)
+++ trunk/languages/tcl/runtime/tcllib.pir Wed Jul 23 20:14:13 2008
@@ -27,7 +27,6 @@
# library files (HLL: _Tcl)
.include 'languages/tcl/runtime/conversions.pir'
-.include 'languages/tcl/runtime/list_to_string.pir'
.include 'languages/tcl/runtime/string_to_list.pir'
.include 'languages/tcl/runtime/variables.pir'
.include 'languages/tcl/runtime/options.pir'
Modified: trunk/languages/tcl/src/pmc/tcldict.pmc
==============================================================================
--- trunk/languages/tcl/src/pmc/tcldict.pmc (original)
+++ trunk/languages/tcl/src/pmc/tcldict.pmc Wed Jul 23 20:14:13 2008
@@ -34,27 +34,27 @@
=item C<STRING *get_string()>
-Returns the dict as a string
+Returns the dict as a string. Take advantage of the heavy lifting already
present
+in TclList.
=cut
*/
VTABLE STRING* get_string() {
- PMC *dictToString, *namespace;
- STRING *_tcl_namespace, *sub;
-
- _tcl_namespace = string_from_cstring(INTERP, "_tcl", 4);
- sub = string_from_cstring(INTERP, "dictToString", 14);
-
- namespace = INTERP->root_namespace;
- namespace = VTABLE_get_pmc_keyed_str(INTERP, namespace,
_tcl_namespace);
- dictToString = VTABLE_get_pmc_keyed_str(INTERP, namespace, sub);
-
- CONTEXT(interp)->constants =
- PMC_sub(dictToString)->seg->const_table->constants;
- return (STRING *)Parrot_runops_fromc_args(INTERP, dictToString, "SP",
SELF);
-
+ PMC *list, *iterator;
+ STRING *key;
+ PMC *value;
+ list = pmc_new(INTERP, pmc_type(INTERP, CONST_STRING(INTERP,
"TclList")));
+ iterator = VTABLE_get_iter(INTERP, list);
+
+ while (VTABLE_get_bool(INTERP, iterator)) {
+ key = VTABLE_shift_string(INTERP, iterator);
+ VTABLE_push_string(INTERP, list, key);
+ value = VTABLE_get_pmc_keyed_str(INTERP, list, key);
+ VTABLE_push_string(INTERP, list, VTABLE_get_string(INTERP,
value));
+ }
+ return VTABLE_get_string(INTERP, list);
}
}