cvs commit: ponie/perl perl.c
[email protected] (Nicholas Clark) 5 May 2005 09:53:44 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 05/05/05 02:53:44
Modified: perl perl.c
Log:
Make a proper reverse mapping table, which allows the 2 new derived PMC types
to appear to be one of the regular 16 perl types.
Revision Changes Path
1.27 +12 -14 ponie/perl/perl.c
Index: perl.c
===================================================================
RCS file: /cvs/public/ponie/perl/perl.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- perl.c 3 May 2005 22:16:29 -0000 1.26
+++ perl.c 5 May 2005 09:53:43 -0000 1.27
@@ -207,13 +207,14 @@
void (*)(Parrot_INTERP, Parrot_PMC));
typedef struct {
- int array_index;
- const char *name;
+ int array_index;
+ int reverse_mapping;
+ const char *name;
} Ponie_pmc_init;
-#define PONIE_PMC_INIT(a) {CAT2(SVt_,a), "Perl5" STRINGIFY(a)}
+#define PONIE_PMC_INIT(a) {CAT2(SVt_,a), CAT2(SVt_,a), "Perl5" STRINGIFY(a)}
/* So PONIE_PMC_INIT(PVMG) goes to
- {SVt_PVMG, "Perl5PVMG"},\
+ {SVt_PVMG, SVt_PVMG, "Perl5PVMG"},\
*/
STATIC Parrot_Int
@@ -252,7 +253,7 @@
if (PL_pmcname[0] == 0) {
const static Ponie_pmc_init s[] =
{
- {SVt_NULL, "Perl5NULL"},
+ {SVt_NULL, SVt_NULL, "Perl5NULL"},
PONIE_PMC_INIT (IV),
PONIE_PMC_INIT (NV),
PONIE_PMC_INIT (RV),
@@ -268,17 +269,13 @@
PONIE_PMC_INIT (PVCV),
PONIE_PMC_INIT (PVFM),
PONIE_PMC_INIT (PVIO),
- /* FIXME. Or at least THINKABOUTME. This code will put the pining
- PMC in the reverse mapping table as a distinct type. Should it
- reverse map as SVt_NULL? */
- {Ponie_PMC_Perl5Pining, "Perl5Pining"},
- {Ponie_PMC_Perl5PVMG_mess, "Perl5PVMG_mess"},
+ {Ponie_PMC_Perl5Pining, SVt_NULL, "Perl5Pining"},
+ {Ponie_PMC_Perl5PVMG_mess, SVt_PVMG, "Perl5PVMG_mess"},
{Ponie_PMC_Perl5_MAX, NULL}
};
const Ponie_pmc_init *i = s;
Parrot_Int max_type = 0;
signed char *temp;
- int j;
while (i->name) {
Parrot_Int type = type_or_bail(i->name);
@@ -292,9 +289,10 @@
memset (temp, -1, max_type);
/* Build the reverse lookup table. */
- j = Ponie_PMC_Perl5_MAX;
- while (j--) {
- temp[PL_pmcname[j]] = j;
+ i = s;
+ while (i->name) {
+ temp[PL_pmcname[i->array_index]] = i->reverse_mapping;
+ ++i;
}
PL_pmc_to_type = temp;