Author: Whiteknight
Date: Thu Aug 21 15:08:21 2008
New Revision: 30430
Modified:
branches/pdd27mmd/src/pmc/multisub.pmc
Log:
[pdd09gc] add basic (and probably wrong) implementations for
MultiSub:get_pmc_keyed and MultiSub:get_pmc_keyed_string
Modified: branches/pdd27mmd/src/pmc/multisub.pmc
==============================================================================
--- branches/pdd27mmd/src/pmc/multisub.pmc (original)
+++ branches/pdd27mmd/src/pmc/multisub.pmc Thu Aug 21 15:08:21 2008
@@ -86,13 +86,22 @@
return list;
}
-/*
+ /* I don't really know how to implement these if they need something
+ special, so I'll sort the sub list and defer processing to the
+ ResizablePMCArray's VTABLE methods of the same names */
VTABLE PMC *get_pmc_keyed(PMC *key) {
+ PMC * list = Parrot_mmd_sort_manhattan(INTERP, SELF);
+ if(PMC_IS_NULL(list))
+ Parrot_ex_throw_from_c_args(INTERP, NULL, 1, "No applicable
methods.\n");
+ return VTABLE_get_pmc_keyed(INTERP, list, key);
}
VTABLE PMC *get_pmc_keyed_string(STRING *s) {
+ PMC * list = Parrot_mmd_sort_manhattan(INTERP, SELF);
+ if(PMC_IS_NULL(list))
+ Parrot_ex_throw_from_c_args(INTERP, NULL, 1, "No applicable
methods.\n");
+ return VTABLE_get_pmc_keyed_string(INTERP, SELF, s);
}
-*/
/* stub get_iter method. Takes an argument list PMC, sorts the subs in the
multi according to the closeness to that list, and returns an iterator