3 Routines for compiling Flash2 AVM2 ABC Actionscript
5 Extension module for the rfxswf library.
6 Part of the swftools package.
8 Copyright (c) 2008 Matthias Kramm <kramm@quiss.org>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24 #ifndef __abc_registry_h__
25 #define __abc_registry_h__
34 DECLARE_LIST(classinfo);
36 /* member/class flags */
38 #define FLAG_BUILTIN 128
42 #define FLAG_OVERRIDE 8
43 #define FLAG_NATIVE 16
46 #define FLAG_DYNAMIC 8
47 #define FLAG_INTERFACE 16
49 #define INFOTYPE_SLOT 1
50 #define INFOTYPE_METHOD 2
51 #define INFOTYPE_CLASS 3
54 #define SUBTYPE_GETSET 3
57 U8 kind,subtype,flags,access;
63 U8 kind,subtype,flags,access;
67 classinfo_t*superclass;
69 void*data; //TODO: get rid of this- parser.y should pass type/value/code triples around
70 classinfo_t*interfaces[];
73 U8 kind,subtype,flags,access;
78 classinfo_t*return_type;
84 U8 kind,subtype,flags,access;
88 classinfo_t*return_type;
90 classinfo_list_t*params;
93 U8 kind,subtype,flags,access;
102 extern type_t slotinfo_type;
103 char slotinfo_equals(slotinfo_t*c1, slotinfo_t*c2);
105 void registry_init();
107 classinfo_t* classinfo_register(int access, const char*package, const char*name, int num_interfaces);
108 methodinfo_t* methodinfo_register_onclass(classinfo_t*cls, U8 access, const char*name);
109 methodinfo_t* methodinfo_register_global(U8 access, const char*package, const char*name);
110 varinfo_t* varinfo_register_onclass(classinfo_t*cls, U8 access, const char*name);
111 varinfo_t* varinfo_register_global(U8 access, const char*package, const char*name);
113 slotinfo_t* registry_find(const char*package, const char*name);
114 void registry_dump();
115 memberinfo_t* registry_findmember(classinfo_t*cls, const char*name, char superclasses);
117 void registry_fill_multiname(multiname_t*m, namespace_t*n, slotinfo_t*c);
118 multiname_t* classinfo_to_multiname(slotinfo_t*cls);
120 char registry_isfunctionclass();
121 char registry_isclassclass();
123 classinfo_t* slotinfo_asclass(slotinfo_t*f);
124 classinfo_t* slotinfo_gettype(slotinfo_t*);
126 namespace_t access2namespace(U8 access, char*package);
129 classinfo_t* registry_getanytype();
130 classinfo_t* registry_getarrayclass();
131 classinfo_t* registry_getobjectclass();
132 classinfo_t* registry_getnumberclass();
133 classinfo_t* registry_getstringclass();
134 classinfo_t* registry_getintclass();
135 classinfo_t* registry_getuintclass();
136 classinfo_t* registry_getnullclass();
137 classinfo_t* registry_getregexpclass();
138 classinfo_t* registry_getbooleanclass();
139 classinfo_t* registry_getMovieClip();
140 classinfo_t* registry_getclassclass(classinfo_t*a);
142 char* infotypename(slotinfo_t*s);
144 /* convenience functions */
145 #define sig2mname(x) (x->superclass,classinfo_to_multiname((slotinfo_t*)(x)))
146 #define TYPE_ANY registry_getanytype()
147 #define TYPE_IS_ANY(t) ((t) == registry_getanytype())
148 #define TYPE_INT registry_getintclass()
149 #define TYPE_IS_INT(t) ((t) == registry_getintclass())
150 #define TYPE_UINT registry_getuintclass()
151 #define TYPE_IS_UINT(t) ((t) == registry_getuintclass())
152 #define TYPE_NUMBER registry_getnumberclass()
153 #define TYPE_IS_NUMBER(t) ((t) == registry_getnumberclass())
154 #define TYPE_FLOAT registry_getnumberclass()
155 #define TYPE_IS_FLOAT(t) ((t) == registry_getnumberclass())
156 #define TYPE_BOOLEAN registry_getbooleanclass()
157 #define TYPE_IS_BOOLEAN(t)((t) == registry_getbooleanclass())
158 #define TYPE_STRING registry_getstringclass()
159 #define TYPE_IS_STRING(t) ((t) == registry_getstringclass())
160 #define TYPE_REGEXP registry_getregexpclass()
161 #define TYPE_IS_REGEXP(t) ((t) == registry_getregexpclass())
163 #define TYPE_OBJECT registry_getobjectclass()
165 #define TYPE_FUNCTION(f) ((f)->return_type,slotinfo_asclass((slotinfo_t*)(f)))
166 #define TYPE_IS_FUNCTION(t) registry_isfunctionclass(t)
168 #define TYPE_CLASS(f) ((f)->superclass,slotinfo_asclass((slotinfo_t*)(f)))
169 #define TYPE_IS_CLASS(t) registry_isclassclass(t)
171 #define TYPE_NULL registry_getnullclass()
172 #define TYPE_IS_NULL(t) ((t) == registry_getnullclass())
174 #define TYPE_IS_BUILTIN_SIMPLE(type) (TYPE_IS_INT(type) || \
175 TYPE_IS_UINT(type) || \
176 TYPE_IS_FLOAT(type) || \
177 TYPE_IS_BOOLEAN(type) || \
178 TYPE_IS_STRING(type))