+ classes = builtin_getclasses();
+}
+classinfo_t* registry_safefindclass(const char*package, const char*name)
+{
+ classinfo_t*c = registry_findclass(package, name);
+ assert(c);
+ return c;
+}
+classinfo_t* registry_findclass(const char*package, const char*name)
+{
+ assert(classes);
+ classinfo_t tmp;
+ tmp.package = package;
+ tmp.name = name;
+ classinfo_t* c = (classinfo_t*)dict_lookup(classes, &tmp);
+ /*if(c)
+ printf("%s.%s->%08x (%s.%s)\n", package, name, c, c->package, c->name);*/
+ return c;
+}
+memberinfo_t* registry_findmember(classinfo_t*cls, const char*name, char recursive)
+{
+ if(!recursive) {
+ return (memberinfo_t*)dict_lookup(&cls->members, name);
+ }
+ /* look at classes directly extended by this class */
+ memberinfo_t*m = 0;
+ classinfo_t*s = cls;
+ while(s) {
+ m = (memberinfo_t*)dict_lookup(&s->members, name);
+ if(m) return m;
+ s = s->superclass;
+ }
+ /* look at interfaces, and parent interfaces */
+ int t=0;
+ while(cls->interfaces[t]) {
+ classinfo_t*s = cls->interfaces[t];
+ while(s) {
+ m = (memberinfo_t*)dict_lookup(&s->members, name);
+ if(m) return m;
+ s = s->superclass;
+ }
+ }
+ return 0;
+
+}
+void registry_fill_multiname(multiname_t*m, namespace_t*n, classinfo_t*c)
+{
+ m->type = QNAME;
+ m->ns = n;
+ m->ns->access = c->access;
+ m->ns->name = (char*)c->package;
+ m->name = c->name;
+ m->namespace_set = 0;
+}
+multiname_t* classinfo_to_multiname(classinfo_t*cls)
+{
+ if(!cls)
+ return 0;
+ multiname_t*m=0;
+ namespace_t*ns = namespace_new(cls->access, cls->package);
+ return multiname_new(ns,cls->name);
+}
+
+// ----------------------- 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_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;