X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fregistry.c;h=06ae5c55d8b2e5b409b42ac6fff27f2a2b853cc9;hb=fb56342d9ce82d70ea6d5d544ff8df485fee3afc;hp=22630382cf13b80ac692a54cbc4cc4520c899127;hpb=cad2e08956148922b5a8b8bff8c8dbee884c854b;p=swftools.git diff --git a/lib/as3/registry.c b/lib/as3/registry.c index 2263038..06ae5c5 100644 --- a/lib/as3/registry.c +++ b/lib/as3/registry.c @@ -93,7 +93,7 @@ classinfo_t* classinfo_register(int access, char*package, char*name, int num_int return c; } -/* function pointers get their own type class */ +/* function and class pointers get their own type class */ static dict_t* functionobjects = 0; classinfo_t* registry_getfunctionclass(memberinfo_t*f) { if(!functionobjects) { @@ -114,6 +114,32 @@ classinfo_t* registry_getfunctionclass(memberinfo_t*f) { dict_put(functionobjects, f, c); return c; } +static dict_t* classobjects = 0; +classinfo_t* registry_getclassclass(classinfo_t*a) { + if(!classobjects) { + classobjects = dict_new2(&ptr_type); + } else { + classinfo_t*c = dict_lookup(classobjects, a); + if(c) + return c; + } + + NEW(classinfo_t,c); + c->access = ACCESS_PUBLIC; + c->package = ""; + c->name = "Class"; + + NEW(memberinfo_t,m); + m->kind = MEMBER_SLOT; + m->name = "prototype"; + m->type = a; + + dict_init(&c->members,1); + dict_put(&c->members, "prototype", m); + + dict_put(classobjects, a, c); + return c; +} memberinfo_t* memberinfo_register(classinfo_t*cls, const char*name, U8 kind) { @@ -176,6 +202,10 @@ char registry_isfunctionclass(classinfo_t*c) { return (c && c->package && c->name && !strcmp(c->package, "") && !strcmp(c->name, "Function")); } +char registry_isclassclass(classinfo_t*c) { + return (c && c->package && c->name && + !strcmp(c->package, "") && !strcmp(c->name, "Class")); +} classinfo_t* registry_getobjectclass() { static classinfo_t*c = 0;