hash = crc32_add_string(hash, c->name);
return hash;
}
+static unsigned int memberinfo_hash(slotinfo_t*c)
+{
+ unsigned int hash = 0;
+ hash = crc32_add_string(hash, c->name);
+ return hash;
+}
static void* dummy_clone(void*other) {return other;}
static void dummy_destroy(slotinfo_t*c) {}
dup: (dup_func)dummy_clone, // all signatures are static
free: (free_func)dummy_destroy,
};
+type_t memberinfo_type = {
+ hash: (hash_func)memberinfo_hash,
+ equals: (equals_func)slotinfo_equals,
+ dup: (dup_func)dummy_clone, // all signatures are static
+ free: (free_func)dummy_destroy,
+};
// ----------------------- resolving ----------------------------------
slotinfo_t* registry_resolve(slotinfo_t*_s)
c->package = package;
c->name = name;
dict_put(registry_classes, c, c);
- dict_init2(&c->members, &slotinfo_type, AVERAGE_NUMBER_OF_MEMBERS);
+ dict_init2(&c->members, &memberinfo_type, AVERAGE_NUMBER_OF_MEMBERS);
schedule_for_resolve((slotinfo_t*)c);
return c;
memberinfo_t* registry_findmember_nsset(classinfo_t*cls, namespace_list_t*ns, const char*name, char superclasses)
{
+ memberinfo_t*m = 0;
while(ns) {
- memberinfo_t*m = registry_findmember(cls, ns->namespace->name, name, superclasses);
+ m = registry_findmember(cls, ns->namespace->name, name, superclasses);
if(m) return m;
ns = ns->next;
}
- return registry_findmember(cls, "", name, superclasses);
+ m = registry_findmember(cls, "", name, superclasses);
+ if(m) return m;
+ /* TODO: it maybe would be faster to just store the builtin namespace as "" in
+ builtins.c */
+ m = registry_findmember(cls, "http://adobe.com/AS3/2006/builtin", name, superclasses);
+ if(m) return m;
+ return 0;
}
classinfo_t*c = rfx_calloc(sizeof(classinfo_t)+sizeof(classinfo_t*));
c->access = ACCESS_PUBLIC;
c->package = "";
- if(f->kind == INFOTYPE_METHOD)
+ if(f->kind == INFOTYPE_METHOD) {
c->name = "Function";
- else if(f->kind == INFOTYPE_CLASS)
+ c->superclass = registry_getobjectclass();
+ } else if(f->kind == INFOTYPE_CLASS) {
c->name = "Class";
- else if(f->kind == INFOTYPE_SLOT)
+ c->superclass = registry_getobjectclass();
+ } else if(f->kind == INFOTYPE_SLOT) {
c->name = "Object";
- else {
+ } else {
c->name = "undefined";
}
- dict_init2(&c->members, &slotinfo_type, 1);
+ dict_init2(&c->members, &memberinfo_type, 1);
c->data = f;
dict_put(functionobjects, f, c);
return c;
return registry_getanytype();
}
}
+
+// ----------------------- package handling ---------------------------
+char registry_ispackage(char*package)
+{
+ /* crude approximation of "the real thing", but sufficient for now */
+ return !strncmp(package, "flash", 5);
+}
// ----------------------- builtin types ------------------------------
classinfo_t* registry_getanytype() {return 0;}