Browse files

use need_ext flag

git-svn-id: https://svn.parrot.org/parrot/trunk@4020 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 548d86c commit 0c0850c5d8a9726074dc6a790fc70a76d088c9d9 Leopold Toetsch committed Aug 28, 2003
View
2 classes/array.pmc
@@ -76,7 +76,7 @@ Parrot_Array_set_pmc_ptr(Interp *interp, List *list, INTVAL key)
}
-pmclass Array {
+pmclass Array need_ext {
void class_init() {
/* class_init_code */
View
2 classes/compiler.pmc
@@ -16,7 +16,7 @@
#include "parrot/method_util.h"
#include "parrot/interp_guts.h"
-pmclass Compiler extends NCI {
+pmclass Compiler extends NCI need_ext {
void* invoke (void * code_ptr) {
/*
View
2 classes/exception.pmc
@@ -39,7 +39,7 @@
#include "parrot/parrot.h"
#include "parrot/method_util.h"
-pmclass Exception extends SArray {
+pmclass Exception extends SArray need_ext {
void init() {
View
2 classes/intlist.pmc
@@ -14,7 +14,7 @@
#define THROW_UNSUPPORTED internal_exception(INTERP_ERROR, "Operation not supported\n")
-pmclass IntList {
+pmclass IntList need_ext {
void clone (PMC *dest) {
PObj_custom_mark_SET(dest);
View
3 classes/iterator.pmc
@@ -12,7 +12,8 @@
#include "parrot/parrot.h"
-pmclass Iterator {
+pmclass Iterator need_ext {
+/* TODO switch to the pmc ptr */
void init () {
internal_exception(1, "Iterator init without aggregate\n");
View
2 classes/key.pmc
@@ -11,7 +11,7 @@
#include "parrot/parrot.h"
-pmclass Key {
+pmclass Key need_ext {
void init () {
PObj_custom_mark_SET(SELF);
View
2 classes/managedstruct.pmc
@@ -14,7 +14,7 @@
#include "parrot/parrot.h"
#include "parrot/method_util.h"
-pmclass ManagedStruct extends UnManagedStruct {
+pmclass ManagedStruct extends UnManagedStruct need_ext {
void init () {
PObj_active_destroy_SET(SELF);
View
2 classes/multiarray.pmc
@@ -44,7 +44,7 @@ static INTVAL calc_offset(Interp* interp, List*list, PMC *key)
return l;
}
-pmclass MultiArray extends Array {
+pmclass MultiArray extends Array need_ext {
void init () {
/* override default in Array - no init */
View
2 classes/nci.pmc
@@ -17,7 +17,7 @@
#include "parrot/parrot.h"
#include "parrot/method_util.h"
-pmclass NCI {
+pmclass NCI need_ext {
void init() {
SELF->cache.struct_val = NULL;
View
2 classes/orderedhash.pmc
@@ -19,7 +19,7 @@
#include "parrot/parrot.h"
#include "perlhash.h"
-pmclass OrderedHash extends PerlArray {
+pmclass OrderedHash extends PerlArray need_ext {
void init () {
SUPER();
PerlHash.SUPER();
View
2 classes/parrotclass.pmc
@@ -27,7 +27,7 @@
#include "parrot/parrot.h"
-pmclass ParrotClass {
+pmclass ParrotClass need_ext {
void init () {
/* Hang an array off the data pointer, empty of course */
View
2 classes/parrotinterpreter.pmc
@@ -17,7 +17,7 @@
#include "parrot/parrot.h"
-pmclass ParrotInterpreter {
+pmclass ParrotInterpreter need_ext {
void init () {
struct Parrot_Interp *new_interp;
View
2 classes/parrotio.pmc
@@ -38,7 +38,7 @@ void Parrot_NCI_class_init(Parrot_Interp, int);
void Parrot_PerlHash_class_init(Parrot_Interp, int);
void Parrot_PerlUndef_class_init(Parrot_Interp, int);
-pmclass ParrotIO {
+pmclass ParrotIO need_ext {
void class_init () {
PMC *method_table;
View
2 classes/perlarray.pmc
@@ -36,7 +36,7 @@ Parrot_PerlArray_set_pmc_ptr(Interp *interp, List *list, INTVAL key)
return value;
}
-pmclass PerlArray extends Array {
+pmclass PerlArray extends Array need_ext {
void set_integer_keyed_int (INTVAL key, INTVAL value) {
PMC *src = pmc_new_noinit(INTERP, enum_class_PerlInt);
View
6 classes/pmc2c.pl
@@ -259,11 +259,11 @@ sub parse_superpmc {
my ($classname) = s/(?:.*?)^\s*pmclass ([\w]*)//ms;
my $superpmc = 'default';
- my $saw_extends;
+ my $saw_extends = 0;
while (s/^(\s*)(\w+)//s) {
- if ($saw_extends) {
+ if ($saw_extends == 1) {
$superpmc = $2;
- last;
+ $saw_extends = 2;
} elsif ($2 eq 'extends') {
$saw_extends = 1;
}
View
2 classes/pointer.pmc
@@ -13,7 +13,7 @@
#include "parrot/parrot.h"
#define POINTER_ERROR internal_exception(PARROT_POINTER_ERROR, "An illegal operation was performed on a Pointer (vtable function at %s line %d).\n", __FILE__, __LINE__);
-pmclass Pointer {
+pmclass Pointer need_ext {
void init () {
PObj_custom_mark_SET(SELF);
View
2 classes/scratchpad.pmc
@@ -13,7 +13,7 @@
#include "parrot/parrot.h"
-pmclass Scratchpad {
+pmclass Scratchpad need_ext {
void init () {
PObj_custom_mark_destroy_SETALL(SELF);
View
2 classes/unmanagedstruct.pmc
@@ -24,7 +24,7 @@ enum {
PObj_UnManagedStruct_my_memory_FLAG = PObj_private0_FLAG
};
-pmclass UnManagedStruct {
+pmclass UnManagedStruct need_ext {
INTVAL is_equal (PMC* value) {
return (SELF->vtable == value->vtable
View
22 pmc.c
@@ -78,26 +78,8 @@ get_new_pmc_header(struct Parrot_Interp *interpreter, INTVAL base_type,
static void
pmc_new_ext(Parrot_Interp interpreter, PMC *pmc, INTVAL base_type)
{
- /* TODO have a bit in the vtable defining if a pmc_ext is needed */
- switch (base_type) {
- case enum_class_PerlInt:
- case enum_class_PerlNum:
- case enum_class_PerlString:
- case enum_class_PerlUndef:
- case enum_class_Boolean:
- case enum_class_PerlHash:
-
- case enum_class_Sub:
- case enum_class_Closure:
- case enum_class_Continuation:
- case enum_class_RetContinuation:
- case enum_class_Coroutine:
- case enum_class_Eval:
- break;
- default:
- add_pmc_ext(interpreter, pmc);
- break;
- }
+ if (pmc->vtable->flags & VTABLE_PMC_NEEDS_EXT)
+ add_pmc_ext(interpreter, pmc);
}
/*=for api pmc pmc_new_noinit
View
22 src/pmc.c
@@ -78,26 +78,8 @@ get_new_pmc_header(struct Parrot_Interp *interpreter, INTVAL base_type,
static void
pmc_new_ext(Parrot_Interp interpreter, PMC *pmc, INTVAL base_type)
{
- /* TODO have a bit in the vtable defining if a pmc_ext is needed */
- switch (base_type) {
- case enum_class_PerlInt:
- case enum_class_PerlNum:
- case enum_class_PerlString:
- case enum_class_PerlUndef:
- case enum_class_Boolean:
- case enum_class_PerlHash:
-
- case enum_class_Sub:
- case enum_class_Closure:
- case enum_class_Continuation:
- case enum_class_RetContinuation:
- case enum_class_Coroutine:
- case enum_class_Eval:
- break;
- default:
- add_pmc_ext(interpreter, pmc);
- break;
- }
+ if (pmc->vtable->flags & VTABLE_PMC_NEEDS_EXT)
+ add_pmc_ext(interpreter, pmc);
}
/*=for api pmc pmc_new_noinit

0 comments on commit 0c0850c

Please sign in to comment.