From: kramm Date: Fri, 19 Dec 2008 08:00:27 +0000 (+0000) Subject: renamed exception to abc_exception (to make MingW happy) X-Git-Tag: release-0-9-0~694 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=1b8d54ccb52b7dd1e327272a65d7b0c6b951a8fc renamed exception to abc_exception (to make MingW happy) --- diff --git a/lib/as3/abc.c b/lib/as3/abc.c index f44a090..f417e16 100644 --- a/lib/as3/abc.c +++ b/lib/as3/abc.c @@ -790,7 +790,7 @@ void* swf_ReadABC(TAG*tag) int s; c->exceptions = list_new(); for(s=0;sfrom = code_atposition(codelookup, swf_GetU30(tag)); e->to = code_atposition(codelookup, swf_GetU30(tag)); @@ -1081,14 +1081,14 @@ void swf_WriteABC(TAG*abctag, void*code) code_write(tag, c->code, pool, file); swf_SetU30(tag, list_length(c->exceptions)); - exception_list_t*l = c->exceptions; + abc_exception_list_t*l = c->exceptions; while(l) { // warning: assumes "pos" in each code_t is up-to-date - swf_SetU30(tag, l->exception->from->pos); - swf_SetU30(tag, l->exception->to->pos); - swf_SetU30(tag, l->exception->target->pos); - swf_SetU30(tag, pool_register_multiname(pool, l->exception->exc_type)); - swf_SetU30(tag, pool_register_multiname(pool, l->exception->var_name)); + swf_SetU30(tag, l->abc_exception->from->pos); + swf_SetU30(tag, l->abc_exception->to->pos); + swf_SetU30(tag, l->abc_exception->target->pos); + swf_SetU30(tag, pool_register_multiname(pool, l->abc_exception->exc_type)); + swf_SetU30(tag, pool_register_multiname(pool, l->abc_exception->var_name)); l = l->next; } @@ -1202,9 +1202,9 @@ void abc_file_free(abc_file_t*file) code_free(body->code);body->code=0; traits_free(body->traits);body->traits=0; - exception_list_t*ee = body->exceptions; + abc_exception_list_t*ee = body->exceptions; while(ee) { - exception_t*e=ee->exception;ee->exception=0; + abc_exception_t*e=ee->abc_exception;ee->abc_exception=0; e->from = e->to = e->target = 0; multiname_destroy(e->exc_type);e->exc_type=0; multiname_destroy(e->var_name);e->var_name=0; diff --git a/lib/as3/abc.h b/lib/as3/abc.h index bc4355b..54749f7 100644 --- a/lib/as3/abc.h +++ b/lib/as3/abc.h @@ -32,8 +32,8 @@ DECLARE(abc_method); DECLARE(abc_method_body); DECLARE(abc_interface); DECLARE(abc_class); -DECLARE(exception); -DECLARE_LIST(exception); +DECLARE(abc_exception); +DECLARE_LIST(abc_exception); #include "code.h" #include "opcodes.h" @@ -136,7 +136,7 @@ abc_method_body_t* abc_class_staticconstructor(abc_class_t*cls, multiname_t*retu abc_method_body_t* abc_class_constructor(abc_class_t*cls, multiname_t*returntype, int num_params, ...); abc_method_body_t* abc_class_method(abc_class_t*cls, multiname_t*returntype, char*name, int num_params, ...); -struct _exception { +struct _abc_exception { code_t*from; code_t*to; code_t*target; @@ -160,7 +160,7 @@ struct _abc_method_body { int init_scope_depth; // volatile, might be increased during code verification - exception_list_t* exceptions; + abc_exception_list_t* exceptions; trait_list_t*traits; diff --git a/lib/as3/code.c b/lib/as3/code.c index 4a18c52..d8fc1b3 100644 --- a/lib/as3/code.c +++ b/lib/as3/code.c @@ -197,7 +197,12 @@ opcode_t opcodes[]={ {0x95, "typeof", "", -1, 1, 0, 0}, {0xa7, "urshift", "", -2, 1, 0, 0}, -/* dummy instruction. Warning: this one are not actually supported by flash */ +/* opcodes not documented, but seen in the wild */ +//0x53: seen in builtin.abc- followed by 0x01 (might be the number of stack params) +{0x53, "xxx1", "", -1, 0, 0, 0}, +{0x01, "xxx2", "", 0, 0, 0, 0}, + +/* dummy instruction. Warning: this one is not actually supported by flash */ {0xff, "__break__", "", 0, 0, 0, OP_RETURN}, }; @@ -274,7 +279,7 @@ code_t*code_parse(TAG*tag, int len, abc_file_t*file, pool_t*pool, codelookup_t** opcode_t*op = opcode_get(opcode); if(!op) { fprintf(stderr, "Can't parse opcode %02x\n", opcode); - return head; + continue; } //printf("%s\n", op->name);fflush(stdout); NEW(code_t,c); @@ -770,7 +775,7 @@ static char callcode(currentstats_t*stats, int pos, int stack, int scope) return 1; } -static currentstats_t* code_get_stats(code_t*code, exception_list_t*exceptions) +static currentstats_t* code_get_stats(code_t*code, abc_exception_list_t*exceptions) { code = code_find_start(code); int num = 0; @@ -819,10 +824,10 @@ static currentstats_t* code_get_stats(code_t*code, exception_list_t*exceptions) free(current); return 0; } - exception_list_t*e = exceptions; + abc_exception_list_t*e = exceptions; while(e) { - if(e->exception->target) - callcode(current, e->exception->target->pos, 1, 0); + if(e->abc_exception->target) + callcode(current, e->abc_exception->target->pos, 1, 0); e = e->next; } @@ -837,9 +842,9 @@ void stats_free(currentstats_t*stats) } } -int code_dump(code_t*c, exception_list_t*exceptions, abc_file_t*file, char*prefix, FILE*fo) +int code_dump(code_t*c, abc_exception_list_t*exceptions, abc_file_t*file, char*prefix, FILE*fo) { - exception_list_t*e = exceptions; + abc_exception_list_t*e = exceptions; c = code_find_start(c); currentstats_t*stats = code_get_stats(c, exceptions); @@ -851,11 +856,11 @@ int code_dump(code_t*c, exception_list_t*exceptions, abc_file_t*file, char*prefi e = exceptions; while(e) { - if(c==e->exception->from) + if(c==e->abc_exception->from) fprintf(fo, "%s TRY {\n", prefix); - if(c==e->exception->target) { - char*s1 = multiname_tostring(e->exception->exc_type); - char*s2 = multiname_tostring(e->exception->var_name); + if(c==e->abc_exception->target) { + char*s1 = multiname_tostring(e->abc_exception->exc_type); + char*s2 = multiname_tostring(e->abc_exception->var_name); fprintf(fo, "%s CATCH(%s %s)\n", prefix, s1, s2); free(s1); free(s2); @@ -956,9 +961,9 @@ int code_dump(code_t*c, exception_list_t*exceptions, abc_file_t*file, char*prefi e = exceptions; while(e) { - if(c==e->exception->to) { - if(e->exception->target) - fprintf(fo, "%s } // END TRY (HANDLER: %d)\n", prefix, e->exception->target->pos); + if(c==e->abc_exception->to) { + if(e->abc_exception->target) + fprintf(fo, "%s } // END TRY (HANDLER: %d)\n", prefix, e->abc_exception->target->pos); else fprintf(fo, "%s } // END TRY (HANDLER: 00000000)\n", prefix); } @@ -972,7 +977,7 @@ int code_dump(code_t*c, exception_list_t*exceptions, abc_file_t*file, char*prefi return 1; } -codestats_t* code_get_statistics(code_t*code, exception_list_t*exceptions) +codestats_t* code_get_statistics(code_t*code, abc_exception_list_t*exceptions) { currentstats_t*current = code_get_stats(code, exceptions); if(!current) diff --git a/lib/as3/code.h b/lib/as3/code.h index 9dc03a7..d842814 100644 --- a/lib/as3/code.h +++ b/lib/as3/code.h @@ -80,13 +80,13 @@ struct _codelookup { code_t*add_opcode(code_t*atag, U8 op); code_t*code_parse(TAG*tag, int len, abc_file_t*file, pool_t*pool, codelookup_t**codelookup); -int code_dump(code_t*c, exception_list_t*exceptions, abc_file_t*file, char*prefix, FILE*fo); +int code_dump(code_t*c, abc_exception_list_t*exceptions, abc_file_t*file, char*prefix, FILE*fo); void code_write(TAG*tag, code_t*code, pool_t*pool, abc_file_t*file); void code_free(code_t*c); code_t* code_atposition(codelookup_t*l, int pos); void codelookup_free(codelookup_t*codelookup); -codestats_t* code_get_statistics(code_t*code, exception_list_t*exceptions); +codestats_t* code_get_statistics(code_t*code, abc_exception_list_t*exceptions); void codestats_print(codestats_t*s); void codestats_free(codestats_t*s);