X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fas3%2Fregistry.c;h=5c947e5ad6a2673e3e353890b55dc2da5531cc31;hp=5fd76cc6d182f898f75a22db39f930660ddb694e;hb=b6ebc39257e2814f08a17d8c179c3991c16053ba;hpb=5250e6b4e61611d48b7635650884f8828575a212 diff --git a/lib/as3/registry.c b/lib/as3/registry.c index 5fd76cc..5c947e5 100644 --- a/lib/as3/registry.c +++ b/lib/as3/registry.c @@ -27,6 +27,7 @@ #include "builtin.h" dict_t*registry_classes=0; +asset_bundle_list_t*assets=0; // ----------------------- class signature ------------------------------ @@ -71,6 +72,58 @@ type_t memberinfo_type = { free: (free_func)dummy_destroy, }; +// ----------------------- assets ------------------------------------- +static void use_asset(asset_bundle_t*a) +{ + a->used = 1; + asset_bundle_list_t*l = a->dependencies; + while(l) { + if(!l->asset_bundle->used) { + use_asset(l->asset_bundle); + } + l = l->next; + } +} +void registry_use(slotinfo_t*s) +{ + if(!s) return; + if(!(s->flags&FLAG_USED)) { + s->flags |= FLAG_USED; + if(s->kind == INFOTYPE_CLASS) { + classinfo_t*c=(classinfo_t*)s; + if(c->assets) { + use_asset(c->assets); + } + int t=0; + while(c->interfaces[t]) { + registry_use((slotinfo_t*)c->interfaces[t]); + t++; + } + while(c->superclass) { + c = c->superclass; + registry_use((slotinfo_t*)c); + } + } else if(s->kind == INFOTYPE_METHOD) { + methodinfo_t*m=(methodinfo_t*)s; + if(m->parent) { + registry_use((slotinfo_t*)m->parent); + } + } else if(s->kind == INFOTYPE_VAR) { + varinfo_t*v=(varinfo_t*)s; + if(v->parent) { + registry_use((slotinfo_t*)v->parent); + } + } + } +} +void registry_add_asset(asset_bundle_t*bundle) +{ + list_append(assets, bundle); +} +asset_bundle_list_t*registry_getassets() +{ + return assets; +} // ----------------------- resolving ---------------------------------- slotinfo_t* registry_resolve(slotinfo_t*_s) {