added slot number to memberinfo
authorkramm <kramm>
Tue, 23 Dec 2008 18:47:36 +0000 (18:47 +0000)
committerkramm <kramm>
Tue, 23 Dec 2008 18:47:36 +0000 (18:47 +0000)
lib/as3/registry.c
lib/as3/registry.h

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;
index 9b70655..bc547e7 100644 (file)
@@ -46,13 +46,14 @@ char classinfo_equals(classinfo_t*c1, classinfo_t*c2);
 #define MEMBER_SLOT 1
 #define MEMBER_METHOD 2
 struct _memberinfo {
-    U8 type;
+    U8 kind;
     const char*name;
     union {
         classinfo_t*returnvalue;
         classinfo_t*type;
     };
     classinfo_list_t*params;
+    int slot;
 };
 
 extern type_t classinfo_type;
@@ -61,6 +62,7 @@ extern type_t function_signature_type;
 void registry_init();
         
 classinfo_t* classinfo_register(int access, char*package, char*name);
+memberinfo_t* memberinfo_register(classinfo_t*cls, const char*name, U8 type);
 
 // static multinames
 classinfo_t* registry_getanytype();
@@ -74,6 +76,7 @@ classinfo_t* registry_getbooleanclass();
 classinfo_t* registry_getMovieClip();
 
 classinfo_t* registry_findclass(const char*package, const char*name);
+memberinfo_t* registry_findmember(classinfo_t*cls, const char*name);
 
 void registry_fill_multiname(multiname_t*m, namespace_t*n, classinfo_t*c);
 multiname_t* classinfo_to_multiname(classinfo_t*cls);