From d0b5bf35596d89ca6273ea7d3bddcfc0c7a29146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Mon, 6 Sep 2010 15:32:07 +0200 Subject: [PATCH] AS2:Fixed Ifs, Added For..in, better Functions --- trunk/src/com/jpexs/asdec/action/Action.java | 114 +++++++++++++----- .../com/jpexs/asdec/action/gui/MainFrame.java | 2 +- .../jpexs/asdec/action/swf3/ActionGetURL.java | 2 +- .../asdec/action/swf3/ActionGoToLabel.java | 2 +- .../asdec/action/swf3/ActionGotoFrame.java | 2 +- .../asdec/action/swf3/ActionNextFrame.java | 2 +- .../jpexs/asdec/action/swf3/ActionPlay.java | 2 +- .../asdec/action/swf3/ActionPrevFrame.java | 2 +- .../asdec/action/swf3/ActionSetTarget.java | 2 +- .../jpexs/asdec/action/swf3/ActionStop.java | 2 +- .../asdec/action/swf3/ActionStopSounds.java | 2 +- .../action/swf3/ActionToggleQuality.java | 2 +- .../asdec/action/swf3/ActionWaitForFrame.java | 2 +- .../jpexs/asdec/action/swf4/ActionAdd.java | 2 +- .../jpexs/asdec/action/swf4/ActionAnd.java | 2 +- .../asdec/action/swf4/ActionAsciiToChar.java | 2 +- .../jpexs/asdec/action/swf4/ActionCall.java | 2 +- .../asdec/action/swf4/ActionCharToAscii.java | 2 +- .../asdec/action/swf4/ActionCloneSprite.java | 2 +- .../jpexs/asdec/action/swf4/ActionDivide.java | 2 +- .../asdec/action/swf4/ActionEndDrag.java | 2 +- .../jpexs/asdec/action/swf4/ActionEquals.java | 2 +- .../asdec/action/swf4/ActionGetProperty.java | 2 +- .../asdec/action/swf4/ActionGetTime.java | 2 +- .../asdec/action/swf4/ActionGetURL2.java | 2 +- .../asdec/action/swf4/ActionGetVariable.java | 2 +- .../asdec/action/swf4/ActionGotoFrame2.java | 2 +- .../jpexs/asdec/action/swf4/ActionLess.java | 2 +- .../action/swf4/ActionMBAsciiToChar.java | 2 +- .../action/swf4/ActionMBCharToAscii.java | 2 +- .../action/swf4/ActionMBStringExtract.java | 2 +- .../action/swf4/ActionMBStringLength.java | 2 +- .../asdec/action/swf4/ActionMultiply.java | 2 +- .../jpexs/asdec/action/swf4/ActionNot.java | 2 +- .../com/jpexs/asdec/action/swf4/ActionOr.java | 2 +- .../jpexs/asdec/action/swf4/ActionPop.java | 2 +- .../jpexs/asdec/action/swf4/ActionPush.java | 7 +- .../asdec/action/swf4/ActionRandomNumber.java | 2 +- .../asdec/action/swf4/ActionRemoveSprite.java | 2 +- .../asdec/action/swf4/ActionSetProperty.java | 2 +- .../asdec/action/swf4/ActionSetTarget2.java | 2 +- .../asdec/action/swf4/ActionSetVariable.java | 2 +- .../asdec/action/swf4/ActionStartDrag.java | 2 +- .../asdec/action/swf4/ActionStringAdd.java | 2 +- .../asdec/action/swf4/ActionStringEquals.java | 2 +- .../action/swf4/ActionStringExtract.java | 2 +- .../asdec/action/swf4/ActionStringLength.java | 2 +- .../asdec/action/swf4/ActionStringLess.java | 2 +- .../asdec/action/swf4/ActionSubtract.java | 2 +- .../asdec/action/swf4/ActionToInteger.java | 2 +- .../jpexs/asdec/action/swf4/ActionTrace.java | 2 +- .../action/swf4/ActionWaitForFrame2.java | 2 +- .../asdec/action/swf4/RegisterNumber.java | 4 +- .../jpexs/asdec/action/swf5/ActionAdd2.java | 2 +- .../jpexs/asdec/action/swf5/ActionBitAnd.java | 2 +- .../asdec/action/swf5/ActionBitLShift.java | 2 +- .../jpexs/asdec/action/swf5/ActionBitOr.java | 2 +- .../asdec/action/swf5/ActionBitRShift.java | 2 +- .../asdec/action/swf5/ActionBitURShift.java | 2 +- .../jpexs/asdec/action/swf5/ActionBitXor.java | 2 +- .../asdec/action/swf5/ActionCallFunction.java | 2 +- .../asdec/action/swf5/ActionCallMethod.java | 2 +- .../asdec/action/swf5/ActionConstantPool.java | 2 +- .../asdec/action/swf5/ActionDecrement.java | 2 +- .../asdec/action/swf5/ActionDefineLocal.java | 2 +- .../asdec/action/swf5/ActionDefineLocal2.java | 2 +- .../jpexs/asdec/action/swf5/ActionDelete.java | 2 +- .../asdec/action/swf5/ActionDelete2.java | 2 +- .../asdec/action/swf5/ActionEnumerate.java | 2 +- .../asdec/action/swf5/ActionEquals2.java | 2 +- .../asdec/action/swf5/ActionGetMember.java | 2 +- .../asdec/action/swf5/ActionIncrement.java | 2 +- .../asdec/action/swf5/ActionInitArray.java | 2 +- .../asdec/action/swf5/ActionInitObject.java | 2 +- .../jpexs/asdec/action/swf5/ActionLess2.java | 2 +- .../jpexs/asdec/action/swf5/ActionModulo.java | 2 +- .../asdec/action/swf5/ActionNewMethod.java | 2 +- .../asdec/action/swf5/ActionNewObject.java | 2 +- .../action/swf5/ActionPushDuplicate.java | 2 +- .../jpexs/asdec/action/swf5/ActionReturn.java | 2 +- .../asdec/action/swf5/ActionSetMember.java | 2 +- .../asdec/action/swf5/ActionStackSwap.java | 2 +- .../action/swf5/ActionStoreRegister.java | 9 +- .../asdec/action/swf5/ActionTargetPath.java | 2 +- .../asdec/action/swf5/ActionToNumber.java | 2 +- .../asdec/action/swf5/ActionToString.java | 2 +- .../jpexs/asdec/action/swf5/ActionTypeOf.java | 2 +- .../asdec/action/swf6/ActionEnumerate2.java | 2 +- .../asdec/action/swf6/ActionGreater.java | 2 +- .../asdec/action/swf6/ActionInstanceOf.java | 2 +- .../asdec/action/swf6/ActionStrictEquals.java | 2 +- .../action/swf6/ActionStringGreater.java | 2 +- .../jpexs/asdec/action/swf7/ActionCastOp.java | 2 +- .../action/swf7/ActionDefineFunction2.java | 1 + .../asdec/action/swf7/ActionExtends.java | 2 +- .../asdec/action/swf7/ActionImplementsOp.java | 2 +- .../jpexs/asdec/action/swf7/ActionThrow.java | 2 +- .../action/treemodel/FunctionTreeItem.java | 17 ++- .../action/treemodel/GetMemberTreeItem.java | 4 + .../treemodel/StoreRegisterTreeItem.java | 9 +- .../action/treemodel/TypeOfTreeItem.java | 2 +- .../treemodel/clauses/ForInTreeItem.java | 55 +++++++++ 102 files changed, 270 insertions(+), 136 deletions(-) create mode 100644 trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForInTreeItem.java diff --git a/trunk/src/com/jpexs/asdec/action/Action.java b/trunk/src/com/jpexs/asdec/action/Action.java index b64f5ef60..dc131cc68 100644 --- a/trunk/src/com/jpexs/asdec/action/Action.java +++ b/trunk/src/com/jpexs/asdec/action/Action.java @@ -6,6 +6,7 @@ import com.jpexs.asdec.action.parser.ParseException; import com.jpexs.asdec.action.parser.ParsedSymbol; import com.jpexs.asdec.action.swf4.*; import com.jpexs.asdec.action.swf5.*; +import com.jpexs.asdec.action.swf6.ActionEnumerate2; import com.jpexs.asdec.action.swf6.ActionStrictEquals; import com.jpexs.asdec.action.swf7.ActionDefineFunction2; import com.jpexs.asdec.action.swf7.ActionTry; @@ -21,6 +22,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.EmptyStackException; +import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -379,8 +381,9 @@ public class Action { * @param stack Stack * @param constants Constant pool * @param output Output + * @param regNames Register names */ - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { } @@ -541,24 +544,25 @@ public class Action { * @return String with Source code */ public static String actionsToSource(List actions, int version) { - List tree = actionsToTree(actions, version); + List tree = actionsToTree(new HashMap(),actions, version); return treeToString(tree); } /** * Converts list of actions to List of treeItems * + * @param regNames Register names * @param actions List of actions * @param version SWF version * @return List of treeItems */ - public static List actionsToTree(List actions, int version) { - return actionsToTree(new ArrayList(), new ArrayList(), getActionsAllIfsOrJumps(actions), new Stack(), new ConstantPool(), actions, 0, actions.size() - 1, version); + public static List actionsToTree(HashMap regNames,List actions, int version) { + return actionsToTree(regNames,new ArrayList(), new ArrayList(), getActionsAllIfsOrJumps(actions), new Stack(), new ConstantPool(), actions, 0, actions.size() - 1, version); } - private static Stack actionsToStackTree(List jumpsOrIfs, List actions, ConstantPool constants, int start, int end, int version) { + private static Stack actionsToStackTree(HashMap regNames,List jumpsOrIfs, List actions, ConstantPool constants, int start, int end, int version) { Stack ret = new Stack(); - actionsToTree(new ArrayList(), new ArrayList(), jumpsOrIfs, ret, constants, actions, start, end, version); + actionsToTree(regNames,new ArrayList(), new ArrayList(), jumpsOrIfs, ret, constants, actions, start, end, version); return ret; } @@ -576,10 +580,12 @@ public class Action { } } - private static List actionsToTree(List unknownJumps, List loopList, List jumpsOrIfs, Stack stack, ConstantPool constants, List actions, int start, int end, int version) { + private static List actionsToTree(HashMap registerNames,List unknownJumps, List loopList, List jumpsOrIfs, Stack stack, ConstantPool constants, List actions, int start, int end, int version) { List output = new ArrayList(); int ip = start; boolean isWhile = false; + boolean isForIn = false; + TreeItem inItem=null; int loopStart = 0; loopip: while (ip <= end + 1) { @@ -624,7 +630,7 @@ public class Action { if (((ActionIf) jif).getRef(version) == addr) { if (jif.getAddress() > addr) { jumpsOrIfs.remove(j); - List doBody = actionsToTree(unknownJumps, loopList, jumpsOrIfs, stack, constants, actions, ip, adr2ip(actions, jif.getAddress(), version) - 1, version); + List doBody = actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, stack, constants, actions, ip, adr2ip(actions, jif.getAddress(), version) - 1, version); Loop currentLoop = new Loop(ip, adr2ip(actions, jif.getAddress(), version) + 1); loopList.add(currentLoop); output.add(new DoWhileTreeItem(action, adr2ip(actions, jif.getAddress(), version) + 1, ip, doBody, stack.pop())); @@ -678,11 +684,14 @@ public class Action { output.add(new UnsupportedTreeItem(action, "ActionIf to jump back")); break; } - TreeItem expression = stack.pop(); - if (expression instanceof NotTreeItem) { - expression = ((NotTreeItem) expression).value; - } else { - expression = new NotTreeItem(action, expression); + TreeItem expression = null; + if(!isForIn){ + expression=stack.pop(); + if (expression instanceof NotTreeItem) { + expression = ((NotTreeItem) expression).value; + } else { + expression = new NotTreeItem(action, expression); + } } List onTrue = new ArrayList(); List onFalse = new ArrayList(); @@ -697,21 +706,36 @@ public class Action { if ((refIp > jumpIp) && (refIp <= end + 1)) { hasElse = true; jumpElseIp = adr2ip(actions, ((ActionJump) actions.get(jumpIp - 1)).getRef(version), version); - onFalse = actionsToTree(unknownJumps, loopList, jumpsOrIfs, falseStack, constants, actions, jumpIp, jumpElseIp - 1, version); + onFalse = actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, falseStack, constants, actions, jumpIp, jumpElseIp - 1, version); } } //} Loop currentLoop = null; - if (isWhile) { + if (isWhile||isForIn) { currentLoop = new Loop(loopStart, jumpIp); loopList.add(currentLoop); } boolean isFor = false; boolean isTernar = false; List finalExpression = null; + + TreeItem variableName=null; + if(isForIn){ + for(int t=ip+1;t<=end;t++){ + Action actionSV=actions.get(t); + actionSV.translate(stack, constants, output, registerNames); + if(actionSV instanceof ActionSetVariable){ + SetVariableTreeItem svt=(SetVariableTreeItem)output.remove(output.size()-1); + variableName=svt.name; + ip=t; + break; + } + } + } + try { - onTrue = actionsToTree(unknownJumps, loopList, jumpsOrIfs, trueStack, constants, actions, ip + 1, jumpIp - 1 - (hasElse || isWhile ? 1 : 0), version); + onTrue = actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, trueStack, constants, actions, ip + 1, jumpIp - 1 - (hasElse || isWhile || isForIn ? 1 : 0), version); if (onTrue.size() == 0 && trueStack.size() > 0) { isTernar = true; } @@ -740,13 +764,15 @@ public class Action { } } } - finalExpression = actionsToTree(unknownJumps, loopList, jumpsOrIfs, stack, constants, actions, adr2ip(actions, uje.addr, version), jumpIp - 2, version); + finalExpression = actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, stack, constants, actions, adr2ip(actions, uje.addr, version), jumpIp - 2, version); isFor = true; } else { //throw new ConvertException("Unknown pattern: jump to nowhere", ip); } } - if (isFor) { + if(isForIn){ + output.add(new ForInTreeItem(action,jumpIp, loopStart,variableName,inItem,onTrue)); + }else if (isFor) { output.add(new ForTreeItem(action, currentLoop.loopBreak, currentLoop.loopContinue, new ArrayList(), expression, finalExpression, onTrue)); } else if (isTernar) { stack.push(new TernarOpTreeItem(action, expression, trueStack.pop(), falseStack.pop())); @@ -758,10 +784,17 @@ public class Action { ip = (hasElse ? jumpElseIp : jumpIp); isWhile = false; isFor = false; + isForIn = false; continue; - } else if (action instanceof ActionTry) { + } else if(action instanceof ActionEnumerate2){ + loopStart=ip+1; + isForIn=true; + inItem=stack.pop(); + ip+=4; + continue; + }else if (action instanceof ActionTry) { ActionTry atry = (ActionTry) action; - List tryCommands = actionsToTree(unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, atry.tryBody, 0, atry.tryBody.size() - 1, version); + List tryCommands = actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, atry.tryBody, 0, atry.tryBody.size() - 1, version); TreeItem catchName; if (atry.catchInRegisterFlag) { catchName = new DirectValueTreeItem(atry, new RegisterNumber(atry.catchRegister), constants); @@ -771,25 +804,39 @@ public class Action { List catchExceptions = new ArrayList(); catchExceptions.add(catchName); List> catchCommands = new ArrayList>(); - catchCommands.add(actionsToTree(unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, atry.catchBody, 0, atry.catchBody.size() - 1, version)); - List finallyCommands = actionsToTree(unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, atry.finallyBody, 0, atry.finallyBody.size() - 1, version); + catchCommands.add(actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, atry.catchBody, 0, atry.catchBody.size() - 1, version)); + List finallyCommands = actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, atry.finallyBody, 0, atry.finallyBody.size() - 1, version); output.add(new TryTreeItem(tryCommands, catchExceptions, catchCommands, finallyCommands)); } else if (action instanceof ActionWith) { ActionWith awith = (ActionWith) action; - List withCommands = actionsToTree(unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, awith.actions, 0, awith.actions.size() - 1, version); + List withCommands = actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, awith.actions, 0, awith.actions.size() - 1, version); output.add(new WithTreeItem(action, stack.pop(), withCommands)); } else if (action instanceof ActionDefineFunction) { - FunctionTreeItem fti = new FunctionTreeItem(action, actionsToTree(unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, ((ActionDefineFunction) action).code, 0, ((ActionDefineFunction) action).code.size() - 1, version), constants); + FunctionTreeItem fti = new FunctionTreeItem(action,((ActionDefineFunction)action).functionName,((ActionDefineFunction)action).paramNames, actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, ((ActionDefineFunction) action).code, 0, ((ActionDefineFunction) action).code.size() - 1, version), constants); stack.push(fti); } else if (action instanceof ActionDefineFunction2) { - FunctionTreeItem fti = new FunctionTreeItem(action, actionsToTree(unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, ((ActionDefineFunction2) action).code, 0, ((ActionDefineFunction2) action).code.size() - 1, version), constants); + HashMap funcRegNames=(HashMap)registerNames.clone(); + for(int f=0;f<((ActionDefineFunction2)action).paramNames.size();f++){ + int reg=((ActionDefineFunction2)action).paramRegisters.get(f); + if(reg!=0) + funcRegNames.put(reg, ((ActionDefineFunction2)action).paramNames.get(f)); + } + int pos=1; + if(((ActionDefineFunction2)action).preloadThisFlag) {funcRegNames.put(pos, "this");pos++;} + if(((ActionDefineFunction2)action).preloadArgumentsFlag) {funcRegNames.put(pos, "arguments");pos++;} + if(((ActionDefineFunction2)action).preloadSuperFlag) {funcRegNames.put(pos, "super");pos++;} + if(((ActionDefineFunction2)action).preloadRootFlag) {funcRegNames.put(pos, "_root");pos++;} + if(((ActionDefineFunction2)action).preloadParentFlag) {funcRegNames.put(pos, "_parent");pos++;} + if(((ActionDefineFunction2)action).preloadGlobalFlag) {funcRegNames.put(pos, "_global");pos++;} + + FunctionTreeItem fti = new FunctionTreeItem(action,((ActionDefineFunction2)action).functionName,((ActionDefineFunction2)action).paramNames, actionsToTree(funcRegNames,unknownJumps, loopList, jumpsOrIfs, new Stack(), constants, ((ActionDefineFunction2) action).code, 0, ((ActionDefineFunction2) action).code.size() - 1, version), constants); stack.push(fti); } else if (action instanceof ActionPushDuplicate) { do { if (actions.get(ip + 1) instanceof ActionNot) { if (actions.get(ip + 2) instanceof ActionIf) { int nextPos = adr2ip(actions, ((ActionIf) actions.get(ip + 2)).getRef(version), version); - stack.push(new AndTreeItem(action, stack.pop(), actionsToStackTree(jumpsOrIfs, actions, constants, ip + 4 /*je tam pop*/, nextPos - 1, version).pop())); + stack.push(new AndTreeItem(action, stack.pop(), actionsToStackTree(registerNames,jumpsOrIfs, actions, constants, ip + 4 /*je tam pop*/, nextPos - 1, version).pop())); ip = nextPos; } else { output.add(new UnsupportedTreeItem(action, "ActionPushDuplicate with Not")); @@ -797,7 +844,7 @@ public class Action { } } else if (actions.get(ip + 1) instanceof ActionIf) { int nextPos = adr2ip(actions, ((ActionIf) actions.get(ip + 1)).getRef(version), version); - stack.push(new OrTreeItem(action, stack.pop(), actionsToStackTree(jumpsOrIfs, actions, constants, ip + 3, nextPos - 1, version).pop())); + stack.push(new OrTreeItem(action, stack.pop(), actionsToStackTree(registerNames,jumpsOrIfs, actions, constants, ip + 3, nextPos - 1, version).pop())); ip = nextPos; } else { output.add(new UnsupportedTreeItem(action, "ActionPushDuplicate with no If")); @@ -806,13 +853,14 @@ public class Action { action = actions.get(ip); } while (action instanceof ActionPushDuplicate); + continue; } else if (action instanceof ActionStoreRegister) { if ((ip + 1 <= end) && (actions.get(ip + 1) instanceof ActionPop)) { - action.translate(stack, constants, output); + action.translate(stack, constants, output, registerNames); stack.pop(); ip++; } else { - action.translate(stack, constants, output); + action.translate(stack, constants, output, registerNames); } } else if (action instanceof ActionStrictEquals) { if ((ip + 1 < actions.size()) && (actions.get(ip + 1) instanceof ActionIf)) { @@ -833,7 +881,7 @@ public class Action { do { ip++; if ((actions.get(ip - 1) instanceof ActionStrictEquals) && (actions.get(ip) instanceof ActionIf)) { - caseValues.add(actionsToStackTree(jumpsOrIfs, actions, constants, caseStart, ip - 2, version).pop()); + caseValues.add(actionsToStackTree(registerNames,jumpsOrIfs, actions, constants, caseStart, ip - 2, version).pop()); caseStart = ip + 1; caseBodyIps.add(adr2ip(actions, ((ActionIf) actions.get(ip)).getRef(version), version)); if (actions.get(ip + 1) instanceof ActionJump) { @@ -848,16 +896,16 @@ public class Action { if (i < caseBodyIps.size() - 1) { caseEnd = caseBodyIps.get(i + 1) - 1; } - caseCommands.add(actionsToTree(unknownJumps, loopList, jumpsOrIfs, stack, constants, actions, caseBodyIps.get(i), caseEnd, version)); + caseCommands.add(actionsToTree(registerNames,unknownJumps, loopList, jumpsOrIfs, stack, constants, actions, caseBodyIps.get(i), caseEnd, version)); } output.add(new SwitchTreeItem(action, defaultAddr, switchedObject, caseValues, caseCommands, null)); continue; } else { - action.translate(stack, constants, output); + action.translate(stack, constants, output, registerNames); } } else { try { - action.translate(stack, constants, output); + action.translate(stack, constants, output, registerNames); } catch (EmptyStackException ese) { output.add(new UnsupportedTreeItem(action, "Empty stack")); } diff --git a/trunk/src/com/jpexs/asdec/action/gui/MainFrame.java b/trunk/src/com/jpexs/asdec/action/gui/MainFrame.java index 6cf8c122c..df1854347 100644 --- a/trunk/src/com/jpexs/asdec/action/gui/MainFrame.java +++ b/trunk/src/com/jpexs/asdec/action/gui/MainFrame.java @@ -103,7 +103,7 @@ public class MainFrame extends JFrame implements TreeSelectionListener, ActionLi miSaveAs.addActionListener(this); JMenuItem miExport = new JMenuItem("Export..."); miExport.setActionCommand("EXPORT"); - miExport.addActionListener(this); + //miExport.addActionListener(this); menuFile.add(miOpen); menuFile.add(miSave); menuFile.add(miSaveAs); diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionGetURL.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionGetURL.java index bc1a4d71a..71a0e04e6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionGetURL.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionGetURL.java @@ -50,7 +50,7 @@ public class ActionGetURL extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new GetURLTreeItem(this, urlString, targetString)); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionGoToLabel.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionGoToLabel.java index c6e818d20..71a0244ef 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionGoToLabel.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionGoToLabel.java @@ -46,7 +46,7 @@ public class ActionGoToLabel extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new GotoLabelTreeItem(this, label)); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionGotoFrame.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionGotoFrame.java index b58fa6758..223ffd891 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionGotoFrame.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionGotoFrame.java @@ -45,7 +45,7 @@ public class ActionGotoFrame extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new GotoFrameTreeItem(this, frame)); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionNextFrame.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionNextFrame.java index 6f8413ad2..20b56959b 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionNextFrame.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionNextFrame.java @@ -20,7 +20,7 @@ public class ActionNextFrame extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "nextFrame();")); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionPlay.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionPlay.java index 5539a5704..dadd0d863 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionPlay.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionPlay.java @@ -19,7 +19,7 @@ public class ActionPlay extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "Play();")); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionPrevFrame.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionPrevFrame.java index 9e4bc549a..0b992fb75 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionPrevFrame.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionPrevFrame.java @@ -20,7 +20,7 @@ public class ActionPrevFrame extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "prevFrame();")); } } \ No newline at end of file diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionSetTarget.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionSetTarget.java index 97c7137ac..811bf95e6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionSetTarget.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionSetTarget.java @@ -46,7 +46,7 @@ public class ActionSetTarget extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new SetTargetTreeItem(this, targetName)); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionStop.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionStop.java index 6a0caee95..56212358e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionStop.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionStop.java @@ -20,7 +20,7 @@ public class ActionStop extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "stop();")); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionStopSounds.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionStopSounds.java index 96a587903..234b789a4 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionStopSounds.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionStopSounds.java @@ -19,7 +19,7 @@ public class ActionStopSounds extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "stopAllSounds();")); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionToggleQuality.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionToggleQuality.java index 573c19dd4..6b3285163 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionToggleQuality.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionToggleQuality.java @@ -20,7 +20,7 @@ public class ActionToggleQuality extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "toggleHighQuality();")); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionWaitForFrame.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionWaitForFrame.java index ca2840df5..9e765b009 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionWaitForFrame.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionWaitForFrame.java @@ -49,7 +49,7 @@ public class ActionWaitForFrame extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new WaitForFrameTreeItem(this, frame, skipCount)); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionAdd.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionAdd.java index f35b10d2e..f9c3ef7c4 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionAdd.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionAdd.java @@ -20,7 +20,7 @@ public class ActionAdd extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new AddTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionAnd.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionAnd.java index 88118e9ff..0d49ea4be 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionAnd.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionAnd.java @@ -20,7 +20,7 @@ public class ActionAnd extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new AndTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionAsciiToChar.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionAsciiToChar.java index 2559be345..426d44636 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionAsciiToChar.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionAsciiToChar.java @@ -20,7 +20,7 @@ public class ActionAsciiToChar extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new AsciiToCharTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionCall.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionCall.java index 84209fb8f..9b4e0f285 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionCall.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionCall.java @@ -20,7 +20,7 @@ public class ActionCall extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new CallTreeItem(this, stack.pop())); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionCharToAscii.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionCharToAscii.java index a015e2e0e..293f45104 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionCharToAscii.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionCharToAscii.java @@ -20,7 +20,7 @@ public class ActionCharToAscii extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new CharToAsciiTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionCloneSprite.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionCloneSprite.java index 7f33604a8..2e3af2053 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionCloneSprite.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionCloneSprite.java @@ -20,7 +20,7 @@ public class ActionCloneSprite extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem depth = stack.pop(); TreeItem target = stack.pop(); TreeItem source = stack.pop(); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionDivide.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionDivide.java index df83a5f60..9444914a6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionDivide.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionDivide.java @@ -21,7 +21,7 @@ public class ActionDivide extends Action { @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new DivideTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionEndDrag.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionEndDrag.java index 97db3ed4c..e6fcb2ef2 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionEndDrag.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionEndDrag.java @@ -20,7 +20,7 @@ public class ActionEndDrag extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "stopDrag();")); } } \ No newline at end of file diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionEquals.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionEquals.java index 9cd83cef5..245c12268 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionEquals.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionEquals.java @@ -20,7 +20,7 @@ public class ActionEquals extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new EqTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetProperty.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetProperty.java index d8b32d657..b7acb394f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetProperty.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetProperty.java @@ -21,7 +21,7 @@ public class ActionGetProperty extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem index = stack.pop(); TreeItem target = stack.pop(); int indexInt = 0; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetTime.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetTime.java index d34bb0b46..1a2bd210c 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetTime.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetTime.java @@ -20,7 +20,7 @@ public class ActionGetTime extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { stack.push(new SimpleActionTreeItem(this, "getTimer()")); } } \ No newline at end of file diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetURL2.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetURL2.java index 2df022666..414205b4f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetURL2.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetURL2.java @@ -57,7 +57,7 @@ public class ActionGetURL2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem targetString = stack.pop(); TreeItem urlString = stack.pop(); output.add(new GetURL2TreeItem(this, urlString, targetString, sendVarsMethod, loadTargetFlag, loadTargetFlag)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetVariable.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetVariable.java index 5616c2be6..b21d322ea 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetVariable.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetVariable.java @@ -20,7 +20,7 @@ public class ActionGetVariable extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem value=stack.pop(); stack.push(new GetVariableTreeItem(this,value)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGotoFrame2.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGotoFrame2.java index a6d718db2..cfde4eba8 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGotoFrame2.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGotoFrame2.java @@ -62,7 +62,7 @@ public class ActionGotoFrame2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem frame = stack.pop(); output.add(new GotoFrame2TreeItem(this, frame, sceneBiasFlag, playFlag, sceneBias)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionLess.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionLess.java index e1d543d29..c9732dee9 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionLess.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionLess.java @@ -20,7 +20,7 @@ public class ActionLess extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new LtTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBAsciiToChar.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBAsciiToChar.java index be43be8c2..646baa760 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBAsciiToChar.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBAsciiToChar.java @@ -20,7 +20,7 @@ public class ActionMBAsciiToChar extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new MBAsciiToCharTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBCharToAscii.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBCharToAscii.java index 6f5c6cf8a..1c385e1b1 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBCharToAscii.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBCharToAscii.java @@ -19,7 +19,7 @@ public class ActionMBCharToAscii extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new MBCharToAsciiTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringExtract.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringExtract.java index c3966143a..5c019706b 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringExtract.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringExtract.java @@ -20,7 +20,7 @@ public class ActionMBStringExtract extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem count = stack.pop(); TreeItem index = stack.pop(); TreeItem value = stack.pop(); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringLength.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringLength.java index b24d9cdb4..c8e96a7ed 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringLength.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringLength.java @@ -19,7 +19,7 @@ public class ActionMBStringLength extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new MBStringLengthTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMultiply.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMultiply.java index de6aebaaa..3f149ba9a 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMultiply.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMultiply.java @@ -20,7 +20,7 @@ public class ActionMultiply extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new MultiplyTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionNot.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionNot.java index d586d79e3..544ae077a 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionNot.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionNot.java @@ -20,7 +20,7 @@ public class ActionNot extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new NotTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionOr.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionOr.java index 517eb99bb..e2eba9fba 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionOr.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionOr.java @@ -20,7 +20,7 @@ public class ActionOr extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new OrTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionPop.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionPop.java index f12faa594..02a0fe745 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionPop.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionPop.java @@ -21,7 +21,7 @@ public class ActionPop extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem val = stack.pop(); if (!(val instanceof DirectValueTreeItem)) output.add(new VoidTreeItem(this, val)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionPush.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionPush.java index 6aa5ffbb2..283c385e8 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionPush.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionPush.java @@ -182,11 +182,16 @@ public class ActionPush extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { for (Object o : values) { if (o instanceof ConstantIndex) { o = constants.constants.get(((ConstantIndex) o).index); } + if (o instanceof RegisterNumber) { + if(regNames.containsKey(((RegisterNumber)o).number)){ + ((RegisterNumber)o).name=regNames.get(((RegisterNumber)o).number); + } + } stack.push(new DirectValueTreeItem(this, o, constants)); } } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionRandomNumber.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionRandomNumber.java index c0f9974b6..e1167014f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionRandomNumber.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionRandomNumber.java @@ -20,7 +20,7 @@ public class ActionRandomNumber extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem maximum = stack.pop(); stack.push(new RandomNumberTreeItem(this, maximum)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionRemoveSprite.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionRemoveSprite.java index 39b32e86b..e5d8bf211 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionRemoveSprite.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionRemoveSprite.java @@ -20,7 +20,7 @@ public class ActionRemoveSprite extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem target = stack.pop(); output.add(new RemoveSpriteTreeItem(this, target)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetProperty.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetProperty.java index e779bfdc5..35fe7f9f3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetProperty.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetProperty.java @@ -21,7 +21,7 @@ public class ActionSetProperty extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem value = stack.pop(); TreeItem index = stack.pop(); TreeItem target = stack.pop(); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetTarget2.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetTarget2.java index 169da0e11..f93eb3126 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetTarget2.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetTarget2.java @@ -20,7 +20,7 @@ public class ActionSetTarget2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem target = stack.pop(); output.add(new SetTarget2TreeItem(this, target)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetVariable.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetVariable.java index 576993d99..5b0d9e1e3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetVariable.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetVariable.java @@ -20,7 +20,7 @@ public class ActionSetVariable extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem value = stack.pop(); TreeItem name = stack.pop(); output.add(new SetVariableTreeItem(this, name, value)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStartDrag.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStartDrag.java index 86c8cda1d..ca1f4d1f8 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStartDrag.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStartDrag.java @@ -21,7 +21,7 @@ public class ActionStartDrag extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem target = stack.pop(); TreeItem lockCenter = stack.pop(); TreeItem constrain = stack.pop(); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringAdd.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringAdd.java index b2af7bb2c..158c2e4e6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringAdd.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringAdd.java @@ -20,7 +20,7 @@ public class ActionStringAdd extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new StringAddTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringEquals.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringEquals.java index 40ae6326b..c71cf9df5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringEquals.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringEquals.java @@ -20,7 +20,7 @@ public class ActionStringEquals extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new StringEqTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringExtract.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringExtract.java index fb6ee5e99..2354dd195 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringExtract.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringExtract.java @@ -20,7 +20,7 @@ public class ActionStringExtract extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem count = stack.pop(); TreeItem index = stack.pop(); TreeItem value = stack.pop(); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLength.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLength.java index 8c53d15c5..c037b0b1d 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLength.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLength.java @@ -20,7 +20,7 @@ public class ActionStringLength extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new StringLengthTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLess.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLess.java index 64dded59f..4ba84f194 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLess.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLess.java @@ -20,7 +20,7 @@ public class ActionStringLess extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new StringLtTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionSubtract.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionSubtract.java index 086797587..d9766e359 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionSubtract.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionSubtract.java @@ -20,7 +20,7 @@ public class ActionSubtract extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new SubtractTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionToInteger.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionToInteger.java index e94b57712..0af04e99b 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionToInteger.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionToInteger.java @@ -20,7 +20,7 @@ public class ActionToInteger extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new ToIntegerTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionTrace.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionTrace.java index 5566ab679..6ce5caa9e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionTrace.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionTrace.java @@ -20,7 +20,7 @@ public class ActionTrace extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem value = stack.pop(); output.add(new TraceTreeItem(this, value)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionWaitForFrame2.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionWaitForFrame2.java index ae8152d81..c172ce101 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionWaitForFrame2.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionWaitForFrame2.java @@ -45,7 +45,7 @@ public class ActionWaitForFrame2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem frame = stack.pop(); output.add(new WaitForFrame2TreeItem(this, frame, skipCount)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf4/RegisterNumber.java b/trunk/src/com/jpexs/asdec/action/swf4/RegisterNumber.java index 6eae61bdb..60ec3cdff 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/RegisterNumber.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/RegisterNumber.java @@ -2,6 +2,7 @@ package com.jpexs.asdec.action.swf4; public class RegisterNumber { public int number; + public String name=null; public RegisterNumber(int number) { this.number = number; @@ -9,6 +10,7 @@ public class RegisterNumber { @Override public String toString() { - return "register" + number; + if(name==null) return "register" + number; + return name; } } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionAdd2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionAdd2.java index 5c0ba73a4..1e96f4163 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionAdd2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionAdd2.java @@ -19,7 +19,7 @@ public class ActionAdd2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new AddTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitAnd.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitAnd.java index a016f0ccf..28a49de41 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitAnd.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitAnd.java @@ -20,7 +20,7 @@ public class ActionBitAnd extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new BitAndTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitLShift.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitLShift.java index 461ddcd5b..fe60c4a15 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitLShift.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitLShift.java @@ -19,7 +19,7 @@ public class ActionBitLShift extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new LShiftTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitOr.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitOr.java index a80a4f372..6c5205f0b 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitOr.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitOr.java @@ -20,7 +20,7 @@ public class ActionBitOr extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new BitOrTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitRShift.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitRShift.java index 399ded238..f17a58991 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitRShift.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitRShift.java @@ -20,7 +20,7 @@ public class ActionBitRShift extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new RShiftTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitURShift.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitURShift.java index 9325c7008..b5e4076cf 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitURShift.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitURShift.java @@ -19,7 +19,7 @@ public class ActionBitURShift extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new URShiftTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitXor.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitXor.java index 31c30c2ce..953af4f3e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitXor.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitXor.java @@ -20,7 +20,7 @@ public class ActionBitXor extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new BitXorTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionCallFunction.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionCallFunction.java index 8412f281c..cb2f6e1b5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionCallFunction.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionCallFunction.java @@ -21,7 +21,7 @@ public class ActionCallFunction extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem functionName = stack.pop(); long numArgs = popLong(stack); List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionCallMethod.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionCallMethod.java index 6eb5f543c..2199eec72 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionCallMethod.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionCallMethod.java @@ -21,7 +21,7 @@ public class ActionCallMethod extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem methodName = stack.pop(); TreeItem scriptObject = stack.pop(); long numArgs = popLong(stack); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionConstantPool.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionConstantPool.java index ea0aad25b..5939bddf5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionConstantPool.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionConstantPool.java @@ -66,7 +66,7 @@ public class ActionConstantPool extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { constants.constants = constantPool; } } \ No newline at end of file diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDecrement.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDecrement.java index 706694123..640ecfa58 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDecrement.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDecrement.java @@ -20,7 +20,7 @@ public class ActionDecrement extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new DecrementTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal.java index 671cad416..ddc359def 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal.java @@ -20,7 +20,7 @@ public class ActionDefineLocal extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem value = stack.pop(); TreeItem name = stack.pop(); output.add(new DefineLocalTreeItem(this, name, value)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal2.java index 9ce2fa383..dbabd7ad9 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal2.java @@ -21,7 +21,7 @@ public class ActionDefineLocal2 extends Action { @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem name = stack.pop(); output.add(new DefineLocalTreeItem(this, name, null)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete.java index a86bc6781..12bf58319 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete.java @@ -22,7 +22,7 @@ public class ActionDelete extends Action { @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem propertyName = stack.pop(); TreeItem object = stack.pop(); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete2.java index a2fa7bff4..1a3deac3a 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete2.java @@ -21,7 +21,7 @@ public class ActionDelete2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem propertyName = stack.pop(); output.add(new DeleteTreeItem(this, null, propertyName)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionEnumerate.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionEnumerate.java index 32f346dd3..84e11323e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionEnumerate.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionEnumerate.java @@ -20,7 +20,7 @@ public class ActionEnumerate extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem object = stack.pop(); stack.push(new EnumerateTreeItem(this, object)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionEquals2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionEquals2.java index ebb9aec18..b16a82a88 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionEquals2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionEquals2.java @@ -20,7 +20,7 @@ public class ActionEquals2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new EqTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionGetMember.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionGetMember.java index d0c567e1a..b8ae3374e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionGetMember.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionGetMember.java @@ -20,7 +20,7 @@ public class ActionGetMember extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem functionName = stack.pop(); TreeItem object = stack.pop(); stack.push(new GetMemberTreeItem(this, object, functionName)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionIncrement.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionIncrement.java index 36c5570ad..73f09ab3e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionIncrement.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionIncrement.java @@ -20,7 +20,7 @@ public class ActionIncrement extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); stack.push(new IncrementTreeItem(this, a)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionInitArray.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionInitArray.java index a6aab6bc8..db28213ab 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionInitArray.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionInitArray.java @@ -16,7 +16,7 @@ public class ActionInitArray extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { long numArgs = popLong(stack); List args = new ArrayList(); for (int l = 0; l < numArgs; l++) { diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionInitObject.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionInitObject.java index 342ad5bfd..e6035fef6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionInitObject.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionInitObject.java @@ -21,7 +21,7 @@ public class ActionInitObject extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { long numArgs = popLong(stack); List values = new ArrayList(); List names = new ArrayList(); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionLess2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionLess2.java index c08ce649e..3df1aa5fb 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionLess2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionLess2.java @@ -20,7 +20,7 @@ public class ActionLess2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new LtTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionModulo.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionModulo.java index 22268254e..2ef551eb5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionModulo.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionModulo.java @@ -20,7 +20,7 @@ public class ActionModulo extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new ModuloTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionNewMethod.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionNewMethod.java index 32c4f41f4..4f3b42ef0 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionNewMethod.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionNewMethod.java @@ -21,7 +21,7 @@ public class ActionNewMethod extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem methodName = stack.pop(); TreeItem scriptObject = stack.pop(); long numArgs = popLong(stack); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionNewObject.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionNewObject.java index d8271a509..e97c6cec4 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionNewObject.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionNewObject.java @@ -21,7 +21,7 @@ public class ActionNewObject extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem objectName = stack.pop(); long numArgs = popLong(stack); List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionPushDuplicate.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionPushDuplicate.java index 03cd7e969..22c388705 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionPushDuplicate.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionPushDuplicate.java @@ -19,7 +19,7 @@ public class ActionPushDuplicate extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem value = stack.pop(); stack.push(value); stack.push(value); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionReturn.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionReturn.java index a9487b46a..6daf81d79 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionReturn.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionReturn.java @@ -20,7 +20,7 @@ public class ActionReturn extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem value = stack.pop(); output.add(new ReturnTreeItem(this, value)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionSetMember.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionSetMember.java index 01d1a0c2c..f1f1a141f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionSetMember.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionSetMember.java @@ -20,7 +20,7 @@ public class ActionSetMember extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem value = stack.pop(); TreeItem objectName = stack.pop(); TreeItem object = stack.pop(); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionStackSwap.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionStackSwap.java index 745b8cdfc..8c555a277 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionStackSwap.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionStackSwap.java @@ -19,7 +19,7 @@ public class ActionStackSwap extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(a); diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionStoreRegister.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionStoreRegister.java index 780883fd2..54beb39b8 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionStoreRegister.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionStoreRegister.java @@ -5,6 +5,7 @@ import com.jpexs.asdec.SWFOutputStream; import com.jpexs.asdec.action.Action; import com.jpexs.asdec.action.parser.FlasmLexer; import com.jpexs.asdec.action.parser.ParseException; +import com.jpexs.asdec.action.swf4.RegisterNumber; import com.jpexs.asdec.action.treemodel.ConstantPool; import com.jpexs.asdec.action.treemodel.StoreRegisterTreeItem; import com.jpexs.asdec.action.treemodel.TreeItem; @@ -45,8 +46,12 @@ public class ActionStoreRegister extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem item = stack.peek(); - output.add(new StoreRegisterTreeItem(this, registerNumber, item)); + RegisterNumber rn=new RegisterNumber(registerNumber); + if(regNames.containsKey(registerNumber)){ + rn.name=regNames.get(registerNumber); + } + output.add(new StoreRegisterTreeItem(this, rn, item)); } } \ No newline at end of file diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionTargetPath.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionTargetPath.java index 792b7b731..7e3b9878d 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionTargetPath.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionTargetPath.java @@ -20,7 +20,7 @@ public class ActionTargetPath extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem object = stack.pop(); stack.push(new TargetPathTreeItem(this, object)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionToNumber.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionToNumber.java index dd5866586..acac38a2d 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionToNumber.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionToNumber.java @@ -20,7 +20,7 @@ public class ActionToNumber extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem object = stack.pop(); stack.push(new ToNumberTreeItem(this, object)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionToString.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionToString.java index 884133278..1b959d62b 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionToString.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionToString.java @@ -20,7 +20,7 @@ public class ActionToString extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem object = stack.pop(); stack.push(new ToStringTreeItem(this, object)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionTypeOf.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionTypeOf.java index 2a024355d..2ce32eb40 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionTypeOf.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionTypeOf.java @@ -20,7 +20,7 @@ public class ActionTypeOf extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem object = stack.pop(); stack.push(new TypeOfTreeItem(this, object)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionEnumerate2.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionEnumerate2.java index 8b34722b7..101aa09c4 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionEnumerate2.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionEnumerate2.java @@ -19,7 +19,7 @@ public class ActionEnumerate2 extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem object = stack.pop(); stack.push(new EnumerateTreeItem(this, object)); } diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionGreater.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionGreater.java index 165e3a318..73afd5a0d 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionGreater.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionGreater.java @@ -20,7 +20,7 @@ public class ActionGreater extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new GtTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionInstanceOf.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionInstanceOf.java index 107b31866..34babe4df 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionInstanceOf.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionInstanceOf.java @@ -19,7 +19,7 @@ public class ActionInstanceOf extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new InstanceOfTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionStrictEquals.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionStrictEquals.java index acdc00777..d7c82b2ca 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionStrictEquals.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionStrictEquals.java @@ -20,7 +20,7 @@ public class ActionStrictEquals extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new StrictEqTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionStringGreater.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionStringGreater.java index fbcbcec91..d23612772 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionStringGreater.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionStringGreater.java @@ -20,7 +20,7 @@ public class ActionStringGreater extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem a = stack.pop(); TreeItem b = stack.pop(); stack.push(new GtTreeItem(this, b, a)); diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionCastOp.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionCastOp.java index c6aa96a48..b156ed76f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionCastOp.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionCastOp.java @@ -20,7 +20,7 @@ public class ActionCastOp extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem object = stack.pop(); TreeItem constructor = stack.pop(); stack.push(new CastOpTreeItem(this, constructor, object)); diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionDefineFunction2.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionDefineFunction2.java index a4b44e8ba..df5ca32b5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionDefineFunction2.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionDefineFunction2.java @@ -80,6 +80,7 @@ public class ActionDefineFunction2 extends Action { code = ASMParser.parse(labels, address + getPreLen(version), lexer, constantPool, version); } + @Override public byte[] getBytes(int version) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SWFOutputStream sos = new SWFOutputStream(baos, version); diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionExtends.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionExtends.java index c90df9e8a..e75379ad3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionExtends.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionExtends.java @@ -21,7 +21,7 @@ public class ActionExtends extends Action { @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem superclass = stack.pop(); TreeItem subclass = stack.pop(); output.add(new ExtendsTreeItem(this, subclass, superclass)); diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionImplementsOp.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionImplementsOp.java index 43b2c1df9..63db3bf85 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionImplementsOp.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionImplementsOp.java @@ -21,7 +21,7 @@ public class ActionImplementsOp extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem subclass = stack.pop(); long inCount = popLong(stack); List superclasses = new ArrayList(); diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionThrow.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionThrow.java index 1ad9910f7..4e74d8f15 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionThrow.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionThrow.java @@ -20,7 +20,7 @@ public class ActionThrow extends Action { } @Override - public void translate(Stack stack, ConstantPool constants, List output) { + public void translate(Stack stack, ConstantPool constants, List output, java.util.HashMap regNames) { TreeItem object = stack.pop(); output.add(new ThrowTreeItem(this, object)); } diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/FunctionTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/FunctionTreeItem.java index e785665e7..6e0decfe1 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/FunctionTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/FunctionTreeItem.java @@ -7,15 +7,28 @@ import java.util.List; public class FunctionTreeItem extends TreeItem { public List actions; public List constants; + public String functionName; + public List paramNames; - public FunctionTreeItem(Action instruction, List actions,ConstantPool constants) { + public FunctionTreeItem(Action instruction, String functionName,List paramNames,List actions,ConstantPool constants) { super(instruction,PRECEDENCE_PRIMARY); this.actions=actions; this.constants=constants.constants; + this.functionName=functionName; + this.paramNames=paramNames; } @Override public String toString(ConstantPool constants) { - return "function()\r\n{\r\n"+Action.treeToString(actions)+"}"; + String ret="function"; + if(!functionName.equals("")) + ret+=" "+functionName; + ret+="("; + for(int p=0;p0) ret+=", "; + ret+=paramNames.get(p); + } + ret+=")\r\n{\r\n"+Action.treeToString(actions)+"}"; + return ret; } } diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GetMemberTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GetMemberTreeItem.java index 02077d9c2..80acf3c9a 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GetMemberTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GetMemberTreeItem.java @@ -14,6 +14,10 @@ public class GetMemberTreeItem extends TreeItem { @Override public String toString(ConstantPool constants) { + if(!((functionName instanceof DirectValueTreeItem)&&(((DirectValueTreeItem)functionName).value instanceof String))){ + //if(!(functionName instanceof GetVariableTreeItem)) + return object.toString(constants) + "[" + stripQuotes(functionName)+"]"; + } return object.toString(constants) + "." + stripQuotes(functionName); } } diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/StoreRegisterTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/StoreRegisterTreeItem.java index f7f741b75..1e2adeabc 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/StoreRegisterTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/StoreRegisterTreeItem.java @@ -1,19 +1,20 @@ package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.swf4.RegisterNumber; public class StoreRegisterTreeItem extends TreeItem { - public int registerIndex; + public RegisterNumber register; public TreeItem value; - public StoreRegisterTreeItem(Action instruction, int registerIndex, TreeItem value) { + public StoreRegisterTreeItem(Action instruction, RegisterNumber register, TreeItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; - this.registerIndex = registerIndex; + this.register = register; } @Override public String toString(ConstantPool constants) { - return "register" + registerIndex + "=" + value.toString(constants) + ";"; + return register.toString() + "=" + value.toString(constants) + ";"; } } diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/TypeOfTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/TypeOfTreeItem.java index f3dbd9e2f..70d27e9b1 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/TypeOfTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/TypeOfTreeItem.java @@ -12,6 +12,6 @@ public class TypeOfTreeItem extends TreeItem { @Override public String toString(ConstantPool constants) { - return "TypeOf(" + value.toString(constants) + ")"; + return "typeof(" + value.toString(constants) + ")"; } } \ No newline at end of file diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForInTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForInTreeItem.java new file mode 100644 index 000000000..ddd50c4dc --- /dev/null +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForInTreeItem.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2010. JPEXS + */ + +package com.jpexs.asdec.action.treemodel.clauses; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.ConstantPool; +import com.jpexs.asdec.action.treemodel.ContinueTreeItem; +import com.jpexs.asdec.action.treemodel.EachTreeItem; +import com.jpexs.asdec.action.treemodel.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class ForInTreeItem extends LoopTreeItem implements Block { + + public TreeItem variableName; + public TreeItem enumVariable; + public List commands; + + public ForInTreeItem(Action instruction, int loopBreak, int loopContinue, TreeItem variableName,TreeItem enumVariable, List commands) { + super(instruction, loopBreak, loopContinue); + this.variableName = variableName; + this.enumVariable=enumVariable; + this.commands = commands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("for(") + stripQuotes(variableName) + " in "+enumVariable.toString(constants)+")\r\n{\r\n"; + for (TreeItem ti : commands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}") + "\r\n"; + ret += ":loop" + loopBreak; + return ret; + } + + public List getContinues() { + List ret = new ArrayList(); + for (TreeItem ti : commands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + return ret; + } +}