X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fas3%2Fregistry.c;h=2789fdf7e021129421d16967b5cbf71aa93ab941;hp=316c71ffc0f31060d1afb3d28241f3903fddfd18;hb=36a1fac8ea3a7457f25b1b4209b5fc918cc6af44;hpb=71c8242a8242eeb6e8b6dcf57239550a6f35c88a diff --git a/lib/as3/registry.c b/lib/as3/registry.c index 316c71f..2789fdf 100644 --- a/lib/as3/registry.c +++ b/lib/as3/registry.c @@ -48,6 +48,12 @@ static unsigned int slotinfo_hash(slotinfo_t*c) 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) {} @@ -58,6 +64,12 @@ type_t slotinfo_type = { 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) @@ -139,7 +151,7 @@ classinfo_t* classinfo_register(int access, const char*package, const char*name, 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; @@ -332,7 +344,7 @@ classinfo_t* slotinfo_asclass(slotinfo_t*f) { 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; @@ -352,6 +364,13 @@ classinfo_t* slotinfo_gettype(slotinfo_t*f) 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;}