added xxx1 opcodes
[swftools.git] / lib / as3 / opcodes.c
index ee43758..b21bccb 100644 (file)
@@ -12,7 +12,13 @@ code_t* abc_add_i(code_t*prev)
 code_t* abc_astype(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x86);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_astype2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x86);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_astypelate(code_t*prev)
@@ -56,21 +62,42 @@ code_t* abc_callmethod(code_t*prev, abc_method_body_t* m, int v)
 code_t* abc_callproplex(code_t*prev, char* name, int v)
 {
     code_t*self = add_opcode(prev, 0x4c);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    self->data[1] = (void*)(ptroff_t)v;
+    return self;
+}
+code_t* abc_callproplex2(code_t*prev, multiname_t* name, int v)
+{
+    code_t*self = add_opcode(prev, 0x4c);
+    self->data[0] = multiname_clone(name);
     self->data[1] = (void*)(ptroff_t)v;
     return self;
 }
 code_t* abc_callproperty(code_t*prev, char* name, int v)
 {
     code_t*self = add_opcode(prev, 0x46);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    self->data[1] = (void*)(ptroff_t)v;
+    return self;
+}
+code_t* abc_callproperty2(code_t*prev, multiname_t* name, int v)
+{
+    code_t*self = add_opcode(prev, 0x46);
+    self->data[0] = multiname_clone(name);
     self->data[1] = (void*)(ptroff_t)v;
     return self;
 }
 code_t* abc_callpropvoid(code_t*prev, char* name, int v)
 {
     code_t*self = add_opcode(prev, 0x4f);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    self->data[1] = (void*)(ptroff_t)v;
+    return self;
+}
+code_t* abc_callpropvoid2(code_t*prev, multiname_t* name, int v)
+{
+    code_t*self = add_opcode(prev, 0x4f);
+    self->data[0] = multiname_clone(name);
     self->data[1] = (void*)(ptroff_t)v;
     return self;
 }
@@ -84,14 +111,28 @@ code_t* abc_callstatic(code_t*prev, abc_method_t* m, int v)
 code_t* abc_callsuper(code_t*prev, char* name, int v)
 {
     code_t*self = add_opcode(prev, 0x45);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    self->data[1] = (void*)(ptroff_t)v;
+    return self;
+}
+code_t* abc_callsuper2(code_t*prev, multiname_t* name, int v)
+{
+    code_t*self = add_opcode(prev, 0x45);
+    self->data[0] = multiname_clone(name);
     self->data[1] = (void*)(ptroff_t)v;
     return self;
 }
 code_t* abc_callsupervoid(code_t*prev, char* name, int v)
 {
     code_t*self = add_opcode(prev, 0x4e);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    self->data[1] = (void*)(ptroff_t)v;
+    return self;
+}
+code_t* abc_callsupervoid2(code_t*prev, multiname_t* name, int v)
+{
+    code_t*self = add_opcode(prev, 0x4e);
+    self->data[0] = multiname_clone(name);
     self->data[1] = (void*)(ptroff_t)v;
     return self;
 }
@@ -103,7 +144,13 @@ code_t* abc_checkfilter(code_t*prev)
 code_t* abc_coerce(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x80);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_coerce2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x80);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_coerce_a(code_t*prev)
@@ -125,7 +172,14 @@ code_t* abc_construct(code_t*prev, int v)
 code_t* abc_constructprop(code_t*prev, char* name, int v)
 {
     code_t*self = add_opcode(prev, 0x4a);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    self->data[1] = (void*)(ptroff_t)v;
+    return self;
+}
+code_t* abc_constructprop2(code_t*prev, multiname_t* name, int v)
+{
+    code_t*self = add_opcode(prev, 0x4a);
+    self->data[0] = multiname_clone(name);
     self->data[1] = (void*)(ptroff_t)v;
     return self;
 }
@@ -208,7 +262,13 @@ code_t* abc_decrement_i(code_t*prev)
 code_t* abc_deleteproperty(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x6a);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_deleteproperty2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x6a);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_divide(code_t*prev)
@@ -250,19 +310,37 @@ code_t* abc_esc_xelem(code_t*prev)
 code_t* abc_findproperty(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x5e);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_findproperty2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x5e);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_findpropstrict(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x5d);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_findpropstrict2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x5d);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_getdescendants(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x59);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_getdescendants2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x59);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_getglobalscope(code_t*prev)
@@ -279,7 +357,13 @@ code_t* abc_getglobalslot(code_t*prev, int v)
 code_t* abc_getlex(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x60);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_getlex2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x60);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_getlocal(code_t*prev, int reg)
@@ -311,7 +395,13 @@ code_t* abc_getlocal_3(code_t*prev)
 code_t* abc_getproperty(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x66);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_getproperty2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x66);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_getscopeobject(code_t*prev, int v)
@@ -329,14 +419,25 @@ code_t* abc_getslot(code_t*prev, int v)
 code_t* abc_getsuper(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x04);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
     return self;
 }
-code_t* abc_greaterequals(code_t*prev)
+code_t* abc_getsuper2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x04);
+    self->data[0] = multiname_clone(name);
+    return self;
+}
+code_t* abc_greaterthan(code_t*prev)
 {
     code_t*self = add_opcode(prev, 0xaf);
     return self;
 }
+code_t* abc_greaterequals(code_t*prev)
+{
+    code_t*self = add_opcode(prev, 0xb0);
+    return self;
+}
 code_t* abc_hasnext(code_t*prev)
 {
     code_t*self = add_opcode(prev, 0x1f);
@@ -477,7 +578,13 @@ code_t* abc_increment_i(code_t*prev)
 code_t* abc_initproperty(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x68);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_initproperty2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x68);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_instanceof(code_t*prev)
@@ -488,7 +595,13 @@ code_t* abc_instanceof(code_t*prev)
 code_t* abc_istype(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0xb2);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_istype2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0xb2);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_istypelate(code_t*prev)
@@ -524,10 +637,10 @@ code_t* abc_lessthan(code_t*prev)
     code_t*self = add_opcode(prev, 0xad);
     return self;
 }
-code_t* abc_lookupswitch(code_t*prev, void* labels)
+code_t* abc_lookupswitch(code_t*prev, lookupswitch_t* l)
 {
     code_t*self = add_opcode(prev, 0x1b);
-    /* FIXME: write labels labels */
+    self->data[0] = l;
     return self;
 }
 code_t* abc_lshift(code_t*prev)
@@ -631,10 +744,12 @@ code_t* abc_pushbyte(code_t*prev, int v)
     self->data[0] = (void*)(ptroff_t)v;
     return self;
 }
-code_t* abc_pushdouble(code_t*prev, int v)
+code_t* abc_pushdouble(code_t*prev, double f)
 {
     code_t*self = add_opcode(prev, 0x2f);
-    self->data[0] = (void*)(ptroff_t)v;
+    double*fp = malloc(sizeof(double));
+    *fp = f;
+    self->data[0] = fp;
     return self;
 }
 code_t* abc_pushfalse(code_t*prev)
@@ -642,10 +757,10 @@ code_t* abc_pushfalse(code_t*prev)
     code_t*self = add_opcode(prev, 0x27);
     return self;
 }
-code_t* abc_pushint(code_t*prev, int v)
+code_t* abc_pushint(code_t*prev, int i)
 {
     code_t*self = add_opcode(prev, 0x2d);
-    self->data[0] = (void*)(ptroff_t)v;
+    self->data[0] = (void*)(ptroff_t)i;
     return self;
 }
 code_t* abc_pushnamespace(code_t*prev, int v)
@@ -686,10 +801,10 @@ code_t* abc_pushtrue(code_t*prev)
     code_t*self = add_opcode(prev, 0x26);
     return self;
 }
-code_t* abc_pushuint(code_t*prev, int v)
+code_t* abc_pushuint(code_t*prev, unsigned int u)
 {
     code_t*self = add_opcode(prev, 0x2e);
-    self->data[0] = (void*)(ptroff_t)v;
+    self->data[0] = (void*)(ptroff_t)u;
     return self;
 }
 code_t* abc_pushundefined(code_t*prev)
@@ -752,19 +867,31 @@ code_t* abc_setglobalslot(code_t*prev, int v)
 code_t* abc_setproperty(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x61);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_setproperty2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x61);
+    self->data[0] = multiname_clone(name);
     return self;
 }
-code_t* abc_setslot(code_t*prev, char* name)
+code_t* abc_setslot(code_t*prev, int v)
 {
     code_t*self = add_opcode(prev, 0x6d);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = (void*)(ptroff_t)v;
     return self;
 }
 code_t* abc_setsuper(code_t*prev, char* name)
 {
     code_t*self = add_opcode(prev, 0x05);
-    self->data[0] = multiname_fromstring(name); // FIXME
+    self->data[0] = multiname_fromstring(name);
+    return self;
+}
+code_t* abc_setsuper2(code_t*prev, multiname_t* name)
+{
+    code_t*self = add_opcode(prev, 0x05);
+    self->data[0] = multiname_clone(name);
     return self;
 }
 code_t* abc_strictequals(code_t*prev)
@@ -802,8 +929,18 @@ code_t* abc_urshift(code_t*prev)
     code_t*self = add_opcode(prev, 0xa7);
     return self;
 }
-code_t* abc_xxx(code_t*prev)
+code_t* abc_xxx1(code_t*prev)
 {
-    code_t*self = add_opcode(prev, 0xb0);
+    code_t*self = add_opcode(prev, 0x53);
+    return self;
+}
+code_t* abc_xxx2(code_t*prev)
+{
+    code_t*self = add_opcode(prev, 0x01);
+    return self;
+}
+code_t* abc___break__(code_t*prev)
+{
+    code_t*self = add_opcode(prev, 0xff);
     return self;
 }