X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fregistry.c;h=c65bcf58e9be15f5c6e4d75ad974be23841b7e72;hb=2b4a44df0c63679e7717d0c699b2785b9e5c0b6a;hp=61fd55b0c61279a833b91985967be26b2d2d4d1b;hpb=64b820f5aa8bb7f2df9f297e325434f043e2d25b;p=swftools.git diff --git a/lib/as3/registry.c b/lib/as3/registry.c index 61fd55b..c65bcf5 100644 --- a/lib/as3/registry.c +++ b/lib/as3/registry.c @@ -150,6 +150,7 @@ classinfo_t* registry_safefindclass(const char*package, const char*name) assert(c); return c; } + classinfo_t* registry_findclass(const char*package, const char*name) { assert(classes); @@ -161,6 +162,20 @@ classinfo_t* registry_findclass(const char*package, const char*name) printf("%s.%s->%08x (%s.%s)\n", package, name, c, c->package, c->name);*/ return c; } +void registry_dumpclasses() +{ + int t; + for(t=0;thashsize;t++) { + dictentry_t*e = classes->slots[t]; + while(e) { + dictentry_t*next = e->next; + classinfo_t*i = (classinfo_t*)e->key; + printf("%s.%s\n", i->package, i->name); + e = e->next; + } + } +} + memberinfo_t* registry_findmember(classinfo_t*cls, const char*name, char recursive) { if(!recursive) { @@ -290,6 +305,11 @@ classinfo_t* registry_getnumberclass() { if(!c) c = registry_safefindclass("", "Number"); return c; } +classinfo_t* registry_getregexpclass() { + static classinfo_t*c = 0; + if(!c) c = registry_safefindclass("", "RegExp"); + return c; +} classinfo_t* registry_getMovieClip() { static classinfo_t*c = 0; if(!c) c = registry_safefindclass("flash.display", "MovieClip"); @@ -304,3 +324,23 @@ classinfo_t* registry_getnullclass() { return &nullclass; } +// --------------------------------------------------------------------- +namespace_t flags2namespace(int flags, char*package) +{ + namespace_t ns; + ns.name = package; + if(flags&FLAG_PUBLIC) { + ns.access = ACCESS_PACKAGE; + } else if(flags&FLAG_PRIVATE) { + ns.access = ACCESS_PRIVATE; + } else if(flags&FLAG_PROTECTED) { + ns.access = ACCESS_PROTECTED; + } else if(flags&FLAG_NAMESPACE_ADOBE) { + ns.access = ACCESS_NAMESPACE; + assert(!package || !package[0]); + ns.name = "http://adobe.com/AS3/2006/builtin"; + } else { + ns.access = ACCESS_PACKAGEINTERNAL; + } + return ns; +}