// ------------------------- constructors --------------------------------
#define AVERAGE_NUMBER_OF_MEMBERS 8
-classinfo_t* classinfo_register(int access, char*package, char*name, int num_interfaces)
+classinfo_t* classinfo_register(int access, const char*package, const char*name, int num_interfaces)
{
classinfo_t*c = rfx_calloc(sizeof(classinfo_t)+(sizeof(classinfo_t*)*(num_interfaces+1)));
c->interfaces[0] = 0;
dict_put(&cls->members, name, m);
return m;
}
+memberinfo_t* memberinfo_register_global(U8 access, const char*package, const char*name, U8 kind)
+{
+ NEW(memberinfo_t, m);
+ m->kind = kind;
+ m->flags = FLAG_STATIC;
+ m->name = name;
+ m->parent = 0;
+
+ classinfo_t*c = classinfo_register(access, package, name, 0);
+ c->function = m;
+ c->flags |= FLAG_METHOD;
+ return m;
+}
+
// --------------- builtin classes (from builtin.c) ----------------------
assert(c);
return c;
}
+
classinfo_t* registry_findclass(const char*package, const char*name)
{
assert(classes);
printf("%s.%s->%08x (%s.%s)\n", package, name, c, c->package, c->name);*/
return c;
}
+void registry_dumpclasses()
+{
+ int t;
+ for(t=0;t<classes->hashsize;t++) {
+ dictentry_t*e = classes->slots[t];
+ while(e) {
+ dictentry_t*next = e->next;
+ classinfo_t*i = (classinfo_t*)e->key;
+ printf("%s.%s\n", i->package, i->name);
+ e = e->next;
+ }
+ }
+}
+
memberinfo_t* registry_findmember(classinfo_t*cls, const char*name, char recursive)
{
if(!recursive) {
if(!c) c = registry_safefindclass("", "Number");
return c;
}
+classinfo_t* registry_getregexpclass() {
+ static classinfo_t*c = 0;
+ if(!c) c = registry_safefindclass("", "RegExp");
+ return c;
+}
classinfo_t* registry_getMovieClip() {
static classinfo_t*c = 0;
if(!c) c = registry_safefindclass("flash.display", "MovieClip");
return &nullclass;
}
+// ---------------------------------------------------------------------
+namespace_t flags2namespace(int flags, char*package)
+{
+ namespace_t ns;
+ ns.name = package;
+ if(flags&FLAG_PUBLIC) {
+ ns.access = ACCESS_PACKAGE;
+ } else if(flags&FLAG_PRIVATE) {
+ ns.access = ACCESS_PRIVATE;
+ } else if(flags&FLAG_PROTECTED) {
+ ns.access = ACCESS_PROTECTED;
+ } else if(flags&FLAG_NAMESPACE_ADOBE) {
+ ns.access = ACCESS_NAMESPACE;
+ assert(!package || !package[0]);
+ ns.name = "http://adobe.com/AS3/2006/builtin";
+ } else {
+ ns.access = ACCESS_PACKAGEINTERNAL;
+ }
+ return ns;
+}