[svn:parrot] r47678 - in trunk: . compilers/data_json compilers/imcc compilers/pct compilers/pge compilers/pirc/src compilers/tge config/auto/sizes config/auto/zlib config/gen/makefiles docs docs/book/draft docs/book/pct docs/dev docs/pdds examples/embed examples/languages/abc examples/languages/squaak examples/pge ext/Parrot-Embed/lib/Parrot ext/nqp-rx include/parrot lib/Parrot lib/Parrot/Configure/Step ports/cygwin ports/debian ports/fedora/2.3.0 ports/suse/2.2.0 runtime/parrot/languages runtime/parrot/library runtime/parrot/library/Math src src/call src/dynpmc src/gc src/interp src/ops src/pmc src/runcore t/compilers/tge 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
Fri Jun 18 00:29:12 UTC 2010
Author: whiteknight
Date: Fri Jun 18 00:29:10 2010
New Revision: 47678
URL: https://trac.parrot.org/parrot/changeset/47678
Log:
[ns_func_cleanup] merge the ns_func_cleanup branch. Renames a bunch of functions in global.c (which is now namespace.c)
Added:
trunk/include/parrot/namespace.h
- copied unchanged from r47677, branches/ns_func_cleanup/include/parrot/namespace.h
trunk/src/namespace.c
- copied unchanged from r47677, branches/ns_func_cleanup/src/namespace.c
Deleted:
trunk/include/parrot/global.h
trunk/src/global.c
Modified:
trunk/ (props changed)
trunk/DEPRECATED.pod
trunk/MANIFEST
trunk/compilers/data_json/Rules.mak (props changed)
trunk/compilers/imcc/Rules.in (props changed)
trunk/compilers/imcc/pbc.c
trunk/compilers/pct/Rules.mak (props changed)
trunk/compilers/pge/Rules.mak (props changed)
trunk/compilers/pirc/src/bcgen.c
trunk/compilers/tge/Rules.mak (props changed)
trunk/config/auto/sizes/intval_maxmin_c.in (props changed)
trunk/config/auto/zlib/ (props changed)
trunk/config/gen/makefiles/root.in
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/embed.pod
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/Parrot-Embed/lib/Parrot/Embed.xs
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/parrot.h
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/cygwin/README
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/2.3.0/ (props changed)
trunk/ports/suse/2.2.0/ (props changed)
trunk/runtime/parrot/languages/ (props changed)
trunk/runtime/parrot/library/Math/Rand.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/dynpmc/Defines.in
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/hll.c
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/multidispatch.c
trunk/src/oo.c
trunk/src/ops/core_ops.c
trunk/src/ops/experimental.ops
trunk/src/ops/pmc.ops
trunk/src/ops/var.ops
trunk/src/packfile.c
trunk/src/pmc/capture.pmc
trunk/src/pmc/class.pmc
trunk/src/pmc/namespace.pmc
trunk/src/pmc/role.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/src/thread.c
trunk/t/compilers/tge/NoneGrammar.tg (props changed)
trunk/t/oo/root_new.t (props changed)
trunk/t/pmc/namespace-old.t (props changed)
trunk/t/src/embed.t (contents, props changed)
trunk/t/src/extend.t
trunk/t/steps/init/hints/linux-01.t (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/DEPRECATED.pod
==============================================================================
--- trunk/DEPRECATED.pod Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/DEPRECATED.pod Fri Jun 18 00:29:10 2010 (r47678)
@@ -310,6 +310,12 @@
L<https://trac.parrot.org/parrot/ticket/443>
+=item C<Parrot_find_global_s> and C<Parrot_store_global_s>
+
+This function is not used or tested anywhere.
+
+http://trac.parrot.org/parrot/ticket/1660
+
=item PMC Attributes Allocation Functions [experimental]
Parrot_gc_allocate_pmc_attributes
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/MANIFEST Fri Jun 18 00:29:10 2010 (r47678)
@@ -959,7 +959,6 @@
include/parrot/exit.h [main]include
include/parrot/extend.h [main]include
include/parrot/gc_api.h [main]include
-include/parrot/global.h [main]include
include/parrot/global_setup.h [main]include
include/parrot/hash.h [main]include
include/parrot/hll.h [main]include
@@ -975,6 +974,7 @@
include/parrot/memory.h [main]include
include/parrot/misc.h [main]include
include/parrot/multidispatch.h [main]include
+include/parrot/namespace.h [main]include
include/parrot/nci.h [main]include
include/parrot/oo.h [main]include
include/parrot/oo_private.h [main]include
@@ -1291,7 +1291,6 @@
src/gc/malloc_trace.c []
src/gc/mark_sweep.c []
src/gc/system.c []
-src/global.c []
src/global_setup.c []
src/hash.c []
src/hll.c []
@@ -1317,6 +1316,7 @@
src/main.c []
src/misc.c []
src/multidispatch.c []
+src/namespace.c []
src/nci/api.c []
src/nci/core_thunks.c []
src/nci/core_thunks.nci []
Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/compilers/imcc/pbc.c Fri Jun 18 00:29:10 2010 (r47678)
@@ -1507,7 +1507,7 @@
else
sub->ns_entry_name = sub->name;
- Parrot_store_sub_in_namespace(interp, sub_pmc);
+ Parrot_ns_store_sub(interp, sub_pmc);
/*
* store the sub's strings
Modified: trunk/compilers/pirc/src/bcgen.c
==============================================================================
--- trunk/compilers/pirc/src/bcgen.c Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/compilers/pirc/src/bcgen.c Fri Jun 18 00:29:10 2010 (r47678)
@@ -1271,7 +1271,7 @@
* XXX must this be done always? (this w.r.t. the recent discussion about :vtable/:method
* and being :anon etc.
*/
- Parrot_store_sub_in_namespace(bc->interp, sub_pmc);
+ Parrot_ns_store_sub(bc->interp, sub_pmc);
subconst_index = add_pmc_const(bc, sub_pmc);
/* Add a new fixup entry in the fixup table for this sub. */
Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/config/gen/makefiles/root.in Fri Jun 18 00:29:10 2010 (r47678)
@@ -390,7 +390,7 @@
$(INC_DIR)/vtables.h \
$(INC_DIR)/multidispatch.h \
$(INC_DIR)/library.h \
- $(INC_DIR)/global.h \
+ $(INC_DIR)/namespace.h \
$(INC_DIR)/stat.h \
$(INC_DIR)/hll.h \
$(INC_DIR)/pbcversion.h \
@@ -451,7 +451,6 @@
src/gc/gc_inf$(O) \
src/gc/mark_sweep$(O) \
src/gc/system$(O) \
- src/global$(O) \
src/global_setup$(O) \
src/hash$(O) \
src/hll$(O) \
@@ -468,6 +467,7 @@
src/longopt$(O) \
src/misc$(O) \
src/multidispatch$(O) \
+ src/namespace$(O) \
src/frame_builder$(O) \
src/nci/api$(O) \
src/nci/core_thunks$(O) \
@@ -662,7 +662,6 @@
src/debug.str \
src/dynext.str \
src/exceptions.str \
- src/global.str \
src/global_setup.str \
src/hll.str \
src/call/pcc.str \
@@ -674,6 +673,7 @@
src/key.str \
src/library.str \
src/multidispatch.str \
+ src/namespace.str \
src/frame_builder.str \
src/nci/api.str \
src/nci/core_thunks.str \
@@ -1254,7 +1254,7 @@
src/global_setup$(O) : $(PARROT_H_HEADERS) src/global_setup.str src/global_setup.c
-src/global$(O) : $(PARROT_H_HEADERS) src/global.str src/global.c \
+src/namespace$(O) : $(PARROT_H_HEADERS) src/namespace.str src/namespace.c \
include/pmc/pmc_sub.h
src/pmc$(O) : include/pmc/pmc_class.h src/pmc.c \
Modified: trunk/docs/embed.pod
==============================================================================
--- trunk/docs/embed.pod Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/docs/embed.pod Fri Jun 18 00:29:10 2010 (r47678)
@@ -288,12 +288,12 @@
=over 4
-=item C<Parrot_PMC Parrot_find_global_cur(PARROT_INTERP, Parrot_String name)>
+=item C<Parrot_PMC Parrot_ns_find_current_namespace_global(PARROT_INTERP, Parrot_String name)>
Find and return a global called C<name> in the current namespace. Returns
C<PMCNULL> if not found.
-=item C<Parrot_PMC Parrot_find_global_n(PARROT_INTERP, PMC namespace, Parrot_String name)>
+=item C<Parrot_PMC Parrot_ns_find_namespace_global(PARROT_INTERP, PMC namespace, Parrot_String name)>
Search the namespace PMC C<namespace> for an object with name C<globalname>.
Return the object, or NULL if not found.
@@ -303,7 +303,7 @@
Find and return a global called C<name> in the namespace C<namespace>. Returns
C<PMCNULL> if not found.
-=item C<void Parrot_store_global_n(PARROT_INTERP, PMC namespace, Parrot_String name, Parrot_PMC val)>
+=item C<void Parrot_ns_store_global(PARROT_INTERP, PMC namespace, Parrot_String name, Parrot_PMC val)>
Store the PMC C<val> into the namespace PMC C<namespace> with name C<globalname>.
@@ -467,7 +467,7 @@
/* find the subroutine named "foo" in the global namespace */
pstr = string_from_literal(interp, "foo");
- sub = Parrot_find_global_cur(interp, pstr);
+ sub = Parrot_ns_find_current_namespace_global(interp, pstr);
/* run foo(), which returns nothing */
Parrot_ext_call(interp, sub, "->");
@@ -709,13 +709,13 @@
=item C<Parrot_find_encoding_converter>
-=item C<Parrot_find_global_cur>
+=item C<Parrot_ns_find_current_namespace_global>
=item C<Parrot_find_global_k>
-=item C<Parrot_find_global_n>
+=item C<Parrot_ns_find_namespace_global>
-=item C<Parrot_find_global_op>
+=item C<Parrot_ns_find_global_from_op>
=item C<Parrot_find_global_s>
@@ -725,7 +725,7 @@
=item C<Parrot_find_method_with_cache>
-=item C<Parrot_find_name_op>
+=item C<Parrot_ns_find_named_item>
=item C<Parrot_float_rand>
@@ -761,7 +761,7 @@
=item C<Parrot_get_encoding>
-=item C<Parrot_get_global>
+=item C<Parrot_ns_get_global>
=item C<Parrot_get_HLL_id>
@@ -775,9 +775,9 @@
=item C<Parrot_get_namespace_autobase>
-=item C<Parrot_get_namespace_keyed>
+=item C<Parrot_ns_get_namespace_keyed>
-=item C<Parrot_get_namespace_keyed_str>
+=item C<Parrot_ns_get_namespace_keyed_str>
=item C<Parrot_get_numreg>
@@ -949,11 +949,11 @@
=item C<Parrot_make_default_encoding>
-=item C<Parrot_make_namespace_autobase>
+=item C<Parrot_ns_make_namespace_autobase>
-=item C<Parrot_make_namespace_keyed>
+=item C<Parrot_ns_make_namespace_keyed>
-=item C<Parrot_make_namespace_keyed_str>
+=item C<Parrot_ns_make_namespace_keyed_str>
=item C<Parrot_mmd_cache_create>
@@ -1497,7 +1497,7 @@
=item C<Parrot_set_flag>
-=item C<Parrot_set_global>
+=item C<Parrot_ns_set_global>
=item C<Parrot_set_intreg>
@@ -1527,11 +1527,11 @@
=item C<Parrot_srand>
-=item C<Parrot_store_global_n>
+=item C<Parrot_ns_store_global>
=item C<Parrot_store_global_s>
-=item C<Parrot_store_sub_in_namespace>
+=item C<Parrot_ns_store_sub>
=item C<Parrot_str_boolean>
Modified: trunk/ext/Parrot-Embed/lib/Parrot/Embed.xs
==============================================================================
--- trunk/ext/Parrot-Embed/lib/Parrot/Embed.xs Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/ext/Parrot-Embed/lib/Parrot/Embed.xs Fri Jun 18 00:29:10 2010 (r47678)
@@ -153,26 +153,26 @@
ns_str += 2;
if (!ns)
- ns = Parrot_find_global_cur(real_interp,
+ ns = Parrot_ns_find_current_namespace_global(real_interp,
Parrot_str_new_constant(real_interp, prev));
else
- ns = Parrot_find_global_n(real_interp, ns,
+ ns = Parrot_ns_find_namespace_global(real_interp, ns,
Parrot_str_new_constant(real_interp, prev));
prev = ns_str;
}
if (!ns)
- ns = Parrot_find_global_cur(real_interp,
+ ns = Parrot_ns_find_current_namespace_global(real_interp,
Parrot_str_new_constant(real_interp, prev));
else
- ns = Parrot_find_global_n(real_interp, ns,
+ ns = Parrot_ns_find_namespace_global(real_interp, ns,
Parrot_str_new_constant(real_interp, prev));
- pmc = Parrot_find_global_n(real_interp, ns, p_global);
+ pmc = Parrot_ns_find_namespace_global(real_interp, ns, p_global);
Safefree(ns_copy);
}
else
- pmc = Parrot_find_global_cur( real_interp, p_global );
+ pmc = Parrot_ns_find_current_namespace_global( real_interp, p_global );
RETVAL = make_pmc( aTHX_ ST(0), pmc );
OUTPUT:
Deleted: trunk/include/parrot/global.h
==============================================================================
--- trunk/include/parrot/global.h Fri Jun 18 00:29:10 2010 (r47677)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,204 +0,0 @@
-/* global.h
- * Copyright (C) 2004, Parrot Foundation.
- * SVN Info
- * $Id$
- * Overview:
- * Contains accessor functions for globals
- * Data Structure and Algorithms:
- * History:
- * Notes:
- * References:
- */
-
-#ifndef PARROT_GLOBAL_H_GUARD
-#define PARROT_GLOBAL_H_GUARD
-
-/* HEADERIZER BEGIN: src/global.c */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_find_global_cur(PARROT_INTERP,
- ARGIN_NULLOK(STRING *globalname))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_find_global_n(PARROT_INTERP,
- ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-PMC * Parrot_find_global_op(PARROT_INTERP,
- ARGIN(PMC *ns),
- ARGIN_NULLOK(STRING *globalname),
- ARGIN_NULLOK(void *next))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_find_global_s(PARROT_INTERP,
- ARGIN_NULLOK(STRING *str_key),
- ARGIN_NULLOK(STRING *globalname))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_find_name_op(PARROT_INTERP,
- ARGIN(STRING *name),
- SHIM(void *next))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_get_global(PARROT_INTERP,
- ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_get_namespace_keyed(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(PMC *pmc_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_get_namespace_keyed_str(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN_NULLOK(STRING *str_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_make_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_make_namespace_keyed(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(PMC *pmc_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_make_namespace_keyed_str(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(STRING *str_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC * Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-void Parrot_set_global(PARROT_INTERP,
- ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname),
- ARGIN_NULLOK(PMC *val))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-void Parrot_store_global_n(PARROT_INTERP,
- ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname),
- ARGIN_NULLOK(PMC *val))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-void Parrot_store_global_s(PARROT_INTERP,
- ARGIN_NULLOK(STRING *str_key),
- ARGIN_NULLOK(STRING *globalname),
- ARGIN_NULLOK(PMC *val))
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
-void Parrot_store_sub_in_namespace(PARROT_INTERP, ARGIN(PMC *sub_pmc))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-#define ASSERT_ARGS_Parrot_find_global_cur __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_find_global_n __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_find_global_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ns))
-#define ASSERT_ARGS_Parrot_find_global_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_find_name_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(name))
-#define ASSERT_ARGS_Parrot_get_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_get_namespace_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(pmc_key))
-#define ASSERT_ARGS_Parrot_get_namespace_keyed_str \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns))
-#define ASSERT_ARGS_Parrot_make_namespace_autobase \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_make_namespace_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(pmc_key))
-#define ASSERT_ARGS_Parrot_make_namespace_keyed_str \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(str_key))
-#define ASSERT_ARGS_Parrot_ns_get_name __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(_namespace))
-#define ASSERT_ARGS_Parrot_set_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_store_global_n __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_store_global_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_store_sub_in_namespace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(sub_pmc))
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-/* HEADERIZER END: src/global.c */
-
-#endif /* PARROT_GLOBAL_H_GUARD */
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
-
Copied: trunk/include/parrot/namespace.h (from r47677, branches/ns_func_cleanup/include/parrot/namespace.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/include/parrot/namespace.h Fri Jun 18 00:29:10 2010 (r47678, copy of r47677, branches/ns_func_cleanup/include/parrot/namespace.h)
@@ -0,0 +1,204 @@
+/* namespace.h
+ * Copyright (C) 2004-2010, Parrot Foundation.
+ * SVN Info
+ * $Id$
+ * Overview:
+ * Contains accessor functions for globals
+ * Data Structure and Algorithms:
+ * History:
+ * Notes:
+ * References:
+ */
+
+#ifndef PARROT_GLOBAL_H_GUARD
+#define PARROT_GLOBAL_H_GUARD
+
+/* HEADERIZER BEGIN: src/namespace.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_find_current_namespace_global(PARROT_INTERP,
+ ARGIN_NULLOK(STRING *globalname))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_find_namespace_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+PMC * Parrot_ns_find_global_from_op(PARROT_INTERP,
+ ARGIN(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname),
+ ARGIN_NULLOK(void *next))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_find_global_s(PARROT_INTERP,
+ ARGIN_NULLOK(STRING *str_key),
+ ARGIN_NULLOK(STRING *globalname))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_find_named_item(PARROT_INTERP,
+ ARGIN(STRING *name),
+ SHIM(void *next))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_get_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_get_namespace_keyed(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(PMC *pmc_key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_get_namespace_keyed_str(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN_NULLOK(STRING *str_key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_make_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_make_namespace_keyed(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(PMC *pmc_key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_make_namespace_keyed_str(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(STRING *str_key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC * Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+void Parrot_ns_set_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname),
+ ARGIN_NULLOK(PMC *val))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+void Parrot_ns_store_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname),
+ ARGIN_NULLOK(PMC *val))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+void Parrot_store_global_s(PARROT_INTERP,
+ ARGIN_NULLOK(STRING *str_key),
+ ARGIN_NULLOK(STRING *globalname),
+ ARGIN_NULLOK(PMC *val))
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+void Parrot_ns_store_sub(PARROT_INTERP, ARGIN(PMC *sub_pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+#define ASSERT_ARGS_Parrot_ns_find_current_namespace_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_find_namespace_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_find_global_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ns))
+#define ASSERT_ARGS_Parrot_find_global_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_find_named_item __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(name))
+#define ASSERT_ARGS_Parrot_ns_get_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_get_namespace_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(pmc_key))
+#define ASSERT_ARGS_Parrot_ns_get_namespace_keyed_str \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns))
+#define ASSERT_ARGS_Parrot_ns_make_namespace_autobase \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_make_namespace_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(pmc_key))
+#define ASSERT_ARGS_Parrot_ns_make_namespace_keyed_str \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(str_key))
+#define ASSERT_ARGS_Parrot_ns_get_name __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(_namespace))
+#define ASSERT_ARGS_Parrot_ns_set_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_store_global __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_store_global_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_ns_store_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sub_pmc))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: src/namespace.c */
+
+#endif /* PARROT_GLOBAL_H_GUARD */
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+
Modified: trunk/include/parrot/parrot.h
==============================================================================
--- trunk/include/parrot/parrot.h Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/include/parrot/parrot.h Fri Jun 18 00:29:10 2010 (r47678)
@@ -284,7 +284,7 @@
#include "parrot/vtables.h"
#include "parrot/multidispatch.h"
#include "parrot/library.h"
-#include "parrot/global.h"
+#include "parrot/namespace.h"
#include "parrot/stat.h"
#include "parrot/hll.h"
#include "parrot/pbcversion.h"
Modified: trunk/ports/cygwin/README
==============================================================================
--- trunk/ports/cygwin/README Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/ports/cygwin/README Fri Jun 18 00:29:10 2010 (r47678)
@@ -1,7 +1,7 @@
parrot
----------------------------------
Parrot is a virtual machine designed to efficiently compile and
-execute bytecode for interpreted languages. Parrot is a target for Perl 6
+execute bytecode for interpreted languages. Parrot is a target for Perl 6
and a lot of other languages.
Runtime requirements:
@@ -11,7 +11,7 @@
w32api pcre libpq5 openssl
Build requirements:
- readline libncurses-devel libicu-devel libgmp-devel libgdbm-devel perl
+ readline libncurses-devel libicu-devel libgmp-devel libgdbm-devel perl
make gcc
Optional build requirements:
@@ -40,7 +40,7 @@
/usr/src/parrot-devel-<VER>-<REL>.tar.bz2
/usr/src/parrot-docs-<VER>-<REL>.tar.bz2
-Or use 'cygport parrot-<VER>-<REL>.cygport prep' to get a patched
+Or use 'cygport parrot-<VER>-<REL>.cygport prep' to get a patched
source directory.
-------------------------------------------------------------------------------
@@ -657,7 +657,6 @@
/usr/include/parrot/1.0.0/parrot/extend.h
/usr/include/parrot/1.0.0/parrot/extend_vtable.h
/usr/include/parrot/1.0.0/parrot/feature.h
- /usr/include/parrot/1.0.0/parrot/global.h
/usr/include/parrot/1.0.0/parrot/global_setup.h
/usr/include/parrot/1.0.0/parrot/has_header.h
/usr/include/parrot/1.0.0/parrot/hash.h
@@ -676,6 +675,7 @@
/usr/include/parrot/1.0.0/parrot/memory.h
/usr/include/parrot/1.0.0/parrot/misc.h
/usr/include/parrot/1.0.0/parrot/mmd.h
+ /usr/include/parrot/1.0.0/parrot/namespace.h
/usr/include/parrot/1.0.0/parrot/nci.h
/usr/include/parrot/1.0.0/parrot/oo.h
/usr/include/parrot/1.0.0/parrot/oo_private.h
@@ -1877,7 +1877,7 @@
----- version parrot-1.0.0-1 -----
* cygwin 1.7, gcc-4.3 only
* renamed libparrot-devel to parrot-devel
-* removed libparrot1
+* removed libparrot1
* new parrot-docs for make html
* library.c patch to allow library/*.pbc
* removed pbc_info
@@ -1910,21 +1910,21 @@
----- version parrot-0.7.0-1 -----
* removed /usr/runtime and its preremove and postinstall scripts
-* added parrot_exists_check to .cygport. Already installed parrot
+* added parrot_exists_check to .cygport. Already installed parrot
still not supported, despite my #39742 patch
* other minor .cygport improvements: export PATH in seperate lines to fix check
-* new patches:
+* new patches:
[perl #39742] [BUG] installed conflict
[perl #58034] [TODO] config_args
[perl #56996] [TODO] FHS runtime paths
-* enhanced patch:
+* enhanced patch:
[perl #56554] [TODO] make install -C languages
* upstream fixed patches:
[perl #56544] [PATCH] install_files.pl
[perl #56998] [TODO] rename cygwin dll to cygparrot$MAJOR_$MINOR_$PATCH.dll
[perl #57006] [PATCH] add cygwin opengl config quirks
[perl #57296] [TODO] make install -C languages
-* fixed pipp, perl6, pheme, tcl installables. added pcbc's to library
+* fixed pipp, perl6, pheme, tcl installables. added pcbc's to library
----- version parrot-0.6.4-2 -----
* fixed invalid parrot languages and perl6 paths referencing the build_dir
@@ -1933,7 +1933,7 @@
* added myconfig parrotbug VERSION to /usr/lib/parrot
* moved language dll's to parrot-languages
* added more sublanguage exe's: bfc, bfco
-* added usr/lib/parrot/include/config.fpmc usr/lib/parrot/include/interpinfo.pasm
+* added usr/lib/parrot/include/config.fpmc usr/lib/parrot/include/interpinfo.pasm
to parrot
----- version parrot-0.6.4-1 -----
@@ -1951,11 +1951,11 @@
[perl #57114] [PATCH] urm RealBin issue
----- version parrot-0.6.3-1 -----
-* first port, with the help from #parrot, fedora spec,
+* first port, with the help from #parrot, fedora spec,
gentoo ebuild and freebsd ports.
* the php implementation plumhead is still named plumhead.
will be renamed to pipp from the next release 0.6.4 on.
Cygwin port maintained by: Reini Urban <rurban at x-ray.at>
-Please address all questions to the Cygwin mailing list
+Please address all questions to the Cygwin mailing list
at <cygwin at cygwin.com>
Modified: trunk/src/dynpmc/Defines.in
==============================================================================
--- trunk/src/dynpmc/Defines.in Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/dynpmc/Defines.in Fri Jun 18 00:29:10 2010 (r47678)
@@ -41,7 +41,6 @@
include/parrot/extend_vtable.h \
include/parrot/feature.h \
include/parrot/gc_api.h \
- include/parrot/global.h \
include/parrot/global_setup.h \
include/parrot/has_header.h \
include/parrot/hash.h \
@@ -54,6 +53,7 @@
include/parrot/memory.h \
include/parrot/misc.h \
include/parrot/multidispatch.h \
+ include/parrot/namespace.h \
include/parrot/nci.h \
include/parrot/oo.h \
include/parrot/op.h \
Deleted: trunk/src/global.c
==============================================================================
--- trunk/src/global.c Fri Jun 18 00:29:10 2010 (r47677)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,854 +0,0 @@
-/*
-Copyright (C) 2004-2009, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/global.c
-
-=head1 DESCRIPTION
-
-Access to global PMCs
-
-=head1 FUNCTIONS
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/parrot.h"
-#include "global.str"
-#include "pmc/pmc_sub.h"
-#include "pmc/pmc_callcontext.h"
-
-/* HEADERIZER HFILE: include/parrot/global.h */
-/* HEADERIZER BEGIN: static */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * internal_ns_keyed(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(PMC *pmc_key),
- int flags)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * internal_ns_keyed_key(PARROT_INTERP,
- ARGIN(PMC *ns),
- ARGIN(PMC *key),
- int flags)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * internal_ns_keyed_str(PARROT_INTERP,
- ARGIN(PMC *base_ns),
- ARGIN(STRING *key),
- int flags)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * internal_ns_maybe_create(PARROT_INTERP,
- ARGIN(PMC *ns),
- ARGIN(STRING *key),
- int flags)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-static void store_sub_in_multi(PARROT_INTERP,
- ARGIN(PMC *sub_pmc),
- ARGIN(PMC *ns))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-#define ASSERT_ARGS_get_namespace_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(sub_pmc))
-#define ASSERT_ARGS_internal_ns_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(pmc_key))
-#define ASSERT_ARGS_internal_ns_keyed_key __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ns) \
- , PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_internal_ns_keyed_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(base_ns) \
- , PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_internal_ns_maybe_create __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ns) \
- , PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_store_sub_in_multi __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(sub_pmc) \
- , PARROT_ASSERT_ARG(ns))
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-/* HEADERIZER END: static */
-
-#define DEBUG_GLOBAL 0
-
-/* flags for internal_ns_keyed */
-#define INTERN_NS_CREAT 1 /* I'm a fan of the classics */
-
-/*
-
-=item C<static PMC * internal_ns_keyed_str(PARROT_INTERP, PMC *base_ns, STRING
-*key, int flags)>
-
-Internal function to do keyed namespace lookup relative to a given namespace
-PMC. Understands STRINGs.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-internal_ns_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
- ARGIN(STRING *key), int flags)
-{
- ASSERT_ARGS(internal_ns_keyed_str)
- PMC * const ns = VTABLE_get_pmc_keyed_str(interp, base_ns, key);
-
- if (!PMC_IS_NULL(ns) && VTABLE_isa(interp, ns, CONST_STRING(interp, "NameSpace")))
- return ns;
-
- return internal_ns_maybe_create(interp, base_ns, key, flags);
-}
-
-/*
-
-=item C<static PMC * internal_ns_keyed_key(PARROT_INTERP, PMC *ns, PMC *key, int
-flags)>
-
-Internal function to do keyed namespace lookup relative to a given namespace
-PMC. Understands Key PMCs. Used from C<internal_ns_keyed>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-internal_ns_keyed_key(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(PMC *key), int flags)
-{
- ASSERT_ARGS(internal_ns_keyed_key)
- while (key) {
- STRING * const part = VTABLE_get_string(interp, key);
- PMC *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
-
- if (PMC_IS_NULL(sub_ns) || !VTABLE_isa(interp, sub_ns, CONST_STRING(interp, "NameSpace"))) {
- sub_ns = internal_ns_maybe_create(interp, ns, part, flags);
-
- if (PMC_IS_NULL(sub_ns))
- return PMCNULL;
- }
-
- ns = sub_ns;
- key = VTABLE_shift_pmc(interp, key);
- }
-
- return ns;
-}
-
-/*
-
-=item C<static PMC * internal_ns_keyed(PARROT_INTERP, PMC *base_ns, PMC
-*pmc_key, int flags)>
-
-internal_ns_keyed: Internal function to do keyed namespace lookup relative to a
-given namespace PMC. Understands String, Key, and array PMCs containing
-strings.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-internal_ns_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN(PMC *pmc_key), int flags)
-{
- ASSERT_ARGS(internal_ns_keyed)
-
- if (VTABLE_isa(interp, pmc_key, CONST_STRING(interp, "String"))) {
- STRING * const str_key = VTABLE_get_string(interp, pmc_key);
- return internal_ns_keyed_str(interp, base_ns, str_key, flags);
- }
- else if (pmc_key->vtable->base_type == enum_class_Key)
- return internal_ns_keyed_key(interp, base_ns, pmc_key, flags);
- else {
- /* array of strings */
- STRING * const isans = CONST_STRING(interp, "NameSpace");
- const INTVAL n = VTABLE_elements(interp, pmc_key);
- INTVAL i;
- PMC *ns = base_ns;
-
- for (i = 0; i < n; ++i) {
- STRING * const part = VTABLE_get_string_keyed_int(interp, pmc_key, i);
- PMC *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
-
- if (PMC_IS_NULL(sub_ns) || !VTABLE_isa(interp, sub_ns, isans)) {
- sub_ns = internal_ns_maybe_create(interp, ns, part, flags);
- if (PMC_IS_NULL(sub_ns))
- return PMCNULL;
- }
- ns = sub_ns;
- }
- return ns;
- }
-}
-
-/*
-
-=item C<static PMC * internal_ns_maybe_create(PARROT_INTERP, PMC *ns, STRING
-*key, int flags)>
-
-Given the a namespace PMC, a STRING containing a name, and flags from
-C<internal_ns_keyed> or C<internal_ns_keyed_str>, creates and returns a new
-namespace with the given name in the given namespace. This is an internal
-function only.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-internal_ns_maybe_create(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(STRING *key), int flags)
-{
- ASSERT_ARGS(internal_ns_maybe_create)
- PMC *sub_ns;
-
- /* TT #1220 - stop depending on typed namespace */
- if (!(flags & INTERN_NS_CREAT))
- return PMCNULL;
-
- /* TT #1221 - match HLL of enclosing namespace? */
- sub_ns = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
- enum_class_NameSpace));
-
- if (PMC_IS_NULL(sub_ns))
- return PMCNULL;
-
- VTABLE_set_pmc_keyed_str(interp, ns, key, sub_ns);
-
- return sub_ns;
-}
-
-
-/*
-
-=item C<PMC * Parrot_get_namespace_keyed(PARROT_INTERP, PMC *base_ns, PMC
-*pmc_key)>
-
-Find the namespace relative to the namespace C<base_ns> with the key
-C<pmc_key>, which may be a String, a Key, or an array of strings. Return
-the namespace, or NULL if not found.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_get_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN(PMC *pmc_key))
-{
- ASSERT_ARGS(Parrot_get_namespace_keyed)
- return internal_ns_keyed(interp, base_ns, pmc_key, 0);
-}
-
-/*
-
-=item C<PMC * Parrot_get_namespace_keyed_str(PARROT_INTERP, PMC *base_ns, STRING
-*str_key)>
-
-Find the namespace relative to the namespace C<base_ns> with the string key
-C<str_key>. Return the namespace, or NULL if not found.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_get_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
- ARGIN_NULLOK(STRING *str_key))
-{
- ASSERT_ARGS(Parrot_get_namespace_keyed_str)
- return internal_ns_keyed_str(interp, base_ns, str_key, 0);
-}
-
-/*
-
-=item C<PMC * Parrot_make_namespace_keyed(PARROT_INTERP, PMC *base_ns, PMC
-*pmc_key)>
-
-Find, or create if necessary, the namespace relative to the namespace
-C<base_ns> with the key C<pmc_key>, which may be a String, a Key, or an
-array of strings. Return the namespace. Errors will result in exceptions.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_make_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns),
- ARGIN(PMC *pmc_key))
-{
- ASSERT_ARGS(Parrot_make_namespace_keyed)
- return internal_ns_keyed(interp, base_ns, pmc_key, INTERN_NS_CREAT);
-}
-
-/*
-
-=item C<PMC * Parrot_make_namespace_keyed_str(PARROT_INTERP, PMC *base_ns,
-STRING *str_key)>
-
-Find, or create if necessary, the namespace relative to the namespace
-C<base_ns> with the string key C<str_key>. Return the namespace. Errors
-will result in exceptions.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_make_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
- ARGIN(STRING *str_key))
-{
- ASSERT_ARGS(Parrot_make_namespace_keyed_str)
- return internal_ns_keyed_str(interp, base_ns, str_key, INTERN_NS_CREAT);
-}
-
-
-/*
-
-=item C<PMC * Parrot_make_namespace_autobase(PARROT_INTERP, PMC *key)>
-
-Find, or create if necessary, a namespace with the key C<key>, which may be a
-String, a Key, or an array of strings. If it is a String, then the lookup is
-relative to the current namespace. Otherwise, it is relative to the current HLL
-root namespace. Return the namespace. Errors will result in exceptions.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_make_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
-{
- ASSERT_ARGS(Parrot_make_namespace_autobase)
- PMC *base_ns;
- if (VTABLE_isa(interp, key, CONST_STRING(interp, "String")))
- base_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- else
- base_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
- Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- return Parrot_make_namespace_keyed(interp, base_ns, key);
-}
-
-/*
-
-=item C<PMC * Parrot_ns_get_name(PARROT_INTERP, PMC *_namespace)>
-
-Retrieve an array of names from a namespace object.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
-{
- ASSERT_ARGS(Parrot_ns_get_name)
- PMC *names;
- Parrot_pcc_invoke_method_from_c_args(interp, _namespace, CONST_STRING(interp, "get_name"), "->P", &names);
- return names;
-}
-
-/*
-
-=item C<PMC * Parrot_get_global(PARROT_INTERP, PMC *ns, STRING *globalname)>
-
-Parrot_get_global allows a null namespace without throwing an exception; it
-simply returns PMCNULL in that case.
-
-NOTE: At present the use of the {get, set}_global functions is mandatory due to the
- wacky namespace typing of the default Parrot namespace. Eventually it will be
- safe to just use the standard hash interface (if desired).
-
-Look up the global named C<globalname> in the namespace C<ns>. Return the
-global, or return PMCNULL if C<ns> is null or if the global is not found.
-
-KLUDGE ALERT: Currently prefers non-namespaces in case of collision.
-
-=cut
-
-*/
-
-
-/*
- * {get, set}_global.
- *
- * Parrot_get_global allows a null namespace without throwing an exception; it
- * simply returns PMCNULL in that case.
- *
- * NOTE: At present the use of the {get, set}_global functions is mandatory due to the
- * wacky namespace typing of the default Parrot namespace. Eventually it will be
- * safe to just use the standard hash interface (if desired).
- */
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_get_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
-{
- ASSERT_ARGS(Parrot_get_global)
- if (PMC_IS_NULL(ns))
- return PMCNULL;
-
- return (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
-}
-
-/*
-
-=item C<void Parrot_set_global(PARROT_INTERP, PMC *ns, STRING *globalname, PMC
-*val)>
-
-Set the global named C<globalname> in the namespace C<ns> to the value C<val>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_set_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
-{
- ASSERT_ARGS(Parrot_set_global)
- VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
-}
-
-
-/*
-
-=item C<PMC * Parrot_find_global_n(PARROT_INTERP, PMC *ns, STRING *globalname)>
-
-Search the namespace PMC C<ns> for an object with name C<globalname>.
-Return the object, or NULL if not found.
-
-TT #1222 - For now this function prefers non-namespaces, it will eventually
-entirely use the untyped interface.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_find_global_n(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
-{
- ASSERT_ARGS(Parrot_find_global_n)
- PMC *res;
-
-#if DEBUG_GLOBAL
- if (globalname)
- Parrot_io_printf(interp, "find_global name '%Ss'\n", globalname);
-#endif
-
- if (PMC_IS_NULL(ns))
- res = PMCNULL;
- else {
- /*
- * TT #1219 - we should be able to use 'get_pmc_keyed' here,
- * but we can't because Parrot's default namespaces are not
- * fully typed and there's a pseudo-typed interface that
- * distinguishes 'get_pmc_keyed' from 'get_pointer_keyed';
- * the former is for NS and the latter is for non-NS.
- */
- res = (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
- }
-
- return PMC_IS_NULL(res) ? NULL : res;
-}
-
-/*
-
-=item C<PMC * Parrot_find_global_cur(PARROT_INTERP, STRING *globalname)>
-
-Finds and returns the data time named C<globalname> in the current namespace.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_find_global_cur(PARROT_INTERP, ARGIN_NULLOK(STRING *globalname))
-{
- ASSERT_ARGS(Parrot_find_global_cur)
- PMC * const ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- return Parrot_find_global_n(interp, ns, globalname);
-}
-
-/*
-
-=item C<PMC * Parrot_find_global_s(PARROT_INTERP, STRING *str_key, STRING
-*globalname)>
-
-Search the namespace designated by C<str_key>, or the HLL root if
-C<str_key> is NULL, for an object with name C<globalname>. Return the
-object, or NULL if not found.
-
-TT #1222 - For now this function prefers non-namespaces, it will eventually
-entirely use the untyped interface.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_find_global_s(PARROT_INTERP, ARGIN_NULLOK(STRING *str_key),
- ARGIN_NULLOK(STRING *globalname))
-{
- ASSERT_ARGS(Parrot_find_global_s)
- PMC *const ns =
- Parrot_get_namespace_keyed_str(interp,
- Parrot_get_ctx_HLL_namespace(interp),
- str_key);
- return Parrot_find_global_n(interp, ns, globalname);
-}
-
-/*
-
-=item C<void Parrot_store_global_n(PARROT_INTERP, PMC *ns, STRING *globalname,
-PMC *val)>
-
-Store the PMC C<val> into the namespace PMC C<ns> with name C<globalname>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_store_global_n(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
- ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
-{
- ASSERT_ARGS(Parrot_store_global_n)
-#if DEBUG_GLOBAL
- if (globalname)
- Parrot_io_printf(interp, "store_global name '%Ss'\n", globalname);
-#endif
-
- if (PMC_IS_NULL(ns))
- return;
-
- VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
-}
-
-/*
-
-=item C<void Parrot_store_global_s(PARROT_INTERP, STRING *str_key, STRING
-*globalname, PMC *val)>
-
-Store the PMC C<val> into the namespace designated by C<str_key>, or
-the HLL root if C<str_key> is NULL, with the name C<globalname>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_store_global_s(PARROT_INTERP, ARGIN_NULLOK(STRING *str_key),
- ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
-{
- ASSERT_ARGS(Parrot_store_global_s)
- PMC * const ns = Parrot_make_namespace_keyed_str(interp,
- Parrot_get_ctx_HLL_namespace(interp),
- str_key);
-
- Parrot_store_global_n(interp, ns, globalname, val);
-
- /* TT #1225 - method cache invalidation should be a namespace function */
- Parrot_invalidate_method_cache(interp, str_key);
-}
-
-
-/*
-
-=item C<PMC * Parrot_find_global_op(PARROT_INTERP, PMC *ns, STRING *globalname,
-void *next)>
-
-If the global exists in the given namespace PMC, return it. If not, return
-PMCNULL.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-PMC *
-Parrot_find_global_op(PARROT_INTERP, ARGIN(PMC *ns),
- ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(void *next))
-{
- ASSERT_ARGS(Parrot_find_global_op)
- PMC *res;
-
- if (STRING_IS_NULL(globalname))
- Parrot_ex_throw_from_c_args(interp, next, EXCEPTION_GLOBAL_NOT_FOUND,
- "Tried to get null global");
-
- res = Parrot_find_global_n(interp, ns, globalname);
- if (!res)
- res = PMCNULL;
-
- return res;
-}
-
-
-/*
-
-=item C<PMC * Parrot_find_name_op(PARROT_INTERP, STRING *name, void *next)>
-
-TT #1223 - THIS IS BROKEN - it doesn't walk up the scopes yet
-
-Find the given C<name> in lexicals, then the current namespace, then the HLL
-root namespace, and finally Parrot builtins. If the name isn't found
-anywhere, return PMCNULL.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC *
-Parrot_find_name_op(PARROT_INTERP, ARGIN(STRING *name), SHIM(void *next))
-{
- ASSERT_ARGS(Parrot_find_name_op)
- PMC * const ctx = CURRENT_CONTEXT(interp);
- PMC * const lex_pad = Parrot_find_pad(interp, name, ctx);
- PMC *g;
-
- if (PMC_IS_NULL(lex_pad))
- g = PMCNULL;
- else
- g = VTABLE_get_pmc_keyed_str(interp, lex_pad, name);
-
- /* TT #1223 - walk up the scopes! duh!! */
-
- if (PMC_IS_NULL(g))
- g = Parrot_find_global_cur(interp, name);
-
- if (PMC_IS_NULL(g))
- g = Parrot_find_global_n(interp, Parrot_get_ctx_HLL_namespace(interp), name);
-
- if (PMC_IS_NULL(g))
- return PMCNULL;
- else
- return g;
-}
-
-/*
-
-=item C<static PMC * get_namespace_pmc(PARROT_INTERP, PMC *sub_pmc)>
-
-Return the namespace PMC associated with the PMC C<sub>. If C<sub> is NULL,
-return the Associated HLL namespace PMC instead.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
-get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
-{
- ASSERT_ARGS(get_namespace_pmc)
- Parrot_Sub_attributes *sub;
- PMC *nsname, *nsroot;
-
- PMC_get_sub(interp, sub_pmc, sub);
- nsname = sub->namespace_name;
- nsroot = Parrot_get_HLL_namespace(interp, sub->HLL_id);
-
- /* If we have a NULL, return the HLL namespace */
- if (PMC_IS_NULL(nsname))
- return nsroot;
- /* If we have a String, do a string lookup */
- else if (nsname->vtable->base_type == enum_class_String)
- return Parrot_make_namespace_keyed_str(interp, nsroot,
- VTABLE_get_string(interp, nsname));
- /* Otherwise, do a PMC lookup */
- else
- return Parrot_make_namespace_keyed(interp, nsroot, nsname);
-}
-
-/*
-
-=item C<static void store_sub_in_multi(PARROT_INTERP, PMC *sub_pmc, PMC *ns)>
-
-Adds the sub C<sub> into a mulisub of the same name in the namespace C<ns>.
-If no multisub by that name currently exists, we create one.
-
-=cut
-
-*/
-
-static void
-store_sub_in_multi(PARROT_INTERP, ARGIN(PMC *sub_pmc), ARGIN(PMC *ns))
-{
- ASSERT_ARGS(store_sub_in_multi)
- Parrot_Sub_attributes *sub;
- STRING *ns_entry_name;
- PMC *multisub;
-
- PMC_get_sub(interp, sub_pmc, sub);
- ns_entry_name = sub->ns_entry_name;
- multisub = VTABLE_get_pmc_keyed_str(interp, ns, ns_entry_name);
-
- /* is there an existing MultiSub PMC? or do we need to create one? */
- if (PMC_IS_NULL(multisub)) {
- multisub = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_MultiSub));
- /* we have to push the sub onto the MultiSub before we try to store
- it because storing requires information from the sub */
- VTABLE_push_pmc(interp, multisub, sub_pmc);
- VTABLE_set_pmc_keyed_str(interp, ns, ns_entry_name, multisub);
- }
- else
- VTABLE_push_pmc(interp, multisub, sub_pmc);
-}
-
-/*
-
-=item C<void Parrot_store_sub_in_namespace(PARROT_INTERP, PMC *sub_pmc)>
-
-Adds the PMC C<sub> into the current namespace. Adds the sub to a multi of the
-same name if it's defined as a multi.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_store_sub_in_namespace(PARROT_INTERP, ARGIN(PMC *sub_pmc))
-{
- ASSERT_ARGS(Parrot_store_sub_in_namespace)
- const INTVAL cur_id = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp));
-
- PMC *ns;
- Parrot_Sub_attributes *sub;
-
- /* PF structures aren't fully constructed yet */
- Parrot_block_GC_mark(interp);
-
- /* store relative to HLL namespace */
- PMC_get_sub(interp, sub_pmc, sub);
- Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), sub->HLL_id);
-
- ns = get_namespace_pmc(interp, sub_pmc);
-
- /* attach a namespace to the sub for lookups */
- sub->namespace_stash = ns;
-
- /* store a :multi sub */
- if (!PMC_IS_NULL(sub->multi_signature))
- store_sub_in_multi(interp, sub_pmc, ns);
-
- /* store other subs (as long as they're not :anon) */
- else if (!(PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_ANON)
- || sub->vtable_index != -1) {
- STRING * const ns_entry_name = sub->ns_entry_name;
- PMC * const nsname = sub->namespace_name;
-
- Parrot_store_global_n(interp, ns, ns_entry_name, sub_pmc);
-
- /* TT #1224:
- TEMPORARY HACK - cache invalidation should be a namespace function */
- if (!PMC_IS_NULL(nsname)) {
- STRING * const nsname_s = VTABLE_get_string(interp, nsname);
- Parrot_invalidate_method_cache(interp, nsname_s);
- }
- }
-
- /* restore HLL_id */
- Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), cur_id);
- Parrot_unblock_GC_mark(interp);
-}
-
-/*
-
-=back
-
-=head1 SEE ALSO
-
-F<include/parrot/global.h>
-
-=cut
-
-*/
-
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: trunk/src/hll.c
==============================================================================
--- trunk/src/hll.c Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/hll.c Fri Jun 18 00:29:10 2010 (r47678)
@@ -167,7 +167,7 @@
* ns_hash to another type, if mappings provide one
* XXX - FIXME
*/
- ns_hash = Parrot_make_namespace_keyed_str(interp, interp->root_namespace,
+ ns_hash = Parrot_ns_make_namespace_keyed_str(interp, interp->root_namespace,
hll_name);
/* cache HLL's toplevel namespace */
@@ -500,7 +500,7 @@
* here because the typemap already exists, but it is not currently
* done for consistency.
*/
- ns_hash = Parrot_make_namespace_keyed_str(interp,
+ ns_hash = Parrot_ns_make_namespace_keyed_str(interp,
interp->root_namespace, hll_name);
VTABLE_set_pmc_keyed_int(interp, interp->HLL_namespace,
Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/multidispatch.c Fri Jun 18 00:29:10 2010 (r47678)
@@ -329,9 +329,9 @@
{
ASSERT_ARGS(Parrot_mmd_find_multi_from_long_sig)
STRING * const multi_str = CONST_STRING(interp, "MULTI");
- PMC * const ns = Parrot_make_namespace_keyed_str(interp,
+ PMC * const ns = Parrot_ns_make_namespace_keyed_str(interp,
interp->root_namespace, multi_str);
- PMC * const multi_sub = Parrot_get_global(interp, ns, name);
+ PMC * const multi_sub = Parrot_ns_get_global(interp, ns, name);
if (PMC_IS_NULL(multi_sub)) {
return PMCNULL;
@@ -844,7 +844,7 @@
if (PMC_IS_NULL(ns))
return;
- multi_sub = Parrot_get_global(interp, ns, name);
+ multi_sub = Parrot_ns_get_global(interp, ns, name);
if (PMC_IS_NULL(multi_sub))
return;
@@ -868,9 +868,9 @@
{
ASSERT_ARGS(mmd_search_global)
STRING * const multi_str = CONST_STRING(interp, "MULTI");
- PMC * const ns = Parrot_get_namespace_keyed_str(interp,
+ PMC * const ns = Parrot_ns_get_namespace_keyed_str(interp,
interp->root_namespace, multi_str);
- PMC *multi_sub = Parrot_get_global(interp, ns, name);
+ PMC *multi_sub = Parrot_ns_get_global(interp, ns, name);
if (PMC_IS_NULL(multi_sub))
return;
@@ -896,13 +896,13 @@
{
ASSERT_ARGS(mmd_add_multi_global)
STRING * const multi_str = CONST_STRING(interp, "MULTI");
- PMC * const ns = Parrot_make_namespace_keyed_str(interp,
+ PMC * const ns = Parrot_ns_make_namespace_keyed_str(interp,
interp->root_namespace, multi_str);
- PMC *multi_sub = Parrot_get_global(interp, ns, sub_name);
+ PMC *multi_sub = Parrot_ns_get_global(interp, ns, sub_name);
if (PMC_IS_NULL(multi_sub)) {
multi_sub = Parrot_pmc_new_constant(interp, enum_class_MultiSub);
- Parrot_set_global(interp, ns, sub_name, multi_sub);
+ Parrot_ns_set_global(interp, ns, sub_name, multi_sub);
}
PARROT_ASSERT(multi_sub->vtable->base_type == enum_class_MultiSub);
@@ -930,12 +930,12 @@
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
interp->HLL_namespace,
Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- PMC * const ns = Parrot_make_namespace_keyed_str(interp, hll_ns, ns_name);
- PMC *multi_sub = Parrot_get_global(interp, ns, sub_name);
+ PMC * const ns = Parrot_ns_make_namespace_keyed_str(interp, hll_ns, ns_name);
+ PMC *multi_sub = Parrot_ns_get_global(interp, ns, sub_name);
if (PMC_IS_NULL(multi_sub)) {
multi_sub = Parrot_pmc_new_constant(interp, enum_class_MultiSub);
- Parrot_set_global(interp, ns, sub_name, multi_sub);
+ Parrot_ns_set_global(interp, ns, sub_name, multi_sub);
}
PARROT_ASSERT(multi_sub->vtable->base_type == enum_class_MultiSub);
Copied: trunk/src/namespace.c (from r47677, branches/ns_func_cleanup/src/namespace.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/src/namespace.c Fri Jun 18 00:29:10 2010 (r47678, copy of r47677, branches/ns_func_cleanup/src/namespace.c)
@@ -0,0 +1,839 @@
+/*
+Copyright (C) 2004-2009, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/namespace.c
+
+=head1 DESCRIPTION
+
+Common routines for storing and finding elements in namespaces
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+#include "namespace.str"
+#include "pmc/pmc_sub.h"
+#include "pmc/pmc_callcontext.h"
+
+/* HEADERIZER HFILE: include/parrot/namespace.h */
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * internal_ns_keyed(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(PMC *pmc_key),
+ int flags)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * internal_ns_keyed_key(PARROT_INTERP,
+ ARGIN(PMC *ns),
+ ARGIN(PMC *key),
+ int flags)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * internal_ns_keyed_str(PARROT_INTERP,
+ ARGIN(PMC *base_ns),
+ ARGIN(STRING *key),
+ int flags)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC * internal_ns_maybe_create(PARROT_INTERP,
+ ARGIN(PMC *ns),
+ ARGIN(STRING *key),
+ int flags)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+static void store_sub_in_multi(PARROT_INTERP,
+ ARGIN(PMC *sub_pmc),
+ ARGIN(PMC *ns))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+#define ASSERT_ARGS_get_namespace_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sub_pmc))
+#define ASSERT_ARGS_internal_ns_keyed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(pmc_key))
+#define ASSERT_ARGS_internal_ns_keyed_key __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ns) \
+ , PARROT_ASSERT_ARG(key))
+#define ASSERT_ARGS_internal_ns_keyed_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(base_ns) \
+ , PARROT_ASSERT_ARG(key))
+#define ASSERT_ARGS_internal_ns_maybe_create __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ns) \
+ , PARROT_ASSERT_ARG(key))
+#define ASSERT_ARGS_store_sub_in_multi __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sub_pmc) \
+ , PARROT_ASSERT_ARG(ns))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: static */
+
+/* flags for internal_ns_keyed */
+#define INTERN_NS_CREAT 1 /* I'm a fan of the classics */
+
+/*
+
+=head1 Internal Static Functions
+
+=over 4
+
+=item C<static PMC * internal_ns_keyed_str(PARROT_INTERP, PMC *base_ns, STRING
+*key, int flags)>
+
+Looks up a nested NameSpace PMC starting from C<base_ns> and doing a relative
+lookup. C<key> is a STRING containing the name of the NameSpace to look up.
+Flags can be 0 or INTERN_NS_CREAT. In the former case, PMCNULL is returned
+if the namespace is not found. In the later, a new namespace with the given
+is created and returned if it is not found.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+internal_ns_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
+ ARGIN(STRING *key), int flags)
+{
+ ASSERT_ARGS(internal_ns_keyed_str)
+ PMC * const ns = VTABLE_get_pmc_keyed_str(interp, base_ns, key);
+
+ if (!PMC_IS_NULL(ns) && VTABLE_isa(interp, ns, CONST_STRING(interp, "NameSpace")))
+ return ns;
+
+ return internal_ns_maybe_create(interp, base_ns, key, flags);
+}
+
+/*
+
+=item C<static PMC * internal_ns_keyed_key(PARROT_INTERP, PMC *ns, PMC *key, int
+flags)>
+
+Internal function to do keyed namespace lookup relative to a given namespace
+PMC. The namespace to find is located by C<key> relative to C<ns>. C<flags>
+determines what happens when an existing namespace is not found. 0 means
+PMCNULL is returned, INTERN_NS_CREAT means a new namespace is created.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+internal_ns_keyed_key(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(PMC *key), int flags)
+{
+ ASSERT_ARGS(internal_ns_keyed_key)
+ while (key) {
+ STRING * const part = VTABLE_get_string(interp, key);
+ PMC *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
+
+ if (PMC_IS_NULL(sub_ns) || !VTABLE_isa(interp, sub_ns, CONST_STRING(interp, "NameSpace"))) {
+ sub_ns = internal_ns_maybe_create(interp, ns, part, flags);
+
+ if (PMC_IS_NULL(sub_ns))
+ return PMCNULL;
+ }
+
+ ns = sub_ns;
+ key = VTABLE_shift_pmc(interp, key);
+ }
+
+ return ns;
+}
+
+/*
+
+=item C<static PMC * internal_ns_keyed(PARROT_INTERP, PMC *base_ns, PMC
+*pmc_key, int flags)>
+
+Search for a namespace PMC starting from a base namespace C<base_ns> and
+following C<pmc_key> to the nested namespace. C<pmc_key> can be a String,
+a Key, or an array of strings (such as an ResizableStringArray, or a
+ResizablePMCArray that contains Strings). Flags determines what we do if the
+requested namespace is not found: 0 means we return PMCNULL, INTERN_NS_CREAT
+means we create the new namespace and return it.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+internal_ns_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN(PMC *pmc_key), int flags)
+{
+ ASSERT_ARGS(internal_ns_keyed)
+
+ if (VTABLE_isa(interp, pmc_key, CONST_STRING(interp, "String"))) {
+ STRING * const str_key = VTABLE_get_string(interp, pmc_key);
+ return internal_ns_keyed_str(interp, base_ns, str_key, flags);
+ }
+ else if (PMC_IS_TYPE(pmc_key, Key))
+ return internal_ns_keyed_key(interp, base_ns, pmc_key, flags);
+ else {
+ /* array of strings */
+ STRING * const isans = CONST_STRING(interp, "NameSpace");
+ const INTVAL n = VTABLE_elements(interp, pmc_key);
+ INTVAL i;
+ PMC *ns = base_ns;
+
+ for (i = 0; i < n; ++i) {
+ STRING * const part = VTABLE_get_string_keyed_int(interp, pmc_key, i);
+ PMC *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
+
+ if (PMC_IS_NULL(sub_ns) || !VTABLE_isa(interp, sub_ns, isans)) {
+ sub_ns = internal_ns_maybe_create(interp, ns, part, flags);
+ if (PMC_IS_NULL(sub_ns))
+ return PMCNULL;
+ }
+ ns = sub_ns;
+ }
+ return ns;
+ }
+}
+
+/*
+
+=item C<static PMC * internal_ns_maybe_create(PARROT_INTERP, PMC *ns, STRING
+*key, int flags)>
+
+Given a namespace PMC C<ns>, a STRING C<key> containing a name, and flags from
+C<internal_ns_keyed> or C<internal_ns_keyed_str>, creates and returns a new
+namespace with the given name as a child of the given namespace. This is an
+internal function only.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+internal_ns_maybe_create(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(STRING *key), int flags)
+{
+ ASSERT_ARGS(internal_ns_maybe_create)
+
+ /* TT #1220 - stop depending on typed namespace */
+ if (!(flags & INTERN_NS_CREAT))
+ return PMCNULL;
+ else {
+ const INTVAL type_id = Parrot_get_ctx_HLL_type(interp, enum_class_NameSpace);
+ /* TT #1221 - match HLL of enclosing namespace? */
+ PMC * const sub_ns = Parrot_pmc_new(interp, type_id);
+
+ if (PMC_IS_NULL(sub_ns))
+ return PMCNULL;
+
+ VTABLE_set_pmc_keyed_str(interp, ns, key, sub_ns);
+ return sub_ns;
+ }
+}
+
+/*
+
+=item C<static PMC * get_namespace_pmc(PARROT_INTERP, PMC *sub_pmc)>
+
+Return the namespace PMC associated with the PMC C<sub>. If there is no
+NameSpace associated with the sub, return it's HLL NameSpace PMC instead.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC *
+get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
+{
+ ASSERT_ARGS(get_namespace_pmc)
+ Parrot_Sub_attributes *sub;
+ PMC *nsname, *nsroot;
+
+ PMC_get_sub(interp, sub_pmc, sub);
+ nsname = sub->namespace_name;
+ nsroot = Parrot_get_HLL_namespace(interp, sub->HLL_id);
+
+ /* If we have a NULL, return the HLL namespace */
+ if (PMC_IS_NULL(nsname))
+ return nsroot;
+ /* If we have a String, do a string lookup */
+ else if (nsname->vtable->base_type == enum_class_String)
+ return Parrot_ns_make_namespace_keyed_str(interp, nsroot,
+ VTABLE_get_string(interp, nsname));
+ /* Otherwise, do a PMC lookup */
+ else
+ return Parrot_ns_make_namespace_keyed(interp, nsroot, nsname);
+}
+
+/*
+
+=item C<static void store_sub_in_multi(PARROT_INTERP, PMC *sub_pmc, PMC *ns)>
+
+Adds the sub C<sub> into a multisub of the same name in the namespace C<ns>.
+If no multisub by that name currently exists, we create one.
+
+=cut
+
+*/
+
+static void
+store_sub_in_multi(PARROT_INTERP, ARGIN(PMC *sub_pmc), ARGIN(PMC *ns))
+{
+ ASSERT_ARGS(store_sub_in_multi)
+ Parrot_Sub_attributes *sub;
+ STRING *ns_entry_name;
+ PMC *multisub;
+
+ PMC_get_sub(interp, sub_pmc, sub);
+ ns_entry_name = sub->ns_entry_name;
+ multisub = VTABLE_get_pmc_keyed_str(interp, ns, ns_entry_name);
+
+ /* is there an existing MultiSub PMC? or do we need to create one? */
+ if (PMC_IS_NULL(multisub)) {
+ multisub = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_MultiSub));
+ /* we have to push the sub onto the MultiSub before we try to store
+ it because storing requires information from the sub */
+ VTABLE_push_pmc(interp, multisub, sub_pmc);
+ VTABLE_set_pmc_keyed_str(interp, ns, ns_entry_name, multisub);
+ }
+ else
+ VTABLE_push_pmc(interp, multisub, sub_pmc);
+}
+
+/*
+
+=back
+
+=head1 NameSpace API Functions
+
+=over 4
+
+=item C<PMC * Parrot_ns_get_namespace_keyed(PARROT_INTERP, PMC *base_ns, PMC
+*pmc_key)>
+
+Find the namespace relative to the namespace C<base_ns> with the key
+C<pmc_key>, which may be a String, a Key, or an array of strings. Return
+the namespace, or NULL if not found.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_get_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN(PMC *pmc_key))
+{
+ ASSERT_ARGS(Parrot_ns_get_namespace_keyed)
+ return internal_ns_keyed(interp, base_ns, pmc_key, 0);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_get_namespace_keyed_str(PARROT_INTERP, PMC *base_ns, STRING
+*str_key)>
+
+Find the namespace relative to the namespace C<base_ns> with the string key
+C<str_key>. Return the namespace, or NULL if not found.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_get_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
+ ARGIN_NULLOK(STRING *str_key))
+{
+ ASSERT_ARGS(Parrot_ns_get_namespace_keyed_str)
+ return internal_ns_keyed_str(interp, base_ns, str_key, 0);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_make_namespace_keyed(PARROT_INTERP, PMC *base_ns, PMC
+*pmc_key)>
+
+Find, or create if necessary, the namespace relative to the namespace
+C<base_ns> with the key C<pmc_key>, which may be a String, a Key, or an
+array of strings. Return the namespace. Errors will result in exceptions.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_make_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns),
+ ARGIN(PMC *pmc_key))
+{
+ ASSERT_ARGS(Parrot_ns_make_namespace_keyed)
+ return internal_ns_keyed(interp, base_ns, pmc_key, INTERN_NS_CREAT);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_make_namespace_keyed_str(PARROT_INTERP, PMC *base_ns,
+STRING *str_key)>
+
+Find, or create if necessary, the namespace relative to the namespace
+C<base_ns> with the string key C<str_key>. Return the namespace. Errors
+will result in exceptions.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_make_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
+ ARGIN(STRING *str_key))
+{
+ ASSERT_ARGS(Parrot_ns_make_namespace_keyed_str)
+ return internal_ns_keyed_str(interp, base_ns, str_key, INTERN_NS_CREAT);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_make_namespace_autobase(PARROT_INTERP, PMC *key)>
+
+Find, or create if necessary, a namespace with the key C<key>, which may be a
+String, a Key, or an array of strings. If it is a String, then the lookup is
+relative to the current namespace. Otherwise, it is relative to the current HLL
+root namespace. Return the namespace. Errors will result in exceptions.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_make_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
+{
+ ASSERT_ARGS(Parrot_ns_make_namespace_autobase)
+ PMC *base_ns;
+ if (VTABLE_isa(interp, key, CONST_STRING(interp, "String")))
+ base_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
+ else
+ base_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
+ Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
+ return Parrot_ns_make_namespace_keyed(interp, base_ns, key);
+}
+
+/*
+
+=item C<PMC * Parrot_ns_get_name(PARROT_INTERP, PMC *_namespace)>
+
+Get the name of the namespace, as a ResizableStringArray. For instance, the
+namespace Foo:Bar:Baz would return an RSA with three elements.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
+{
+ ASSERT_ARGS(Parrot_ns_get_name)
+ PMC *names;
+ STRING * const get_name = CONST_STRING(interp, "get_name");
+ Parrot_pcc_invoke_method_from_c_args(interp, _namespace, get_name, "->P", &names);
+ return names;
+}
+
+/*
+
+=item C<PMC * Parrot_ns_get_global(PARROT_INTERP, PMC *ns, STRING *globalname)>
+
+Look up the global named C<globalname> in the namespace C<ns>. Return the
+global, or return PMCNULL if C<ns> is null or if the global is not found.
+
+Parrot_ns_get_global allows a null namespace without throwing an exception; it
+simply returns PMCNULL in that case.
+
+NOTE: At present the use of the {get, set}_global functions is mandatory due
+ to the wacky namespace typing of the default Parrot namespace.
+ Eventually it will be safe to just use the standard hash interface
+ (if desired).
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_get_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
+{
+ ASSERT_ARGS(Parrot_ns_get_global)
+ if (PMC_IS_NULL(ns))
+ return PMCNULL;
+
+ return (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
+}
+
+/*
+
+=item C<void Parrot_ns_set_global(PARROT_INTERP, PMC *ns, STRING *globalname, PMC
+*val)>
+
+Set the global named C<globalname> in the namespace C<ns> to the value C<val>.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_ns_set_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
+{
+ ASSERT_ARGS(Parrot_ns_set_global)
+ VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
+}
+
+
+/*
+
+=item C<PMC * Parrot_ns_find_namespace_global(PARROT_INTERP, PMC *ns, STRING *globalname)>
+
+Search the namespace PMC C<ns> for an object with name C<globalname>.
+Return the object, or NULL if not found.
+
+TT #1222 - For now this function prefers non-namespaces, it will eventually
+entirely use the untyped interface.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_find_namespace_global(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
+{
+ ASSERT_ARGS(Parrot_ns_find_namespace_global)
+ PMC *res;
+
+ if (PMC_IS_NULL(ns))
+ res = PMCNULL;
+ else {
+ /*
+ * TT #1219 - we should be able to use 'get_pmc_keyed' here,
+ * but we can't because Parrot's default namespaces are not
+ * fully typed and there's a pseudo-typed interface that
+ * distinguishes 'get_pmc_keyed' from 'get_pointer_keyed';
+ * the former is for NS and the latter is for non-NS.
+ */
+ res = (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
+ }
+
+ return PMC_IS_NULL(res) ? NULL : res;
+}
+
+/*
+
+=item C<PMC * Parrot_ns_find_current_namespace_global(PARROT_INTERP, STRING *globalname)>
+
+Finds and returns the data time named C<globalname> in the current namespace.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_find_current_namespace_global(PARROT_INTERP, ARGIN_NULLOK(STRING *globalname))
+{
+ ASSERT_ARGS(Parrot_ns_find_current_namespace_global)
+ PMC * const ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
+ return Parrot_ns_find_namespace_global(interp, ns, globalname);
+}
+
+/*
+
+=item C<PMC * Parrot_find_global_s(PARROT_INTERP, STRING *str_key, STRING
+*globalname)>
+
+Search the namespace designated by C<str_key>, or the HLL root if
+C<str_key> is NULL, for an object with name C<globalname>. Return the
+object, or NULL if not found.
+
+TT #1222 - For now this function prefers non-namespaces, it will eventually
+entirely use the untyped interface.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_find_global_s(PARROT_INTERP, ARGIN_NULLOK(STRING *str_key),
+ ARGIN_NULLOK(STRING *globalname))
+{
+ ASSERT_ARGS(Parrot_find_global_s)
+ PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
+ PMC * const ns = Parrot_ns_get_namespace_keyed_str(interp, hll_ns, str_key);
+ return Parrot_ns_find_namespace_global(interp, ns, globalname);
+}
+
+/*
+
+=item C<void Parrot_ns_store_global(PARROT_INTERP, PMC *ns, STRING *globalname,
+PMC *val)>
+
+Store the PMC C<val> into the namespace PMC C<ns> with name C<globalname>. If
+the namespace is null, do nothing.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_ns_store_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
+{
+ ASSERT_ARGS(Parrot_ns_store_global)
+
+ if (PMC_IS_NULL(ns))
+ return;
+
+ VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
+}
+
+/*
+
+=item C<void Parrot_store_global_s(PARROT_INTERP, STRING *str_key, STRING
+*globalname, PMC *val)>
+
+Store the PMC C<val> into the namespace designated by C<str_key>, or
+the HLL root if C<str_key> is NULL, with the name C<globalname>.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_store_global_s(PARROT_INTERP, ARGIN_NULLOK(STRING *str_key),
+ ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
+{
+ ASSERT_ARGS(Parrot_store_global_s)
+ PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
+ PMC * const ns = Parrot_ns_make_namespace_keyed_str(interp, hll_ns, str_key);
+ Parrot_ns_store_global(interp, ns, globalname, val);
+
+ /* TT #1225 - method cache invalidation should be a namespace function */
+ Parrot_invalidate_method_cache(interp, str_key);
+}
+
+
+/*
+
+=item C<PMC * Parrot_ns_find_global_from_op(PARROT_INTERP, PMC *ns, STRING *globalname,
+void *next)>
+
+If the global exists in the given namespace PMC, return it. If not, return
+PMCNULL. Throw an exception if a NULL name is passed.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+PMC *
+Parrot_ns_find_global_from_op(PARROT_INTERP, ARGIN(PMC *ns),
+ ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(void *next))
+{
+ ASSERT_ARGS(Parrot_ns_find_global_from_op)
+ if (STRING_IS_NULL(globalname))
+ Parrot_ex_throw_from_c_args(interp, next, EXCEPTION_GLOBAL_NOT_FOUND,
+ "Tried to get null global");
+ else {
+ PMC * const res = Parrot_ns_find_namespace_global(interp, ns, globalname);
+ if (!res)
+ return PMCNULL;
+ return res;
+ }
+}
+
+
+/*
+
+=item C<PMC * Parrot_ns_find_named_item(PARROT_INTERP, STRING *name, void *next)>
+
+TT #1223 - THIS IS BROKEN - it doesn't walk up the scopes yet
+
+Find the given C<name> in lexicals, then the current namespace, then the HLL
+root namespace, and finally Parrot builtins. If the name isn't found
+anywhere, return PMCNULL.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+PMC *
+Parrot_ns_find_named_item(PARROT_INTERP, ARGIN(STRING *name), SHIM(void *next))
+{
+ ASSERT_ARGS(Parrot_ns_find_named_item)
+ PMC * const ctx = CURRENT_CONTEXT(interp);
+ PMC * const lex_pad = Parrot_find_pad(interp, name, ctx);
+ PMC * g = PMCNULL;
+
+ if (!PMC_IS_NULL(lex_pad)) {
+ g = VTABLE_get_pmc_keyed_str(interp, lex_pad, name);
+
+ /* TT #1223 - walk up the scopes! duh!! */
+ if (!PMC_IS_NULL(g))
+ return g;
+ }
+
+ g = Parrot_ns_find_current_namespace_global(interp, name);
+ if (!PMC_IS_NULL(g))
+ return g;
+
+ g = Parrot_ns_find_namespace_global(interp, Parrot_get_ctx_HLL_namespace(interp), name);
+ if (!PMC_IS_NULL(g))
+ return g;
+ return PMCNULL;
+}
+
+/*
+
+=item C<void Parrot_ns_store_sub(PARROT_INTERP, PMC *sub_pmc)>
+
+Adds the PMC C<sub> into the current namespace. Adds the sub to a multi of the
+same name if it's defined as a multi.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_ns_store_sub(PARROT_INTERP, ARGIN(PMC *sub_pmc))
+{
+ ASSERT_ARGS(Parrot_ns_store_sub)
+ const INTVAL cur_id = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp));
+
+ PMC *ns;
+ Parrot_Sub_attributes *sub;
+
+ /* PF structures aren't fully constructed yet */
+ Parrot_block_GC_mark(interp);
+
+ /* store relative to HLL namespace */
+ PMC_get_sub(interp, sub_pmc, sub);
+ Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), sub->HLL_id);
+
+ ns = get_namespace_pmc(interp, sub_pmc);
+
+ /* attach a namespace to the sub for lookups */
+ sub->namespace_stash = ns;
+
+ /* store a :multi sub */
+ if (!PMC_IS_NULL(sub->multi_signature))
+ store_sub_in_multi(interp, sub_pmc, ns);
+
+ /* store other subs (as long as they're not :anon) */
+ else if (!(PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_ANON)
+ || sub->vtable_index != -1) {
+ STRING * const ns_entry_name = sub->ns_entry_name;
+ PMC * const nsname = sub->namespace_name;
+
+ Parrot_ns_store_global(interp, ns, ns_entry_name, sub_pmc);
+
+ /* TT #1224:
+ TEMPORARY HACK - cache invalidation should be a namespace function
+ */
+ if (!PMC_IS_NULL(nsname)) {
+ STRING * const nsname_s = VTABLE_get_string(interp, nsname);
+ Parrot_invalidate_method_cache(interp, nsname_s);
+ }
+ }
+
+ /* restore HLL_id */
+ Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp), cur_id);
+ Parrot_unblock_GC_mark(interp);
+}
+
+/*
+
+=back
+
+=head1 SEE ALSO
+
+F<include/parrot/namespace.h>
+
+=cut
+
+*/
+
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/oo.c Fri Jun 18 00:29:10 2010 (r47678)
@@ -190,7 +190,7 @@
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
interp->HLL_namespace,
Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- PMC * const ns = Parrot_get_namespace_keyed(interp,
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp,
hll_ns, key);
if (!PMC_IS_NULL(ns))
@@ -334,9 +334,9 @@
return type_class;
}
else {
- PMC * const parrot_hll = Parrot_get_namespace_keyed_str(interp, interp->root_namespace, CONST_STRING(interp, "parrot"));
+ PMC * const parrot_hll = Parrot_ns_get_namespace_keyed_str(interp, interp->root_namespace, CONST_STRING(interp, "parrot"));
PMC * const pmc_ns =
- Parrot_make_namespace_keyed_str(interp, parrot_hll,
+ Parrot_ns_make_namespace_keyed_str(interp, parrot_hll,
interp->vtables[type]->whoami);
PMC * proxy = VTABLE_get_class(interp, pmc_ns);
@@ -375,7 +375,7 @@
/* First check in current HLL namespace */
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp, interp->HLL_namespace,
Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- PMC * const ns = Parrot_get_namespace_keyed_str(interp, hll_ns, name);
+ PMC * const ns = Parrot_ns_get_namespace_keyed_str(interp, hll_ns, name);
PMC * const _class = PMC_IS_NULL(ns)
? PMCNULL : VTABLE_get_class(interp, ns);
Modified: trunk/src/ops/core_ops.c
==============================================================================
--- trunk/src/ops/core_ops.c Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/ops/core_ops.c Fri Jun 18 00:29:10 2010 (r47678)
@@ -19803,7 +19803,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = PREG(2);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19823,7 +19823,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = CONST(2)->u.key;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19843,7 +19843,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = PREG(2);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19863,7 +19863,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = CONST(2)->u.key;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19883,7 +19883,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = PREG(2);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -19903,7 +19903,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const key = CONST(2)->u.key;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -22823,7 +22823,7 @@
Parrot_get_namespace_p_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PREG(2));
PREG(1) = PMC_IS_NULL(ns) ? PMCNULL : ns;
@@ -22833,7 +22833,7 @@
Parrot_get_namespace_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
PREG(1) = PMC_IS_NULL(ns) ? PMCNULL : ns;
@@ -22854,7 +22854,7 @@
if (PMC_IS_NULL(hll_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PREG(2));
PREG(1) = ns;
}
@@ -22867,7 +22867,7 @@
if (PMC_IS_NULL(hll_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
PREG(1) = ns;
}
@@ -22888,7 +22888,7 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PREG(2));
PREG(1) = ns;
}
@@ -22901,7 +22901,7 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
PREG(1) = ns;
}
@@ -22911,7 +22911,7 @@
Parrot_get_global_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PREG(1) = Parrot_find_global_op(interp, cur_ns, SREG(2),cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, cur_ns, SREG(2),cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -22919,7 +22919,7 @@
Parrot_get_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PREG(1) = Parrot_find_global_op(interp, cur_ns, CONST(2)->u.string,cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, cur_ns, CONST(2)->u.string,cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -22931,11 +22931,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -22948,11 +22948,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -22965,11 +22965,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -22982,11 +22982,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -22995,7 +22995,7 @@
Parrot_get_hll_global_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PREG(1) = Parrot_find_global_op(interp, hll_ns, SREG(2),cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, hll_ns, SREG(2),cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23003,7 +23003,7 @@
Parrot_get_hll_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PREG(1) = Parrot_find_global_op(interp, hll_ns, CONST(2)->u.string,cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, hll_ns, CONST(2)->u.string,cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23015,11 +23015,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23032,11 +23032,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23049,11 +23049,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23066,11 +23066,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23079,7 +23079,7 @@
Parrot_get_root_global_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PREG(1) = Parrot_find_global_op(interp, root_ns, SREG(2),cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, root_ns, SREG(2),cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23087,7 +23087,7 @@
Parrot_get_root_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PREG(1) = Parrot_find_global_op(interp, root_ns, CONST(2)->u.string,cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, root_ns, CONST(2)->u.string,cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23098,11 +23098,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23114,11 +23114,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, SREG(3),cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SREG(3),cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23130,11 +23130,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, PREG(2));
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PREG(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23146,11 +23146,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2)->u.key);
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_find_global_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3)->u.string,cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -23159,7 +23159,7 @@
Parrot_set_global_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- Parrot_set_global(interp, cur_ns, SREG(1), PREG(2));
+ Parrot_ns_set_global(interp, cur_ns, SREG(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23167,7 +23167,7 @@
Parrot_set_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- Parrot_set_global(interp, cur_ns, CONST(1)->u.string, PREG(2));
+ Parrot_ns_set_global(interp, cur_ns, CONST(1)->u.string, PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23175,9 +23175,9 @@
Parrot_set_global_p_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, PREG(1));
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23185,9 +23185,9 @@
Parrot_set_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23195,9 +23195,9 @@
Parrot_set_global_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, PREG(1));
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23205,9 +23205,9 @@
Parrot_set_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23215,7 +23215,7 @@
Parrot_set_hll_global_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- Parrot_set_global(interp, hll_ns, SREG(1), PREG(2));
+ Parrot_ns_set_global(interp, hll_ns, SREG(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23223,7 +23223,7 @@
Parrot_set_hll_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- Parrot_set_global(interp, hll_ns, CONST(1)->u.string, PREG(2));
+ Parrot_ns_set_global(interp, hll_ns, CONST(1)->u.string, PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23231,9 +23231,9 @@
Parrot_set_hll_global_p_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, PREG(1));
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23241,9 +23241,9 @@
Parrot_set_hll_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23251,9 +23251,9 @@
Parrot_set_hll_global_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, PREG(1));
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23261,9 +23261,9 @@
Parrot_set_hll_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23271,7 +23271,7 @@
Parrot_set_root_global_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- Parrot_set_global(interp, root_ns, SREG(1), PREG(2));
+ Parrot_ns_set_global(interp, root_ns, SREG(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23279,7 +23279,7 @@
Parrot_set_root_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- Parrot_set_global(interp, root_ns, CONST(1)->u.string, PREG(2));
+ Parrot_ns_set_global(interp, root_ns, CONST(1)->u.string, PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23287,9 +23287,9 @@
Parrot_set_root_global_p_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, PREG(1));
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23297,9 +23297,9 @@
Parrot_set_root_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, SREG(2), PREG(3));
+ Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23307,9 +23307,9 @@
Parrot_set_root_global_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, PREG(1));
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, PREG(1));
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23317,9 +23317,9 @@
Parrot_set_root_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, CONST(1)->u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, CONST(1)->u.key);
- Parrot_set_global(interp, ns, CONST(2)->u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, CONST(2)->u.string, PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23332,7 +23332,7 @@
"Tried to find null name");return (opcode_t *)handler;
}
- PREG(1) = Parrot_find_name_op(interp, SREG(2),cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_named_item(interp, SREG(2),cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23345,7 +23345,7 @@
"Tried to find null name");return (opcode_t *)handler;
}
- PREG(1) = Parrot_find_name_op(interp, CONST(2)->u.string,cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_named_item(interp, CONST(2)->u.string,cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -23353,7 +23353,7 @@
Parrot_find_sub_not_null_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t *dest =cur_opcode + 3;
- PMC *sub = Parrot_find_name_op(interp, SREG(2), dest);
+ PMC *sub = Parrot_ns_find_named_item(interp, SREG(2), dest);
if (PMC_IS_NULL(sub)) {
opcode_t *handler;
@@ -23371,7 +23371,7 @@
Parrot_find_sub_not_null_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t *dest =cur_opcode + 3;
- PMC *sub = Parrot_find_name_op(interp, CONST(2)->u.string, dest);
+ PMC *sub = Parrot_ns_find_named_item(interp, CONST(2)->u.string, dest);
if (PMC_IS_NULL(sub)) {
opcode_t *handler;
@@ -24779,7 +24779,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
@@ -24813,7 +24813,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
@@ -24847,7 +24847,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
@@ -24881,7 +24881,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
@@ -25032,7 +25032,7 @@
1083, /* op_count */
core_op_info_table, /* op_info_table */
core_op_func_table, /* op_func_table */
- get_op /* op_code() */
+ get_op /* op_code() */
};
/*
Modified: trunk/src/ops/experimental.ops
==============================================================================
--- trunk/src/ops/experimental.ops Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/ops/experimental.ops Fri Jun 18 00:29:10 2010 (r47678)
@@ -325,7 +325,7 @@
/* if it's clearly a PIR-level PMC */
if (type > enum_class_core_max) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, name_key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, name_key);
PMC * const _class = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
Modified: trunk/src/ops/pmc.ops
==============================================================================
--- trunk/src/ops/pmc.ops Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/ops/pmc.ops Fri Jun 18 00:29:10 2010 (r47678)
@@ -146,7 +146,7 @@
op root_new(out PMC, in PMC) {
PMC * const key = $2;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
@@ -164,7 +164,7 @@
op root_new(out PMC, in PMC, in PMC) {
PMC * const key = $2;
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
if (!PMC_IS_NULL(ns))
Modified: trunk/src/ops/var.ops
==============================================================================
--- trunk/src/ops/var.ops Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/ops/var.ops Fri Jun 18 00:29:10 2010 (r47678)
@@ -192,7 +192,7 @@
op get_namespace(out PMC, in PMC) {
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, $2);
$1 = PMC_IS_NULL(ns) ? PMCNULL : ns;
}
@@ -219,7 +219,7 @@
if (PMC_IS_NULL(hll_ns))
$1 = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, $2);
$1 = ns;
}
}
@@ -245,7 +245,7 @@
if (PMC_IS_NULL(root_ns))
$1 = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, $2);
$1 = ns;
}
}
@@ -275,7 +275,7 @@
op get_global(out PMC, in STR) {
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- $1 = Parrot_find_global_op(interp, cur_ns, $2, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, cur_ns, $2, expr NEXT());
}
op get_global(out PMC, in PMC, in STR) {
@@ -284,11 +284,11 @@
$1 = PMCNULL;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, cur_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, $2);
if (PMC_IS_NULL(ns))
$1 = PMCNULL;
else
- $1 = Parrot_find_global_op(interp, ns, $3, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, ns, $3, expr NEXT());
}
}
@@ -307,7 +307,7 @@
op get_hll_global(out PMC, in STR) {
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- $1 = Parrot_find_global_op(interp, hll_ns, $2, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, hll_ns, $2, expr NEXT());
}
op get_hll_global(out PMC, in PMC, in STR) {
@@ -316,11 +316,11 @@
$1 = hll_ns;
}
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, hll_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, $2);
if (PMC_IS_NULL(ns))
$1 = PMCNULL;
else
- $1 = Parrot_find_global_op(interp, ns, $3, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, ns, $3, expr NEXT());
}
}
@@ -339,7 +339,7 @@
op get_root_global(out PMC, in STR) {
PMC * const root_ns = interp->root_namespace;
- $1 = Parrot_find_global_op(interp, root_ns, $2, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, root_ns, $2, expr NEXT());
}
op get_root_global(out PMC, in PMC, in STR) {
@@ -347,11 +347,11 @@
if (PMC_IS_NULL(root_ns))
$1 = PMCNULL;
else {
- PMC * const ns = Parrot_get_namespace_keyed(interp, root_ns, $2);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, $2);
if (PMC_IS_NULL(ns))
$1 = PMCNULL;
else
- $1 = Parrot_find_global_op(interp, ns, $3, expr NEXT());
+ $1 = Parrot_ns_find_global_from_op(interp, ns, $3, expr NEXT());
}
}
@@ -379,14 +379,14 @@
op set_global(in STR, invar PMC) {
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- Parrot_set_global(interp, cur_ns, $1, $2);
+ Parrot_ns_set_global(interp, cur_ns, $1, $2);
}
op set_global(in PMC, in STR, invar PMC) {
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_make_namespace_keyed(interp, cur_ns, $1);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, $1);
- Parrot_set_global(interp, ns, $2, $3);
+ Parrot_ns_set_global(interp, ns, $2, $3);
}
=item B<set_hll_global>(in STR, invar PMC)
@@ -403,14 +403,14 @@
op set_hll_global(in STR, invar PMC) {
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- Parrot_set_global(interp, hll_ns, $1, $2);
+ Parrot_ns_set_global(interp, hll_ns, $1, $2);
}
op set_hll_global(in PMC, in STR, invar PMC) {
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_make_namespace_keyed(interp, hll_ns, $1);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, $1);
- Parrot_set_global(interp, ns, $2, $3);
+ Parrot_ns_set_global(interp, ns, $2, $3);
}
=item B<set_root_global>(in STR, invar PMC)
@@ -427,14 +427,14 @@
op set_root_global(in STR, invar PMC) {
PMC * const root_ns = interp->root_namespace;
- Parrot_set_global(interp, root_ns, $1, $2);
+ Parrot_ns_set_global(interp, root_ns, $1, $2);
}
op set_root_global(in PMC, in STR, invar PMC) {
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_make_namespace_keyed(interp, root_ns, $1);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, $1);
- Parrot_set_global(interp, ns, $2, $3);
+ Parrot_ns_set_global(interp, ns, $2, $3);
}
=back
@@ -470,7 +470,7 @@
goto ADDRESS(handler);
}
- $1 = Parrot_find_name_op(interp, $2, expr NEXT());
+ $1 = Parrot_ns_find_named_item(interp, $2, expr NEXT());
}
=item B<find_sub_not_null>(out PMC, in STR)
@@ -482,7 +482,7 @@
inline op find_sub_not_null(out PMC, in STR) :base_core {
opcode_t *dest = expr NEXT();
- PMC *sub = Parrot_find_name_op(interp, $2, dest);
+ PMC *sub = Parrot_ns_find_named_item(interp, $2, dest);
if (PMC_IS_NULL(sub)) {
opcode_t *handler;
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/packfile.c Fri Jun 18 00:29:10 2010 (r47678)
@@ -3129,7 +3129,7 @@
/* Vtable overrides and methods were already cloned, so don't reclone them. */
if (new_sub->vtable_index == -1
&& !(old_sub->comp_flags & SUB_COMP_FLAG_METHOD))
- Parrot_store_sub_in_namespace(interp, new_sub_pmc);
+ Parrot_ns_store_sub(interp, new_sub_pmc);
ret->u.key = new_sub_pmc;
@@ -3987,7 +3987,7 @@
/* finally place the sub into some namespace stash
* XXX place this code in Sub.thaw ? */
if (VTABLE_isa(interp, pmc, _sub))
- Parrot_store_sub_in_namespace(interp, pmc);
+ Parrot_ns_store_sub(interp, pmc);
/* restore code */
interp->code = cs_save;
Modified: trunk/src/pmc/capture.pmc
==============================================================================
--- trunk/src/pmc/capture.pmc Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/pmc/capture.pmc Fri Jun 18 00:29:10 2010 (r47678)
@@ -855,8 +855,8 @@
PMC *ns = INTERP->root_namespace;
STRING *attribute = CONST_STRING(INTERP, "proxy");
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot"));
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture"));
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot"));
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture"));
classobj = Parrot_oo_get_class(INTERP, ns);
capt = VTABLE_get_attr_keyed(INTERP, SELF, classobj, attribute);
}
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/pmc/class.pmc Fri Jun 18 00:29:10 2010 (r47678)
@@ -284,7 +284,7 @@
else {
PMC * const hll_ns = VTABLE_get_pmc_keyed_int(interp,
interp->HLL_namespace, Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp)));
- new_namespace = Parrot_make_namespace_keyed(interp, hll_ns, name_arg);
+ new_namespace = Parrot_ns_make_namespace_keyed(interp, hll_ns, name_arg);
}
if (PMC_IS_NULL(new_namespace))
@@ -1589,13 +1589,13 @@
STRING * const semicolon_str = CONST_STRING(INTERP, ";");
PMC * const namespace_array =
Parrot_str_split(INTERP, semicolon_str, serial_namespace);
- PMC *ns = Parrot_get_namespace_keyed(INTERP,
+ PMC *ns = Parrot_ns_get_namespace_keyed(INTERP,
INTERP->root_namespace, namespace_array);
/* If the namespace doesn't exist, we create it, and initialize
* ourselves in it */
if (PMC_IS_NULL(ns)) {
- ns = Parrot_make_namespace_keyed(INTERP,
+ ns = Parrot_ns_make_namespace_keyed(INTERP,
INTERP->root_namespace, namespace_array);
SELF.init_pmc(ns);
}
Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/pmc/namespace.pmc Fri Jun 18 00:29:10 2010 (r47678)
@@ -456,11 +456,11 @@
key = VTABLE_shift_pmc(INTERP, key);
if (!key) {
- Parrot_set_global(INTERP, ns, part, value);
+ Parrot_ns_set_global(INTERP, ns, part, value);
return;
}
- ns = Parrot_make_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_make_namespace_keyed_str(INTERP, ns, part);
}
}
@@ -471,11 +471,11 @@
STRING * const part = VTABLE_get_string_keyed_int(INTERP, key, i);
if ((i + 1) >= elements) { /* Last entry in the array */
- Parrot_set_global(INTERP, ns, part, value);
+ Parrot_ns_set_global(INTERP, ns, part, value);
return;
}
- ns = Parrot_make_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_make_namespace_keyed_str(INTERP, ns, part);
}
}
@@ -515,7 +515,7 @@
if (!key)
return VTABLE_get_pmc_keyed_str(INTERP, ns, part);
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, part);
if (PMC_IS_NULL(ns))
return PMCNULL;
@@ -531,14 +531,14 @@
/* What to do here? Throw an exception or something? */
break;
}
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, name);
+ ns = Parrot_ns_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);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, name);
return ns;
}
/* If we get the wrong type, should we throw an exception?
@@ -605,7 +605,7 @@
if (!key)
return VTABLE_get_pointer_keyed_str(INTERP, ns, part);
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, part);
if (PMC_IS_NULL(ns))
return PMCNULL;
@@ -621,7 +621,7 @@
if ((i + 1) >= elements)
return VTABLE_get_pointer_keyed_str(INTERP, ns, part);
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, part);
+ ns = Parrot_ns_get_namespace_keyed_str(INTERP, ns, part);
if (PMC_IS_NULL(ns))
return PMCNULL;
@@ -729,9 +729,9 @@
*/
METHOD make_namespace(PMC *key) {
- PMC *ns = Parrot_get_namespace_keyed(INTERP, SELF, key);
+ PMC *ns = Parrot_ns_get_namespace_keyed(INTERP, SELF, key);
if (PMC_IS_NULL(ns)) {
- ns = Parrot_make_namespace_keyed(INTERP, SELF, key);
+ ns = Parrot_ns_make_namespace_keyed(INTERP, SELF, key);
}
RETURN(PMC *ns);
}
Modified: trunk/src/pmc/role.pmc
==============================================================================
--- trunk/src/pmc/role.pmc Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/pmc/role.pmc Fri Jun 18 00:29:10 2010 (r47678)
@@ -101,7 +101,7 @@
* to look one up with and do so. */
PMC *_namespace = VTABLE_get_pmc_keyed_str(interp, info, namespace_str);
if (!VTABLE_isa(interp, _namespace, ns_string))
- _namespace = Parrot_make_namespace_autobase(interp, _namespace);
+ _namespace = Parrot_ns_make_namespace_autobase(interp, _namespace);
/* If we get something null back it's an error; otherwise, store it. */
if (!PMC_IS_NULL(_namespace))
@@ -121,7 +121,7 @@
/* Namespace is nested in the current namespace and with the name of
* the role. */
- role->_namespace = Parrot_make_namespace_keyed_str(interp,
+ role->_namespace = Parrot_ns_make_namespace_keyed_str(interp,
Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp)), role->name);
}
@@ -131,7 +131,7 @@
* to look one up with and do so. */
PMC *_namespace = VTABLE_get_pmc_keyed_str(interp, info, namespace_str);
if (!VTABLE_isa(interp, _namespace, ns_string))
- _namespace = Parrot_make_namespace_autobase(interp, _namespace);
+ _namespace = Parrot_ns_make_namespace_autobase(interp, _namespace);
/* If we get something null back it's an error; otherwise, store it. */
if (PMC_IS_NULL(_namespace))
Modified: trunk/src/thread.c
==============================================================================
--- trunk/src/thread.c Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/src/thread.c Fri Jun 18 00:29:10 2010 (r47678)
@@ -197,7 +197,7 @@
/* Skip vtable overrides and methods. */
if (ret_val_sub->vtable_index == -1
&& !(ret_val_sub->comp_flags & SUB_COMP_FLAG_METHOD)) {
- Parrot_store_sub_in_namespace(interp, ret_val);
+ Parrot_ns_store_sub(interp, ret_val);
}
}
else {
Modified: trunk/t/src/embed.t
==============================================================================
--- trunk/t/src/embed.t Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/t/src/embed.t Fri Jun 18 00:29:10 2010 (r47678)
@@ -451,7 +451,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
@@ -516,7 +516,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
@@ -607,7 +607,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
@@ -698,7 +698,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
@@ -788,7 +788,7 @@
/* locate function to run */
smain = Parrot_str_new_constant(interp, "main");
- entry = Parrot_find_global_cur(interp, smain);
+ entry = Parrot_ns_find_current_namespace_global(interp, smain);
/* location of the entry */
interp->current_cont = new_ret_continuation_pmc(interp, NULL);
Modified: trunk/t/src/extend.t
==============================================================================
--- trunk/t/src/extend.t Fri Jun 18 00:17:19 2010 (r47677)
+++ trunk/t/src/extend.t Fri Jun 18 00:29:10 2010 (r47678)
@@ -382,7 +382,7 @@
PMC *sub, *arg;
Parrot_pbc_load(interp, pf);
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
Parrot_ext_call(interp, sub, "->");
Parrot_eprintf(interp, "back\\n");
@@ -390,7 +390,7 @@
Parrot_io_flush(interp, Parrot_io_STDERR(interp));
name = Parrot_str_new_constant(interp, "_sub2");
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
arg = Parrot_pmc_new(interp, enum_class_String);
Parrot_PMC_set_string_native(interp, arg,
@@ -440,7 +440,7 @@
PMC *sub, *arg;
Parrot_pbc_load(interp, pf);
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
Parrot_ext_call(interp, sub, "->");
Parrot_eprintf(interp, "back\\n");
@@ -448,7 +448,7 @@
Parrot_io_flush(interp, Parrot_io_STDERR(interp));
name = Parrot_str_new_constant(interp, "_sub2");
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
arg = Parrot_pmc_new(interp, enum_class_String);
Parrot_PMC_set_string_native(interp, arg,
@@ -517,7 +517,7 @@
Parrot_Int result;
Parrot_pbc_load(interp, pf);
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
arg = Parrot_pmc_new(interp, enum_class_String);
Parrot_PMC_set_string_native(interp, arg,
@@ -584,7 +584,7 @@
Parrot_runloop jump_point;
Parrot_pbc_load(interp, pf);
- sub = Parrot_find_global_cur(interp, name);
+ sub = Parrot_ns_find_current_namespace_global(interp, name);
if (setjmp(jump_point.resume)) {
Parrot_eprintf(interp, "caught\\n");
@@ -714,7 +714,7 @@
}
foo_name = Parrot_str_new_constant( interp, "foo" );
- sub = Parrot_find_global_cur( interp, foo_name );
+ sub = Parrot_ns_find_current_namespace_global( interp, foo_name );
Parrot_ext_call(interp, sub, "->");
@@ -746,7 +746,7 @@
pf = Parrot_pbc_read( interp, "$temp_pbc", 0 );
Parrot_pbc_load( interp, pf );
- sub = Parrot_find_global_cur( interp, Parrot_str_new_constant( interp, "add" ) );
+ sub = Parrot_ns_find_current_namespace_global( interp, Parrot_str_new_constant( interp, "add" ) );
Parrot_ext_call(interp, sub, "II->I", 100, 200, &result);
printf( "Result is %d.\\n", result );
@@ -778,7 +778,7 @@
pf = Parrot_pbc_read( interp, "$temp_pbc", 0 );
Parrot_pbc_load( interp, pf );
- sub = Parrot_find_global_cur( interp, Parrot_str_new_constant( interp, "add" ) );
+ sub = Parrot_ns_find_current_namespace_global( interp, Parrot_str_new_constant( interp, "add" ) );
Parrot_ext_call( interp, sub, "II->I", 100, 200, &result );
printf( "Result is %d.\\n", result );
More information about the parrot-commits
mailing list