From: kramm <kramm>
Date: Fri, 2 Jan 2009 19:46:19 +0000 (+0000)
Subject: warn about internal opcodes during writing
X-Git-Tag: release-0-9-0~482
X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=719f26744e38f9abbcadfc132b214dfd950a79fd;p=swftools.git

warn about internal opcodes during writing
---

diff --git a/lib/as3/code.c b/lib/as3/code.c
index aef16ed..8a729d4 100644
--- a/lib/as3/code.c
+++ b/lib/as3/code.c
@@ -37,6 +37,7 @@
 #define OP_LOOKUPSWITCH 512
 #define OP_NEED_ACTIVATION 1024
 #define OP_STACK_ARGS2 2048
+#define OP_INTERNAL 32768
 
 /* 2 = u30 index into multiname
    m = u30 index into method
@@ -200,8 +201,8 @@ opcode_t opcodes[]={
 {0x53, "applytype", "n",       -1, 1, 0, OP_STACK_ARGS},
 
 /* dummy instruction. Warning: this one is not actually supported by flash */
-{0xfe, "__continue__", "s",           0, 0, 0, OP_RETURN},
-{0xff, "__break__", "s",            0, 0, 0, OP_RETURN},
+{0xfe, "__continue__", "s",           0, 0, 0, OP_RETURN|OP_INTERNAL},
+{0xff, "__break__", "s",            0, 0, 0, OP_RETURN|OP_INTERNAL},
 };
 
 static U8 op2index[256] = {254};
@@ -459,6 +460,15 @@ static int opcode_write(TAG*tag, code_t*c, pool_t*pool, abc_file_t*file, int len
         swf_SetU8(tag, c->opcode);
     len++;
 
+    if(op->flags & OP_INTERNAL) {
+        if(c->opcode == OPCODE___BREAK__ ||
+           c->opcode == OPCODE___CONTINUE__) {
+            fprintf(stderr, "Unresolved %s\n", op->name);
+        } else {
+            fprintf(stderr, "Error: writing undefined internal opcode %s", op->name);
+        }
+    }
+
     while(*p) {
         void*data = c->data[pos++];
         assert(pos<=2);