+// ----------------------- memberinfo methods ------------------------------
+
+/* function and class pointers get their own type class */
+static dict_t* functionobjects = 0;
+classinfo_t* memberinfo_asclass(memberinfo_t*f) {
+ if(!functionobjects) {
+ functionobjects = dict_new2(&ptr_type);
+ } else {
+ classinfo_t*c = dict_lookup(functionobjects, f);
+ if(c)
+ return c;
+ }
+
+ NEW(classinfo_t,c);
+ c->access = ACCESS_PUBLIC;
+ c->package = "";
+ c->name = "Function";
+
+ dict_init(&c->members,1);
+ c->function = f;
+
+ dict_put(functionobjects, f, c);
+ return c;
+}
+
+classinfo_t* memberinfo_gettype(memberinfo_t*f)
+{
+ if(f) {
+ if(f->kind == MEMBER_METHOD) {
+ return memberinfo_asclass(f);
+ } else {
+ return f->type;
+ }
+ } else {
+ return registry_getanytype();
+ }
+}
+// ----------------------- builtin types ------------------------------
+classinfo_t* registry_getanytype() {return 0;}
+
+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;
+ if(!c) c = registry_safefindclass("", "Object");
+ return c;
+}
+classinfo_t* registry_getstringclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = registry_safefindclass("", "String");
+ return c;
+}
+classinfo_t* registry_getarrayclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = registry_safefindclass("", "Array");
+ return c;
+}
+classinfo_t* registry_getintclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = registry_safefindclass("", "int");
+ return c;
+}
+classinfo_t* registry_getuintclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = registry_safefindclass("", "uint");
+ return c;
+}
+classinfo_t* registry_getbooleanclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = registry_safefindclass("", "Boolean");
+ return c;
+}
+classinfo_t* registry_getnumberclass() {
+ static classinfo_t*c = 0;
+ 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");
+ return c;
+}
+
+// ----------------------- builtin dummy types -------------------------
+classinfo_t nullclass = {
+ ACCESS_PACKAGE, 0, "", "null", 0, 0, 0,
+};
+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;
+}