[svn:parrot] r44104 - in trunk: . compilers/data_json compilers/imcc compilers/json compilers/nqp compilers/pct compilers/pge compilers/tge config/auto/sizes docs/book/draft docs/book/pct docs/dev docs/pdds examples/embed examples/languages/abc examples/languages/squaak examples/pge ext/nqp-rx include/parrot lib/Parrot lib/Parrot/Configure/Step ports/cpan ports/cygwin ports/debian ports/fedora ports/mandriva ports/suse runtime/parrot/languages runtime/parrot/library runtime/parrot/library/Math runtime/parrot/library/Math/Random src/call src/gc src/interp src/pmc src/runcore t/compilers/tge t/library t/oo t/pmc t/src t/steps/init/hints tools/build tools/dev tools/util
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Wed Feb 17 19:01:49 UTC 2010
Author: whiteknight
Date: Wed Feb 17 19:01:48 2010
New Revision: 44104
URL: https://trac.parrot.org/parrot/changeset/44104
Log:
[TT #1449] merge the tt_1449 branch into trunk. This should satisfy the ticket
Modified:
trunk/ (props changed)
trunk/compilers/data_json/Rules.mak (props changed)
trunk/compilers/imcc/Rules.mak (props changed)
trunk/compilers/json/Rules.mak (props changed)
trunk/compilers/nqp/Rules.mak (props changed)
trunk/compilers/pct/Rules.mak (props changed)
trunk/compilers/pge/Rules.mak (props changed)
trunk/compilers/tge/Rules.mak (props changed)
trunk/config/auto/sizes/intval_maxmin_c.in (props changed)
trunk/docs/book/draft/README (props changed)
trunk/docs/book/draft/appa_glossary.pod (props changed)
trunk/docs/book/draft/appb_patch_submission.pod (props changed)
trunk/docs/book/draft/appc_command_line_options.pod (props changed)
trunk/docs/book/draft/appd_build_options.pod (props changed)
trunk/docs/book/draft/appe_source_code.pod (props changed)
trunk/docs/book/draft/ch01_introduction.pod (props changed)
trunk/docs/book/draft/ch02_getting_started.pod (props changed)
trunk/docs/book/draft/ch07_dynpmcs.pod (props changed)
trunk/docs/book/draft/ch08_dynops.pod (props changed)
trunk/docs/book/draft/ch10_opcode_reference.pod (props changed)
trunk/docs/book/draft/ch11_directive_reference.pod (props changed)
trunk/docs/book/draft/ch12_operator_reference.pod (props changed)
trunk/docs/book/draft/chXX_hlls.pod (props changed)
trunk/docs/book/draft/chXX_library.pod (props changed)
trunk/docs/book/draft/chXX_testing_and_debugging.pod (props changed)
trunk/docs/book/pct/ch01_introduction.pod (props changed)
trunk/docs/book/pct/ch02_getting_started.pod (props changed)
trunk/docs/book/pct/ch03_compiler_tools.pod (props changed)
trunk/docs/book/pct/ch04_pge.pod (props changed)
trunk/docs/book/pct/ch05_nqp.pod (props changed)
trunk/docs/dev/c_functions.pod (props changed)
trunk/docs/pdds/pdd30_install.pod (props changed)
trunk/examples/embed/cotorra.c (props changed)
trunk/examples/languages/abc/ (props changed)
trunk/examples/languages/squaak/ (props changed)
trunk/examples/pge/demo.pir (props changed)
trunk/ext/nqp-rx/Rules.mak (props changed)
trunk/include/parrot/call.h (props changed)
trunk/include/parrot/gc_api.h (props changed)
trunk/include/parrot/runcore_api.h (props changed)
trunk/include/parrot/runcore_profiling.h (props changed)
trunk/include/parrot/runcore_trace.h (props changed)
trunk/lib/Parrot/Configure/Step/Test.pm (props changed)
trunk/lib/Parrot/H2inc.pm (props changed)
trunk/ports/cpan/pause_guide.pod (props changed)
trunk/ports/cygwin/parrot-1.0.0-1.cygport (props changed)
trunk/ports/debian/libparrot-dev.install.in (props changed)
trunk/ports/debian/libparrot.install.in (props changed)
trunk/ports/debian/parrot-doc.install.in (props changed)
trunk/ports/debian/parrot.install.in (props changed)
trunk/ports/fedora/parrot.spec.fedora (props changed)
trunk/ports/mandriva/parrot.spec.mandriva (props changed)
trunk/ports/suse/parrot.spec.suse (props changed)
trunk/runtime/parrot/languages/ (props changed)
trunk/runtime/parrot/library/Math/Rand.pir (props changed)
trunk/runtime/parrot/library/Math/Random/mt19937ar.pir (props changed)
trunk/runtime/parrot/library/Rules.mak (props changed)
trunk/src/call/ops.c (props changed)
trunk/src/call/pcc.c (props changed)
trunk/src/gc/alloc_memory.c (props changed)
trunk/src/gc/alloc_resources.c (props changed)
trunk/src/gc/api.c (props changed)
trunk/src/gc/malloc.c (props changed)
trunk/src/gc/malloc_trace.c (props changed)
trunk/src/gc/mark_sweep.c (props changed)
trunk/src/gc/system.c (props changed)
trunk/src/interp/inter_cb.c (props changed)
trunk/src/interp/inter_create.c (props changed)
trunk/src/interp/inter_misc.c (props changed)
trunk/src/pmc/namespace.pmc
trunk/src/runcore/cores.c (props changed)
trunk/src/runcore/main.c (props changed)
trunk/src/runcore/profiling.c (props changed)
trunk/src/runcore/trace.c (props changed)
trunk/t/compilers/tge/NoneGrammar.tg (props changed)
trunk/t/library/mt19937ar.t (props changed)
trunk/t/library/mt19937ar.txt (props changed)
trunk/t/oo/root_new.t (props changed)
trunk/t/pmc/namespace-old.t (props changed)
trunk/t/pmc/namespace.t
trunk/t/src/embed.t (props changed)
trunk/t/steps/init/hints/linux-01.t (props changed)
trunk/tools/build/cc_flags.pl (props changed)
trunk/tools/build/h2inc.pl (props changed)
trunk/tools/dev/fetch_languages.pl (props changed)
trunk/tools/dev/mk_gitignore.pl (props changed)
trunk/tools/util/perlcritic-cage.conf (props changed)
Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc Wed Feb 17 18:53:01 2010 (r44103)
+++ trunk/src/pmc/namespace.pmc Wed Feb 17 19:01:48 2010 (r44104)
@@ -387,7 +387,8 @@
}
VTABLE PMC *get_pmc_keyed_str(STRING *key) {
- PMC *ns = (PMC *)parrot_hash_get(INTERP, (Hash *)SELF.get_pointer(), key);
+ Hash * const hash = (Hash *)SELF.get_pointer();
+ PMC *ns = (PMC *)parrot_hash_get(INTERP, hash, key);
if (!ns)
return PMCNULL;
@@ -400,8 +401,8 @@
}
VTABLE PMC *get_pmc_keyed(PMC *key) {
- /* PMC *ns = SUPER(key); */
- PMC *ns = INTERP->vtables[enum_class_Hash]->get_pmc_keyed(INTERP, SELF, key);
+ PMC *ns = SUPER(key);
+ //PMC *ns = INTERP->vtables[enum_class_Hash]->get_pmc_keyed(INTERP, SELF, key);
if (!PMC_IS_NULL(ns))
return ns;
@@ -422,9 +423,27 @@
return VTABLE_get_pmc_keyed(INTERP, ns, key);
}
-
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_GLOBAL_NOT_FOUND,
- "Invalid namespace key in get_pmc_keyed_str");
+ else if (VTABLE_does(INTERP, key, CONST_STRING(INTERP, "array"))) {
+ INTVAL i = 0;
+ while (!PMC_IS_NULL(ns) && VTABLE_elements(INTERP, key)) {
+ STRING * const name = VTABLE_get_string_keyed_int(INTERP, key, i);
+ if (name == NULL || name == STRINGNULL) {
+ ns = PMCNULL;
+ // TODO: Throw an exception or something?
+ break;
+ }
+ ns = Parrot_get_namespace_keyed_str(INTERP, ns, name);
+ i++;
+ }
+ return ns;
+ }
+ else {
+ STRING * const name = VTABLE_get_string(INTERP, key);
+ ns = Parrot_get_namespace_keyed_str(INTERP, ns, name);
+ return ns;
+ }
+ //Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_GLOBAL_NOT_FOUND,
+ // "Invalid namespace key in get_pmc_keyed_str");
}
VTABLE PMC *get_pmc_keyed_int(INTVAL key) {
Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t Wed Feb 17 18:53:01 2010 (r44103)
+++ trunk/t/pmc/namespace.t Wed Feb 17 19:01:48 2010 (r44104)
@@ -56,11 +56,12 @@
.sub main :main
.include 'test_more.pir'
- plan(70)
+ plan(74)
create_namespace_pmc()
verify_namespace_type()
get_namespace_class()
+ keyed_namespace_lookup()
get_global_opcode()
get_sub_from_namespace_hash()
access_sub_in_namespace()
@@ -167,6 +168,40 @@
.end
+.sub keyed_namespace_lookup
+ # Tests to verify behavior of TT #1449
+ $P0 = get_root_namespace
+
+ # Keyed lookup
+ $P1 = $P0["parrot";"Foo";"Bar"]
+ $I0 = isnull $P1
+ is($I0, 0, "can lookup nested namespace by Key")
+ # TODO: Get the function from this namespace and call it to verify we have
+ # the correct one.
+
+ # Array lookup
+ $P1 = new ['ResizableStringArray']
+ $P1[0] = "parrot"
+ $P1[1] = "Foo"
+ $P1[2] = "Bar"
+ $P1[3] = "Baz"
+ $P2 = $P0[$P1]
+ $I0 = isnull $P1
+ is($I0, 0, "can lookup nested namespace by RSA")
+ # TODO: Get the function from this namespace and call it to verify we have
+ # the correct one.
+
+ # String lookup
+ $P1 = $P0["parrot"]
+ $P2 = $P1["Foo"]
+ $I0 = isnull $P1
+ is($I0, 0, "can lookup namespace by string")
+ $I0 = isnull $P2
+ is($I0, 0, "can lookup namespace by string")
+ # TODO: Get the function from this namespace and call it to verify we have
+ # the correct one.
+.end
+
# L<PDD21//>
.sub 'get_global_opcode'
test1:
@@ -486,7 +521,7 @@
# ...now we do!
$P1 = $P0.'make_namespace'("NewNamespace1")
- $P2 = $P1["baz"]
+ $P2 = $P1["baz"]
$I0 = isnull $P2
is($I0, 1, "make_namespace also creates new namespaces")
@@ -632,6 +667,12 @@
.return("Foo::Bar")
.end
+# Namespace "Foo";"Bar";"Baz". Nested namespace
+.namespace ["Foo";"Bar";"Baz"]
+.sub 'widget'
+ .return("Foo::Bar::Baz")
+.end
+
# Namespace specified in ISO-8859-1
.namespace [ iso-8859-1:"Fran\x{E7}ois" ]
.sub 'baz'
More information about the parrot-commits
mailing list