added slot number to memberinfo
[swftools.git] / lib / as3 / registry.c
index b43a5dd..293598f 100644 (file)
@@ -80,6 +80,7 @@ type_t memberinfo_type = {
 
 // ------------------------- constructors --------------------------------
 
+#define AVERAGE_NUMBER_OF_MEMBERS 8
 classinfo_t* classinfo_register(int access, char*package, char*name)
 {
     NEW(classinfo_t,c);
@@ -87,8 +88,17 @@ classinfo_t* classinfo_register(int access, char*package, char*name)
     c->package = package;
     c->name = name;
     dict_put(classes, c, c);
+    dict_init(&c->members,AVERAGE_NUMBER_OF_MEMBERS);
     return c;
 }
+memberinfo_t* memberinfo_register(classinfo_t*cls, const char*name, U8 kind)
+{
+    NEW(memberinfo_t,m);
+    m->kind = kind;
+    m->name = strdup(name);
+    dict_put(&cls->members, name, m);
+    return m;
+}
 
 // --------------- builtin classes (from builtin.c) ----------------------
 
@@ -113,6 +123,10 @@ classinfo_t* registry_findclass(const char*package, const char*name)
         printf("%s.%s->%08x (%s.%s)\n", package, name, c, c->package, c->name);*/
     return c;
 }
+memberinfo_t* registry_findmember(classinfo_t*cls, const char*name)
+{
+    return (memberinfo_t*)dict_lookup(&cls->members, name);
+}
 void registry_fill_multiname(multiname_t*m, namespace_t*n, classinfo_t*c)
 {
     m->type = QNAME;