removed parent element in abc_code
[swftools.git] / lib / as3 / code.h
1 #ifndef __abc_code_h__
2 #define __abc_code_h__
3
4 #include "../q.h"
5
6 DECLARE(abc_code);
7 DECLARE(codestats);
8
9 #include "abc.h"
10
11 typedef struct _opcode
12 {
13     unsigned char opcode;
14     char*name;
15     char*params;
16
17     int stack_minus;
18     int stack_plus;
19     int scope_stack_plus;
20     int flags;
21 } opcode_t;
22
23 struct _abc_code {
24     void*data[2];
25     abc_code_t*next;
26     abc_code_t*prev;
27
28     abc_code_t*branch;
29     int pos; //used during code path evaluation
30     
31     U8 opcode;
32 };
33
34 struct _codestats {
35     int max_stack;
36     int local_count;
37     int init_scope_depth;
38     int max_scope_depth;
39 };
40
41 abc_code_t*add_opcode(abc_code_t*atag, U8 op);
42
43 abc_code_t*code_parse(TAG*tag, int len, abc_file_t*file, pool_t*pool);
44 int        code_dump(abc_code_t*c, abc_file_t*file, char*prefix, FILE*fo);
45 void       code_write(TAG*tag, abc_code_t*code, pool_t*pool, abc_file_t*file);
46 void       code_free(abc_code_t*c);
47
48 codestats_t code_get_statistics(abc_code_t*code);
49
50
51 #endif