Front page | perl.cvs.mod_parrot |
Postings from August 2009
[svn:mod_parrot] r653 - mod_parrot/trunk/src
From:
jhorwitz
Date:
August 24, 2009 08:00
Subject:
[svn:mod_parrot] r653 - mod_parrot/trunk/src
Message ID:
20090824150017.C349D1844E2@xx12.develooper.com
Author: jhorwitz
Date: Mon Aug 24 08:00:12 2009
New Revision: 653
Modified:
mod_parrot/trunk/src/parrot_util.c
Log:
replace deprecated Parrot_find_global_k
Modified: mod_parrot/trunk/src/parrot_util.c
==============================================================================
--- mod_parrot/trunk/src/parrot_util.c (original)
+++ mod_parrot/trunk/src/parrot_util.c Mon Aug 24 08:00:12 2009
@@ -47,18 +47,24 @@
static Parrot_PMC get_sub_pmc_k(Parrot_Interp interp, char *hll, char *name)
{
Parrot_PMC sub;
+ Parrot_PMC nskey;
Parrot_PMC namespace;
int typenum;
typenum = Parrot_PMC_typenum(interp, "ResizablePMCArray");
- namespace = (Parrot_PMC)Parrot_PMC_new(interp, typenum);
+ nskey = (Parrot_PMC)Parrot_PMC_new(interp, typenum);
+ Parrot_register_pmc(interp, nskey);
+ Parrot_PMC_set_intval(interp, nskey, 3);
+ Parrot_PMC_set_cstring_intkey(interp, nskey, 0, "ModParrot");
+ Parrot_PMC_set_cstring_intkey(interp, nskey, 1, "HLL");
+ Parrot_PMC_set_cstring_intkey(interp, nskey, 2, hll);
+
+ /* this assumes no current HLL */
+ namespace = Parrot_get_namespace_keyed(interp,
+ Parrot_get_ctx_HLL_namespace(interp), nskey);
Parrot_register_pmc(interp, namespace);
- Parrot_PMC_set_intval(interp, namespace, 3);
- Parrot_PMC_set_cstring_intkey(interp, namespace, 0, "ModParrot");
- Parrot_PMC_set_cstring_intkey(interp, namespace, 1, "HLL");
- Parrot_PMC_set_cstring_intkey(interp, namespace, 2, hll);
- sub = Parrot_find_global_k(interp, namespace, MAKE_PARROT_STRING(name));
+ sub = Parrot_find_global_n(interp, namespace, MAKE_PARROT_STRING(name));
Parrot_unregister_pmc(interp, namespace);
@@ -137,30 +143,38 @@
Parrot_PMC namespace;
Parrot_PMC hllns;
Parrot_PMC ourns;
+ Parrot_PMC nskey;
int typenum, hllid;
typenum = Parrot_PMC_typenum(interp, "ResizablePMCArray");
- ourns = (Parrot_PMC)Parrot_PMC_new(interp, typenum);
+ nskey = (Parrot_PMC)Parrot_PMC_new(interp, typenum);
+ Parrot_register_pmc(interp, nskey);
+ Parrot_PMC_set_intval(interp, nskey, 3);
+ Parrot_PMC_set_cstring_intkey(interp, nskey, 0, "ModParrot");
+ Parrot_PMC_set_cstring_intkey(interp, nskey, 1, "HLL");
+ Parrot_PMC_set_cstring_intkey(interp, nskey, 2, hll);
+
+ /* this assumes no current HLL */
+ ourns = Parrot_get_namespace_keyed(interp,
+ Parrot_get_ctx_HLL_namespace(interp), nskey);
Parrot_register_pmc(interp, ourns);
- Parrot_PMC_set_intval(interp, ourns, 3);
- Parrot_PMC_set_cstring_intkey(interp, ourns, 0, "ModParrot");
- Parrot_PMC_set_cstring_intkey(interp, ourns, 1, "HLL");
- Parrot_PMC_set_cstring_intkey(interp, ourns, 2, hll);
/* if PIR, use default namespace, else look in HLL namespace */
if (!strcmp(hll, "PIR")) {
namespace = ourns;
- sub = Parrot_find_global_k(interp, namespace, MAKE_PARROT_STRING(name));
+ sub = Parrot_find_global_n(interp, namespace, MAKE_PARROT_STRING(name));
}
else {
/* XXX cache these during module creation */
hllid = Parrot_get_HLL_id(interp, MAKE_PARROT_STRING(hll));
hllns = Parrot_get_HLL_namespace(interp, hllid);
- namespace = Parrot_get_namespace_keyed(interp, hllns, ourns);
+ namespace = Parrot_get_namespace_keyed(interp, hllns, nskey);
sub = Parrot_find_global_n(interp, namespace, MAKE_PARROT_STRING(name));
}
+ Parrot_unregister_pmc(interp, nskey);
Parrot_unregister_pmc(interp, namespace);
+ Parrot_unregister_pmc(interp, ourns);
return(sub);
}
-
[svn:mod_parrot] r653 - mod_parrot/trunk/src
by jhorwitz