+ if(f) {
+ if(f->kind == INFOTYPE_METHOD) {
+ return slotinfo_asclass(f);
+ } else if(f->kind == INFOTYPE_VAR) {
+ varinfo_t*v = (varinfo_t*)f;
+ return v->type;
+ } else
+ return 0;
+ } else {
+ return TYPE_ANY;
+ }
+}
+
+// ----------------------- package handling ---------------------------
+char registry_ispackage(char*package)
+{
+ /* crude approximation of "the real thing", but sufficient for now */
+ return !strncmp(package, "flash", 5);
+}
+// ----------------------- builtin types ------------------------------
+
+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 = (classinfo_t*)registry_safefind("", "Object");
+ return c;
+}
+classinfo_t* registry_getstringclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "String");
+ return c;
+}
+classinfo_t* registry_getarrayclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "Array");
+ return c;
+}
+classinfo_t* registry_getintclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "int");
+ return c;
+}
+classinfo_t* registry_getuintclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "uint");
+ return c;
+}
+classinfo_t* registry_getbooleanclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "Boolean");
+ return c;
+}
+classinfo_t* registry_getnumberclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "Number");
+ return c;
+}
+classinfo_t* registry_getregexpclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "RegExp");
+ return c;
+}
+classinfo_t* registry_getdateclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "Date");
+ return c;
+}
+classinfo_t* registry_getxmlclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "XML");
+ return c;
+}
+classinfo_t* registry_getxmllistclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "XMLList");
+ return c;
+}
+classinfo_t* registry_getnamespaceclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("", "Namespace");
+ return c;
+}
+classinfo_t* registry_getMovieClip() {
+ static classinfo_t*c = 0;
+ if(!c) c = (classinfo_t*)registry_safefind("flash.display", "MovieClip");
+ return c;
+}
+
+// ----------------------- builtin dummy types -------------------------
+classinfo_t nullclass = {
+ INFOTYPE_CLASS,0,0,ACCESS_PACKAGE, "", "null", 0, 0, 0
+};
+classinfo_t* registry_getnullclass() {
+ return &nullclass;
+}
+classinfo_t voidclass = {
+ INFOTYPE_CLASS,0,0,ACCESS_PACKAGE, "", "void", 0, 0, 0
+};
+classinfo_t* registry_getvoidclass() {
+ return &voidclass;
+}
+
+namespace_t access2namespace(U8 access, char*package)
+{
+ namespace_t ns;
+ ns.access = access;
+ ns.name = package;
+ return ns;
+}
+
+char* infotypename(slotinfo_t*s)
+{
+ if(s->kind == INFOTYPE_CLASS) return "class";
+ else if(s->kind == INFOTYPE_VAR) return "var";
+ else if(s->kind == INFOTYPE_METHOD) return "function";
+ else return "object";
+}
+
+void slotinfo_dump(slotinfo_t*s)
+{
+ if(s->package[0]) {
+ printf("%s %s.%s", infotypename(s), s->package, s->name);
+ } else {
+ printf("%s %s", infotypename(s), s->name);
+ }
+ if(s->kind == INFOTYPE_CLASS) {
+ classinfo_t*c = (classinfo_t*)s;
+ }
+ else if(s->kind == INFOTYPE_VAR) {
+ varinfo_t*v = (varinfo_t*)s;
+ printf(":%s", v->type?v->type->name:"*");
+ if(v->value)
+ printf("=%s", constant_tostring(v->value));
+ if(v->slot)
+ printf(" (slot:%d)", v->slot);
+ }
+ else if(s->kind == INFOTYPE_METHOD) {
+ methodinfo_t*m = (methodinfo_t*)s;
+ }
+ else {
+ }
+ printf("\n");