started integrating expression ast
[swftools.git] / lib / as3 / registry.h
index 0640a78..a4ee9ac 100644 (file)
@@ -30,8 +30,10 @@ DECLARE(slotinfo);
 DECLARE(classinfo);
 DECLARE(memberinfo);
 DECLARE(methodinfo);
+DECLARE(unresolvedinfo);
 DECLARE(varinfo);
 DECLARE_LIST(classinfo);
+DECLARE_LIST(slotinfo);
 
 /* member/class flags */
 #define FLAG_FINAL 1
@@ -49,6 +51,7 @@ DECLARE_LIST(classinfo);
 #define INFOTYPE_SLOT 1
 #define INFOTYPE_METHOD 2
 #define INFOTYPE_CLASS 3
+#define INFOTYPE_UNRESOLVED 4
 #define SUBTYPE_GET 1
 #define SUBTYPE_SET 2
 #define SUBTYPE_GETSET 3
@@ -59,6 +62,13 @@ struct _slotinfo {
     const char*name;
     int slot;
 };
+struct _unresolvedinfo {
+    U8 kind,subtype,flags,access;
+    const char*package;
+    const char*name;
+    int slot;
+    namespace_list_t*nsset;
+};
 struct _classinfo {
     U8 kind,subtype,flags,access;
     const char*package;
@@ -99,20 +109,25 @@ struct _varinfo {
     constant_t*value;
 };
 
+extern type_t memberinfo_type;
 extern type_t slotinfo_type;
 char slotinfo_equals(slotinfo_t*c1, slotinfo_t*c2);
 
 void registry_init();
         
 classinfo_t* classinfo_register(int access, const char*package, const char*name, int num_interfaces);
-methodinfo_t* methodinfo_register_onclass(classinfo_t*cls, U8 access, const char*name);
+methodinfo_t* methodinfo_register_onclass(classinfo_t*cls, U8 access, const char*ns, const char*name);
 methodinfo_t* methodinfo_register_global(U8 access, const char*package, const char*name);
-varinfo_t* varinfo_register_onclass(classinfo_t*cls, U8 access, const char*name);
+varinfo_t* varinfo_register_onclass(classinfo_t*cls, U8 access,  const char*ns, const char*name);
 varinfo_t* varinfo_register_global(U8 access, const char*package, const char*name);
 
+slotinfo_t* registry_resolve(slotinfo_t*s);
+void registry_resolve_all();
+
 slotinfo_t* registry_find(const char*package, const char*name);
 void registry_dump();
-memberinfo_t* registry_findmember(classinfo_t*cls, const char*name, char superclasses);
+memberinfo_t* registry_findmember(classinfo_t*cls, const char*ns, const char*name, char superclasses);
+memberinfo_t* registry_findmember_nsset(classinfo_t*cls, namespace_list_t*ns, const char*name, char superclasses);
 
 void registry_fill_multiname(multiname_t*m, namespace_t*n, slotinfo_t*c);
 multiname_t* classinfo_to_multiname(slotinfo_t*cls);
@@ -125,6 +140,8 @@ classinfo_t* slotinfo_gettype(slotinfo_t*);
 
 namespace_t access2namespace(U8 access, char*package);
 
+char registry_ispackage(char*package);
+
 // static multinames
 classinfo_t* registry_getanytype();
 classinfo_t* registry_getarrayclass();
@@ -138,38 +155,39 @@ classinfo_t* registry_getregexpclass();
 classinfo_t* registry_getbooleanclass();
 classinfo_t* registry_getMovieClip();
 classinfo_t* registry_getclassclass(classinfo_t*a);
+classinfo_t* registry_getnamespaceclass();
 
 char* infotypename(slotinfo_t*s);
 
 /* convenience functions */
 #define sig2mname(x) (x->superclass,classinfo_to_multiname((slotinfo_t*)(x)))
-#define TYPE_ANY                  registry_getanytype()
-#define TYPE_IS_ANY(t)    ((t) == registry_getanytype())
-#define TYPE_INT                  registry_getintclass()
-#define TYPE_IS_INT(t)    ((t) == registry_getintclass())
-#define TYPE_UINT                 registry_getuintclass()
-#define TYPE_IS_UINT(t)   ((t) == registry_getuintclass())
-#define TYPE_NUMBER               registry_getnumberclass()
-#define TYPE_IS_NUMBER(t) ((t) == registry_getnumberclass())
-#define TYPE_FLOAT                registry_getnumberclass()
-#define TYPE_IS_FLOAT(t)  ((t) == registry_getnumberclass())
-#define TYPE_BOOLEAN              registry_getbooleanclass()
-#define TYPE_IS_BOOLEAN(t)((t) == registry_getbooleanclass())
-#define TYPE_STRING               registry_getstringclass()
-#define TYPE_IS_STRING(t) ((t) == registry_getstringclass())
-#define TYPE_REGEXP               registry_getregexpclass()
-#define TYPE_IS_REGEXP(t) ((t) == registry_getregexpclass())
-
-#define TYPE_OBJECT               registry_getobjectclass()
-
-#define TYPE_FUNCTION(f)          ((f)->return_type,slotinfo_asclass((slotinfo_t*)(f)))
-#define TYPE_IS_FUNCTION(t)       registry_isfunctionclass(t)
-
-#define TYPE_CLASS(f)             ((f)->superclass,slotinfo_asclass((slotinfo_t*)(f)))
-#define TYPE_IS_CLASS(t)          registry_isclassclass(t)
-
-#define TYPE_NULL                 registry_getnullclass()
-#define TYPE_IS_NULL(t)   ((t) == registry_getnullclass())
+
+#define TYPE_ANY                     registry_getanytype()
+#define TYPE_IS_ANY(t)       ((t) == registry_getanytype())
+#define TYPE_INT                     registry_getintclass()
+#define TYPE_IS_INT(t)       ((t) == registry_getintclass())
+#define TYPE_UINT                    registry_getuintclass()
+#define TYPE_IS_UINT(t)      ((t) == registry_getuintclass())
+#define TYPE_NUMBER                  registry_getnumberclass()
+#define TYPE_IS_NUMBER(t)    ((t) == registry_getnumberclass())
+#define TYPE_FLOAT                   registry_getnumberclass()
+#define TYPE_IS_FLOAT(t)     ((t) == registry_getnumberclass())
+#define TYPE_BOOLEAN                 registry_getbooleanclass()
+#define TYPE_IS_BOOLEAN(t)   ((t) == registry_getbooleanclass())
+#define TYPE_STRING                  registry_getstringclass()
+#define TYPE_IS_STRING(t)    ((t) == registry_getstringclass())
+#define TYPE_OBJECT                  registry_getobjectclass()
+#define TYPE_IS_OBJECT(t)    ((t) == registry_getobjectclass())
+#define TYPE_REGEXP                  registry_getregexpclass()
+#define TYPE_IS_REGEXP(t)    ((t) == registry_getregexpclass())
+#define TYPE_NAMESPACE            registry_getnamespaceclass()
+#define TYPE_IS_NAMESPACE(t) ((t) == registry_getnamespaceclass())
+#define TYPE_FUNCTION(f)     ((f)->return_type,slotinfo_asclass((slotinfo_t*)(f)))
+#define TYPE_IS_FUNCTION(t)  registry_isfunctionclass(t)
+#define TYPE_CLASS(f)        ((f)->superclass,slotinfo_asclass((slotinfo_t*)(f)))
+#define TYPE_IS_CLASS(t)     registry_isclassclass(t)
+#define TYPE_NULL            registry_getnullclass()
+#define TYPE_IS_NULL(t)      ((t) == registry_getnullclass())
         
 #define TYPE_IS_BUILTIN_SIMPLE(type) (TYPE_IS_INT(type) || \
                                       TYPE_IS_UINT(type) || \