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 */
41 #define FLAG_OVERRIDE 8
42 #define FLAG_NATIVE 16
45 #define FLAG_DYNAMIC 8
46 #define FLAG_INTERFACE 16
48 #define INFOTYPE_SLOT 1
49 #define INFOTYPE_METHOD 2
50 #define INFOTYPE_CLASS 3
53 #define SUBTYPE_GETSET 3
56 U8 kind,subtype,flags,access;
62 U8 kind,subtype,flags,access;
66 classinfo_t*superclass;
68 void*data; //TODO: get rid of this- parser.y should pass type/value/code triples around
69 classinfo_t*interfaces[];
72 U8 kind,subtype,flags,access;
77 classinfo_t*return_type;
83 U8 kind,subtype,flags,access;
87 classinfo_t*return_type;
89 classinfo_list_t*params;
92 U8 kind,subtype,flags,access;
101 extern type_t slotinfo_type;
102 char slotinfo_equals(slotinfo_t*c1, slotinfo_t*c2);
104 void registry_init();
106 classinfo_t* classinfo_register(int access, const char*package, const char*name, int num_interfaces);
107 methodinfo_t* methodinfo_register_onclass(classinfo_t*cls, U8 access, const char*name);
108 methodinfo_t* methodinfo_register_global(U8 access, const char*package, const char*name);
109 varinfo_t* varinfo_register_onclass(classinfo_t*cls, U8 access, const char*name);
110 varinfo_t* varinfo_register_global(U8 access, const char*package, const char*name);
112 slotinfo_t* registry_find(const char*package, const char*name);
113 void registry_dump();
114 memberinfo_t* registry_findmember(classinfo_t*cls, const char*name, char superclasses);
116 void registry_fill_multiname(multiname_t*m, namespace_t*n, slotinfo_t*c);
117 multiname_t* classinfo_to_multiname(slotinfo_t*cls);
119 char registry_isfunctionclass();
120 char registry_isclassclass();
122 classinfo_t* slotinfo_asclass(slotinfo_t*f);
123 classinfo_t* slotinfo_gettype(slotinfo_t*);
125 namespace_t access2namespace(U8 access, char*package);
128 classinfo_t* registry_getanytype();
129 classinfo_t* registry_getarrayclass();
130 classinfo_t* registry_getobjectclass();
131 classinfo_t* registry_getnumberclass();
132 classinfo_t* registry_getstringclass();
133 classinfo_t* registry_getintclass();
134 classinfo_t* registry_getuintclass();
135 classinfo_t* registry_getnullclass();
136 classinfo_t* registry_getregexpclass();
137 classinfo_t* registry_getbooleanclass();
138 classinfo_t* registry_getMovieClip();
139 classinfo_t* registry_getclassclass(classinfo_t*a);
141 char* infotypename(slotinfo_t*s);
143 /* convenience functions */
144 #define sig2mname(x) (x->superclass,classinfo_to_multiname((slotinfo_t*)(x)))
145 #define TYPE_ANY registry_getanytype()
146 #define TYPE_IS_ANY(t) ((t) == registry_getanytype())
147 #define TYPE_INT registry_getintclass()
148 #define TYPE_IS_INT(t) ((t) == registry_getintclass())
149 #define TYPE_UINT registry_getuintclass()
150 #define TYPE_IS_UINT(t) ((t) == registry_getuintclass())
151 #define TYPE_NUMBER registry_getnumberclass()
152 #define TYPE_IS_NUMBER(t) ((t) == registry_getnumberclass())
153 #define TYPE_FLOAT registry_getnumberclass()
154 #define TYPE_IS_FLOAT(t) ((t) == registry_getnumberclass())
155 #define TYPE_BOOLEAN registry_getbooleanclass()
156 #define TYPE_IS_BOOLEAN(t)((t) == registry_getbooleanclass())
157 #define TYPE_STRING registry_getstringclass()
158 #define TYPE_IS_STRING(t) ((t) == registry_getstringclass())
159 #define TYPE_REGEXP registry_getregexpclass()
160 #define TYPE_IS_REGEXP(t) ((t) == registry_getregexpclass())
162 #define TYPE_OBJECT registry_getobjectclass()
164 #define TYPE_FUNCTION(f) ((f)->return_type,slotinfo_asclass((slotinfo_t*)(f)))
165 #define TYPE_IS_FUNCTION(t) registry_isfunctionclass(t)
167 #define TYPE_CLASS(f) ((f)->superclass,slotinfo_asclass((slotinfo_t*)(f)))
168 #define TYPE_IS_CLASS(t) registry_isclassclass(t)
170 #define TYPE_NULL registry_getnullclass()
171 #define TYPE_IS_NULL(t) ((t) == registry_getnullclass())
173 #define TYPE_IS_BUILTIN_SIMPLE(type) (TYPE_IS_INT(type) || \
174 TYPE_IS_UINT(type) || \
175 TYPE_IS_FLOAT(type) || \
176 TYPE_IS_BOOLEAN(type) || \
177 TYPE_IS_STRING(type))