From 3fb75ef418267cb0f7370d365b3a37b8013fbee9 Mon Sep 17 00:00:00 2001 From: kramm Date: Fri, 2 Jan 2009 19:53:40 +0000 Subject: [PATCH] added getarrayclass() --- lib/as3/registry.c | 5 +++++ lib/as3/registry.h | 27 +++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lib/as3/registry.c b/lib/as3/registry.c index a9cb163..f160b5c 100644 --- a/lib/as3/registry.c +++ b/lib/as3/registry.c @@ -227,6 +227,11 @@ classinfo_t* registry_getstringclass() { if(!c) c = registry_safefindclass("", "String"); return c; } +classinfo_t* registry_getarrayclass() { + static classinfo_t*c = 0; + if(!c) c = registry_safefindclass("", "Array"); + return c; +} classinfo_t* registry_getintclass() { static classinfo_t*c = 0; if(!c) c = registry_safefindclass("", "int"); diff --git a/lib/as3/registry.h b/lib/as3/registry.h index 77d1f89..0fb84a3 100644 --- a/lib/as3/registry.h +++ b/lib/as3/registry.h @@ -26,16 +26,21 @@ #include "pool.h" +DECLARE(packageinfo); DECLARE(classinfo); -DECLARE_LIST(classinfo); DECLARE(memberinfo); +DECLARE_LIST(classinfo); struct _classinfo { U8 access; U8 flags; const char*package; const char*name; - int slot; + union { + ptroff_t slot; // slot nr in initscript traits + classinfo_t*cls; // specific class of a Class type + memberinfo_t*function; //specific function of a Function type + }; classinfo_t*superclass; dict_t members; @@ -62,7 +67,7 @@ struct _memberinfo { }; extern type_t classinfo_type; -extern type_t function_signature_type; +extern type_t memberinfo_type; void registry_init(); @@ -71,6 +76,7 @@ memberinfo_t* memberinfo_register(classinfo_t*cls, const char*name, U8 type); // static multinames classinfo_t* registry_getanytype(); +classinfo_t* registry_getarrayclass(); classinfo_t* registry_getobjectclass(); classinfo_t* registry_getnumberclass(); classinfo_t* registry_getstringclass(); @@ -78,9 +84,9 @@ classinfo_t* registry_getintclass(); classinfo_t* registry_getuintclass(); classinfo_t* registry_getnullclass(); classinfo_t* registry_getbooleanclass(); -classinfo_t* registry_getfunctionclass(); classinfo_t* registry_getMovieClip(); -classinfo_t* registry_getfunctionclass(memberinfo_t*f); +classinfo_t* memberinfo_asclass(memberinfo_t*f); +classinfo_t* registry_getclassclass(classinfo_t*a); classinfo_t* registry_findclass(const char*package, const char*name); memberinfo_t* registry_findmember(classinfo_t*cls, const char*name); @@ -89,6 +95,10 @@ void registry_fill_multiname(multiname_t*m, namespace_t*n, classinfo_t*c); multiname_t* classinfo_to_multiname(classinfo_t*cls); char registry_isfunctionclass(); +char registry_isclassclass(); + +classinfo_t* memberinfo_gettype(memberinfo_t*); + /* convenience functions */ #define sig2mname(x) classinfo_to_multiname(x) #define TYPE_ANY registry_getanytype() @@ -106,9 +116,14 @@ char registry_isfunctionclass(); #define TYPE_STRING registry_getstringclass() #define TYPE_IS_STRING(t) ((t) == registry_getstringclass()) -#define TYPE_FUNCTION(f) registry_getfunctionclass(f) +#define TYPE_OBJECT registry_getobjectclass() + +#define TYPE_FUNCTION(f) memberinfo_asclass(f) #define TYPE_IS_FUNCTION(t) registry_isfunctionclass(t) +#define TYPE_CLASS(f) registry_getclassclass(f) +#define TYPE_IS_CLASS(t) registry_isclassclass(t) + #define TYPE_NULL registry_getnullclass() #define TYPE_IS_NULL(t) ((t) == registry_getnullclass()) -- 1.7.10.4