3 Routines for handling Flash2 AVM2 ABC Actionscript (header file)
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 */
32 DECLARE(abc_method_body);
33 DECLARE(abc_interface);
35 DECLARE(abc_exception);
36 DECLARE_LIST(abc_exception);
44 #define METHOD_NEED_ARGUMENTS 1
45 #define METHOD_NEED_ACTIVATION 2
46 #define METHOD_NEED_REST 4
47 #define METHOD_HAS_OPTIONAL 8
48 #define METHOD_SET_DXNS 0x40
49 #define METHOD_HAS_PARAM_NAMES 0x80
52 multiname_t*return_type;
53 multiname_list_t*parameters;
54 constant_list_t*optional_parameters;
57 abc_method_body_t*body;
61 int index; //filled in during writing
64 #define ABCFILE_LAZY 1
74 array_t*method_bodies;
77 abc_file_t*abc_file_new();
80 #define TRAIT_METHOD 1
81 #define TRAIT_GETTER 2
82 #define TRAIT_SETTER 3
84 #define TRAIT_FUNCTION 5
87 #define TRAIT_ATTR_FINAL 0x10
88 #define TRAIT_ATTR_OVERRIDE 0x20
89 #define TRAIT_ATTR_METADATA 0x40
94 unsigned char attributes;
105 multiname_t*type_name;
111 trait_t*trait_new_method(trait_list_t**traits, multiname_t*name, abc_method_t*m);
112 trait_t*trait_new_member(trait_list_t**traits, multiname_t*type, multiname_t*name, constant_t*v);
114 #define CLASS_SEALED 1
115 #define CLASS_FINAL 2
116 #define CLASS_INTERFACE 4
117 #define CLASS_PROTECTED_NS 8
122 multiname_t*classname;
123 multiname_t*superclass;
124 namespace_t*protectedNS;
126 multiname_list_t*interfaces;
128 abc_method_t*constructor;
131 abc_method_t*static_constructor;
132 trait_list_t*static_traits;
136 int init_scope_depth; // volatile, might be increased during code verification
138 int index; //filled in during writing
141 abc_method_t* abc_method_new(abc_file_t*file, multiname_t*returntype, char body);
143 abc_class_t* abc_class_new(abc_file_t*file, multiname_t*classname, multiname_t*superclass);
144 abc_class_t* abc_class_new2(abc_file_t*file, char*classname, char*superclass);
145 void abc_class_sealed(abc_class_t*c);
146 void abc_class_final(abc_class_t*c);
147 void abc_class_interface(abc_class_t*c);
148 void abc_class_protectedNS(abc_class_t*c, char*namespace);
149 void abc_class_add_interface(abc_class_t*c, multiname_t*interface);
151 trait_t* abc_class_find_slotid(abc_class_t*c, int slotid);
153 abc_method_t* abc_class_getconstructor(abc_class_t*cls, multiname_t*returntype);
154 abc_method_t* abc_class_getstaticconstructor(abc_class_t*cls, multiname_t*returntype);
156 abc_method_t* abc_class_method(abc_class_t*cls, multiname_t*returntype, multiname_t*name);
157 abc_method_t* abc_class_staticmethod(abc_class_t*cls, multiname_t*returntype, multiname_t*name);
158 trait_t* abc_class_slot(abc_class_t*cls, multiname_t*name, multiname_t*type);
159 trait_t* abc_class_staticslot(abc_class_t*cls, multiname_t*name, multiname_t*type);
161 struct _abc_exception {
165 multiname_t*exc_type;
166 multiname_t*var_name;
169 struct _abc_method_body {
176 //for dumping: filled in during parsing
180 int init_scope_depth;
183 int init_scope_depth; // volatile, might be increased during code verification
185 abc_exception_list_t* exceptions;
189 int index; // filled in during writing
190 codestats_t*stats; //filled in during writing
193 typedef struct _abc_script {
199 abc_method_t* abc_nullmethod(abc_file_t*file);
200 abc_script_t* abc_initscript(abc_file_t*file);
201 int abc_initscript_addClassTrait(abc_script_t*script, multiname_t*multiname, abc_class_t*cls);