From: kramm Date: Mon, 24 Nov 2008 16:13:37 +0000 (+0000) Subject: added flags generation X-Git-Tag: release-0-9-0~764 X-Git-Url: http://git.asbjorn.biz/?a=commitdiff_plain;ds=sidebyside;h=dbd04efb40a894c9d3d0c32c00e0e65d27115357;p=swftools.git added flags generation --- diff --git a/lib/as3/code.c b/lib/as3/code.c index 0c97998..ed59d22 100644 --- a/lib/as3/code.c +++ b/lib/as3/code.c @@ -526,6 +526,7 @@ typedef struct { int maxlocal; int maxstack; int maxscope; + int flags; } currentstats_t; static int stack_minus(code_t*c) @@ -620,6 +621,11 @@ static char callcode(currentstats_t*stats, int pos, int stack, int scope) stats->maxstack = stack; if(scope > stats->maxscope) stats->maxscope = scope; + + if(op->flags & OP_SET_DXNS) + stats->flags |= FLAGS_SET_DXNS; + if(op->flags & OP_NEED_ACTIVATION) + stats->flags |= FLAGS_ACTIVATION; if(op->flags & OP_REGISTER) { char*p = op->params; @@ -708,6 +714,7 @@ static currentstats_t* code_get_stats(code_t*code, exception_list_t*exceptions) current->maxstack = 0; current->maxscope = 0; current->num = num; + current->flags = 0; //#define DEBUG_BYTES #ifdef DEBUG_BYTES @@ -888,11 +895,12 @@ codestats_t* code_get_statistics(code_t*code, exception_list_t*exceptions) currentstats_t*current = code_get_stats(code, exceptions); if(!current) return 0; - codestats_t*stats = malloc(sizeof(codestats_t)); + codestats_t*stats = rfx_calloc(sizeof(codestats_t)); stats->local_count = current->maxlocal; stats->max_stack = current->maxstack; stats->init_scope_depth = 0; stats->max_scope_depth = current->maxscope; + stats->flags = current->flags; stats_free(current);current=0; return stats; diff --git a/lib/as3/code.h b/lib/as3/code.h index 5d94611..6cf00f3 100644 --- a/lib/as3/code.h +++ b/lib/as3/code.h @@ -40,11 +40,14 @@ struct _lookupswitch { code_list_t*targets; }; +#define FLAGS_ACTIVATION 0x02 +#define FLAGS_SET_DXNS 0x40 struct _codestats { int max_stack; int local_count; int init_scope_depth; int max_scope_depth; + int flags; }; struct _codelookup {